diff --git a/dependencies.gradle b/dependencies.gradle index 7328f9db..2e6b4529 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -4,8 +4,8 @@ dependencies { compile('com.github.GTNewHorizons:NotEnoughItems:2.3.10-GTNH:dev') compile('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-117-GTNH:dev') compile('curse.maven:cofh-core-69162:2388751') - compile('com.github.GTNewHorizons:ExtraCells2:2.5.25:dev') { transitive = false } - compile("com.github.GTNewHorizons:WirelessCraftingTerminal:1.8.9.2:dev") + compileOnly('com.github.GTNewHorizons:ExtraCells2:2.5.25:dev') { transitive = false } + compileOnly("com.github.GTNewHorizons:WirelessCraftingTerminal:1.8.9.2:dev") compileOnly('com.github.GTNewHorizons:ForestryMC:4.4.7:dev') compileOnly('com.github.GTNewHorizons:EnderIO:2.3.1.27:dev') diff --git a/src/main/java/com/glodblock/github/client/gui/FCGuiTextField.java b/src/main/java/com/glodblock/github/client/gui/FCGuiTextField.java index c8933d18..c7147969 100644 --- a/src/main/java/com/glodblock/github/client/gui/FCGuiTextField.java +++ b/src/main/java/com/glodblock/github/client/gui/FCGuiTextField.java @@ -6,12 +6,15 @@ import net.minecraft.client.gui.GuiTextField; public class FCGuiTextField extends GuiTextField { private static final int PADDING = 2; + private final FontRenderer _fontRender; private String tooltip; private final int _xPos; private final int _yPos; private final int _width; private final int _height; + private int _border; + private int _color; /** * Uses the values to instantiate a padded version of a text field. @@ -30,6 +33,48 @@ public class FCGuiTextField extends GuiTextField { this._yPos = yPos; this._width = width; this._height = height; + this._fontRender = fontRenderer; + } + + @Override + public void drawTextBox() { + super.drawTextBox(); + if (this.getBorder() > 0 && this.getVisible()) { + GuiTextField.drawRect( + this._xPos - this.getBorder(), + this._yPos - this.getBorder(), + this._width - 2 * PADDING - this._fontRender.getCharWidth('_') + this.getBorder(), + this._height - 2 * PADDING + this.getBorder(), + this.getColor() + ); + } + } + + public int getBorder() { + return this._border; + } + + public void setBorder(int border) { + this._border = border; + this._color = 0; + } + + public void setBorder(int border, int color) { + this._border = border; + this._color = color; + } + + public void setBorder() { + this._border = 0; + this._color = 0; + } + + public int getColor() { + return this._color; + } + + public void setColor(int color) { + this._color = color; } @Override diff --git a/src/main/java/com/glodblock/github/client/gui/GuiFCImgButton.java b/src/main/java/com/glodblock/github/client/gui/GuiFCImgButton.java index e405c881..c5038af9 100644 --- a/src/main/java/com/glodblock/github/client/gui/GuiFCImgButton.java +++ b/src/main/java/com/glodblock/github/client/gui/GuiFCImgButton.java @@ -35,10 +35,11 @@ public class GuiFCImgButton extends GuiButton implements ITooltip { if( appearances == null ) { appearances = new HashMap<>(); - this.registerApp( 0, "NOT_COMBINE", "DONT_COMBINE", "not_combine" ); - this.registerApp( 1, "FORCE_COMBINE", "DO_COMBINE", "combine" ); - this.registerApp( 2, "FORCE_PRIO", "DO_PRIO", "prio" ); - this.registerApp( 3, "NOT_PRIO", "DONT_PRIO", "not_prio" ); + this.registerApp(0, "NOT_COMBINE", "DONT_COMBINE", "not_combine"); + this.registerApp(1, "FORCE_COMBINE", "DO_COMBINE", "combine"); + this.registerApp(2, "FORCE_PRIO", "DO_PRIO", "prio"); + this.registerApp(3, "NOT_PRIO", "DONT_PRIO", "not_prio"); + this.registerApp(4, "SUBMIT", "SUBMIT", "submit"); } } @@ -221,35 +222,34 @@ public class GuiFCImgButton extends GuiButton implements ITooltip { par1Minecraft.renderEngine.bindTexture( FluidCraft.resource("textures/gui/states.png") ); this.field_146123_n = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width && par3 < this.yPosition + this.height; - final int uv_y = (int) Math.floor( iconIndex / 3.0 ); + final int uv_y = (int) Math.floor(iconIndex / 3.0); final int uv_x = iconIndex - uv_y * 3; - this.drawTexturedModalRect( 0, 0, Math.round(32F * 16F / 3F), Math.round(32F * 16F / 3F), Math.round(16F * 16F / 3F), Math.round(16F * 16F / 3F) ); - this.drawTexturedModalRect( 0, 0, Math.round(uv_x * 16F * 16F / 3F), Math.round(uv_y * 16F * 16F / 3F), Math.round(16F * 16F / 3F), Math.round(16F * 16F / 3F) ); - this.mouseDragged( par1Minecraft, par2, par3 ); + this.drawTexturedModalRect(0, 0, Math.round(32F * 16F / 3F), Math.round(32F * 16F / 3F), Math.round(16F * 16F / 3F), Math.round(16F * 16F / 3F)); + this.drawTexturedModalRect(0, 0, Math.round(uv_x * 16F * 16F / 3F), Math.round(uv_y * 16F * 16F / 3F), Math.round(16F * 16F / 3F), Math.round(16F * 16F / 3F)); + this.mouseDragged(par1Minecraft, par2, par3); GL11.glPopMatrix(); - } - else - { - if( this.enabled ) - { - GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f ); - } - else - { - GL11.glColor4f( 0.5f, 0.5f, 0.5f, 1.0f ); + } else { + GL11.glPushMatrix(); + GL11.glTranslatef(this.xPosition, this.yPosition, 0.0F); + GL11.glScalef(0.5f / 16 * 6, 0.5f / 16 * 6, 0.5f / 16 * 6); + if (this.enabled) { + GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + } else { + GL11.glColor4f(0.5f, 0.5f, 0.5f, 1.0f); } - par1Minecraft.renderEngine.bindTexture( FluidCraft.resource("textures/gui/states.png") ); + par1Minecraft.renderEngine.bindTexture(FluidCraft.resource("textures/gui/states.png")); this.field_146123_n = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width && par3 < this.yPosition + this.height; - final int uv_y = (int) Math.floor( iconIndex / 3.0 ); + final int uv_y = (int) Math.floor(iconIndex / 3.0); final int uv_x = iconIndex - uv_y * 3; - this.drawTexturedModalRect( this.xPosition, this.yPosition, 32, 32, 16, 16 ); - this.drawTexturedModalRect( this.xPosition, this.yPosition, uv_x * 16, uv_y * 16, 16, 16 ); - this.mouseDragged( par1Minecraft, par2, par3 ); + this.drawTexturedModalRect(0, 0, Math.round(32F * 16F / 3F), Math.round(32F * 16F / 3F), Math.round(16F * 16F / 3F), Math.round(16F * 16F / 3F)); + this.drawTexturedModalRect(0, 0, Math.round(uv_x * 16F * 16F / 3F), Math.round(uv_y * 16F * 16F / 3F), Math.round(16F * 16F / 3F), Math.round(16F * 16F / 3F)); + this.mouseDragged(par1Minecraft, par2, par3); + GL11.glPopMatrix(); } } GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f ); diff --git a/src/main/java/com/glodblock/github/client/gui/GuiLevelMaintainer.java b/src/main/java/com/glodblock/github/client/gui/GuiLevelMaintainer.java new file mode 100644 index 00000000..dc48fda2 --- /dev/null +++ b/src/main/java/com/glodblock/github/client/gui/GuiLevelMaintainer.java @@ -0,0 +1,246 @@ +package com.glodblock.github.client.gui; + +import appeng.api.storage.data.IAEItemStack; +import appeng.client.gui.AEBaseGui; +import appeng.client.render.AppEngRenderItem; +import appeng.container.slot.SlotFake; +import com.glodblock.github.FluidCraft; +import com.glodblock.github.client.gui.container.ContainerLevelMaintainer; +import com.glodblock.github.common.item.ItemFluidPacket; +import com.glodblock.github.common.tile.TileLevelMaintainer; +import com.glodblock.github.inventory.gui.MouseRegionManager; +import com.glodblock.github.inventory.slot.SlotSingleItem; +import com.glodblock.github.network.CPacketLevelMaintainer; +import com.glodblock.github.util.Ae2ReflectClient; +import com.glodblock.github.util.ModAndClassUtil; +import com.glodblock.github.util.NameConst; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.resources.I18n; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Slot; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.input.Keyboard; + +import java.util.List; + +public class GuiLevelMaintainer extends AEBaseGui { + + private static final ResourceLocation TEX_BG = FluidCraft.resource("textures/gui/level_maintainer.png"); + private final ContainerLevelMaintainer cont; + private final Widget[] qtyInputs = new Widget[TileLevelMaintainer.REQ_COUNT]; + private final Widget[] batchInputs = new Widget[TileLevelMaintainer.REQ_COUNT]; + private final MouseRegionManager mouseRegions = new MouseRegionManager(this); + private final AppEngRenderItem stackSizeRenderer = Ae2ReflectClient.getStackSizeRenderer(this); + private TileLevelMaintainer tile; + private FCGuiTextField input; + + public GuiLevelMaintainer(InventoryPlayer ipl, TileLevelMaintainer tile) { + super(new ContainerLevelMaintainer(ipl, tile)); + this.cont = (ContainerLevelMaintainer) inventorySlots; + this.xSize = 195; + this.ySize = 214; + this.tile = tile; + } + + public void postUpdate(List list) { + for (IAEItemStack is : list) { + long size = is.getItemStack().getTagCompound().getLong("BatchSize"); + int i = is.getItemStack().getTagCompound().getInteger("Index"); + qtyInputs[i].textField.setText(String.valueOf(is.getStackSize())); + batchInputs[i].textField.setText(String.valueOf(size)); + } + } + + public void drawScreen(final int mouseX, final int mouseY, final float btn) { + super.drawScreen(mouseX, mouseY, btn); + if (ModAndClassUtil.isSearchBar) { + for (Widget i : qtyInputs) { + handleTooltip(mouseX, mouseY, i.textField.new TooltipProvider()); + } + for (Widget i : batchInputs) { + handleTooltip(mouseX, mouseY, i.textField.new TooltipProvider()); + } + } + } + + public void initGui() { + super.initGui(); + for (int i = 0; i < TileLevelMaintainer.REQ_COUNT; i++) { + qtyInputs[i] = new Widget( + new FCGuiTextField(this.fontRendererObj, guiLeft + 37, guiTop + 21 + 20 * i, 52, 16), + new GuiFCImgButton(guiLeft + 37 + 47, guiTop + 20 + 20 * i, "SUBMIT", "SUBMIT"), I18n.format(NameConst.TT_REQUEST_SIZE), + i, 0); + this.buttonList.add(qtyInputs[i].btn()); + batchInputs[i] = new Widget( + new FCGuiTextField(this.fontRendererObj, guiLeft + 100, guiTop + 21 + 20 * i, 52, 16), + new GuiFCImgButton(guiLeft + 100 + 47, guiTop + 20 + 20 * i, "SUBMIT", "SUBMIT"), I18n.format(NameConst.TT_BATCH_SIZE), + i, 1 + ); + this.buttonList.add(batchInputs[i].btn()); + } + FluidCraft.proxy.netHandler.sendToServer(new CPacketLevelMaintainer(-1)); + } + + @Override + public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) { + mc.getTextureManager().bindTexture(TEX_BG); + drawTexturedModalRect(offsetX, offsetY, 0, 0, 176, ySize); + for (int i = 0; i < TileLevelMaintainer.REQ_COUNT; i++) { + qtyInputs[i].draw(); + batchInputs[i].draw(); + } + } + + @Override + public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) { + fontRendererObj.drawString(getGuiDisplayName(I18n.format(NameConst.GUI_LEVEL_MAINTAINER)), 8, 6, 0x404040); + mouseRegions.render(mouseX, mouseY); + } + + @Override + public void func_146977_a(final Slot s) { + if (drawSlot0(s)) + super.func_146977_a(s); + } + + public boolean drawSlot0(Slot slot) { + if (slot instanceof SlotFake) { + IAEItemStack stack = ((ContainerLevelMaintainer.FakeSlot) slot).getAeStack(); + super.func_146977_a(new SlotSingleItem(slot)); + if (stack == null) return true; + IAEItemStack fake = stack.copy(); + if (fake.getItemStack().getItem() instanceof ItemFluidPacket) { + if (ItemFluidPacket.getFluidStack(stack) != null && ItemFluidPacket.getFluidStack(stack).amount > 0) + fake.setStackSize(ItemFluidPacket.getFluidStack(stack).amount); + } + stackSizeRenderer.setAeStack(fake); + stackSizeRenderer.renderItemOverlayIntoGUI(fontRendererObj, mc.getTextureManager(), stack.getItemStack(), slot.xDisplayPosition, slot.yDisplayPosition); + return false; + } + return true; + } + + @Override + protected void mouseClicked(final int xCoord, final int yCoord, final int btn) { + if (btn == 0) { + if (input != null) { + input.setFocused(false); + } + for (Widget i : qtyInputs) { + if (i.textField.isMouseIn(xCoord, yCoord)) { + i.textField.setFocused(true); + this.input = i.textField; + super.mouseClicked(xCoord, yCoord, btn); + return; + } + } + for (Widget i : batchInputs) { + if (i.textField.isMouseIn(xCoord, yCoord)) { + i.textField.setFocused(true); + this.input = i.textField; + super.mouseClicked(xCoord, yCoord, btn); + return; + } + } + this.input = null; + } + super.mouseClicked(xCoord, yCoord, btn); + } + + @Override + protected void keyTyped(final char character, final int key) { + if (this.input == null) { + super.keyTyped(character, key); + return; + } + if (!this.checkHotbarKeys(key)) { + if (!((character == ' ') && this.input.getText().isEmpty())) { + this.input.textboxKeyTyped(character, key); + } + super.keyTyped(character, key); + if (!this.input.getText().matches("[0-9]+")) { + this.input.setTextColor(0xFF0000); + } else { + this.input.setTextColor(0xFFFFFF); + } + if (key == Keyboard.KEY_RETURN) { + this.input.setFocused(false); + this.input = null; + } + } + } + + @Override + protected void handleMouseClick(final Slot slot, final int slotIdx, final int ctrlDown, final int mouseButton) { + super.handleMouseClick(slot, slotIdx, ctrlDown, mouseButton); + if (slot instanceof ContainerLevelMaintainer.FakeSlot && this.cont.getPlayerInv().getItemStack() != null) { + this.qtyInputs[slot.getSlotIndex()].textField.setText(String.valueOf(this.cont.getPlayerInv().getItemStack().stackSize)); + } + } + + public void updateAmount(int idx, int stackSize) { + this.qtyInputs[idx].textField.setText(String.valueOf(stackSize)); + } + + private boolean sendToServer(Widget widget) { + if (((ContainerLevelMaintainer.FakeSlot) cont.inventorySlots.get(widget.idx)).getHasStack()) { + if (!widget.textField.getText().isEmpty() && widget.textField.getText().matches("[0-9]+") && Long.parseLong(widget.textField.getText()) <= Integer.MAX_VALUE) { + FluidCraft.proxy.netHandler.sendToServer(new CPacketLevelMaintainer(widget.action, widget.idx, widget.textField.getText())); + widget.textField.setTextColor(0xFFFFFF); + return true; + } else { + widget.textField.setTextColor(0xFF0000); + return false; + } + } + return false; + } + + @Override + protected void actionPerformed(final GuiButton btn) { + super.actionPerformed(btn); + for (Widget widget : qtyInputs) { + if (widget.button == btn) { + sendToServer(widget); + return; + } + } + for (Widget widget : batchInputs) { + if (widget.button == btn) { + sendToServer(widget); + return; + } + } + } + + private class Widget { + public final int idx; + public final int action; + private FCGuiTextField textField; + private GuiFCImgButton button; + + public Widget(FCGuiTextField textField, GuiFCImgButton button, String tooltip, int idx, int action) { + this.textField = textField; + this.textField.setMessage(tooltip); + this.textField.setEnableBackgroundDrawing(false); + this.textField.setText("0"); + this.button = button; + this.idx = idx; + this.action = action; + } + + public void draw() { + this.textField.drawTextBox(); + } + + public GuiFCImgButton btn() { + return this.button; + } + + public void setTooltip(String message) { + this.textField.setMessage(message); + } + + } + +} diff --git a/src/main/java/com/glodblock/github/client/gui/container/ContainerFluidPatternEncoder.java b/src/main/java/com/glodblock/github/client/gui/container/ContainerFluidPatternEncoder.java index fe2d6dcf..5fe9e0e4 100644 --- a/src/main/java/com/glodblock/github/client/gui/container/ContainerFluidPatternEncoder.java +++ b/src/main/java/com/glodblock/github/client/gui/container/ContainerFluidPatternEncoder.java @@ -168,7 +168,7 @@ public class ContainerFluidPatternEncoder extends AEBaseContainer implements Pat } } - private static class SlotFluidConvertingFake extends SlotFake implements SlotFluid { + public static class SlotFluidConvertingFake extends SlotFake implements SlotFluid { private final AeStackInventory inv; diff --git a/src/main/java/com/glodblock/github/client/gui/container/ContainerLevelMaintainer.java b/src/main/java/com/glodblock/github/client/gui/container/ContainerLevelMaintainer.java new file mode 100644 index 00000000..74693780 --- /dev/null +++ b/src/main/java/com/glodblock/github/client/gui/container/ContainerLevelMaintainer.java @@ -0,0 +1,89 @@ +package com.glodblock.github.client.gui.container; + +import appeng.container.AEBaseContainer; +import appeng.container.slot.OptionalSlotFake; +import appeng.container.slot.SlotFakeCraftingMatrix; +import appeng.util.Platform; +import appeng.util.item.AEItemStack; +import com.glodblock.github.client.gui.GuiLevelMaintainer; +import com.glodblock.github.common.tile.TileLevelMaintainer; +import com.glodblock.github.inventory.AeItemStackHandler; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.ICrafting; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + + +public class ContainerLevelMaintainer extends AEBaseContainer { + private final TileLevelMaintainer tile; + private final FakeSlot[] craftingSlots = new FakeSlot[TileLevelMaintainer.REQ_COUNT]; + + public ContainerLevelMaintainer(InventoryPlayer ipl, TileLevelMaintainer tile) { + super(ipl, tile); + this.tile = tile; + AeItemStackHandler crafting = new AeItemStackHandler(tile.getCraftingSlots()); + for (int y = 0; y < TileLevelMaintainer.REQ_COUNT; y++) { + FakeSlot slot = new FakeSlot(crafting, y, 17, 19 + y * 20); + addSlotToContainer(slot); + craftingSlots[y] = slot; + } + bindPlayerInventory(ipl, 0, 132); + } + + public TileLevelMaintainer getTile() { + return tile; + } + + @Override + public ItemStack transferStackInSlot(EntityPlayer player, int idx) { + for (ContainerFluidPatternEncoder.SlotFluidConvertingFake slot : craftingSlots) { + if (!slot.getHasStack()) { + slot.setAeStack(AEItemStack.create(((Slot) this.inventorySlots.get(idx)).getStack()), true); + if (Platform.isClient()) { + GuiLevelMaintainer gui = (GuiLevelMaintainer) Minecraft.getMinecraft().currentScreen; + gui.updateAmount(slot.getSlotIndex(), ((Slot) this.inventorySlots.get(idx)).getStack().stackSize); + } + break; + } + } + this.detectAndSendChanges(); + return null; + } + + + public void handleClientInteraction(int action, int idx, long size) { + if (action == 0) { + tile.updateQuantity(idx, size); + } else if (action == 1) { + tile.updateBatchSize(idx, size); + } + } + + @Override + public void onSlotChange(final Slot s) { + if (Platform.isServer()) { + for (final Object crafter : this.crafters) { + final ICrafting icrafting = (ICrafting) crafter; + + for (final Object g : this.inventorySlots) { + if (g instanceof OptionalSlotFake || g instanceof SlotFakeCraftingMatrix) { + final Slot sri = (Slot) g; + icrafting.sendSlotContents(this, sri.slotNumber, sri.getStack()); + } + } + ((EntityPlayerMP) icrafting).isChangingQuantityOnly = false; + } + this.detectAndSendChanges(); + } + } + + public static class FakeSlot extends ContainerFluidPatternEncoder.SlotFluidConvertingFake { + + public FakeSlot(AeItemStackHandler inv, int idx, int x, int y) { + super(inv, idx, x, y); + } + } +} diff --git a/src/main/java/com/glodblock/github/client/textures/FCPartsTexture.java b/src/main/java/com/glodblock/github/client/textures/FCPartsTexture.java index f556d0bc..db2f9d6b 100644 --- a/src/main/java/com/glodblock/github/client/textures/FCPartsTexture.java +++ b/src/main/java/com/glodblock/github/client/textures/FCPartsTexture.java @@ -14,18 +14,16 @@ public enum FCPartsTexture { PartFluidPatternTerminal_Colored("pattern_terminal_medium"), PartTerminalBroad("terminal_broad"), PartFluidImportBus("fluid_import_face"), PartFluidExportBus("fluid_export_face"), BlockFluidInterfaceAlternate_Arrow("fluid_interface_arrow"), BlockInterfaceAlternate("fluid_interface_a"), - BlockInterface_Face("fluid_interface"); + BlockInterface_Face("fluid_interface"), BlockLevelMaintainer("level_maintainer"); private final String name; public net.minecraft.util.IIcon IIcon; - FCPartsTexture(final String name) - { + FCPartsTexture(final String name) { this.name = name; } - public static ResourceLocation GuiTexture(final String string) - { + public static ResourceLocation GuiTexture(final String string) { return null; } diff --git a/src/main/java/com/glodblock/github/common/block/BlockLevelMaintainer.java b/src/main/java/com/glodblock/github/common/block/BlockLevelMaintainer.java new file mode 100644 index 00000000..c853bf9d --- /dev/null +++ b/src/main/java/com/glodblock/github/common/block/BlockLevelMaintainer.java @@ -0,0 +1,55 @@ +package com.glodblock.github.common.block; + +import appeng.block.AEBaseItemBlock; +import com.glodblock.github.common.tabs.FluidCraftingTabs; +import com.glodblock.github.common.tile.TileLevelMaintainer; +import com.glodblock.github.inventory.InventoryHandler; +import com.glodblock.github.inventory.gui.GuiType; +import com.glodblock.github.util.BlockPos; +import com.glodblock.github.util.NameConst; +import cpw.mods.fml.common.registry.GameRegistry; +import net.minecraft.block.material.Material; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumFacing; +import net.minecraft.world.World; + +public class BlockLevelMaintainer extends FCBaseBlock { + + public BlockLevelMaintainer() { + super(Material.iron, NameConst.BLOCK_LEVEL_MAINTAINER); + setFullBlock(true); + setOpaque(true); + setTileEntity(TileLevelMaintainer.class); + } + + public BlockLevelMaintainer register() { + GameRegistry.registerBlock(this, AEBaseItemBlock.class, NameConst.BLOCK_LEVEL_MAINTAINER); + GameRegistry.registerTileEntity(TileLevelMaintainer.class, NameConst.BLOCK_LEVEL_MAINTAINER); + setCreativeTab(FluidCraftingTabs.INSTANCE); + return this; + } + + @Override + public boolean onActivated(World world, int x, int y, int z, EntityPlayer player, int facing, float hitX, float hitY, float hitZ) { + if (player.isSneaking()) { + return false; + } + TileLevelMaintainer tile = getTileEntity(world, x, y, z); + if (tile != null) { + if (!world.isRemote) { + InventoryHandler.openGui(player, world, new BlockPos(x, y, z), EnumFacing.getFront(facing), GuiType.LEVEL_MAINTAINER); + } + return true; + } + return false; + } + + public ItemStack stack(int size) { + return new ItemStack(this, size); + } + + public ItemStack stack() { + return new ItemStack(this, 1); + } +} diff --git a/src/main/java/com/glodblock/github/common/storage/FluidCellInventory.java b/src/main/java/com/glodblock/github/common/storage/FluidCellInventory.java index 5fdc5c64..23ba5217 100644 --- a/src/main/java/com/glodblock/github/common/storage/FluidCellInventory.java +++ b/src/main/java/com/glodblock/github/common/storage/FluidCellInventory.java @@ -34,6 +34,7 @@ public class FluidCellInventory implements IFluidCellInventory { private short storedFluids; private IItemList cellItems; private final NBTTagCompound tagCompound; + public static final int singleByteAmount = 256 * 8; public FluidCellInventory( final ItemStack o, final ISaveProvider container ) throws AppEngException { @@ -147,8 +148,8 @@ public class FluidCellInventory implements IFluidCellInventory { @Override public long getUsedBytes() { - long bytesForItemCount = (this.getStoredFluidCount() + this.getUnusedFluidCount()) / (8 * 256); - long tmp = this.getStoredFluidTypes() * this.getBytesPerType() + bytesForItemCount; + long bytesForItemCount = this.getStoredFluidCount() / singleByteAmount; + long tmp = (this.getStoredFluidTypes() * this.getBytesPerType()) * singleByteAmount + bytesForItemCount; if (this.getUnusedFluidCount() > 0 && tmp < this.getTotalBytes()) tmp++; return tmp; } @@ -177,20 +178,14 @@ public class FluidCellInventory implements IFluidCellInventory { @Override public long getRemainingFluidCount() { - final long remaining = (this.getTotalBytes() - (this.getTotalFluidTypes() * 8)) * 8 * 256 - this.getStoredFluidCount(); + final long remaining = this.getTotalBytes() * singleByteAmount - this.getStoredFluidCount(); return remaining > 0 ? remaining : 0; } @Override public int getUnusedFluidCount() { - final int div = (int) ( this.getStoredFluidCount() % 8 ); + return (int) (this.getStoredFluidCount() % singleByteAmount); - if( div == 0 ) - { - return 0; - } - - return 8 - div; } @Override @@ -349,7 +344,7 @@ public class FluidCellInventory implements IFluidCellInventory { if( l != null ) { - final long remainingItemSlots = this.getRemainingFluidCount(); + final long remainingItemSlots = this.getRemainingFluidCount() - (long) this.getBytesPerType() * singleByteAmount; if( remainingItemSlots < 0 ) { @@ -384,7 +379,7 @@ public class FluidCellInventory implements IFluidCellInventory { if( this.canHoldNewFluid() ) // room for new type, and for at least one item! { - final long remainingItemCount = this.getRemainingFluidCount() - this.getBytesPerType() * 8; + final long remainingItemCount = this.getRemainingFluidCount() - ((long) this.getBytesPerType() * singleByteAmount); if( remainingItemCount > 0 ) { diff --git a/src/main/java/com/glodblock/github/common/tile/TileLevelMaintainer.java b/src/main/java/com/glodblock/github/common/tile/TileLevelMaintainer.java new file mode 100644 index 00000000..b0f0c426 --- /dev/null +++ b/src/main/java/com/glodblock/github/common/tile/TileLevelMaintainer.java @@ -0,0 +1,250 @@ +package com.glodblock.github.common.tile; + +import appeng.api.config.Actionable; +import appeng.api.networking.GridFlags; +import appeng.api.networking.IGrid; +import appeng.api.networking.IGridNode; +import appeng.api.networking.crafting.ICraftingGrid; +import appeng.api.networking.crafting.ICraftingJob; +import appeng.api.networking.crafting.ICraftingLink; +import appeng.api.networking.crafting.ICraftingRequester; +import appeng.api.networking.security.BaseActionSource; +import appeng.api.networking.security.MachineSource; +import appeng.api.networking.storage.IStackWatcher; +import appeng.api.networking.storage.IStackWatcherHost; +import appeng.api.networking.ticking.IGridTickable; +import appeng.api.networking.ticking.TickRateModulation; +import appeng.api.networking.ticking.TickingRequest; +import appeng.api.storage.StorageChannel; +import appeng.api.storage.data.IAEItemStack; +import appeng.api.storage.data.IAEStack; +import appeng.api.storage.data.IItemList; +import appeng.helpers.MultiCraftingTracker; +import appeng.me.GridAccessException; +import appeng.tile.TileEvent; +import appeng.tile.events.TileEventType; +import appeng.tile.grid.AENetworkTile; +import appeng.tile.inventory.IAEAppEngInventory; +import appeng.tile.inventory.InvOperation; +import com.glodblock.github.inventory.AeStackInventory; +import com.glodblock.github.inventory.AeStackInventoryImpl; +import com.google.common.collect.ImmutableSet; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +import java.util.concurrent.Future; + +public class TileLevelMaintainer extends AENetworkTile implements IAEAppEngInventory, IStackWatcherHost, IGridTickable, ICraftingRequester { + + public static final int REQ_COUNT = 5; + public final InventoryRequest requests = new InventoryRequest(this); + private final BaseActionSource source; + private final MultiCraftingTracker craftingTracker = new MultiCraftingTracker(this, REQ_COUNT); + + + public TileLevelMaintainer() { + getProxy().setIdlePowerUsage(1D); + getProxy().setFlags(GridFlags.REQUIRE_CHANNEL); + this.source = new MachineSource(this); + } + + public AeStackInventory getCraftingSlots() { + return requests.getCraftingSlots(); + } + + @Override + public ImmutableSet getRequestedJobs() { + return this.craftingTracker.getRequestedJobs(); + } + + @Override + public IAEItemStack injectCraftedItems(ICraftingLink link, IAEItemStack items, Actionable mode) { + return null; + } + + @Override + public void jobStateChange(ICraftingLink link) { + this.craftingTracker.jobStateChange(link); + } + + @Override + public TickingRequest getTickingRequest(IGridNode node) { + return new TickingRequest(5, 120, false, true); + } + + @Override + public TickRateModulation tickingRequest(IGridNode node, int TicksSinceLastCall) { + return this.canDoBusWork() ? this.doWork() : TickRateModulation.IDLE; + } + + private TickRateModulation doWork() { + if (!this.getProxy().isActive() || !this.canDoBusWork()) { + return TickRateModulation.IDLE; + } + boolean didSomething = false; + try { + ICraftingGrid cg = this.getProxy().getCrafting(); + IGrid grid = this.getProxy().getGrid(); + final IItemList inv = this.getProxy().getStorage().getItemInventory().getStorageList(); + for (int i = 0; i < REQ_COUNT; i++) { + IAEItemStack is = requests.getQuantity(i); + if (is != null && requests.getBatchSize(i) > 0) { + IAEItemStack craftItem = requests.getCraftItem(i); + if (inv.findPrecise(is) == null || inv.findPrecise(is).getStackSize() >= is.getStackSize() || cg.isRequesting(craftItem)) + continue; + + // do crafting + + Future jobTask = requests.getJobs()[i]; + + if (jobTask == null) { + requests.getJobs()[i] = cg.beginCraftingJob(getWorldObj(), grid, this.source, craftItem, null); + } else if (jobTask.isDone()) { + try { + ICraftingJob job = jobTask.get(); + if (job != null) { + ICraftingLink link = cg.submitJob(job, null, null, false, this.source); + didSomething = true; + requests.jobs[i] = null; + if (link != null) { + requests.links[i] = link; + } + } + } catch (Exception ignored) { + + } + } + } + } + } catch (final GridAccessException e) { + // :P + } + return didSomething ? TickRateModulation.FASTER : TickRateModulation.SLOWER; + } + + @Override + public void saveChanges() { + super.saveChanges(); + } + + @Override + public void onChangeInventory(IInventory inv, int slot, InvOperation mc, ItemStack removedStack, ItemStack newStack) { + try { + getProxy().getTick().alertDevice(getProxy().getNode()); + } catch (GridAccessException e) { + // NO-OP + } + } + + @Override + public void updateWatcher(IStackWatcher newWatcher) { + + } + + protected boolean canDoBusWork() { + return this.getProxy().isActive(); + } + + @Override + public void onStackChange(IItemList o, IAEStack fullStack, IAEStack diffStack, BaseActionSource src, StorageChannel chan) { + } + + public InventoryRequest getRequestInventory() { + return this.requests; + } + + public IInventory getInventory() { + return (IInventory) this.requests.getCraftingSlots(); + } + + public void updateQuantity(int idx, long size) { + this.requests.updateQuantity(idx, size); + } + + public void updateBatchSize(int idx, long size) { + this.requests.updateBatchSize(idx, size); + } + + @TileEvent(TileEventType.WORLD_NBT_WRITE) + public NBTTagCompound writeToNBTEvent(NBTTagCompound data) { + this.requests.crafting.writeToNbt(data, "Inventory"); + this.requests.batchSize.writeToNbt(data, "BatchSize"); + return data; + } + + @TileEvent(TileEventType.WORLD_NBT_READ) + public void readFromNBTEvent(NBTTagCompound data) { + this.requests.crafting.readFromNbt(data, "Inventory"); + this.requests.batchSize.readFromNbt(data, "BatchSize"); + } + + public static class InventoryRequest { + private final AeStackInventoryImpl crafting; + private final AeStackInventoryImpl batchSize; + private Future[] jobs; + private ICraftingLink[] links; + + public InventoryRequest(TileLevelMaintainer tile) { + this.crafting = new AeStackInventoryImpl<>(StorageChannel.ITEMS, REQ_COUNT, tile); + this.batchSize = new AeStackInventoryImpl<>(StorageChannel.ITEMS, REQ_COUNT, tile); + this.jobs = new Future[REQ_COUNT]; + this.links = new ICraftingLink[REQ_COUNT]; + } + + public Future[] getJobs() { + return jobs; + } + + public ICraftingLink[] getLinks() { + return links; + } + + public AeStackInventory getBatchInputs() { + return this.batchSize; + } + + public AeStackInventory getCraftingSlots() { + return this.crafting; + } + + public void updateQuantity(int idx, long size) { + IAEItemStack is = this.crafting.getStack(idx); + if (is != null) { + is.setStackSize(size); + } + } + + public void updateBatchSize(int idx, long size) { + IAEItemStack is = this.crafting.getStack(idx); + if (is != null) { + IAEItemStack i = is.copy(); + i.setStackSize(size); + this.batchSize.setStack(idx, i); + } + } + + public IAEItemStack getQuantity(int idx) { + return this.crafting.getStack(idx); + } + + public long getBatchSize(int idx) { + IAEItemStack is = this.crafting.getStack(idx); + IAEItemStack is1 = this.batchSize.getStack(idx); + if (is != null && is1 != null && is.isSameType(is1)) { + return is1.getStackSize(); + } + return 0; + } + + public IAEItemStack getCraftItem(int idx) { + IAEItemStack is = this.crafting.getStack(idx); + if (is != null) { + IAEItemStack ias = is.copy(); + ias.setStackSize(this.getBatchSize(idx)); + return ias; + } + return null; + } + } +} diff --git a/src/main/java/com/glodblock/github/coremod/FCClassTransformer.java b/src/main/java/com/glodblock/github/coremod/FCClassTransformer.java index 921a754e..a742faa5 100644 --- a/src/main/java/com/glodblock/github/coremod/FCClassTransformer.java +++ b/src/main/java/com/glodblock/github/coremod/FCClassTransformer.java @@ -32,6 +32,9 @@ public class FCClassTransformer implements IClassTransformer { case "appeng.integration.modules.NEI": tform = NEITransfermer.INSTANCE; break; + case "appeng.tile.storage.TileIOPort": + tform = TitleIOPortTransformer.INSTANCE; + break; default: return code; } diff --git a/src/main/java/com/glodblock/github/coremod/hooker/CoreModHooks.java b/src/main/java/com/glodblock/github/coremod/hooker/CoreModHooks.java index 6f7da80e..2c157c52 100644 --- a/src/main/java/com/glodblock/github/coremod/hooker/CoreModHooks.java +++ b/src/main/java/com/glodblock/github/coremod/hooker/CoreModHooks.java @@ -7,6 +7,7 @@ import appeng.api.networking.IGridNode; import appeng.api.networking.IMachineSet; import appeng.api.networking.storage.IStorageGrid; import appeng.api.storage.IMEInventory; +import appeng.api.storage.StorageChannel; import appeng.api.storage.data.IAEFluidStack; import appeng.api.storage.data.IAEItemStack; import appeng.crafting.MECraftingInventory; @@ -19,6 +20,7 @@ import com.glodblock.github.client.gui.GuiFluidCraftConfirm; import com.glodblock.github.common.item.ItemFluidDrop; import com.glodblock.github.common.item.ItemFluidPacket; import com.glodblock.github.common.parts.PartFluidInterface; +import com.glodblock.github.common.storage.FluidCellInventory; import com.glodblock.github.common.tile.TileFluidInterface; import com.glodblock.github.inventory.FluidConvertingInventoryAdaptor; import com.glodblock.github.inventory.FluidConvertingInventoryCrafting; @@ -197,4 +199,8 @@ public class CoreModHooks { whatToSend.setTagCompound(Result.getTagCompound()); } } + + public static long IOPortMinSpeed(long possible, long itemsToMove, final StorageChannel chan) { + return chan == StorageChannel.FLUIDS ? Math.min(possible, itemsToMove * FluidCellInventory.singleByteAmount) : Math.min(possible, itemsToMove); + } } diff --git a/src/main/java/com/glodblock/github/coremod/transform/TitleIOPortTransformer.java b/src/main/java/com/glodblock/github/coremod/transform/TitleIOPortTransformer.java new file mode 100644 index 00000000..8adf6e74 --- /dev/null +++ b/src/main/java/com/glodblock/github/coremod/transform/TitleIOPortTransformer.java @@ -0,0 +1,55 @@ +package com.glodblock.github.coremod.transform; + +import com.glodblock.github.coremod.FCClassTransformer; +import org.objectweb.asm.ClassVisitor; +import org.objectweb.asm.MethodVisitor; +import org.objectweb.asm.Opcodes; + +public class TitleIOPortTransformer extends FCClassTransformer.ClassMapper { + public static final TitleIOPortTransformer INSTANCE = new TitleIOPortTransformer(); + + private TitleIOPortTransformer() { + // NO-OP + } + + @Override + protected ClassVisitor getClassMapper(ClassVisitor downstream) { + return new TitleIOPortTransformer.TransformTitleIOPort(Opcodes.ASM5, downstream); + } + + private static class TransformTitleIOPort extends ClassVisitor { + + TransformTitleIOPort(int api, ClassVisitor cv) { + super(api, cv); + } + + @Override + public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { + if (name.equals("transferContents")) { + return new TitleIOPortTransformer.TransformTransferContents(api, super.visitMethod(access, name, desc, signature, exceptions)); + } + return super.visitMethod(access, name, desc, signature, exceptions); + } + } + + private static class TransformTransferContents extends MethodVisitor { + + TransformTransferContents(int api, MethodVisitor mv) { + super(api, mv); + } + + @Override + public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) { + if (opcode == Opcodes.INVOKESTATIC && owner.equals("java/lang/Math") && name.equals("min")) { + super.visitVarInsn(Opcodes.ALOAD, 6); + super.visitMethodInsn(Opcodes.INVOKESTATIC, + "com/glodblock/github/coremod/hooker/CoreModHooks", + "IOPortMinSpeed", + "(JJLappeng/api/storage/StorageChannel;)J", + false); + } else { + super.visitMethodInsn(opcode, owner, name, desc, itf); + } + } + } +} diff --git a/src/main/java/com/glodblock/github/inventory/gui/GuiType.java b/src/main/java/com/glodblock/github/inventory/gui/GuiType.java index 76ae169c..4d8c972d 100644 --- a/src/main/java/com/glodblock/github/inventory/gui/GuiType.java +++ b/src/main/java/com/glodblock/github/inventory/gui/GuiType.java @@ -19,7 +19,17 @@ import javax.annotation.Nullable; import java.util.List; public enum GuiType { + LEVEL_MAINTAINER(new TileGuiFactory(TileLevelMaintainer.class) { + @Override + protected Object createServerGui(EntityPlayer player, TileLevelMaintainer inv) { + return new ContainerLevelMaintainer(player.inventory, inv); + } + @Override + protected Object createClientGui(EntityPlayer player, TileLevelMaintainer inv) { + return new GuiLevelMaintainer(player.inventory, inv); + } + }), OC_PATTERN_EDITOR(new TileGuiFactory(TileOCPatternEditor.class) { @Override protected Object createServerGui(EntityPlayer player, TileOCPatternEditor inv) { diff --git a/src/main/java/com/glodblock/github/loader/ChannelLoader.java b/src/main/java/com/glodblock/github/loader/ChannelLoader.java index 62304638..6fe5978a 100644 --- a/src/main/java/com/glodblock/github/loader/ChannelLoader.java +++ b/src/main/java/com/glodblock/github/loader/ChannelLoader.java @@ -22,5 +22,6 @@ public class ChannelLoader implements Runnable { FluidCraft.proxy.netHandler.registerMessage(new SPacketFluidUpdate.Handler(), SPacketFluidUpdate.class, id ++, Side.CLIENT); FluidCraft.proxy.netHandler.registerMessage(new CPacketPatternValueSet.Handler(), CPacketPatternValueSet.class, id++, Side.SERVER); FluidCraft.proxy.netHandler.registerMessage(new CPacketFluidUpdate.Handler(), CPacketFluidUpdate.class, id++, Side.SERVER); + FluidCraft.proxy.netHandler.registerMessage(new CPacketLevelMaintainer.Handler(), CPacketLevelMaintainer.class, id++, Side.SERVER); } } diff --git a/src/main/java/com/glodblock/github/loader/ItemAndBlockHolder.java b/src/main/java/com/glodblock/github/loader/ItemAndBlockHolder.java index dced9a28..a627125d 100644 --- a/src/main/java/com/glodblock/github/loader/ItemAndBlockHolder.java +++ b/src/main/java/com/glodblock/github/loader/ItemAndBlockHolder.java @@ -8,6 +8,7 @@ import com.glodblock.github.common.storage.CellType; public class ItemAndBlockHolder { public static BlockFluidDiscretizer DISCRETIZER = new BlockFluidDiscretizer().register(); + public static BlockLevelMaintainer LEVEL_MAINTAINER = new BlockLevelMaintainer().register(); public static BlockFluidPatternEncoder ENCODER = new BlockFluidPatternEncoder().register(); public static BlockFluidPacketDecoder DECODER = new BlockFluidPacketDecoder().register(); public static BlockFluidInterface INTERFACE = new BlockFluidInterface().register(); diff --git a/src/main/java/com/glodblock/github/network/CPacketLevelMaintainer.java b/src/main/java/com/glodblock/github/network/CPacketLevelMaintainer.java new file mode 100644 index 00000000..a383cd9e --- /dev/null +++ b/src/main/java/com/glodblock/github/network/CPacketLevelMaintainer.java @@ -0,0 +1,96 @@ +package com.glodblock.github.network; + +import appeng.api.storage.data.IAEItemStack; +import appeng.util.item.AEItemStack; +import com.glodblock.github.FluidCraft; +import com.glodblock.github.client.gui.container.ContainerLevelMaintainer; +import com.glodblock.github.common.tile.TileLevelMaintainer; +import cpw.mods.fml.common.network.simpleimpl.IMessage; +import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; +import cpw.mods.fml.common.network.simpleimpl.MessageContext; +import io.netty.buffer.ByteBuf; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; + +import javax.annotation.Nullable; + +public class CPacketLevelMaintainer implements IMessage { + + private int action; + private long size; + private int slotIndex; + + public CPacketLevelMaintainer() { + } + + public CPacketLevelMaintainer(int action) { + this.action = action; + this.size = 0; + this.slotIndex = 0; + } + + public CPacketLevelMaintainer(int action, int slotIndex, long size) { + this.action = action; + this.size = size; + this.slotIndex = slotIndex; + } + + public CPacketLevelMaintainer(int action, int slotIndex, String size) { + this.action = action; + this.slotIndex = slotIndex; + this.size = Long.parseLong(size); + } + + public static IAEItemStack setTag(IAEItemStack ias, long size, int slotIndex) { + NBTTagCompound data = new NBTTagCompound(); + ItemStack is = ias.getItemStack(); + data.setLong("BatchSize", size); + data.setLong("Index", slotIndex); + is.setTagCompound(data); + IAEItemStack iaeItemStack = AEItemStack.create(is); + iaeItemStack.setStackSize(ias.getStackSize()); + return iaeItemStack; + } + + @Override + public void fromBytes(ByteBuf buf) { + this.action = buf.readInt(); + this.slotIndex = buf.readInt(); + this.size = buf.readLong(); + } + + @Override + public void toBytes(ByteBuf buf) { + buf.writeInt(this.action); + buf.writeInt(this.slotIndex); + buf.writeLong(this.size); + } + + public static class Handler implements IMessageHandler { + + @Nullable + @Override + public IMessage onMessage(CPacketLevelMaintainer message, MessageContext ctx) { + if (ctx.getServerHandler().playerEntity.openContainer instanceof ContainerLevelMaintainer) { + EntityPlayerMP player = ctx.getServerHandler().playerEntity; + final ContainerLevelMaintainer cca = (ContainerLevelMaintainer) ctx.getServerHandler().playerEntity.openContainer; + if (message.action == -1) { + SPacketMEInventoryUpdate piu = new SPacketMEInventoryUpdate(false); + for (int i = 0; i < TileLevelMaintainer.REQ_COUNT; i++) { + IAEItemStack is = cca.getTile().requests.getCraftingSlots().getStack(i); + IAEItemStack is1 = cca.getTile().requests.getBatchInputs().getStack(i); + if (is != null) { + piu.appendItem(setTag(is, is1 != null ? is1.getStackSize() : 0, i)); + } + } + FluidCraft.proxy.netHandler.sendTo(piu, player); + } else { + cca.handleClientInteraction(message.action, message.slotIndex, message.size); + } + + } + return null; + } + } +} diff --git a/src/main/java/com/glodblock/github/network/SPacketMEInventoryUpdate.java b/src/main/java/com/glodblock/github/network/SPacketMEInventoryUpdate.java index a557f70c..4bd67a0c 100644 --- a/src/main/java/com/glodblock/github/network/SPacketMEInventoryUpdate.java +++ b/src/main/java/com/glodblock/github/network/SPacketMEInventoryUpdate.java @@ -7,6 +7,7 @@ import appeng.util.item.AEItemStack; import com.glodblock.github.client.gui.GuiFCBaseFluidMonitor; import com.glodblock.github.client.gui.GuiFCBaseMonitor; import com.glodblock.github.client.gui.GuiFluidCraftConfirm; +import com.glodblock.github.client.gui.GuiLevelMaintainer; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; @@ -102,6 +103,8 @@ public class SPacketMEInventoryUpdate implements IMessage { ((GuiFCBaseMonitor) gs).postUpdate((List) (List) message.list); } else if (gs instanceof GuiFluidCraftConfirm) { ((GuiFluidCraftConfirm) gs).postUpdate((List) (List) message.list, message.ref); + } else if (gs instanceof GuiLevelMaintainer) { + ((GuiLevelMaintainer) gs).postUpdate((List) (List) message.list); } return null; } diff --git a/src/main/java/com/glodblock/github/util/NameConst.java b/src/main/java/com/glodblock/github/util/NameConst.java index bbbf4783..2d463855 100644 --- a/src/main/java/com/glodblock/github/util/NameConst.java +++ b/src/main/java/com/glodblock/github/util/NameConst.java @@ -11,6 +11,7 @@ public class NameConst { public static final String BLOCK_INGREDIENT_BUFFER = "ingredient_buffer"; public static final String BLOCK_LARGE_INGREDIENT_BUFFER = "large_ingredient_buffer"; public static final String BLOCK_OC_PATTERN_EDITOR = "oc_pattern_editor"; + public static final String BLOCK_LEVEL_MAINTAINER = "level_maintainer"; public static final String ITEM_FLUID_DROP = "fluid_drop"; public static final String ITEM_FLUID_ENCODED_PATTERN = "fluid_encoded_pattern"; @@ -31,6 +32,8 @@ public class NameConst { public static final String TT_ENCODE_PATTERN = TT_KEY + "encode_pattern"; public static final String TT_EMPTY = TT_KEY + "empty"; public static final String TT_DUMP_TANK = TT_KEY + "dump_tank"; + public static final String TT_REQUEST_SIZE = TT_KEY + "request_size"; + public static final String TT_BATCH_SIZE = TT_KEY + "batch_size"; public static final String RES_KEY = FluidCraft.MODID + ":"; @@ -38,6 +41,7 @@ public class NameConst { public static final String GUI_FLUID_TERMINAL = GUI_KEY + ITEM_PART_FLUID_TERMINAL; public static final String GUI_FLUID_PATTERN_TERMINAL = GUI_KEY + ITEM_PART_FLUID_PATTERN_TERMINAL; public static final String GUI_FLUID_PATTERN_TERMINAL_EX = GUI_KEY + ITEM_PART_FLUID_PATTERN_TERMINAL_EX; + public static final String GUI_LEVEL_MAINTAINER = GUI_KEY + BLOCK_LEVEL_MAINTAINER; public static final String GUI_FLUID_PATTERN_ENCODER = GUI_KEY + BLOCK_FLUID_PATTERN_ENCODER; public static final String GUI_FLUID_PACKET_DECODER = GUI_KEY + BLOCK_FLUID_PACKET_DECODER; public static final String GUI_INGREDIENT_BUFFER = GUI_KEY + BLOCK_INGREDIENT_BUFFER; diff --git a/src/main/resources/assets/ae2fc/lang/en_US.lang b/src/main/resources/assets/ae2fc/lang/en_US.lang index e7e74d14..4115ba1e 100644 --- a/src/main/resources/assets/ae2fc/lang/en_US.lang +++ b/src/main/resources/assets/ae2fc/lang/en_US.lang @@ -29,7 +29,10 @@ tile.fluid_interface.name=ME Dual Interface tile.ingredient_buffer.name=Ingredient Buffer tile.large_ingredient_buffer.name=Large Ingredient Buffer tile.oc_pattern_editor.name=OC Pattern Editor +tile.level_maintainer.name=ME Level Maintainer +ae2fc.tooltip.request_size=Amount to Maintain +ae2fc.tooltip.batch_size=Crafting Batch Size ae2fc.tooltip.fluid_terminal=uh So we don't need EC2 anymore? ae2fc.tooltip.invalid_fluid=Invalid fluid! ae2fc.tooltip.encode_pattern=Encode Patter @@ -46,6 +49,8 @@ ae2fc.tooltip.not_prio=Allow fluids to be placed first ae2fc.tooltip.not_prio.hint=Enabled ae2fc.tooltip.prio=Allow fluids to be placed first ae2fc.tooltip.prio.hint=Disabled +ae2fc.tooltip.submit=Submit +ae2fc.tooltip.submit.hint=Submit Request ae2fc.gui.part_fluid_pattern_terminal=Fluid Pattern Terminal ae2fc.gui.part_fluid_pattern_terminal_ex=Fluid Processing Pattern Terminal @@ -54,6 +59,7 @@ ae2fc.gui.fluid_packet_decoder=ME Fluid Packet Decoder ae2fc.gui.ingredient_buffer=Ingredient Buffer ae2fc.gui.large_ingredient_buffer=Large Ingredient Buffer ae2fc.gui.fluid_interface=ME Dual Interface +ae2fc.gui.level_maintainer=ME Level Maintainer ae2fc.gui.fluid_interface.0=D ae2fc.gui.fluid_interface.1=U ae2fc.gui.fluid_interface.2=N diff --git a/src/main/resources/assets/ae2fc/lang/zh_CN.lang b/src/main/resources/assets/ae2fc/lang/zh_CN.lang index a12846d5..12123dab 100644 --- a/src/main/resources/assets/ae2fc/lang/zh_CN.lang +++ b/src/main/resources/assets/ae2fc/lang/zh_CN.lang @@ -29,7 +29,10 @@ tile.fluid_interface.name=ME二合一接口 tile.ingredient_buffer.name=原材料缓存仓 tile.large_ingredient_buffer.name=大型原材料缓存仓 tile.oc_pattern_editor.name=OC样板编辑器 +tile.level_maintainer.name=ME缓存指令器 +ae2fc.tooltip.request_size=缓存量 +ae2fc.tooltip.batch_size=批量制作数量 ae2fc.tooltip.fluid_terminal=我们不再需要EC2了吗? ae2fc.tooltip.invalid_fluid=流体无效! ae2fc.tooltip.encode_pattern=编写样板 @@ -46,6 +49,8 @@ ae2fc.tooltip.not_prio=优先放置流体 ae2fc.tooltip.not_prio.hint=启用 ae2fc.tooltip.prio=优先放置流体 ae2fc.tooltip.prio.hint=禁用 +ae2fc.tooltip.submit=提交 +ae2fc.tooltip.submit.hint=提交请求 ae2fc.gui.part_fluid_pattern_terminal=ME流体样板终端 ae2fc.gui.part_fluid_pattern_terminal_ex=ME增广流体样板终端 @@ -54,6 +59,7 @@ ae2fc.gui.fluid_packet_decoder=ME流体封包解码器 ae2fc.gui.ingredient_buffer=原材料缓存仓 ae2fc.gui.large_ingredient_buffer=大型原材料缓存仓 ae2fc.gui.fluid_interface=ME二合一接口 +ae2fc.gui.level_maintainer=ME缓存指令器 ae2fc.gui.fluid_interface.0=下 ae2fc.gui.fluid_interface.1=上 ae2fc.gui.fluid_interface.2=北 diff --git a/src/main/resources/assets/ae2fc/textures/blocks/level_maintainer.png b/src/main/resources/assets/ae2fc/textures/blocks/level_maintainer.png new file mode 100644 index 00000000..3a4500f9 Binary files /dev/null and b/src/main/resources/assets/ae2fc/textures/blocks/level_maintainer.png differ diff --git a/src/main/resources/assets/ae2fc/textures/blocks/level_maintainerActive.png b/src/main/resources/assets/ae2fc/textures/blocks/level_maintainerActive.png new file mode 100644 index 00000000..a87a3e06 Binary files /dev/null and b/src/main/resources/assets/ae2fc/textures/blocks/level_maintainerActive.png differ diff --git a/src/main/resources/assets/ae2fc/textures/blocks/level_maintainerFront.png b/src/main/resources/assets/ae2fc/textures/blocks/level_maintainerFront.png new file mode 100644 index 00000000..8a481478 Binary files /dev/null and b/src/main/resources/assets/ae2fc/textures/blocks/level_maintainerFront.png differ diff --git a/src/main/resources/assets/ae2fc/textures/gui/level_maintainer.png b/src/main/resources/assets/ae2fc/textures/gui/level_maintainer.png new file mode 100644 index 00000000..85118334 Binary files /dev/null and b/src/main/resources/assets/ae2fc/textures/gui/level_maintainer.png differ diff --git a/src/main/resources/assets/ae2fc/textures/gui/states.png b/src/main/resources/assets/ae2fc/textures/gui/states.png index 7e7bb6dc..d0fee811 100644 Binary files a/src/main/resources/assets/ae2fc/textures/gui/states.png and b/src/main/resources/assets/ae2fc/textures/gui/states.png differ