Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 486a68d06b | |||
| 9b263c5501 | |||
| daf4910548 | |||
| 4f5bdfefe8 | |||
| c9f1387098 | |||
| 1f1d6d041a | |||
| 403a6e8b4a | |||
| 0a0c23c190 | |||
| d28cd798e9 | |||
| 3dedb7eefb | |||
| ae3295d3c9 | |||
| 4bac5f43db | |||
| 2e9a5dc8ea | |||
| 9ac4ea4e6e | |||
| 601faf5087 | |||
| 88e3df897e | |||
| f57a8cefda | |||
| d3fdac2b81 |
+1
-1
@@ -4,7 +4,7 @@ aebuild=7
|
||||
aegroup=appeng
|
||||
aebasename=appliedenergistics2
|
||||
extended=extended_life
|
||||
extendedversion=v0.53.8
|
||||
extendedversion=v0.54.0
|
||||
#########################################################
|
||||
# Versions #
|
||||
#########################################################
|
||||
|
||||
@@ -19,6 +19,15 @@
|
||||
repositories {
|
||||
mavenLocal()
|
||||
|
||||
maven {
|
||||
url "https://cursemaven.com"
|
||||
}
|
||||
|
||||
maven {
|
||||
name = "CurseForge"
|
||||
url = "https://minecraft.curseforge.com/api/maven/"
|
||||
}
|
||||
|
||||
maven {
|
||||
name "Mobius"
|
||||
url "http://mobiusstrip.eu/maven"
|
||||
@@ -68,11 +77,6 @@ repositories {
|
||||
// name 'modmaven'
|
||||
// url "https://modmaven.k-4u.nl/"
|
||||
//}
|
||||
|
||||
maven {
|
||||
name = "CurseForge"
|
||||
url = "https://minecraft.curseforge.com/api/maven/"
|
||||
}
|
||||
}
|
||||
|
||||
configurations {
|
||||
@@ -80,15 +84,22 @@ configurations {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
deobfCompile "gregtechce:gregtech:1.12.2:1.15.1.735"
|
||||
// deobfCompile "gregtechce:gregtech:1.12.2:1.15.1.735"
|
||||
// installable runtime dependencies
|
||||
mods "mcp.mobius.waila:Hwyla:${hwyla_version}"
|
||||
deobfCompile "curse.maven:gregtechceu-557242:3949406"
|
||||
|
||||
//mods "mcp.mobius.waila:Hwyla:${hwyla_version}"
|
||||
mods "curse.maven:hwyla-253449:2568751"
|
||||
mods "net.industrial-craft:industrialcraft-2:${ic2_version}:dev"
|
||||
mods "mcjty.theoneprobe:TheOneProbe-${minecraft_version}:${top_version}"
|
||||
|
||||
|
||||
// compile against provided APIs
|
||||
compileOnly "mezz.jei:jei_${minecraft_version}:${jei_version}:api"
|
||||
compileOnly "mcp.mobius.waila:Hwyla:${hwyla_version}"
|
||||
//compileOnly "mcp.mobius.waila:Hwyla:${hwyla_version}"
|
||||
compileOnly "curse.maven:hwyla-253449:2568751"
|
||||
//Code chicken lib, GTCE dependency
|
||||
deobfCompile "curse.maven:CCL-242818:2779848"
|
||||
|
||||
compileOnly "net.darkhax.tesla:Tesla-1.12.2:${tesla_version}"
|
||||
compileOnly "net.industrial-craft:industrialcraft-2:${ic2_version}:api"
|
||||
compileOnly "mcjty.theoneprobe:TheOneProbe-1.12:${top_version}:api"
|
||||
|
||||
@@ -301,7 +301,7 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity
|
||||
final NBTTagCompound data = memoryCard.getData(heldItem);
|
||||
|
||||
if (this.getUnlocalizedName().equals(savedName)) {
|
||||
tileEntity.uploadSettings(SettingsFrom.MEMORY_CARD, data);
|
||||
tileEntity.uploadSettings(SettingsFrom.MEMORY_CARD, data, player);
|
||||
memoryCard.notifyUser(player, MemoryCardMessages.SETTINGS_LOADED);
|
||||
} else {
|
||||
memoryCard.notifyUser(player, MemoryCardMessages.INVALID_MACHINE);
|
||||
|
||||
@@ -40,6 +40,7 @@ import appeng.fluids.client.render.FluidStackSizeRenderer;
|
||||
import appeng.fluids.container.slots.IMEFluidSlot;
|
||||
import appeng.helpers.InventoryAction;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import com.google.common.base.Joiner;
|
||||
import com.google.common.base.Stopwatch;
|
||||
import com.google.common.collect.Lists;
|
||||
@@ -66,11 +67,13 @@ import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidUtil;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
import net.minecraftforge.items.SlotItemHandler;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import yalter.mousetweaks.api.IMTModGuiContainer2;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.awt.*;
|
||||
import java.io.IOException;
|
||||
import java.text.DecimalFormat;
|
||||
@@ -720,8 +723,14 @@ public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContain
|
||||
if (slot instanceof SlotFake) {
|
||||
final ItemStack stack = slot.getStack();
|
||||
if (stack != ItemStack.EMPTY) {
|
||||
InventoryAction direction = wheel > 0 ? InventoryAction.PLACE_SINGLE : InventoryAction.PICKUP_SINGLE;
|
||||
final PacketInventoryAction p = new PacketInventoryAction(direction, slot.slotNumber, 0);
|
||||
final PacketInventoryAction p;
|
||||
if (Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL)) {
|
||||
InventoryAction direction = wheel > 0 ? InventoryAction.DOUBLE : InventoryAction.HALVE;
|
||||
p = new PacketInventoryAction(direction, slot.slotNumber, 0);
|
||||
} else {
|
||||
InventoryAction direction = wheel > 0 ? InventoryAction.PLACE_SINGLE : InventoryAction.PICKUP_SINGLE;
|
||||
p = new PacketInventoryAction(direction, slot.slotNumber, 0);
|
||||
}
|
||||
NetworkHandler.instance().sendToServer(p);
|
||||
}
|
||||
}
|
||||
@@ -887,10 +896,25 @@ public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContain
|
||||
this.itemRender.zLevel = 0.0F;
|
||||
}
|
||||
}
|
||||
|
||||
if (s instanceof AppEngSlot) {
|
||||
((AppEngSlot) s).setDisplay(true);
|
||||
if (s instanceof SlotPlayerInv || s instanceof SlotPlayerHotBar) {
|
||||
super.drawSlot(s);
|
||||
} else if (s instanceof AppEngSlot) {
|
||||
((AppEngSlot) s).setDisplay(true);
|
||||
this.zLevel = 100.0F;
|
||||
this.itemRender.zLevel = 100.0F;
|
||||
|
||||
if (!this.isPowered()) {
|
||||
drawRect(s.xPos, s.yPos, 16 + s.xPos, 16 + s.yPos, 0x66111111);
|
||||
}
|
||||
|
||||
this.zLevel = 0.0F;
|
||||
this.itemRender.zLevel = 0.0F;
|
||||
|
||||
// Annoying but easier than trying to splice into render item
|
||||
super.drawSlot(s);
|
||||
|
||||
this.stackSizeRenderer.renderStackSize(this.fontRenderer, AEItemStack.fromItemStack(((AppEngSlot) s).getDisplayStack()), s.xPos, s.yPos);
|
||||
return;
|
||||
} else {
|
||||
super.drawSlot(s);
|
||||
}
|
||||
|
||||
@@ -21,6 +21,9 @@ package appeng.client.gui;
|
||||
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.client.me.SlotME;
|
||||
import appeng.container.slot.AppEngSlot;
|
||||
import appeng.container.slot.SlotPlayerHotBar;
|
||||
import appeng.container.slot.SlotPlayerInv;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.localization.ButtonToolTips;
|
||||
import net.minecraft.inventory.Container;
|
||||
@@ -43,11 +46,12 @@ public abstract class AEBaseMEGui extends AEBaseGui {
|
||||
protected void renderToolTip(final ItemStack stack, final int x, final int y) {
|
||||
final Slot s = this.getSlot(x, y);
|
||||
|
||||
final int bigNumber = AEConfig.instance().useTerminalUseLargeFont() ? 999 : 9999;
|
||||
final List<String> currentToolTip = this.getItemToolTip(stack);
|
||||
|
||||
if (s instanceof SlotME && !stack.isEmpty()) {
|
||||
final int bigNumber = AEConfig.instance().useTerminalUseLargeFont() ? 999 : 9999;
|
||||
|
||||
IAEItemStack myStack = null;
|
||||
final List<String> currentToolTip = this.getItemToolTip(stack);
|
||||
|
||||
try {
|
||||
final SlotME theSlotField = (SlotME) s;
|
||||
@@ -56,7 +60,7 @@ public abstract class AEBaseMEGui extends AEBaseGui {
|
||||
}
|
||||
|
||||
if (myStack != null) {
|
||||
if (myStack.getStackSize() > bigNumber || (myStack.getStackSize() > 1 && stack.isItemDamaged())) {
|
||||
if (myStack.getStackSize() > 1) {
|
||||
final String local = ButtonToolTips.ItemsStored.getLocal();
|
||||
final String formattedAmount = NumberFormat.getNumberInstance(Locale.US).format(myStack.getStackSize());
|
||||
final String format = String.format(local, formattedAmount);
|
||||
@@ -86,6 +90,15 @@ public abstract class AEBaseMEGui extends AEBaseGui {
|
||||
|
||||
return;
|
||||
}
|
||||
} else if (s instanceof AppEngSlot) {
|
||||
if (!(s instanceof SlotPlayerInv) && !(s instanceof SlotPlayerHotBar)) {
|
||||
if (!s.getStack().isEmpty()) {
|
||||
final String formattedAmount = NumberFormat.getNumberInstance(Locale.US).format(s.getStack().getCount());
|
||||
currentToolTip.add(TextFormatting.GRAY + formattedAmount);
|
||||
this.drawHoveringText(currentToolTip, x, y, this.fontRenderer);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
super.renderToolTip(stack, x, y);
|
||||
|
||||
@@ -81,6 +81,7 @@ public class GuiCraftConfirm extends AEBaseGui {
|
||||
this.setScrollBar(scrollbar);
|
||||
|
||||
this.ccc = (ContainerCraftConfirm) this.inventorySlots;
|
||||
this.ccc.setGui(this);
|
||||
|
||||
if (te instanceof WirelessTerminalGuiObject) {
|
||||
this.OriginalGui = GuiBridge.GUI_WIRELESS_TERM;
|
||||
|
||||
@@ -95,6 +95,7 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource {
|
||||
protected GuiCraftingCPU(final ContainerCraftingCPU container) {
|
||||
super(container);
|
||||
this.craftingCpu = container;
|
||||
this.craftingCpu.setGui(this);
|
||||
this.ySize = GUI_HEIGHT;
|
||||
this.xSize = GUI_WIDTH;
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ import appeng.api.config.ActionItems;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.client.gui.widgets.GuiImgButton;
|
||||
import appeng.client.me.ItemRepo;
|
||||
import appeng.container.implementations.ContainerCraftingTerm;
|
||||
import appeng.container.slot.SlotCraftingMatrix;
|
||||
import appeng.core.localization.GuiText;
|
||||
@@ -81,4 +82,8 @@ public class GuiCraftingTerm extends GuiMEMonitorable {
|
||||
protected String getBackground() {
|
||||
return "guis/crafting.png";
|
||||
}
|
||||
|
||||
public ItemRepo getRepo() {
|
||||
return this.repo;
|
||||
}
|
||||
}
|
||||
|
||||
+14
-8
@@ -19,10 +19,8 @@
|
||||
package appeng.client.gui.implementations;
|
||||
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.ActionItems;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.client.gui.widgets.GuiCustomSlot;
|
||||
@@ -89,6 +87,7 @@ public class GuiFluidInterfaceConfigurationTerminal extends AEBaseGui implements
|
||||
private final ArrayList<String> names = new ArrayList<>();
|
||||
private final ArrayList<Object> lines = new ArrayList<>();
|
||||
private final Set<Object> matchedStacks = new HashSet<>();
|
||||
private final Set<ClientDCInternalFluidInv> matchedInterfaces = new HashSet<ClientDCInternalFluidInv>();
|
||||
|
||||
private final Map<String, Set<Object>> cachedSearches = new WeakHashMap<>();
|
||||
|
||||
@@ -157,12 +156,14 @@ public class GuiFluidInterfaceConfigurationTerminal extends AEBaseGui implements
|
||||
|
||||
for (int row = 0; row < 1 + extraLines && linesDraw < LINES_ON_PAGE; ++row) {
|
||||
for (int z = 0; z < 5; z++) {
|
||||
GuiFluidTank tankSlot = new GuiFluidTank(inv.getInventory(), z + (row * 5), z + (row * 5), (z * 18 + 22), offset, 16, 16);
|
||||
GuiFluidTank tankSlot;
|
||||
if (!matchedInterfaces.contains(inv) && !this.matchedStacks.contains(inv.getInventory().getFluidInSlot(z + (row * 5)))) {
|
||||
tankSlot = new GuiFluidTank(inv.getInventory(), z + (row * 5), z + (row * 5), (z * 18 + 22), offset, 16, 16, true);
|
||||
} else {
|
||||
tankSlot = new GuiFluidTank(inv.getInventory(), z + (row * 5), z + (row * 5), (z * 18 + 22), offset, 16, 16);
|
||||
}
|
||||
this.guiSlots.add(tankSlot);
|
||||
guiFluidTankClientDCInternalFluidInvMap.put(tankSlot, inv);
|
||||
if (this.matchedStacks.contains(inv.getInventory().getFluidInSlot(z + (row * 5)))) {
|
||||
drawRect(z * 18 + 22, offset, z * 18 + 22 + 16, offset + 16, 0x2A00FF00);
|
||||
}
|
||||
}
|
||||
linesDraw++;
|
||||
offset += 18;
|
||||
@@ -321,6 +322,7 @@ public class GuiFluidInterfaceConfigurationTerminal extends AEBaseGui implements
|
||||
this.byName.clear();
|
||||
this.buttonList.clear();
|
||||
this.matchedStacks.clear();
|
||||
this.matchedInterfaces.clear();
|
||||
|
||||
final String searchFieldInputs = this.searchFieldInputs.getText().toLowerCase();
|
||||
|
||||
@@ -352,8 +354,12 @@ public class GuiFluidInterfaceConfigurationTerminal extends AEBaseGui implements
|
||||
slot++;
|
||||
}
|
||||
}
|
||||
if (searchFieldInputs.isEmpty() || entry.getName().toLowerCase().contains(searchFieldInputs)) {
|
||||
this.matchedInterfaces.add(entry);
|
||||
found = true;
|
||||
}
|
||||
// if found, filter skipped or machine name matching the search term, add it
|
||||
if (found || entry.getName().toLowerCase().contains(searchFieldInputs)) {
|
||||
if (found) {
|
||||
this.byName.put(entry.getName(), entry);
|
||||
cachedSearch.add(entry);
|
||||
} else {
|
||||
@@ -441,7 +447,7 @@ public class GuiFluidInterfaceConfigurationTerminal extends AEBaseGui implements
|
||||
ClientDCInternalFluidInv o = this.byId.get(id);
|
||||
|
||||
if (o == null) {
|
||||
this.byId.put(id, o = new ClientDCInternalFluidInv(5, id, sortBy, string, 64));
|
||||
this.byId.put(id, o = new ClientDCInternalFluidInv(5, id, sortBy, string, 1000));
|
||||
this.refreshList = true;
|
||||
}
|
||||
|
||||
|
||||
+25
-6
@@ -52,6 +52,7 @@ import net.minecraft.nbt.NBTUtil;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import java.awt.*;
|
||||
@@ -77,6 +78,7 @@ public class GuiInterfaceConfigurationTerminal extends AEBaseGui implements IJEI
|
||||
private final ArrayList<String> names = new ArrayList<>();
|
||||
private final ArrayList<Object> lines = new ArrayList<>();
|
||||
private final Set<Object> matchedStacks = new HashSet<>();
|
||||
private final Set<ClientDCInternalInv> matchedInterfaces = new HashSet<>();
|
||||
|
||||
private final Map<String, Set<Object>> cachedSearches = new WeakHashMap<>();
|
||||
|
||||
@@ -147,7 +149,9 @@ public class GuiInterfaceConfigurationTerminal extends AEBaseGui implements IJEI
|
||||
for (int z = 0; z < 9; z++) {
|
||||
this.inventorySlots.inventorySlots.add(new SlotDisconnected(inv, z + (row * 9), (z * 18 + 22), offset));
|
||||
if (this.matchedStacks.contains(inv.getInventory().getStackInSlot(z + (row * 9)))) {
|
||||
drawRect(z * 18 + 22, offset, z * 18 + 22 + 16, offset + 16, 0x2A00FF00);
|
||||
drawRect(z * 18 + 22, offset, z * 18 + 22 + 16, offset + 16, 0x8A00FF00);
|
||||
} else if (!matchedInterfaces.contains(inv)) {
|
||||
drawRect(z * 18 + 22, offset, z * 18 + 22 + 16, offset + 16, 0x6A000000);
|
||||
}
|
||||
}
|
||||
linesDraw++;
|
||||
@@ -213,8 +217,14 @@ public class GuiInterfaceConfigurationTerminal extends AEBaseGui implements IJEI
|
||||
if (slot instanceof SlotDisconnected) {
|
||||
final ItemStack stack = slot.getStack();
|
||||
if (stack != ItemStack.EMPTY) {
|
||||
InventoryAction direction = wheel > 0 ? InventoryAction.PLACE_SINGLE : InventoryAction.PICKUP_SINGLE;
|
||||
final PacketInventoryAction p = new PacketInventoryAction(direction, slot.getSlotIndex(), ((SlotDisconnected) slot).getSlot().getId());
|
||||
final PacketInventoryAction p;
|
||||
if (Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL)) {
|
||||
InventoryAction direction = wheel > 0 ? InventoryAction.DOUBLE : InventoryAction.HALVE;
|
||||
p = new PacketInventoryAction(direction, slot.getSlotIndex(), ((SlotDisconnected) slot).getSlot().getId());
|
||||
} else {
|
||||
InventoryAction direction = wheel > 0 ? InventoryAction.PLACE_SINGLE : InventoryAction.PICKUP_SINGLE;
|
||||
p = new PacketInventoryAction(direction, slot.getSlotIndex(), ((SlotDisconnected) slot).getSlot().getId());
|
||||
}
|
||||
NetworkHandler.instance().sendToServer(p);
|
||||
}
|
||||
} else {
|
||||
@@ -289,7 +299,11 @@ public class GuiInterfaceConfigurationTerminal extends AEBaseGui implements IJEI
|
||||
for (int x = 0; x < current.getInventory().getSlots(); x++) {
|
||||
final String which = Integer.toString(x);
|
||||
if (invData.hasKey(which)) {
|
||||
current.getInventory().setStackInSlot(x, new ItemStack(invData.getCompoundTag(which)));
|
||||
NBTTagCompound tag = invData.getCompoundTag(which);
|
||||
current.getInventory().setStackInSlot(x, new ItemStack(tag));
|
||||
if (tag.hasKey("stackSize")) {
|
||||
current.getInventory().getStackInSlot(x).setCount(tag.getInteger("stackSize"));
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (final NumberFormatException ignored) {
|
||||
@@ -314,6 +328,7 @@ public class GuiInterfaceConfigurationTerminal extends AEBaseGui implements IJEI
|
||||
this.byName.clear();
|
||||
this.buttonList.clear();
|
||||
this.matchedStacks.clear();
|
||||
this.matchedInterfaces.clear();
|
||||
|
||||
final String searchFieldInputs = this.searchFieldInputs.getText().toLowerCase();
|
||||
|
||||
@@ -345,7 +360,11 @@ public class GuiInterfaceConfigurationTerminal extends AEBaseGui implements IJEI
|
||||
}
|
||||
}
|
||||
// if found, filter skipped or machine name matching the search term, add it
|
||||
if (found || entry.getName().toLowerCase().contains(searchFieldInputs)) {
|
||||
if (searchFieldInputs.isEmpty() || entry.getName().toLowerCase().contains(searchFieldInputs)) {
|
||||
this.matchedInterfaces.add(entry);
|
||||
found = true;
|
||||
}
|
||||
if (found) {
|
||||
this.byName.put(entry.getName(), entry);
|
||||
cachedSearch.add(entry);
|
||||
} else {
|
||||
@@ -435,7 +454,7 @@ public class GuiInterfaceConfigurationTerminal extends AEBaseGui implements IJEI
|
||||
ClientDCInternalInv o = this.byId.get(id);
|
||||
|
||||
if (o == null) {
|
||||
this.byId.put(id, o = new ClientDCInternalInv(DualityInterface.NUMBER_OF_CONFIG_SLOTS, id, sortBy, string, 64));
|
||||
this.byId.put(id, o = new ClientDCInternalInv(DualityInterface.NUMBER_OF_CONFIG_SLOTS, id, sortBy, string, 512));
|
||||
this.refreshList = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ public class GuiInterfaceTerminal extends AEBaseGui {
|
||||
private final ArrayList<String> names = new ArrayList<>();
|
||||
private final ArrayList<Object> lines = new ArrayList<>();
|
||||
private final Set<Object> matchedStacks = new HashSet<>();
|
||||
|
||||
private final Set<ClientDCInternalInv> matchedInterfaces = new HashSet<>();
|
||||
private final Map<String, Set<Object>> cachedSearches = new WeakHashMap<>();
|
||||
|
||||
private boolean refreshList = false;
|
||||
@@ -155,7 +155,9 @@ public class GuiInterfaceTerminal extends AEBaseGui {
|
||||
for (int z = 0; z < 9; z++) {
|
||||
this.inventorySlots.inventorySlots.add(new SlotDisconnected(inv, z + (row * 9), (z * 18 + 22), offset));
|
||||
if (this.matchedStacks.contains(inv.getInventory().getStackInSlot(z + (row * 9)))) {
|
||||
drawRect(z * 18 + 22, offset, z * 18 + 22 + 16, offset + 16, 0x2A00FF00);
|
||||
drawRect(z * 18 + 22, offset, z * 18 + 22 + 16, offset + 16, 0x8A00FF00);
|
||||
} else if (!matchedInterfaces.contains(inv)) {
|
||||
drawRect(z * 18 + 22, offset, z * 18 + 22 + 16, offset + 16, 0x6A000000);
|
||||
}
|
||||
}
|
||||
linesDraw++;
|
||||
@@ -344,6 +346,7 @@ public class GuiInterfaceTerminal extends AEBaseGui {
|
||||
this.byName.clear();
|
||||
this.buttonList.clear();
|
||||
this.matchedStacks.clear();
|
||||
this.matchedInterfaces.clear();
|
||||
|
||||
final String searchFieldInputs = this.searchFieldInputs.getText().toLowerCase();
|
||||
final String searchFieldOutputs = this.searchFieldOutputs.getText().toLowerCase();
|
||||
@@ -393,7 +396,13 @@ public class GuiInterfaceTerminal extends AEBaseGui {
|
||||
}
|
||||
}
|
||||
// if found, filter skipped or machine name matching the search term, add it
|
||||
if (found || (entry.getName().toLowerCase().contains(searchFieldInputs) && entry.getName().toLowerCase().contains(searchFieldOutputs))) {
|
||||
if ((searchFieldInputs.isEmpty() && searchFieldOutputs.isEmpty()) ||
|
||||
!searchFieldInputs.isEmpty() && entry.getName().toLowerCase().contains(searchFieldInputs) ||
|
||||
(!searchFieldOutputs.isEmpty() && entry.getName().toLowerCase().contains(searchFieldOutputs))) {
|
||||
this.matchedInterfaces.add(entry);
|
||||
found = true;
|
||||
}
|
||||
if (found) {
|
||||
if (!partInterfaceTerminal.onlyInterfacesWithFreeSlots) {
|
||||
this.byName.put(entry.getName(), entry);
|
||||
cachedSearch.add(entry);
|
||||
|
||||
@@ -31,7 +31,11 @@ import appeng.api.util.IConfigManager;
|
||||
import appeng.api.util.IConfigurableObject;
|
||||
import appeng.client.ActionKey;
|
||||
import appeng.client.gui.AEBaseMEGui;
|
||||
import appeng.client.gui.widgets.*;
|
||||
import appeng.client.gui.widgets.GuiImgButton;
|
||||
import appeng.client.gui.widgets.GuiScrollbar;
|
||||
import appeng.client.gui.widgets.GuiTabButton;
|
||||
import appeng.client.gui.widgets.ISortSource;
|
||||
import appeng.client.gui.widgets.MEGuiTextField;
|
||||
import appeng.client.me.InternalSlotME;
|
||||
import appeng.client.me.ItemRepo;
|
||||
import appeng.client.me.SlotME;
|
||||
@@ -73,7 +77,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
||||
private static int craftingGridOffsetY;
|
||||
|
||||
private static String memoryText = "";
|
||||
private final ItemRepo repo;
|
||||
protected final ItemRepo repo;
|
||||
private final int offsetX = 9;
|
||||
private final int lowerTextureOffset = 0;
|
||||
private final IConfigManager configSrc;
|
||||
|
||||
@@ -51,6 +51,7 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource {
|
||||
|
||||
private final ItemRepo repo;
|
||||
private final int rows = 4;
|
||||
private final ContainerNetworkStatus cns;
|
||||
private GuiImgButton units;
|
||||
private int tooltip = -1;
|
||||
|
||||
@@ -65,6 +66,9 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource {
|
||||
this.ySize = 153;
|
||||
this.xSize = 195;
|
||||
this.repo.setRowSize(5);
|
||||
|
||||
this.cns = (ContainerNetworkStatus) this.inventorySlots;
|
||||
this.cns.setGui(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -227,8 +227,10 @@ public class ItemRepo {
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
searchTask.cancel(true);
|
||||
searchTask = null;
|
||||
if (searchTask != null) {
|
||||
searchTask.cancel(true);
|
||||
searchTask = null;
|
||||
}
|
||||
this.list.resetStatus();
|
||||
}
|
||||
|
||||
@@ -266,4 +268,8 @@ public class ItemRepo {
|
||||
this.updateJEI(this.searchString);
|
||||
}
|
||||
}
|
||||
|
||||
public IItemList<IAEItemStack> getList() {
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +48,7 @@ import appeng.helpers.InventoryAction;
|
||||
import appeng.me.helpers.PlayerSource;
|
||||
import appeng.util.InventoryAdaptor;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.helpers.ItemHandlerUtil;
|
||||
import appeng.util.inv.AdaptorItemHandler;
|
||||
import appeng.util.inv.WrapperCursorItemHandler;
|
||||
import appeng.util.item.AEItemStack;
|
||||
@@ -387,10 +388,7 @@ public abstract class AEBaseContainer extends Container {
|
||||
|
||||
if (Platform.itemComparisons().isSameItem(tis, t)) // t.isItemEqual(tis))
|
||||
{
|
||||
int maxSize = t.getMaxStackSize();
|
||||
if (maxSize > d.getSlotStackLimit()) {
|
||||
maxSize = d.getSlotStackLimit();
|
||||
}
|
||||
int maxSize = d.getSlotStackLimit();
|
||||
|
||||
int placeAble = maxSize - t.getCount();
|
||||
|
||||
@@ -406,9 +404,7 @@ public abstract class AEBaseContainer extends Container {
|
||||
if (tis.getCount() <= 0) {
|
||||
clickSlot.putStack(ItemStack.EMPTY);
|
||||
d.onSlotChanged();
|
||||
|
||||
// if ( hasMETiles ) updateClient();
|
||||
|
||||
|
||||
this.updateSlot(clickSlot);
|
||||
this.updateSlot(d);
|
||||
return ItemStack.EMPTY;
|
||||
@@ -545,23 +541,20 @@ public abstract class AEBaseContainer extends Container {
|
||||
|
||||
switch (action) {
|
||||
case PICKUP_OR_SET_DOWN:
|
||||
|
||||
if (hand.isEmpty()) {
|
||||
s.putStack(ItemStack.EMPTY);
|
||||
} else {
|
||||
s.putStack(hand.copy());
|
||||
}
|
||||
|
||||
break;
|
||||
case PLACE_SINGLE:
|
||||
|
||||
if (!hand.isEmpty()) {
|
||||
final ItemStack is = hand.copy();
|
||||
is.setCount(1);
|
||||
s.putStack(is);
|
||||
} else {
|
||||
final ItemStack is = s.getStack().copy();
|
||||
if (is.getCount() < is.getMaxStackSize())
|
||||
if (is.getCount() < is.getMaxStackSize() * 8)
|
||||
is.grow(1);
|
||||
s.putStack(is);
|
||||
}
|
||||
@@ -575,7 +568,6 @@ public abstract class AEBaseContainer extends Container {
|
||||
}
|
||||
break;
|
||||
case SPLIT_OR_PLACE_SINGLE:
|
||||
|
||||
ItemStack is = s.getStack();
|
||||
if (!is.isEmpty()) {
|
||||
if (hand.isEmpty()) {
|
||||
@@ -586,14 +578,26 @@ public abstract class AEBaseContainer extends Container {
|
||||
is = hand.copy();
|
||||
is.setCount(1);
|
||||
}
|
||||
|
||||
s.putStack(is);
|
||||
} else if (!hand.isEmpty()) {
|
||||
is = hand.copy();
|
||||
is.setCount(1);
|
||||
s.putStack(is);
|
||||
}
|
||||
|
||||
break;
|
||||
case HALVE:
|
||||
if (s.getStack().getCount() > 1) {
|
||||
ItemStack halved = s.getStack().copy();
|
||||
halved.setCount(s.getStack().getCount() / 2);
|
||||
s.putStack(halved);
|
||||
}
|
||||
break;
|
||||
case DOUBLE:
|
||||
ItemStack doubled = s.getStack().copy();
|
||||
if (s.getStack().getCount() * 2 > 0) {
|
||||
doubled.setCount(Math.min(s.getSlotStackLimit(), s.getStack().getCount() * 2));
|
||||
s.putStack(doubled);
|
||||
}
|
||||
break;
|
||||
case CREATIVE_DUPLICATE:
|
||||
case MOVE_REGION:
|
||||
@@ -606,9 +610,9 @@ public abstract class AEBaseContainer extends Container {
|
||||
if (action == InventoryAction.MOVE_REGION) {
|
||||
final List<Slot> from = new ArrayList<>();
|
||||
|
||||
for (final Object j : this.inventorySlots) {
|
||||
if (j instanceof Slot && j.getClass() == s.getClass() && !(j instanceof SlotCraftingTerm)) {
|
||||
from.add((Slot) j);
|
||||
for (final Slot j : this.inventorySlots) {
|
||||
if (j != null && j.getClass() == s.getClass() && !(j instanceof SlotCraftingTerm)) {
|
||||
from.add(j);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ import appeng.api.storage.ITerminalHost;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.client.gui.implementations.GuiCraftConfirm;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.guisync.GuiSync;
|
||||
import appeng.core.AELog;
|
||||
@@ -61,6 +62,7 @@ import javax.annotation.Nonnull;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
|
||||
@@ -85,6 +87,7 @@ public class ContainerCraftConfirm extends AEBaseContainer {
|
||||
public boolean noCPU = true;
|
||||
@GuiSync(7)
|
||||
public String myName = "";
|
||||
private GuiCraftConfirm guiCraftConfirm;
|
||||
|
||||
public ContainerCraftConfirm(final InventoryPlayer ip, final ITerminalHost te) {
|
||||
super(ip, te);
|
||||
@@ -403,4 +406,12 @@ public class ContainerCraftConfirm extends AEBaseContainer {
|
||||
public void setJob(final Future<ICraftingJob> job) {
|
||||
this.job = job;
|
||||
}
|
||||
|
||||
public void postUpdate(final List<IAEItemStack> list, final byte ref) {
|
||||
this.guiCraftConfirm.postUpdate(list, ref);
|
||||
}
|
||||
|
||||
public void setGui(GuiCraftConfirm guiCraftConfirm) {
|
||||
this.guiCraftConfirm = guiCraftConfirm;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,8 @@ import appeng.api.storage.IMEMonitorHandlerReceiver;
|
||||
import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.client.gui.implementations.GuiCraftConfirm;
|
||||
import appeng.client.gui.implementations.GuiCraftingCPU;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.guisync.GuiSync;
|
||||
import appeng.core.AELog;
|
||||
@@ -47,6 +49,7 @@ import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.IContainerListener;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorHandlerReceiver<IAEItemStack>, ICustomNameObject {
|
||||
@@ -58,6 +61,7 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
|
||||
|
||||
@GuiSync(0)
|
||||
public long eta = -1;
|
||||
private GuiCraftingCPU guiCraftingCPU;
|
||||
|
||||
public ContainerCraftingCPU(final InventoryPlayer ip, final Object te) {
|
||||
super(ip, te);
|
||||
@@ -232,4 +236,12 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
|
||||
private void setNetwork(final IGrid network) {
|
||||
this.network = network;
|
||||
}
|
||||
|
||||
public void postUpdate(final List<IAEItemStack> list, final byte ref) {
|
||||
this.guiCraftingCPU.postUpdate(list, ref);
|
||||
}
|
||||
|
||||
public void setGui(GuiCraftingCPU guiCraftingCPU) {
|
||||
this.guiCraftingCPU = guiCraftingCPU;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,8 +24,10 @@ import appeng.container.ContainerNull;
|
||||
import appeng.container.slot.SlotCraftingMatrix;
|
||||
import appeng.container.slot.SlotCraftingTerm;
|
||||
import appeng.helpers.IContainerCraftingPacket;
|
||||
import appeng.parts.reporting.AbstractPartTerminal;
|
||||
import appeng.parts.reporting.PartCraftingTerminal;
|
||||
import appeng.tile.inventory.AppEngInternalInventory;
|
||||
import appeng.util.IConfigManagerHost;
|
||||
import appeng.util.inv.IAEAppEngInventory;
|
||||
import appeng.util.inv.InvOperation;
|
||||
import appeng.util.inv.WrapperInvItemHandler;
|
||||
|
||||
+16
-1
@@ -184,7 +184,7 @@ public final class ContainerInterfaceConfigurationTerminal extends AEBaseContain
|
||||
}
|
||||
break;
|
||||
case PLACE_SINGLE:
|
||||
if (inSlot.getMaxStackSize() > inSlot.getCount()) {
|
||||
if (inSlot.getCount() < inSlot.getMaxStackSize() * 8) {
|
||||
inSlot.grow(1);
|
||||
ItemHandlerUtil.setStackInSlot(theSlot, 0, inSlot);
|
||||
}
|
||||
@@ -222,6 +222,18 @@ public final class ContainerInterfaceConfigurationTerminal extends AEBaseContain
|
||||
ItemHandlerUtil.setStackInSlot(theSlot, 0, player.inventory.getItemStack().copy());
|
||||
}
|
||||
|
||||
break;
|
||||
case HALVE:
|
||||
if (inSlot.getCount() > 1) {
|
||||
ItemStack halved = inSlot.copy();
|
||||
halved.setCount(inSlot.getCount() / 2);
|
||||
ItemHandlerUtil.setStackInSlot(theSlot, 0, halved);
|
||||
}
|
||||
break;
|
||||
case DOUBLE:
|
||||
ItemStack doubled = inSlot.copy();
|
||||
doubled.setCount(Math.min(512, inSlot.getCount() * 2));
|
||||
ItemHandlerUtil.setStackInSlot(theSlot, 0, doubled);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
@@ -299,6 +311,9 @@ public final class ContainerInterfaceConfigurationTerminal extends AEBaseContain
|
||||
|
||||
if (!is.isEmpty()) {
|
||||
is.writeToNBT(itemNBT);
|
||||
if (is.getCount() > is.getMaxStackSize()) {
|
||||
itemNBT.setInteger("stackSize", is.getCount());
|
||||
}
|
||||
}
|
||||
|
||||
tag.setTag(Integer.toString(x + offset), itemNBT);
|
||||
|
||||
@@ -42,6 +42,7 @@ import appeng.api.storage.data.IItemList;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.api.util.IConfigurableObject;
|
||||
import appeng.client.gui.implementations.GuiMEMonitorable;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.guisync.GuiSync;
|
||||
import appeng.container.slot.SlotRestrictedInput;
|
||||
@@ -64,13 +65,14 @@ import net.minecraftforge.fml.common.Loader;
|
||||
import javax.annotation.Nonnull;
|
||||
import java.io.IOException;
|
||||
import java.nio.BufferOverflowException;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class ContainerMEMonitorable extends AEBaseContainer implements IConfigManagerHost, IConfigurableObject, IMEMonitorHandlerReceiver<IAEItemStack> {
|
||||
|
||||
private final SlotRestrictedInput[] cellView = new SlotRestrictedInput[5];
|
||||
private final IMEMonitor<IAEItemStack> monitor;
|
||||
private final IItemList<IAEItemStack> items = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
|
||||
public final IItemList<IAEItemStack> items = AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createList();
|
||||
private final IConfigManager clientCM;
|
||||
private final ITerminalHost host;
|
||||
@GuiSync(99)
|
||||
@@ -357,11 +359,19 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
|
||||
this.hasPower = isPowered;
|
||||
}
|
||||
|
||||
private IConfigManagerHost getGui() {
|
||||
public IConfigManagerHost getGui() {
|
||||
return this.gui;
|
||||
}
|
||||
|
||||
public void setGui(@Nonnull final IConfigManagerHost gui) {
|
||||
this.gui = gui;
|
||||
}
|
||||
|
||||
public IItemList<IAEItemStack> getItems() {
|
||||
return items;
|
||||
}
|
||||
|
||||
public void postUpdate(final List<IAEItemStack> list) {
|
||||
((GuiMEMonitorable) this.gui).postUpdate(list);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ import appeng.api.storage.channels.IItemStorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.client.gui.implementations.GuiNetworkStatus;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.guisync.GuiSync;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
@@ -42,6 +43,7 @@ import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class ContainerNetworkStatus extends AEBaseContainer {
|
||||
@@ -56,6 +58,7 @@ public class ContainerNetworkStatus extends AEBaseContainer {
|
||||
public long maxPower;
|
||||
private IGrid network;
|
||||
private int delay = 40;
|
||||
private GuiNetworkStatus guiNetworkStatus;
|
||||
|
||||
public ContainerNetworkStatus(final InventoryPlayer ip, final INetworkTool te) {
|
||||
super(ip, null, null);
|
||||
@@ -160,4 +163,12 @@ public class ContainerNetworkStatus extends AEBaseContainer {
|
||||
private void setPowerUsage(final long powerUsage) {
|
||||
this.powerUsage = powerUsage;
|
||||
}
|
||||
|
||||
public void postUpdate(final List<IAEItemStack> list) {
|
||||
this.guiNetworkStatus.postUpdate(list);
|
||||
}
|
||||
|
||||
public void setGui(GuiNetworkStatus guiNetworkStatus) {
|
||||
this.guiNetworkStatus = guiNetworkStatus;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,15 @@ import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.container.ContainerNull;
|
||||
import appeng.container.guisync.GuiSync;
|
||||
import appeng.container.slot.*;
|
||||
import appeng.container.slot.AppEngSlot;
|
||||
import appeng.container.slot.IOptionalSlotHost;
|
||||
import appeng.container.slot.OptionalSlotFake;
|
||||
import appeng.container.slot.SlotFakeCraftingMatrix;
|
||||
import appeng.container.slot.SlotPatternOutputs;
|
||||
import appeng.container.slot.SlotPatternTerm;
|
||||
import appeng.container.slot.SlotPlayerHotBar;
|
||||
import appeng.container.slot.SlotPlayerInv;
|
||||
import appeng.container.slot.SlotRestrictedInput;
|
||||
import appeng.core.sync.packets.PacketPatternSlot;
|
||||
import appeng.helpers.IContainerCraftingPacket;
|
||||
import appeng.items.storage.ItemViewCell;
|
||||
@@ -46,7 +54,11 @@ import appeng.util.item.AEItemStack;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.*;
|
||||
import net.minecraft.inventory.IContainerListener;
|
||||
import net.minecraft.inventory.InventoryCraftResult;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.inventory.SlotCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
@@ -266,13 +278,13 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
|
||||
for (int x = 0; x < this.craftingSlots.length; x++) {
|
||||
input[x] = this.craftingSlots[x].getStack();
|
||||
if (!input[x].isEmpty() && input[x].getCount() * multiple > input[x].getMaxStackSize()) {
|
||||
if (!input[x].isEmpty() && input[x].getCount() * multiple < 0) {
|
||||
canMultiplyInputs = false;
|
||||
}
|
||||
}
|
||||
for (final OptionalSlotFake outputSlot : this.outputSlots) {
|
||||
final ItemStack out = outputSlot.getStack();
|
||||
if (!out.isEmpty() && out.getCount() * multiple > out.getMaxStackSize()) {
|
||||
if (!out.isEmpty() && out.getCount() * multiple < 0) {
|
||||
canMultiplyOutputs = false;
|
||||
}
|
||||
}
|
||||
@@ -328,13 +340,13 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
|
||||
for (int x = 0; x < this.craftingSlots.length; x++) {
|
||||
input[x] = this.craftingSlots[x].getStack();
|
||||
if (!input[x].isEmpty() && input[x].getCount() + increase > input[x].getMaxStackSize()) {
|
||||
if (!input[x].isEmpty() && input[x].getCount() + increase < 0) {
|
||||
canIncreaseInputs = false;
|
||||
}
|
||||
}
|
||||
for (final OptionalSlotFake outputSlot : this.outputSlots) {
|
||||
final ItemStack out = outputSlot.getStack();
|
||||
if (!out.isEmpty() && out.getCount() + increase > out.getMaxStackSize()) {
|
||||
if (!out.isEmpty() && out.getCount() + increase < 0) {
|
||||
canIncreaseOutputs = false;
|
||||
}
|
||||
}
|
||||
@@ -488,6 +500,9 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
|
||||
if (!i.isEmpty()) {
|
||||
i.writeToNBT(c);
|
||||
if (i.getCount() > i.getMaxStackSize()) {
|
||||
c.setInteger("stackSize", i.getCount());
|
||||
}
|
||||
}
|
||||
|
||||
return c;
|
||||
|
||||
@@ -96,7 +96,9 @@ public class AppEngSlot extends Slot {
|
||||
|
||||
if (this.isDisplay()) {
|
||||
this.setDisplay(false);
|
||||
return this.getDisplayStack();
|
||||
ItemStack retStack = this.getDisplayStack().copy();
|
||||
retStack.setCount(1);
|
||||
return retStack;
|
||||
}
|
||||
|
||||
return this.itemHandler.getStackInSlot(this.index);
|
||||
|
||||
@@ -62,6 +62,11 @@ public class OptionalSlotFake extends SlotFake implements IOptionalSlot {
|
||||
return this.host.isSlotEnabled(this.groupNum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSlotStackLimit() {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRenderDisabled() {
|
||||
return this.renderDisabled;
|
||||
|
||||
@@ -27,4 +27,9 @@ public class SlotFakeCraftingMatrix extends SlotFake {
|
||||
public SlotFakeCraftingMatrix(final IItemHandler inv, final int idx, final int x, final int y) {
|
||||
super(inv, idx, x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSlotStackLimit() {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public enum PlayerMessages {
|
||||
DeviceNotLinked,
|
||||
StationCanNotBeLocated,
|
||||
SettingCleared,
|
||||
;
|
||||
MissingPatternsToEncode;
|
||||
|
||||
public ITextComponent get() {
|
||||
return new TextComponentTranslation(this.getName());
|
||||
|
||||
@@ -20,19 +20,18 @@ package appeng.core.sync.packets;
|
||||
|
||||
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.client.gui.implementations.GuiCraftConfirm;
|
||||
import appeng.client.gui.implementations.GuiCraftingCPU;
|
||||
import appeng.client.gui.implementations.GuiMEMonitorable;
|
||||
import appeng.client.gui.implementations.GuiNetworkStatus;
|
||||
import appeng.container.implementations.ContainerCraftConfirm;
|
||||
import appeng.container.implementations.ContainerCraftingCPU;
|
||||
import appeng.container.implementations.ContainerMEMonitorable;
|
||||
import appeng.container.implementations.ContainerNetworkStatus;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
import appeng.core.sync.network.INetworkInfo;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraftforge.fml.common.network.internal.FMLProxyPacket;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
@@ -132,22 +131,22 @@ public class PacketMEInventoryUpdate extends AppEngPacket {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void clientPacketData(final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player) {
|
||||
final GuiScreen gs = Minecraft.getMinecraft().currentScreen;
|
||||
final Container c = player.openContainer;
|
||||
|
||||
if (gs instanceof GuiCraftConfirm) {
|
||||
((GuiCraftConfirm) gs).postUpdate(this.list, this.ref);
|
||||
if (c instanceof ContainerCraftConfirm) {
|
||||
((ContainerCraftConfirm) c).postUpdate(this.list, this.ref);
|
||||
}
|
||||
|
||||
if (gs instanceof GuiCraftingCPU) {
|
||||
((GuiCraftingCPU) gs).postUpdate(this.list, this.ref);
|
||||
if (c instanceof ContainerCraftingCPU) {
|
||||
((ContainerCraftingCPU) c).postUpdate(this.list, this.ref);
|
||||
}
|
||||
|
||||
if (gs instanceof GuiMEMonitorable) {
|
||||
((GuiMEMonitorable) gs).postUpdate(this.list);
|
||||
if (c instanceof ContainerMEMonitorable) {
|
||||
((ContainerMEMonitorable) c).postUpdate(this.list);
|
||||
}
|
||||
|
||||
if (gs instanceof GuiNetworkStatus) {
|
||||
((GuiNetworkStatus) gs).postUpdate(this.list);
|
||||
if (c instanceof ContainerNetworkStatus) {
|
||||
((ContainerNetworkStatus) c).postUpdate(this.list);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ public class GuiFluidTank extends GuiCustomSlot implements ITooltip {
|
||||
private final int slot;
|
||||
private final int width;
|
||||
private final int height;
|
||||
private boolean darkened = false;
|
||||
|
||||
public GuiFluidTank(IAEFluidTank tank, int slot, int id, int x, int y, int w, int h) {
|
||||
super(id, x, y);
|
||||
@@ -50,6 +51,15 @@ public class GuiFluidTank extends GuiCustomSlot implements ITooltip {
|
||||
this.height = h;
|
||||
}
|
||||
|
||||
public GuiFluidTank(IAEFluidTank tank, int slot, int id, int x, int y, int w, int h, boolean darkened) {
|
||||
super(id, x, y);
|
||||
this.tank = tank;
|
||||
this.slot = slot;
|
||||
this.width = w;
|
||||
this.height = h;
|
||||
this.darkened = darkened;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawContent(Minecraft mc, int mouseX, int mouseY, float partialTicks) {
|
||||
final IAEFluidStack fs = this.getFluidStack();
|
||||
@@ -66,10 +76,16 @@ public class GuiFluidTank extends GuiCustomSlot implements ITooltip {
|
||||
float red = (fluid.getFluid().getColor() >> 16 & 255) / 255.0F;
|
||||
float green = (fluid.getFluid().getColor() >> 8 & 255) / 255.0F;
|
||||
float blue = (fluid.getFluid().getColor() & 255) / 255.0F;
|
||||
if (darkened) {
|
||||
red = red * 0.4F;
|
||||
green = green * 0.4F;
|
||||
blue = blue * 0.4F;
|
||||
}
|
||||
GlStateManager.color(red, green, blue);
|
||||
|
||||
TextureAtlasSprite sprite = mc.getTextureMapBlocks().getAtlasSprite(fluid.getFluid().getStill().toString());
|
||||
final int scaledHeight = (int) (this.height * ((float) fluid.getStackSize() / this.tank.getTankProperties()[this.slot].getCapacity()));
|
||||
int scaledHeight = (int) (this.height * ((float) fluid.getStackSize() / this.tank.getTankProperties()[this.slot].getCapacity()));
|
||||
scaledHeight = Math.min(this.height, scaledHeight);
|
||||
|
||||
int iconHeightRemainder = scaledHeight % 16;
|
||||
if (iconHeightRemainder > 0) {
|
||||
|
||||
@@ -234,9 +234,4 @@ public class ContainerFluidInterface extends ContainerFluidConfigurable implemen
|
||||
public int availableUpgrades() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasToolbox() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,8 +114,8 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
private final IActionSource mySource;
|
||||
private final IActionSource interfaceRequestSource;
|
||||
private final ConfigManager cm = new ConfigManager(this);
|
||||
private final AppEngInternalAEInventory config = new AppEngInternalAEInventory(this, NUMBER_OF_CONFIG_SLOTS);
|
||||
private final AppEngInternalInventory storage = new AppEngInternalInventory(this, NUMBER_OF_STORAGE_SLOTS);
|
||||
private final AppEngInternalAEInventory config = new AppEngInternalAEInventory(this, NUMBER_OF_CONFIG_SLOTS, 512);
|
||||
private final AppEngInternalInventory storage = new AppEngInternalInventory(this, NUMBER_OF_STORAGE_SLOTS, 512);
|
||||
private final AppEngInternalInventory patterns = new AppEngInternalInventory(this, NUMBER_OF_PATTERN_SLOTS);
|
||||
private final MEMonitorPassThrough<IAEItemStack> items = new MEMonitorPassThrough<>(new NullInventory<IAEItemStack>(), AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class));
|
||||
private final MEMonitorPassThrough<IAEFluidStack> fluids = new MEMonitorPassThrough<>(new NullInventory<IAEFluidStack>(), AEApi.instance().storage().getStorageChannel(IFluidStorageChannel.class));
|
||||
@@ -749,7 +749,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
// make sure strange things didn't happen...
|
||||
// TODO: check if OK
|
||||
final ItemStack canExtract = adaptor.simulateRemove((int) diff, toStore.getDefinition(), null);
|
||||
if (canExtract.isEmpty() || canExtract.getCount() != diff) {
|
||||
if (canExtract.isEmpty()) {
|
||||
changed = true;
|
||||
throw new GridAccessException();
|
||||
}
|
||||
@@ -766,8 +766,6 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
|
||||
final ItemStack removed = adaptor.removeItems((int) diff, ItemStack.EMPTY, null);
|
||||
if (removed.isEmpty()) {
|
||||
throw new IllegalStateException("bad attempt at managing inventory. ( removeItems )");
|
||||
} else if (removed.getCount() != diff) {
|
||||
throw new IllegalStateException("bad attempt at managing inventory. ( removeItems )");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,5 +43,7 @@ public enum InventoryAction {
|
||||
ROLL_DOWN,
|
||||
AUTO_CRAFT,
|
||||
PLACE_SINGLE,
|
||||
DOUBLE,
|
||||
HALVE,
|
||||
PLACE_JEI_GHOST_ITEM
|
||||
}
|
||||
|
||||
@@ -93,6 +93,10 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
NBTTagCompound ingredient = inTag.getCompoundTagAt(x);
|
||||
final ItemStack gs = new ItemStack(ingredient);
|
||||
|
||||
if (ingredient.hasKey("stackSize")) {
|
||||
gs.setCount(ingredient.getInteger("stackSize"));
|
||||
}
|
||||
|
||||
if (!ingredient.hasNoTags() && gs.isEmpty()) {
|
||||
throw new IllegalArgumentException("No pattern here!");
|
||||
}
|
||||
@@ -124,6 +128,10 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
||||
NBTTagCompound resultItemTag = outTag.getCompoundTagAt(x);
|
||||
final ItemStack gs = new ItemStack(resultItemTag);
|
||||
|
||||
if (resultItemTag.hasKey("stackSize")) {
|
||||
gs.setCount(resultItemTag.getInteger("stackSize"));
|
||||
}
|
||||
|
||||
if (!resultItemTag.hasNoTags() && gs.isEmpty()) {
|
||||
throw new IllegalArgumentException("No pattern here!");
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package appeng.integration.modules.jei;
|
||||
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketInventoryAction;
|
||||
import appeng.helpers.InventoryAction;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import mezz.jei.api.gui.ITooltipCallback;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CraftableCallBack implements ITooltipCallback<ItemStack> {
|
||||
private final IItemList<IAEItemStack> list;
|
||||
private final Container container;
|
||||
|
||||
public CraftableCallBack(Container container, IItemList<IAEItemStack> ir) {
|
||||
this.list = ir;
|
||||
this.container = container;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTooltip(int slotIndex, boolean input, ItemStack ingredient, List<String> tooltip) {
|
||||
if (list != null) {
|
||||
AEItemStack stack = AEItemStack.fromItemStack(ingredient);
|
||||
if (list.findPrecise(stack) != null) {
|
||||
tooltip.add(I18n.translateToLocalFormatted("gui.appliedenergistics2.Missing"));
|
||||
tooltip.add(I18n.translateToLocalFormatted("gui.tooltips.appliedenergistics2.Craftable"));
|
||||
if (Mouse.isButtonDown(2)) {
|
||||
((AEBaseContainer) container).setTargetStack(stack);
|
||||
final PacketInventoryAction p = new PacketInventoryAction(InventoryAction.AUTO_CRAFT, container.getInventory().size(), 0);
|
||||
NetworkHandler.instance().sendToServer(p);
|
||||
}
|
||||
} else {
|
||||
tooltip.add(I18n.translateToLocalFormatted("gui.appliedenergistics2.Missing"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
package appeng.integration.modules.jei;
|
||||
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.client.gui.implementations.GuiCraftingTerm;
|
||||
import appeng.container.implementations.ContainerCraftingTerm;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import mezz.jei.api.gui.IGuiIngredient;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.recipe.transfer.IRecipeTransferError;
|
||||
import mezz.jei.gui.recipes.RecipeLayout;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.awt.*;
|
||||
import java.util.Collection;
|
||||
|
||||
import static mezz.jei.api.recipe.transfer.IRecipeTransferError.Type.USER_FACING;
|
||||
|
||||
public class JEIMissingItem implements IRecipeTransferError {
|
||||
|
||||
private boolean errored;
|
||||
|
||||
JEIMissingItem(Container container, @Nonnull IRecipeLayout recipeLayout) {
|
||||
if (container instanceof ContainerCraftingTerm) {
|
||||
ContainerCraftingTerm craftingTerm = (ContainerCraftingTerm) container;
|
||||
GuiCraftingTerm g = (GuiCraftingTerm) craftingTerm.getGui();
|
||||
|
||||
IItemList<IAEItemStack> ir = g.getRepo().getList();
|
||||
boolean found;
|
||||
this.errored = false;
|
||||
|
||||
recipeLayout.getItemStacks().addTooltipCallback(new CraftableCallBack(container, ir));
|
||||
|
||||
for (IGuiIngredient<?> i : recipeLayout.getItemStacks().getGuiIngredients().values()) {
|
||||
found = false;
|
||||
if (i.isInput() && i.getAllIngredients().size() > 0) {
|
||||
for (Object o : i.getAllIngredients()) {
|
||||
if (o instanceof ItemStack) {
|
||||
ItemStack stack = (ItemStack) o;
|
||||
if (!stack.isEmpty()) {
|
||||
if (stack.getItem().isDamageable() || Platform.isGTDamageableItem(stack.getItem())) {
|
||||
Collection<IAEItemStack> fuzzy = ir.findFuzzy(AEItemStack.fromItemStack(stack), FuzzyMode.IGNORE_ALL);
|
||||
if (fuzzy.size() > 0) {
|
||||
for (IAEItemStack itemStack : fuzzy) {
|
||||
if (itemStack.getStackSize() > 0) {
|
||||
if (itemStack.fuzzyComparison(AEItemStack.fromItemStack(stack), FuzzyMode.IGNORE_ALL)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
IAEItemStack ext = ir.findPrecise(AEItemStack.fromItemStack(stack));
|
||||
if (ext != null) {
|
||||
if (ext.getStackSize() > 0) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
this.errored = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Type getType() {
|
||||
return USER_FACING;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showError(Minecraft minecraft, int mouseX, int mouseY, @Nonnull IRecipeLayout recipeLayout, int recipeX, int recipeY) {
|
||||
Container c = minecraft.player.openContainer;
|
||||
if (c instanceof ContainerCraftingTerm) {
|
||||
ContainerCraftingTerm craftingTerm = (ContainerCraftingTerm) c;
|
||||
|
||||
GuiCraftingTerm g = (GuiCraftingTerm) craftingTerm.getGui();
|
||||
IItemList<IAEItemStack> ir = g.getRepo().getList();
|
||||
boolean found;
|
||||
boolean craftable;
|
||||
this.errored = false;
|
||||
|
||||
for (IGuiIngredient<?> i : recipeLayout.getItemStacks().getGuiIngredients().values()) {
|
||||
found = false;
|
||||
craftable = false;
|
||||
if (i.isInput() && i.getAllIngredients().size() > 0) {
|
||||
for (Object o : i.getAllIngredients()) {
|
||||
if (o instanceof ItemStack) {
|
||||
ItemStack stack = (ItemStack) o;
|
||||
if (!stack.isEmpty()) {
|
||||
if (stack.getItem().isDamageable() || Platform.isGTDamageableItem(stack.getItem())) {
|
||||
Collection<IAEItemStack> fuzzy = ir.findFuzzy(AEItemStack.fromItemStack(stack), FuzzyMode.IGNORE_ALL);
|
||||
if (fuzzy.size() > 0) {
|
||||
for (IAEItemStack itemStack : fuzzy) {
|
||||
if (itemStack.getStackSize() > 0) {
|
||||
if (itemStack.fuzzyComparison(AEItemStack.fromItemStack(stack), FuzzyMode.IGNORE_ALL)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (itemStack.isCraftable()) {
|
||||
craftable = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
IAEItemStack ext = ir.findPrecise(AEItemStack.fromItemStack(stack));
|
||||
if (ext != null) {
|
||||
if (ext.getStackSize() > 0) {
|
||||
break;
|
||||
} else {
|
||||
if (ext.isCraftable()) {
|
||||
craftable = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
if (craftable) {
|
||||
i.drawHighlight(minecraft, new Color(0.0f, 0.0f, 1.0f, 0.4f), recipeX, recipeY);
|
||||
} else {
|
||||
i.drawHighlight(minecraft, new Color(1.0f, 0.0f, 0.0f, 0.4f), recipeX, recipeY);
|
||||
}
|
||||
this.errored = true;
|
||||
} else {
|
||||
this.errored = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!this.errored) {
|
||||
((RecipeLayout) recipeLayout).getRecipeTransferButton().init(Minecraft.getMinecraft().player.openContainer, Minecraft.getMinecraft().player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean errored() {
|
||||
return this.errored;
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,7 @@
|
||||
package appeng.integration.modules.jei;
|
||||
|
||||
|
||||
import appeng.container.implementations.ContainerCraftingTerm;
|
||||
import appeng.container.implementations.ContainerPatternTerm;
|
||||
import appeng.container.slot.SlotCraftingMatrix;
|
||||
import appeng.container.slot.SlotFakeCraftingMatrix;
|
||||
@@ -40,6 +41,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
@@ -62,7 +64,7 @@ class RecipeTransferHandler<T extends Container> implements IRecipeTransferHandl
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IRecipeTransferError transferRecipe(T container, IRecipeLayout recipeLayout, EntityPlayer player, boolean maxTransfer, boolean doTransfer) {
|
||||
public IRecipeTransferError transferRecipe(@Nonnull T container, IRecipeLayout recipeLayout, @Nonnull EntityPlayer player, boolean maxTransfer, boolean doTransfer) {
|
||||
final String recipeType = recipeLayout.getRecipeCategory().getUid();
|
||||
|
||||
if (recipeType.equals(VanillaRecipeCategoryUid.INFORMATION) || recipeType.equals(VanillaRecipeCategoryUid.FUEL)) {
|
||||
@@ -70,6 +72,11 @@ class RecipeTransferHandler<T extends Container> implements IRecipeTransferHandl
|
||||
}
|
||||
|
||||
if (!doTransfer) {
|
||||
if (container instanceof ContainerCraftingTerm && recipeType.equals(VanillaRecipeCategoryUid.CRAFTING)) {
|
||||
JEIMissingItem error = new JEIMissingItem(container, recipeLayout);
|
||||
if (error.errored())
|
||||
return error;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
@@ -301,7 +302,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
|
||||
|
||||
public void onPlacement(final ItemStack stack, final EntityPlayer player, final EnumFacing side) {
|
||||
if (stack.hasTagCompound()) {
|
||||
this.uploadSettings(SettingsFrom.DISMANTLE_ITEM, stack.getTagCompound());
|
||||
this.uploadSettings(SettingsFrom.DISMANTLE_ITEM, stack.getTagCompound(), player);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,7 +312,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
|
||||
* @param from source of settings
|
||||
* @param compound compound of source
|
||||
*/
|
||||
public void uploadSettings(final SettingsFrom from, final NBTTagCompound compound) {
|
||||
public void uploadSettings(final SettingsFrom from, final NBTTagCompound compound, EntityPlayer player) {
|
||||
if (compound != null && this instanceof IConfigurableObject) {
|
||||
final IConfigManager cm = ((IConfigurableObject) this).getConfigManager();
|
||||
if (cm != null) {
|
||||
|
||||
@@ -52,6 +52,13 @@ public class AppEngInternalAEInventory implements IItemHandlerModifiable, Iterab
|
||||
this.inv = new IAEItemStack[s];
|
||||
}
|
||||
|
||||
public AppEngInternalAEInventory(final IAEAppEngInventory te, final int s, int stackSize) {
|
||||
this.te = te;
|
||||
this.size = s;
|
||||
this.maxStack = stackSize;
|
||||
this.inv = new IAEItemStack[s];
|
||||
}
|
||||
|
||||
public void setMaxStackSize(final int s) {
|
||||
this.maxStack = s;
|
||||
}
|
||||
@@ -216,7 +223,7 @@ public class AppEngInternalAEInventory implements IItemHandlerModifiable, Iterab
|
||||
|
||||
@Override
|
||||
public int getSlotLimit(int slot) {
|
||||
return this.maxStack > 64 ? 64 : this.maxStack;
|
||||
return this.maxStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -25,6 +25,9 @@ import appeng.util.inv.InvOperation;
|
||||
import appeng.util.inv.filter.IAEItemFilter;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraftforge.common.util.Constants;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
import net.minecraftforge.items.ItemStackHandler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
@@ -84,7 +87,38 @@ public class AppEngInternalInventory extends ItemStackHandler implements Iterabl
|
||||
if (!simulate) {
|
||||
this.previousStack = this.getStackInSlot(slot).copy();
|
||||
}
|
||||
return super.insertItem(slot, stack, simulate);
|
||||
|
||||
if (stack.isEmpty())
|
||||
return ItemStack.EMPTY;
|
||||
|
||||
validateSlotIndex(slot);
|
||||
|
||||
ItemStack existing = this.stacks.get(slot);
|
||||
|
||||
int limit = maxStack[slot];
|
||||
|
||||
if (!existing.isEmpty()) {
|
||||
if (!ItemHandlerHelper.canItemStacksStack(stack, existing))
|
||||
return stack;
|
||||
|
||||
limit -= existing.getCount();
|
||||
}
|
||||
|
||||
if (limit <= 0)
|
||||
return stack;
|
||||
|
||||
boolean reachedLimit = stack.getCount() > limit;
|
||||
|
||||
if (!simulate) {
|
||||
if (existing.isEmpty()) {
|
||||
this.stacks.set(slot, reachedLimit ? ItemHandlerHelper.copyStackWithSize(stack, limit) : stack);
|
||||
} else {
|
||||
existing.grow(reachedLimit ? limit : stack.getCount());
|
||||
}
|
||||
onContentsChanged(slot);
|
||||
}
|
||||
|
||||
return reachedLimit ? ItemHandlerHelper.copyStackWithSize(stack, stack.getCount() - limit) : ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -97,7 +131,30 @@ public class AppEngInternalInventory extends ItemStackHandler implements Iterabl
|
||||
if (!simulate) {
|
||||
this.previousStack = this.getStackInSlot(slot).copy();
|
||||
}
|
||||
return super.extractItem(slot, amount, simulate);
|
||||
if (amount == 0)
|
||||
return ItemStack.EMPTY;
|
||||
|
||||
validateSlotIndex(slot);
|
||||
|
||||
ItemStack existing = this.stacks.get(slot);
|
||||
|
||||
if (existing.isEmpty())
|
||||
return ItemStack.EMPTY;
|
||||
|
||||
if (existing.getCount() <= amount) {
|
||||
if (!simulate) {
|
||||
this.stacks.set(slot, ItemStack.EMPTY);
|
||||
onContentsChanged(slot);
|
||||
}
|
||||
return existing;
|
||||
} else {
|
||||
if (!simulate) {
|
||||
this.stacks.set(slot, ItemHandlerHelper.copyStackWithSize(existing, existing.getCount() - amount));
|
||||
onContentsChanged(slot);
|
||||
}
|
||||
|
||||
return ItemHandlerHelper.copyStackWithSize(existing, amount);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -152,6 +209,27 @@ public class AppEngInternalInventory extends ItemStackHandler implements Iterabl
|
||||
data.setTag(name, this.serializeNBT());
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound serializeNBT() {
|
||||
NBTTagList nbtTagList = new NBTTagList();
|
||||
for (int i = 0; i < stacks.size(); i++) {
|
||||
ItemStack is = stacks.get(i);
|
||||
if (!is.isEmpty()) {
|
||||
NBTTagCompound itemTag = new NBTTagCompound();
|
||||
itemTag.setInteger("Slot", i);
|
||||
if (is.getCount() > is.getMaxStackSize()) {
|
||||
itemTag.setInteger("stackSize", stacks.get(i).getCount());
|
||||
}
|
||||
stacks.get(i).writeToNBT(itemTag);
|
||||
nbtTagList.appendTag(itemTag);
|
||||
}
|
||||
}
|
||||
NBTTagCompound nbt = new NBTTagCompound();
|
||||
nbt.setTag("Items", nbtTagList);
|
||||
nbt.setInteger("Size", stacks.size());
|
||||
return nbt;
|
||||
}
|
||||
|
||||
public void readFromNBT(final NBTTagCompound data, final String name) {
|
||||
final NBTTagCompound c = data.getCompoundTag(name);
|
||||
if (c != null) {
|
||||
@@ -163,6 +241,24 @@ public class AppEngInternalInventory extends ItemStackHandler implements Iterabl
|
||||
this.deserializeNBT(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserializeNBT(NBTTagCompound nbt) {
|
||||
setSize(nbt.hasKey("Size", Constants.NBT.TAG_INT) ? nbt.getInteger("Size") : stacks.size());
|
||||
NBTTagList tagList = nbt.getTagList("Items", Constants.NBT.TAG_COMPOUND);
|
||||
for (int i = 0; i < tagList.tagCount(); i++) {
|
||||
NBTTagCompound itemTags = tagList.getCompoundTagAt(i);
|
||||
int slot = itemTags.getInteger("Slot");
|
||||
if (slot >= 0 && slot < stacks.size()) {
|
||||
stacks.set(slot, new ItemStack(itemTags));
|
||||
if (itemTags.hasKey("stackSize")) {
|
||||
int stackSize = itemTags.getInteger("stackSize");
|
||||
stacks.get(slot).setCount(stackSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
onLoad();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<ItemStack> iterator() {
|
||||
return Collections.unmodifiableList(super.stacks).iterator();
|
||||
|
||||
@@ -22,6 +22,8 @@ package appeng.tile.misc;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.api.definitions.IMaterials;
|
||||
import appeng.api.implementations.tiles.ISegmentedInventory;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.crafting.ICraftingLink;
|
||||
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
||||
@@ -37,16 +39,23 @@ import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.core.localization.PlayerMessages;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.helpers.DualityInterface;
|
||||
import appeng.helpers.IInterfaceHost;
|
||||
import appeng.helpers.IPriorityHost;
|
||||
import appeng.items.misc.ItemEncodedPattern;
|
||||
import appeng.tile.grid.AENetworkInvTile;
|
||||
import appeng.tile.inventory.AppEngInternalAEInventory;
|
||||
import appeng.tile.inventory.AppEngInternalInventory;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.SettingsFrom;
|
||||
import appeng.util.inv.IInventoryDestination;
|
||||
import appeng.util.inv.InvOperation;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -56,6 +65,8 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.items.wrapper.PlayerInvWrapper;
|
||||
import net.minecraftforge.items.wrapper.PlayerMainInvWrapper;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
@@ -308,4 +319,61 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, II
|
||||
public GuiBridge getGuiBridge() {
|
||||
return GuiBridge.GUI_INTERFACE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound downloadSettings(SettingsFrom from) {
|
||||
NBTTagCompound output = super.downloadSettings(from);
|
||||
if (from == SettingsFrom.MEMORY_CARD) {
|
||||
final IItemHandler inv = this.getInventoryByName("patterns");
|
||||
if (inv instanceof AppEngInternalInventory) {
|
||||
((AppEngInternalInventory) inv).writeToNBT(output, "patterns");
|
||||
}
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadSettings(SettingsFrom from, NBTTagCompound compound, EntityPlayer player) {
|
||||
super.uploadSettings(from, compound, player);
|
||||
final IItemHandler inv = this.getInventoryByName("patterns");
|
||||
if (inv instanceof AppEngInternalInventory) {
|
||||
final AppEngInternalInventory target = (AppEngInternalInventory) inv;
|
||||
AppEngInternalInventory tmp = new AppEngInternalInventory(null, target.getSlots());
|
||||
tmp.readFromNBT(compound, "patterns");
|
||||
PlayerMainInvWrapper playerInv = new PlayerMainInvWrapper(player.inventory);
|
||||
final IMaterials materials = AEApi.instance().definitions().materials();
|
||||
int missingPatternsToEncode = 0;
|
||||
|
||||
for (int i = 0; i < inv.getSlots(); i++) {
|
||||
if (target.getStackInSlot(i).getItem() instanceof ItemEncodedPattern) {
|
||||
ItemStack blank = materials.blankPattern().maybeStack(target.getStackInSlot(i).getCount()).get();
|
||||
if (!player.addItemStackToInventory(blank)) {
|
||||
player.dropItem(blank, true);
|
||||
}
|
||||
target.setStackInSlot(i, ItemStack.EMPTY);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (int x = 0; x < tmp.getSlots(); x++) {
|
||||
if (!tmp.getStackInSlot(x).isEmpty()) {
|
||||
boolean found = false;
|
||||
for (int i = 0; i < playerInv.getSlots(); i++) {
|
||||
if (materials.blankPattern().isSameAs(playerInv.getStackInSlot(i))) {
|
||||
target.setStackInSlot(x, tmp.getStackInSlot(x));
|
||||
playerInv.getStackInSlot(i).shrink(1);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
missingPatternsToEncode++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Platform.isServer() && missingPatternsToEncode > 0) {
|
||||
player.sendMessage(PlayerMessages.MissingPatternsToEncode.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ import appeng.block.networking.BlockEnergyCell;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.tile.grid.AENetworkTile;
|
||||
import appeng.util.SettingsFrom;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
|
||||
@@ -106,7 +107,7 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadSettings(final SettingsFrom from, final NBTTagCompound compound) {
|
||||
public void uploadSettings(final SettingsFrom from, final NBTTagCompound compound, EntityPlayer player) {
|
||||
if (from == SettingsFrom.DISMANTLE_ITEM) {
|
||||
this.internalCurrentPower = compound.getDouble("internalCurrentPower");
|
||||
}
|
||||
|
||||
@@ -75,6 +75,7 @@ tile.appliedenergistics2.sky_stone_slab.name=Sky Stone Slabs
|
||||
// Chat Messages
|
||||
chat.appliedenergistics2.ChestCannotReadStorageCell=ME Chest cannot read storage cell.
|
||||
chat.appliedenergistics2.SettingCleared=Memory card cleared.
|
||||
chat.appliedenergistics2.MissingPatternsToEncode=Not enough patterns to finish copying
|
||||
chat.appliedenergistics2.OutOfRange=Wireless Out Of Range.
|
||||
chat.appliedenergistics2.InvalidMachine=Invalid Machine.
|
||||
chat.appliedenergistics2.LoadedSettings=Loaded device configuration from memory card.
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 14 KiB |
Reference in New Issue
Block a user