本文整理匯總了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;
}
示例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);
}
示例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));
}
示例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));
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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());
}
示例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;
}
示例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;
}
示例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);
}
示例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));
}
示例14: EnumBlockStateMapper
import net.minecraft.block.properties.PropertyEnum; //導入依賴的package包/類
public EnumBlockStateMapper(PropertyEnum<T> prop){
this.prop = prop;
}
示例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();
}