mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 00:38:35 +01:00
Merge branch '1.20.4' of https://github.com/Ellpeck/ActuallyAdditions into 1.20.4
This commit is contained in:
commit
9f0a9926ac
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