@Override public boolean place( Item item, Block block, Block target, int face, double fx, double fy, double fz, Player player) { int[] faces = new int[] {3, 0, 1, 2}; this.meta = faces[(player != null) ? player.getDirection() : 0] & 0x03; this.getLevel().setBlock(block, this, true, true); return true; }
@Override public boolean place( Item item, Block block, Block target, int face, double fx, double fy, double fz, Player player) { int faces[] = {4, 2, 5, 3}; meta = faces[player != null ? player.getDirection() : 0]; getLevel().setBlock(block, this, true, true); CompoundTag nbt = new CompoundTag() .putList(new ListTag<>("Items")) .putString("id", Tile.BREWING_STAND) .putInt("x", (int) this.x) .putInt("y", (int) this.y) .putInt("z", (int) this.z); if (item.hasCustomName()) { nbt.putString("CustomName", item.getCustomName()); } if (item.hasCustomBlockData()) { Map<String, Tag> customData = item.getCustomBlockData().getTags(); Iterator iter = customData.entrySet().iterator(); while (iter.hasNext()) { Map.Entry tag = (Map.Entry) iter.next(); nbt.put((String) tag.getKey(), (Tag) tag.getValue()); } } new cn.nukkit.tile.BrewingStand(getLevel().getChunk((int) this.x >> 4, (int) this.z >> 4), nbt); return true; }