當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。