本文整理汇总了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();
}