Crop growth material fixes for 1.13!

This commit is contained in:
ProSavage 2018-08-13 00:02:03 -05:00
parent 70e069dc05
commit 9216bdbb48

View File

@ -46,7 +46,14 @@ public class CropUpgrades implements Listener {
private void growCrop(BlockGrowEvent e) { private void growCrop(BlockGrowEvent e) {
if (e.getBlock().getType().equals(Material.LEGACY_CROPS)) { Material CROPS;
if (P.p.mc113) {
CROPS = Material.valueOf("LEGACY_CROPS");
} else {
CROPS = Material.valueOf("CROPS");
}
if (e.getBlock().getType().equals(CROPS)) {
e.setCancelled(true); e.setCancelled(true);
Crops c = new Crops(CropState.RIPE); Crops c = new Crops(CropState.RIPE);
org.bukkit.block.BlockState bs = e.getBlock().getState(); org.bukkit.block.BlockState bs = e.getBlock().getState();
@ -54,11 +61,19 @@ public class CropUpgrades implements Listener {
bs.update(); bs.update();
} }
org.bukkit.block.Block below = e.getBlock().getLocation().subtract(0, 1, 0).getBlock(); org.bukkit.block.Block below = e.getBlock().getLocation().subtract(0, 1, 0).getBlock();
if (below.getType() == Material.LEGACY_SUGAR_CANE_BLOCK) { Material SUGARCANEBLOCK;
if (P.p.mc113) {
SUGARCANEBLOCK = Material.valueOf("LEGACY_SUGAR_CANE_BLOCK");
} else {
SUGARCANEBLOCK = Material.valueOf("SUGAR_CANE_BLOCK");
}
if (below.getType() == SUGARCANEBLOCK) {
org.bukkit.block.Block above = e.getBlock().getLocation().add(0, 1, 0).getBlock(); org.bukkit.block.Block above = e.getBlock().getLocation().add(0, 1, 0).getBlock();
if (above.getType() == Material.AIR && above.getLocation().add(0, -2, 0).getBlock().getType() != Material.AIR) { if (above.getType() == Material.AIR && above.getLocation().add(0, -2, 0).getBlock().getType() != Material.AIR) {
above.setType(Material.LEGACY_SUGAR_CANE_BLOCK); above.setType(SUGARCANEBLOCK);
} }
} }