本文整理匯總了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;
}