Fixes broken controller rendering.
This commit is contained in:
parent
96a9e2f558
commit
9fe692c9bd
|
@ -23,14 +23,13 @@ import net.minecraft.block.Block;
|
|||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.tile.networking.TileController;
|
||||
|
@ -57,7 +56,7 @@ public class BlockController extends AEBaseTileBlock
|
|||
*/
|
||||
public enum ControllerRenderType implements IStringSerializable
|
||||
{
|
||||
block, column, inside_a, inside_b;
|
||||
block, column_x, column_y, column_z, inside_a, inside_b;
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
|
@ -71,12 +70,28 @@ public class BlockController extends AEBaseTileBlock
|
|||
|
||||
public static final PropertyEnum<ControllerRenderType> CONTROLLER_TYPE = PropertyEnum.create( "type", ControllerRenderType.class );
|
||||
|
||||
public BlockController()
|
||||
{
|
||||
super( Material.IRON );
|
||||
this.setTileEntity( TileController.class );
|
||||
this.setHardness( 6 );
|
||||
this.setDefaultState( getDefaultState()
|
||||
.withProperty( CONTROLLER_STATE, ControllerBlockState.offline )
|
||||
.withProperty( CONTROLLER_TYPE, ControllerRenderType.block ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IProperty[] getAEStates()
|
||||
{
|
||||
return new IProperty[] { CONTROLLER_STATE, CONTROLLER_TYPE };
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState()
|
||||
{
|
||||
return new BlockStateContainer( this, getAEStates() );
|
||||
}
|
||||
|
||||
/**
|
||||
* This will compute the AE_BLOCK_FORWARD, AE_BLOCK_UP and CONTROLLER_TYPE block states based on adjacent
|
||||
* controllers and the network state of this controller (offline, online, conflicted). This is used to
|
||||
|
@ -100,15 +115,15 @@ public class BlockController extends AEBaseTileBlock
|
|||
|
||||
if( xx && !yy && !zz )
|
||||
{
|
||||
type = ControllerRenderType.column;
|
||||
type = ControllerRenderType.column_x;
|
||||
}
|
||||
else if( !xx && yy && !zz )
|
||||
{
|
||||
type = ControllerRenderType.column;
|
||||
type = ControllerRenderType.column_y;
|
||||
}
|
||||
else if( !xx && !yy && zz )
|
||||
{
|
||||
type = ControllerRenderType.column;
|
||||
type = ControllerRenderType.column_z;
|
||||
}
|
||||
else if( ( xx ? 1 : 0 ) + ( yy ? 1 : 0 ) + ( zz ? 1 : 0 ) >= 2 )
|
||||
{
|
||||
|
@ -132,37 +147,7 @@ public class BlockController extends AEBaseTileBlock
|
|||
@Override
|
||||
public IBlockState getExtendedState( IBlockState state, IBlockAccess world, BlockPos pos )
|
||||
{
|
||||
// Only used for columns, really
|
||||
EnumFacing up = EnumFacing.UP;
|
||||
EnumFacing forward = EnumFacing.NORTH;
|
||||
|
||||
int x = pos.getX();
|
||||
int y = pos.getY();
|
||||
int z = pos.getZ();
|
||||
|
||||
// Detect whether controllers are on both sides of the x, y, and z axes
|
||||
final boolean xx = this.getTileEntity( world, x - 1, y, z ) instanceof TileController && this.getTileEntity( world, x + 1, y, z ) instanceof TileController;
|
||||
final boolean yy = this.getTileEntity( world, x, y - 1, z ) instanceof TileController && this.getTileEntity( world, x, y + 1, z ) instanceof TileController;
|
||||
final boolean zz = this.getTileEntity( world, x, y, z - 1 ) instanceof TileController && this.getTileEntity( world, x, y, z + 1 ) instanceof TileController;
|
||||
|
||||
if( xx && !yy && !zz )
|
||||
{
|
||||
up = EnumFacing.EAST;
|
||||
forward = EnumFacing.UP;
|
||||
}
|
||||
else if( !xx && yy && !zz )
|
||||
{
|
||||
up = EnumFacing.UP;
|
||||
forward = EnumFacing.NORTH;
|
||||
}
|
||||
else if( !xx && !yy && zz )
|
||||
{
|
||||
up = EnumFacing.NORTH;
|
||||
forward = EnumFacing.UP;
|
||||
}
|
||||
|
||||
IExtendedBlockState extState = (IExtendedBlockState) super.getExtendedState( state, world, pos );
|
||||
return extState.withProperty( FORWARD, forward ).withProperty( UP, up );
|
||||
return state;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -184,14 +169,6 @@ public class BlockController extends AEBaseTileBlock
|
|||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
public BlockController()
|
||||
{
|
||||
super( Material.IRON );
|
||||
this.setTileEntity( TileController.class );
|
||||
this.setHardness( 6 );
|
||||
this.setDefaultState( getDefaultState().withProperty( CONTROLLER_STATE, ControllerBlockState.offline ).withProperty( CONTROLLER_TYPE, ControllerRenderType.block ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void neighborChanged( final IBlockState state, final World w, final BlockPos pos, final Block neighborBlock )
|
||||
{
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
package appeng.block.networking;
|
||||
|
||||
|
||||
import appeng.bootstrap.BlockRenderingCustomizer;
|
||||
import appeng.bootstrap.IBlockRendering;
|
||||
import appeng.bootstrap.IItemRendering;
|
||||
|
||||
|
||||
public class ControllerRendering extends BlockRenderingCustomizer
|
||||
{
|
||||
@Override
|
||||
public void customize( IBlockRendering rendering, IItemRendering itemRendering )
|
||||
{
|
||||
// Disables the default model rotator
|
||||
rendering.modelCustomizer( ( loc, model ) -> model );
|
||||
}
|
||||
}
|
|
@ -64,6 +64,7 @@ import appeng.block.networking.BlockEnergyCellRendering;
|
|||
import appeng.block.networking.BlockWireless;
|
||||
import appeng.block.networking.CableBusColor;
|
||||
import appeng.block.networking.CableModelCustomizer;
|
||||
import appeng.block.networking.ControllerRendering;
|
||||
import appeng.block.qnb.BlockQuantumLinkChamber;
|
||||
import appeng.block.qnb.BlockQuantumRing;
|
||||
import appeng.block.spatial.BlockMatrixFrame;
|
||||
|
@ -274,7 +275,10 @@ public final class ApiBlocks implements IBlocks
|
|||
this.quantumLink = registry.block( "quantum_link", BlockQuantumLinkChamber::new ).features( AEFeature.QuantumNetworkBridge ).build();
|
||||
this.spatialPylon = registry.block( "spatial_pylon", BlockSpatialPylon::new ).features( AEFeature.SpatialIO ).build();
|
||||
this.spatialIOPort = registry.block( "spatial_ioport", BlockSpatialIOPort::new ).features( AEFeature.SpatialIO ).build();
|
||||
this.controller = registry.block( "controller", BlockController::new ).features( AEFeature.Channels ).build();
|
||||
this.controller = registry.block( "controller", BlockController::new )
|
||||
.features( AEFeature.Channels )
|
||||
.rendering( new ControllerRendering() )
|
||||
.build();
|
||||
this.drive = registry.block( "drive", BlockDrive::new )
|
||||
.features( AEFeature.StorageCells, AEFeature.MEDrive )
|
||||
.useCustomItemModel()
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
},
|
||||
{
|
||||
"apply": {
|
||||
"model": "appliedenergistics2:controller/controller_block_online.uvl"
|
||||
"model": "appliedenergistics2:controller/controller_block_online"
|
||||
},
|
||||
"when": {
|
||||
"state": "online",
|
||||
|
@ -20,38 +20,101 @@
|
|||
},
|
||||
{
|
||||
"apply": {
|
||||
"model": "appliedenergistics2:controller/controller_block_conflicted.uvl"
|
||||
"model": "appliedenergistics2:controller/controller_block_conflicted"
|
||||
},
|
||||
"when": {
|
||||
"state": "conflicted",
|
||||
"type": "block"
|
||||
}
|
||||
},
|
||||
{
|
||||
"apply": {
|
||||
"model": "appliedenergistics2:controller/controller_column_offline",
|
||||
"x": 90,
|
||||
"y": 90
|
||||
},
|
||||
"when": {
|
||||
"state": "offline",
|
||||
"type": "column_x"
|
||||
}
|
||||
},
|
||||
{
|
||||
"apply": {
|
||||
"model": "appliedenergistics2:controller/controller_column_offline"
|
||||
},
|
||||
"when": {
|
||||
"state": "offline",
|
||||
"type": "column"
|
||||
"type": "column_y"
|
||||
}
|
||||
},
|
||||
{
|
||||
"apply": {
|
||||
"model": "appliedenergistics2:controller/controller_column_online.uvl"
|
||||
"model": "appliedenergistics2:controller/controller_column_offline",
|
||||
"x": 90
|
||||
},
|
||||
"when": {
|
||||
"state": "offline",
|
||||
"type": "column_z"
|
||||
}
|
||||
},
|
||||
{
|
||||
"apply": {
|
||||
"model": "appliedenergistics2:controller/controller_column_online",
|
||||
"x": 90,
|
||||
"y": 90
|
||||
},
|
||||
"when": {
|
||||
"state": "online",
|
||||
"type": "column"
|
||||
"type": "column_x"
|
||||
}
|
||||
},
|
||||
{
|
||||
"apply": {
|
||||
"model": "appliedenergistics2:controller/controller_column_conflicted.uvl"
|
||||
"model": "appliedenergistics2:controller/controller_column_online"
|
||||
},
|
||||
"when": {
|
||||
"state": "online",
|
||||
"type": "column_y"
|
||||
}
|
||||
},
|
||||
{
|
||||
"apply": {
|
||||
"model": "appliedenergistics2:controller/controller_column_online",
|
||||
"x": 90
|
||||
},
|
||||
"when": {
|
||||
"state": "online",
|
||||
"type": "column_z"
|
||||
}
|
||||
},
|
||||
{
|
||||
"apply": {
|
||||
"model": "appliedenergistics2:controller/controller_column_conflicted",
|
||||
"x": 90,
|
||||
"y": 90
|
||||
},
|
||||
"when": {
|
||||
"state": "conflicted",
|
||||
"type": "column"
|
||||
"type": "column_x"
|
||||
}
|
||||
},
|
||||
{
|
||||
"apply": {
|
||||
"model": "appliedenergistics2:controller/controller_column_conflicted"
|
||||
},
|
||||
"when": {
|
||||
"state": "conflicted",
|
||||
"type": "column_y"
|
||||
}
|
||||
},
|
||||
{
|
||||
"apply": {
|
||||
"model": "appliedenergistics2:controller/controller_column_conflicted",
|
||||
"x": 90
|
||||
},
|
||||
"when": {
|
||||
"state": "conflicted",
|
||||
"type": "column_z"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
@ -1,23 +1,5 @@
|
|||
{
|
||||
"display": {
|
||||
"firstperson_righthand": {
|
||||
"rotation": [
|
||||
0,
|
||||
135,
|
||||
0
|
||||
],
|
||||
"scale": [
|
||||
0.40,
|
||||
0.40,
|
||||
0.40
|
||||
],
|
||||
"translation": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
"uvlMarker": true,
|
||||
"elements": [
|
||||
{
|
||||
"faces": {
|
|
@ -1,23 +1,5 @@
|
|||
{
|
||||
"display": {
|
||||
"firstperson_righthand": {
|
||||
"rotation": [
|
||||
0,
|
||||
135,
|
||||
0
|
||||
],
|
||||
"scale": [
|
||||
0.40,
|
||||
0.40,
|
||||
0.40
|
||||
],
|
||||
"translation": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
"uvlMarker": true,
|
||||
"elements": [
|
||||
{
|
||||
"faces": {
|
|
@ -1,23 +1,5 @@
|
|||
{
|
||||
"display": {
|
||||
"firstperson_righthand": {
|
||||
"rotation": [
|
||||
0,
|
||||
135,
|
||||
0
|
||||
],
|
||||
"scale": [
|
||||
0.40,
|
||||
0.40,
|
||||
0.40
|
||||
],
|
||||
"translation": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
"uvlMarker": true,
|
||||
"elements": [
|
||||
{
|
||||
"faces": {
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"parent": "block/cube_all",
|
||||
"parent": "block/cube_column",
|
||||
"textures": {
|
||||
"all": "appliedenergistics2:blocks/controller_column"
|
||||
"side": "appliedenergistics2:blocks/controller_column",
|
||||
"end": "appliedenergistics2:blocks/controller"
|
||||
}
|
||||
}
|
|
@ -1,23 +1,5 @@
|
|||
{
|
||||
"display": {
|
||||
"firstperson_righthand": {
|
||||
"rotation": [
|
||||
0,
|
||||
135,
|
||||
0
|
||||
],
|
||||
"scale": [
|
||||
0.40,
|
||||
0.40,
|
||||
0.40
|
||||
],
|
||||
"translation": [
|
||||
0,
|
||||
0,
|
||||
0
|
||||
]
|
||||
}
|
||||
},
|
||||
"uvlMarker": true,
|
||||
"elements": [
|
||||
{
|
||||
"faces": {
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"parent": "appliedenergistics2:block/controller/controller_block_offline"
|
||||
}
|
Loading…
Reference in New Issue