mirror of
https://github.com/GTNewHorizons/Applied-Energistics-2-Unofficial.git
synced 2026-10-25 20:22:23 +00:00
Merge branch 'master' into improve-fluid-adaptor-init
This commit is contained in:
commit
04efee1914
14 files changed
+355
-40
No files matched your search
@@ -31,6 +31,8 @@ import appeng.util.IterationCounter;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import appeng.util.item.ImmutableAEItemStackWrapper;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectIterators;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectList;
|
||||
|
||||
public class MEItemIO implements ItemIO {
|
||||
|
||||
@@ -187,12 +189,13 @@ public class MEItemIO implements ItemIO {
|
||||
if (isFiltered()) {
|
||||
return new FilteredInventoryIterator(allowedSlots);
|
||||
} else {
|
||||
IAEItemStack[] contents = storage.getStorageList().toArray(new IAEItemStack[0]);
|
||||
// Limit the polled stacks to 64 temporarily to avoid performance issues. This should be fine for now.
|
||||
ObjectList<IAEItemStack> contents = ObjectIterators.pour(storage.getStorageList().iterator(), 64);
|
||||
|
||||
// Add 64 so that there are empty fake 'slots' to insert into. Otherwise [InventoryIterator.hasNext()] will
|
||||
// always return false. This could be higher, but 64 is a reasonable default for anything that will try to
|
||||
// insert via the iterator.
|
||||
int[] slots = new int[contents.length + 64];
|
||||
int[] slots = new int[contents.size() + 64];
|
||||
|
||||
for (int i = 0; i < slots.length; i++) slots[i] = i;
|
||||
|
||||
@@ -284,9 +287,9 @@ public class MEItemIO implements ItemIO {
|
||||
|
||||
private class UnfilteredInventoryIterator extends AbstractInventoryIterator {
|
||||
|
||||
private final IAEItemStack[] contents;
|
||||
private final ObjectList<IAEItemStack> contents;
|
||||
|
||||
public UnfilteredInventoryIterator(int[] slots, IAEItemStack[] contents) {
|
||||
public UnfilteredInventoryIterator(int[] slots, ObjectList<IAEItemStack> contents) {
|
||||
super(slots);
|
||||
|
||||
this.contents = contents;
|
||||
@@ -294,9 +297,9 @@ public class MEItemIO implements ItemIO {
|
||||
|
||||
@Override
|
||||
protected ItemStack getStackInSlot(int slot) {
|
||||
if (slot < 0 || slot >= contents.length) return null;
|
||||
if (slot < 0 || slot >= contents.size()) return null;
|
||||
|
||||
IAEItemStack stack = contents[slot];
|
||||
IAEItemStack stack = contents.get(slot);
|
||||
|
||||
return stack == null ? null : stack.getItemStack();
|
||||
}
|
||||
@@ -305,9 +308,9 @@ public class MEItemIO implements ItemIO {
|
||||
public ItemStack extract(int amount, boolean force) {
|
||||
int slot = getCurrentSlot();
|
||||
|
||||
if (slot < 0 || slot >= contents.length) return null;
|
||||
if (slot < 0 || slot >= contents.size()) return null;
|
||||
|
||||
IAEItemStack current = contents[slot];
|
||||
IAEItemStack current = contents.get(slot);
|
||||
|
||||
if (current == null) return null;
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import java.util.function.Predicate;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
import org.apache.commons.lang3.time.DurationFormatUtils;
|
||||
import org.lwjgl.input.Mouse;
|
||||
@@ -228,6 +229,10 @@ public class GuiCraftingCPUTable {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
if (hoveredCpu != null) {
|
||||
EnumChatFormatting green = EnumChatFormatting.GREEN;
|
||||
EnumChatFormatting reset = EnumChatFormatting.RESET;
|
||||
EnumChatFormatting gold = EnumChatFormatting.GOLD;
|
||||
|
||||
StringBuilder tooltip = new StringBuilder();
|
||||
String name = hoveredCpu.getName();
|
||||
if (name != null && !name.isEmpty()) {
|
||||
@@ -241,6 +246,7 @@ public class GuiCraftingCPUTable {
|
||||
}
|
||||
IAEItemStack crafting = hoveredCpu.getCrafting();
|
||||
if (crafting != null && crafting.getStackSize() > 0) {
|
||||
|
||||
final long elapsedInMilliseconds = TimeUnit.MILLISECONDS
|
||||
.convert(hoveredCpu.getCraftingElapsedTime(), TimeUnit.NANOSECONDS);
|
||||
final String elapsedTimeText = DurationFormatUtils
|
||||
@@ -248,47 +254,73 @@ public class GuiCraftingCPUTable {
|
||||
final double craftingPercentage = 100
|
||||
- (double) (hoveredCpu.getRemainingItems()) / (double) hoveredCpu.getTotalItems() * 100;
|
||||
|
||||
tooltip.append(GuiText.Crafting.getLocal());
|
||||
tooltip.append(green);
|
||||
tooltip.append(GuiText.CraftName.getLocal());
|
||||
tooltip.append(reset);
|
||||
tooltip.append(": ");
|
||||
tooltip.append(NumberFormat.getInstance().format(crafting.getStackSize()));
|
||||
tooltip.append(' ');
|
||||
tooltip.append(crafting.getItemStack().getDisplayName());
|
||||
tooltip.append('\n');
|
||||
|
||||
tooltip.append(NumberFormat.getInstance().format(hoveredCpu.getRemainingItems()));
|
||||
tooltip.append(" / ");
|
||||
tooltip.append(NumberFormat.getInstance().format(hoveredCpu.getTotalItems()));
|
||||
tooltip.append(String.format(" %02.2f %%", craftingPercentage));
|
||||
tooltip.append(green);
|
||||
tooltip.append(GuiText.Remains.getLocal());
|
||||
tooltip.append(reset);
|
||||
tooltip.append(": ");
|
||||
tooltip.append(NumberFormat.getInstance().format(crafting.getStackSize()));
|
||||
tooltip.append('\n');
|
||||
|
||||
tooltip.append(green);
|
||||
tooltip.append(GuiText.Progress.getLocal());
|
||||
tooltip.append(reset);
|
||||
tooltip.append(": ");
|
||||
tooltip.append(NumberFormat.getInstance().format(hoveredCpu.getTotalItems()));
|
||||
tooltip.append(" / ");
|
||||
tooltip.append(
|
||||
NumberFormat.getInstance().format(hoveredCpu.getTotalItems() - hoveredCpu.getRemainingItems()));
|
||||
tooltip.append(" (");
|
||||
tooltip.append(gold);
|
||||
tooltip.append(String.format("%02.2f%%", craftingPercentage));
|
||||
tooltip.append(reset);
|
||||
tooltip.append(") ");
|
||||
tooltip.append('\n');
|
||||
|
||||
tooltip.append(green);
|
||||
tooltip.append(GuiText.TimeUsed.getLocal());
|
||||
tooltip.append(reset);
|
||||
tooltip.append(": ");
|
||||
tooltip.append(elapsedTimeText);
|
||||
tooltip.append('\n');
|
||||
}
|
||||
|
||||
if (hoveredCpu.getUsedStorage() > 0) {
|
||||
tooltip.append(green);
|
||||
tooltip.append(GuiText.BytesUsed.getLocal());
|
||||
tooltip.append(reset);
|
||||
tooltip.append(": ");
|
||||
tooltip.append(hoveredCpu.formatUsedStorage());
|
||||
tooltip.append(" / ");
|
||||
tooltip.append(hoveredCpu.formatStorage());
|
||||
tooltip.append('\n');
|
||||
} else if (hoveredCpu.getStorage() > 0) {
|
||||
tooltip.append(green);
|
||||
tooltip.append(GuiText.Bytes.getLocal());
|
||||
tooltip.append(reset);
|
||||
tooltip.append(": ");
|
||||
tooltip.append(hoveredCpu.formatStorage());
|
||||
tooltip.append('\n');
|
||||
}
|
||||
if (hoveredCpu.getCoprocessors() > 0) {
|
||||
tooltip.append(green);
|
||||
tooltip.append(GuiText.CoProcessors.getLocal());
|
||||
tooltip.append(reset);
|
||||
tooltip.append(": ");
|
||||
tooltip.append(hoveredCpu.formatCoprocessors());
|
||||
tooltip.append('\n');
|
||||
}
|
||||
|
||||
// Crafting Allow Mode part
|
||||
tooltip.append(green);
|
||||
tooltip.append(GuiText.CPUAllowMode.getLocal());
|
||||
tooltip.append(reset);
|
||||
tooltip.append(": ");
|
||||
switch (hoveredCpu.allowMode()) {
|
||||
case ALLOW_ALL -> tooltip.append(GuiText.CPUAllowAll.getLocal());
|
||||
|
||||
@@ -46,6 +46,9 @@ public enum GuiText implements Localization {
|
||||
Types,
|
||||
QuantumLinkChamber,
|
||||
PortableCell,
|
||||
CraftName,
|
||||
Remains,
|
||||
Progress,
|
||||
|
||||
NetworkTool,
|
||||
AdvancedNetworkTool,
|
||||
|
||||
@@ -46,7 +46,15 @@ public enum WailaText implements Localization {
|
||||
wireless_notconnected,
|
||||
wireless_channels,
|
||||
wireless_power,
|
||||
wireless_name;
|
||||
wireless_name,
|
||||
CoordinateX,
|
||||
CoordinateY,
|
||||
CoordinateZ,
|
||||
Dimension,
|
||||
Id,
|
||||
ConnectedTo,
|
||||
Disconnected,
|
||||
Singularity;
|
||||
|
||||
private final String formatedName;
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
import java.util.OptionalInt;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
@@ -43,6 +44,8 @@ import com.glodblock.github.common.parts.PartFluidInterface;
|
||||
import com.glodblock.github.common.parts.PartFluidP2PInterface;
|
||||
import com.glodblock.github.common.tile.TileFluidInterface;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.gtnewhorizon.gtnhlib.capability.item.ItemSink;
|
||||
import com.gtnewhorizon.gtnhlib.util.ItemUtil;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
@@ -81,6 +84,7 @@ import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.api.util.IConfigManager;
|
||||
@@ -913,7 +917,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
@Override
|
||||
public IMEMonitor<IAEItemStack> getItemInventory() {
|
||||
if (this.hasConfig()) {
|
||||
return new InterfaceInventory(this);
|
||||
return new InterfaceInventory();
|
||||
}
|
||||
|
||||
return this.items;
|
||||
@@ -987,13 +991,11 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
return myInterface;
|
||||
}
|
||||
|
||||
final DualityInterface di = this;
|
||||
|
||||
return new IStorageMonitorable() {
|
||||
|
||||
@Override
|
||||
public IMEMonitor<IAEItemStack> getItemInventory() {
|
||||
return new InterfaceInventory(di);
|
||||
return new InterfaceInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1019,11 +1021,25 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
|
||||
private boolean inventoryCountsAsEmpty(TileEntity te, InventoryAdaptor ad, ForgeDirection side) {
|
||||
String name = te.getBlockType().getUnlocalizedName();
|
||||
boolean isEmpty = (name.equals("gt.blockmachines") || name.equals("tile.interface")
|
||||
|| name.equals("tile.blockWritingTable")) && tileHasOnlyIgnoredItems(ad);
|
||||
|
||||
if (name.equals("gt.blockmachines")) {
|
||||
ItemSink sink = ItemUtil.getItemSink(te, side);
|
||||
|
||||
if (sink != null) {
|
||||
OptionalInt present = sink.getStoredItemsInSink(
|
||||
stack -> !BlockingModeIgnoreItemRegistry.instance().isIgnored(stack.toStackFast()));
|
||||
|
||||
return present.orElse(0) == 0;
|
||||
}
|
||||
}
|
||||
|
||||
boolean isEmpty = (name.equals("tile.interface") || name.equals("tile.blockWritingTable"))
|
||||
&& tileHasOnlyIgnoredItems(ad);
|
||||
|
||||
if (shouldCheckFluid()) {
|
||||
isEmpty = name.equals("tile.interface");
|
||||
}
|
||||
|
||||
return isEmpty;
|
||||
}
|
||||
|
||||
@@ -1674,9 +1690,9 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
|
||||
private class InterfaceInventory extends MEMonitorIInventory {
|
||||
|
||||
public InterfaceInventory(final DualityInterface tileInterface) {
|
||||
super(new AdaptorIInventory(tileInterface.storage));
|
||||
this.setActionSource(new MachineSource(DualityInterface.this.iHost));
|
||||
public InterfaceInventory() {
|
||||
super(new AdaptorIInventory(storage));
|
||||
this.setActionSource(new MachineSource(iHost));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1697,5 +1713,15 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
|
||||
return super.extractItems(request, type, src);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemList<IAEItemStack> getStorageList() {
|
||||
IItemList<IAEItemStack> list = AEApi.instance().storage().createPrimitiveItemList();
|
||||
for (ItemStack stack : getStorage()) {
|
||||
if (stack == null) continue;
|
||||
list.add(AEApi.instance().storage().createItemStack(stack));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -46,6 +46,8 @@ public class GT implements IIntegrationModule, IGT {
|
||||
public int getGTMachineHash(TileEntity te) {
|
||||
IGregTechTileEntity igte = (IGregTechTileEntity) te;
|
||||
|
||||
return igte.canAccessData() ? 1 : 0;
|
||||
// PartStorageBus uses 0 to represent 'no hash' so we offset the numbers up one here. They just need to be
|
||||
// distinct. This controls when the item IO is reset.
|
||||
return igte.canAccessData() ? 2 : 1;
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,8 @@ import appeng.integration.modules.waila.tile.CraftingMonitorWailaDataProvider;
|
||||
import appeng.integration.modules.waila.tile.InterfaceDataProvider;
|
||||
import appeng.integration.modules.waila.tile.PowerStateWailaDataProvider;
|
||||
import appeng.integration.modules.waila.tile.PowerStorageWailaDataProvider;
|
||||
import appeng.integration.modules.waila.tile.QuantumBridgeWailaDataProvider;
|
||||
import appeng.tile.qnb.TileQuantumBridge;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
@@ -56,8 +58,10 @@ public final class TileWailaDataProvider implements IWailaDataProvider {
|
||||
final IWailaDataProvider craftingBlock = new PowerStateWailaDataProvider();
|
||||
final IWailaDataProvider craftingMonitor = new CraftingMonitorWailaDataProvider();
|
||||
final IWailaDataProvider interfaceBlock = new InterfaceDataProvider();
|
||||
final IWailaDataProvider quantumBridge = new QuantumBridgeWailaDataProvider();
|
||||
|
||||
this.providers = Lists.newArrayList(charger, energyCell, craftingBlock, craftingMonitor, interfaceBlock);
|
||||
this.providers = Lists
|
||||
.newArrayList(charger, energyCell, craftingBlock, craftingMonitor, interfaceBlock, quantumBridge);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -107,7 +111,8 @@ public final class TileWailaDataProvider implements IWailaDataProvider {
|
||||
provider.getNBTData(player, te, tag, world, x, y, z);
|
||||
}
|
||||
if (te instanceof ICustomNameObject customNameObject && customNameObject.hasCustomName()
|
||||
&& !customNameObject.getCustomName().isEmpty()) {
|
||||
&& !customNameObject.getCustomName().isEmpty()
|
||||
&& !(te instanceof TileQuantumBridge)) {
|
||||
tag.setString(NBT_TILE_CUSTOM_NAME, customNameObject.getCustomName());
|
||||
}
|
||||
|
||||
|
||||
+134
@@ -0,0 +1,134 @@
|
||||
package appeng.integration.modules.waila.tile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldProvider;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.features.ILocatable;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.core.localization.WailaText;
|
||||
import appeng.integration.modules.waila.BaseWailaDataProvider;
|
||||
import appeng.me.cluster.implementations.QuantumCluster;
|
||||
import appeng.tile.qnb.TileQuantumBridge;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
|
||||
public final class QuantumBridgeWailaDataProvider extends BaseWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(final ItemStack itemStack, final List<String> currentToolTip,
|
||||
final IWailaDataAccessor accessor, final IWailaConfigHandler config) {
|
||||
|
||||
final TileEntity te = accessor.getTileEntity();
|
||||
if (te instanceof TileQuantumBridge) {
|
||||
MovingObjectPosition pos = accessor.getPosition();
|
||||
NBTTagCompound nbt = accessor.getNBTData();
|
||||
|
||||
int x = pos.blockX;
|
||||
int y = pos.blockY;
|
||||
int z = pos.blockZ;
|
||||
boolean hasConnection = nbt.getBoolean("hasConnection");
|
||||
|
||||
if (hasConnection) {
|
||||
|
||||
int sideAX = nbt.getInteger("sideAX");
|
||||
int sideAY = nbt.getInteger("sideAY");
|
||||
int sideAZ = nbt.getInteger("sideAZ");
|
||||
int sideADim = nbt.getInteger("sideADim");
|
||||
String sideAName = nbt.getString("sideAName");
|
||||
|
||||
int sideBX = nbt.getInteger("sideBX");
|
||||
int sideBY = nbt.getInteger("sideBY");
|
||||
int sideBZ = nbt.getInteger("sideBZ");
|
||||
int sideBDim = nbt.getInteger("sideBDim");
|
||||
String sideBName = nbt.getString("sideBName");
|
||||
|
||||
if (x == sideAX && y == sideAY && z == sideAZ) {
|
||||
getInfo(sideBX, sideBY, sideBZ, sideBDim, sideAName, currentToolTip);
|
||||
} else if (x == sideBX && y == sideBY && z == sideBZ) {
|
||||
getInfo(sideAX, sideAY, sideAZ, sideADim, sideBName, currentToolTip);
|
||||
}
|
||||
} else {
|
||||
currentToolTip.add(EnumChatFormatting.RED + WailaText.Disconnected.getLocal());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return currentToolTip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x,
|
||||
int y, int z) {
|
||||
if (te instanceof TileQuantumBridge quantumBridge) {
|
||||
QuantumCluster cluster = (QuantumCluster) quantumBridge.getCluster();
|
||||
if (cluster != null) {
|
||||
if (cluster.getConnection() != null) {
|
||||
tag.setBoolean("hasConnection", true);
|
||||
final ILocatable myOtherSide = cluster.getOtherSide() == 0 ? null
|
||||
: AEApi.instance().registries().locatable().getLocatableBy(cluster.getOtherSide());
|
||||
if (myOtherSide instanceof QuantumCluster otherCluster) {
|
||||
DimensionalCoord sideA = new DimensionalCoord(cluster.getCenter());
|
||||
DimensionalCoord sideB = new DimensionalCoord(otherCluster.getCenter());
|
||||
TileQuantumBridge sideABridge = cluster.getCenter();
|
||||
TileQuantumBridge sideBBridge = otherCluster.getCenter();
|
||||
String nameSideA = sideABridge.getInternalInventory().getStackInSlot(0).getDisplayName();
|
||||
String nameSideB = sideBBridge.getInternalInventory().getStackInSlot(0).getDisplayName();
|
||||
|
||||
tag.setInteger("sideAX", sideA.x);
|
||||
tag.setInteger("sideAY", sideA.y);
|
||||
tag.setInteger("sideAZ", sideA.z);
|
||||
tag.setInteger("sideADim", sideA.getDimension());
|
||||
if (!nameSideA.equals("Quantum Entangled Singularity")) {
|
||||
tag.setString("sideAName", nameSideA);
|
||||
}
|
||||
|
||||
tag.setInteger("sideBX", sideB.x);
|
||||
tag.setInteger("sideBY", sideB.y);
|
||||
tag.setInteger("sideBZ", sideB.z);
|
||||
tag.setInteger("sideBDim", sideB.getDimension());
|
||||
if (!nameSideB.equals("Quantum Entangled Singularity")) {
|
||||
tag.setString("sideBName", nameSideB);
|
||||
}
|
||||
return tag;
|
||||
}
|
||||
}
|
||||
}
|
||||
tag.setBoolean("hasConnection", false);
|
||||
}
|
||||
return tag;
|
||||
}
|
||||
|
||||
public void getInfo(int x, int y, int z, int dimId, String nameItemStack, List<String> currentToolTip) {
|
||||
EnumChatFormatting green = EnumChatFormatting.GREEN;
|
||||
EnumChatFormatting yellow = EnumChatFormatting.YELLOW;
|
||||
currentToolTip.add(EnumChatFormatting.BLUE + WailaText.ConnectedTo.getLocal() + ":");
|
||||
if (!nameItemStack.isEmpty()) {
|
||||
currentToolTip.add(green + WailaText.Singularity.getLocal() + ": " + yellow + nameItemStack);
|
||||
}
|
||||
currentToolTip.add(
|
||||
green + WailaText.Dimension.getLocal()
|
||||
+ ": "
|
||||
+ yellow
|
||||
+ WorldProvider.getProviderForDimension(dimId).getDimensionName()
|
||||
+ " "
|
||||
+ "["
|
||||
+ EnumChatFormatting.WHITE
|
||||
+ WailaText.Id.getLocal()
|
||||
+ ": "
|
||||
+ dimId
|
||||
+ yellow
|
||||
+ "]");
|
||||
currentToolTip.add(green + WailaText.CoordinateX.getLocal() + ": " + yellow + x);
|
||||
currentToolTip.add(green + WailaText.CoordinateY.getLocal() + ": " + yellow + y);
|
||||
currentToolTip.add(green + WailaText.CoordinateZ.getLocal() + ": " + yellow + z);
|
||||
}
|
||||
}
|
||||
@@ -1035,7 +1035,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU {
|
||||
if (this.myLastLink != null && this.isBusy()
|
||||
&& this.finalOutput.isSameType((Object) job.getOutput())
|
||||
&& this.availableStorage >= this.usedStorage + job.getByteTotal()) {
|
||||
return mergeJob(g, job, src);
|
||||
return mergeJob(g, job, src, requestingMachine);
|
||||
}
|
||||
|
||||
if (!this.tasks.isEmpty() || !this.waitingFor.isEmpty()) {
|
||||
@@ -1169,7 +1169,8 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU {
|
||||
}
|
||||
}
|
||||
|
||||
public ICraftingLink mergeJob(final IGrid g, final ICraftingJob job, final BaseActionSource src) {
|
||||
public ICraftingLink mergeJob(final IGrid g, final ICraftingJob job, final BaseActionSource src,
|
||||
final ICraftingRequester requestingMachine) {
|
||||
final IStorageGrid sg = g.getCache(IStorageGrid.class);
|
||||
final MECraftingInventory ci = new MECraftingInventory(sg, true, false, false);
|
||||
|
||||
@@ -1197,7 +1198,13 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU {
|
||||
this.prepareStepCount();
|
||||
this.markDirty();
|
||||
this.updateCPU();
|
||||
return this.myLastLink;
|
||||
|
||||
final ICraftingLink whatLink = new CraftingLink(
|
||||
this.generateLinkData(this.myLastLink.getCraftingID(), false, true),
|
||||
requestingMachine);
|
||||
|
||||
this.submitLink(whatLink);
|
||||
return whatLink;
|
||||
} else {
|
||||
inventory = backupInventory;
|
||||
waitingForMissing = backupWaitingForMissing;
|
||||
|
||||
@@ -246,4 +246,12 @@ public class QuantumCluster implements ILocatable, IAECluster {
|
||||
private void setRing(final TileQuantumBridge[] ring) {
|
||||
this.Ring = ring;
|
||||
}
|
||||
|
||||
public long getOtherSide() {
|
||||
return otherSide;
|
||||
}
|
||||
|
||||
public ConnectionWrapper getConnection() {
|
||||
return connection;
|
||||
}
|
||||
}
|
||||
@@ -204,6 +204,7 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
|
||||
}
|
||||
|
||||
public void readFromNBT(final NBTTagCompound data, final String name) {
|
||||
if (!data.hasKey(name)) return;
|
||||
final NBTTagCompound c = data.getCompoundTag(name);
|
||||
if (c != null) {
|
||||
this.readFromNBT(c);
|
||||
@@ -213,8 +214,9 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
|
||||
public void readFromNBT(final NBTTagCompound target) {
|
||||
for (int x = 0; x < this.size; x++) {
|
||||
try {
|
||||
final NBTTagCompound c = target.getCompoundTag("#" + x);
|
||||
|
||||
final String key = "#" + x;
|
||||
if (!target.hasKey(key)) continue;
|
||||
final NBTTagCompound c = target.getCompoundTag(key);
|
||||
if (c != null) {
|
||||
this.inv[x] = ItemStack.loadItemStackFromNBT(c);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.google.common.base.Optional;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.definitions.IBlockDefinition;
|
||||
import appeng.api.features.ILocatable;
|
||||
import appeng.api.networking.GridFlags;
|
||||
import appeng.api.networking.events.MENetworkEventSubscribe;
|
||||
import appeng.api.networking.events.MENetworkPowerStatusChange;
|
||||
@@ -301,4 +302,38 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
|
||||
public byte getCorner() {
|
||||
return this.corner;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCustomName() {
|
||||
ItemStack sideAStack = getStackInSlot(0);
|
||||
if (sideAStack != null) {
|
||||
return sideAStack.getDisplayName();
|
||||
}
|
||||
return "Quantum Entangled Singularity";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomName() {
|
||||
return getStackInSlot(0) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCustomName(String name) {
|
||||
if (name.isEmpty()) name = "Quantum Entangled Singularity";
|
||||
ItemStack sideAStack = getStackInSlot(0);
|
||||
if (sideAStack != null) {
|
||||
sideAStack.setStackDisplayName(name);
|
||||
if (cluster.getCenter() != null) {
|
||||
final ILocatable myOtherSide = cluster.getOtherSide() == 0 ? null
|
||||
: AEApi.instance().registries().locatable().getLocatableBy(cluster.getOtherSide());
|
||||
if (myOtherSide instanceof QuantumCluster sideBCluster) {
|
||||
ItemStack sideBStack = sideBCluster.getCenter().getStackInSlot(0);
|
||||
if (sideBStack != null) {
|
||||
sideBStack.setStackDisplayName(name);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,6 @@ import com.gtnewhorizon.gtnhlib.capability.item.ItemIO;
|
||||
import com.gtnewhorizon.gtnhlib.item.FastImmutableItemStack;
|
||||
import com.gtnewhorizon.gtnhlib.item.ImmutableItemStack;
|
||||
import com.gtnewhorizon.gtnhlib.item.InventoryIterator;
|
||||
import com.gtnewhorizon.gtnhlib.item.ItemStackPredicate;
|
||||
import com.gtnewhorizon.gtnhlib.util.ItemUtil;
|
||||
|
||||
import appeng.api.config.FuzzyMode;
|
||||
@@ -28,13 +27,36 @@ public class AdaptorItemIO extends InventoryAdaptor {
|
||||
|
||||
@Override
|
||||
public ItemStack removeItems(int amount, ItemStack filter, IInventoryDestination destination) {
|
||||
ItemStackPredicate predicate = ItemStackPredicate.matches(filter);
|
||||
InventoryIterator iter = itemIO.sourceIterator();
|
||||
|
||||
if (destination != null) {
|
||||
predicate = predicate.and(stack -> destination.canInsert(stack.toStackFast()));
|
||||
if (iter == null) return null;
|
||||
|
||||
ItemStack out = null;
|
||||
|
||||
while (iter.hasNext() && amount > 0) {
|
||||
ImmutableItemStack immutableStack = iter.next();
|
||||
|
||||
if (immutableStack == null) continue;
|
||||
|
||||
if (filter != null && !immutableStack.matches(filter)) continue;
|
||||
|
||||
ItemStack stack = immutableStack.toStack();
|
||||
|
||||
if (destination != null && !destination.canInsert(stack)) continue;
|
||||
|
||||
if (out == null) {
|
||||
out = immutableStack.toStack(0);
|
||||
}
|
||||
|
||||
ItemStack extracted = iter.extract(amount, false);
|
||||
|
||||
if (extracted != null) {
|
||||
out.stackSize += extracted.stackSize;
|
||||
amount -= extracted.stackSize;
|
||||
}
|
||||
}
|
||||
|
||||
return itemIO.pull(predicate, stack -> Math.min(stack.getStackSize(), amount));
|
||||
return out;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -156,9 +178,25 @@ public class AdaptorItemIO extends InventoryAdaptor {
|
||||
|
||||
@Override
|
||||
public boolean containsItems() {
|
||||
InventoryIterator iter = itemIO.sourceIterator();
|
||||
if (itemIO.getStoredItemsInSink(null).orElse(0) > 0) return true;
|
||||
|
||||
return iter != null && iter.hasNext();
|
||||
InventoryIterator iter = itemIO.sinkIterator();
|
||||
|
||||
if (iter != null) {
|
||||
while (iter.hasNext()) {
|
||||
if (iter.next() != null) return true;
|
||||
}
|
||||
}
|
||||
|
||||
iter = itemIO.sourceIterator();
|
||||
|
||||
if (iter != null) {
|
||||
while (iter.hasNext()) {
|
||||
if (iter.next() != null) return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -230,6 +230,9 @@ gui.appliedenergistics2.IOBuses=ME Import/Export Bus
|
||||
gui.appliedenergistics2.Stores=Stores
|
||||
gui.appliedenergistics2.BytesUsed=Bytes Used
|
||||
gui.appliedenergistics2.TimeUsed=Time Used
|
||||
gui.appliedenergistics2.CraftName=Craft Name
|
||||
gui.appliedenergistics2.Remains=Remains
|
||||
gui.appliedenergistics2.Progress=Progress
|
||||
gui.appliedenergistics2.Types=Types
|
||||
gui.appliedenergistics2.Blank=Blank
|
||||
gui.appliedenergistics2.Unlinked=Unlinked
|
||||
@@ -666,6 +669,15 @@ waila.appliedenergistics2.CraftingLockedByLackOfRedstoneSignal=Locked by lack of
|
||||
waila.appliedenergistics2.CraftingLockedByRedstoneSignal=Locked by redstone signal
|
||||
waila.appliedenergistics2.CraftingLockedUntilPulse=Waiting for redstone pulse to unlock
|
||||
waila.appliedenergistics2.CraftingLockedUntilResult=Waiting for results to unlock
|
||||
waila.appliedenergistics2.CoordinateX=X
|
||||
waila.appliedenergistics2.CoordinateY=Y
|
||||
waila.appliedenergistics2.CoordinateZ=Z
|
||||
waila.appliedenergistics2.Dimension=Dimension
|
||||
waila.appliedenergistics2.Id=id
|
||||
waila.appliedenergistics2.ConnectedTo=Connected to
|
||||
waila.appliedenergistics2.Disconnected=Disconnected
|
||||
waila.appliedenergistics2.Singularity=Singularity
|
||||
|
||||
|
||||
# Items
|
||||
item.appliedenergistics2.ItemBasicStorageCell.1k.name=§61k§r ME Storage Cell
|
||||
|
||||
Reference in new issue
Block a user