如题。大佬们快来帮帮萌新吧





大佬们在工作?
箱子朝向我不知道,但是楼梯的朝向都是由子ID代表的,都是10以后的子ID,楼主一个一个试过去应该能找到
凋灵兔子 发表于 2017-5-23 17:35
箱子朝向我不知道,但是楼梯的朝向都是由子ID代表的,都是10以后的子ID,楼主一个一个试过去应该能找到 ...
虽然你没有解决我问题,但我还是要说谢谢。
我在 生成告示牌贴在箱子上这里难住了,如果你有好的解决方法请求告知。
本帖最后由 810587921 于 2017-5-24 05:21 编辑
设置箱子朝向:
假设loc变量为箱子的位置:
复制代码
贴牌子到箱子上并且为箱子的面对方向:
假设block变量为箱子方块
复制代码
Edit:哎呀←_←,假设变量错了,应该是loc而不是location
哎呀,2000回复了,你破了我1999回复Σ(?д?;),赔我!
设置箱子朝向:
假设loc变量为箱子的位置:
- Block block=loc.getBlock();
- block.setType(Material.CHEST);
- Directional direction=(Directional)block.getState().getData();
- direction.setFacingDirection(BlockFace.EAST);
- BlockState state=block.getState();
- state.setData((MaterialData)direction);
- state.update(true);
贴牌子到箱子上并且为箱子的面对方向:
假设block变量为箱子方块
- Directional direction(Directional)block.getState.getData();
- BlockFace face=direction.getFacing();
- Block signBlock=block.getRelative(face);
- //设置方块,类型为贴在方块上的牌子
- signBlock.setType(Material.WALL_SIGN);
- direction=(Directional)signBlock.getState().getData();
- //设置牌子的朝向为箱子的朝向
- direction.setFacingDirection(face);
- Sign sign=(Sign)signBlock.getState();
- sign.setLine(1,"§a......");
- //刷新朝向
- sign.setData((MaterialData)direction);
- sign.update(true);
Edit:哎呀←_←,假设变量错了,应该是loc而不是location
哎呀,2000回复了,你破了我1999回复Σ(?д?;),赔我!
810587921 发表于 2017-5-24 02:32
设置箱子朝向:
假设loc变量为箱子的位置:
谢谢大佬~~~