當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。