1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-19 19:25:48 +00:00

Fixes #1855 plus a few optimizations

This commit is contained in:
TheBusyBiscuit 2020-06-24 18:50:39 +02:00
parent 8d373a3812
commit d3f1dc6fb3
3 changed files with 31 additions and 11 deletions

View File

@ -37,6 +37,8 @@
* Performance improvements to Rainbow Blocks
* Crafting Tin cans now produces 8 items instead of 4
* Multi Tool lore now says "Crouch" instead of "Hold Shift"
* items which cannot be distributed by a Cargo Net will be dropped on the ground now instead of getting deleted
* Small performance improvements to the Cargo Net
#### Fixes
* Fixed #2005
@ -44,6 +46,7 @@
* Fixed a chunk caching issue for GEO resources
* Fixed Infused Magnet working even if you haven't researched it
* Fixed Rainbow blocks duplication glitch when timing the block break right
* Fixed #1855
## Release Candidate 13 (16 Jun 2020)
https://thebusybiscuit.github.io/builds/TheBusyBiscuit/Slimefun4/stable/#13

View File

@ -87,7 +87,10 @@ public class CargoNet extends ChestTerminalNetwork {
@Override
public NetworkComponent classifyLocation(Location l) {
String id = BlockStorage.checkID(l);
if (id == null) return null;
if (id == null) {
return null;
}
switch (id) {
case "CARGO_MANAGER":
@ -157,8 +160,8 @@ public class CargoNet extends ChestTerminalNetwork {
// Chest Terminal Stuff
Set<Location> destinations = new HashSet<>();
List<Location> output16 = output.get(16);
if (output16 != null) {
destinations.addAll(output16);
}
@ -264,17 +267,30 @@ public class CargoNet extends ChestTerminalNetwork {
stack = distributeItem(stack, inputNode, outputs);
}
DirtyChestMenu menu = CargoUtils.getChestMenu(inputTarget);
if (stack != null) {
DirtyChestMenu menu = CargoUtils.getChestMenu(inputTarget);
if (menu != null) {
menu.replaceExistingItem(previousSlot, stack);
}
else if (CargoUtils.hasInventory(inputTarget)) {
BlockState state = inputTarget.getState();
if (menu != null) {
if (menu.getItemInSlot(previousSlot) == null) {
menu.replaceExistingItem(previousSlot, stack);
}
else {
inputTarget.getWorld().dropItem(inputTarget.getLocation().add(0, 1, 0), stack);
}
}
else if (CargoUtils.hasInventory(inputTarget)) {
BlockState state = inputTarget.getState();
if (state instanceof InventoryHolder) {
Inventory inv = ((InventoryHolder) state).getInventory();
inv.setItem(previousSlot, stack);
if (state instanceof InventoryHolder) {
Inventory inv = ((InventoryHolder) state).getInventory();
if (inv.getItem(previousSlot) == null) {
inv.setItem(previousSlot, stack);
}
else {
inputTarget.getWorld().dropItem(inputTarget.getLocation().add(0, 1, 0), stack);
}
}
}
}
}

View File

@ -194,6 +194,7 @@ final class CargoUtils {
}
}
}
return null;
}