當前位置: 首頁>>代碼示例>>Java>>正文


Java IProperty.getAllowedValues方法代碼示例

本文整理匯總了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);
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:25,代碼來源:BlockState.java

示例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;
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:24,代碼來源:BlockStateContainer.java

示例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);
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:27,代碼來源:BlockStateContainer.java

示例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;
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:14,代碼來源:ConnectedParser.java

示例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);
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:29,代碼來源:BlockStateContainer.java

示例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;
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:22,代碼來源:Block.java


注:本文中的net.minecraft.block.properties.IProperty.getAllowedValues方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。