mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-19 19:25:48 +00:00
Fixes #1903
This commit is contained in:
parent
886121e226
commit
741d18a8e8
@ -41,6 +41,7 @@
|
||||
* Fixed #1893
|
||||
* Fixed #1897
|
||||
* Fixed #1908
|
||||
* Fixed #1903
|
||||
|
||||
## Release Candidate 11 (25 Apr 2020)
|
||||
|
||||
|
@ -29,7 +29,7 @@ final class CargoUtils {
|
||||
|
||||
private CargoUtils() {}
|
||||
|
||||
public static boolean hasInventory(Block block) {
|
||||
protected static boolean hasInventory(Block block) {
|
||||
if (block == null) {
|
||||
return false;
|
||||
}
|
||||
@ -68,7 +68,7 @@ final class CargoUtils {
|
||||
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);
|
||||
|
||||
if (menu == null) {
|
||||
@ -103,7 +103,7 @@ final class CargoUtils {
|
||||
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();
|
||||
int minSlot = 0;
|
||||
int maxSlot = contents.length;
|
||||
@ -137,7 +137,7 @@ final class CargoUtils {
|
||||
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);
|
||||
|
||||
if (menu != null) {
|
||||
@ -181,7 +181,7 @@ final class CargoUtils {
|
||||
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;
|
||||
|
||||
DirtyChestMenu menu = getChestMenu(target);
|
||||
@ -246,7 +246,6 @@ final class CargoUtils {
|
||||
}
|
||||
}
|
||||
else if (inv instanceof BrewerInventory) {
|
||||
|
||||
if (stack.getType() == Material.POTION || stack.getType() == Material.LINGERING_POTION || stack.getType() == Material.SPLASH_POTION) {
|
||||
// Potions slot
|
||||
maxSlot = 3;
|
||||
@ -298,7 +297,7 @@ final class CargoUtils {
|
||||
return stack;
|
||||
}
|
||||
|
||||
public static DirtyChestMenu getChestMenu(Block block) {
|
||||
protected static DirtyChestMenu getChestMenu(Block block) {
|
||||
if (BlockStorage.hasInventory(block)) {
|
||||
return BlockStorage.getInventory(block);
|
||||
}
|
||||
@ -306,7 +305,7 @@ final class CargoUtils {
|
||||
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;
|
||||
|
||||
// Store the returned Config instance to avoid heavy calls
|
||||
|
@ -18,11 +18,18 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||
*/
|
||||
public final class ItemStackWrapper extends ItemStack {
|
||||
|
||||
private ItemMeta meta;
|
||||
private final ItemMeta meta;
|
||||
private final boolean hasItemMeta;
|
||||
|
||||
public ItemStackWrapper(ItemStack item) {
|
||||
super(item.getType());
|
||||
meta = item.getItemMeta();
|
||||
hasItemMeta = item.hasItemMeta();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasItemMeta() {
|
||||
return hasItemMeta;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user