Java 类net.minecraft.block.properties.PropertyEnum 实例源码

项目:DecompiledMinecraft    文件:BlockFlower.java   
public IProperty<BlockFlower.EnumFlowerType> getTypeProperty()
{
    if (this.type == null)
    {
        this.type = PropertyEnum.<BlockFlower.EnumFlowerType>create("type", BlockFlower.EnumFlowerType.class, new Predicate<BlockFlower.EnumFlowerType>()
        {
            public boolean apply(BlockFlower.EnumFlowerType p_apply_1_)
            {
                return p_apply_1_.getBlockType() == BlockFlower.this.getBlockType();
            }
        });
    }

    return this.type;
}
项目:DecompiledMinecraft    文件:BlockFlower.java   
public IProperty<BlockFlower.EnumFlowerType> getTypeProperty()
{
    if (this.type == null)
    {
        this.type = PropertyEnum.<BlockFlower.EnumFlowerType>create("type", BlockFlower.EnumFlowerType.class, new Predicate<BlockFlower.EnumFlowerType>()
        {
            public boolean apply(BlockFlower.EnumFlowerType p_apply_1_)
            {
                return p_apply_1_.getBlockType() == BlockFlower.this.getBlockType();
            }
        });
    }

    return this.type;
}
项目:BaseClient    文件:BlockFlower.java   
public IProperty<BlockFlower.EnumFlowerType> getTypeProperty()
{
    if (this.type == null)
    {
        this.type = PropertyEnum.<BlockFlower.EnumFlowerType>create("type", BlockFlower.EnumFlowerType.class, new Predicate<BlockFlower.EnumFlowerType>()
        {
            public boolean apply(BlockFlower.EnumFlowerType p_apply_1_)
            {
                return p_apply_1_.getBlockType() == BlockFlower.this.getBlockType();
            }
        });
    }

    return this.type;
}
项目:BaseClient    文件:BlockFlower.java   
public IProperty<BlockFlower.EnumFlowerType> getTypeProperty()
{
    if (this.type == null)
    {
        this.type = PropertyEnum.<BlockFlower.EnumFlowerType>create("type", BlockFlower.EnumFlowerType.class, new Predicate<BlockFlower.EnumFlowerType>()
        {
            public boolean apply(BlockFlower.EnumFlowerType p_apply_1_)
            {
                return p_apply_1_.getBlockType() == BlockFlower.this.getBlockType();
            }
        });
    }

    return this.type;
}
项目:customstuff4    文件:BlockHelper.java   
/**
 * Gets the property for the given subtypes. Returns the same instance of a property for the same array of subtypes.
 * Order of the subtypes does not matter.
 */
public static PropertyEnum<EnumSubtype> getSubtypeProperty(int[] subtypes)
{
    int[] sortedSubtypes = Arrays.stream(subtypes)
                                 .distinct()
                                 .sorted()
                                 .toArray();

    return subtypeProperties.computeIfAbsent(new IntArray(sortedSubtypes), BlockHelper::createSubtypeProperty);
}
项目:customstuff4    文件:BlockHelperTests.java   
@Test
public void test_getSubtypeProperty()
{
    PropertyEnum<EnumSubtype> property = BlockHelper.getSubtypeProperty(new int[] {0, 5});
    Collection<EnumSubtype> allowedValues = property.getAllowedValues();

    assertEquals(2, allowedValues.size());
    assertTrue(allowedValues.contains(EnumSubtype.SUBTYPE0));
    assertTrue(allowedValues.contains(EnumSubtype.SUBTYPE5));
}
项目:customstuff4    文件:BlockHelperTests.java   
@Test
public void test_getSubtypeProperty_ignoresDuplicates()
{
    PropertyEnum<EnumSubtype> property = BlockHelper.getSubtypeProperty(new int[] {0, 0, 5, 5});
    Collection<EnumSubtype> allowedValues = property.getAllowedValues();

    assertEquals(2, allowedValues.size());
    assertTrue(allowedValues.contains(EnumSubtype.SUBTYPE0));
    assertTrue(allowedValues.contains(EnumSubtype.SUBTYPE5));
}
项目:customstuff4    文件:BlockHelperTests.java   
@Test
public void test_getSubtypeProperty_ignoresDuplicates2()
{
    PropertyEnum<EnumSubtype> property1 = BlockHelper.getSubtypeProperty(new int[] {0, 0, 5, 5});
    PropertyEnum<EnumSubtype> property2 = BlockHelper.getSubtypeProperty(new int[] {0, 5});

    assertSame(property1, property2);
}
项目:customstuff4    文件:BlockHelperTests.java   
@Test
public void test_getSubtypeProperty_multipleCallsReturnsSameProperty()
{
    PropertyEnum<EnumSubtype> property1 = BlockHelper.getSubtypeProperty(new int[] {0, 5});
    PropertyEnum<EnumSubtype> property2 = BlockHelper.getSubtypeProperty(new int[] {0, 5});

    assertSame(property1, property2);
}
项目:customstuff4    文件:BlockHelperTests.java   
@Test
public void test_getSubtypeProperty_subtypeOrderDoesNotMatter()
{
    PropertyEnum<EnumSubtype> property1 = BlockHelper.getSubtypeProperty(new int[] {0, 5});
    PropertyEnum<EnumSubtype> property2 = BlockHelper.getSubtypeProperty(new int[] {5, 0});

    assertSame(property1, property2);
}
项目:Backmemed    文件:BlockFlower.java   
public IProperty<BlockFlower.EnumFlowerType> getTypeProperty()
{
    if (this.type == null)
    {
        this.type = PropertyEnum.<BlockFlower.EnumFlowerType>create("type", BlockFlower.EnumFlowerType.class, new Predicate<BlockFlower.EnumFlowerType>()
        {
            public boolean apply(@Nullable BlockFlower.EnumFlowerType p_apply_1_)
            {
                return p_apply_1_.getBlockType() == BlockFlower.this.getBlockType();
            }
        });
    }

    return this.type;
}
项目:CustomWorldGen    文件:BlockFlower.java   
public IProperty<BlockFlower.EnumFlowerType> getTypeProperty()
{
    if (this.type == null)
    {
        this.type = PropertyEnum.<BlockFlower.EnumFlowerType>create("type", BlockFlower.EnumFlowerType.class, new Predicate<BlockFlower.EnumFlowerType>()
        {
            public boolean apply(@Nullable BlockFlower.EnumFlowerType p_apply_1_)
            {
                return p_apply_1_.getBlockType() == BlockFlower.this.getBlockType();
            }
        });
    }

    return this.type;
}
项目:marcraft    文件:SAWorldGen.java   
private void setRover(World world, int x, int y, int z){
    world.setBlockState(new BlockPos(x, y, z), Blocks.coal_block.getDefaultState());
    world.setBlockState(new BlockPos(x + 4, y, z), Blocks.coal_block.getDefaultState());
    world.setBlockState(new BlockPos(x + 4, y, z + 3), Blocks.coal_block.getDefaultState());
    world.setBlockState(new BlockPos(x, y, z + 3), Blocks.coal_block.getDefaultState());

    world.setBlockState(new BlockPos(x, y + 1, z + 1), Blocks.iron_block.getDefaultState());
    world.setBlockState(new BlockPos(x + 1, y + 1, z + 1), Blocks.iron_block.getDefaultState());
    world.setBlockState(new BlockPos(x + 2, y + 1, z + 1), Blocks.iron_block.getDefaultState());
    world.setBlockState(new BlockPos(x + 3, y + 1, z + 1), Blocks.iron_block.getDefaultState());

    world.setBlockState(new BlockPos(x, y + 1, z + 2), Blocks.iron_block.getDefaultState());
    world.setBlockState(new BlockPos(x + 1, y + 1, z + 2), Blocks.iron_block.getDefaultState());
    world.setBlockState(new BlockPos(x + 2, y + 1, z + 2), Blocks.iron_block.getDefaultState());
    world.setBlockState(new BlockPos(x + 3, y + 1, z + 2), Blocks.iron_block.getDefaultState());

    world.setBlockState(new BlockPos(x + 4, y + 1, z + 1), Blocks.stone.getDefaultState());
    world.setBlockState(new BlockPos(x + 4, y + 1, z + 2), Blocks.stone.getDefaultState());
    world.setBlockState(new BlockPos(x, y + 2, z + 1), Blocks.stained_glass.getDefaultState().withProperty(PropertyEnum.<EnumDyeColor>create("color", EnumDyeColor.class), EnumDyeColor.YELLOW));
    world.setBlockState(new BlockPos(x, y + 2, z + 2), Blocks.stained_glass.getDefaultState().withProperty(PropertyEnum.<EnumDyeColor>create("color", EnumDyeColor.class), EnumDyeColor.YELLOW));

    world.setBlockState(new BlockPos(x + 4, y + 2, z + 1), Blocks.stained_glass.getDefaultState().withProperty(PropertyEnum.<EnumDyeColor>create("color", EnumDyeColor.class), EnumDyeColor.RED));
    world.setBlockState(new BlockPos(x + 4, y + 2, z + 2), Blocks.stained_glass.getDefaultState().withProperty(PropertyEnum.<EnumDyeColor>create("color", EnumDyeColor.class), EnumDyeColor.RED));

    world.setBlockState(new BlockPos(x + 1, y + 2, z + 1), Blocks.iron_block.getDefaultState());
    world.setBlockState(new BlockPos(x + 2, y + 2, z + 1), Blocks.iron_block.getDefaultState());
    world.setBlockState(new BlockPos(x + 3, y + 2, z + 1), Blocks.iron_block.getDefaultState());

    world.setBlockState(new BlockPos(x + 1, y + 2, z + 2), Blocks.iron_block.getDefaultState());
    world.setBlockState(new BlockPos(x + 2, y + 2, z + 2), Blocks.iron_block.getDefaultState());
    world.setBlockState(new BlockPos(x + 3, y + 2, z + 2), Blocks.iron_block.getDefaultState());

    world.setBlockState(new BlockPos(x + 2, y + 3, z + 1), Blocks.iron_block.getDefaultState());
    world.setBlockState(new BlockPos(x + 2, y + 3, z + 2), Blocks.iron_block.getDefaultState());
}
项目:geomastery    文件:TEMultiAbstract.java   
/** Apply state information for this block.
 * @return The IBlockState with tile entity information added. */
public IBlockState applyActualState(IBlockState state,
        PropertyEnum<E> partProperty) {

    state = this.part == null ? state :
            state.withProperty(partProperty, this.part);
    state = this.facing == null ? state :
            state.withProperty(BlockContainerMulti.FACING, this.facing);
    return state;
}
项目:PackingTape    文件:BlockPackaged.java   
private static boolean rotateBlockToward(World worldIn, BlockPos pos, EnumFacing preferred, PropertyEnum prop)
{
    IBlockState stored = worldIn.getBlockState(pos);
    Block block = stored.getBlock();
    IBlockState actual = stored.getActualState(worldIn, pos);
    if (actual.getValue(prop) == preferred)
    {
        return true;
    }

    for (Object ignored : prop.getAllowedValues())
    {
        if (preferred.getAxis() == EnumFacing.Axis.Y)
            block.rotateBlock(worldIn, pos, EnumFacing.WEST);
        else
            block.rotateBlock(worldIn, pos, EnumFacing.UP);

        stored = worldIn.getBlockState(pos);
        block = stored.getBlock();
        actual = stored.getActualState(worldIn, pos);
        if (actual.getValue(prop) == preferred)
        {
            return true;
        }
    }

    return false;
}
项目:NeptuneCommon    文件:NeptuneBlockProperty.java   
public static BlockProperty of(IProperty property) {
    if (property instanceof PropertyBool) {
        return new NeptuneBlockBooleanProperty((PropertyBool) property);
    } else if (property instanceof PropertyDirection) {
        return new NeptuneBlockDirectionProperty((PropertyDirection) property);
    } else if (property instanceof PropertyEnum) {
        return new NeptuneBlockEnumProperty((PropertyEnum) property);
    } else if (property instanceof PropertyInteger) {
        return new NeptuneBlockIntegerProperty((PropertyInteger) property);
    }
    return new NeptuneBlockProperty(property);
}
项目:NeptuneMod    文件:NeptuneBlockProperty.java   
public static BlockProperty of(IProperty property) {
    if (property instanceof PropertyBool) {
        return new NeptuneBlockBooleanProperty((PropertyBool) property);
    } else if (property instanceof PropertyDirection) {
        return new NeptuneBlockDirectionProperty((PropertyDirection) property);
    } else if (property instanceof PropertyEnum) {
        return new NeptuneBlockEnumProperty((PropertyEnum) property);
    } else if (property instanceof PropertyInteger) {
        return new NeptuneBlockIntegerProperty((PropertyInteger) property);
    }
    return new NeptuneBlockProperty(property);
}
项目:ExpandedRailsMod    文件:BlockFlower.java   
public IProperty<BlockFlower.EnumFlowerType> getTypeProperty()
{
    if (this.type == null)
    {
        this.type = PropertyEnum.<BlockFlower.EnumFlowerType>create("type", BlockFlower.EnumFlowerType.class, new Predicate<BlockFlower.EnumFlowerType>()
        {
            public boolean apply(@Nullable BlockFlower.EnumFlowerType p_apply_1_)
            {
                return p_apply_1_.getBlockType() == BlockFlower.this.getBlockType();
            }
        });
    }

    return this.type;
}
项目:customstuff4    文件:BlockHelper.java   
private static PropertyEnum<EnumSubtype> createSubtypeProperty(IntArray subtypes)
{
    return PropertyEnum.create("subtype", EnumSubtype.class, EnumSubtype.getValues(subtypes.array));
}
项目:CrystalMod    文件:EnumBlockStateMapper.java   
public EnumBlockStateMapper(PropertyEnum<T> prop){
    this.prop = prop;
}
项目:CrystalMod    文件:EnumBlock.java   
public EnumBlock(Material material, PropertyEnum<E> prop, Class<E> clazz) {
  super(preInit(material, prop));
  this.prop = prop;
  values = clazz.getEnumConstants();
}
项目:CrystalMod    文件:EnumBlock.java   
private static Material preInit(Material material, PropertyEnum<?> property) {
tmp = property;
   return material;
 }
项目:CrystalMod    文件:BlockStateMachine.java   
public BlockStateMachine(BlockMachine block, PropertyEnum<?> prop)
{
    super(block, prop, facingProperty, activeProperty);
}
项目:CrystalMod    文件:BlockStateFacing.java   
public BlockStateFacing(Block block, PropertyEnum<?> typeProperty)
{
    super(block, facingProperty, typeProperty);
}
项目:geomastery    文件:BlockSawpit.java   
@Override
public PropertyEnum<EPartSawpit> getPartProperty() {

    return PART;
}
项目:geomastery    文件:BlockContainerMulti.java   
/** @return The PropertyEnum for this multiblock's parts. */
public abstract PropertyEnum<E> getPartProperty();
项目:geomastery    文件:BlockContainerMulti.java   
@Override
public PropertyEnum<EPartStone> getPartProperty() {

    return PART;
}
项目:geomastery    文件:BlockContainerMulti.java   
@Override
public PropertyEnum<EPartClay> getPartProperty() {

    return PART;
}
项目:geomastery    文件:BlockContainerMulti.java   
@Override
public PropertyEnum<EPartWoodworking> getPartProperty() {

    return PART;
}
项目:geomastery    文件:BlockContainerMulti.java   
@Override
public PropertyEnum<EPartTextiles> getPartProperty() {

    return PART;
}
项目:geomastery    文件:BlockContainerMulti.java   
@Override
public PropertyEnum<EPartMason> getPartProperty() {

    return PART;
}
项目:geomastery    文件:BlockContainerMulti.java   
@Override
public PropertyEnum<EPartForge> getPartProperty() {

    return PART;
}
项目:geomastery    文件:BlockContainerMulti.java   
@Override
public PropertyEnum<EPartCandlemaker> getPartProperty() {

    return PART;
}
项目:geomastery    文件:BlockContainerMulti.java   
@Override
public PropertyEnum<EPartArmourer> getPartProperty() {

    return PART;
}
项目:geomastery    文件:TECraftingArmourer.java   
@Override
public boolean buildStructure(World world, BlockPos pos,
        EnumFacing facing, ItemStack stack, EntityPlayer player) {

    if (this != M) {

        return false;
    }

    BlockContainerMulti<EPartArmourer> block =
            GeoBlocks.CRAFTING_ARMOURER;
    IBlockState state = block.getDefaultState();
    PropertyEnum<EPartArmourer> prop = block.getPartProperty();

    // Prepare map of properties

    Map<BlockPos, EPartArmourer> map = Maps.newHashMap();
    map.put(pos, M);
    map.put(pos.offset(facing.rotateYCCW()), L);
    map.put(pos.offset(facing.rotateYCCW()).up(), T);
    map.put(pos.offset(facing.rotateY()), R);

    // Check validity

    for (Entry<BlockPos, EPartArmourer> entry : map.entrySet()) {

        IBlockState placeState = state
                .withProperty(prop, entry.getValue());

        if (!block.isValid(world, entry.getKey(), null,
                false, placeState, player)) {

            return false;
        }
    }

    // Place all

    map.keySet().forEach((p) -> world.setBlockState(p, state));

    // Set up tileentities

    map.entrySet().forEach((e) -> {

        TECraftingArmourer te = (TECraftingArmourer) world
                .getTileEntity(e.getKey());
        te.setWeathering(stack.getMaxDamage() - stack.getItemDamage());
        te.setState(facing, e.getValue());
    });


    return true;
}
项目:geomastery    文件:TEFurnaceStone.java   
@Override
public boolean buildStructure(World world, BlockPos pos,
        EnumFacing facing, ItemStack stack, EntityPlayer player) {

    if (this != BM) {

        return false;
    }

    BlockContainerMulti<EPartStone> block = GeoBlocks.FURNACE_STONE;
    IBlockState state = block.getDefaultState();
    PropertyEnum<EPartStone> prop = block.getPartProperty();

    // Prepare map of properties

    Map<BlockPos, EPartStone> map = Maps.newHashMap();
    map.put(pos, BM);
    map.put(pos.offset(facing.rotateY().getOpposite()), BL);
    map.put(pos.offset(facing.rotateY()), BR);
    map.put(pos.offset(facing.rotateY().getOpposite()).up(), TL);
    map.put(pos.up(), TM);
    map.put(pos.offset(facing.rotateY()).up(), TR);

    // Check validity

    for (Entry<BlockPos, EPartStone> entry : map.entrySet()) {

        IBlockState placeState = state
                .withProperty(prop, entry.getValue());

        if (!block.isValid(world, entry.getKey(), null,
                false, placeState, player)) {

            return false;
        }
    }

    // Place all

    map.keySet().forEach((p) -> world.setBlockState(p, state));

    // Set up tileentities

    map.entrySet().forEach((e) -> ((TEFurnaceStone) world
            .getTileEntity(e.getKey())).setState(facing, e.getValue()));

    return true;
}
项目:geomastery    文件:TECraftingCandlemaker.java   
@Override
public boolean buildStructure(World world, BlockPos pos,
        EnumFacing facing, ItemStack stack, EntityPlayer player) {

    if (this != FRONT) {

        return false;
    }

    BlockContainerMulti<EPartCandlemaker> block =
            GeoBlocks.CRAFTING_CANDLEMAKER;
    IBlockState state = block.getDefaultState();
    PropertyEnum<EPartCandlemaker> prop = block.getPartProperty();

    // Prepare map of properties

    Map<BlockPos, EPartCandlemaker> map = Maps.newHashMap();
    map.put(pos, FRONT);
    map.put(pos.offset(facing), BACK);

    // Check validity

    for (Entry<BlockPos, EPartCandlemaker> entry : map.entrySet()) {

        IBlockState placeState = state
                .withProperty(prop, entry.getValue());

        if (!block.isValid(world, entry.getKey(), null,
                false, placeState, player)) {

            return false;
        }
    }

    // Place all

    map.keySet().forEach((p) -> world.setBlockState(p, state));

    // Set up tileentities

    map.entrySet().forEach((e) -> {

        TECraftingCandlemaker te = (TECraftingCandlemaker) world
                .getTileEntity(e.getKey());
        te.setWeathering(stack.getMaxDamage() - stack.getItemDamage());
        te.setState(facing, e.getValue());
    });

    return true;
}
项目:geomastery    文件:TECraftingMason.java   
@Override
public boolean buildStructure(World world, BlockPos pos,
        EnumFacing facing, ItemStack stack, EntityPlayer player) {

    if (this != FM) {

        return false;
    }

    BlockContainerMulti<EPartMason> block = GeoBlocks.CRAFTING_MASON;
    IBlockState state = block.getDefaultState();
    PropertyEnum<EPartMason> prop = block.getPartProperty();

    // Prepare map of properties

    Map<BlockPos, EPartMason> map = Maps.newHashMap();
    map.put(pos, FM);
    map.put(pos.offset(facing.rotateY().getOpposite()), FL);
    map.put(pos.offset(facing), BM);
    map.put(pos.offset(facing.rotateY()), FR);
    map.put(pos.offset(facing.rotateY()).offset(facing), BR);

    // Check validity

    for (Entry<BlockPos, EPartMason> entry : map.entrySet()) {

        IBlockState placeState = state
                .withProperty(prop, entry.getValue());

        if (!block.isValid(world, entry.getKey(), null,
                false, placeState, player)) {

            return false;
        }
    }

    // Place all

    map.keySet().forEach((p) -> world.setBlockState(p, state));

    // Set up tileentities

    map.entrySet().forEach((e) -> {

        TECraftingMason te = (TECraftingMason) world
                .getTileEntity(e.getKey());
        te.setWeathering(stack.getMaxDamage() - stack.getItemDamage());
        te.setState(facing, e.getValue());
    });

    return true;
}
项目:geomastery    文件:TECraftingWoodworking.java   
@Override
public boolean buildStructure(World world, BlockPos pos,
        EnumFacing facing, ItemStack stack, EntityPlayer player) {

    if (this != FM) {

        return false;
    }

    BlockContainerMulti<EPartWoodworking> block =
            GeoBlocks.CRAFTING_WOODWORKING;
    IBlockState state = block.getDefaultState();
    PropertyEnum<EPartWoodworking> prop = block.getPartProperty();

    // Prepare map of properties

    Map<BlockPos, EPartWoodworking> map = Maps.newHashMap();
    map.put(pos, FM);
    map.put(pos.offset(facing.rotateY().getOpposite()), FL);
    map.put(pos.offset(facing.rotateY().getOpposite())
            .offset(facing), BL);
    map.put(pos.offset(facing), BM);
    map.put(pos.offset(facing).offset(facing.rotateY()), BR);
    map.put(pos.offset(facing.rotateY()), FR);

    // Check validity

    for (Entry<BlockPos, EPartWoodworking> entry : map.entrySet()) {

        IBlockState placeState = state
                .withProperty(prop, entry.getValue());

        if (!block.isValid(world, entry.getKey(), null,
                false, placeState, player)) {

            return false;
        }
    }

    // Place all

    map.keySet().forEach((p) -> world.setBlockState(p, state));

    // Set up tileentities

    map.entrySet().forEach((e) -> {

        TECraftingWoodworking te = (TECraftingWoodworking) world
                .getTileEntity(e.getKey());
        te.setWeathering(stack.getMaxDamage() - stack.getItemDamage());
        te.setState(facing, e.getValue());
    });

    return true;
}
项目:geomastery    文件:TECraftingTextiles.java   
@Override
public boolean buildStructure(World world, BlockPos pos,
        EnumFacing facing, ItemStack stack, EntityPlayer player) {

    if (this != FRONT) {

        return false;
    }

    BlockContainerMulti<EPartTextiles> block =
            GeoBlocks.CRAFTING_TEXTILES;
    IBlockState state = block.getDefaultState();
    PropertyEnum<EPartTextiles> prop = block.getPartProperty();

    // Prepare map of properties

    Map<BlockPos, EPartTextiles> map = Maps.newHashMap();
    map.put(pos, FRONT);
    map.put(pos.offset(facing), BACK);

    // Check validity

    for (Entry<BlockPos, EPartTextiles> entry : map.entrySet()) {

        IBlockState placeState = state
                .withProperty(prop, entry.getValue());

        if (!block.isValid(world, entry.getKey(), null,
                false, placeState, player)) {

            return false;
        }
    }

    // Place all

    map.keySet().forEach((p) -> world.setBlockState(p, state));

    // Set up tileentities

    map.entrySet().forEach((e) -> {

        TECraftingTextiles te = (TECraftingTextiles) world
                .getTileEntity(e.getKey());
        te.setWeathering(stack.getMaxDamage() - stack.getItemDamage());
        te.setState(facing, e.getValue());
    });

    return true;
}