mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-13 00:37:33 +00:00
gui improvements
This commit is contained in:
1 parent
411065ea67
commit
c6938cc921
6 files changed
+38
-7
No files matched your search
@@ -29,7 +29,7 @@ public class GuiFluidLevelMaintainer extends AEBaseGui {
|
||||
public GuiFluidLevelMaintainer(InventoryPlayer ipl, TileFluidLevelMaintainer tile) {
|
||||
super(new ContainerFluidLevelMaintainer(ipl, tile));
|
||||
this.cont = (ContainerFluidLevelMaintainer) inventorySlots;
|
||||
this.ySize = 214;
|
||||
this.ySize = 223;
|
||||
}
|
||||
|
||||
public void setMaintainNumber(int id, int size) {
|
||||
@@ -68,7 +68,7 @@ public class GuiFluidLevelMaintainer extends AEBaseGui {
|
||||
id = i + 10;
|
||||
}
|
||||
}
|
||||
if (focus != null) {
|
||||
if (focus != null && key != 1) {
|
||||
if ((key == 211 || key == 205 || key == 203 || key == 14 || character == '-' || Character.isDigit(character)) && focus.textboxKeyTyped(character, key)) {
|
||||
try {
|
||||
String out = focus.getText();
|
||||
@@ -92,6 +92,11 @@ public class GuiFluidLevelMaintainer extends AEBaseGui {
|
||||
result = 1;
|
||||
}
|
||||
|
||||
if (result > Integer.MAX_VALUE) {
|
||||
result = Integer.MAX_VALUE;
|
||||
focus.setText(String.valueOf(result));
|
||||
}
|
||||
|
||||
if (id >= 10 || result != 0)
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketUpdateFluidLevel(id, (int) result));
|
||||
|
||||
@@ -110,10 +115,14 @@ public class GuiFluidLevelMaintainer extends AEBaseGui {
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
for (int i = 0; i < TileFluidLevelMaintainer.MAX_FLUID; i ++) {
|
||||
maintain[i] = new GuiNumberBox(this.fontRenderer, this.guiLeft + 39, this.guiTop + 22 + i * 20, 42, 10, Integer.class);
|
||||
request[i] = new GuiNumberBox(this.fontRenderer, this.guiLeft + 102, this.guiTop + 22 + i * 20, 42, 10, Integer.class);
|
||||
maintain[i] = new GuiNumberBox(this.fontRenderer, this.guiLeft + 39, this.guiTop + 33 + i * 20, 51, 10, Integer.class);
|
||||
request[i] = new GuiNumberBox(this.fontRenderer, this.guiLeft + 102, this.guiTop + 33 + i * 20, 51, 10, Integer.class);
|
||||
maintain[i].setTextColor(16777215);
|
||||
request[i].setTextColor(16777215);
|
||||
maintain[i].setEnableBackgroundDrawing(false);
|
||||
request[i].setEnableBackgroundDrawing(false);
|
||||
maintain[i].setMaxStringLength(10);
|
||||
request[i].setMaxStringLength(10);
|
||||
}
|
||||
TileFluidLevelMaintainer tile = this.cont.getTile();
|
||||
IItemHandler inv = tile.getInventoryHandler();
|
||||
@@ -149,6 +158,8 @@ public class GuiFluidLevelMaintainer extends AEBaseGui {
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
fontRenderer.drawString(getGuiDisplayName(I18n.format(NameConst.GUI_FLUID_LEVEL_MAINTAINER)), 8, 6, 0x404040);
|
||||
fontRenderer.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, 0x404040);
|
||||
fontRenderer.drawString(I18n.format(NameConst.MISC_THRESHOLD), 39, 19, 0x404040);
|
||||
fontRenderer.drawString(I18n.format(NameConst.MISC_REQ), 102, 19, 0x404040);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-2
@@ -30,9 +30,9 @@ public class ContainerFluidLevelMaintainer extends AEBaseContainer {
|
||||
this.tile = tile;
|
||||
IItemHandler inv = tile.getInventoryHandler();
|
||||
for (int i = 0; i < 5; i++) {
|
||||
addSlotToContainer(new DisplayFluidSlot(inv, i, 17, 19 + i * 20));
|
||||
addSlotToContainer(new DisplayFluidSlot(inv, i, 17, 28 + i * 20));
|
||||
}
|
||||
bindPlayerInventory(ip, 0, 132);
|
||||
bindPlayerInventory(ip, 0, 141);
|
||||
}
|
||||
|
||||
public TileFluidLevelMaintainer getTile() {
|
||||
|
||||
@@ -34,6 +34,7 @@ import com.google.common.collect.ImmutableSet;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fml.common.network.ByteBufUtils;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
@@ -41,9 +42,10 @@ import net.minecraftforge.items.IItemHandler;
|
||||
import javax.annotation.Nonnull;
|
||||
import java.io.IOException;
|
||||
|
||||
public class TileFluidLevelMaintainer extends AENetworkTile implements ICraftingRequester, IAEAppEngInventory {
|
||||
public class TileFluidLevelMaintainer extends AENetworkTile implements ICraftingRequester, IAEAppEngInventory, ITickable {
|
||||
|
||||
public static final int MAX_FLUID = 5;
|
||||
private int tick = 0;
|
||||
|
||||
private final AppEngInternalAEInventory config = new AppEngInternalAEInventory(this, MAX_FLUID) {
|
||||
@Override
|
||||
@@ -251,4 +253,15 @@ public class TileFluidLevelMaintainer extends AENetworkTile implements ICrafting
|
||||
markForUpdate();
|
||||
}
|
||||
|
||||
//Sometimes it may get fucked, let's force update it every 60s
|
||||
@Override
|
||||
public void update() {
|
||||
if (!getWorld().isRemote) {
|
||||
tick ++;
|
||||
if (tick > 1200) {
|
||||
tick = 0;
|
||||
doWork();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -38,6 +38,10 @@ public final class NameConst {
|
||||
public static final String GUI_BURETTE = GUI_KEY + BLOCK_BURETTE;
|
||||
public static final String GUI_FLUID_LEVEL_MAINTAINER = GUI_KEY + BLOCK_FLUID_LEVEL_MAINTAINER;
|
||||
|
||||
public static final String MISC = FluidCraft.MODID + ".misc.";
|
||||
public static final String MISC_THRESHOLD = MISC + "threshold";
|
||||
public static final String MISC_REQ = MISC + "request";
|
||||
|
||||
public static final ResourceLocation MODEL_DENSE_ENCODED_PATTERN = FluidCraft.resource("builtin/dense_encoded_pattern");
|
||||
public static final ResourceLocation MODEL_FLUID_PACKET = FluidCraft.resource("builtin/fluid_packet");
|
||||
|
||||
|
||||
@@ -22,6 +22,9 @@ ae2fc.gui.ingredient_buffer=Ingredient Buffer
|
||||
ae2fc.gui.burette=Precision Burette
|
||||
ae2fc.gui.fluid_level_maintainer=ME Fluid Level Maintainer
|
||||
|
||||
ae2fc.misc.threshold=Threshold
|
||||
ae2fc.misc.request=Batch Size
|
||||
|
||||
ae2fc.tooltip.fluid_packet=Use a Fluid Packet Decoder to\nconvert this back into fluid.
|
||||
ae2fc.tooltip.invalid_fluid=Invalid fluid!
|
||||
ae2fc.tooltip.processing_recipe_only=Not a processing recipe!
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 9.1 KiB After Width: | Height: | Size: 1.6 KiB |
Reference in new issue
Block a user