本文整理汇总了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();
}
示例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();
}
}
示例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();
}
}
示例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));
}
}
示例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;
}
示例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;
}
示例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_)});
}
}
}
示例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_);
}
示例9: getState
import net.minecraft.block.Block; //导入方法依赖的package包/类
@Deprecated
public static IBlockState getState(Block block, int meta) {
return block == null ? null : block.getStateFromMeta(meta);
}
示例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_);
}