首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >我的世界找不到布洛克的状态

我的世界找不到布洛克的状态
EN

Stack Overflow用户
提问于 2016-01-08 12:28:02
回答 1查看 3.5K关注 0票数 2

我做了个模特儿我建了个小木屋。它是一个有库存和gui的瓷砖实体。我也做了一个定制渲染。然后我想让它转向球员面对的方向。Cabin.java的代码如下所示:

代码语言:javascript
复制
package aidas.morestuff.blocks;

import java.util.Iterator;

import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyDirection;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.InventoryHelper;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import aidas.morestuff.Main;
import aidas.morestuff.network.MGuiHandler;
import aidas.morestuff.tileentity.CabinTileEntity;

public class Cabin extends BlockContainer
{

    public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL);

    public Cabin(String uName)
    {
        super(Material.iron);
        this.setUnlocalizedName(uName);
        this.setHardness(2.0f);
        this.setResistance(6.0f);
        this.setHarvestLevel("pickaxe", 2);
    }

    @Override
    public TileEntity createNewTileEntity(World worldIn, int meta)
    {
        return new CabinTileEntity();
    }

    @Override
    public int getRenderType()
    {
        return 2;
    }

    @Override
    public void breakBlock(World world, BlockPos pos, IBlockState blockstate) {
        CabinTileEntity te = (CabinTileEntity) world.getTileEntity(pos);
        InventoryHelper.dropInventoryItems(world, pos, te);
        super.breakBlock(world, pos, blockstate);
    }

    @Override
    public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) {
        if (!world.isRemote) {
            player.openGui(Main.instance, MGuiHandler.MOD_TILE_ENTITY_GUI, world, pos.getX(), pos.getY(), pos.getZ());
        }
        return true;
    }

    public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
    {
       return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing());
    }

    public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
    {
        EnumFacing enumfacing = EnumFacing.getHorizontal(MathHelper.floor_double((double)(placer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3).getOpposite();
        state = state.withProperty(FACING, enumfacing);
        BlockPos blockpos1 = pos.north();
        BlockPos blockpos2 = pos.south();
        BlockPos blockpos3 = pos.west();
        BlockPos blockpos4 = pos.east();
        boolean flag = this == worldIn.getBlockState(blockpos1).getBlock();
        boolean flag1 = this == worldIn.getBlockState(blockpos2).getBlock();
        boolean flag2 = this == worldIn.getBlockState(blockpos3).getBlock();
        boolean flag3 = this == worldIn.getBlockState(blockpos4).getBlock();

        if (!flag && !flag1 && !flag2 && !flag3)
        {
            worldIn.setBlockState(pos, state, 3);
        }
        else if (enumfacing.getAxis() == EnumFacing.Axis.X && (flag || flag1))
        {
            if (flag)
            {
                worldIn.setBlockState(blockpos1, state, 3);
            }
            else
            {
                worldIn.setBlockState(blockpos2, state, 3);
            }

            worldIn.setBlockState(pos, state, 3);
        }
        else if (enumfacing.getAxis() == EnumFacing.Axis.Z && (flag2 || flag3))
        {
            if (flag2)
            {
                worldIn.setBlockState(blockpos3, state, 3);
            }
            else
            {
                worldIn.setBlockState(blockpos4, state, 3);
            }

            worldIn.setBlockState(pos, state, 3);
        }

        if (stack.hasDisplayName())
        {
            TileEntity tileentity = worldIn.getTileEntity(pos);

            if (tileentity instanceof TileEntityChest)
            {
                ((TileEntityChest)tileentity).setCustomName(stack.getDisplayName());
            }
        }
    }

    public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos)
    {
        if (worldIn.getBlockState(pos.north()).getBlock() == this)
        {
            this.setBlockBounds(0.0625F, 0.0F, 0.0F, 0.9375F, 0.875F, 0.9375F);
        }
        else if (worldIn.getBlockState(pos.south()).getBlock() == this)
        {
            this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 1.0F);
        }
        else if (worldIn.getBlockState(pos.west()).getBlock() == this)
        {
            this.setBlockBounds(0.0F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F);
        }
        else if (worldIn.getBlockState(pos.east()).getBlock() == this)
        {
            this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 1.0F, 0.875F, 0.9375F);
        }
        else
        {
            this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F);
        }
    }

    public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state)
    {
        Iterator iterator = EnumFacing.Plane.HORIZONTAL.iterator();

        while (iterator.hasNext())
        {
            EnumFacing enumfacing = (EnumFacing)iterator.next();
            BlockPos blockpos1 = pos.offset(enumfacing);
            IBlockState iblockstate1 = worldIn.getBlockState(blockpos1);
        }
    }

    public IBlockState checkForSurroundingChests(World worldIn, BlockPos pos, IBlockState state)
    {
        if (worldIn.isRemote)
        {
            return state;
        }
        else
        {
            IBlockState iblockstate1 = worldIn.getBlockState(pos.north());
            IBlockState iblockstate2 = worldIn.getBlockState(pos.south());
            IBlockState iblockstate3 = worldIn.getBlockState(pos.west());
            IBlockState iblockstate4 = worldIn.getBlockState(pos.east());
            EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
            Block block = iblockstate1.getBlock();
            Block block1 = iblockstate2.getBlock();
            Block block2 = iblockstate3.getBlock();
            Block block3 = iblockstate4.getBlock();

            if (block != this && block1 != this)
            {
                boolean flag = block.isFullBlock();
                boolean flag1 = block1.isFullBlock();

                if (block2 == this || block3 == this)
                {
                    BlockPos blockpos2 = block2 == this ? pos.west() : pos.east();
                    IBlockState iblockstate7 = worldIn.getBlockState(blockpos2.north());
                    IBlockState iblockstate8 = worldIn.getBlockState(blockpos2.south());
                    enumfacing = EnumFacing.SOUTH;
                    EnumFacing enumfacing2;

                    if (block2 == this)
                    {
                        enumfacing2 = (EnumFacing)iblockstate3.getValue(FACING);
                    }
                    else
                    {
                        enumfacing2 = (EnumFacing)iblockstate4.getValue(FACING);
                    }

                    if (enumfacing2 == EnumFacing.NORTH)
                    {
                        enumfacing = EnumFacing.NORTH;
                    }

                    Block block6 = iblockstate7.getBlock();
                    Block block7 = iblockstate8.getBlock();

                    if ((flag || block6.isFullBlock()) && !flag1 && !block7.isFullBlock())
                    {
                        enumfacing = EnumFacing.SOUTH;
                    }

                    if ((flag1 || block7.isFullBlock()) && !flag && !block6.isFullBlock())
                    {
                        enumfacing = EnumFacing.NORTH;
                    }
                }
            }
            else
            {
                BlockPos blockpos1 = block == this ? pos.north() : pos.south();
                IBlockState iblockstate5 = worldIn.getBlockState(blockpos1.west());
                IBlockState iblockstate6 = worldIn.getBlockState(blockpos1.east());
                enumfacing = EnumFacing.EAST;
                EnumFacing enumfacing1;

                if (block == this)
                {
                    enumfacing1 = (EnumFacing)iblockstate1.getValue(FACING);
                }
                else
                {
                    enumfacing1 = (EnumFacing)iblockstate2.getValue(FACING);
                }

                if (enumfacing1 == EnumFacing.WEST)
                {
                    enumfacing = EnumFacing.WEST;
                }

                Block block4 = iblockstate5.getBlock();
                Block block5 = iblockstate6.getBlock();

                if ((block2.isFullBlock() || block4.isFullBlock()) && !block3.isFullBlock() && !block5.isFullBlock())
                {
                    enumfacing = EnumFacing.EAST;
                }

                if ((block3.isFullBlock() || block5.isFullBlock()) && !block2.isFullBlock() && !block4.isFullBlock())
                {
                    enumfacing = EnumFacing.WEST;
                }
            }

            state = state.withProperty(FACING, enumfacing);
            worldIn.setBlockState(pos, state, 3);
            return state;
        }
    }

    public IBlockState correctFacing(World worldIn, BlockPos pos, IBlockState state)
    {
        EnumFacing enumfacing = null;
        Iterator iterator = EnumFacing.Plane.HORIZONTAL.iterator();

        while (iterator.hasNext())
        {
            EnumFacing enumfacing1 = (EnumFacing)iterator.next();
            IBlockState iblockstate1 = worldIn.getBlockState(pos.offset(enumfacing1));

            if (iblockstate1.getBlock() == this)
            {
                return state;
            }

            if (iblockstate1.getBlock().isFullBlock())
            {
                if (enumfacing != null)
                {
                    enumfacing = null;
                    break;
                }

                enumfacing = enumfacing1;
            }
        }

        if (enumfacing != null)
        {
            return state.withProperty(FACING, enumfacing.getOpposite());
        }
        else
        {
            EnumFacing enumfacing2 = (EnumFacing)state.getValue(FACING);

            if (worldIn.getBlockState(pos.offset(enumfacing2)).getBlock().isFullBlock())
            {
                enumfacing2 = enumfacing2.getOpposite();
            }

            if (worldIn.getBlockState(pos.offset(enumfacing2)).getBlock().isFullBlock())
            {
                enumfacing2 = enumfacing2.rotateY();
            }

            if (worldIn.getBlockState(pos.offset(enumfacing2)).getBlock().isFullBlock())
            {
                enumfacing2 = enumfacing2.getOpposite();
            }

            return state.withProperty(FACING, enumfacing2);
        }
    }
}

当我把小木屋放下来,游戏就崩溃了。

这是坠机报告:

代码语言:javascript
复制
---- Minecraft Crash Report ----
// I just don't know what went wrong :(

Time: 1/8/16 2:12 PM
Description: Unexpected error

java.lang.IllegalArgumentException: Cannot set property PropertyDirection{name=facing, clazz=class net.minecraft.util.EnumFacing, values=[north, south, west, east]} as it does not exist in BlockState{block=ms:cabin, properties=[]}
    at net.minecraft.block.state.BlockState$StateImplementation.withProperty(BlockState.java:189)
    at aidas.morestuff.blocks.Cabin.onBlockPlaced(Cabin.java:68)
    at net.minecraft.item.ItemBlock.onItemUse(ItemBlock.java:73)
    at net.minecraft.item.ItemStack.onItemUse(ItemStack.java:147)
    at net.minecraft.client.multiplayer.PlayerControllerMP.func_178890_a(PlayerControllerMP.java:442)
    at net.minecraft.client.Minecraft.rightClickMouse(Minecraft.java:1571)
    at net.minecraft.client.Minecraft.runTick(Minecraft.java:2131)
    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1087)
    at net.minecraft.client.Minecraft.run(Minecraft.java:376)
    at net.minecraft.client.main.Main.main(Main.java:117)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)
    at GradleStart.main(Unknown Source)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Stacktrace:
    at net.minecraft.block.state.BlockState$StateImplementation.withProperty(BlockState.java:189)
    at aidas.morestuff.blocks.Cabin.onBlockPlaced(Cabin.java:68)
    at net.minecraft.item.ItemBlock.onItemUse(ItemBlock.java:73)
    at net.minecraft.item.ItemStack.onItemUse(ItemStack.java:147)
    at net.minecraft.client.multiplayer.PlayerControllerMP.func_178890_a(PlayerControllerMP.java:442)
    at net.minecraft.client.Minecraft.rightClickMouse(Minecraft.java:1571)

-- Affected level --
Details:
    Level name: MpServer
    All players: 1 total; [EntityPlayerSP['Player688'/351, l='MpServer', x=187.67, y=63.00, z=289.42]]
    Chunk stats: MultiplayerChunkCache: 624, 624
    Level seed: 0
    Level generator: ID 00 - default, ver 1. Features enabled: false
    Level generator options: 
    Level spawn location: 164.00,64.00,256.00 - World: (164,64,256), Chunk: (at 4,4,0 in 10,16; contains blocks 160,0,256 to 175,255,271), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
    Level time: 40812 game time, 32306 day time
    Level dimension: 0
    Level storage version: 0x00000 - Unknown?
    Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)
    Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false
/*
* 提示:该行代码过长,系统自动注释不进行高亮。一键复制会移除系统注释 
* Forced entities: 111 total; [EntityCreeper['Creeper'/262, l='MpServer', x=230.31, y=22.00, z=213.78], EntitySheep['Sheep'/263, l='MpServer', x=225.94, y=65.00, z=216.97], EntitySkeleton['Skeleton'/264, l='MpServer', x=224.16, y=41.00, z=231.28], EntitySkeleton['Skeleton'/265, l='MpServer', x=227.69, y=42.00, z=234.75], EntityZombie['Zombie'/266, l='MpServer', x=224.25, y=42.00, z=228.19], EntitySquid['Squid'/267, l='MpServer', x=241.50, y=54.91, z=241.78], EntitySquid['Squid'/268, l='MpServer', x=234.31, y=56.84, z=256.06], EntityCreeper['Creeper'/269, l='MpServer', x=227.50, y=46.00, z=284.50], EntityBat['Bat'/270, l='MpServer', x=235.11, y=34.07, z=290.06], EntityZombie['Zombie'/271, l='MpServer', x=234.69, y=34.35, z=289.28], EntitySquid['Squid'/272, l='MpServer', x=238.31, y=57.97, z=294.47], EntityBat['Bat'/273, l='MpServer', x=231.22, y=37.02, z=310.35], EntityBat['Bat'/279, l='MpServer', x=248.45, y=26.03, z=221.48], EntityCreeper['Creeper'/280, l='MpServer', x=249.50, y=26.15, z=221.60], EntityZombie['Zombie'/281, l='MpServer', x=244.53, y=27.00, z=220.94], EntityZombie['Zombie'/282, l='MpServer', x=250.47, y=28.00, z=221.94], EntitySkeleton['Skeleton'/283, l='MpServer', x=252.50, y=29.00, z=211.50], EntityBat['Bat'/284, l='MpServer', x=244.64, y=27.72, z=220.45], EntityCreeper['Creeper'/285, l='MpServer', x=251.31, y=28.00, z=235.69], EntityBat['Bat'/286, l='MpServer', x=249.47, y=29.25, z=237.53], EntityZombie['Zombie'/287, l='MpServer', x=247.50, y=27.00, z=245.06], EntitySquid['Squid'/288, l='MpServer', x=246.06, y=53.50, z=247.75], EntityZombie['Zombie'/289, l='MpServer', x=240.41, y=37.00, z=283.03], EntityZombie['Zombie'/290, l='MpServer', x=244.94, y=28.00, z=299.47], EntityBat['Bat'/291, l='MpServer', x=247.63, y=33.10, z=302.75], EntityCreeper['Creeper'/292, l='MpServer', x=246.91, y=19.00, z=349.63], EntitySpider['Spider'/293, l='MpServer', x=247.28, y=24.00, z=362.28], EntityZombie['Zombie'/302, l='MpServer', x=254.59, y=31.00, z=344.00], EntityRabbit['Rabbit'/105, l='MpServer', x=111.38, y=70.00, z=287.16], EntitySheep['Sheep'/113, l='MpServer', x=109.69, y=67.00, z=329.75], EntityRabbit['Rabbit'/114, l='MpServer', x=114.52, y=67.27, z=331.05], EntityPlayerSP['Player688'/351, l='MpServer', x=187.67, y=63.00, z=289.42], EntitySheep['Sheep'/124, l='MpServer', x=123.84, y=67.00, z=242.03], EntitySheep['Sheep'/125, l='MpServer', x=128.05, y=70.00, z=255.53], EntitySheep['Sheep'/126, l='MpServer', x=114.72, y=70.00, z=291.50], EntitySheep['Sheep'/127, l='MpServer', x=114.16, y=69.00, z=310.06], EntitySheep['Sheep'/128, l='MpServer', x=127.24, y=68.00, z=308.03], EntitySheep['Sheep'/129, l='MpServer', x=115.25, y=67.00, z=317.63], EntitySheep['Sheep'/130, l='MpServer', x=112.08, y=67.00, z=326.00], EntitySheep['Sheep'/131, l='MpServer', x=127.13, y=67.00, z=320.13], EntitySheep['Sheep'/132, l='MpServer', x=118.94, y=67.00, z=330.97], EntityRabbit['Rabbit'/133, l='MpServer', x=116.06, y=68.00, z=333.94], EntitySheep['Sheep'/134, l='MpServer', x=121.81, y=63.00, z=350.69], EntitySheep['Sheep'/135, l='MpServer', x=114.88, y=69.00, z=355.44], EntitySheep['Sheep'/146, l='MpServer', x=130.84, y=65.00, z=218.81], EntitySheep['Sheep'/147, l='MpServer', x=135.06, y=65.00, z=218.66], EntityZombie['Zombie'/148, l='MpServer', x=135.50, y=47.00, z=231.50], EntityCreeper['Creeper'/149, l='MpServer', x=134.50, y=47.00, z=233.50], EntityCreeper['Creeper'/150, l='MpServer', x=134.50, y=47.00, z=232.50], EntitySheep['Sheep'/151, l='MpServer', x=139.34, y=71.00, z=279.19], EntitySheep['Sheep'/152, l='MpServer', x=129.50, y=72.00, z=285.84], EntitySheep['Sheep'/153, l='MpServer', x=141.88, y=70.00, z=281.19], EntitySheep['Sheep'/154, l='MpServer', x=131.53, y=71.00, z=303.63], EntityRabbit['Rabbit'/155, l='MpServer', x=136.88, y=71.00, z=315.38], EntityRabbit['Rabbit'/156, l='MpServer', x=139.84, y=70.00, z=327.44], EntitySheep['Sheep'/157, l='MpServer', x=137.25, y=68.00, z=320.47], EntityZombie['Zombie'/165, l='MpServer', x=150.13, y=13.00, z=226.41], EntityZombie['Zombie'/166, l='MpServer', x=156.03, y=12.00, z=247.53], EntityBat['Bat'/167, l='MpServer', x=148.88, y=15.10, z=256.59], EntitySheep['Sheep'/168, l='MpServer', x=147.81, y=68.00, z=292.63], EntityRabbit['Rabbit'/169, l='MpServer', x=151.59, y=67.00, z=314.66], EntityRabbit['Rabbit'/170, l='MpServer', x=149.56, y=66.00, z=306.00], EntityRabbit['Rabbit'/171, l='MpServer', x=160.28, y=63.00, z=324.53], EntitySheep['Sheep'/172, l='MpServer', x=143.44, y=69.57, z=303.57], EntityZombie['Zombie'/178, l='MpServer', x=172.59, y=13.00, z=229.56], EntityZombie['Zombie'/179, l='MpServer', x=175.63, y=26.00, z=237.59], EntityZombie['Zombie'/180, l='MpServer', x=175.50, y=27.00, z=229.50], EntityZombie['Zombie'/181, l='MpServer', x=160.69, y=13.00, z=240.28], EntityEnderman['Enderman'/182, l='MpServer', x=174.81, y=13.00, z=282.28], EntityZombie['Zombie'/183, l='MpServer', x=173.44, y=15.00, z=279.03], EntityZombie['Zombie'/184, l='MpServer', x=157.56, y=19.00, z=313.77], EntitySpider['Spider'/185, l='MpServer', x=174.69, y=23.00, z=320.28], EntityRabbit['Rabbit'/186, l='MpServer', x=161.47, y=67.00, z=324.00], EntityZombie['Zombie'/194, l='MpServer', x=183.56, y=12.00, z=217.56], EntitySkeleton['Skeleton'/195, l='MpServer', x=175.64, y=12.37, z=282.53], EntityZombie['Zombie'/196, l='MpServer', x=189.19, y=11.00, z=296.19], EntityZombie['Zombie'/209, l='MpServer', x=195.93, y=34.00, z=230.28], EntityBat['Bat'/210, l='MpServer', x=205.47, y=34.10, z=232.16], EntityBat['Bat'/211, l='MpServer', x=204.53, y=35.10, z=228.25], EntityZombie['Zombie'/212, l='MpServer', x=196.53, y=34.00, z=232.25], EntitySkeleton['Skeleton'/213, l='MpServer', x=203.50, y=34.00, z=233.09], EntitySpider['Spider'/214, l='MpServer', x=199.69, y=37.97, z=231.41], EntitySkeleton['Skeleton'/215, l='MpServer', x=195.06, y=34.00, z=229.53], EntitySkeleton['Skeleton'/216, l='MpServer', x=196.41, y=34.00, z=233.06], EntityZombie['Zombie'/217, l='MpServer', x=199.28, y=37.47, z=230.16], EntityBat['Bat'/218, l='MpServer', x=200.38, y=35.10, z=231.25], EntitySkeleton['Skeleton'/219, l='MpServer', x=192.41, y=34.00, z=230.09], EntitySkeleton['Skeleton'/220, l='MpServer', x=205.88, y=34.00, z=246.50], EntityZombie['Zombie'/221, l='MpServer', x=199.88, y=30.00, z=275.53], EntityBat['Bat'/222, l='MpServer', x=206.54, y=47.80, z=272.52], EntityCreeper['Creeper'/223, l='MpServer', x=205.47, y=47.85, z=277.59], EntitySkeleton['Skeleton'/224, l='MpServer', x=193.50, y=13.00, z=309.09], EntityCreeper['Creeper'/225, l='MpServer', x=194.47, y=11.00, z=310.15], EntitySkeleton['Skeleton'/226, l='MpServer', x=194.28, y=12.00, z=306.72], EntityCreeper['Creeper'/227, l='MpServer', x=197.81, y=20.00, z=339.13], EntityCreeper['Creeper'/228, l='MpServer', x=200.72, y=20.00, z=334.00], EntitySheep['Sheep'/236, l='MpServer', x=223.81, y=64.00, z=220.84], EntityCreeper['Creeper'/237, l='MpServer', x=203.90, y=33.00, z=231.40], EntityCreeper['Creeper'/238, l='MpServer', x=214.53, y=32.00, z=231.94], EntityZombie['Zombie'/239, l='MpServer', x=209.75, y=32.00, z=230.69], EntityZombie['Zombie'/240, l='MpServer', x=210.28, y=32.00, z=231.69], EntityBat['Bat'/241, l='MpServer', x=215.09, y=34.10, z=238.44], EntityCreeper['Creeper'/242, l='MpServer', x=223.28, y=41.00, z=231.75], EntityRabbit['Rabbit'/243, l='MpServer', x=217.78, y=63.00, z=228.47], EntityZombie['Zombie'/244, l='MpServer', x=216.59, y=31.00, z=249.00], EntityBat['Bat'/245, l='MpServer', x=225.14, y=34.91, z=269.63], EntityBat['Bat'/246, l='MpServer', x=212.33, y=31.00, z=273.23], EntityBat['Bat'/247, l='MpServer', x=216.79, y=31.91, z=272.25], EntityCreeper['Creeper'/248, l='MpServer', x=219.50, y=47.00, z=289.50], EntityBat['Bat'/249, l='MpServer', x=221.83, y=23.30, z=354.41], EntityZombie['Zombie'/250, l='MpServer', x=220.50, y=20.02, z=359.63]]
*/
    Retry entities: 0 total; []
    Server brand: fml,forge
    Server type: Integrated singleplayer server
Stacktrace:
    at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:392)
    at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2614)
    at net.minecraft.client.Minecraft.run(Minecraft.java:405)
    at net.minecraft.client.main.Main.main(Main.java:117)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)
    at GradleStart.main(Unknown Source)

-- System Details --
Details:
    Minecraft Version: 1.8
    Operating System: Windows 7 (amd64) version 6.1
    Java Version: 1.8.0_31, Oracle Corporation
    Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
    Memory: 719890400 bytes (686 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB)
    JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
    IntCache: cache: 0, tcache: 0, allocated: 12, tallocated: 94
    FML: MCP v9.10 FML v8.0.99.99 Minecraft Forge 11.14.4.1563 4 mods loaded, 4 mods active
    States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
    UCHIJAAAA   mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) 
    UCHIJAAAA   FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.8-11.14.4.1563.jar) 
    UCHIJAAAA   Forge{11.14.4.1563} [Minecraft Forge] (forgeSrc-1.8-11.14.4.1563.jar) 
    UCHIJAAAA   ms{1.0} [More Stuff] (bin) 
    Loaded coremods (and transformers): 
    GL info: ' Vendor: 'NVIDIA Corporation' Version: '4.5.0 NVIDIA 358.91' Renderer: 'GeForce GTX 560 Ti/PCIe/SSE2'
    Launched Version: 1.8
    LWJGL: 2.9.1
    OpenGL: GeForce GTX 560 Ti/PCIe/SSE2 GL version 4.5.0 NVIDIA 358.91, NVIDIA Corporation
    GL Caps: Using GL 1.3 multitexturing.
Using GL 1.3 texture combiners.
Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
Shaders are available because OpenGL 2.1 is supported.
VBOs are available because OpenGL 1.5 is supported.

    Using VBOs: No
    Is Modded: Definitely; Client brand changed to 'fml,forge'
    Type: Client (map_client.txt)
    Resource Packs: []
    Current Language: English (US)
    Profiler Position: N/A (disabled)

我知道“我的世界”在寻找船舱的封锁。我在cabin.json中创建了“我的世界想要的大片”:

代码语言:javascript
复制
{
    "variants": {
        "facing=east": { "model": "ms:cabin" },
        "facing=south": { "model": "ms:cabin", "y": 90 },
        "facing=west": { "model": "ms:cabin", "y": 180 },
        "facing=north": { "model": "ms:cabin", "y": 270 },
        "normal": { "model": "ms:cabin" }
    }
}

cabin.json区块是以资产/ms/区块表示的。

我做错什么了?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-01-10 15:23:45

问题是我没有添加元数据。可以在块中使用以下代码行添加元数据:

代码语言:javascript
复制
/* This method returns the IBlockState from the metadata
 * so we can have the proper rotation and textures of the block. 
 * This method is usually only called on map/chunk load.
 */
public IBlockState getStateFromMeta( int meta )
{
    EnumFacing enumfacing = EnumFacing.getFront(meta);

    if (enumfacing.getAxis() == EnumFacing.Axis.Y)
    {
        enumfacing = EnumFacing.NORTH;
    }

    return this.getDefaultState().withProperty(FACING, enumfacing);
}

/* Here the EnumFacing is translated into a metadata value(0-15)
 * so it can be stored. You can store up to 16 different states alone
 * in metadata, but no more. If you need more consider using a tile
 * entity alongside the metadata for more flexiblity
 */
public int getMetaFromState( IBlockState state )
{
    return (( EnumFacing )state.getValue( FACING )).getIndex();
}

/* Define which properties we have in our block.
 * this can be accessed in the JSON to differentiate
 * seperate textures
 */
protected BlockState createBlockState()
{
    return new BlockState( this, new IProperty[] { FACING });
}
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34677155

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档