use of net.minecraft.block.properties.IProperty in project SecurityCraft by Geforce132.
the class ItemBlockReinforcedSlabs method canPlaceBlockOnSide.
@Override
@SideOnly(Side.CLIENT)
public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side, EntityPlayer player, ItemStack stack) {
BlockPos blockpos1 = pos;
IProperty iproperty = this.singleSlab.getVariantProperty();
Object object = this.singleSlab.getTypeForItem(stack);
IBlockState iblockstate = worldIn.getBlockState(pos);
if (iblockstate.getBlock() == this.singleSlab) {
boolean flag = iblockstate.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP;
if ((side == EnumFacing.UP && !flag || side == EnumFacing.DOWN && flag) && object == iblockstate.getValue(iproperty)) {
return true;
}
}
pos = pos.offset(side);
IBlockState iblockstate1 = worldIn.getBlockState(pos);
return iblockstate1.getBlock() == this.singleSlab && object == iblockstate1.getValue(iproperty) ? true : super.canPlaceBlockOnSide(worldIn, blockpos1, side, player, stack);
}
use of net.minecraft.block.properties.IProperty in project ImmersiveEngineering by BluSunrize.
the class ClientProxy method getPropertyString.
public static String getPropertyString(Map<IProperty, Comparable> propertyMap) {
StringBuilder stringbuilder = new StringBuilder();
for (Entry<IProperty, Comparable> entry : propertyMap.entrySet()) {
if (stringbuilder.length() != 0)
stringbuilder.append(",");
IProperty iproperty = entry.getKey();
Comparable comparable = entry.getValue();
stringbuilder.append(iproperty.getName());
stringbuilder.append("=");
stringbuilder.append(iproperty.getName(comparable));
}
if (stringbuilder.length() == 0)
stringbuilder.append("normal");
return stringbuilder.toString();
}
use of net.minecraft.block.properties.IProperty in project ImmersiveEngineering by BluSunrize.
the class BlockIETileProvider method getActualState.
@Override
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
state = super.getActualState(state, world, pos);
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof IAttachedIntegerProperies) {
for (String s : ((IAttachedIntegerProperies) tile).getIntPropertyNames()) state = applyProperty(state, ((IAttachedIntegerProperies) tile).getIntProperty(s), ((IAttachedIntegerProperies) tile).getIntPropertyValue(s));
}
if (tile instanceof IDirectionalTile && (state.getPropertyNames().contains(IEProperties.FACING_ALL) || state.getPropertyNames().contains(IEProperties.FACING_HORIZONTAL))) {
PropertyDirection prop = state.getPropertyNames().contains(IEProperties.FACING_HORIZONTAL) ? IEProperties.FACING_HORIZONTAL : IEProperties.FACING_ALL;
state = applyProperty(state, prop, ((IDirectionalTile) tile).getFacing());
} else if (state.getPropertyNames().contains(IEProperties.FACING_HORIZONTAL))
state = state.withProperty(IEProperties.FACING_HORIZONTAL, getDefaultFacing());
else if (state.getPropertyNames().contains(IEProperties.FACING_ALL))
state = state.withProperty(IEProperties.FACING_ALL, getDefaultFacing());
if (tile instanceof IActiveState) {
IProperty boolProp = ((IActiveState) tile).getBoolProperty(IActiveState.class);
if (state.getPropertyNames().contains(boolProp))
state = applyProperty(state, boolProp, ((IActiveState) tile).getIsActive());
}
if (tile instanceof IDualState) {
IProperty boolProp = ((IDualState) tile).getBoolProperty(IDualState.class);
if (state.getPropertyNames().contains(boolProp))
state = applyProperty(state, boolProp, ((IDualState) tile).getIsSecondState());
}
if (tile instanceof TileEntityMultiblockPart)
state = applyProperty(state, IEProperties.MULTIBLOCKSLAVE, ((TileEntityMultiblockPart) tile).isDummy());
else if (tile instanceof IHasDummyBlocks)
state = applyProperty(state, IEProperties.MULTIBLOCKSLAVE, ((IHasDummyBlocks) tile).isDummy());
if (tile instanceof IMirrorAble)
state = applyProperty(state, ((IMirrorAble) tile).getBoolProperty(IMirrorAble.class), ((IMirrorAble) tile).getIsMirrored());
return state;
}
use of net.minecraft.block.properties.IProperty in project ImmersiveEngineering by BluSunrize.
the class BlockIEBase method createNotTempBlockState.
protected BlockStateContainer createNotTempBlockState() {
IProperty[] array = new IProperty[1 + this.additionalProperties.length];
array[0] = this.property;
for (int i = 0; i < this.additionalProperties.length; i++) array[1 + i] = this.additionalProperties[i];
if (this.additionalUnlistedProperties.length > 0)
return new ExtendedBlockState(this, array, additionalUnlistedProperties);
return new BlockStateContainer(this, array);
}
use of net.minecraft.block.properties.IProperty in project SecurityCraft by Geforce132.
the class ItemBlockReinforcedSlabs method canPlaceBlockOnSide.
@Override
@SideOnly(Side.CLIENT)
public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side, EntityPlayer player, ItemStack stack) {
BlockPos blockpos1 = pos;
IProperty iproperty = singleSlab.getVariantProperty();
Object object = singleSlab.getVariant(stack);
IBlockState iblockstate = worldIn.getBlockState(pos);
if (iblockstate.getBlock() == singleSlab) {
boolean flag = iblockstate.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP;
if ((side == EnumFacing.UP && !flag || side == EnumFacing.DOWN && flag) && object == iblockstate.getValue(iproperty))
return true;
}
pos = pos.offset(side);
IBlockState iblockstate1 = worldIn.getBlockState(pos);
return iblockstate1.getBlock() == singleSlab && object == iblockstate1.getValue(iproperty) ? true : super.canPlaceBlockOnSide(worldIn, blockpos1, side, player, stack);
}
Aggregations