Fixes #2398 by switching to use of the auto rotation

This commit is contained in:
Sebastian Hartte 2016-10-02 13:27:38 +02:00
parent c19d9d49f9
commit 18ea568e2a
4 changed files with 15 additions and 22 deletions

View File

@ -45,8 +45,6 @@ public class BlockCraftingMonitor extends BlockCraftingUnit
public static final UnlistedProperty<AEColor> COLOR = new UnlistedProperty<>( "color", AEColor.class );
public static final UnlistedProperty<EnumFacing> FORWARD = new UnlistedProperty<>( "forward", EnumFacing.class );
public BlockCraftingMonitor()
{
super( CraftingUnitType.MONITOR );
@ -59,7 +57,8 @@ public class BlockCraftingMonitor extends BlockCraftingUnit
return new ExtendedBlockState( this, getAEStates(), new IUnlistedProperty[] {
STATE,
COLOR,
FORWARD
FORWARD,
UP
} );
}
@ -68,15 +67,20 @@ public class BlockCraftingMonitor extends BlockCraftingUnit
{
AEColor color = AEColor.TRANSPARENT;
EnumFacing forward = EnumFacing.NORTH;
EnumFacing up = EnumFacing.UP;
TileCraftingMonitorTile te = getTileEntity( world, pos );
if( te != null )
{
color = te.getColor();
forward = te.getForward();
up = te.getUp();
}
return super.getExtendedState( state, world, pos ).withProperty( COLOR, color ).withProperty( FORWARD, forward );
return super.getExtendedState( state, world, pos )
.withProperty( COLOR, color )
.withProperty( FORWARD, forward )
.withProperty( UP, up );
}
@Override

View File

@ -59,7 +59,10 @@ public class CraftingCubeRendering extends BlockRenderingCustomizer
ResourceLocation baseName = new ResourceLocation( AppEng.MOD_ID, registryName );
// Disable auto-rotation
rendering.modelCustomizer( ( loc, model ) -> model );
if( type != BlockCraftingUnit.CraftingUnitType.MONITOR )
{
rendering.modelCustomizer( ( loc, model ) -> model );
}
// This is the standard blockstate model
ModelResourceLocation defaultModel = new ModelResourceLocation( baseName, "normal" );

View File

@ -63,10 +63,9 @@ class MonitorBakedModel extends CraftingCubeBakedModel
@Override
protected void addInnerCube( EnumFacing side, IBlockState state, CubeBuilder builder, float x1, float y1, float z1, float x2, float y2, float z2 )
{
EnumFacing forward = getForward( state );
// For sides other than the front, use the chassis texture
if( side != forward )
// The actual rotation of the cube is handled by the auto rotation as usual
if( side != EnumFacing.NORTH )
{
builder.setTexture( chassisTexture );
builder.addCube( x1, y1, z1, x2, y2, z2 );
@ -111,18 +110,4 @@ class MonitorBakedModel extends CraftingCubeBakedModel
return AEColor.TRANSPARENT;
}
private static EnumFacing getForward( IBlockState state )
{
if( state instanceof IExtendedBlockState )
{
IExtendedBlockState extState = (IExtendedBlockState) state;
EnumFacing forward = extState.getValue( BlockCraftingMonitor.FORWARD );
if( forward != null )
{
return forward;
}
}
return EnumFacing.NORTH;
}
}

View File

@ -1,6 +1,7 @@
{
"parent": "block/cube",
"textures": {
"particle": "appliedenergistics2:blocks/crafting/monitor",
"north": "appliedenergistics2:blocks/crafting/monitor",
"east": "appliedenergistics2:blocks/crafting/unit",
"west": "appliedenergistics2:blocks/crafting/unit",