diff options
| author | miozune <miozune@gmail.com> | 2022-11-26 01:56:28 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-25 17:56:28 +0100 |
| commit | cd2ba914a6b5b980ff56347455fcf43a9e3eea3b (patch) | |
| tree | 9dfba22762592ee292edd9a6c2eb6e4c3d9c6e96 /src/main/java/gtPlusPlus/xmod/gregtech/api/gui/widget | |
| parent | 921527ce3cc5f92b067f180295fa55dae718461f (diff) | |
| download | GT5-Unofficial-cd2ba914a6b5b980ff56347455fcf43a9e3eea3b.tar.gz GT5-Unofficial-cd2ba914a6b5b980ff56347455fcf43a9e3eea3b.tar.bz2 GT5-Unofficial-cd2ba914a6b5b980ff56347455fcf43a9e3eea3b.zip | |
Rewrite GUIs with ModularUI (#440)
* Update GT
* NEI migration & cleanup
Deprecate GTPP_Recipe_Map_Internal#sMappingsEx and delegate to GT_Recipe_Map#sMappings instead
Remove recipe modification check
* Boiler
* Programmed Circuit & Super Bus
* Lower the number of fluid slots for multi mixer NEI
* Solar Generator
* Crop Manager
* Bronze Workbench & Advanced Workbench
* Turbine Housing & Rotor Assembly
* Iron Plated Blast Furnace
* Player Safe
* Advanced Muffler Hatch
* spotlessApply
* Auto Workbench
* Breaker, Control Core, RTG Hatch, Steam Bus, some cleanup
* Fix crash when removing Breaker
* Data Orb Repository
* Charging/Discharging Bus
* Pollution Scrubber
* Storage Crate, Shelf, TieredChest
They're just broken in the first place, don't blame me
* cleanup
* Steam Condenser
It's broken in the first place, never blame me!
* Catalyst Housing, Ball Housing
* Fluid Tank, generators, custom hatches, cleanup
* Computer Cube MKII
Many things are broken in the first place, I swear
* Inventory Manager
* Migrate multiblock dehydrator recipemap to ModularUI
* Overflow cover
* Redstone Circuit Block
* Multiblock
* cleanup
* Update GT
Diffstat (limited to 'src/main/java/gtPlusPlus/xmod/gregtech/api/gui/widget')
| -rw-r--r-- | src/main/java/gtPlusPlus/xmod/gregtech/api/gui/widget/DataStickSlotWidget.java | 28 | ||||
| -rw-r--r-- | src/main/java/gtPlusPlus/xmod/gregtech/api/gui/widget/ElectricSlotWidget.java | 37 |
2 files changed, 65 insertions, 0 deletions
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/widget/DataStickSlotWidget.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/widget/DataStickSlotWidget.java new file mode 100644 index 0000000000..dbda217c27 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/widget/DataStickSlotWidget.java @@ -0,0 +1,28 @@ +package gtPlusPlus.xmod.gregtech.api.gui.widget; + +import com.gtnewhorizons.modularui.api.ModularUITextures; +import com.gtnewhorizons.modularui.api.forge.IItemHandlerModifiable; +import com.gtnewhorizons.modularui.common.internal.wrapper.BaseSlot; +import com.gtnewhorizons.modularui.common.widget.SlotWidget; +import gregtech.api.enums.ItemList; +import gregtech.api.gui.modularui.GT_UITextures; +import gregtech.api.util.GT_Utility; + +public class DataStickSlotWidget extends SlotWidget { + + public DataStickSlotWidget(IItemHandlerModifiable handler, int index) { + this(new BaseSlot(handler, index) { + @Override + public int getSlotStackLimit() { + return 1; + } + }); + } + + private DataStickSlotWidget(BaseSlot slot) { + super(slot); + setFilter(stack -> GT_Utility.areStacksEqual(stack, ItemList.Tool_DataStick.get(1), true) + || GT_Utility.areStacksEqual(stack, ItemList.Tool_DataOrb.get(1), true)); + setBackground(ModularUITextures.ITEM_SLOT, GT_UITextures.OVERLAY_SLOT_DATA_ORB); + } +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/widget/ElectricSlotWidget.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/widget/ElectricSlotWidget.java new file mode 100644 index 0000000000..b575c3c4bd --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/widget/ElectricSlotWidget.java @@ -0,0 +1,37 @@ +package gtPlusPlus.xmod.gregtech.api.gui.widget; + +import com.gtnewhorizons.modularui.api.forge.IItemHandlerModifiable; +import com.gtnewhorizons.modularui.common.internal.wrapper.BaseSlot; +import com.gtnewhorizons.modularui.common.widget.SlotWidget; +import gregtech.api.items.GT_MetaGenerated_Tool; +import ic2.api.info.Info; +import ic2.api.item.ElectricItem; +import ic2.api.item.IElectricItem; +import net.minecraft.item.ItemStack; + +public class ElectricSlotWidget extends SlotWidget { + + public ElectricSlotWidget(IItemHandlerModifiable handler, int index) { + this(new BaseSlot(handler, index, false) { + @Override + public int getSlotStackLimit() { + return 1; + } + }); + } + + private ElectricSlotWidget(BaseSlot slot) { + super(slot); + setFilter(stack -> (accepts(stack)) + || (stack.getItem() instanceof GT_MetaGenerated_Tool) + || (stack.getItem() instanceof IElectricItem)); + } + + private boolean accepts(final ItemStack stack) { + if (stack == null) { + return false; + } + return (Info.itemEnergy.getEnergyValue(stack) > 0.0D) + || (ElectricItem.manager.discharge(stack, (1.0D / 0.0D), 4, true, true, true) > 0.0D); + } +} |
