本文整理匯總了Java中net.minecraft.block.properties.PropertyEnum.getAllowedValues方法的典型用法代碼示例。如果您正苦於以下問題:Java PropertyEnum.getAllowedValues方法的具體用法?Java PropertyEnum.getAllowedValues怎麽用?Java PropertyEnum.getAllowedValues使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.block.properties.PropertyEnum
的用法示例。
在下文中一共展示了PropertyEnum.getAllowedValues方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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));
}
示例2: 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));
}
示例3: 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;
}