Search in sources :

Example 16 with IProperty

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);
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) IProperty(net.minecraft.block.properties.IProperty) BlockPos(net.minecraft.util.math.BlockPos) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 17 with IProperty

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();
}
Also used : IProperty(net.minecraft.block.properties.IProperty)

Example 18 with IProperty

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;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) IProperty(net.minecraft.block.properties.IProperty) PropertyDirection(net.minecraft.block.properties.PropertyDirection)

Example 19 with IProperty

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);
}
Also used : IProperty(net.minecraft.block.properties.IProperty) ExtendedBlockState(net.minecraftforge.common.property.ExtendedBlockState) BlockStateContainer(net.minecraft.block.state.BlockStateContainer)

Example 20 with IProperty

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);
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) IProperty(net.minecraft.block.properties.IProperty) BlockPos(net.minecraft.util.BlockPos) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

IProperty (net.minecraft.block.properties.IProperty)29 IBlockState (net.minecraft.block.state.IBlockState)19 ItemStack (net.minecraft.item.ItemStack)8 Block (net.minecraft.block.Block)7 ResourceLocation (net.minecraft.util.ResourceLocation)6 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)6 DrawBlock (com.microsoft.Malmo.Schemas.DrawBlock)5 TileEntity (net.minecraft.tileentity.TileEntity)5 BlockStateContainer (net.minecraft.block.state.BlockStateContainer)4 JsonObject (com.google.gson.JsonObject)3 Variation (com.microsoft.Malmo.Schemas.Variation)3 ItemBlock (net.minecraft.item.ItemBlock)3 ComparableItemStack (blusunrize.immersiveengineering.api.ComparableItemStack)2 StateValue (com.almuradev.content.type.block.state.value.StateValue)2 ImmutableMap (com.google.common.collect.ImmutableMap)2 BlockType (com.microsoft.Malmo.Schemas.BlockType)2 Colour (com.microsoft.Malmo.Schemas.Colour)2 DrawItem (com.microsoft.Malmo.Schemas.DrawItem)2 ArrayList (java.util.ArrayList)2 Map (java.util.Map)2