mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-20 03:35:51 +00:00
Lightened some heavy calls in (dis)enchantable checks
This commit is contained in:
parent
8910839e31
commit
18779b114b
@ -95,7 +95,12 @@ public class AutoDisenchanter extends AContainer {
|
|||||||
for (int slot: getInputSlots()) {
|
for (int slot: getInputSlots()) {
|
||||||
ItemStack target = BlockStorage.getInventory(b).getItemInSlot(slot == getInputSlots()[0] ? getInputSlots()[1]: getInputSlots()[0]);
|
ItemStack target = BlockStorage.getInventory(b).getItemInSlot(slot == getInputSlots()[0] ? getInputSlots()[1]: getInputSlots()[0]);
|
||||||
ItemStack item = BlockStorage.getInventory(b).getItemInSlot(slot);
|
ItemStack item = BlockStorage.getInventory(b).getItemInSlot(slot);
|
||||||
if(SlimefunItem.getByItem(item) != null && !SlimefunItem.getByItem(item).isDisenchantable()) return;
|
|
||||||
|
// Check if disenchantable
|
||||||
|
SlimefunItem sfItem = SlimefunItem.getByItem(item);
|
||||||
|
if (sfItem != null && !sfItem.isDisenchantable()) return;
|
||||||
|
|
||||||
|
// Disenchant
|
||||||
if (item != null && target != null && target.getType() == Material.BOOK) {
|
if (item != null && target != null && target.getType() == Material.BOOK) {
|
||||||
int amount = 0;
|
int amount = 0;
|
||||||
|
|
||||||
|
@ -93,8 +93,13 @@ public class AutoEnchanter extends AContainer {
|
|||||||
slots:
|
slots:
|
||||||
for (int slot: getInputSlots()) {
|
for (int slot: getInputSlots()) {
|
||||||
ItemStack target = BlockStorage.getInventory(b).getItemInSlot(slot == getInputSlots()[0] ? getInputSlots()[1]: getInputSlots()[0]);
|
ItemStack target = BlockStorage.getInventory(b).getItemInSlot(slot == getInputSlots()[0] ? getInputSlots()[1]: getInputSlots()[0]);
|
||||||
if(SlimefunItem.getByItem(target) != null && !SlimefunItem.getByItem(target).isEnchantable()) return;
|
// Check if enchantable
|
||||||
|
SlimefunItem sfTarget = SlimefunItem.getByItem(target);
|
||||||
|
if(sfTarget != null && !sfTarget.isEnchantable()) return;
|
||||||
|
|
||||||
ItemStack item = BlockStorage.getInventory(b).getItemInSlot(slot);
|
ItemStack item = BlockStorage.getInventory(b).getItemInSlot(slot);
|
||||||
|
|
||||||
|
// Enchant
|
||||||
if (item != null && item.getType() == Material.ENCHANTED_BOOK && target != null) {
|
if (item != null && item.getType() == Material.ENCHANTED_BOOK && target != null) {
|
||||||
Map<Enchantment, Integer> enchantments = new HashMap<Enchantment, Integer>();
|
Map<Enchantment, Integer> enchantments = new HashMap<Enchantment, Integer>();
|
||||||
Set<ItemEnchantment> enchantments2 = new HashSet<ItemEnchantment>();
|
Set<ItemEnchantment> enchantments2 = new HashSet<ItemEnchantment>();
|
||||||
|
Loading…
Reference in New Issue
Block a user