Lots of compile fixes
This commit is contained in:
@@ -36,7 +36,7 @@ import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
|
||||
import appeng.block.crafting.BlockCraftingUnit;
|
||||
import appeng.block.crafting.AbstractCraftingUnitBlock;
|
||||
import appeng.client.render.cablebus.CubeBuilder;
|
||||
|
||||
|
||||
@@ -264,7 +264,7 @@ abstract class CraftingCubeBakedModel implements IBakedModel
|
||||
}
|
||||
|
||||
IExtendedBlockState extState = (IExtendedBlockState) state;
|
||||
CraftingCubeState cubeState = extState.getValue( BlockCraftingUnit.STATE );
|
||||
CraftingCubeState cubeState = extState.getValue( AbstractCraftingUnitBlock.STATE );
|
||||
if( cubeState == null )
|
||||
{
|
||||
return EnumSet.noneOf( Direction.class );
|
||||
|
||||
@@ -33,7 +33,7 @@ import net.minecraftforge.client.model.IModel;
|
||||
import net.minecraftforge.common.model.IModelState;
|
||||
import net.minecraftforge.common.model.TRSRTransformation;
|
||||
|
||||
import appeng.block.crafting.BlockCraftingUnit;
|
||||
import appeng.block.crafting.AbstractCraftingUnitBlock;
|
||||
import appeng.core.AppEng;
|
||||
|
||||
|
||||
@@ -58,9 +58,9 @@ class CraftingCubeModel implements IModel
|
||||
private final static ResourceLocation MONITOR_LIGHT_MEDIUM = texture( "monitor_light_medium" );
|
||||
private final static ResourceLocation MONITOR_LIGHT_BRIGHT = texture( "monitor_light_bright" );
|
||||
|
||||
private final BlockCraftingUnit.CraftingUnitType type;
|
||||
private final AbstractCraftingUnitBlock.CraftingUnitType type;
|
||||
|
||||
CraftingCubeModel( BlockCraftingUnit.CraftingUnitType type )
|
||||
CraftingCubeModel( AbstractCraftingUnitBlock.CraftingUnitType type )
|
||||
{
|
||||
this.type = type;
|
||||
}
|
||||
@@ -106,7 +106,7 @@ class CraftingCubeModel implements IModel
|
||||
}
|
||||
}
|
||||
|
||||
private static TextureAtlasSprite getLightTexture( Function<ResourceLocation, TextureAtlasSprite> textureGetter, BlockCraftingUnit.CraftingUnitType type )
|
||||
private static TextureAtlasSprite getLightTexture( Function<ResourceLocation, TextureAtlasSprite> textureGetter, AbstractCraftingUnitBlock.CraftingUnitType type )
|
||||
{
|
||||
switch( type )
|
||||
{
|
||||
|
||||
@@ -19,21 +19,15 @@
|
||||
package appeng.client.render.crafting;
|
||||
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.block.crafting.BlockCraftingUnit;
|
||||
import appeng.block.crafting.AbstractCraftingUnitBlock;
|
||||
import appeng.bootstrap.BlockRenderingCustomizer;
|
||||
import appeng.bootstrap.IBlockRendering;
|
||||
import appeng.bootstrap.IItemRendering;
|
||||
import appeng.core.AppEng;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
|
||||
/**
|
||||
@@ -44,9 +38,9 @@ public class CraftingCubeRendering extends BlockRenderingCustomizer
|
||||
|
||||
private final String registryName;
|
||||
|
||||
private final BlockCraftingUnit.CraftingUnitType type;
|
||||
private final AbstractCraftingUnitBlock.CraftingUnitType type;
|
||||
|
||||
public CraftingCubeRendering( String registryName, BlockCraftingUnit.CraftingUnitType type )
|
||||
public CraftingCubeRendering( String registryName, AbstractCraftingUnitBlock.CraftingUnitType type )
|
||||
{
|
||||
this.registryName = registryName;
|
||||
this.type = type;
|
||||
@@ -56,48 +50,47 @@ public class CraftingCubeRendering extends BlockRenderingCustomizer
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void customize( IBlockRendering rendering, IItemRendering itemRendering )
|
||||
{
|
||||
if (type != AbstractCraftingUnitBlock.CraftingUnitType.MONITOR) {
|
||||
rendering.renderType(RenderType.getCutout());
|
||||
}
|
||||
|
||||
ResourceLocation baseName = new ResourceLocation( AppEng.MOD_ID, this.registryName );
|
||||
|
||||
// Disable auto-rotation
|
||||
if( this.type != BlockCraftingUnit.CraftingUnitType.MONITOR )
|
||||
if( this.type != AbstractCraftingUnitBlock.CraftingUnitType.MONITOR )
|
||||
{
|
||||
rendering.modelCustomizer( ( loc, model ) -> model );
|
||||
}
|
||||
|
||||
// This is the standard blockstate model
|
||||
ModelResourceLocation defaultModel = new ModelResourceLocation( baseName, "normal" );
|
||||
|
||||
// This is the built-in model
|
||||
String builtInName = "models/block/crafting/" + this.registryName + "/builtin";
|
||||
ModelResourceLocation builtInModelName = new ModelResourceLocation( new ResourceLocation( AppEng.MOD_ID, builtInName ), "normal" );
|
||||
|
||||
rendering.builtInModel( builtInName, new CraftingCubeModel( this.type ) );
|
||||
|
||||
rendering.stateMapper( block -> this.mapState( block, defaultModel, builtInModelName ) );
|
||||
|
||||
if( this.type == BlockCraftingUnit.CraftingUnitType.MONITOR )
|
||||
{
|
||||
rendering.tileEntityRenderer( new CraftingMonitorTESR() );
|
||||
}
|
||||
// FIXME // This is the standard blockstate model
|
||||
// FIXME ModelResourceLocation defaultModel = new ModelResourceLocation( baseName, "normal" );
|
||||
// FIXME
|
||||
// FIXME // This is the built-in model
|
||||
// FIXME String builtInName = "models/block/crafting/" + this.registryName + "/builtin";
|
||||
// FIXME ModelResourceLocation builtInModelName = new ModelResourceLocation( new ResourceLocation( AppEng.MOD_ID, builtInName ), "normal" );
|
||||
// FIXME
|
||||
// FIXME rendering.builtInModel( builtInName, new CraftingCubeModel( this.type ) );
|
||||
// FIXME
|
||||
// FIXME rendering.stateMapper( block -> this.mapState( block, defaultModel, builtInModelName ) );
|
||||
|
||||
}
|
||||
|
||||
private Map<BlockState, ModelResourceLocation> mapState( Block block, ModelResourceLocation defaultModel, ModelResourceLocation formedModel )
|
||||
{
|
||||
Map<BlockState, ModelResourceLocation> result = new HashMap<>();
|
||||
for( BlockState state : block.getBlockState().getValidStates() )
|
||||
{
|
||||
if( state.getValue( BlockCraftingUnit.FORMED ) )
|
||||
{
|
||||
// Always use the builtin model if the multiblock is formed
|
||||
result.put( state, formedModel );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Use the default model
|
||||
result.put( state, defaultModel );
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
// FIXME private Map<BlockState, ModelResourceLocation> mapState( Block block, ModelResourceLocation defaultModel, ModelResourceLocation formedModel )
|
||||
// FIXME {
|
||||
// FIXME Map<BlockState, ModelResourceLocation> result = new HashMap<>();
|
||||
// FIXME for( BlockState state : block.getBlockState().getValidStates() )
|
||||
// FIXME {
|
||||
// FIXME if( state.get( AbstractCraftingUnitBlock.FORMED ) )
|
||||
// FIXME {
|
||||
// FIXME // Always use the builtin model if the multiblock is formed
|
||||
// FIXME result.put( state, formedModel );
|
||||
// FIXME }
|
||||
// FIXME else
|
||||
// FIXME {
|
||||
// FIXME // Use the default model
|
||||
// FIXME result.put( state, defaultModel );
|
||||
// FIXME }
|
||||
// FIXME }
|
||||
// FIXME return result;
|
||||
// FIXME }
|
||||
}
|
||||
|
||||
@@ -19,8 +19,10 @@
|
||||
package appeng.client.render.crafting;
|
||||
|
||||
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
@@ -37,27 +39,26 @@ import appeng.tile.crafting.TileCraftingMonitorTile;
|
||||
public class CraftingMonitorTESR extends TileEntityRenderer<TileCraftingMonitorTile>
|
||||
{
|
||||
|
||||
public CraftingMonitorTESR(TileEntityRendererDispatcher rendererDispatcherIn) {
|
||||
super(rendererDispatcherIn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render( TileCraftingMonitorTile te, double x, double y, double z, float partialTicks, int destroyStage, float p_render_10_ )
|
||||
{
|
||||
if( te == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
public void render(TileCraftingMonitorTile te, float partialTicks, MatrixStack matrixStack, IRenderTypeBuffer buffers, int combinedLight, int combinedOverlay) {
|
||||
|
||||
Direction facing = te.getForward();
|
||||
|
||||
IAEItemStack jobProgress = te.getJobProgress();
|
||||
if( jobProgress != null )
|
||||
{
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate( x + 0.5, y + 0.5, z + 0.5 );
|
||||
matrixStack.push();
|
||||
matrixStack.translate(0.5, 0.5, 0.5);
|
||||
|
||||
TesrRenderHelper.moveToFace( facing );
|
||||
TesrRenderHelper.rotateToFace( facing, (byte) 0 );
|
||||
TesrRenderHelper.renderItem2dWithAmount( jobProgress, 0.7f, 0.1f );
|
||||
TesrRenderHelper.moveToFace( matrixStack, facing );
|
||||
TesrRenderHelper.rotateToFace( matrixStack, facing, (byte) 0 );
|
||||
TesrRenderHelper.renderItem2dWithAmount(matrixStack, buffers, jobProgress, 0.7f, 0.1f );
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
matrixStack.pop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.util.Direction;
|
||||
|
||||
import appeng.block.crafting.BlockCraftingUnit;
|
||||
import appeng.block.crafting.AbstractCraftingUnitBlock;
|
||||
import appeng.client.render.cablebus.CubeBuilder;
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ class LightBakedModel extends CraftingCubeBakedModel
|
||||
builder.setTexture( this.baseTexture );
|
||||
builder.addCube( x1, y1, z1, x2, y2, z2 );
|
||||
|
||||
boolean powered = state.getValue( BlockCraftingUnit.POWERED );
|
||||
boolean powered = state.get( AbstractCraftingUnitBlock.POWERED );
|
||||
builder.setRenderFullBright( powered );
|
||||
builder.setTexture( this.lightTexture );
|
||||
builder.addCube( x1, y1, z1, x2, y2, z2 );
|
||||
|
||||
@@ -78,7 +78,7 @@ class MonitorBakedModel extends CraftingCubeBakedModel
|
||||
|
||||
// Now add the three layered light textures
|
||||
AEColor color = getColor( state );
|
||||
boolean powered = state.getValue( BlockCraftingMonitor.POWERED );
|
||||
boolean powered = state.get( BlockCraftingMonitor.POWERED );
|
||||
|
||||
builder.setRenderFullBright( powered );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user