More Rendering Fixes
This commit is contained in:
@@ -22,7 +22,7 @@ package appeng.bootstrap;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.bootstrap.components.BlockColorComponent;
|
||||
import appeng.bootstrap.components.RenderTypeComponent;
|
||||
import appeng.bootstrap.components.TileEntityRendererComponent;
|
||||
import appeng.client.render.model.AutoRotatingBakedModel;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.color.IBlockColor;
|
||||
@@ -105,12 +105,12 @@ class BlockRendering implements IBlockRendering
|
||||
{
|
||||
// This is a default rotating model if the base-block uses an AE tile entity which exposes UP/FRONT as
|
||||
// extended props
|
||||
// FIXME factory.addModelOverride( block.getRegistryName().getPath(), ( l, m ) -> new AutoRotatingModel( m ) );
|
||||
factory.addModelOverride( block.getRegistryName().getPath(), ( l, m ) -> new AutoRotatingBakedModel( m ) );
|
||||
}
|
||||
|
||||
// TODO : 1.12
|
||||
this.builtInModels.forEach( factory::addBuiltInModel );
|
||||
|
||||
// TODO : 1.12
|
||||
if( this.blockColor != null )
|
||||
{
|
||||
factory.addBootstrapComponent( new BlockColorComponent( block, this.blockColor ) );
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package appeng.bootstrap.components;
|
||||
|
||||
import appeng.bootstrap.IBootstrapComponent;
|
||||
import net.minecraftforge.client.event.ModelBakeEvent;
|
||||
|
||||
public interface IModelBakeComponent extends IBootstrapComponent {
|
||||
|
||||
void onModelBakeEvent(ModelBakeEvent event);
|
||||
|
||||
}
|
||||
@@ -29,15 +29,12 @@ import com.google.common.collect.Sets;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.model.ModelBakery;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.client.event.ModelBakeEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
|
||||
import appeng.core.AppEng;
|
||||
|
||||
|
||||
public class ModelOverrideComponent implements IPreInitComponent
|
||||
public class ModelOverrideComponent implements IModelBakeComponent
|
||||
{
|
||||
|
||||
// Maps from resource path to customizer
|
||||
@@ -48,13 +45,6 @@ public class ModelOverrideComponent implements IPreInitComponent
|
||||
this.customizer.put( resourcePath, customizer );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preInitialize( Dist dist )
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.register( this );
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onModelBakeEvent( final ModelBakeEvent event )
|
||||
{
|
||||
Map<ResourceLocation, IBakedModel> modelRegistry = event.getModelRegistry();
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.bootstrap.components;
|
||||
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
||||
|
||||
import appeng.tile.AEBaseTile;
|
||||
|
||||
|
||||
/**
|
||||
* Registers a TESR for a given tile entity class.
|
||||
*
|
||||
* @param <T>
|
||||
*/
|
||||
public class TileEntityRendererComponent<T extends AEBaseTile> implements IPreInitComponent
|
||||
{
|
||||
|
||||
private final TileEntityType<T> tileEntityType;
|
||||
|
||||
private final Function<? super TileEntityRendererDispatcher, ? extends TileEntityRenderer<? super T>> tileEntityRenderer;
|
||||
|
||||
public TileEntityRendererComponent(TileEntityType<T> tileEntityType,
|
||||
Function<? super TileEntityRendererDispatcher, ? extends TileEntityRenderer<? super T>> tileEntityRenderer)
|
||||
{
|
||||
this.tileEntityType = tileEntityType;
|
||||
this.tileEntityRenderer = tileEntityRenderer;
|
||||
}
|
||||
|
||||
@Override
|
||||
// public void modelReg( Dist dist )
|
||||
public void preInitialize( Dist dist )
|
||||
{
|
||||
ClientRegistry.bindTileEntityRenderer( tileEntityType, tileEntityRenderer);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user