From 43274b032766762a853990f5ee0e3795b530c55a Mon Sep 17 00:00:00 2001 From: Flo56958 Date: Thu, 8 Jun 2023 09:29:37 +0200 Subject: [PATCH] Update Auto-Smelt and Beheading with 1.20 Blocks --- .../de/flo56958/minetinker/MineTinker.java | 5 +++++ .../minetinker/listeners/TinkerListener.java | 2 +- .../minetinker/listeners/TridentListener.java | 2 +- .../minetinker/modifiers/types/AutoSmelt.java | 18 ++++++++++++++++++ .../minetinker/modifiers/types/Beheading.java | 2 ++ 5 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/flo56958/minetinker/MineTinker.java b/src/main/java/de/flo56958/minetinker/MineTinker.java index 25f32ddd..a89ff24a 100644 --- a/src/main/java/de/flo56958/minetinker/MineTinker.java +++ b/src/main/java/de/flo56958/minetinker/MineTinker.java @@ -26,6 +26,7 @@ public class MineTinker extends JavaPlugin { private static JavaPlugin plugin; public static boolean is18compatible; public static boolean is19compatible; + public static boolean is20compatible; @Contract(pure = true) public static JavaPlugin getPlugin() { // necessary to do getConfig() in other classes @@ -45,6 +46,7 @@ private void parseMCVersion() { is18compatible = mayor >= 1 && minor >= 18; is19compatible = mayor >= 1 && minor >= 19; + is20compatible = mayor >= 1 && minor >= 20; } catch (Exception e) { e.printStackTrace(); ChatWriter.logError("Could not parse the Minecraft Version! Running 1.17 feature set. " + @@ -57,6 +59,9 @@ private void parseMCVersion() { if (is19compatible) { ChatWriter.log(false, "1.19 enhanced features activated!"); } + if (is20compatible) { + ChatWriter.log(false, "1.20 enhanced features activated!"); + } } @Override diff --git a/src/main/java/de/flo56958/minetinker/listeners/TinkerListener.java b/src/main/java/de/flo56958/minetinker/listeners/TinkerListener.java index de9982ef..e961759d 100644 --- a/src/main/java/de/flo56958/minetinker/listeners/TinkerListener.java +++ b/src/main/java/de/flo56958/minetinker/listeners/TinkerListener.java @@ -188,7 +188,7 @@ public void onToolLevelUp(@NotNull final ToolLevelUpEvent event) { config.getBoolean("LevelUpEvents.AppliedModifiersConsiderSlots")); } if (!appliedRandomMod) { - mods.remove(index); //Remove the failed modifier from the the list of the possibles + mods.remove(index); //Remove the failed modifier from the list of the possibles } } } diff --git a/src/main/java/de/flo56958/minetinker/listeners/TridentListener.java b/src/main/java/de/flo56958/minetinker/listeners/TridentListener.java index e9326c8f..dfdfb7ec 100644 --- a/src/main/java/de/flo56958/minetinker/listeners/TridentListener.java +++ b/src/main/java/de/flo56958/minetinker/listeners/TridentListener.java @@ -32,7 +32,7 @@ public void onTridentLaunch(@NotNull final ProjectileLaunchEvent event) { } ModManager.instance().addExp(player, trident, -5_000_000, true); - //trident is a item clone and only for triggering modifier effects + //trident is an item clone and only for triggering modifier effects //this makes sure that the item duplicate does not get any level ups TridentToItemStack.put((Trident) event.getEntity(), trident); } diff --git a/src/main/java/de/flo56958/minetinker/modifiers/types/AutoSmelt.java b/src/main/java/de/flo56958/minetinker/modifiers/types/AutoSmelt.java index 9a726dd5..9cba2d5c 100644 --- a/src/main/java/de/flo56958/minetinker/modifiers/types/AutoSmelt.java +++ b/src/main/java/de/flo56958/minetinker/modifiers/types/AutoSmelt.java @@ -197,6 +197,24 @@ public void reload() { conversions.put(Material.MUD, new Triplet(Material.CLAY, 1)); } + if (MineTinker.is20compatible) { + conversions.put(Material.CHERRY_LEAVES, new Triplet(Material.STICK, 1)); + conversions.put(Material.CHERRY_LOG, new Triplet(Material.CHARCOAL, 1)); + conversions.put(Material.STRIPPED_CHERRY_LOG, new Triplet(Material.CHARCOAL, 1)); + conversions.put(Material.CHERRY_WOOD, new Triplet(Material.CHARCOAL, 1)); + conversions.put(Material.STRIPPED_CHERRY_WOOD, new Triplet(Material.CHARCOAL, 1)); + + conversions.put(Material.BAMBOO_BLOCK, new Triplet(Material.CHARCOAL, 1)); + + conversions.put(Material.SUSPICIOUS_SAND, new Triplet(Material.GLASS, 1)); + } + + for (Material m : Material.values()) { + if (m.isBurnable()) { + conversions.putIfAbsent(m, new Triplet(Material.AIR, 1)); + } + } + //Saving Conversions as String Map conversionsSTR = new HashMap<>(); conversions.forEach((k, v) -> conversionsSTR.put(k.toString(), v.toString())); diff --git a/src/main/java/de/flo56958/minetinker/modifiers/types/Beheading.java b/src/main/java/de/flo56958/minetinker/modifiers/types/Beheading.java index ab065dfb..b6e04640 100644 --- a/src/main/java/de/flo56958/minetinker/modifiers/types/Beheading.java +++ b/src/main/java/de/flo56958/minetinker/modifiers/types/Beheading.java @@ -137,6 +137,8 @@ public void effect(MTEntityDeathEvent event) { } loot = head; + } else if (MineTinker.is20compatible && mob.getType() == EntityType.PIGLIN) { + loot = new ItemStack(Material.PIGLIN_HEAD, 1); } if (loot.getType() != Material.AIR) {