本文整理汇总了Java中net.minecraft.block.properties.IProperty.getAllowedValues方法的典型用法代码示例。如果您正苦于以下问题:Java IProperty.getAllowedValues方法的具体用法?Java IProperty.getAllowedValues怎么用?Java IProperty.getAllowedValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.block.properties.IProperty
的用法示例。
在下文中一共展示了IProperty.getAllowedValues方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildPropertyValueTable
import net.minecraft.block.properties.IProperty; //导入方法依赖的package包/类
public void buildPropertyValueTable(Map<Map<IProperty, Comparable>, BlockState.StateImplementation> map)
{
if (this.propertyValueTable != null)
{
throw new IllegalStateException();
}
else
{
Table<IProperty, Comparable, IBlockState> table = HashBasedTable.<IProperty, Comparable, IBlockState>create();
for (IProperty <? extends Comparable > iproperty : this.properties.keySet())
{
for (Comparable comparable : iproperty.getAllowedValues())
{
if (comparable != this.properties.get(iproperty))
{
table.put(iproperty, comparable, map.get(this.getPropertiesWithValue(iproperty, comparable)));
}
}
}
this.propertyValueTable = ImmutableTable.<IProperty, Comparable, IBlockState>copyOf(table);
}
}
示例2: validateProperty
import net.minecraft.block.properties.IProperty; //导入方法依赖的package包/类
public static <T extends Comparable<T>> String validateProperty(Block block, IProperty<T> property)
{
String s = property.getName();
if (!NAME_PATTERN.matcher(s).matches())
{
throw new IllegalArgumentException("Block: " + block.getClass() + " has invalidly named property: " + s);
}
else
{
for (T t : property.getAllowedValues())
{
String s1 = property.getName(t);
if (!NAME_PATTERN.matcher(s1).matches())
{
throw new IllegalArgumentException("Block: " + block.getClass() + " has property: " + s + " with invalidly named value: " + s1);
}
}
return s;
}
}
示例3: buildPropertyValueTable
import net.minecraft.block.properties.IProperty; //导入方法依赖的package包/类
public void buildPropertyValueTable(Map < Map < IProperty<?>, Comparable<? >> , BlockStateContainer.StateImplementation > map)
{
if (this.propertyValueTable != null)
{
throw new IllegalStateException();
}
else
{
Table < IProperty<?>, Comparable<?>, IBlockState > table = HashBasedTable. < IProperty<?>, Comparable<?>, IBlockState > create();
for (Entry < IProperty<?>, Comparable<? >> entry : this.properties.entrySet())
{
IProperty<?> iproperty = (IProperty)entry.getKey();
for (Comparable<?> comparable : iproperty.getAllowedValues())
{
if (comparable != entry.getValue())
{
table.put(iproperty, comparable, map.get(this.getPropertiesWithValue(iproperty, comparable)));
}
}
}
this.propertyValueTable = ImmutableTable. < IProperty<?>, Comparable<?>, IBlockState > copyOf(table);
}
}
示例4: parsePropertyValue
import net.minecraft.block.properties.IProperty; //导入方法依赖的package包/类
public static Comparable parsePropertyValue(IProperty p_parsePropertyValue_0_, String p_parsePropertyValue_1_)
{
Class oclass = p_parsePropertyValue_0_.getValueClass();
Comparable comparable = parseValue(p_parsePropertyValue_1_, oclass);
if (comparable == null)
{
Collection collection = p_parsePropertyValue_0_.getAllowedValues();
comparable = getPropertyValue(p_parsePropertyValue_1_, collection);
}
return comparable;
}
示例5: buildPropertyValueTable
import net.minecraft.block.properties.IProperty; //导入方法依赖的package包/类
public void buildPropertyValueTable(Map < Map < IProperty<?>, Comparable<? >> , BlockStateContainer.StateImplementation > map)
{
if (this.propertyValueTable != null)
{
throw new IllegalStateException();
}
else
{
Table < IProperty<?>, Comparable<?>, IBlockState > table = HashBasedTable. < IProperty<?>, Comparable<?>, IBlockState > create();
UnmodifiableIterator unmodifiableiterator = this.properties.entrySet().iterator();
while (unmodifiableiterator.hasNext())
{
Entry < IProperty<?>, Comparable<? >> entry = (Entry)unmodifiableiterator.next();
IProperty<?> iproperty = (IProperty)entry.getKey();
for (Comparable<?> comparable : iproperty.getAllowedValues())
{
if (comparable != entry.getValue())
{
table.put(iproperty, comparable, map.get(this.getPropertiesWithValue(iproperty, comparable)));
}
}
}
this.propertyValueTable = ImmutableTable. < IProperty<?>, Comparable<?>, IBlockState > copyOf(table);
}
}
示例6: getValidRotations
import net.minecraft.block.properties.IProperty; //导入方法依赖的package包/类
/**
* Get the rotations that can apply to the block at the specified coordinates. Null means no rotations are possible.
* Note, this is up to the block to decide. It may not be accurate or representative.
* @param world The world
* @param pos Block position in world
* @return An array of valid axes to rotate around, or null for none or unknown
*/
public EnumFacing[] getValidRotations(World world, BlockPos pos)
{
IBlockState state = world.getBlockState(pos);
for (IProperty<?> prop : state.getProperties().keySet())
{
if (prop.getName().equals("facing") && prop.getValueClass() == EnumFacing.class)
{
@SuppressWarnings("unchecked")
java.util.Collection<EnumFacing> values = ((java.util.Collection<EnumFacing>)prop.getAllowedValues());
return values.toArray(new EnumFacing[values.size()]);
}
}
return null;
}