当前位置: 首页>>代码示例>>Java>>正文


Java IProperty.getValueClass方法代码示例

本文整理汇总了Java中net.minecraft.block.properties.IProperty.getValueClass方法的典型用法代码示例。如果您正苦于以下问题:Java IProperty.getValueClass方法的具体用法?Java IProperty.getValueClass怎么用?Java IProperty.getValueClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.block.properties.IProperty的用法示例。


在下文中一共展示了IProperty.getValueClass方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: blockColourMatches

import net.minecraft.block.properties.IProperty; //导入方法依赖的package包/类
/** Test whether this block has a colour attribute which matches the list of allowed colours
 * @param bs blockstate to test
 * @param allowedColours list of allowed Colour enum values
 * @return true if the block matches.
 */
public static boolean blockColourMatches(IBlockState bs, List<Colour> allowedColours)
{
    for (IProperty prop : (java.util.Set<IProperty>) bs.getProperties().keySet())
    {
        if (prop.getName().equals("color") && prop.getValueClass() == net.minecraft.item.EnumDyeColor.class)
        {
            // The block in question has a colour, so check it is a specified one:
            net.minecraft.item.EnumDyeColor current = (net.minecraft.item.EnumDyeColor)bs.getValue(prop);
            for (Colour col : allowedColours)
            {
                if (current.getName().equalsIgnoreCase(col.name()))
                    return true;
            }
        }
    } 
    return false;
}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:23,代码来源:MinecraftTypeHelper.java

示例2: applyColour

import net.minecraft.block.properties.IProperty; //导入方法依赖的package包/类
/** Recolour the Minecraft block
 * @param state The block to be recoloured
 * @param colour The new colour
 * @return A new blockstate which is a recoloured version of the original
 */
static IBlockState applyColour(IBlockState state, Colour colour)
{
    for (IProperty prop : (java.util.Set<IProperty>)state.getProperties().keySet())
    {
        if (prop.getName().equals("color") && prop.getValueClass() == net.minecraft.item.EnumDyeColor.class)
        {
            net.minecraft.item.EnumDyeColor current = (net.minecraft.item.EnumDyeColor)state.getValue(prop);
            if (!current.getName().equalsIgnoreCase(colour.name()))
            {
                return state.withProperty(prop, EnumDyeColor.valueOf(colour.name()));
            }
        }
    }
    return state;
}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:21,代码来源:MinecraftTypeHelper.java

示例3: recolorBlock

import net.minecraft.block.properties.IProperty; //导入方法依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
public boolean recolorBlock(World world, BlockPos pos, EnumFacing side, net.minecraft.item.EnumDyeColor color)
{
    IBlockState state = world.getBlockState(pos);
    for (IProperty prop : state.getProperties().keySet())
    {
        if (prop.getName().equals("color") && prop.getValueClass() == net.minecraft.item.EnumDyeColor.class)
        {
            net.minecraft.item.EnumDyeColor current = (net.minecraft.item.EnumDyeColor)state.getValue(prop);
            if (current != color)
            {
                world.setBlockState(pos, state.withProperty(prop, color));
                return true;
            }
        }
    }
    return false;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:19,代码来源:Block.java

示例4: rotateBlock

import net.minecraft.block.properties.IProperty; //导入方法依赖的package包/类
public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis)
{
    IBlockState state = world.getBlockState(pos);
    for (IProperty prop : state.getProperties().keySet())
    {
        if (prop.getName().equals("variant") && prop.getValueClass() == EnumType.class)
        {
            EnumType current = (EnumType)state.getValue(prop);
            EnumType next = current == EnumType.LINES_X ? EnumType.LINES_Y :
                            current == EnumType.LINES_Y ? EnumType.LINES_Z :
                            current == EnumType.LINES_Z ? EnumType.LINES_X : current;
            if (next == current)
                return false;
            world.setBlockState(pos, state.withProperty(prop, next));
            return true;
        }
    }
    return false;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:20,代码来源:BlockQuartz.java

示例5: allowedProperty

import net.minecraft.block.properties.IProperty; //导入方法依赖的package包/类
private boolean allowedProperty(IProperty<?> key) {
    Class<?> vc = key.getValueClass();
    if (EnumFacing.class.isAssignableFrom(vc)) {
        return false;
    }
    if (Objects.equals(key.getName(), "facing")) {
        return false;
    }
    if (Objects.equals(key.getName(), "direction")) {
        return false;
    }
    return true;
}
 
开发者ID:kenzierocks,项目名称:HardVox,代码行数:14,代码来源:OpSetBasicBlock.java

示例6: 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

示例7: 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.getValueClass方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。