mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 15:18:34 +01:00
Fix hopping item interface
This commit is contained in:
parent
26758cb41b
commit
5a1eabeac4
3 changed files with 12 additions and 10 deletions
|
@ -198,16 +198,15 @@ public class TileEntityItemInterface extends TileEntityBase {
|
||||||
|
|
||||||
int slotsQueried = 0;
|
int slotsQueried = 0;
|
||||||
for (GenericItemHandlerInfo info : this.genericInfos) {
|
for (GenericItemHandlerInfo info : this.genericInfos) {
|
||||||
|
if (!info.isLoaded()) continue;
|
||||||
for (SlotlessableItemHandlerWrapper handler : info.handlers) {
|
for (SlotlessableItemHandlerWrapper handler : info.handlers) {
|
||||||
Optional<IItemHandler> normalHandler = Optional.ofNullable(handler.getNormalHandler());
|
IItemHandler normalHandler = handler.getNormalHandler();
|
||||||
slotsQueried += normalHandler.map(cap -> {
|
if (normalHandler != null) {
|
||||||
int queried = 0;
|
for (int i = 0; i < normalHandler.getSlots(); i++) {
|
||||||
for (int i = 0; i < cap.getSlots(); i++) {
|
this.itemHandlerInfos.put(slotsQueried, new IItemHandlerInfo(normalHandler, i, info.relayInQuestion));
|
||||||
this.itemHandlerInfos.put(queried, new IItemHandlerInfo(cap, i, info.relayInQuestion));
|
slotsQueried++;
|
||||||
queried++;
|
|
||||||
}
|
}
|
||||||
return queried;
|
}
|
||||||
}).orElse(0);
|
|
||||||
// TODO: [port] add back
|
// TODO: [port] add back
|
||||||
|
|
||||||
// if (ActuallyAdditions.commonCapsLoaded) {
|
// if (ActuallyAdditions.commonCapsLoaded) {
|
||||||
|
|
|
@ -41,6 +41,7 @@ import net.neoforged.neoforge.event.EventHooks;
|
||||||
import net.neoforged.neoforge.event.level.BlockEvent.BreakEvent;
|
import net.neoforged.neoforge.event.level.BlockEvent.BreakEvent;
|
||||||
import net.neoforged.neoforge.fluids.FluidStack;
|
import net.neoforged.neoforge.fluids.FluidStack;
|
||||||
import net.neoforged.neoforge.fluids.capability.IFluidHandler;
|
import net.neoforged.neoforge.fluids.capability.IFluidHandler;
|
||||||
|
import net.neoforged.neoforge.items.IItemHandler;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -94,7 +95,7 @@ public final class WorldUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!StackUtil.isValid(extracted)) {
|
if (!StackUtil.isValid(extracted)) {
|
||||||
/* IItemHandler handler = extractWrapper.getNormalHandler();
|
IItemHandler handler = extractWrapper.getNormalHandler();
|
||||||
if (handler != null) {
|
if (handler != null) {
|
||||||
for (int i = Math.max(0, slotStart); i < Math.min(slotEnd, handler.getSlots()); i++) {
|
for (int i = Math.max(0, slotStart); i < Math.min(slotEnd, handler.getSlots()); i++) {
|
||||||
if (filter == null || !filter.needsCheck() || filter.check(handler.getStackInSlot(i))) {
|
if (filter == null || !filter.needsCheck() || filter.check(handler.getStackInSlot(i))) {
|
||||||
|
@ -105,7 +106,7 @@ public final class WorldUtil {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return extracted;
|
return extracted;
|
||||||
|
|
|
@ -16,6 +16,7 @@ public class SlotlessableItemHandlerWrapper {
|
||||||
//TODO: Check if we need this wrapper at all? The previous implementation used CommonCapabilities ISlotlessItemhandler
|
//TODO: Check if we need this wrapper at all? The previous implementation used CommonCapabilities ISlotlessItemhandler
|
||||||
|
|
||||||
private final IItemHandler normalHandler;
|
private final IItemHandler normalHandler;
|
||||||
|
@Deprecated
|
||||||
private final Object slotlessHandler;
|
private final Object slotlessHandler;
|
||||||
|
|
||||||
public SlotlessableItemHandlerWrapper(IItemHandler normalHandler, Object slotlessHandler) {
|
public SlotlessableItemHandlerWrapper(IItemHandler normalHandler, Object slotlessHandler) {
|
||||||
|
@ -27,6 +28,7 @@ public class SlotlessableItemHandlerWrapper {
|
||||||
return this.normalHandler;
|
return this.normalHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public Object getSlotlessHandler() {
|
public Object getSlotlessHandler() {
|
||||||
return this.slotlessHandler;
|
return this.slotlessHandler;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue