diff --git a/README.md b/README.md
index a6b684d..aa5fd6c 100644
--- a/README.md
+++ b/README.md
@@ -3,9 +3,9 @@ Supreme is an addon for Slimefun which adds 100+ various new resources that will
## Requirements
-Minecraft Version: 1.17 ~ 1.19.2
+Minecraft Version: 1.17 ~ 1.12.4
-Slimefun Version: RC-32
+Slimefun Version: 1aeb0e8
### [Download](https://thebusybiscuit.github.io/builds/RelativoBR/Supreme/main/)
@@ -147,7 +147,6 @@ Make a new issue, pull request, or discord Slimefun-Addon-Community
- **enable-tools** - Indication whether to enable the tools (default: true)
- **enable-armor** - Indication whether to enable the armor (default: true)
- **enable-tech** - Indication whether to enable new machine and resource to clonnig item (default: true)
-- **enable-item-converter-machine** - Converter Item by ID, restore values of name and meta item converting to a new item (maintaining current enchantments and durability) (default: true)
- **supreme-enchant** - Indication Enchantment of the gear and tools
- **supreme-effects** - Indication Effects of the gear
- **power-section** - Customizable Capacity, Buffer and Energy of the capacitor and generator
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 7f6b014..1049834 100644
--- a/pom.xml
+++ b/pom.xml
@@ -36,14 +36,14 @@
org.spigotmc
spigot-api
- 1.19-R0.1-SNAPSHOT
+ 1.20.4-R0.1-SNAPSHOT
provided
com.github.Slimefun
Slimefun4
- RC-32
+ 1aeb0e8
provided
@@ -67,7 +67,7 @@
5.3.19
-
+
net.guizhanss
GuizhanLib
@@ -78,7 +78,7 @@
- ${project.name} - RC 1
+ ${project.name}
clean package
${basedir}/src/main/java
diff --git a/src/main/java/com/github/relativobr/supreme/Supreme.java b/src/main/java/com/github/relativobr/supreme/Supreme.java
index e1ae8c7..bd91101 100644
--- a/src/main/java/com/github/relativobr/supreme/Supreme.java
+++ b/src/main/java/com/github/relativobr/supreme/Supreme.java
@@ -60,7 +60,6 @@ public static SupremeOptions getSupremeOptions() {
.enableTools(typeSection.getBoolean("enable-tools", true))
.enableArmor(typeSection.getBoolean("enable-armor", true))
.enableTech(typeSection.getBoolean("enable-tech", true))
- .enableItemConverter(typeSection.getBoolean("enable-item-converter-machine", true))
.customBc(typeSection.getBoolean("custom-bc", false))
.build();
}
diff --git a/src/main/java/com/github/relativobr/supreme/machine/ItemConverter.java b/src/main/java/com/github/relativobr/supreme/machine/ItemConverter.java
deleted file mode 100644
index 118d00d..0000000
--- a/src/main/java/com/github/relativobr/supreme/machine/ItemConverter.java
+++ /dev/null
@@ -1,184 +0,0 @@
-package com.github.relativobr.supreme.machine;
-
-import static com.github.relativobr.supreme.util.CompatibilySupremeLegacy.getNewIdSupremeLegacy;
-import static com.github.relativobr.supreme.util.CompatibilySupremeLegacy.getOldIdSupremeLegacy;
-
-import com.github.relativobr.supreme.generic.machine.SimpleItemContainerMachine;
-import com.github.relativobr.supreme.util.SupremeItemStack;
-import com.github.relativobr.supreme.util.UtilEnergy;
-import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup;
-import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
-import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack;
-import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType;
-import io.github.thebusybiscuit.slimefun4.core.attributes.MachineTier;
-import io.github.thebusybiscuit.slimefun4.core.attributes.MachineType;
-import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
-import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems;
-import io.github.thebusybiscuit.slimefun4.utils.LoreBuilder;
-import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Optional;
-import javax.annotation.Nonnull;
-import me.mrCookieSlime.Slimefun.api.BlockStorage;
-import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
-import org.bukkit.Material;
-import org.bukkit.block.Block;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.inventory.meta.Damageable;
-import org.bukkit.inventory.meta.ItemMeta;
-import org.bukkit.inventory.meta.Repairable;
-
-public class ItemConverter extends SimpleItemContainerMachine {
-
- public static final SlimefunItemStack ITEM_CONVERTER_MACHINE = new SupremeItemStack("SUPREME_ITEM_CONVERTER_MACHINE",
- Material.CARTOGRAPHY_TABLE, "&bItem Converter", "", "&fOriginal Converter Item by ID,",
- "&frestore values of name and meta item", "&fconverting to a new item",
- LoreBuilder.machine(MachineTier.ADVANCED, MachineType.MACHINE), LoreBuilder.speed(1000),
- UtilEnergy.energyPowerPerSecond(0), "", "&3Supreme Machine");
- public static final ItemStack[] RECIPE_ITEM_CONVERTER_MACHINE = new ItemStack[]{new ItemStack(Material.REDSTONE),
- new ItemStack(Material.REDSTONE), new ItemStack(Material.REDSTONE), new ItemStack(Material.PAPER),
- new ItemStack(Material.CARTOGRAPHY_TABLE), new ItemStack(Material.PAPER), new ItemStack(Material.REDSTONE_BLOCK),
- new ItemStack(Material.REDSTONE_BLOCK), new ItemStack(Material.REDSTONE_BLOCK)};
-
- public ItemConverter(ItemGroup category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
- super(category, item, recipeType, recipe);
- }
-
- @Nonnull
- public List getDisplayRecipes() {
- return new ArrayList<>();
- }
-
- @Override
- protected void tick(Block b) {
- BlockMenu inv = BlockStorage.getInventory(b);
- int[] outputSlots = this.getOutputSlots();
- int[] inputSlots = this.getInputSlots();
- for (int inputSlot : inputSlots) {
- ItemStack inputStack = inv.getItemInSlot(inputSlot);
- if (inputStack != null) {
-
- //is SlimefunItem
- if (inputStack.hasItemMeta() && inputStack.getItemMeta() != null) {
- final ItemMeta inputItemMeta = inputStack.getItemMeta();
- Optional id = Slimefun.getItemDataService().getItemData(inputItemMeta);
- if (id.isPresent()) {
- if (checkSlimefunConverter(inv, outputSlots, inputSlot, inputStack, inputItemMeta, id.get())) {
- break;
- }
- if (checkSlimefunConverter(inv, outputSlots, inputSlot, inputStack, inputItemMeta,
- getNewIdSupremeLegacy(id.get()))) {
- break;
- }
- if (checkSlimefunConverter(inv, outputSlots, inputSlot, inputStack, inputItemMeta,
- getOldIdSupremeLegacy(id.get()))) {
- break;
- }
- }
- }
-
- //check inputStack
- SlimefunItem slimefunItem = SlimefunItem.getByItem(inputStack);
- ItemStack item;
- if (slimefunItem != null) {
- item = slimefunItem.getItem().clone();
- processOutputItem(inv, outputSlots, inputSlot, new SlimefunItemStack(slimefunItem.getId(), item),
- inputStack.getAmount(), inputStack.getItemMeta());
- } else {
- item = inputStack.clone();
- processOutputItem(inv, outputSlots, inputSlot, item, inputStack.getAmount(), inputStack.getItemMeta());
- }
- break;
- }
- }
- }
-
- private boolean checkSlimefunConverter(BlockMenu inv, int[] outputSlots, int inputSlot, ItemStack inputStack,
- ItemMeta inputItemMeta, String itemId) {
- SlimefunItem slimefunItem = SlimefunItem.getById(itemId);
- if (slimefunItem != null) {
- ItemStack item = slimefunItem.getItem().clone();
- processOutputItem(inv, outputSlots, inputSlot, new SlimefunItemStack(itemId, item), inputStack.getAmount(),
- inputItemMeta);
- return true;
- }
- return false;
- }
-
- private void processOutputItem(BlockMenu inv, int[] outputSlots, int inputSlot, ItemStack itemStack, int amount,
- ItemMeta inputItemMeta) {
-
- for (int outputSlot : outputSlots) {
- ItemStack outputStack = inv.getItemInSlot(outputSlot);
- if (outputStack == null) {
- pushOutputItem(inv, inputSlot, amount, getItemWithEnchantAndRepairable(itemStack, inputItemMeta), outputSlot);
- break;
- } else {
- if (SlimefunUtils.isItemSimilar(itemStack, outputStack, false, false)) {
- final int outputAmount = outputStack.getAmount();
- if (outputAmount < outputStack.getMaxStackSize()) {
- final int maxAmount = outputStack.getMaxStackSize() - outputAmount;
- final int newAmount = Math.min(maxAmount, amount);
- pushOutputItem(inv, inputSlot, newAmount, getItemWithEnchantAndRepairable(itemStack, inputItemMeta),
- outputSlot);
- break;
- }
- }
- }
- }
- }
-
- private ItemStack getItemWithEnchantAndRepairable(ItemStack itemStack, ItemMeta inputItemMeta) {
- itemStack = itemStack.clone();
- if (inputItemMeta != null) {
- // remove enchant
- removeEnchant(itemStack);
-
- // add if it has enchants
- if (inputItemMeta.hasEnchants()) {
- itemStack.addUnsafeEnchantments(inputItemMeta.getEnchants());
- }
-
- ItemMeta itemMeta = itemStack.getItemMeta();
- if (itemMeta != null) {
-
- // replace repairCost
- ((Repairable) itemMeta).setRepairCost(((Repairable) inputItemMeta).getRepairCost());
-
- // replace durability
- Damageable durability = (Damageable) inputItemMeta;
- ((Damageable) itemMeta).setDamage(durability.getDamage());
-
- // save
- itemStack.setItemMeta(itemMeta);
- }
- }
- return itemStack;
- }
-
- private void removeEnchant(ItemStack itemStack) {
- if (!itemStack.getEnchantments().isEmpty()) {
- itemStack.getEnchantments().forEach((enchantment, integer) -> itemStack.removeEnchantment(enchantment));
- }
- }
-
- private void pushOutputItem(BlockMenu inv, int inputSlot, int amount, ItemStack itemStack, int outputSlot) {
- ItemStack inputItem = inv.getItemInSlot(inputSlot);
-
- if(checkIgnoreItem(inputItem)){
- inv.consumeItem(inputSlot, inputItem.getAmount());
- inv.pushItem(inputItem, outputSlot);
-
- } else if (inputItem != null && inputItem.getAmount() >= amount) {
- inv.consumeItem(inputSlot, amount);
- itemStack.setAmount(amount);
- inv.pushItem(itemStack, outputSlot);
- }
- }
-
- private boolean checkIgnoreItem(ItemStack inputItem) {
- return SlimefunItems.REPAIRED_SPAWNER.isSimilar(inputItem)
- || SlimefunItems.BROKEN_SPAWNER.isSimilar(inputItem);
- }
-}
diff --git a/src/main/java/com/github/relativobr/supreme/setup/SetupMachines.java b/src/main/java/com/github/relativobr/supreme/setup/SetupMachines.java
index 491d6ee..485cd66 100644
--- a/src/main/java/com/github/relativobr/supreme/setup/SetupMachines.java
+++ b/src/main/java/com/github/relativobr/supreme/setup/SetupMachines.java
@@ -8,7 +8,6 @@
import com.github.relativobr.supreme.machine.ForgeIngot;
import com.github.relativobr.supreme.machine.ForgeMagical;
import com.github.relativobr.supreme.machine.Foundry;
-import com.github.relativobr.supreme.machine.ItemConverter;
import com.github.relativobr.supreme.machine.MagicAltar;
import com.github.relativobr.supreme.machine.MobCollector;
import com.github.relativobr.supreme.machine.VirtualAquarium;
@@ -218,14 +217,7 @@ public static void setup(Supreme sup) {
SetupTechMachines.setup(sup);
- if (supremeOptions.isEnableItemConverter()) {
- new ItemConverter(ItemGroups.MACHINES_CATEGORY, ItemConverter.ITEM_CONVERTER_MACHINE,
- RecipeType.ENHANCED_CRAFTING_TABLE, ItemConverter.RECIPE_ITEM_CONVERTER_MACHINE).setMachineIdentifier(
- ItemConverter.ITEM_CONVERTER_MACHINE.getItemId()).setCapacity(1).setEnergyConsumption(1)
- .setProcessingSpeed(1000).register(sup);
- }
-
- CheckInventory.setup(sup);
+ CheckInventory.setup(sup);
}
}
diff --git a/src/main/java/com/github/relativobr/supreme/util/EnchantsAndEffectsUtil.java b/src/main/java/com/github/relativobr/supreme/util/EnchantsAndEffectsUtil.java
index 1336774..8c2ff65 100644
--- a/src/main/java/com/github/relativobr/supreme/util/EnchantsAndEffectsUtil.java
+++ b/src/main/java/com/github/relativobr/supreme/util/EnchantsAndEffectsUtil.java
@@ -3,9 +3,9 @@
import com.github.relativobr.supreme.Supreme;
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack;
import org.bukkit.ChatColor;
+import org.bukkit.NamespacedKey;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.enchantments.Enchantment;
-import org.bukkit.enchantments.EnchantmentWrapper;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
@@ -120,7 +120,7 @@ private static Map getEnchants(@Nonnull ConfigurationSecti
Map enchants = new HashMap<>();
for (String path : section.getKeys(false)) {
- Enchantment e = new EnchantmentWrapper(path);
+ Enchantment e = Enchantment.getByKey(NamespacedKey.minecraft(path));
if (e != null) {
int level = section.getInt(path);
if (level > 0 && level <= 100) {
diff --git a/src/main/java/com/github/relativobr/supreme/util/SupremeOptions.java b/src/main/java/com/github/relativobr/supreme/util/SupremeOptions.java
index c2945ab..2dc55e2 100644
--- a/src/main/java/com/github/relativobr/supreme/util/SupremeOptions.java
+++ b/src/main/java/com/github/relativobr/supreme/util/SupremeOptions.java
@@ -32,7 +32,6 @@ public class SupremeOptions {
boolean enableTools;
boolean enableArmor;
boolean enableTech;
- boolean enableItemConverter;
boolean customBc;
public static SupremeOptions defaultValue() {
@@ -58,7 +57,6 @@ public static SupremeOptions defaultValue() {
.enableTools(true)
.enableArmor(true)
.enableTech(true)
- .enableItemConverter(true)
.customBc(false)
.build();
}
diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml
index 5ca97e8..b23e44d 100644
--- a/src/main/resources/config.yml
+++ b/src/main/resources/config.yml
@@ -1,7 +1,6 @@
options:
auto-update: true
use-legacy-supremeexpansion-item-id: false
- enable-item-converter-machine: true
lang: en-US
custom-ticker-delay: 2
enable-generators: true