当前位置: 首页>>代码示例>>Java>>正文


Java PropertyEnum类代码示例

本文整理汇总了Java中net.minecraft.block.properties.PropertyEnum的典型用法代码示例。如果您正苦于以下问题:Java PropertyEnum类的具体用法?Java PropertyEnum怎么用?Java PropertyEnum使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PropertyEnum类属于net.minecraft.block.properties包,在下文中一共展示了PropertyEnum类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getTypeProperty

import net.minecraft.block.properties.PropertyEnum; //导入依赖的package包/类
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;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:16,代码来源:BlockFlower.java

示例2: getSubtypeProperty

import net.minecraft.block.properties.PropertyEnum; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:cubex2,项目名称:customstuff4,代码行数:14,代码来源:BlockHelper.java

示例3: test_getSubtypeProperty

import net.minecraft.block.properties.PropertyEnum; //导入依赖的package包/类
@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));
}
 
开发者ID:cubex2,项目名称:customstuff4,代码行数:11,代码来源:BlockHelperTests.java

示例4: test_getSubtypeProperty_ignoresDuplicates

import net.minecraft.block.properties.PropertyEnum; //导入依赖的package包/类
@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));
}
 
开发者ID:cubex2,项目名称:customstuff4,代码行数:11,代码来源:BlockHelperTests.java

示例5: test_getSubtypeProperty_ignoresDuplicates2

import net.minecraft.block.properties.PropertyEnum; //导入依赖的package包/类
@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);
}
 
开发者ID:cubex2,项目名称:customstuff4,代码行数:9,代码来源:BlockHelperTests.java

示例6: test_getSubtypeProperty_multipleCallsReturnsSameProperty

import net.minecraft.block.properties.PropertyEnum; //导入依赖的package包/类
@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);
}
 
开发者ID:cubex2,项目名称:customstuff4,代码行数:9,代码来源:BlockHelperTests.java

示例7: test_getSubtypeProperty_subtypeOrderDoesNotMatter

import net.minecraft.block.properties.PropertyEnum; //导入依赖的package包/类
@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);
}
 
开发者ID:cubex2,项目名称:customstuff4,代码行数:9,代码来源:BlockHelperTests.java

示例8: getTypeProperty

import net.minecraft.block.properties.PropertyEnum; //导入依赖的package包/类
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;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:16,代码来源:BlockFlower.java

示例9: setRover

import net.minecraft.block.properties.PropertyEnum; //导入依赖的package包/类
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());
}
 
开发者ID:oscaresgil,项目名称:marcraft,代码行数:36,代码来源:SAWorldGen.java

示例10: applyActualState

import net.minecraft.block.properties.PropertyEnum; //导入依赖的package包/类
/** 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;
}
 
开发者ID:JayAvery,项目名称:geomastery,代码行数:12,代码来源:TEMultiAbstract.java

示例11: rotateBlockToward

import net.minecraft.block.properties.PropertyEnum; //导入依赖的package包/类
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;
}
 
开发者ID:gigaherz,项目名称:PackingTape,代码行数:29,代码来源:BlockPackaged.java

示例12: of

import net.minecraft.block.properties.PropertyEnum; //导入依赖的package包/类
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);
}
 
开发者ID:NeptunePowered,项目名称:NeptuneCommon,代码行数:13,代码来源:NeptuneBlockProperty.java

示例13: createSubtypeProperty

import net.minecraft.block.properties.PropertyEnum; //导入依赖的package包/类
private static PropertyEnum<EnumSubtype> createSubtypeProperty(IntArray subtypes)
{
    return PropertyEnum.create("subtype", EnumSubtype.class, EnumSubtype.getValues(subtypes.array));
}
 
开发者ID:cubex2,项目名称:customstuff4,代码行数:5,代码来源:BlockHelper.java

示例14: EnumBlockStateMapper

import net.minecraft.block.properties.PropertyEnum; //导入依赖的package包/类
public EnumBlockStateMapper(PropertyEnum<T> prop){
	this.prop = prop;
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:4,代码来源:EnumBlockStateMapper.java

示例15: EnumBlock

import net.minecraft.block.properties.PropertyEnum; //导入依赖的package包/类
public EnumBlock(Material material, PropertyEnum<E> prop, Class<E> clazz) {
  super(preInit(material, prop));
  this.prop = prop;
  values = clazz.getEnumConstants();
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:6,代码来源:EnumBlock.java


注:本文中的net.minecraft.block.properties.PropertyEnum类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。