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


Java Block.getStateFromMeta方法代码示例

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


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

示例1: doRender

import net.minecraft.block.Block; //导入方法依赖的package包/类
@Override
public void doRender(EntityTorch torch, double d, double d1, double d2, float f, float f1)
{
    Block block = Blocks.TORCH;
    GlStateManager.enableRescaleNormal();
    GlStateManager.pushMatrix();
    GlStateManager.translate(d, d1, d2);
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    bindEntityTexture(torch);
    GlStateManager.disableLighting();
    GlStateManager.rotate(torch.prevRotationYaw + (torch.rotationYaw - torch.prevRotationYaw) * f1 - 90F, 0.0F, 1.0F, 0.0F);
    GlStateManager.rotate(90F + torch.prevRotationPitch + (torch.rotationPitch - torch.prevRotationPitch) * f1, 0.0F, 0.0F, 1.0F);

    IBlockState state = block.getStateFromMeta(0);
    RendererHelper.renderBakedModel(Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelForState(state), -1, ItemStack.EMPTY);

    GlStateManager.enableLighting();

    GlStateManager.popMatrix();
    GlStateManager.disableRescaleNormal();
}
 
开发者ID:iChun,项目名称:Torched,代码行数:22,代码来源:RenderTorch.java

示例2: getStateFromMeta

import net.minecraft.block.Block; //导入方法依赖的package包/类
private IBlockState getStateFromMeta(Block p_getStateFromMeta_1_, int p_getStateFromMeta_2_)
{
    try
    {
        IBlockState iblockstate = p_getStateFromMeta_1_.getStateFromMeta(p_getStateFromMeta_2_);

        if (p_getStateFromMeta_1_ == Blocks.double_plant && p_getStateFromMeta_2_ > 7)
        {
            IBlockState iblockstate1 = p_getStateFromMeta_1_.getStateFromMeta(p_getStateFromMeta_2_ & 7);
            iblockstate = iblockstate.withProperty(BlockDoublePlant.VARIANT, iblockstate1.getValue(BlockDoublePlant.VARIANT));
        }

        return iblockstate;
    }
    catch (IllegalArgumentException var5)
    {
        return p_getStateFromMeta_1_.getDefaultState();
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:20,代码来源:ConnectedParser.java

示例3: getStateFromMeta

import net.minecraft.block.Block; //导入方法依赖的package包/类
private IBlockState getStateFromMeta(Block p_getStateFromMeta_1_, int p_getStateFromMeta_2_)
{
    try
    {
        IBlockState iblockstate = p_getStateFromMeta_1_.getStateFromMeta(p_getStateFromMeta_2_);

        if (p_getStateFromMeta_1_ == Blocks.DOUBLE_PLANT && p_getStateFromMeta_2_ > 7)
        {
            IBlockState iblockstate1 = p_getStateFromMeta_1_.getStateFromMeta(p_getStateFromMeta_2_ & 7);
            iblockstate = iblockstate.withProperty(BlockDoublePlant.VARIANT, iblockstate1.getValue(BlockDoublePlant.VARIANT));
        }

        return iblockstate;
    }
    catch (IllegalArgumentException var5)
    {
        return p_getStateFromMeta_1_.getDefaultState();
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:20,代码来源:ConnectedParser.java

示例4: getDescriptor

import net.minecraft.block.Block; //导入方法依赖的package包/类
public static IBlockStateDescriptor getDescriptor(String strElement) throws JsonParseException {
    int meta = -1;
    int indexMeta = strElement.indexOf('@');
    if(indexMeta != -1 && indexMeta != strElement.length() - 1) {
        try {
            meta = Integer.parseInt(strElement.substring(indexMeta + 1));
        } catch (NumberFormatException exc) {
            throw new JsonParseException("Expected a metadata number, got " + strElement.substring(indexMeta + 1), exc);
        }
        strElement = strElement.substring(0, indexMeta);
    }
    ResourceLocation res = new ResourceLocation(strElement);
    Block b = ForgeRegistries.BLOCKS.getValue(res);
    if(b == null || b == Blocks.AIR) {
        throw new JsonParseException("Couldn't find block with registryName '" + res.toString() + "' !");
    }
    if(meta == -1) {
        return new IBlockStateDescriptor(b);
    } else {
        return new IBlockStateDescriptor(b.getStateFromMeta(meta));
    }
}
 
开发者ID:HellFirePvP,项目名称:ModularMachinery,代码行数:23,代码来源:BlockArray.java

示例5: getCamoState

import net.minecraft.block.Block; //导入方法依赖的package包/类
private static IBlockState getCamoState(ItemStack stack) {
    if (stack.hasTagCompound() && stack.getTagCompound().hasKey("CamoState")) {
        NBTTagCompound stateTag = stack.getTagCompound().getCompoundTag("CamoState");
        Block b = ForgeRegistries.BLOCKS.getValue(new ResourceLocation(stateTag.getString("block")));
        return b != null ? b.getStateFromMeta(stateTag.getInteger("meta")) : null;
    }
    return null;
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:9,代码来源:ItemCamoApplicator.java

示例6: getStateForStack

import net.minecraft.block.Block; //导入方法依赖的package包/类
static IBlockState getStateForStack(ItemStack stack) {
    if (stack.getItem() instanceof ItemBlock) {
        Block b = ((ItemBlock) stack.getItem()).getBlock();
        return b.getStateFromMeta(stack.getMetadata());
    }
    return null;
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:8,代码来源:ICamouflageableTE.java

示例7: func_190794_a

import net.minecraft.block.Block; //导入方法依赖的package包/类
public static IBlockState func_190794_a(Block p_190794_0_, String p_190794_1_) throws NumberInvalidException, InvalidBlockStateException
{
    try
    {
        int i = Integer.parseInt(p_190794_1_);

        if (i < 0)
        {
            throw new NumberInvalidException("commands.generic.num.tooSmall", new Object[] {Integer.valueOf(i), Integer.valueOf(0)});
        }
        else if (i > 15)
        {
            throw new NumberInvalidException("commands.generic.num.tooBig", new Object[] {Integer.valueOf(i), Integer.valueOf(15)});
        }
        else
        {
            return p_190794_0_.getStateFromMeta(Integer.parseInt(p_190794_1_));
        }
    }
    catch (RuntimeException var7)
    {
        try
        {
            Map < IProperty<?>, Comparable<? >> map = func_190795_c(p_190794_0_, p_190794_1_);
            IBlockState iblockstate = p_190794_0_.getDefaultState();

            for (Entry < IProperty<?>, Comparable<? >> entry : map.entrySet())
            {
                iblockstate = func_190793_a(iblockstate, (IProperty)entry.getKey(), (Comparable)entry.getValue());
            }

            return iblockstate;
        }
        catch (RuntimeException var6)
        {
            throw new InvalidBlockStateException("commands.generic.blockstate.invalid", new Object[] {p_190794_1_, Block.REGISTRY.getNameForObject(p_190794_0_)});
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:40,代码来源:CommandBase.java

示例8: FlatLayerInfo

import net.minecraft.block.Block; //导入方法依赖的package包/类
public FlatLayerInfo(int p_i45628_1_, int p_i45628_2_, Block p_i45628_3_, int p_i45628_4_)
{
    this(p_i45628_1_, p_i45628_2_, p_i45628_3_);
    this.field_175901_b = p_i45628_3_.getStateFromMeta(p_i45628_4_);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:6,代码来源:FlatLayerInfo.java

示例9: getState

import net.minecraft.block.Block; //导入方法依赖的package包/类
@Deprecated
public static IBlockState getState(Block block, int meta) {
    return block == null ? null : block.getStateFromMeta(meta);
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:5,代码来源:ZWrapper.java

示例10: FlatLayerInfo

import net.minecraft.block.Block; //导入方法依赖的package包/类
public FlatLayerInfo(int p_i45628_1_, int p_i45628_2_, Block layerMaterialIn, int p_i45628_4_)
{
    this(p_i45628_1_, p_i45628_2_, layerMaterialIn);
    this.layerMaterial = layerMaterialIn.getStateFromMeta(p_i45628_4_);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:6,代码来源:FlatLayerInfo.java


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