diff --git a/src/main/java/appeng/client/gui/implementations/GuiOreDictStorageBus.java b/src/main/java/appeng/client/gui/implementations/GuiOreDictStorageBus.java index c444c7e71a0..3f4e7eccbb5 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiOreDictStorageBus.java +++ b/src/main/java/appeng/client/gui/implementations/GuiOreDictStorageBus.java @@ -4,7 +4,6 @@ import appeng.api.config.ActionItems; import appeng.api.config.Settings; import appeng.api.config.StorageFilter; -import appeng.client.gui.AEBaseGui; import appeng.client.gui.widgets.GuiImgButton; import appeng.client.gui.widgets.GuiTabButton; import appeng.client.gui.widgets.MEGuiTextField; @@ -27,7 +26,7 @@ import java.util.regex.Pattern; -public class GuiOreDictStorageBus extends AEBaseGui { +public class GuiOreDictStorageBus extends GuiUpgradeable { private final ContainerOreDictStorageBus container; PartOreDicStorageBus part; private GuiTabButton priority; @@ -41,13 +40,11 @@ public GuiOreDictStorageBus(final InventoryPlayer inventoryPlayer, final PartOre super(new ContainerOreDictStorageBus(inventoryPlayer, te)); this.container = (ContainerOreDictStorageBus) super.inventorySlots; part = te; - this.ySize = 84; + this.ySize = 170; } @Override - public void initGui() { - super.initGui(); - + protected void addButtons() { this.searchFieldInputs = new MEGuiTextField(this.fontRenderer, this.guiLeft + 3, this.guiTop + 22, 170, 12); this.searchFieldInputs.setEnableBackgroundDrawing(false); this.searchFieldInputs.setMaxStringLength(512); @@ -66,7 +63,6 @@ public void initGui() { } catch (IOException e) { e.printStackTrace(); } - } public void fillRegex(String regex) { @@ -143,10 +139,13 @@ public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) { } @Override - public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) { - this.bindTexture("guis/oredictstoragebus.png"); - this.drawTexturedModalRect(offsetX, offsetY, 0, 0, 175, 85); + protected String getBackground() { + return "guis/oredictstoragebus.png"; + } + @Override + public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) { + super.drawBG(offsetX, offsetY, mouseX, mouseY); if (this.searchFieldInputs != null) { this.searchFieldInputs.drawTextBox(); } diff --git a/src/main/java/appeng/container/implementations/ContainerOreDictStorageBus.java b/src/main/java/appeng/container/implementations/ContainerOreDictStorageBus.java index d6413eab979..6a6d82bbfac 100644 --- a/src/main/java/appeng/container/implementations/ContainerOreDictStorageBus.java +++ b/src/main/java/appeng/container/implementations/ContainerOreDictStorageBus.java @@ -1,15 +1,12 @@ package appeng.container.implementations; import appeng.api.AEApi; -import appeng.api.config.AccessRestriction; -import appeng.api.config.SecurityPermissions; -import appeng.api.config.Settings; -import appeng.api.config.StorageFilter; +import appeng.api.config.*; import appeng.api.storage.IMEInventory; import appeng.api.storage.channels.IItemStorageChannel; import appeng.api.storage.data.IAEItemStack; -import appeng.container.AEBaseContainer; import appeng.container.guisync.GuiSync; +import appeng.container.slot.SlotRestrictedInput; import appeng.core.sync.network.NetworkHandler; import appeng.core.sync.packets.PacketValueConfig; import appeng.parts.misc.PartOreDicStorageBus; @@ -18,6 +15,7 @@ import appeng.util.item.OreReference; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.InventoryPlayer; +import net.minecraftforge.items.IItemHandler; import net.minecraftforge.oredict.OreDictionary; import java.io.IOException; @@ -26,7 +24,7 @@ import java.util.Set; -public class ContainerOreDictStorageBus extends AEBaseContainer { +public class ContainerOreDictStorageBus extends ContainerUpgradeable { private final PartOreDicStorageBus part; @GuiSync(3) @@ -35,6 +33,9 @@ public class ContainerOreDictStorageBus extends AEBaseContainer { @GuiSync(4) public StorageFilter storageFilter = StorageFilter.EXTRACTABLE_ONLY; + @GuiSync(7) + public YesNo stickyMode = YesNo.NO; + public ContainerOreDictStorageBus(final InventoryPlayer ip, final PartOreDicStorageBus anchor) { super(ip, anchor); this.part = anchor; @@ -47,9 +48,15 @@ public void detectAndSendChanges() { if (Platform.isServer()) { this.setReadWriteMode((AccessRestriction) part.getConfigManager().getSetting(Settings.ACCESS)); this.setStorageFilter((StorageFilter) part.getConfigManager().getSetting(Settings.STORAGE_FILTER)); + this.setStickyMode((YesNo) this.getUpgradeable().getConfigManager().getSetting(Settings.STICKY_MODE)); } - super.detectAndSendChanges(); + super.standardDetectAndSendChanges(); + } + + @Override + protected int getHeight() { + return 170; } public void partition() { @@ -116,4 +123,29 @@ public StorageFilter getStorageFilter() { private void setStorageFilter(final StorageFilter storageFilter) { this.storageFilter = storageFilter; } + + @Override + protected void setupConfig() { + final IItemHandler upgrades = this.getUpgradeable().getInventoryByName("upgrades"); + this.addSlotToContainer((new SlotRestrictedInput(SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.getInventoryPlayer())) + .setNotDraggable()); + } + + @Override + public int availableUpgrades() { + return 1; + } + + @Override + protected boolean supportCapacity() { + return false; + } + + public YesNo getStickyMode() { + return this.stickyMode; + } + + private void setStickyMode(final YesNo stickyMode) { + this.stickyMode = stickyMode; + } } diff --git a/src/main/java/appeng/core/Registration.java b/src/main/java/appeng/core/Registration.java index 1aaa4fc9514..92473679a81 100644 --- a/src/main/java/appeng/core/Registration.java +++ b/src/main/java/appeng/core/Registration.java @@ -54,8 +54,8 @@ import appeng.core.stats.Stats; import appeng.core.worlddata.SpatialDimensionManager; import appeng.fluids.registries.BasicFluidCellGuiHandler; -import appeng.hooks.WrenchClickHook; import appeng.hooks.TickHandler; +import appeng.hooks.WrenchClickHook; import appeng.items.materials.ItemMaterial; import appeng.items.parts.ItemFacade; import appeng.items.parts.ItemPart; @@ -406,6 +406,9 @@ void postInit(final FMLPostInitializationEvent event) { Upgrades.CAPACITY.registerItem(parts.storageBus(), 5); Upgrades.STICKY.registerItem(parts.storageBus(), 1); + // OreDict Storage Bus + Upgrades.STICKY.registerItem(parts.oreDictStorageBus(), 1); + // Storage Bus Fluids Upgrades.INVERTER.registerItem(parts.fluidStorageBus(), 1); Upgrades.CAPACITY.registerItem(parts.fluidStorageBus(), 5); diff --git a/src/main/java/appeng/parts/misc/PartOreDicStorageBus.java b/src/main/java/appeng/parts/misc/PartOreDicStorageBus.java index 5a57d73494b..84daa1b8ee7 100644 --- a/src/main/java/appeng/parts/misc/PartOreDicStorageBus.java +++ b/src/main/java/appeng/parts/misc/PartOreDicStorageBus.java @@ -115,6 +115,7 @@ public MEInventoryHandler getInternalHandler() { this.handler.setPriority(this.priority); this.handler.setPartitionList(this.getPriorityList()); this.handler.setStorageFilter((StorageFilter) this.getConfigManager().getSetting(Settings.STORAGE_FILTER)); + this.handler.setSticky(this.getInstalledUpgrades(Upgrades.STICKY) > 0); if (inv instanceof IBaseMonitor) { if (((AccessRestriction) ((ConfigManager) this.getConfigManager()).getSetting(Settings.ACCESS)).hasPermission(AccessRestriction.READ)) { diff --git a/src/main/resources/assets/appliedenergistics2/textures/guis/oredictstoragebus.png b/src/main/resources/assets/appliedenergistics2/textures/guis/oredictstoragebus.png index de3b6cd9c30..fb7a48b7deb 100644 Binary files a/src/main/resources/assets/appliedenergistics2/textures/guis/oredictstoragebus.png and b/src/main/resources/assets/appliedenergistics2/textures/guis/oredictstoragebus.png differ