diff --git a/src/main/java/io/github/thebusybiscuit/exoticgarden/ExoticGarden.java b/src/main/java/io/github/thebusybiscuit/exoticgarden/ExoticGarden.java index cb9fd4a5..e9c093cd 100644 --- a/src/main/java/io/github/thebusybiscuit/exoticgarden/ExoticGarden.java +++ b/src/main/java/io/github/thebusybiscuit/exoticgarden/ExoticGarden.java @@ -392,14 +392,14 @@ public static ItemStack harvestPlant(@Nonnull Block block) { BlockStorage.deleteLocationInfoUnsafely(block.getLocation(), false); block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, Material.OAK_LEAVES); - block.setType(Material.AIR); + block.setType(Material.AIR, false); - plant.setType(Material.OAK_SAPLING); + plant.setType(Material.OAK_SAPLING, false); BlockStorage.deleteLocationInfoUnsafely(plant.getLocation(), false); BlockStorage.store(plant, getItem(berry.toBush())); return berry.getItem().clone(); default: - block.setType(Material.OAK_SAPLING); + block.setType(Material.OAK_SAPLING, false); BlockStorage.deleteLocationInfoUnsafely(block.getLocation(), false); BlockStorage.store(block, getItem(berry.toBush())); return berry.getItem().clone(); @@ -423,7 +423,7 @@ public void harvestFruit(Block fruit) { ItemStack fruits = check.getItem().clone(); fruit.getWorld().playEffect(loc, Effect.STEP_SOUND, Material.OAK_LEAVES); fruit.getWorld().dropItemNaturally(loc, fruits); - fruit.setType(Material.AIR); + fruit.setType(Material.AIR, false); } } diff --git a/src/main/java/io/github/thebusybiscuit/exoticgarden/listeners/PlantsListener.java b/src/main/java/io/github/thebusybiscuit/exoticgarden/listeners/PlantsListener.java index c7e2c093..21b3f336 100644 --- a/src/main/java/io/github/thebusybiscuit/exoticgarden/listeners/PlantsListener.java +++ b/src/main/java/io/github/thebusybiscuit/exoticgarden/listeners/PlantsListener.java @@ -157,7 +157,7 @@ private void growStructure(StructureGrowEvent e) { for (Tree tree : ExoticGarden.getTrees()) { if (item.getId().equalsIgnoreCase(tree.getSapling())) { BlockStorage.clearBlockInfo(e.getLocation()); - Schematic.pasteSchematic(e.getLocation(), tree); + Schematic.pasteSchematic(e.getLocation(), tree, false); return; } } @@ -166,7 +166,7 @@ private void growStructure(StructureGrowEvent e) { if (item.getId().equalsIgnoreCase(berry.toBush())) { switch (berry.getType()) { case BUSH: - e.getLocation().getBlock().setType(Material.OAK_LEAVES); + e.getLocation().getBlock().setType(Material.OAK_LEAVES, false); break; case ORE_PLANT: case DOUBLE_PLANT: @@ -186,16 +186,16 @@ private void growStructure(StructureGrowEvent e) { } BlockStorage.store(blockAbove, berry.getItem()); - e.getLocation().getBlock().setType(Material.OAK_LEAVES); - blockAbove.setType(Material.PLAYER_HEAD); + e.getLocation().getBlock().setType(Material.OAK_LEAVES, false); + blockAbove.setType(Material.PLAYER_HEAD, false); Rotatable rotatable = (Rotatable) blockAbove.getBlockData(); rotatable.setRotation(faces[ThreadLocalRandom.current().nextInt(faces.length)]); - blockAbove.setBlockData(rotatable); + blockAbove.setBlockData(rotatable, false); PlayerHead.setSkin(blockAbove, PlayerSkin.fromHashCode(berry.getTexture()), true); break; default: - e.getLocation().getBlock().setType(Material.PLAYER_HEAD); + e.getLocation().getBlock().setType(Material.PLAYER_HEAD, false); Rotatable s = (Rotatable) e.getLocation().getBlock().getBlockData(); s.setRotation(faces[ThreadLocalRandom.current().nextInt(faces.length)]); e.getLocation().getBlock().setBlockData(s); @@ -217,7 +217,7 @@ private void pasteTree(ChunkPopulateEvent e, int x, int z, Tree tree) { for (int y = e.getWorld().getMaxHeight(); y > 30; y--) { Block current = e.getWorld().getBlockAt(x, y, z); if (current.getType() != Material.WATER && current.getType() != Material.SEAGRASS && current.getType() != Material.TALL_SEAGRASS && !current.getType().isSolid() && !(current.getBlockData() instanceof Waterlogged && ((Waterlogged) current.getBlockData()).isWaterlogged()) && tree.isSoil(current.getRelative(0, -1, 0).getType()) && isFlat(current)) { - Schematic.pasteSchematic(e.getWorld(), x, y, z, tree); + Schematic.pasteSchematic(e.getWorld(), x, y, z, tree, false); break; } } @@ -231,7 +231,7 @@ private void growBush(ChunkPopulateEvent e, int x, int z, Berry berry, Random ra switch (berry.getType()) { case BUSH: if (isPaper) { - current.setType(Material.OAK_LEAVES); + current.setType(Material.OAK_LEAVES, false); } else { plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () -> current.setType(Material.OAK_LEAVES)); @@ -239,10 +239,10 @@ private void growBush(ChunkPopulateEvent e, int x, int z, Berry berry, Random ra break; case FRUIT: if (isPaper) { - current.setType(Material.PLAYER_HEAD); + current.setType(Material.PLAYER_HEAD, false); Rotatable s = (Rotatable) current.getBlockData(); s.setRotation(faces[random.nextInt(faces.length)]); - current.setBlockData(s); + current.setBlockData(s, false); PlayerHead.setSkin(current, PlayerSkin.fromHashCode(berry.getTexture()), true); } else { @@ -250,7 +250,7 @@ private void growBush(ChunkPopulateEvent e, int x, int z, Berry berry, Random ra current.setType(Material.PLAYER_HEAD); Rotatable s = (Rotatable) current.getBlockData(); s.setRotation(faces[random.nextInt(faces.length)]); - current.setBlockData(s); + current.setBlockData(s, false); PlayerHead.setSkin(current, PlayerSkin.fromHashCode(berry.getTexture()), true); }); } @@ -258,20 +258,20 @@ private void growBush(ChunkPopulateEvent e, int x, int z, Berry berry, Random ra case ORE_PLANT: case DOUBLE_PLANT: if (isPaper) { - current.setType(Material.PLAYER_HEAD); + current.setType(Material.PLAYER_HEAD, false); Rotatable s = (Rotatable) current.getBlockData(); s.setRotation(faces[random.nextInt(faces.length)]); - current.setBlockData(s); + current.setBlockData(s, false); PlayerHead.setSkin(current, PlayerSkin.fromHashCode(berry.getTexture()), true); } else { plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () -> { BlockStorage.store(current.getRelative(BlockFace.UP), berry.getItem()); - current.setType(Material.OAK_LEAVES); - current.getRelative(BlockFace.UP).setType(Material.PLAYER_HEAD); + current.setType(Material.OAK_LEAVES, false); + current.getRelative(BlockFace.UP).setType(Material.PLAYER_HEAD, false); Rotatable ss = (Rotatable) current.getRelative(BlockFace.UP).getBlockData(); ss.setRotation(faces[random.nextInt(faces.length)]); - current.getRelative(BlockFace.UP).setBlockData(ss); + current.getRelative(BlockFace.UP).setBlockData(ss, false); PlayerHead.setSkin(current.getRelative(BlockFace.UP), PlayerSkin.fromHashCode(berry.getTexture()), true); }); } @@ -348,7 +348,7 @@ public void onDecay(LeavesDecayEvent e) { if (item != null) { e.setCancelled(true); - e.getBlock().setType(Material.AIR); + e.getBlock().setType(Material.AIR, false); e.getBlock().getWorld().dropItemNaturally(e.getBlock().getLocation(), item); } } diff --git a/src/main/java/io/github/thebusybiscuit/exoticgarden/schematics/Schematic.java b/src/main/java/io/github/thebusybiscuit/exoticgarden/schematics/Schematic.java index a69607ef..887cf251 100644 --- a/src/main/java/io/github/thebusybiscuit/exoticgarden/schematics/Schematic.java +++ b/src/main/java/io/github/thebusybiscuit/exoticgarden/schematics/Schematic.java @@ -109,11 +109,11 @@ public short getHeight() { return height; } - public static void pasteSchematic(Location loc, Tree tree) { - pasteSchematic(loc.getWorld(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), tree); + public static void pasteSchematic(Location loc, Tree tree, boolean doPhysics) { + pasteSchematic(loc.getWorld(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), tree, doPhysics); } - public static void pasteSchematic(World world, int x1, int y1, int z1, Tree tree) { + public static void pasteSchematic(World world, int x1, int y1, int z1, Tree tree, boolean doPhysics) { Schematic schematic; try { @@ -151,7 +151,7 @@ public static void pasteSchematic(World world, int x1, int y1, int z1, Tree tree if (material != null) { if (blocks[index] != 0) { - block.setType(material); + block.setType(material, doPhysics); } if (org.bukkit.Tag.LEAVES.isTagged(material)) { @@ -162,7 +162,7 @@ public static void pasteSchematic(World world, int x1, int y1, int z1, Tree tree else if (material == Material.PLAYER_HEAD) { Rotatable s = (Rotatable) block.getBlockData(); s.setRotation(BLOCK_FACES[ThreadLocalRandom.current().nextInt(BLOCK_FACES.length)]); - block.setBlockData(s); + block.setBlockData(s, doPhysics); PlayerHead.setSkin(block, PlayerSkin.fromHashCode(tree.getTexture()), true); BlockStorage.store(block, tree.getFruit());