Created
February 26, 2016 22:57
-
-
Save marchermans/c730ce31afcafc331f72 to your computer and use it in GitHub Desktop.
Anvil getExtendedState
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Get the actual Block state of this Block at the given position. This applies properties not visible in the | |
* metadata, such as fence connections. | |
* | |
* @param state | |
* @param world | |
* @param pos | |
*/ | |
@Override | |
public IBlockState getExtendedState (IBlockState state, IBlockAccess world, BlockPos pos) { | |
if (world.getTileEntity(pos) == null) return this.state.getBaseState(); | |
OBJModel.OBJState objState = ((IExtendedBlockState) state).getValue(OBJModel.OBJProperty.instance); | |
if (objState == null) | |
{ | |
ArrayList<String> parts = new ArrayList<>(); | |
parts.add(OBJModel.Group.ALL); | |
objState = new OBJModel.OBJState(parts, true); | |
} | |
objState.parent = new TRSRTransformation(state.getValue(FACING)); | |
return ((IExtendedBlockState)state).withProperty(PROPERTY_ANVIL_MATERIAL, (( BlackSmithsAnvilState) ((TileEntityBlackSmithsAnvil) world.getTileEntity(pos)).getState()).getMaterial().getID()).withProperty(OBJModel.OBJProperty.instance, objState); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment