当前位置: 首页>>代码示例>>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;未经允许,请勿转载。