Skip to content

Commit 7589589

Browse files
bruberuYefancy
andauthored
Port Clipboard to GT (#44)
* Start on clipboard GUI * Complete everything up to the actual rendering * Don't forget the buttons * Remove TileEntity systems, since they're not really needed * Wait, this shouldn't be an MTE :thonk: * Fiddle around with blockstates * Add proper clipboard-placing behavior * Add a clipboard back * Begin movement to MTE, by Yefancy's request * Remove aged TE code * Complete step two of four * A husk of a renderMetaTileEntityDynamic * Fix model rendering * Pull in FakeModularGui and FakeModularUIContainer, and start on a few helper functions * Create a Death Ray * Complete check 3/4 * Fix references to removed class * Tweak clipboard's location * Remove more old code * Get GUI interactivity online! (4/4) :lets: * Add crafting recipe, and fix some minor issues * ...Why was that there? * Fix more various bugs * Fix more bugs * Fix more bugs * Fix non-in-world GUI, and add explainer text to tooltip * Fix certain formatting and extraneous import problems * Fix certain formatting and extraneous import problems * Reformat GregFakePlayer * Yeet ModelCache.java * Keep removing useless imports * Behaviour -> Behavior (as per Tech's request) * Implement @tech22's suggestions * Continue transition to behavior * Apply all of Kila's suggestions that could be simply implemented * Fix up ClipboardBehavior.java * Fix up MetaTileEntityClipboard.java * Continue removing unnecessary checks from PlayerInventoryHolder.java * Add Max's textures! * Squashed commit of the following: commit 713fd9e Author: ALongStringOfNumbers <31759736+ALongStringOfNumbers@users.noreply.github.com> Date: Fri Aug 20 23:33:54 2021 -0700 Fix for null materials being entered into the washedIn pair (#98) commit e0d55c8 Author: ALongStringOfNumbers <31759736+ALongStringOfNumbers@users.noreply.github.com> Date: Fri Aug 20 22:59:08 2021 -0700 Allow specifying the amount of fluid for chemical bath processing (#97) commit 98e3bef Author: froot <66188216+kumquat-ir@users.noreply.github.com> Date: Fri Aug 20 22:38:12 2021 -0700 Material Tree JEI page returns (#66) commit 0f6c8b7 Author: KilaBash <yefancy@foxmail.com> Date: Sat Aug 21 13:11:31 2021 +0800 GuideBook stuff (#46) commit 63adb22 Author: ALongStringOfNumbers <31759736+ALongStringOfNumbers@users.noreply.github.com> Date: Fri Aug 20 22:05:50 2021 -0700 Fix infinite Energy emitter decrement amperage not working (#94) commit f0c9a84 Author: DStrand1 <dane@strandboge.com> Date: Fri Aug 20 23:54:37 2021 -0500 fix oilsands recipe commit 0dc9f97 Author: ALongStringOfNumbers <31759736+ALongStringOfNumbers@users.noreply.github.com> Date: Fri Aug 20 21:44:06 2021 -0700 Fix Infinite Emitter breaking particles (#93) commit f8f1284 Author: DStrand1 <dane@strandboge.com> Date: Fri Aug 20 23:08:35 2021 -0500 remove multi fluid pipes for Wood commit 0672a79 Author: DStrand1 <dane@strandboge.com> Date: Fri Aug 20 22:21:01 2021 -0500 fix primitive multis workable fix diamond composition commit c50fdb2 Author: BraggestSage833 <46819052+BraggestSage833@users.noreply.github.com> Date: Fri Aug 20 23:18:33 2021 -0400 fix the default output side on quantum tanks/chest (#92) commit 5c46453 Author: PrototypeTrousers <salomaoo@gmail.com> Date: Fri Aug 20 23:24:16 2021 -0300 "Better Idling" for MTEs (#91) Co-authored-by: Exa <11907282+Exaxxion@users.noreply.github.com> commit 835b5b9 Author: DStrand1 <dane@strandboge.com> Date: Fri Aug 20 21:12:55 2021 -0500 make battery tooltips better commit 78e37f7 Author: Tech22 <swarren2022@gmail.com> Date: Fri Aug 20 03:53:31 2021 -0400 add tiered superconductors commit 4eb9133 Author: DStrand1 <dane@strandboge.com> Date: Fri Aug 20 02:13:06 2021 -0500 add new EV-UV batteries commit 1e6ff1e Author: DStrand1 <dane@strandboge.com> Date: Fri Aug 20 01:00:52 2021 -0500 remove line from build.gradle commit 312c188 Author: DStrand1 <dane@strandboge.com> Date: Thu Aug 19 19:39:11 2021 -0500 fix log warning about missing recipe property commit d76afa3 Author: Rongmario <rongmario@gmail.com> Date: Thu Aug 19 07:32:25 2021 +0100 Add config to turn on/off GT adding loot (#87) commit 4fa4e3f Author: brachy84 <45517902+brachy84@users.noreply.github.com> Date: Thu Aug 19 08:30:20 2021 +0200 Fix issue from #80 (#88) commit c7e9f84 Author: brachy84 <45517902+brachy84@users.noreply.github.com> Date: Thu Aug 19 08:27:07 2021 +0200 Pipefixes (#80) * i forgor release() commit aba97f0 Author: DStrand1 <dane@strandboge.com> Date: Wed Aug 18 23:23:30 2021 -0500 clean out dead prefixes (will cause ID shift) commit 0bbdc65 Author: DStrand1 <dane@strandboge.com> Date: Wed Aug 18 23:21:03 2021 -0500 clean up current batteries commit b59f0dc Author: DStrand1 <dane@strandboge.com> Date: Wed Aug 18 22:13:06 2021 -0500 finish Supercon value on WireProperty commit 5018bbe Author: DStrand1 <dane@strandboge.com> Date: Tue Aug 17 23:24:12 2021 -0500 add some missing iconset files from gregicality commit ce2d5fe Author: DStrand1 <dane@strandboge.com> Date: Tue Aug 17 22:39:13 2021 -0500 add `heat` getter to fusion reactor commit 3e599b5 Author: DStrand1 <dane@strandboge.com> Date: Tue Aug 17 20:50:58 2021 -0500 remove ExNi stuff (in Gregification) commit 0cb6427 Author: Dane Strandboge <dane@strandboge.com> Date: Tue Aug 17 01:21:31 2021 -0500 Primitive Multi Rewrite (#85) * new PBF working * implement primitive recipes * finish PBF * refactor Coke Oven * update changelog * fix tech memeing on me commit 61a52db Author: DStrand1 <dane@strandboge.com> Date: Mon Aug 16 21:47:28 2021 -0500 update changelog for #75 commit d51ae3e Author: bruberu <80226372+bruberu@users.noreply.github.com> Date: Mon Aug 16 21:46:42 2021 -0500 Add Highlighting to the Crafting Station (#75) commit 36ef039 Author: DStrand1 <dane@strandboge.com> Date: Mon Aug 16 21:03:29 2021 -0500 relocate `RecipeMapSteamMultiblockController` commit 13b7827 Author: DStrand1 <dane@strandboge.com> Date: Mon Aug 16 02:00:04 2021 -0500 clean up components, make constructor public commit 77ce62e Author: brachy84 <45517902+brachy84@users.noreply.github.com> Date: Mon Aug 16 08:58:55 2021 +0200 rework creative energy (#84) commit 48b1284 Author: DStrand1 <dane@strandboge.com> Date: Mon Aug 16 01:33:26 2021 -0500 add circuit markers to CraftingComponent commit 2100c86 Author: DStrand1 <dane@strandboge.com> Date: Mon Aug 16 00:55:09 2021 -0500 rework crafting component loading commit 612bc74 Author: Rongmario <rongmario@gmail.com> Date: Mon Aug 16 02:11:59 2021 +0100 De-enumify MaterialIconSet + MaterialIconType (#82) - Names are converted to the right format in the ctor commit 826556a Author: DStrand1 <dane@strandboge.com> Date: Sun Aug 15 17:11:57 2021 -0500 pull changes from upstream #1710 commit 0ef0b33 Author: DStrand1 <dane@strandboge.com> Date: Sun Aug 15 17:08:44 2021 -0500 add some MetaItem MaterialInfos commit 523627d Author: Rongmario <rongmario@gmail.com> Date: Sun Aug 15 16:33:16 2021 +0100 No longer hardcode biomes for primitive water pump (#81) - Now utilizes Forge's BiomeDictionary types - Ocean/River => `Type.WATER` (1000) - Swamp => `Type.SWAMP` and `Type.WET` (800) - Jungle => `Type.JUNGLE` (350) - Snow => `Type.SNOWY` (300) - Plains/Forest => `Type.PLAINS` and `Type.FOREST` (250) - Taiga => `Type.COLD` (175) - Beach => `Type.BEACH` (170) commit 85b3e98 Author: DStrand1 <dane@strandboge.com> Date: Sun Aug 15 01:34:08 2021 -0500 update changelog for EnergyNet updates commit 7a9b1db Author: brachy84 <45517902+brachy84@users.noreply.github.com> Date: Sun Aug 15 08:32:02 2021 +0200 Electric pipes rework (#78) commit 757264a Author: BraggestSage833 <46819052+BraggestSage833@users.noreply.github.com> Date: Sun Aug 15 02:17:23 2021 -0400 reinstate metaArmor classes (#79) commit 11ecde2 Author: DStrand1 <dane@strandboge.com> Date: Sun Aug 15 00:57:00 2021 -0500 remove energy field projector, cleanup commit 73f6bdc Author: DStrand1 <dane@strandboge.com> Date: Sat Aug 14 22:38:35 2021 -0500 update changelog for buffers commit dc81fa8 Author: DStrand1 <dane@strandboge.com> Date: Sat Aug 14 22:37:29 2021 -0500 port the Buffer to CEu commit fa1b388 Author: DStrand1 <dane@strandboge.com> Date: Sat Aug 14 19:59:18 2021 -0500 pull changes from upstream #1701 commit 2bede3b Author: DStrand1 <dane@strandboge.com> Date: Sat Aug 14 19:48:36 2021 -0500 merge changes from upstream #1709 commit db8a4a9 Author: Tech22 <swarren2022@gmail.com> Date: Sat Aug 14 20:45:52 2021 -0400 change isotope element symbols to a dash commit 6eff9e6 Author: DStrand1 <dane@strandboge.com> Date: Sat Aug 14 19:45:39 2021 -0500 fix Water missing fluid tooltip commit ecae98a Author: DStrand1 <dane@strandboge.com> Date: Sat Aug 14 19:14:34 2021 -0500 add `.chancedOutputs` builder call for List commit 5a40354 Author: DStrand1 <dane@strandboge.com> Date: Sat Aug 14 18:08:29 2021 -0500 add some missing material flags commit 59fb179 Author: DStrand1 <dane@strandboge.com> Date: Sat Aug 14 14:43:23 2021 -0500 buff Indium (small over tiny dust) commit 6f82857 Author: Tech22 <swarren2022@gmail.com> Date: Sat Aug 14 12:49:04 2021 -0400 change distillation EUt to reflect config commit 9e10cf2 Author: DStrand1 <dane@strandboge.com> Date: Sat Aug 14 02:27:23 2021 -0500 add more changes, fix some mistakes commit 82fb254 Author: Dane Strandboge <dane@strandboge.com> Date: Sat Aug 14 02:03:55 2021 -0500 fix some changelog mistakes commit 4289c65 Author: DStrand1 <dane@strandboge.com> Date: Sat Aug 14 02:01:26 2021 -0500 add GTCEu changelog (probably missed something) commit 90c4e2f Author: DStrand1 <dane@strandboge.com> Date: Sat Aug 14 00:55:44 2021 -0500 fix DT outputs sometimes on wrong layers commit 859bcb9 Author: brachy84 <45517902+brachy84@users.noreply.github.com> Date: Sat Aug 14 07:03:57 2021 +0200 Fluid pipes rework, MultiFluid Pipes (#53) commit ba74b2f Author: Rongmario <rongmario@gmail.com> Date: Fri Aug 13 21:56:25 2021 +0100 Made material tool enchantability not implicitly tied to icon sets (#76) * Made material tool enchantability not implicitly tied to icon sets - Nano Saber gets 33 enchantability, it inherited platinum's enchantability before but right now platinum doesn't have the tool property - Deprecated old static helper method to get a material enchantability (delete outright?) * Remove deprecated method commit 1b3c241 Author: Tech22 <swarren2022@gmail.com> Date: Fri Aug 13 02:58:17 2021 -0400 infinite water cover tweaks commit 9a7af7d Author: Tech22 <swarren2022@gmail.com> Date: Fri Aug 13 02:30:35 2021 -0400 add recipes to adjustables, simple washer commit d4b0dfa Author: DStrand1 <dane@strandboge.com> Date: Fri Aug 13 01:22:47 2021 -0500 add infinite water cover commit 664bd32 Author: Tech22 <swarren2022@gmail.com> Date: Fri Aug 13 00:44:57 2021 -0400 add simple washer commit 807092a Author: DStrand1 <dane@strandboge.com> Date: Thu Aug 12 23:42:24 2021 -0500 Revert "remove RecipeMap minimums" This reverts commit 201c564. commit 806dfd2 Author: DStrand1 <dane@strandboge.com> Date: Thu Aug 12 22:08:39 2021 -0500 small cleanup on OreProperty commit bf2e397 Author: DStrand1 <dane@strandboge.com> Date: Thu Aug 12 22:06:24 2021 -0500 require DustProperty for oreByProducts commit eb03b82 Author: DStrand1 <dane@strandboge.com> Date: Thu Aug 12 21:57:28 2021 -0500 port Native EU to FE commit d1bceee Author: DStrand1 <dane@strandboge.com> Date: Thu Aug 12 21:39:32 2021 -0500 port Diodes from Gregicality commit 3c4a9cf Author: DStrand1 <dane@strandboge.com> Date: Thu Aug 12 21:06:28 2021 -0500 Squashed commit of the following: commit 22cf316 Author: DStrand1 <dane@strandboge.com> Date: Thu Aug 12 21:05:58 2021 -0500 Revert "clean up duplicated code in energy hatch" This reverts commit 44b1b7f. commit 44b1b7f Author: DStrand1 <dane@strandboge.com> Date: Thu Aug 12 20:07:39 2021 -0500 clean up duplicated code in energy hatch commit 0163764 Author: Tech22 <swarren2022@gmail.com> Date: Thu Aug 12 15:51:32 2021 -0400 adjustable energy hatches commit 6acee86 Author: Tech22 <swarren2022@gmail.com> Date: Thu Aug 12 14:57:21 2021 -0400 adjustable transformers commit 45e27fa Author: Tech22 <swarren2022@gmail.com> Date: Thu Aug 12 03:28:29 2021 -0400 fix off-centered lignite gem texture commit 254ea67 Author: Tech22 <swarren2022@gmail.com> Date: Thu Aug 12 03:26:32 2021 -0400 better coke oven jei page commit 19ce515 Author: DStrand1 <dane@strandboge.com> Date: Thu Aug 12 02:05:19 2021 -0500 add method for addons to register MTEs easily commit f0c75f2 Author: DStrand1 <dane@strandboge.com> Date: Thu Aug 12 00:19:46 2021 -0500 merge material changes from multi PR commit 308d436 Author: DStrand1 <dane@strandboge.com> Date: Wed Aug 11 23:06:11 2021 -0500 more code cleanup commit 3789f4b Author: DStrand1 <dane@strandboge.com> Date: Wed Aug 11 22:40:41 2021 -0500 clean up configs a bit commit 052fd4e Author: DStrand1 <dane@strandboge.com> Date: Wed Aug 11 20:36:08 2021 -0500 add registration, CT method commit b6cad8c Author: DStrand1 <dane@strandboge.com> Date: Wed Aug 11 20:30:45 2021 -0500 port MetaOreDictItem commit c1e9780 Author: DStrand1 <dane@strandboge.com> Date: Wed Aug 11 19:58:54 2021 -0500 make addOrePrefix take varargs commit afe3e35 Author: DStrand1 <dane@strandboge.com> Date: Wed Aug 11 19:54:46 2021 -0500 make `addOrePrefix` public commit 09600d2 Author: DStrand1 <dane@strandboge.com> Date: Wed Aug 11 19:30:58 2021 -0500 make OrePrefix constructor public commit cde0631 Author: Tech22 <swarren2022@gmail.com> Date: Wed Aug 11 18:59:45 2021 -0400 fix extra facade material recipes being registered commit 292ff21 Author: Tech22 <swarren2022@gmail.com> Date: Wed Aug 11 18:47:10 2021 -0400 use dimension names for gas collector property commit 189f645 Author: Tech22 <swarren2022@gmail.com> Date: Wed Aug 11 10:41:27 2021 -0400 fix missing resource location commit 724b20e Author: Tech22 <swarren2022@gmail.com> Date: Wed Aug 11 10:36:10 2021 -0400 add missing components to H2S and FeCl3 commit 18c4373 Author: Tech22 <swarren2022@gmail.com> Date: Wed Aug 11 02:19:53 2021 -0400 prevent DT jei page overlaps commit 201c564 Author: DStrand1 <dane@strandboge.com> Date: Wed Aug 11 01:20:18 2021 -0500 remove RecipeMap minimums commit 9a307e1 Author: TechLord22 <37029404+TechLord22@users.noreply.github.com> Date: Wed Aug 11 01:30:34 2021 -0400 Add Cryogenic Air Recipes (#74) commit d1a5619 Author: DStrand1 <dane@strandboge.com> Date: Tue Aug 10 23:58:21 2021 -0500 clean up tool classes impl commit 41ff7ce Author: BraggestSage833 <46819052+BraggestSage833@users.noreply.github.com> Date: Wed Aug 11 00:51:19 2021 -0400 Update ToolWrench.java (#70) commit cdd9923 Author: DStrand1 <dane@strandboge.com> Date: Tue Aug 10 23:46:33 2021 -0500 clean up steam-era recipe duration and EUt commit e53885d Author: DStrand1 <dane@strandboge.com> Date: Tue Aug 10 23:19:16 2021 -0500 :monkey: dust blocks :monkey: commit 81f2eef Author: DStrand1 <dane@strandboge.com> Date: Tue Aug 10 23:13:29 2021 -0500 rename bricked steel hull commit 8f5ad1d Author: DStrand1 <dane@strandboge.com> Date: Tue Aug 10 22:58:53 2021 -0500 make steam great again commit 346ce2c Author: DStrand1 <dane@strandboge.com> Date: Tue Aug 10 21:05:59 2021 -0500 rework Steam Machine logic commit 8288ff0 Author: DStrand1 <dane@strandboge.com> Date: Tue Aug 10 20:22:02 2021 -0500 wipe recipe cache on multiblock deformation commit f1e6a95 Author: Tech22 <swarren2022@gmail.com> Date: Tue Aug 10 19:10:51 2021 -0400 make NaOH not power positive, change cumene to consume H3PO4 commit b37cdf2 Author: DStrand1 <dane@strandboge.com> Date: Mon Aug 9 22:49:04 2021 -0500 fix issues in UniversalDistillationBuilder commit 30cf93c Author: BraggestSage833 <46819052+BraggestSage833@users.noreply.github.com> Date: Mon Aug 9 20:28:52 2021 -0400 Quantum Tanks/Chests can now disallow input from their export face via screwdriver (#69) commit 95d1f58 Author: Tech22 <swarren2022@gmail.com> Date: Mon Aug 9 18:54:31 2021 -0400 fix crate guis commit a4634bd Author: Tech22 <swarren2022@gmail.com> Date: Mon Aug 9 17:56:17 2021 -0400 fix drum TOP display commit b1ac5e5 Author: Tech22 <swarren2022@gmail.com> Date: Mon Aug 9 02:23:41 2021 -0400 add toolstats to Flint commit a22aa35 Author: Tech22 <swarren2022@gmail.com> Date: Mon Aug 9 02:12:04 2021 -0400 fix missing filter and crate recipes commit 019ed53 Author: DStrand1 <dane@strandboge.com> Date: Mon Aug 9 01:04:54 2021 -0500 remove ULV from overclock button commit 98a6ca6 Author: TechLord22 <37029404+TechLord22@users.noreply.github.com> Date: Mon Aug 9 02:04:08 2021 -0400 Add Gas Collectors (#68) * add dimension-specific gas collectors commit 17d8f74 Author: Tech22 <swarren2022@gmail.com> Date: Mon Aug 9 01:53:14 2021 -0400 add polished stone autoclave recipes commit 90b8e04 Author: DStrand1 <dane@strandboge.com> Date: Mon Aug 9 00:25:49 2021 -0500 trim lossless wire configs commit 4f36d36 Author: DStrand1 <dane@strandboge.com> Date: Mon Aug 9 00:16:30 2021 -0500 clean up MetaTileEntities commit 161a216 Author: DStrand1 <dane@strandboge.com> Date: Sun Aug 8 23:12:45 2021 -0500 add UV-UXV circuit assembler lang keys commit a65bbaa Author: DStrand1 <dane@strandboge.com> Date: Sun Aug 8 22:05:16 2021 -0500 fix crash on furnace recipe removal commit 932be0f Author: DStrand1 <dane@strandboge.com> Date: Sun Aug 8 21:57:13 2021 -0500 add debug logging to recipe removals commit 7f557a9 Author: DStrand1 <dane@strandboge.com> Date: Sun Aug 8 21:09:03 2021 -0500 config to disable in-world concrete commit 2cd6159 Author: ALongStringOfNumbers <31759736+ALongStringOfNumbers@users.noreply.github.com> Date: Sun Aug 8 18:29:28 2021 -0700 A bunch of small cleanups (#67) * Slight cleanup of unused constructors Slight fix to Assembly Line JEI page Remove Legacy method of specifying surface rocks * Fix typo in Electric Furnace recipe map localization * compatibility * Fix remaining issues Co-authored-by: Yefancy <yefancy@foxmail.com>
1 parent 713fd9e commit 7589589

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1689
-35
lines changed

src/main/java/gregtech/api/block/machines/BlockMachine.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ public BlockMachine() {
8484
setHardness(6.0f);
8585
setResistance(6.0f);
8686
setTranslationKey("unnamed");
87-
setHarvestLevel("wrench", 1);
8887
setDefaultState(getDefaultState().withProperty(OPAQUE, true));
8988
}
9089

src/main/java/gregtech/api/cover/ICoverable.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,4 +198,8 @@ static Cuboid6 getCoverPlateBox(EnumFacing side, double plateThickness) {
198198
throw new UnsupportedOperationException();
199199
}
200200
}
201+
202+
public default boolean canRenderMachineGrid() {
203+
return true;
204+
}
201205
}

src/main/java/gregtech/api/gui/GuiTextures.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,15 @@ public class GuiTextures {
1515
public static final TextureArea BORDERED_BACKGROUND = AdoptableTextureArea.fullImage("textures/gui/base/bordered_background.png", 195, 136, 4, 4);
1616
public static final TextureArea BOXED_BACKGROUND = AdoptableTextureArea.fullImage("textures/gui/base/boxed_background.png", 256, 174, 11, 11);
1717

18+
public static final TextureArea BLANK = AdoptableTextureArea.fullImage("textures/gui/base/blank.png", 1, 1, 0, 0);
1819
public static final TextureArea DISPLAY = TextureArea.fullImage("textures/gui/base/display.png");
1920
public static final TextureArea FLUID_SLOT = AdoptableTextureArea.fullImage("textures/gui/base/fluid_slot.png", 18, 18, 1, 1);
2021
public static final TextureArea FLUID_TANK_BACKGROUND = TextureArea.fullImage("textures/gui/base/fluid_tank_background.png");
2122
public static final TextureArea FLUID_TANK_OVERLAY = TextureArea.fullImage("textures/gui/base/fluid_tank_overlay.png");
2223
public static final TextureArea SLOT = AdoptableTextureArea.fullImage("textures/gui/base/slot.png", 18, 18, 1, 1);
2324
public static final TextureArea SLOT_DARKENED = TextureArea.fullImage("textures/gui/base/darkened_slot.png");
2425

26+
2527
//FLUID & ITEM OUTPUT BUTTONS
2628
public static final TextureArea BLOCKS_INPUT = TextureArea.fullImage("textures/gui/widget/button_blocks_input.png");
2729
public static final TextureArea BUTTON = TextureArea.fullImage("textures/gui/widget/button.png");
@@ -32,8 +34,12 @@ public class GuiTextures {
3234
public static final TextureArea BUTTON_FILTER_NBT = TextureArea.fullImage("textures/gui/widget/button_filter_nbt.png");
3335
public static final TextureArea BUTTON_FLUID_OUTPUT = TextureArea.fullImage("textures/gui/widget/button_fluid_output.png");
3436
public static final TextureArea BUTTON_ITEM_OUTPUT = TextureArea.fullImage("textures/gui/widget/button_item_output.png");
37+
public static final TextureArea BUTTON_LEFT = TextureArea.fullImage("textures/gui/widget/left.png");
3538
public static final TextureArea BUTTON_OVERCLOCK = TextureArea.fullImage("textures/gui/widget/button_overclock.png");
39+
public static final TextureArea BUTTON_RIGHT = TextureArea.fullImage("textures/gui/widget/right.png");
3640
public static final TextureArea BUTTON_SWITCH_VIEW = TextureArea.fullImage("textures/gui/widget/button_switch_view.png");
41+
public static final TextureArea CLIPBOARD_BUTTON = TextureArea.fullImage("textures/gui/widget/clipboard_button.png");
42+
public static final SizedTextureArea CLIPBOARD_TEXT_BOX = AdoptableTextureArea.fullImage("textures/gui/widget/clipboard_text_box.png", 9, 18, 1, 1);
3743
public static final TextureArea DISTRIBUTION_MODE = TextureArea.fullImage("textures/gui/widget/button_distribution_mode.png");
3844
public static final TextureArea LOCK = TextureArea.fullImage("textures/gui/widget/lock.png");
3945
public static final TextureArea SWITCH = TextureArea.fullImage("textures/gui/widget/switch.png");

src/main/java/gregtech/api/gui/Widget.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -275,23 +275,23 @@ protected void writeClientAction(int id, Consumer<PacketBuffer> packetBufferWrit
275275
}
276276

277277
@SideOnly(Side.CLIENT)
278-
protected void drawBorder(int x, int y, int width, int height, int stroke, int stroke_width) {
278+
public void drawBorder(int x, int y, int width, int height, int stroke, int stroke_width) {
279279
drawGradientRect(x - stroke_width, y - stroke_width, width + 2 * stroke_width, stroke_width, stroke, stroke);
280280
drawGradientRect(x - stroke_width, y + height, width + 2 * stroke_width, stroke_width, stroke, stroke);
281281
drawGradientRect(x - stroke_width, y - stroke_width, stroke_width, height + 2 * stroke_width, stroke, stroke);
282282
drawGradientRect(x + width, y - stroke_width, stroke_width, height + 2 * stroke_width, stroke, stroke);
283283
}
284284

285285
@SideOnly(Side.CLIENT)
286-
protected void drawHoveringText(ItemStack itemStack, List<String> tooltip, int maxTextWidth, int mouseX, int mouseY) {
286+
public void drawHoveringText(ItemStack itemStack, List<String> tooltip, int maxTextWidth, int mouseX, int mouseY) {
287287
Minecraft mc = Minecraft.getMinecraft();
288288
GuiUtils.drawHoveringText(itemStack, tooltip, mouseX, mouseY,
289289
sizes.getScreenWidth(),
290290
sizes.getScreenHeight(), maxTextWidth, mc.fontRenderer);
291291
}
292292

293293
@SideOnly(Side.CLIENT)
294-
protected void drawStringSized(String text, double x, double y, int color, boolean dropShadow, float scale, boolean center) {
294+
public void drawStringSized(String text, double x, double y, int color, boolean dropShadow, float scale, boolean center) {
295295
GlStateManager.pushMatrix();
296296
FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
297297
double scaledTextWidth = center ? fontRenderer.getStringWidth(text) * scale : 0.0;
@@ -302,15 +302,15 @@ protected void drawStringSized(String text, double x, double y, int color, boole
302302
}
303303

304304
@SideOnly(Side.CLIENT)
305-
protected void drawStringFixedCorner(String text, double x, double y, int color, boolean dropShadow, float scale) {
305+
public void drawStringFixedCorner(String text, double x, double y, int color, boolean dropShadow, float scale) {
306306
FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
307307
double scaledWidth = fontRenderer.getStringWidth(text) * scale;
308308
double scaledHeight = fontRenderer.FONT_HEIGHT * scale;
309309
drawStringSized(text, x - scaledWidth, y - scaledHeight, color, dropShadow, scale, false);
310310
}
311311

312312
@SideOnly(Side.CLIENT)
313-
protected static void drawItemStack(ItemStack itemStack, int x, int y, @Nullable String altTxt) {
313+
public static void drawItemStack(ItemStack itemStack, int x, int y, @Nullable String altTxt) {
314314
GlStateManager.pushMatrix();
315315
GlStateManager.translate(0.0F, 0.0F, 32.0F);
316316
GlStateManager.color(1F, 1F, 1F, 1F);
@@ -331,7 +331,7 @@ protected static void drawItemStack(ItemStack itemStack, int x, int y, @Nullable
331331
}
332332

333333
@SideOnly(Side.CLIENT)
334-
protected static List<String> getItemToolTip(ItemStack itemStack) {
334+
public static List<String> getItemToolTip(ItemStack itemStack) {
335335
Minecraft mc = Minecraft.getMinecraft();
336336
ITooltipFlag flag = mc.gameSettings.advancedItemTooltips ? ITooltipFlag.TooltipFlags.ADVANCED : ITooltipFlag.TooltipFlags.NORMAL;
337337
List<String> tooltip = itemStack.getTooltip(mc.player, flag);
@@ -346,7 +346,7 @@ protected static List<String> getItemToolTip(ItemStack itemStack) {
346346
}
347347

348348
@SideOnly(Side.CLIENT)
349-
protected static void drawSelectionOverlay(int x, int y, int width, int height) {
349+
public static void drawSelectionOverlay(int x, int y, int width, int height) {
350350
GlStateManager.disableDepth();
351351
GlStateManager.colorMask(true, true, true, false);
352352
drawGradientRect(x, y, width, height, -2130706433, -2130706433);
@@ -356,14 +356,14 @@ protected static void drawSelectionOverlay(int x, int y, int width, int height)
356356
}
357357

358358
@SideOnly(Side.CLIENT)
359-
protected static void drawSolidRect(int x, int y, int width, int height, int color) {
359+
public static void drawSolidRect(int x, int y, int width, int height, int color) {
360360
Gui.drawRect(x, y, x + width, y + height, color);
361361
GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
362362
GlStateManager.enableBlend();
363363
}
364364

365365
@SideOnly(Side.CLIENT)
366-
protected static void drawGradientRect(int x, int y, int width, int height, int startColor, int endColor) {
366+
public static void drawGradientRect(int x, int y, int width, int height, int startColor, int endColor) {
367367
drawGradientRect(x, y, width, height, startColor, endColor, false);
368368
}
369369

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
package gregtech.api.gui.impl;
2+
3+
import gregtech.api.gui.IRenderContext;
4+
import gregtech.api.gui.ModularUI;
5+
import gregtech.api.gui.Widget;
6+
import gregtech.api.util.RenderUtil;
7+
import gregtech.common.gui.impl.FakeModularUIContainerClipboard;
8+
import net.minecraft.client.Minecraft;
9+
import net.minecraft.client.gui.FontRenderer;
10+
import net.minecraft.client.renderer.GlStateManager;
11+
import net.minecraft.client.util.ITooltipFlag;
12+
import net.minecraft.inventory.Slot;
13+
import net.minecraft.item.ItemStack;
14+
import net.minecraft.network.PacketBuffer;
15+
import net.minecraft.util.text.TextFormatting;
16+
import net.minecraftforge.fml.client.config.GuiUtils;
17+
import net.minecraftforge.fml.relauncher.Side;
18+
import net.minecraftforge.fml.relauncher.SideOnly;
19+
20+
import java.util.List;
21+
import java.util.Optional;
22+
23+
import static gregtech.api.gui.impl.ModularUIGui.*;
24+
25+
@SideOnly(Side.CLIENT)
26+
public class FakeModularGui implements IRenderContext {
27+
public final ModularUI modularUI;
28+
public FakeModularUIContainerClipboard container;
29+
protected Minecraft mc;
30+
protected FontRenderer fr;
31+
32+
public FakeModularGui(ModularUI modularUI, FakeModularUIContainerClipboard fakeModularUIContainer){
33+
this.modularUI = modularUI;
34+
this.container = fakeModularUIContainer;
35+
this.modularUI.updateScreenSize(this.modularUI.getWidth(), this.modularUI.getHeight());
36+
this.mc = Minecraft.getMinecraft();
37+
this.fr = mc.fontRenderer;
38+
}
39+
40+
public void updateScreen() {
41+
modularUI.guiWidgets.values().forEach(Widget::updateScreen);
42+
}
43+
44+
public void handleWidgetUpdate(int windowId, int widgetId, PacketBuffer updateData) {
45+
if (windowId == container.windowId) {
46+
Widget widget = modularUI.guiWidgets.get(Optional.of(widgetId));
47+
int updateId = updateData.readVarInt();
48+
if (widget != null) {
49+
widget.readUpdateInfo(updateId, updateData);
50+
}
51+
}
52+
}
53+
54+
public void drawScreen(double x, double y, float partialTicks) {
55+
float halfW = modularUI.getWidth() / 2f;
56+
float halfH = modularUI.getHeight() / 2f;
57+
float scale = 0.5f / Math.max(halfW, halfH);
58+
int mouseX = (int) ((x / scale) + (halfW > halfH? 0: (halfW - halfH)));
59+
int mouseY = (int) ((y / scale) + (halfH > halfW? 0: (halfH - halfW)));
60+
61+
GlStateManager.translate(-scale * halfW, -scale * halfH, 0.01);
62+
GlStateManager.scale(scale, scale, 1);
63+
GlStateManager.depthMask(false);
64+
65+
drawGuiContainerBackgroundLayer(partialTicks, mouseX, mouseY);
66+
67+
GlStateManager.scale(1, 1, 0);
68+
drawGuiContainerForegroundLayer(mouseX, mouseY);
69+
70+
for (int i = 0; i < this.container.inventorySlots.size(); ++i) {
71+
Slot slot = this.container.inventorySlots.get(i);
72+
if (!slot.getStack().isEmpty() && slot.xPos < mouseX && mouseX < slot.xPos + 18 && slot.yPos < mouseY && mouseY < slot.yPos + 18) {
73+
Widget.drawSolidRect(slot.xPos, slot.yPos, 18, 18, 0X8fffffff);
74+
renderToolTip(slot.getStack(), slot.xPos, slot.yPos);
75+
}
76+
}
77+
78+
GlStateManager.depthMask(true);
79+
GlStateManager.color(1.0f, 1.0f, 1.0f);
80+
GlStateManager.disableLighting();
81+
}
82+
83+
protected void renderToolTip(ItemStack stack, int x, int y) {
84+
FontRenderer font = stack.getItem().getFontRenderer(stack);
85+
GuiUtils.preItemToolTip(stack);
86+
GuiUtils.drawHoveringText(this.getItemToolTip(stack), x, y, modularUI.getScreenWidth(), modularUI.getScreenHeight(), -1, (font == null ? fr : font));
87+
net.minecraftforge.fml.client.config.GuiUtils.postItemToolTip();
88+
}
89+
90+
protected List<String> getItemToolTip(ItemStack itemStack) {
91+
List<String> list = itemStack.getTooltip(mc.player, mc.gameSettings.advancedItemTooltips ? ITooltipFlag.TooltipFlags.ADVANCED : ITooltipFlag.TooltipFlags.NORMAL);
92+
list.set(0, itemStack.getItem().getForgeRarity(itemStack).getColor() + list.get(0));
93+
for (int i = 1; i < list.size(); ++i) {
94+
list.set(i, TextFormatting.GRAY + list.get(i));
95+
}
96+
return list;
97+
}
98+
99+
public void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
100+
GlStateManager.color(rColorForOverlay, gColorForOverlay, bColorForOverlay, 1.0F);
101+
modularUI.backgroundPath.draw(0, 0, modularUI.getWidth(), modularUI.getHeight());
102+
for (Widget widget : modularUI.guiWidgets.values()) {
103+
GlStateManager.pushMatrix();
104+
GlStateManager.color(1.0f, 1.0f, 1.0f);
105+
GlStateManager.enableBlend();
106+
widget.drawInBackground(mouseX, mouseY, this);
107+
GlStateManager.popMatrix();
108+
}
109+
}
110+
111+
public void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
112+
for (Widget widget : modularUI.guiWidgets.values()) {
113+
GlStateManager.pushMatrix();
114+
GlStateManager.color(1.0f, 1.0f, 1.0f);
115+
widget.drawInForeground(mouseX, mouseY);
116+
GlStateManager.popMatrix();
117+
}
118+
}
119+
120+
public boolean mouseClicked(int mouseX, int mouseY, int mouseButton) {
121+
return modularUI.guiWidgets.values().stream().anyMatch(widget -> widget.mouseClicked(mouseX, mouseY, mouseButton));
122+
}
123+
}
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
package gregtech.api.gui.widgets;
2+
3+
import gregtech.api.gui.GuiTextures;
4+
import gregtech.api.gui.IRenderContext;
5+
import gregtech.api.gui.Widget;
6+
import gregtech.api.gui.resources.SizedTextureArea;
7+
import gregtech.api.gui.resources.TextureArea;
8+
import gregtech.api.util.GTUtility;
9+
import gregtech.api.util.Position;
10+
import gregtech.api.util.Size;
11+
import gregtech.api.util.function.BooleanConsumer;
12+
import net.minecraft.client.Minecraft;
13+
import net.minecraft.client.gui.FontRenderer;
14+
import net.minecraft.client.renderer.GlStateManager;
15+
import net.minecraft.client.resources.I18n;
16+
import net.minecraft.item.ItemStack;
17+
import net.minecraft.network.PacketBuffer;
18+
import net.minecraft.util.IStringSerializable;
19+
import net.minecraft.util.math.MathHelper;
20+
import net.minecraftforge.fml.relauncher.Side;
21+
import net.minecraftforge.fml.relauncher.SideOnly;
22+
23+
import java.util.Arrays;
24+
import java.util.List;
25+
import java.util.function.*;
26+
27+
public class ImageCycleButtonWidget extends Widget {
28+
29+
protected TextureArea buttonTexture;
30+
private int textColor = 0xFFFFFF;
31+
private IntSupplier currentOptionSupplier;
32+
private IntConsumer setOptionExecutor;
33+
private int optionCount;
34+
private final int RIGHT_MOUSE = 1;
35+
protected int currentOption;
36+
protected String tooltipHoverString;
37+
protected long hoverStartTime = -1L;
38+
protected boolean isMouseHovered;
39+
40+
public ImageCycleButtonWidget(int xPosition, int yPosition, int width, int height, TextureArea buttonTexture, int optionCount, IntSupplier currentOptionSupplier, IntConsumer setOptionExecutor) {
41+
super(new Position(xPosition, yPosition), new Size(width, height));
42+
this.buttonTexture = buttonTexture;
43+
this.currentOptionSupplier = currentOptionSupplier;
44+
this.setOptionExecutor = setOptionExecutor;
45+
this.optionCount = optionCount;
46+
}
47+
48+
49+
public ImageCycleButtonWidget(int xPosition, int yPosition, int width, int height, TextureArea buttonTexture, int optionCount, BooleanSupplier supplier, BooleanConsumer updater) {
50+
super(new Position(xPosition, yPosition), new Size(width, height));
51+
this.buttonTexture = buttonTexture;
52+
this.currentOptionSupplier = () -> supplier.getAsBoolean() ? 1 : 0;
53+
this.setOptionExecutor = (value) -> updater.apply(value >= 1);
54+
this.optionCount = optionCount;
55+
}
56+
57+
public ImageCycleButtonWidget setTooltipHoverString(String hoverString) {
58+
this.tooltipHoverString = hoverString;
59+
return this;
60+
}
61+
62+
public ImageCycleButtonWidget setButtonTexture(TextureArea texture) {
63+
this.buttonTexture = texture;
64+
return this;
65+
}
66+
67+
public ImageCycleButtonWidget setTextColor(int textColor) {
68+
this.textColor = textColor;
69+
return this;
70+
}
71+
72+
@Override
73+
@SideOnly(Side.CLIENT)
74+
public void drawInBackground(int mouseX, int mouseY, IRenderContext context) {
75+
Position pos = getPosition();
76+
Size size = getSize();
77+
if (buttonTexture instanceof SizedTextureArea) {
78+
((SizedTextureArea) buttonTexture).drawHorizontalCutSubArea(pos.x, pos.y, size.width, size.height, (float)currentOption / optionCount, (float)1 / optionCount);
79+
} else {
80+
buttonTexture.drawSubArea(pos.x, pos.y, size.width, size.height, 0.0, (float)currentOption / optionCount, 1.0, (float)1 / optionCount);
81+
}
82+
}
83+
84+
@Override
85+
public void drawInForeground(int mouseX, int mouseY) {
86+
boolean isHovered = isMouseOverElement(mouseX, mouseY);
87+
boolean wasHovered = isMouseHovered;
88+
if (isHovered && !wasHovered) {
89+
this.isMouseHovered = true;
90+
this.hoverStartTime = System.currentTimeMillis();
91+
} else if (!isHovered && wasHovered) {
92+
this.isMouseHovered = false;
93+
this.hoverStartTime = 0L;
94+
} else if (isHovered) {
95+
long timeSinceHover = System.currentTimeMillis() - hoverStartTime;
96+
if (timeSinceHover > 1000L && tooltipHoverString != null) {
97+
List<String> hoverList = Arrays.asList(I18n.format(tooltipHoverString).split("/n"));
98+
drawHoveringText(ItemStack.EMPTY, hoverList, 300, mouseX, mouseY);
99+
}
100+
}
101+
}
102+
103+
@Override
104+
public void detectAndSendChanges() {
105+
super.detectAndSendChanges();
106+
if (currentOptionSupplier.getAsInt() != currentOption) {
107+
this.currentOption = currentOptionSupplier.getAsInt();
108+
writeUpdateInfo(1, buf -> buf.writeVarInt(currentOption));
109+
}
110+
}
111+
112+
@Override
113+
public void readUpdateInfo(int id, PacketBuffer buffer) {
114+
super.readUpdateInfo(id, buffer);
115+
if (id == 1) {
116+
this.currentOption = buffer.readVarInt();
117+
}
118+
}
119+
120+
@Override
121+
@SideOnly(Side.CLIENT)
122+
public boolean mouseClicked(int mouseX, int mouseY, int button) {
123+
super.mouseClicked(mouseX, mouseY, button);
124+
if (isMouseOverElement(mouseX, mouseY)) {
125+
//Allow only the RMB to reverse cycle
126+
if(button == RIGHT_MOUSE) {
127+
//Wrap from the first option to the last if needed
128+
this.currentOption = currentOption == 0 ? optionCount - 1 : currentOption - 1;
129+
} else {
130+
this.currentOption = (currentOption + 1) % optionCount;
131+
}
132+
writeClientAction(1, buf -> buf.writeVarInt(currentOption));
133+
playButtonClickSound();
134+
return true;
135+
}
136+
return false;
137+
}
138+
139+
140+
@Override
141+
public void handleClientAction(int id, PacketBuffer buffer) {
142+
super.handleClientAction(id, buffer);
143+
if (id == 1) {
144+
this.currentOption = MathHelper.clamp(buffer.readVarInt(), 0, optionCount);
145+
setOptionExecutor.accept(currentOption);
146+
}
147+
}
148+
149+
}

0 commit comments

Comments
 (0)