mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-20 11:45:51 +00:00
Small performance improvement in CargoManager
done by saving the blockinfo to avoid heavy calls. Would probably need later a more reliable "rewrite". Fixes https://github.com/TheBusyBiscuit/Slimefun4/issues/514
This commit is contained in:
parent
5c6b8bd838
commit
2d38231101
@ -3,6 +3,7 @@ package me.mrCookieSlime.Slimefun.api.item_transport;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
|
||||||
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.Item.CustomItem;
|
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.Item.CustomItem;
|
||||||
import me.mrCookieSlime.Slimefun.Setup.SlimefunManager;
|
import me.mrCookieSlime.Slimefun.Setup.SlimefunManager;
|
||||||
import me.mrCookieSlime.Slimefun.Setup.SlimefunManager.DataType;
|
import me.mrCookieSlime.Slimefun.Setup.SlimefunManager.DataType;
|
||||||
@ -194,11 +195,13 @@ public class CargoManager {
|
|||||||
String id = BlockStorage.checkID(block);
|
String id = BlockStorage.checkID(block);
|
||||||
if (id.equals("CARGO_NODE_OUTPUT")) return true;
|
if (id.equals("CARGO_NODE_OUTPUT")) return true;
|
||||||
|
|
||||||
BlockMenu menu = BlockStorage.getInventory(block.getLocation());
|
Config blockInfo = BlockStorage.getBlockInfo(block); // Store the returned Config instance to avoid heavy calls
|
||||||
boolean lore = BlockStorage.getBlockInfo(block, "filter-lore").equals("true");
|
|
||||||
boolean data = BlockStorage.getBlockInfo(block, "filter-durability").equals("true");
|
|
||||||
|
|
||||||
if (BlockStorage.getBlockInfo(block, "filter-type").equals("whitelist")) {
|
BlockMenu menu = BlockStorage.getInventory(block.getLocation());
|
||||||
|
boolean lore = blockInfo.getString("filter-lore").equals("true");
|
||||||
|
boolean data = blockInfo.getString("filter-durability").equals("true");
|
||||||
|
|
||||||
|
if (blockInfo.getString("filter-type").equals("whitelist")) {
|
||||||
List<ItemStack> items = new ArrayList<ItemStack>();
|
List<ItemStack> items = new ArrayList<ItemStack>();
|
||||||
for (int slot: slots) {
|
for (int slot: slots) {
|
||||||
ItemStack template = menu.getItemInSlot(slot);
|
ItemStack template = menu.getItemInSlot(slot);
|
||||||
|
Loading…
Reference in New Issue
Block a user