mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 07:13:28 +01:00
Auto pickup fixed
This commit is contained in:
parent
d704c4a4ba
commit
edccaec7df
2 changed files with 18 additions and 2 deletions
|
@ -19,6 +19,7 @@ import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
|
|||
import de.ellpeck.actuallyadditions.mod.items.DrillItem;
|
||||
import de.ellpeck.actuallyadditions.mod.items.Sack;
|
||||
import de.ellpeck.actuallyadditions.mod.network.PacketHandlerHelper;
|
||||
import de.ellpeck.actuallyadditions.mod.sack.SackManager;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.FilterSettings;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
||||
|
@ -72,8 +73,12 @@ public class CommonEvents {
|
|||
boolean changed = false;
|
||||
|
||||
boolean isVoid = ((Sack) invStack.getItem()).isVoid;
|
||||
ItemStackHandlerAA inv = new ItemStackHandlerAA(28); //TODO whats going on here
|
||||
DrillItem.loadSlotsFromNBT(inv, invStack);
|
||||
var optHandler = SackManager.get().getHandler(invStack);
|
||||
|
||||
if (optHandler.isEmpty())
|
||||
continue;
|
||||
|
||||
ItemStackHandlerAA inv = optHandler.get();
|
||||
|
||||
FilterSettings filter = new FilterSettings(4, false, false);
|
||||
filter.readFromNBT(invStack.getOrCreateTag(), "Filter");
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package de.ellpeck.actuallyadditions.mod.sack;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.ListTag;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
@ -70,6 +71,16 @@ public class SackManager extends SavedData {
|
|||
return Optional.empty();
|
||||
}
|
||||
|
||||
public Optional<ItemStackHandlerAA> getHandler(ItemStack stack) {
|
||||
if (stack.getOrCreateTag().contains("UUID")) {
|
||||
UUID uuid = stack.getTag().getUUID("UUID");
|
||||
if (data.containsKey(uuid))
|
||||
return Optional.of(data.get(uuid).getSpecialHandler());
|
||||
}
|
||||
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
public static SackManager load(CompoundTag nbt) {
|
||||
if (nbt.contains("Sacks")) {
|
||||
ListTag list = nbt.getList("Sacks", CompoundTag.TAG_COMPOUND);
|
||||
|
|
Loading…
Reference in a new issue