1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-19 19:25:48 +00:00
This commit is contained in:
TheBusyBiscuit 2020-05-15 00:36:39 +02:00
parent 886121e226
commit 741d18a8e8
3 changed files with 16 additions and 9 deletions

View File

@ -41,6 +41,7 @@
* Fixed #1893 * Fixed #1893
* Fixed #1897 * Fixed #1897
* Fixed #1908 * Fixed #1908
* Fixed #1903
## Release Candidate 11 (25 Apr 2020) ## Release Candidate 11 (25 Apr 2020)

View File

@ -29,7 +29,7 @@ final class CargoUtils {
private CargoUtils() {} private CargoUtils() {}
public static boolean hasInventory(Block block) { protected static boolean hasInventory(Block block) {
if (block == null) { if (block == null) {
return false; return false;
} }
@ -68,7 +68,7 @@ final class CargoUtils {
return false; return false;
} }
public static ItemStack withdraw(Block node, Block target, ItemStack template) { protected static ItemStack withdraw(Block node, Block target, ItemStack template) {
DirtyChestMenu menu = getChestMenu(target); DirtyChestMenu menu = getChestMenu(target);
if (menu == null) { if (menu == null) {
@ -103,7 +103,7 @@ final class CargoUtils {
return null; return null;
} }
private static ItemStack withdrawFromVanillaInventory(Block node, ItemStack template, Inventory inv) { protected static ItemStack withdrawFromVanillaInventory(Block node, ItemStack template, Inventory inv) {
ItemStack[] contents = inv.getContents(); ItemStack[] contents = inv.getContents();
int minSlot = 0; int minSlot = 0;
int maxSlot = contents.length; int maxSlot = contents.length;
@ -137,7 +137,7 @@ final class CargoUtils {
return null; return null;
} }
public static ItemStackAndInteger withdraw(Block node, Block target, int index) { protected static ItemStackAndInteger withdraw(Block node, Block target, int index) {
DirtyChestMenu menu = getChestMenu(target); DirtyChestMenu menu = getChestMenu(target);
if (menu != null) { if (menu != null) {
@ -181,7 +181,7 @@ final class CargoUtils {
return null; return null;
} }
public static ItemStack insert(Block node, Block target, ItemStack stack, int index) { protected static ItemStack insert(Block node, Block target, ItemStack stack, int index) {
if (!matchesFilter(node, stack, index)) return stack; if (!matchesFilter(node, stack, index)) return stack;
DirtyChestMenu menu = getChestMenu(target); DirtyChestMenu menu = getChestMenu(target);
@ -246,7 +246,6 @@ final class CargoUtils {
} }
} }
else if (inv instanceof BrewerInventory) { else if (inv instanceof BrewerInventory) {
if (stack.getType() == Material.POTION || stack.getType() == Material.LINGERING_POTION || stack.getType() == Material.SPLASH_POTION) { if (stack.getType() == Material.POTION || stack.getType() == Material.LINGERING_POTION || stack.getType() == Material.SPLASH_POTION) {
// Potions slot // Potions slot
maxSlot = 3; maxSlot = 3;
@ -298,7 +297,7 @@ final class CargoUtils {
return stack; return stack;
} }
public static DirtyChestMenu getChestMenu(Block block) { protected static DirtyChestMenu getChestMenu(Block block) {
if (BlockStorage.hasInventory(block)) { if (BlockStorage.hasInventory(block)) {
return BlockStorage.getInventory(block); return BlockStorage.getInventory(block);
} }
@ -306,7 +305,7 @@ final class CargoUtils {
return BlockStorage.getUniversalInventory(block); return BlockStorage.getUniversalInventory(block);
} }
public static boolean matchesFilter(Block block, ItemStack item, int index) { protected static boolean matchesFilter(Block block, ItemStack item, int index) {
if (item == null || item.getType() == Material.AIR) return false; if (item == null || item.getType() == Material.AIR) return false;
// Store the returned Config instance to avoid heavy calls // Store the returned Config instance to avoid heavy calls

View File

@ -18,11 +18,18 @@ import org.bukkit.inventory.meta.ItemMeta;
*/ */
public final class ItemStackWrapper extends ItemStack { public final class ItemStackWrapper extends ItemStack {
private ItemMeta meta; private final ItemMeta meta;
private final boolean hasItemMeta;
public ItemStackWrapper(ItemStack item) { public ItemStackWrapper(ItemStack item) {
super(item.getType()); super(item.getType());
meta = item.getItemMeta(); meta = item.getItemMeta();
hasItemMeta = item.hasItemMeta();
}
@Override
public boolean hasItemMeta() {
return hasItemMeta;
} }
@Override @Override