From 26a35a2ce394d660297467074a19fe68763303a3 Mon Sep 17 00:00:00 2001 From: raoulvdberge Date: Wed, 11 Sep 2019 19:56:35 +0200 Subject: [PATCH] Make entire gui pkg compile --- .../refinedstorage/gui/GuiController.java | 2 +- .../refinedstorage/gui/GuiCrafterManager.java | 2 +- .../refinedstorage/gui/GuiHandler.java | 62 +++++++++---------- .../refinedstorage/gui/grid/GuiGrid.java | 48 ++++++-------- .../gui/grid/GuiGridCraftingSettings.java | 16 +++-- .../gui/grid/filtering/GridFilterFilter.java | 3 +- .../sorting/GridSorterInventoryTweaks.java | 18 ++++-- .../gui/grid/stack/GridStackFluid.java | 15 ++--- .../gui/grid/stack/GridStackItem.java | 23 +++---- .../gui/grid/view/GridViewFluid.java | 8 +-- 10 files changed, 93 insertions(+), 104 deletions(-) diff --git a/src/main/java/com/raoulvdberge/refinedstorage/gui/GuiController.java b/src/main/java/com/raoulvdberge/refinedstorage/gui/GuiController.java index 01970f2d7..ed45d0be9 100755 --- a/src/main/java/com/raoulvdberge/refinedstorage/gui/GuiController.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/gui/GuiController.java @@ -22,7 +22,7 @@ public class GuiController extends GuiBase { private int barWidth = 16; private int barHeight = 59; - public GuiController(ContainerController container, PlayerInventory inventory, TileController controller) { + public GuiController(ContainerController container, TileController controller, PlayerInventory inventory) { super(container, 176, 181, inventory, null); this.controller = controller; diff --git a/src/main/java/com/raoulvdberge/refinedstorage/gui/GuiCrafterManager.java b/src/main/java/com/raoulvdberge/refinedstorage/gui/GuiCrafterManager.java index 5b1c80974..fb29c626b 100644 --- a/src/main/java/com/raoulvdberge/refinedstorage/gui/GuiCrafterManager.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/gui/GuiCrafterManager.java @@ -23,7 +23,7 @@ public class GuiCrafterManager extends GuiBase implemen private TextFieldSearch searchField; - public GuiCrafterManager(PlayerInventory inventory, NetworkNodeCrafterManager crafterManager) { + public GuiCrafterManager(NetworkNodeCrafterManager crafterManager, PlayerInventory inventory) { super(null, 193, 0, inventory, null); this.crafterManager = crafterManager; diff --git a/src/main/java/com/raoulvdberge/refinedstorage/gui/GuiHandler.java b/src/main/java/com/raoulvdberge/refinedstorage/gui/GuiHandler.java index 5bc697d0a..b8f6f14d0 100755 --- a/src/main/java/com/raoulvdberge/refinedstorage/gui/GuiHandler.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/gui/GuiHandler.java @@ -8,15 +8,14 @@ import com.raoulvdberge.refinedstorage.tile.*; import com.raoulvdberge.refinedstorage.tile.craftingmonitor.TileCraftingMonitor; import com.raoulvdberge.refinedstorage.tile.craftingmonitor.WirelessCraftingMonitor; import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.inventory.Container; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.common.network.IGuiHandler; public class GuiHandler implements IGuiHandler { - private Container getContainer(int ID, PlayerEntity player, TileEntity tile) { + private Object getContainer(int ID, PlayerEntity player, TileEntity tile) { switch (ID) { case RSGui.CONTROLLER: return new ContainerController((TileController) tile, player); @@ -84,58 +83,59 @@ public class GuiHandler implements IGuiHandler { switch (ID) { case RSGui.CONTROLLER: - return new GuiController((ContainerController) getContainer(ID, player, tile), (TileController) tile); + return new GuiController((ContainerController) getContainer(ID, player, tile), (TileController) tile, player.inventory); case RSGui.DISK_DRIVE: - return new GuiStorage((ContainerDiskDrive) getContainer(ID, player, tile), ((TileDiskDrive) tile).getNode(), "gui/disk_drive.png"); + return new GuiStorage((ContainerDiskDrive) getContainer(ID, player, tile), ((TileDiskDrive) tile).getNode(), "gui/disk_drive.png", player.inventory); case RSGui.IMPORTER: - return new GuiImporter((ContainerImporter) getContainer(ID, player, tile)); + return new GuiImporter((ContainerImporter) getContainer(ID, player, tile), player.inventory); case RSGui.EXPORTER: - return new GuiExporter((ContainerExporter) getContainer(ID, player, tile)); + return new GuiExporter((ContainerExporter) getContainer(ID, player, tile), player.inventory); case RSGui.DETECTOR: - return new GuiDetector((ContainerDetector) getContainer(ID, player, tile)); + return new GuiDetector((ContainerDetector) getContainer(ID, player, tile), player.inventory); case RSGui.DESTRUCTOR: - return new GuiDestructor((ContainerDestructor) getContainer(ID, player, tile)); + return new GuiDestructor((ContainerDestructor) getContainer(ID, player, tile), player.inventory); case RSGui.CONSTRUCTOR: - return new GuiConstructor((ContainerConstructor) getContainer(ID, player, tile)); + return new GuiConstructor((ContainerConstructor) getContainer(ID, player, tile), player.inventory); case RSGui.STORAGE: - return new GuiStorage((ContainerStorage) getContainer(ID, player, tile), ((TileStorage) tile).getNode()); + return new GuiStorage((ContainerStorage) getContainer(ID, player, tile), ((TileStorage) tile).getNode(), player.inventory); case RSGui.EXTERNAL_STORAGE: - return new GuiStorage((ContainerExternalStorage) getContainer(ID, player, tile), ((TileExternalStorage) tile).getNode()); + return new GuiStorage((ContainerExternalStorage) getContainer(ID, player, tile), ((TileExternalStorage) tile).getNode(), player.inventory); case RSGui.RELAY: - return new GuiRelay((ContainerRelay) getContainer(ID, player, tile)); + return new GuiRelay((ContainerRelay) getContainer(ID, player, tile), player.inventory); case RSGui.INTERFACE: - return new GuiInterface((ContainerInterface) getContainer(ID, player, tile)); + return new GuiInterface((ContainerInterface) getContainer(ID, player, tile), player.inventory); case RSGui.CRAFTING_MONITOR: { NetworkNodeCraftingMonitor node = ((TileCraftingMonitor) tile).getNode(); - GuiCraftingMonitor gui = new GuiCraftingMonitor(null, node); - gui.inventorySlots = new ContainerCraftingMonitor(node, (TileCraftingMonitor) tile, player); - return gui; + + return new GuiCraftingMonitor(new ContainerCraftingMonitor(node, (TileCraftingMonitor) tile, player), node, player.inventory); } case RSGui.WIRELESS_TRANSMITTER: - return new GuiWirelessTransmitter((ContainerWirelessTransmitter) getContainer(ID, player, tile)); + return new GuiWirelessTransmitter((ContainerWirelessTransmitter) getContainer(ID, player, tile), player.inventory); case RSGui.CRAFTER: - return new GuiCrafter((ContainerCrafter) getContainer(ID, player, tile)); + return new GuiCrafter((ContainerCrafter) getContainer(ID, player, tile), player.inventory); case RSGui.FILTER: - return new GuiFilter(getFilterContainer(player, x)); + return new GuiFilter(getFilterContainer(player, x), player.inventory); case RSGui.NETWORK_TRANSMITTER: - return new GuiNetworkTransmitter((ContainerNetworkTransmitter) getContainer(ID, player, tile), (TileNetworkTransmitter) tile); + return new GuiNetworkTransmitter((ContainerNetworkTransmitter) getContainer(ID, player, tile), (TileNetworkTransmitter) tile, player.inventory); case RSGui.FLUID_INTERFACE: - return new GuiFluidInterface((ContainerFluidInterface) getContainer(ID, player, tile)); + return new GuiFluidInterface((ContainerFluidInterface) getContainer(ID, player, tile), player.inventory); case RSGui.FLUID_STORAGE: - return new GuiStorage((ContainerFluidStorage) getContainer(ID, player, tile), ((TileFluidStorage) tile).getNode()); + return new GuiStorage((ContainerFluidStorage) getContainer(ID, player, tile), ((TileFluidStorage) tile).getNode(), player.inventory); case RSGui.DISK_MANIPULATOR: - return new GuiDiskManipulator((ContainerDiskManipulator) getContainer(ID, player, tile)); + return new GuiDiskManipulator((ContainerDiskManipulator) getContainer(ID, player, tile), player.inventory); case RSGui.WIRELESS_CRAFTING_MONITOR: return getWirelessCraftingMonitorGui(player, x); case RSGui.READER_WRITER: - return new GuiReaderWriter((ContainerReaderWriter) getContainer(ID, player, tile), (IGuiReaderWriter) ((TileNode) tile).getNode()); + return new GuiReaderWriter((ContainerReaderWriter) getContainer(ID, player, tile), (IGuiReaderWriter) ((TileNode) tile).getNode(), player.inventory); case RSGui.SECURITY_MANAGER: - return new GuiSecurityManager((ContainerSecurityManager) getContainer(ID, player, tile), (TileSecurityManager) tile); + return new GuiSecurityManager((ContainerSecurityManager) getContainer(ID, player, tile), (TileSecurityManager) tile, player.inventory); case RSGui.STORAGE_MONITOR: - return new GuiStorageMonitor((ContainerStorageMonitor) getContainer(ID, player, tile)); + return new GuiStorageMonitor((ContainerStorageMonitor) getContainer(ID, player, tile), player.inventory); case RSGui.CRAFTER_MANAGER: - GuiCrafterManager crafterManagerGui = new GuiCrafterManager(((TileCrafterManager) tile).getNode()); + GuiCrafterManager crafterManagerGui = new GuiCrafterManager(((TileCrafterManager) tile).getNode(), player.inventory); + crafterManagerGui.setContainer(new ContainerCrafterManager((TileCrafterManager) tile, player, crafterManagerGui)); + return crafterManagerGui; default: return null; @@ -149,9 +149,7 @@ public class GuiHandler implements IGuiHandler { private GuiCraftingMonitor getWirelessCraftingMonitorGui(PlayerEntity player, int invIndex) { WirelessCraftingMonitor craftingMonitor = getWirelessCraftingMonitor(player, invIndex); - GuiCraftingMonitor gui = new GuiCraftingMonitor(null, craftingMonitor); - gui.inventorySlots = new ContainerCraftingMonitor(craftingMonitor, null, player); - return gui; + return new GuiCraftingMonitor(new ContainerCraftingMonitor(craftingMonitor, null, player), craftingMonitor, player.inventory); } private ContainerCraftingMonitor getCraftingMonitorContainer(PlayerEntity player, int invIndex) { @@ -159,6 +157,6 @@ public class GuiHandler implements IGuiHandler { } private ContainerFilter getFilterContainer(PlayerEntity player, int hand) { - return new ContainerFilter(player, player.getHeldItem(EnumHand.values()[hand])); + return new ContainerFilter(player, player.getHeldItem(Hand.values()[hand])); } } diff --git a/src/main/java/com/raoulvdberge/refinedstorage/gui/grid/GuiGrid.java b/src/main/java/com/raoulvdberge/refinedstorage/gui/grid/GuiGrid.java index d045b99de..0ad8deb11 100755 --- a/src/main/java/com/raoulvdberge/refinedstorage/gui/grid/GuiGrid.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/gui/grid/GuiGrid.java @@ -1,12 +1,10 @@ package com.raoulvdberge.refinedstorage.gui.grid; import com.google.common.collect.Lists; +import com.mojang.blaze3d.platform.GlStateManager; import com.raoulvdberge.refinedstorage.RS; -import com.raoulvdberge.refinedstorage.RSKeyBindings; import com.raoulvdberge.refinedstorage.api.network.grid.GridType; import com.raoulvdberge.refinedstorage.api.network.grid.IGrid; -import com.raoulvdberge.refinedstorage.api.network.grid.IGridNetworkAware; -import com.raoulvdberge.refinedstorage.api.network.grid.handler.IItemGridHandler; import com.raoulvdberge.refinedstorage.apiimpl.network.node.NetworkNodeGrid; import com.raoulvdberge.refinedstorage.container.ContainerGrid; import com.raoulvdberge.refinedstorage.gui.GuiBase; @@ -18,31 +16,22 @@ import com.raoulvdberge.refinedstorage.gui.grid.stack.IGridStack; import com.raoulvdberge.refinedstorage.gui.grid.view.GridViewFluid; import com.raoulvdberge.refinedstorage.gui.grid.view.GridViewItem; import com.raoulvdberge.refinedstorage.gui.grid.view.IGridView; -import com.raoulvdberge.refinedstorage.network.*; import com.raoulvdberge.refinedstorage.tile.config.IType; -import com.raoulvdberge.refinedstorage.tile.data.TileDataManager; import com.raoulvdberge.refinedstorage.tile.grid.TileGrid; import com.raoulvdberge.refinedstorage.tile.grid.portable.IPortableGrid; import com.raoulvdberge.refinedstorage.tile.grid.portable.TilePortableGrid; import com.raoulvdberge.refinedstorage.util.RenderUtils; import com.raoulvdberge.refinedstorage.util.TimeUtils; -import net.minecraft.client.audio.PositionedSoundRecord; -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.resources.I18n; -import net.minecraft.init.SoundEvents; +import net.minecraft.entity.player.PlayerInventory; import net.minecraft.item.ItemStack; -import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.client.config.GuiCheckBox; -import net.minecraftforge.fml.common.FMLCommonHandler; -import java.io.IOException; import java.util.LinkedList; import java.util.List; -public class GuiGrid extends GuiBase implements IResizableDisplay { +public class GuiGrid extends GuiBase implements IResizableDisplay { private IGridView view; private TextFieldSearch searchField; @@ -56,8 +45,8 @@ public class GuiGrid extends GuiBase implements IResizableDisplay { private int slotNumber; - public GuiGrid(ContainerGrid container, IGrid grid) { - super(container, 227, 0); + public GuiGrid(ContainerGrid container, IGrid grid, PlayerInventory inventory) { + super(container, 227, 0, inventory, null); this.grid = grid; this.view = grid.getGridType() == GridType.FLUID ? new GridViewFluid(this, getDefaultSorter(), getSorters()) : new GridViewItem(this, getDefaultSorter(), getSorters()); @@ -84,7 +73,7 @@ public class GuiGrid extends GuiBase implements IResizableDisplay { @Override public void init(int x, int y) { - ((ContainerGrid) this.inventorySlots).initSlots(); + ((ContainerGrid) this.container).initSlots(); this.tabs.init(xSize - 32); @@ -98,7 +87,7 @@ public class GuiGrid extends GuiBase implements IResizableDisplay { int sy = y + 6 + 1; if (searchField == null) { - searchField = new TextFieldSearch(0, fontRenderer, sx, sy, 88 - 6); + searchField = new TextFieldSearch(font, sx, sy, 88 - 6); searchField.addListener(() -> { this.getView().sort(); // Use getter since this view can be replaced. }); @@ -126,7 +115,7 @@ public class GuiGrid extends GuiBase implements IResizableDisplay { } if (showOredict) { - oredictPattern = addCheckBox(processingPattern.x + processingPattern.width + 5, y + getTopHeight() + (getVisibleRows() * 18) + 60, t("misc.refinedstorage:oredict"), TileGrid.OREDICT_PATTERN.getValue()); + oredictPattern = addCheckBox(processingPattern.x + processingPattern.getWidth() + 5, y + getTopHeight() + (getVisibleRows() * 18) + 60, t("misc.refinedstorage:oredict"), TileGrid.OREDICT_PATTERN.getValue()); } addSideButton(new SideButtonType(this, TileGrid.PROCESSING_TYPE)); @@ -309,13 +298,13 @@ public class GuiGrid extends GuiBase implements IResizableDisplay { tabs.drawForeground(x, y - tabs.getHeight(), mouseX, mouseY, true); if (searchField != null) { - searchField.drawTextBox(); + searchField.render(0, 0, 0); } } @Override - public void drawScreen(int mouseX, int mouseY, float partialTicks) { - super.drawScreen(mouseX, mouseY, partialTicks); + public void render(int mouseX, int mouseY, float partialTicks) { + super.render(mouseX, mouseY, partialTicks); // Drawn in here for bug #1844 (https://github.com/raoulvdberge/refinedstorage/issues/1844) // Item tooltips can't be rendered in the foreground layer due to the X offset translation. @@ -351,14 +340,12 @@ public class GuiGrid extends GuiBase implements IResizableDisplay { int color = grid.isActive() ? -2130706433 : 0xFF5B5B5B; GlStateManager.disableLighting(); - GlStateManager.disableDepth(); - zLevel = 190; + GlStateManager.disableDepthTest(); GlStateManager.colorMask(true, true, true, false); - drawGradientRect(x, y, x + 16, y + 16, color, color); - zLevel = 0; + fillGradient(x, y, x + 16, y + 16, color, color); GlStateManager.colorMask(true, true, true, true); GlStateManager.enableLighting(); - GlStateManager.enableDepth(); + GlStateManager.enableDepthTest(); } slot++; @@ -379,7 +366,7 @@ public class GuiGrid extends GuiBase implements IResizableDisplay { drawTooltip(mouseX, mouseY, t("gui.refinedstorage:grid.pattern_create")); } - tabs.drawTooltip(fontRenderer, mouseX, mouseY); + tabs.drawTooltip(font, mouseX, mouseY); } private void drawGridTooltip(IGridStack gridStack, int mouseX, int mouseY) { @@ -396,9 +383,10 @@ public class GuiGrid extends GuiBase implements IResizableDisplay { ItemStack stack = gridStack instanceof GridStackItem ? ((GridStackItem) gridStack).getStack() : ItemStack.EMPTY; - RenderUtils.drawTooltipWithSmallText(textLines, smallTextLines, RS.INSTANCE.config.detailedTooltip, stack, mouseX, mouseY, screenWidth, screenHeight, fontRenderer); + RenderUtils.drawTooltipWithSmallText(textLines, smallTextLines, RS.INSTANCE.config.detailedTooltip, stack, mouseX, mouseY, screenWidth, screenHeight, font); } + /* TODO @Override protected void actionPerformed(GuiButton button) throws IOException { super.actionPerformed(button); @@ -497,7 +485,7 @@ public class GuiGrid extends GuiBase implements IResizableDisplay { } else { super.keyTyped(character, keyCode); } - } + }*/ public TextFieldSearch getSearchField() { return searchField; diff --git a/src/main/java/com/raoulvdberge/refinedstorage/gui/grid/GuiGridCraftingSettings.java b/src/main/java/com/raoulvdberge/refinedstorage/gui/grid/GuiGridCraftingSettings.java index a376ef4fc..206cd2502 100644 --- a/src/main/java/com/raoulvdberge/refinedstorage/gui/grid/GuiGridCraftingSettings.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/gui/grid/GuiGridCraftingSettings.java @@ -1,21 +1,19 @@ package com.raoulvdberge.refinedstorage.gui.grid; import com.google.common.primitives.Ints; -import com.raoulvdberge.refinedstorage.RS; import com.raoulvdberge.refinedstorage.container.ContainerCraftingSettings; import com.raoulvdberge.refinedstorage.gui.GuiAmountSpecifying; import com.raoulvdberge.refinedstorage.gui.GuiBase; import com.raoulvdberge.refinedstorage.gui.grid.stack.GridStackFluid; import com.raoulvdberge.refinedstorage.gui.grid.stack.IGridStack; -import com.raoulvdberge.refinedstorage.network.MessageGridCraftingPreview; import net.minecraft.entity.player.PlayerEntity; -import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidAttributes; -public class GuiGridCraftingSettings extends GuiAmountSpecifying { +public class GuiGridCraftingSettings extends GuiAmountSpecifying { private IGridStack stack; public GuiGridCraftingSettings(GuiBase parent, PlayerEntity player, IGridStack stack) { - super(parent, new ContainerCraftingSettings(player, stack), 172, 99); + super(parent, new ContainerCraftingSettings(player, stack), 172, 99, player.inventory); this.stack = stack; } @@ -26,7 +24,7 @@ public class GuiGridCraftingSettings extends GuiAmountSpecifying { } @Override - protected String getTitle() { + protected String getGuiTitle() { return t("container.crafting"); } @@ -52,7 +50,7 @@ public class GuiGridCraftingSettings extends GuiAmountSpecifying { @Override protected int getDefaultAmount() { - return stack instanceof GridStackFluid ? Fluid.BUCKET_VOLUME : 1; + return stack instanceof GridStackFluid ? FluidAttributes.BUCKET_VOLUME : 1; } @Override @@ -69,9 +67,9 @@ public class GuiGridCraftingSettings extends GuiAmountSpecifying { Integer quantity = Ints.tryParse(amountField.getText()); if (quantity != null && quantity > 0) { - RS.INSTANCE.network.sendToServer(new MessageGridCraftingPreview(stack.getHash(), quantity, shiftDown, stack instanceof GridStackFluid)); + // TODO RS.INSTANCE.network.sendToServer(new MessageGridCraftingPreview(stack.getHash(), quantity, shiftDown, stack instanceof GridStackFluid)); - okButton.enabled = false; + okButton.active = false; // TODO is active correct } } } diff --git a/src/main/java/com/raoulvdberge/refinedstorage/gui/grid/filtering/GridFilterFilter.java b/src/main/java/com/raoulvdberge/refinedstorage/gui/grid/filtering/GridFilterFilter.java index 1918454d6..0deb1dfb9 100644 --- a/src/main/java/com/raoulvdberge/refinedstorage/gui/grid/filtering/GridFilterFilter.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/gui/grid/filtering/GridFilterFilter.java @@ -6,7 +6,6 @@ import com.raoulvdberge.refinedstorage.gui.grid.stack.GridStackFluid; import com.raoulvdberge.refinedstorage.gui.grid.stack.GridStackItem; import com.raoulvdberge.refinedstorage.gui.grid.stack.IGridStack; import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; import java.util.List; @@ -47,7 +46,7 @@ public class GridFilterFilter implements Predicate { FluidStack stackInFilter = (FluidStack) filter.getStack(); if (filter.isModFilter()) { - String stackInFilterModId = FluidRegistry.getModId(stackInFilter); + String stackInFilterModId = /* TODO FluidRegistry.getModId(stackInFilter)*/"bla bla"; if (stackInFilterModId != null && stackInFilterModId.equalsIgnoreCase(stack.getModId())) { return filter.getMode() == IFilter.MODE_WHITELIST; diff --git a/src/main/java/com/raoulvdberge/refinedstorage/gui/grid/sorting/GridSorterInventoryTweaks.java b/src/main/java/com/raoulvdberge/refinedstorage/gui/grid/sorting/GridSorterInventoryTweaks.java index 7e29ad953..33f033ff5 100644 --- a/src/main/java/com/raoulvdberge/refinedstorage/gui/grid/sorting/GridSorterInventoryTweaks.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/gui/grid/sorting/GridSorterInventoryTweaks.java @@ -1,15 +1,23 @@ package com.raoulvdberge.refinedstorage.gui.grid.sorting; import com.raoulvdberge.refinedstorage.api.network.grid.IGrid; -import com.raoulvdberge.refinedstorage.gui.grid.stack.GridStackItem; import com.raoulvdberge.refinedstorage.gui.grid.stack.IGridStack; -import invtweaks.api.InvTweaksAPI; -import net.minecraftforge.fml.common.Loader; +// TODO public class GridSorterInventoryTweaks implements IGridSorter { public static final String MOD_ID = "inventorytweaks"; - private InvTweaksAPI api = null; + @Override + public boolean isApplicable(IGrid grid) { + return false; + } + + @Override + public int compare(IGridStack left, IGridStack right, GridSorterDirection direction) { + return 0; + } + +/* private InvTweaksAPI api = null; public GridSorterInventoryTweaks() { try { @@ -35,6 +43,6 @@ public class GridSorterInventoryTweaks implements IGridSorter { } return 0; - } + }*/ } \ No newline at end of file diff --git a/src/main/java/com/raoulvdberge/refinedstorage/gui/grid/stack/GridStackFluid.java b/src/main/java/com/raoulvdberge/refinedstorage/gui/grid/stack/GridStackFluid.java index 08538e6ea..750bd9df1 100755 --- a/src/main/java/com/raoulvdberge/refinedstorage/gui/grid/stack/GridStackFluid.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/gui/grid/stack/GridStackFluid.java @@ -4,7 +4,6 @@ import com.raoulvdberge.refinedstorage.api.storage.IStorageTracker; import com.raoulvdberge.refinedstorage.apiimpl.API; import com.raoulvdberge.refinedstorage.gui.GuiBase; import net.minecraft.client.resources.I18n; -import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; import javax.annotation.Nullable; @@ -53,13 +52,14 @@ public class GridStackFluid implements IGridStack { @Override public String getName() { - return stack.getFluid().getLocalizedName(stack); + return stack.getDisplayName().getFormattedText(); // TODO correct method usage } @Override public String getModId() { if (modId == null) { - modId = FluidRegistry.getModId(stack); + // modId = FluidRegistry.getModId(stack); + modId = "dinosaur";//TODO if (modId == null) { modId = "???"; @@ -84,17 +84,18 @@ public class GridStackFluid implements IGridStack { @Override public String[] getOreIds() { - return new String[]{stack.getFluid().getName()}; + return new String[]{}; + //return new String[]{stack.getFluid().getName()}; } @Override public String getTooltip() { - return stack.getFluid().getLocalizedName(stack); + return stack.getDisplayName().getFormattedText();//TODO } @Override public int getQuantity() { - return stack.amount; + return stack.getAmount(); } @Override @@ -104,7 +105,7 @@ public class GridStackFluid implements IGridStack { @Override public void draw(GuiBase gui, int x, int y) { - GuiBase.FLUID_RENDERER.draw(gui.mc, x, y, stack); + GuiBase.FLUID_RENDERER.draw(gui.getMinecraft(), x, y, stack); String text; diff --git a/src/main/java/com/raoulvdberge/refinedstorage/gui/grid/stack/GridStackItem.java b/src/main/java/com/raoulvdberge/refinedstorage/gui/grid/stack/GridStackItem.java index 8a78c4968..def8850ca 100755 --- a/src/main/java/com/raoulvdberge/refinedstorage/gui/grid/stack/GridStackItem.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/gui/grid/stack/GridStackItem.java @@ -4,18 +4,12 @@ import com.raoulvdberge.refinedstorage.api.storage.IStorageTracker; import com.raoulvdberge.refinedstorage.apiimpl.API; import com.raoulvdberge.refinedstorage.apiimpl.storage.StorageTrackerEntry; import com.raoulvdberge.refinedstorage.gui.GuiBase; -import com.raoulvdberge.refinedstorage.util.RenderUtils; import com.raoulvdberge.refinedstorage.util.StackUtils; -import io.netty.buffer.ByteBuf; import net.minecraft.client.resources.I18n; import net.minecraft.item.ItemStack; -import net.minecraftforge.fml.common.Loader; -import net.minecraftforge.fml.common.ModContainer; -import net.minecraftforge.oredict.OreDictionary; +import net.minecraft.network.PacketBuffer; import javax.annotation.Nullable; -import java.util.Arrays; -import java.util.stream.Collectors; public class GridStackItem implements IGridStack { private int hash; @@ -34,7 +28,7 @@ public class GridStackItem implements IGridStack { this.stack = stack; } - public GridStackItem(ByteBuf buf) { + public GridStackItem(PacketBuffer buf) { this.stack = StackUtils.readItemStack(buf); this.hash = buf.readInt(); this.craftable = buf.readBoolean(); @@ -48,12 +42,13 @@ public class GridStackItem implements IGridStack { @Nullable static String getModNameByModId(String modId) { - ModContainer container = Loader.instance().getActiveModList().stream() + /*ModContainer container = Loader.instance().getActiveModList().stream() .filter(m -> m.getModId().toLowerCase().equals(modId)) .findFirst() .orElse(null); - return container == null ? null : container.getName(); + return container == null ? null : container.getName();*/ + return "dinosaur"; // TODO } public ItemStack getStack() { @@ -88,7 +83,7 @@ public class GridStackItem implements IGridStack { public String getName() { try { if (cachedName == null) { - cachedName = stack.getDisplayName(); + cachedName = stack.getDisplayName().getFormattedText(); // TODO } return cachedName; @@ -129,7 +124,8 @@ public class GridStackItem implements IGridStack { if (stack.isEmpty()) { oreIds = new String[]{}; } else { - oreIds = Arrays.stream(OreDictionary.getOreIDs(stack)).mapToObj(OreDictionary::getOreName).toArray(String[]::new); + oreIds = new String[]{};//TODO OreDict + //oreIds = Arrays.stream(OreDictionary.getOreIDs(stack)).mapToObj(OreDictionary::getOreName).toArray(String[]::new); } } @@ -140,7 +136,8 @@ public class GridStackItem implements IGridStack { public String getTooltip() { if (tooltip == null) { try { - tooltip = RenderUtils.getItemTooltip(stack).stream().collect(Collectors.joining("\n")); + tooltip = "dinosaur";//TODO + //tooltip = RenderUtils.getItemTooltip(stack).stream().collect(Collectors.joining("\n")); } catch (Throwable t) { tooltip = ""; } diff --git a/src/main/java/com/raoulvdberge/refinedstorage/gui/grid/view/GridViewFluid.java b/src/main/java/com/raoulvdberge/refinedstorage/gui/grid/view/GridViewFluid.java index 2d694056e..2485caa7b 100644 --- a/src/main/java/com/raoulvdberge/refinedstorage/gui/grid/view/GridViewFluid.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/gui/grid/view/GridViewFluid.java @@ -35,11 +35,11 @@ public class GridViewFluid extends GridViewBase { GridStackFluid existing = (GridStackFluid) map.get(stack.getHash()); if (existing == null) { - ((GridStackFluid) stack).getStack().amount = delta; + ((GridStackFluid) stack).getStack().setAmount(delta); map.put(stack.getHash(), stack); } else { - if (existing.getStack().amount + delta <= 0) { + if (existing.getStack().getAmount() + delta <= 0) { if (existing.isCraftable()) { existing.setDisplayCraftText(true); } else { @@ -49,9 +49,9 @@ public class GridViewFluid extends GridViewBase { if (existing.doesDisplayCraftText()) { existing.setDisplayCraftText(false); - existing.getStack().amount = delta; + existing.getStack().setAmount(delta); } else { - existing.getStack().amount += delta; + existing.getStack().grow(delta); } }