Compare commits

...
202 Commits
Author SHA1 Message Date
749ea96c62 Make target Travel Anchor selection snap angle configurable and don't override empty selection server-side (#230)
Co-authored-by: Wilhelm Schuster <[email protected]>
Co-authored-by: Martin Robertz <[email protected]>
2026-11-11 22:52:22 +01:00
DiscreaterandChitak 985 f4dfa9e6cf Fix the inventory name display issue (#283)
Co-authored-by: Chitak 985 <[email protected]>
2026-11-11 18:54:08 +01:00
UltraProdigy 30958c201a ci: run build and test on release branches 2026-11-09 01:03:11 -05:00
Eldrinn ElanteyandNikolay S. 8ead31ff76 Translate chat messages on the client instead of the server (#275)
Co-authored-by: Nikolay S. <[email protected]>
2026-11-01 19:28:01 +00:00
Eldrinn Elantey 7bebb05573 Respect recipe slot numbers when validating machine inputs (#260) 2026-10-31 22:29:14 +01:00
MissBismuthandMartin Robertz 87e5a32b89 Fix painted blocks missing paint when placed with wand (#280)
Co-authored-by: Martin Robertz <[email protected]>
2026-10-27 20:48:42 +01:00
Ressed c232ea8534 Fix the iteration of getting slot from inventory for existing item filter. (#269) 2026-10-25 19:25:58 +01:00
Fib4ikandM R S E d27f30951a Add redstone signal support for item conduit. (#265)
Co-authored-by: M R S E <[email protected]>
2026-10-06 19:19:44 +02:00
Mykhailo Balaker 8dcda4e822 Prevent fall-through when clicking on the "Show Range" button in Vacuum Chest GUI (#274) 2026-09-27 18:08:03 +00:00
fehling135 e337597a3c Make specialmobs really availale for soul binder (#270) 2026-09-25 17:46:29 +02:00
Nikolay S. a8197e0026 Remove broken NBT-matching logic (#268) 2026-09-20 13:33:30 +02:00
danyadev 9549d9385c optimize recipe checking on mc loading (#263) 2026-09-07 16:18:00 +02:00
Martin Robertz d44c6bb7c7 update deps 2026-09-05 10:11:02 +02:00
Eldrinn ElanteyandCaedis a4a40ee726 Fix night vision deactivating after dimension change via portal (#262)
Co-authored-by: Caedis <[email protected]>
2026-09-04 18:41:45 -05:00
Caedis caec163702 Revert #231 (#261) 2026-09-04 14:09:25 +00:00
Glease 673f832c2d fix PacketTeleport sanitizer false positive (#253) 2026-09-03 07:00:46 +02:00
Eldrinn Elantey ce11a2dcf2 Fix night vision deactivating after dimension change via portal (#231) 2026-09-02 15:09:32 +00:00
vcwdfca 68e209203c Fix Player inventory cannot be shown when the EnderIO fluid conduit tier is lower than Ender (#255) 2026-09-02 15:03:02 +00:00
0715f8b536 remove direct getStackInSlot exploit (#245)
Co-authored-by: Martin Robertz <[email protected]>
Co-authored-by: attempt0 <[email protected]>
2026-09-02 09:38:29 +00:00
boubou19 d356dddedb Temporary revert #256 and #257 (#258) 2026-08-31 15:40:19 +02:00
June 604b47a394 Update en_US.lang (#257) 2026-08-29 23:34:49 -04:00
June 42dc1f43aa Update TileReservoir.java (#256)
it did not make sense previously. was worse than one vanilla water source
2026-08-29 20:47:05 -02:30
Elyspio cbeec42e47 Fix client NPE when placing wireless powered lights on dedicated servers (#252) 2026-08-21 18:16:23 +02:00
boubou19andgithub-actions[bot] 046ad7441d Cache more enum .values() (#249)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-08-11 02:53:48 +02:00
boubou19andMartin Robertz 8750005be5 Cache enum .values() (#248)
Co-authored-by: Martin Robertz <[email protected]>
2026-08-10 21:03:55 +02:00
Caedis b46cfbb351 fix: billboard toward renderViewEntity (#247) 2026-08-10 11:46:58 -04:00
Dream Master 070ef99694 update+gradle+deps+bs 2026-08-04 11:41:57 +07:00
fec675ef48 Fix many render issues (#232)
Co-authored-by: Alexdoru <[email protected]>
Co-authored-by: Martin Robertz <[email protected]>
2026-08-03 19:31:40 +02:00
Wilhelm Schuster 503b90a5d0 Fix crash when removing inventory from Inventory Panel network (#243) 2026-07-23 23:33:16 -04:00
Ranzu 84052a1c42 Extend ColorUtil class colors (#242) 2026-07-20 01:24:58 -04:00
Jordan Rey 554a08a515 fix: infinite speed and altitude using glider with elytra (#240) 2026-07-14 21:31:04 -07:00
Martin Robertz 55928c5234 update deps 2026-07-04 19:29:09 +02:00
RanzuandMartin Robertz 65c5d3aec5 Fix "Range" string position and implement ColorUtils (#238)
Co-authored-by: Martin Robertz <[email protected]>
2026-07-04 19:25:23 +02:00
__felix__ 7737598e4f Update required version of gtnhlib in @Mod (#239) 2026-07-04 18:39:58 +02:00
Dream Master eb9845d3a0 update+bs+gradle+deps 2026-06-12 16:36:04 +02:00
7a61bb9dee Add automation to EIO Enchanter (basically a copy-paste from my other two PR's) (#227)
Co-authored-by: koolkrafter5 <[email protected]>
Co-authored-by: Martin Robertz <[email protected]>
2026-06-12 15:45:50 +02:00
DanandMartin Robertz ed24e1e1f0 divided rocket entity from overworld to dimensions specific (#222)
Co-authored-by: Martin Robertz <[email protected]>
2026-06-07 16:09:19 +02:00
FourIsTheNumber 76e50f8a32 Remove space suit from end steel armor (#237) 2026-06-03 11:46:26 +02:00
Ranzu 5b8810633b Localization of gui title elemets (#236) 2026-06-02 11:16:35 -04:00
Alexdoru 48e30828cf Fix 4 world client leaks (#235) 2026-05-04 14:07:16 +02:00
Alexdoru 924b4dbbf2 Intellij quick fixes (#234) 2026-05-04 13:25:46 +02:00
Alexdoru b5a2693d7c Fix world client leak in TechneMachineRenderer (#233) 2026-05-03 20:38:04 +02:00
ImaMapleTreeandMartin Robertz 372c317077 Fix sort order bounds check on Inventory Panel UI (#228)
Co-authored-by: Martin Robertz <[email protected]>
2026-04-25 19:06:45 +00:00
44ee860a39 Fix Dark Steel Shears duplicating drops from shearable blocks (#224)
Co-authored-by: clawdbot-silly-waddle <[email protected]>
Co-authored-by: Copilot <[email protected]>
2026-04-24 16:44:57 +00:00
Luca Bancale 181d48ac60 Render travel anchor when holding staff in offhand (#226) 2026-04-08 13:28:59 +02:00
UltraProdigy 267adc0a31 Optimize Images & Workflow (#225) 2026-03-16 10:47:08 +01:00
Alexdoru 503a6e7a76 Cache frequent Enum#values() calls (#223) 2026-03-03 19:46:41 +00:00
danyadev ff0e85142d less FluidStack copying in conduits & less HashMap lookups in reservoirs (#221) 2026-02-18 15:33:45 -05:00
Martin Robertz 94bd521739 Update Angelica dependency version in dependencies.gradle 2026-02-07 19:10:46 +01:00
e66c50bc24 Improve tooltip capacitor and farming station efficiency (#215)
Co-authored-by: Martin Robertz <[email protected]>
Co-authored-by: Ruling-0 <[email protected]>
2026-02-07 19:07:42 +01:00
Martin Robertz d9df657f35 Update dependencies.gradle (#220) 2026-02-07 19:07:23 +01:00
Martin Robertz 08553f8af2 fix 2026-02-07 19:02:37 +01:00
Martin Robertz 0fe564d007 fix 2026-02-07 18:55:57 +01:00
Martin Robertz 53ba0383fb Merge remote-tracking branch 'origin/master' 2026-02-07 18:46:30 +01:00
Martin Robertz 2c5664ce08 update 2026-02-07 18:46:22 +01:00
Jason Mitchell da70f52b0d Reduce allocation spam on fluid flow in fluid conduits (#219) 2026-02-07 08:32:58 -08:00
SwingURM 46644bc889 Optimize FluidStack copying in EnderLiquidConduitNetwork.doFill (#218) 2026-02-07 15:52:50 +01:00
danyadev f615df5010 compat with WailaPlugins own fluid handler (#217) 2026-01-13 11:27:35 +01:00
PLASMAchicken 73891d20ff Fix Client Crash when breaking Wirelesscharger on Server (#216) 2025-12-26 21:14:36 -05:00
Alexdoru e21793245f [Memory-opti:fix leak] Fix World leak in WirelessChargerController (#212) 2025-12-16 13:41:45 -06:00
Worive ffe4296ef6 Improve NetworkedInventory robustness (#210) 2025-12-10 09:27:33 +01:00
Alexdoru 5083fb2a60 Delete brute forcing of items to generate Thaumcraft aspects (#213) 2025-11-30 07:45:12 +01:00
Alexdoru 05ee12955d Fix World leak in ConduitNetworkTickHandler (#211) 2025-11-22 00:56:09 +01:00
Martin Robertz a7acc7e224 update 2025-10-19 20:30:47 +02:00
Martin Robertz a59bb21e59 update 2025-10-12 20:30:55 +02:00
chochem 5b6c13ff0a Dont register several duplicate items in case of GTNH (#209) 2025-10-12 01:14:36 +01:00
Martin Robertz 6f8b6e2a9c update 2025-10-04 14:26:40 +02:00
TheYoingLadandMartin Robertz 479c8328b4 Added the ability for the farming station to plant Pam's nether seeds (#208)
Co-authored-by: Martin Robertz <[email protected]>
2025-10-04 12:24:54 +00:00
Wilhelm Schuster 0c23f4937d Handle mouse button keybinds (#204) 2025-09-25 19:55:57 +02:00
Wilhelm Schusterandgithub-actions[bot] cde2e4fa60 Fix crash when breaking Painted Glowstone placed by Better Builders Wand (#206)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-09-25 19:35:30 +02:00
Ranzu abbb6dc151 Update bauble slot background in capacitor ui (#203) 2025-09-25 15:20:59 +02:00
Martin Robertz b3def82cde update 2025-09-24 16:49:42 +02:00
EmperorSuper 8b4e7f7ec3 Cap the length of the baubles inventory (#202) 2025-09-24 11:10:22 +02:00
Alexdoru d69d77ecae fix NPE in BlockConduitBundle#onPlaySound (#201) 2025-07-25 08:21:32 +07:00
Dream Master a233f6ba30 update 2025-07-18 09:47:57 +07:00
boubou19andAlexdoru 581150178f Speed up forge event registration (#200)
Co-authored-by: Alexdoru <[email protected]>
2025-07-17 22:37:03 +00:00
Dream Master 313a243bf5 update 2025-07-17 22:29:13 +07:00
Dream Master d5f1008b08 update 2025-07-17 22:28:51 +07:00
koolkrafter5 e1e1f06dc6 Break Dependency Chain (#199) 2025-07-17 02:40:36 +00:00
Martin Robertz aad9c092b1 update 2025-06-12 23:33:37 +02:00
slprime f8c56939cd Update NEI Handlers (#198) 2025-06-12 23:32:01 +02:00
Martin Robertz e2e22d6103 update 2025-05-26 19:22:34 +02:00
dibbydoda a798d2146d Remove deprecated CapacitorBank (#197) 2025-05-26 07:38:39 -04:00
Martin Robertz e829c4168b update 2025-05-23 23:46:07 +02:00
dibbydoda b1f8d99da9 Comparator refactor and Vacuum Chest logic (#196)
Add comparator logic to the Vacuum Chest and refactor comparator logic for Capacitor Banks and Tanks
2025-05-20 04:24:45 -04:00
Maya 304fdef5ec update 2025-05-18 10:35:07 -05:00
glowredman 1f05312ded Small Cleanup (#195) 2025-05-18 10:34:59 -05:00
Maya eb88b1cfe0 update 2025-05-06 17:46:36 -05:00
glowredmanandMaya d4256bda6e Make Fused Quartz blast resistance configurable (#194)
Co-authored-by: Maya <[email protected]>
2025-05-06 17:45:43 -05:00
bda8902709 Feature: Automatable weather obelisk (#193)
Co-authored-by: Martin Robertz <[email protected]>
Co-authored-by: koolkrafter5 <[email protected]>
2025-05-04 19:38:08 -04:00
Maya 63971381cc update 2025-04-24 17:20:42 -05:00
__felix__and__felix__ 09238b09ef Change hazmat Optional decorators' modid from gregtech to gregtech_nh to add gt6 compat (#191)
Co-authored-by: __felix__ <134875831+48a3efa65c881ef567345b17f3910e06@users.noreply.github.com>
2025-04-24 17:19:59 -05:00
Maya 32556e078e update 2025-04-08 16:28:20 -05:00
Niclas Klugmann ace514f628 Move End Steel/ Stellar Armor to GT Hazard API (#189) 2025-04-08 16:27:01 -05:00
Niclas Klugmann 0102b89c33 fix trackman's goggles config (#188) 2025-03-22 14:45:52 +00:00
Maya b65afde754 fix dependencies 2025-03-22 09:01:45 -05:00
Maya 4a0a427186 update 2025-03-22 08:55:17 -05:00
Niclas KlugmannandMaya e04e2e3411 Add trackman's goggles upgrade support to the Dark Helm (#186)
Co-authored-by: Maya <[email protected]>
2025-03-22 08:54:08 -05:00
Niclas Klugmann 316db4bd77 Fix naturalist's eyes (#187) 2025-03-22 08:32:29 -05:00
Maya f43936c29a update 2025-02-14 11:57:41 -06:00
Maya c6471ed6b0 Mark EnderCore as a required dependency (#185) 2025-02-14 17:57:27 +00:00
Maya 654b95da1a update 2025-02-03 15:05:58 -06:00
Dioxop d70263f3af Adding "show range" button to multiple machines (#184) 2025-02-03 15:04:20 -06:00
Martin Robertz c10f74486b update 2024-12-31 14:36:18 +01:00
glowredman c7db2c4840 Add Localizations (#183) 2024-12-30 17:44:29 -06:00
Martin Robertz 948a021f3e update 2024-12-29 18:01:20 +01:00
Simon Zünd 346bbf4e53 Remove left-over code and textures for ultra dense ME conduits (#182) 2024-12-29 16:25:03 +00:00
Martin Robertz 5769ebe3cb update 2024-12-22 01:21:47 +01:00
Pascal 4558f194be ensure TileLightNode instance at breakBlock (#181) 2024-12-21 10:31:30 -06:00
Martin Robertz e12142890e update 2024-11-16 15:28:59 +01:00
Kogepan229andboubou19 e6ebb5dfec Fix Zombie Generator NPE (#180)
Co-authored-by: boubou19 <[email protected]>
2024-11-14 19:22:20 +00:00
54M44R 1d4f6831dd Prevent Silver Capacitor from being used as Upgrade (#178) 2024-11-14 13:32:38 +00:00
Dream Master 726ce46475 update 2024-11-12 12:15:49 +01:00
Noc d01de95e8e removed conduit subtype (#179) 2024-11-12 08:35:28 +01:00
Martin Robertz b15d357f1a update 2024-10-21 21:56:28 +02:00
Darren Eberly 0fbf6f05ba No more TESR on conduits (#176)
* Goodbye TESR, Hello ISBRH

* More fluid conduit rendering work

* more stuff

* spotless

* Add empty check to fluid conduit renderer
2024-10-21 20:08:58 +02:00
Martin Robertz bf9c2cd2c7 update 2024-10-02 15:16:09 +02:00
chochem 51b4c4e74c dont double apply oredicts (#175) 2024-10-01 20:16:52 +01:00
Dream Master cf6b678dd9 update 2024-07-15 23:45:30 +07:00
Under 6c205150b1 Travel Staff Blink Keybind fixes. (#163)
Fixes 2 separate bugs with the SoT keybind.
1. Staff of Teleportation in GTNH pack specifically didn't work due to reporting as having 0 power through the RF API. Fixed this by having it always report that it's full of power since it has infinite.
2. BlackSteelSword and EndSteelSword (The Ender and MKII) both were quite funky with keybind, causing no teleports to happen when they really should have.
Fixed this through tweaks to how this is handled in a number of places to allow for proper handling while not changing the default held/shift held behavior.

Tested in SP, Anchor behavior while holding staffs and Swords with travel thing on them work as expected. Keybind now works and is able to use swords with travel thing on them.
One quirk is that if you are holding a sword with travel upgrade, but NOT shifting, the sword itself stops counting as a valid travel item. So if ONLY using sword no separate SoT the keybind will not work unless you hold shift. If you have another SoT in your inventory it will identify and use that and still blink you upon hitting keybind.
This quirk doesn't really matter in most cases, just something worth noting I guess.
2024-07-15 23:43:39 +07:00
Zoltán Szepesi e39a1e1eb6 Fix LiquidConduit not attempting to pull fluids from all directions if one of external tanks are empty (#174) 2024-07-15 19:09:16 +07:00
glowredman 4a94c1ba90 Remove isModLoaded check for GTNH Lib (#172) 2024-07-11 08:44:35 -05:00
Jason Mitchell 0fc382dd13 Update dependencies.gradle (#170)
Fix server test
2024-07-11 03:31:46 -05:00
Jason Mitchell 04964e15e4 hard dep on gtnhlib 2024-07-10 14:09:43 -07:00
Jason Mitchell 085ccc9d21 Try a CasList, since the Collections.synchronizedList actually needed the reads to be synchronized... 2024-07-10 13:40:46 -07:00
Dream Master 1903589e29 update 2024-07-08 13:26:52 +07:00
Ethryan 46971bbe0e Rename Dark Iron Bars to Dark Steel (#167) 2024-07-05 13:20:31 +07:00
Martin Robertz 4ccecf7bc0 update 2024-07-02 23:50:19 +02:00
Jason Mitchell 92fb58f0c6 Work around CME
* Not entirely sure why it's being concurrently modified.. so let's just make it safe for now
2024-06-30 14:15:24 -07:00
Martin Robertz 54c6db0afc update 2024-06-05 22:49:08 +02:00
OvermindDL1 84d9dcaf00 Fix another thread data race issue introduced in #164. 2024-06-04 21:53:01 -07:00
Jason Mitchell af923d1977 Probably less thread unsafe. (#164) 2024-06-04 18:53:14 -07:00
Martin Robertz efb918fc6d update 2024-06-02 23:05:27 +02:00
6447ffb4d5 Tweaks to EnderIO travel + teleportation (#158)
* Tweak teleport staff controls

* Fix comment

* Fix logic

* spotlessApply (#159)

Co-authored-by: GitHub GTNH Actions <>

* Add configs for teleport staff actions

* Various TP fixes

* Allow TP to unloaded anchor
* Improve TP through wall by checking every 0.5 instead of 2 distance
* Fix blink placing player one block too high
* Fix anchor being incorrectly selected sometimes by constraining to visual angle

* Add server-side handling for two-in-one teleport action

* Clear stored anchors on world load

* Check for obstructed anchor on long-distance teleport

* Check anchor accessibility and require `player != null`

* Handle server-side `travelToLocation`

* Limit backwards teleport check

* 2-in-1 TP: find destination client-side

* spotlessApply (#161)

Co-authored-by: GitHub GTNH Actions <>

* Don't conserve momentum

* Address review comments

* Refactor packet instantiation

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-06-02 17:20:23 +02:00
Martin Robertz fb4c9bde59 update 2024-05-09 10:02:46 +02:00
Oleg Ivanov bd47a39c83 Add config entries for Farming Station particles (#162)
* Decrease number of Farming Station particles

* Set default values for range & number of particles to original
2024-05-08 20:48:35 +02:00
Martin Robertz 43d74c9a7a update 2024-04-24 21:47:04 +02:00
PT400C Jomcraft 6d3a631bb0 Improve FarmingStation portal texture rendering (#157) 2024-04-24 21:26:51 +02:00
Martin Robertz ccdef03296 update 2024-04-18 20:42:39 +02:00
Drathonix 56e163c234 Conduit Replacement Retains Connection Data (#160)
* Replacing Conduits Now maintains all Connection Settings

* Only write/read connection nbt.

* Use Correct Connectionset
2024-04-18 10:24:59 +02:00
Martin Robertz 8ecec5b096 update 2024-02-28 20:07:25 +01:00
boubou19GitHub GTNH Actionsgithub-actions[bot]
4e3fbc7667 Reduce allocation spam in capacitor banks (#155)
* reduce memory allocation

* update dep

* use public

* wrong dep

* spotlessApply (#156)

Co-authored-by: GitHub GTNH Actions <>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-02-25 23:26:17 +01:00
Jason Mitchell 845f277497 Actually optional (#154)
* Actually optional

* Tags
2024-02-22 21:21:37 +01:00
Jason Mitchell 94fb952cb0 Angelica compat (#153)
* Angelica Compat - Thread Saftey
* Depends on EnderCore updates for instanced CubeRenderer
* Switches relevant renderers to ThreadLocals, and adds a getRenderer() to Conduits
* Makes ConduitBundleRenderer threadsafe
* Misc reduction in allocations
2024-02-22 07:54:55 -08:00
Martin Robertz 29554c6a40 update 2024-02-22 13:27:10 +01:00
connor135246 fc5cba342c Fix Dark Steel Anvils in WAILA (#152)
Dark Steel Anvils wouldn't show the correct block in WAILA if the "Sneaky Facades" option was on.
2024-02-22 11:33:13 +01:00
Jason Mitchell 05d31b2e70 Some null checks to avoid outright crashing with Angelica, future thread saftey to come (#150) 2024-02-22 11:32:53 +01:00
Martin Robertz 5265340e3c update 2024-02-17 11:13:20 +01:00
Raven Szewczyk 37e239ae81 [ci skip] upgraded build system 2024-02-04 19:58:13 +00:00
Martin Robertz a725ebf120 update bs+deps 2024-01-31 22:47:55 +01:00
Pascal 6affe75674 fix protection mode of travel anchor (#149) 2024-01-31 07:53:01 +01:00
Martin Robertz 19f19d348b update bs+deps 2024-01-24 18:19:30 +01:00
Under 3154d03b4f Fix Anchor always rendering bug (#148)
* Fix Anchor always rendering bug

Also stop inventory scanning from happening every client tick, whoops.
Tested by placing a debug point on line 768 of TravelController (in getRequiredPower) and a debug point at line 656 of TravelController (in findTravelItemInInventoryOrBaubles). Debug points were used to verify that the code was ONLY hit when actual teleport happens, and not happening every tick like what was accidentally happening before.

* Run spotlessApply

Forgot that was a thing I do for GTNH stuff.
2024-01-24 10:58:27 -06:00
Martin Robertz 9e84167012 update bs+deps 2024-01-10 00:42:52 +01:00
bombcar d1a1bf1ed5 add required hard dependency on cofhlib (#146)
* add required hard dependency on cofhlib

* update bs, dependencies, and settings.gradle
2024-01-10 00:41:51 +01:00
Raven Szewczyk c1309fa37d [ci skip] upgraded build system 2024-01-08 21:25:19 +00:00
Martin Robertz 6a0785e1da exchange existing Item filter from newer Ender io version (#145) 2023-12-30 12:09:44 +01:00
Martin Robertz 6a4d655c71 update deps 2023-12-24 20:21:36 +01:00
Under 3639ade571 Staff Of Traveling Keybind Feature (#144)
* Staff Of Traveling Keybind Update

Two main things
1. Added a keybind for Staff of Traveling blink ability
2. Due to the new keybind, also added Baubles support for Staff of Traveling.

By extension, both features 1 and 2 also apply to the Staff of Teleportation.

* Update en_US.lang

* Add config to disable Travel Staff Keybind

Change as per request by @Caedis .
New config option is synced in the PacketConfigSync class.
A helpful info message is displayed when players attempt to use the keybind but it is disabled so it's immediately apparent why it's not working.

* Typo/formatting

Fix type, remove unnecessary null check.

* Annotations and UNIVERSAL bauble type

Added annotations missing from ItemMagnet and ItemTravelStaff for Baubles.
Added option 'UNIVERSAL' to description of magnet and travel staff Bauble type configs.
Changed default of staff to be 'UNIVERSAL', because bauble slots are limited enough as-is.
2023-12-24 20:18:57 +01:00
Martin Robertz 95daa9b035 update deps 2023-12-20 20:21:36 +01:00
Under f249fd2973 Add Config to allow servers to re-enable support for client-side 'hacks' like Staff Of Traveling Keybind mod. (#142)
* Update Config.java

Adding config to allow not validating travel staff packets.

* Update TravelController.java

Disable validation if server config deems it so.

* spotlessApply fix

* Wrong ordering and spotlessApply
2023-12-20 20:06:38 +01:00
9f3f8243f9 Limited Item Filter (#143)
* Limited Item Filter

* simplify inverted limit

Co-authored-by: Alexander Anishin <[email protected]>

* Update src/main/java/crazypants/enderio/conduit/item/filter/ItemFilterLimited.java

Co-authored-by: Alexander Anishin <[email protected]>

* Update src/main/java/crazypants/enderio/conduit/item/filter/ItemFilterLimited.java

Co-authored-by: Alexander Anishin <[email protected]>

* Update ItemFilterLimited.java

---------

Co-authored-by: Alexander Anishin <[email protected]>
Co-authored-by: Martin Robertz <[email protected]>
2023-12-20 19:50:55 +01:00
Martin Robertz 23a5484ee8 update deps 2023-12-13 15:38:04 +01:00
Bears Dot Zone 4b5837cac2 Fix an edge case pertaining to freshly crafted tanks (#141)
* Update dependencies

* Replace faulty dummy object logic with object creation

* Remove logic that is exiting a function erroneously
2023-12-13 15:32:56 +01:00
Spacebuilder2020andMartin Robertz 1251427388 Fix NBT Match where tag is empty but exists (#138)
* Fix NBT Match where tag is empty but exists

* Apply Splotless

* update deps

* update gradle + bs

---------

Co-authored-by: Martin Robertz <[email protected]>
2023-12-13 09:40:48 +01:00
ghostflyby 3e7d69f460 Open conduit connection GUI with more wrenches (#139) 2023-11-25 16:02:12 +08:00
Martin Robertz 88725a144d update deps 2023-11-16 13:59:12 +01:00
Pelotrio 123f22f20e Add unload event handling to ClientNetworkManager (#137)
Added a new method `onWorldUnload` to `ClientNetworkManager` to destroy and clear any network instances when the world event `Unload` is triggered. The addition of this event handler was necessary to prevent the possibility of any network instances persisting on the client side beyond the World lifetime, thus potentially causing memory leaks.
2023-11-16 15:42:32 +03:00
Martin Robertz 0b0f7a4f1a update deps 2023-11-11 12:13:03 +01:00
Martin Robertz b00c5996f7 update bs+deps 2023-11-11 12:12:45 +01:00
Pelotrio 83f52d15c7 Removed the redundant static IWailaDataAccessor _accessor to not leak the world object 2023-11-10 18:34:39 -08:00
Pelotrio 287c4498d2 Use null for the Item to render to not leak the world 2023-11-10 18:34:39 -08:00
Martin Robertz 2470e81f0e update bs+de+wci 2023-10-15 17:43:47 +02:00
Alexdoru 1af6fcae0b set fluid conduit default to output only 2023-10-15 13:34:45 +02:00
Alexdoru f44111da96 revert changes to conduit default connection modes 2023-10-15 13:34:45 +02:00
Dream-MasterXXL 4ae9ff2d77 update bs+deps 2023-10-05 00:42:17 +02:00
Martin Robertz 71f79536a7 update deps 2023-09-28 20:54:35 +02:00
Alexdoru 0920bf28d6 Change default connection mode of fluid conduits (#134)
* update bs

* change default connection mode of fluid conduits

* fix imports
2023-09-28 20:45:53 +02:00
Martin Robertz 8e4107d11e update bs+deps 2023-09-22 19:09:29 +02:00
Glease 349bcc0926 allow small overshoot of power use for traveling (#133) 2023-09-22 20:04:04 +03:00
Glease 070660efe4 fix travel upgrade items using wrong way to determine power stored (#131)
Signed-off-by: Glease <[email protected]>
2023-07-24 01:45:41 +08:00
Martin RobertzandRaven Szewczyk 0dd56b62ab update bs+sa+deps (#130)
* update bs+sa+deps

* Switch immibis microblocks to modrinth maven

* Remove modrinth from repositories as it's now in the buildscript

---------

Co-authored-by: Raven Szewczyk <[email protected]>
2023-07-23 11:36:28 +02:00
Glease 54d61f5251 valiate tp packets (#128)
* validate tp packets

Signed-off-by: Glease <[email protected]>

* spotless

Signed-off-by: Glease <[email protected]>

---------

Signed-off-by: Glease <[email protected]>
2023-07-23 08:04:14 +02:00
初夏同学 ebcbef851a Fix a bug in NBT usage (#127) 2023-07-05 17:57:26 +02:00
miozune 1717d38632 Validate TE of packet (#126)
* Validate TE of packet

* Remove outdated script
2023-07-03 11:33:32 +09:00
Caedis 5fdd24293a Implement item bar visibility config (#125)
* Implement item bar visibility config

* Forgot about spotless

* Recommit changed files + added magnet, cap bank, and staff bar hiding
2023-06-04 22:09:59 +02:00
miozune 2629076937 Fix fluid conduit connecting to non-fluid GT tiles (#123)
* updateBuildScript & update dependencies

* Fix fluid conduit connecting to non-fluid GT tiles

* spotlessApply

* one less variable
2023-05-22 12:01:16 +02:00
Pilzinsel64 63cbe6e562 fix + more cleanup for PowerConduitEndergy (#122) 2023-05-09 19:29:05 +02:00
Pilzinsel64 3194ecf6e8 Cleanup PowerConduitEndergy (#121)
* cleanup PowerConduitEndergy

* spotlessApply

* re-add POSTFIX again
2023-05-08 18:08:41 +02:00
miozune 638f04a58e Fix crash with outOfRange on server (#120) 2023-05-02 09:09:51 +02:00
Pilzinsel64 e5e6e2fdba use config for transceiver's energy buffer (#119) 2023-05-01 22:55:20 +02:00
Martin Robertz 5b46f376eb Update dependencies.gradle 2023-04-23 11:12:50 +02:00
miozune 1a14946abb Show travel message above hotbar (#117) 2023-04-10 11:21:39 +02:00
Pilzinsel64 8ca820f71c prevent ghostloading (#115)
* prevent ghostloading by MEConduit

* prevent more ghostloading by MEConduit

* spottlessApply

* prevent ghostloading by ConduitUtil
2023-04-01 15:10:20 +02:00
D-Cysteine 4e40230bf3 Try to fix energy overflow (#114) 2023-03-29 17:25:43 +02:00
Pilzinsel64 76708883c0 needUpdateConnections only while updating cons (#113) 2023-03-23 21:12:11 +01:00
Pilzinsel64 0a1ee81780 Add comments for needUpdateConnections (#112)
* imrpove canConnectToExternal()

* needUpdateConnections

* add comments for needUpdateconnections
2023-03-23 06:46:13 +01:00
Pilzinsel64 1fd7ae7567 Improve canConnectToExternal() (#111)
* imrpove canConnectToExternal()

* needUpdateConnections
2023-03-22 23:43:32 +01:00
Pilzinsel64 251fcc26b0 Ultra Dense ME Conduits (#105)
* basic MEConduit DenseUltra implementation

* add assets for ME Conduit Dense Ultra

* fix icon array count

* fix previous commit

* finalize ultra dense me conduits

* add configu for Ultra Dense ME Conduits

* edit texture a little bit more

* adjust meConduitCoreDenseUltra.png

* fix enableMEUltraDenseConduits

* spottlessApply

* fix texture

* improve canConnectToExternal()
2023-03-19 10:35:42 +01:00
Pilzinsel64 b22915cc9c More German Translation (#110)
* more german translation

* fix crystalline pink slime missmatch
2023-03-12 11:19:10 +01:00
Pilzinsel64 0bf8d3f568 Revert "fix ME Conduits onChunkUnload (#107)" (#109)
This reverts commit 73cb43a761.
2023-03-05 18:05:17 +01:00
Pilzinsel64andglowredman 35e6667da5 Some more German translation (#108)
* some more German translation

* Update src/main/resources/assets/enderio/lang/de_DE.lang

Co-authored-by: glowredman <[email protected]>

* Update src/main/resources/assets/enderio/lang/de_DE.lang

Co-authored-by: glowredman <[email protected]>

* Update src/main/resources/assets/enderio/lang/de_DE.lang

Co-authored-by: glowredman <[email protected]>

* Update src/main/resources/assets/enderio/lang/de_DE.lang

Co-authored-by: glowredman <[email protected]>

* Update src/main/resources/assets/enderio/lang/de_DE.lang

Co-authored-by: glowredman <[email protected]>

* Update src/main/resources/assets/enderio/lang/de_DE.lang

Co-authored-by: glowredman <[email protected]>

---------

Co-authored-by: glowredman <[email protected]>
2023-03-05 13:31:55 +01:00
1357 changed files with 8102 additions and 9869 deletions

No files matched your search

-33
View File
@@ -1,33 +0,0 @@
#!/usr/bin/env bash
RUNDIR="run"
CRASH="crash-reports"
SERVERLOG="server.log"
if [[ -d $RUNDIR/$CRASH ]]; then
echo "Crash reports detected:"
cat $RUNDIR/$CRASH/crash*.txt
exit 1
fi
if grep --quiet "Fatal errors were detected" $SERVERLOG; then
echo "Fatal errors detected:"
cat server.log
exit 1
fi
if grep --quiet "The state engine was in incorrect state ERRORED and forced into state SERVER_STOPPED" $SERVERLOG; then
echo "Server force stopped:"
cat server.log
exit 1
fi
if ! grep --quiet -Po '.+Done \(.+\)\! For help, type "help" or "\?"' $SERVERLOG; then
echo "Server didn't finish startup:"
cat server.log
exit 1
fi
echo "No crash reports detected"
exit 0
+2 -2
View File
@@ -3,9 +3,9 @@ name: Build and test
on:
pull_request:
branches: [ master, main ]
branches: [ master, main, release/** ]
push:
branches: [ master, main ]
branches: [ master, main, release/** ]
jobs:
build-and-test:
+17
View File
@@ -0,0 +1,17 @@
name: Optimize images
on:
pull_request:
branches: [ master, main, release/** ]
paths:
- "**/*.png"
push:
branches: [ master, main, release/** ]
paths:
- "**/*.png"
jobs:
optimize-images:
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/optimize-images.yml@master
secrets: inherit
+2
View File
@@ -27,3 +27,5 @@ whitelist.json
*.iws
src/main/resources/mixins.*.json
*.bat
layout.json
.DS_Store
+2 -1531
View File
File diff suppressed because it is too large. Load diff
+25 -14
View File
@@ -1,24 +1,35 @@
// Add your dependencies here
dependencies {
api('com.github.GTNewHorizons:EnderCore:0.2.13:dev')
implementation('com.github.GTNewHorizons:ForestryMC:4.5.8:dev')
implementation('com.github.GTNewHorizons:NotEnoughItems:2.3.35-GTNH:dev')
api('com.github.GTNewHorizons:BuildCraft:7.1.27:dev')
api('com.github.GTNewHorizons:EnderCore:0.5.15:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:ForestryMC:4.11.37:dev')
compileOnly('com.github.GTNewHorizons:NotEnoughItems:2.8.130-GTNH:dev')
api("com.github.GTNewHorizons:GTNHLib:0.11.45:dev")
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.63:dev')
api('curse.maven:cofh-lib-220333:2388748') // https://www.curseforge.com/minecraft/mc-mods/cofh-lib/files/2388748
shadowImplementation('cglib:cglib-nodep:3.3.0')
api("com.github.GTNewHorizons:TinkersConstruct:1.14.107-GTNH:dev")
compileOnly('com.github.GTNewHorizons:waila:1.5.23:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-168-GTNH:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:Baubles:1.0.1.14:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:Railcraft:9.13.6:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:StorageDrawers:1.11.13-GTNH:api') {transitive = false}
implementation('com.github.GTNewHorizons:Chisel:2.10.8-GTNH:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:OpenComputers:1.8.0.13-GTNH:api') {transitive = false}
devOnlyNonPublishable('com.github.GTNewHorizons:waila:1.19.34:dev') {transitive = false}
compileOnly('ganymedes01.etfuturum:Et-Futurum-Requiem:2.6.48-GTNH:dev') {transitive = false}
runtimeOnlyNonPublishable('com.github.GTNewHorizons:WAILAPlugins:0.7.2:dev') {transitive = false}
compileOnly("com.github.GTNewHorizons:Backhand:1.8.14:dev") { transitive = false }
compileOnly('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-999-GTNH:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:Baubles-Expanded:2.2.22-GTNH:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.54.129:dev') {transitive = false}
compileOnly("com.github.GTNewHorizons:ModularUI2:2.3.88-1.7.10:dev") {transitive = false}
compileOnly('com.github.GTNewHorizons:Railcraft:9.17.31:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:StorageDrawers:2.2.29-GTNH:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:Chisel:2.17.32-GTNH:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:OpenComputers:1.12.61-GTNH:api') {transitive = false}
compileOnly('curse.maven:minefactory-reloaded-66672:2366150') // https://www.curseforge.com/minecraft/mc-mods/minefactory-reloaded/files/2366150
compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
compileOnly('curse.maven:ee3-65509:2305023') // https://www.curseforge.com/minecraft/mc-mods/ee3/files/2305023
compileOnly(deobf('https://media.forgecdn.net/files/2269/339/ComputerCraft1.75.jar')) // https://www.curseforge.com/minecraft/mc-mods/computercraft/files/2269339
compileOnly(deobf('https://media.forgecdn.net/files/2426/270/Mekanism-1.7.10-9.1.0.281.jar')) // https://aidancbrady.com/mekanism/download/
compileOnly(deobf('https://immibis.com/mcmoddl/files/immibis-microblocks-59.1.2.jar'))
compileOnly(rfg.deobf('curse.maven:computercraft-67504:2269339')) // https://www.curseforge.com/minecraft/mc-mods/computercraft/files/2269339
compileOnly(rfg.deobf('curse.maven:mekanism-268560:2475797')) // https://www.curseforge.com/minecraft/mc-mods/mekanism/files/2475797
compileOnly(rfg.deobf('maven.modrinth:immibis-microblocks:59.1.2')) // https://modrinth.com/mod/immibis-microblocks/version/59.1.2
compileOnly('com.github.GTNewHorizons:BetterBuildersWands:0.13.12-GTNH:dev@jar')
compileOnlyApi('com.github.GTNewHorizons:Angelica:2.2.10:api') {transitive = false}
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.7.196:dev")
compileOnly('curse.maven:automagy-222153:2285272')
}
+197 -29
View File
@@ -1,63 +1,135 @@
# ExampleMod tag to use as Blowdryer (Spotless, etc.) settings version, leave empty to disable.
# LOCAL to test local config updates.
gtnh.settings.blowdryerTag = 0.2.0
# Human-readable mod name, available for mcmod.info population.
modName = Ender IO
# This is a case-sensitive string to identify your mod. Convention is to use lower case.
# Case-sensitive identifier string, available for mcmod.info population and used for automatic mixin JSON generation.
# Conventionally lowercase.
modId = EnderIO
# Root package of the mod, used to find various classes in other properties,
# mcmod.info substitution, enabling assertions in run tasks, etc.
modGroup = crazypants.enderio
# WHY is there no version field?
# The build script relies on git to provide a version via tags. It is super easy and will enable you to always know the
# code base or your binary. Check out this tutorial: https://blog.mattclemente.com/2017/10/13/versioning-with-git-tags/
# Whether to use modGroup as the maven publishing group.
# When false, com.github.GTNewHorizons is used.
useModGroupForPublishing = false
# Will update your build.gradle automatically whenever an update is available
# Updates your build.gradle and settings.gradle automatically whenever an update is available.
autoUpdateBuildScript = false
# Version of Minecraft to target
minecraftVersion = 1.7.10
# Version of Minecraft Forge to target
forgeVersion = 10.13.4.1614
# Specify a MCP channel and mappings version for dependency deobfuscation and the deobfParams task.
# Specify an MCP channel for dependency deobfuscation and the deobfParams task.
channel = stable
# Specify an MCP mappings version for dependency deobfuscation and the deobfParams task.
mappingsVersion = 12
# Define other MCP mappings for dependency deobfuscation
remoteMappings = https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/
# Defines other MCP mappings for dependency deobfuscation.
remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/
# Select a username for testing your mod with breakpoints. You may leave this empty for a random user name each time you
# restart Minecraft in development. Choose this dependent on your mod:
# Do you need consistent player progressing (for example Thaumcraft)? -> Select a name
# Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty
# Select a default username for testing your mod. You can always override this per-run by running
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
developmentEnvironmentUserName = Developer
# Define a source file of your project with:
# public static final String VERSION = "GRADLETOKEN_VERSION";
# The string's content will be replaced with your mods version when compiled. You should use this to specify your mod's
# version in @Mod([...], version = VERSION, [...])
# Leave these properties empty to skip individual token replacements
replaceGradleTokenInFile = EnderIO.java
# Enables modern Java syntax support. Valid values:
# - false: No modern syntax, Java 8 only
# - jabel: Jabel syntax-only support, compiles to J8 bytecode
# - jvmDowngrader: Full modern Java via JVM Downgrader (syntax + stdlib APIs)
# - modern: Native modern Java bytecode, no downgrading
enableModernJavaSyntax = jabel
# If set, ignores the above setting and compiles with the given toolchain. This may cause unexpected issues,
# and should *not* be used in most situations. -1 disables this.
# forceToolchainVersion = -1
# Target JVM version for JVM Downgrader bytecode downgrading.
# Only used when enableModernJavaSyntax = jvmDowngrader
# downgradeTargetVersion = 8
# Comma-separated list of Java versions for multi-release jar support (JVM Downgrader only).
# Classes will be available in META-INF/versions/N/ for each version N in this list.
# Default: "21,25" (J25+ gets native classes, J21-24 gets partial downgrade, J8-20 gets full downgrade).
# jvmDowngraderMultiReleaseVersions = 21,25
# Specifies how JVM Downgrader API stubs are provided. Options:
# - shade: Shade minimized stubs into the jar
# - gtnhlib: GTNHLib provides stubs at runtime (adds version constraint)
# - external: Another dependency provides stubs (no constraint, no warning)
# - (empty): Warning reminding you to configure stubs
# Note: 'shade' option requires you to verify license compliance, see: https://github.com/unimined/JvmDowngrader/blob/main/LICENSE.md
# jvmDowngraderStubsProvider =
# Enables injecting missing generics into the decompiled source code for a better coding experience.
# Turns most publicly visible List, Map, etc. into proper List<E>, Map<K, V> types.
enableGenericInjection = true
# Generate a class with a String field for the mod version named as defined below.
# If generateGradleTokenClass is empty or not missing, no such class will be generated.
# If gradleTokenVersion is empty or missing, the field will not be present in the class.
generateGradleTokenClass = crazypants.enderio.Tags
# Name of the token containing the project's current version to generate/replace.
gradleTokenVersion = VERSION
# [DEPRECATED] Mod ID replacement token.
gradleTokenModId =
# [DEPRECATED] Mod name replacement token.
gradleTokenModName =
gradleTokenVersion = GRADLETOKEN_VERSION
# [DEPRECATED] Mod Group replacement token.
gradleTokenGroupName =
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise you can
# [DEPRECATED]
# Multiple source files can be defined here by providing a comma-separated list: Class1.java,Class2.java,Class3.java
# public static final String VERSION = "GRADLETOKEN_VERSION";
# The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's
# version in @Mod([...], version = VERSION, [...]).
# Leave these properties empty to skip individual token replacements.
replaceGradleTokenInFile =
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
# leave this property empty.
# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api
# Example value: (apiPackage = api) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.api
apiPackage = api
# Specify the configuration file for Forge's access transformers here. I must be placed into /src/main/resources/META-INF/
# Example value: mymodid_at.cfg
accessTransformersFile =
# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/META-INF/
# There can be multiple files in a space-separated list.
# Example value: mymodid_at.cfg nei_at.cfg
accessTransformersFile = enderio_at.cfg
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
usesMixins = false
# Set to a non-empty string to configure mixins in a separate source set under src/VALUE, instead of src/main.
# This can speed up compile times thanks to not running the mixin annotation processor on all input sources.
# Mixin classes will have access to "main" classes, but not the other way around.
separateMixinSourceSet =
# Adds some debug arguments like verbose output and class export.
usesMixinDebug = false
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
mixinPlugin =
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
# Specify the package that contains all of your Mixins. The package must exist or
# the build will fail. If you have a package property defined in your mixins.<modid>.json,
# it must match with this or the build will fail.
mixinsPackage =
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
# This parameter is for legacy compatability only
# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin
# This parameter is for legacy compatibility only
# Example value: (coreModClass = asm.FMLPlugin) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.asm.FMLPlugin
coreModClass =
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class
# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
containsMixinsAndOrCoreModOnly = false
@@ -65,6 +137,102 @@ containsMixinsAndOrCoreModOnly = false
# Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins.
forceEnableMixins = false
# If enabled, you may use 'shadowImplementation' for dependencies. They will be integrated in your jar. It is your
# responsibility check the licence and request permission for distribution, if required.
# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated into your jar. It is your
# responsibility to check the license and request permission for distribution if required.
usesShadowedDependencies = true
# If disabled, won't remove unused classes from shadowed dependencies. Some libraries use reflection to access
# their own classes, making the minimization unreliable.
minimizeShadowedDependencies = true
# If disabled, won't rename the shadowed classes.
relocateShadowedDependencies = true
# Adds CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.
includeWellKnownRepositories = true
# A list of repositories to exclude from the includeWellKnownRepositories setting. Should be a space separated
# list of strings, with the acceptable keys being(case does not matter):
# cursemaven
# modrinth
excludeWellKnownRepositories =
# Change these to your Maven coordinates if you want to publish to a custom Maven repository instead of the default GTNH Maven.
# Authenticate with the MAVEN_USER and MAVEN_PASSWORD environment variables.
# If you need a more complex setup disable maven publishing here and add a publishing repository to addon.gradle.
usesMavenPublishing = true
# Maven repository to publish the mod to.
# mavenPublishUrl = https\://nexus.gtnewhorizons.com/repository/releases/
# Publishing to Modrinth requires you to set the MODRINTH_TOKEN environment variable to your current Modrinth API token.
#
# The project's ID on Modrinth. Can be either the slug or the ID.
# Leave this empty if you don't want to publish to Modrinth.
modrinthProjectId =
# The project's relations on Modrinth. You can use this to refer to other projects on Modrinth.
# Syntax: scope1-type1:name1;scope2-type2:name2;...
# Where scope can be one of [required, optional, incompatible, embedded],
# type can be one of [project, version],
# and the name is the Modrinth project or version slug/id of the other mod.
# Example: required-project:fplib;optional-project:gasstation;incompatible-project:gregtech
# Note: UniMixins is automatically set as a required dependency if usesMixins = true.
modrinthRelations =
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
#
# The project's numeric ID on CurseForge. You can find this in the About Project box.
# Leave this empty if you don't want to publish on CurseForge.
curseForgeProjectId =
# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge.
# Syntax: type1:name1;type2:name2;...
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
# and the name is the CurseForge project slug of the other mod.
# Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft
# Note: UniMixins is automatically set as a required dependency if usesMixins = true.
curseForgeRelations =
# Optional parameter to customize the produced artifacts. Use this to preserve artifact naming when migrating older
# projects. New projects should not use this parameter.
# customArchiveBaseName =
# Optional parameter to customize the default working directory used by the runClient* tasks. Relative to the project directory.
# runClientWorkingDirectory = run/client
# Optional parameter to customize the default working directory used by the runServer* tasks. Relative to the project directory.
# runServerWorkingDirectory = run/server
# Optional parameter to have the build automatically fail if an illegal version is used.
# This can be useful if you e.g. only want to allow versions in the form of '1.1.xxx'.
# The check is ONLY performed if the version is a git tag.
# Note: the specified string must be escaped, so e.g. 1\\.1\\.\\d+ instead of 1\.1\.\d+
# versionPattern =
# Uncomment to prevent the source code from being published.
# noPublishedSources = true
# Uncomment this to disable Spotless checks.
# This should only be uncommented to keep it easier to sync with upstream/other forks.
# That is, if there is no other active fork/upstream, NEVER change this.
# disableSpotless = true
# Uncomment this to disable Checkstyle checks (currently wildcard import check).
# disableCheckstyle = true
# Override the IDEA build type. Valid values are: "" (leave blank, do not override), "idea" (force use native IDEA build), "gradle"
# (force use delegated build).
# This is meant to be set in $HOME/.gradle/gradle.properties.
# e.g. add "systemProp.org.gradle.project.ideaOverrideBuildType=idea" will override the build type to be native build.
# WARNING: If you do use this option, it will overwrite whatever you have in your existing projects. This might not be what you want!
# Usually there is no need to uncomment this here as other developers do not necessarily use the same build type as you.
# ideaOverrideBuildType = idea
# Whether IDEA should run spotless checks when pressing the Build button.
# This is meant to be set in $HOME/.gradle/gradle.properties.
# ideaCheckSpotlessOnBuild = true
# Non-GTNH properties
org.gradle.configuration-cache = true
org.gradle.parallel = true
+12
View File
@@ -0,0 +1,12 @@
#This file is generated by updateDaemonJvm
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/539ea72837c6244075f8ee037babc29e/redirect
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/876dbbf00bf4ef6190f7da074cee903a/redirect
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/539ea72837c6244075f8ee037babc29e/redirect
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/876dbbf00bf4ef6190f7da074cee903a/redirect
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/9064f22734b42ac03e85df04b632e167/redirect
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/4d0277c49991306ac78048580fe34bcf/redirect
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/539ea72837c6244075f8ee037babc29e/redirect
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/876dbbf00bf4ef6190f7da074cee903a/redirect
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/a9fa3b809e484a1e1ac4308a5dda661a/redirect
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/aa99913fa6d767d899ffc96082da01ca/redirect
toolchainVersion=25
Binary file not shown.
+2 -1
View File
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Vendored
+22 -18
View File
@@ -1,7 +1,7 @@
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
# Copyright © 2015 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
##############################################################################
#
@@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/b631911858264c0b6e4d6603d677ff5218766cee/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -83,10 +85,8 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@@ -114,7 +114,6 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
@@ -133,10 +132,13 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.
@@ -144,7 +146,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
@@ -152,7 +154,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
@@ -169,7 +171,6 @@ fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
@@ -197,16 +198,19 @@ if "$cygwin" || "$msys" ; then
done
fi
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"
# Stop when "xargs" is not available.
Vendored
+13 -12
View File
@@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@@ -43,11 +45,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
@@ -57,22 +59,21 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
:end
@rem End local scope for the variables with windows NT shell
+5 -10
View File
@@ -4,10 +4,10 @@ pluginManagement {
maven {
// RetroFuturaGradle
name "GTNH Maven"
url "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
allowInsecureProtocol = true
url "https://nexus.gtnewhorizons.com/repository/public/"
mavenContent {
includeGroup("com.gtnewhorizons.retrofuturagradle")
includeGroup("com.gtnewhorizons")
includeGroupByRegex("com\\.gtnewhorizons\\..+")
}
}
gradlePluginPortal()
@@ -17,12 +17,7 @@ pluginManagement {
}
plugins {
id 'com.diffplug.blowdryerSetup' version '1.6.0'
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.4.0' // Provides java toolchains
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.29'
}
blowdryerSetup {
repoSubfolder 'gtnhShared'
github('GTNewHorizons/ExampleMod1.7.10', 'tag', '0.2.0')
//devLocal '.' // Use this when testing config updates locally
}
@@ -1,8 +1,5 @@
package crazypants.enderio;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
@@ -30,39 +27,29 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import crazypants.enderio.conduit.BlockConduitBundle;
import crazypants.enderio.conduit.IConduit;
import crazypants.enderio.conduit.TileConduitBundle;
import crazypants.enderio.conduit.facade.FacadeRenderer;
import crazypants.enderio.conduit.gas.GasConduit;
import crazypants.enderio.conduit.gas.GasConduitRenderer;
import crazypants.enderio.conduit.gas.GasUtil;
import crazypants.enderio.conduit.item.ItemConduit;
import crazypants.enderio.conduit.liquid.AbstractEnderLiquidConduit;
import crazypants.enderio.conduit.liquid.AdvancedLiquidConduit;
import crazypants.enderio.conduit.liquid.AdvancedLiquidConduitRenderer;
import crazypants.enderio.conduit.liquid.CrystallineEnderLiquidConduit;
import crazypants.enderio.conduit.liquid.CrystallinePinkSlimeEnderLiquidConduit;
import crazypants.enderio.conduit.liquid.EnderLiquidConduit;
import crazypants.enderio.conduit.liquid.EnderLiquidConduitRenderer;
import crazypants.enderio.conduit.liquid.LiquidConduit;
import crazypants.enderio.conduit.liquid.LiquidConduitRenderer;
import crazypants.enderio.conduit.liquid.MelodicEnderLiquidConduit;
import crazypants.enderio.conduit.liquid.StellarEnderLiquidConduit;
import crazypants.enderio.conduit.me.MEConduit;
import crazypants.enderio.conduit.me.MEUtil;
import crazypants.enderio.conduit.oc.OCConduit;
import crazypants.enderio.conduit.oc.OCConduitRenderer;
import crazypants.enderio.conduit.oc.OCUtil;
import crazypants.enderio.conduit.power.PowerConduit;
import crazypants.enderio.conduit.power.PowerConduitRenderer;
import crazypants.enderio.conduit.power.endergy.PowerConduitEndergy;
import crazypants.enderio.conduit.redstone.InsulatedRedstoneConduit;
import crazypants.enderio.conduit.redstone.InsulatedRedstoneConduitRenderer;
import crazypants.enderio.conduit.redstone.RedstoneConduit;
import crazypants.enderio.conduit.redstone.RedstoneSwitch;
import crazypants.enderio.conduit.redstone.RedstoneSwitchRenderer;
import crazypants.enderio.conduit.render.ConduitBundleRenderer;
import crazypants.enderio.conduit.render.ConduitRenderer;
import crazypants.enderio.conduit.render.DefaultConduitRenderer;
import crazypants.enderio.conduit.render.ItemConduitRenderer;
import crazypants.enderio.config.Config;
import crazypants.enderio.enderface.EnderIoRenderer;
@@ -116,11 +103,8 @@ import crazypants.enderio.machine.painter.BlockPaintedFenceGateRenderer;
import crazypants.enderio.machine.painter.BlockPaintedGlowstone;
import crazypants.enderio.machine.painter.PaintedBlockRenderer;
import crazypants.enderio.machine.painter.PaintedItemRenderer;
import crazypants.enderio.machine.power.BlockCapacitorBank;
import crazypants.enderio.machine.power.CapBankRenderer2;
import crazypants.enderio.machine.power.CapacitorBankRenderer;
import crazypants.enderio.machine.ranged.RangeEntity;
import crazypants.enderio.machine.ranged.RangeRenerer;
import crazypants.enderio.machine.ranged.RangeRenderer;
import crazypants.enderio.machine.reservoir.ReservoirRenderer;
import crazypants.enderio.machine.reservoir.TileReservoir;
import crazypants.enderio.machine.solar.BlockSolarPanel;
@@ -166,10 +150,6 @@ public class ClientProxy extends CommonProxy {
};
// @formatter:on
private final List<ConduitRenderer> conduitRenderers = new ArrayList<ConduitRenderer>();
private final DefaultConduitRenderer dcr = new DefaultConduitRenderer();
private ConduitBundleRenderer cbr;
private boolean checkedNei = false;
@@ -258,6 +238,8 @@ public class ClientProxy extends CommonProxy {
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockPainter), machRen);
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockCrafter), machRen);
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockBuffer), machRen);
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockPoweredSpawner), machRen);
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockSliceAndSplice), machRen);
MinecraftForgeClient.registerItemRenderer(EnderIO.itemBrokenSpawner, new BrokenSpawnerRenderer());
@@ -276,13 +258,15 @@ public class ClientProxy extends CommonProxy {
ClientRegistry.bindTileEntitySpecialRenderer(TileFarmStation.class, new FarmingStationSpecialRenderer());
BlockSoulBinder.renderId = RenderingRegistry.getNextAvailableRenderId();
RenderingRegistry.registerBlockHandler(new SoulBinderRenderer());
SoulBinderRenderer soulBinderRenderer = new SoulBinderRenderer();
RenderingRegistry.registerBlockHandler(soulBinderRenderer);
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockSoulFuser), soulBinderRenderer);
ObeliskRenderer defaultObeliskRenderer = new ObeliskRenderer();
BlockObeliskAbstract.defaultObeliskRenderId = RenderingRegistry.getNextAvailableRenderId();
RenderingRegistry.registerBlockHandler(defaultObeliskRenderer);
ObeliskSpecialRenderer<TileAttractor> attRen = new ObeliskSpecialRenderer<TileAttractor>(
ObeliskSpecialRenderer<TileAttractor> attRen = new ObeliskSpecialRenderer<>(
new ItemStack(EnderIO.itemMaterial, 1, Material.ATTRACTOR_CRYSTAL.ordinal()),
defaultObeliskRenderer);
ClientRegistry.bindTileEntitySpecialRenderer(TileAttractor.class, attRen);
@@ -292,7 +276,7 @@ public class ClientProxy extends CommonProxy {
ClientRegistry.bindTileEntitySpecialRenderer(TileAversionObelisk.class, sgr);
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockSpawnGuard), sgr);
ObeliskSpecialRenderer<TileExperienceObelisk> eor = new ObeliskSpecialRenderer<TileExperienceObelisk>(
ObeliskSpecialRenderer<TileExperienceObelisk> eor = new ObeliskSpecialRenderer<>(
new ItemStack(EnderIO.itemXpTransfer),
defaultObeliskRenderer);
ClientRegistry.bindTileEntitySpecialRenderer(TileExperienceObelisk.class, eor);
@@ -305,7 +289,7 @@ public class ClientProxy extends CommonProxy {
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockWeatherObelisk), twr);
BlockCombustionGenerator.renderId = RenderingRegistry.getNextAvailableRenderId();
TechneMachineRenderer<TileCombustionGenerator> cr = new TechneMachineRenderer<TileCombustionGenerator>(
TechneMachineRenderer<TileCombustionGenerator> cr = new TechneMachineRenderer<>(
EnderIO.blockCombustionGenerator,
"models/combustionGen");
RenderingRegistry.registerBlockHandler(cr);
@@ -321,7 +305,7 @@ public class ClientProxy extends CommonProxy {
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockKillerJoe), kjr);
BlockVat.renderId = RenderingRegistry.getNextAvailableRenderId();
TechneMachineRenderer<TileVat> vr = new TechneMachineRenderer<TileVat>(EnderIO.blockVat, "models/vat");
TechneMachineRenderer<TileVat> vr = new TechneMachineRenderer<>(EnderIO.blockVat, "models/vat");
RenderingRegistry.registerBlockHandler(vr);
FusedQuartzFrameRenderer fqfr = new FusedQuartzFrameRenderer();
@@ -338,13 +322,6 @@ public class ClientProxy extends CommonProxy {
ClientRegistry.bindTileEntitySpecialRenderer(TileCapBank.class, newCbr);
}
CapacitorBankRenderer capr = new CapacitorBankRenderer();
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockCapacitorBank), capr);
BlockCapacitorBank.renderId = RenderingRegistry.getNextAvailableRenderId();
CapBankRenderer2 cbr2 = new CapBankRenderer2();
RenderingRegistry.registerBlockHandler(cbr2);
BlockVacuumChest.renderId = RenderingRegistry.getNextAvailableRenderId();
VacuumChestRenderer vcr = new VacuumChestRenderer();
RenderingRegistry.registerBlockHandler(vcr);
@@ -387,6 +364,7 @@ public class ClientProxy extends CommonProxy {
TelePadRenderer telePadRenderer = new TelePadRenderer();
RenderingRegistry.registerBlockHandler(telePadRenderer);
ClientRegistry.bindTileEntitySpecialRenderer(TileTelePad.class, new TelePadSpecialRenderer(telePadRenderer));
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockTelePad), telePadRenderer);
MinecraftForgeClient.registerItemRenderer(EnderIO.itemMachinePart, new MachinePartRenderer());
MinecraftForgeClient.registerItemRenderer(EnderIO.itemConduitFacade, new FacadeRenderer());
@@ -394,7 +372,6 @@ public class ClientProxy extends CommonProxy {
cbr = new ConduitBundleRenderer((float) Config.conduitScale);
BlockConduitBundle.rendererId = RenderingRegistry.getNextAvailableRenderId();
RenderingRegistry.registerBlockHandler(cbr);
ClientRegistry.bindTileEntitySpecialRenderer(TileConduitBundle.class, cbr);
ClientRegistry.bindTileEntitySpecialRenderer(TileTravelAnchor.class, new TravelEntitySpecialRenderer());
@@ -403,20 +380,6 @@ public class ClientProxy extends CommonProxy {
RenderingRegistry.registerBlockHandler(esk);
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockEndermanSkull), esk);
conduitRenderers.add(RedstoneSwitchRenderer.getInstance());
conduitRenderers.add(new AdvancedLiquidConduitRenderer());
conduitRenderers.add(LiquidConduitRenderer.create());
conduitRenderers.add(new PowerConduitRenderer());
conduitRenderers.add(new InsulatedRedstoneConduitRenderer());
conduitRenderers.add(new EnderLiquidConduitRenderer());
conduitRenderers.add(new crazypants.enderio.conduit.item.ItemConduitRenderer());
if (GasUtil.isGasConduitEnabled()) {
conduitRenderers.add(new GasConduitRenderer());
}
if (OCUtil.isOCEnabled()) {
conduitRenderers.add(new OCConduitRenderer());
}
EnderIoRenderer eior = new EnderIoRenderer();
ClientRegistry.bindTileEntitySpecialRenderer(TileEnderIO.class, eior);
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(EnderIO.blockEnderIo), eior);
@@ -451,7 +414,7 @@ public class ClientProxy extends CommonProxy {
FMLCommonHandler.instance().bus().register(KeyTracker.instance);
RenderingRegistry.registerEntityRenderingHandler(SoundEntity.class, new SoundRenderer());
RenderingRegistry.registerEntityRenderingHandler(RangeEntity.class, new RangeRenerer());
RenderingRegistry.registerEntityRenderingHandler(RangeEntity.class, new RangeRenderer());
MinecraftForge.EVENT_BUS.register(SoundDetector.instance);
FMLCommonHandler.instance().bus().register(SoundDetector.instance);
@@ -480,12 +443,7 @@ public class ClientProxy extends CommonProxy {
@Override
public ConduitRenderer getRendererForConduit(IConduit conduit) {
for (ConduitRenderer renderer : conduitRenderers) {
if (renderer.isRendererForConduit(conduit)) {
return renderer;
}
}
return dcr;
return conduit.getRenderer();
}
@Override
@@ -1,7 +1,5 @@
package crazypants.enderio;
import java.text.DecimalFormat;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
@@ -9,20 +7,27 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.event.FMLServerAboutToStartEvent;
import cpw.mods.fml.common.event.FMLServerStartedEvent;
import cpw.mods.fml.common.event.FMLServerStoppedEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent.ClientTickEvent;
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
import cpw.mods.fml.common.gameevent.TickEvent.ServerTickEvent;
import crazypants.enderio.conduit.ConduitNetworkTickHandler;
import crazypants.enderio.conduit.IConduit;
import crazypants.enderio.conduit.render.ConduitRenderer;
import crazypants.enderio.machine.hypercube.HyperCubeRegister;
import crazypants.enderio.machine.transceiver.ServerChannelRegister;
import crazypants.enderio.machine.wireless.WirelessChargerController;
public class CommonProxy {
private static final DecimalFormat FORMAT = new DecimalFormat("########0.000");
protected long serverTickCount = 0;
protected long clientTickCount = 0;
protected final TickTimer tickTimer = new TickTimer();
public ConduitNetworkTickHandler conduitNetworkTickHandler = null;
public WirelessChargerController wirelessChargerController = null;
public CommonProxy() {}
@@ -34,6 +39,7 @@ public class CommonProxy {
return null;
}
@Deprecated
public ConduitRenderer getRendererForConduit(IConduit conduit) {
return null;
}
@@ -43,7 +49,7 @@ public class CommonProxy {
}
public void loadIcons() {
;
}
public void load() {
@@ -75,6 +81,26 @@ public class CommonProxy {
return new ResourceLocation(EnderIO.DOMAIN + TEXTURE_PATH + name + TEXTURE_EXT);
}
public void onServerAboutToStart(FMLServerAboutToStartEvent event) {
conduitNetworkTickHandler = new ConduitNetworkTickHandler();
FMLCommonHandler.instance().bus().register(conduitNetworkTickHandler);
wirelessChargerController = new WirelessChargerController();
FMLCommonHandler.instance().bus().register(wirelessChargerController);
}
public void onServerStarted(FMLServerStartedEvent event) {
HyperCubeRegister.load();
ServerChannelRegister.load();
}
public void onServerStopped(FMLServerStoppedEvent event) {
HyperCubeRegister.unload();
FMLCommonHandler.instance().bus().unregister(conduitNetworkTickHandler);
conduitNetworkTickHandler = null;
FMLCommonHandler.instance().bus().unregister(wirelessChargerController);
wirelessChargerController = null;
}
public final class TickTimer {
@SubscribeEvent
+51 -28
View File
@@ -38,6 +38,7 @@ import cpw.mods.fml.common.event.FMLLoadCompleteEvent;
import cpw.mods.fml.common.event.FMLMissingMappingsEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerAboutToStartEvent;
import cpw.mods.fml.common.event.FMLServerStartedEvent;
import cpw.mods.fml.common.event.FMLServerStoppedEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
@@ -46,6 +47,7 @@ import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import crazypants.enderio.api.IMC;
import crazypants.enderio.betterbuilderswands.PaintedCustomMapping;
import crazypants.enderio.block.BlockDarkSteelAnvil;
import crazypants.enderio.block.BlockDarkSteelLadder;
import crazypants.enderio.block.BlockDarkSteelPressurePlate;
@@ -62,6 +64,7 @@ import crazypants.enderio.conduit.item.ItemItemConduit;
import crazypants.enderio.conduit.item.filter.ItemBasicItemFilter;
import crazypants.enderio.conduit.item.filter.ItemBigItemFilter;
import crazypants.enderio.conduit.item.filter.ItemExistingItemFilter;
import crazypants.enderio.conduit.item.filter.ItemLimitedItemFilter;
import crazypants.enderio.conduit.item.filter.ItemModItemFilter;
import crazypants.enderio.conduit.item.filter.ItemPowerItemFilter;
import crazypants.enderio.conduit.liquid.ItemLiquidConduit;
@@ -110,7 +113,6 @@ import crazypants.enderio.machine.generator.zombie.BlockZombieGenerator.BlockEnd
import crazypants.enderio.machine.generator.zombie.BlockZombieGenerator.BlockFrankenZombieGenerator;
import crazypants.enderio.machine.generator.zombie.PacketNutrientTank;
import crazypants.enderio.machine.hypercube.BlockHyperCube;
import crazypants.enderio.machine.hypercube.HyperCubeRegister;
import crazypants.enderio.machine.invpanel.BlockInventoryPanel;
import crazypants.enderio.machine.killera.BlockKillerJoe;
import crazypants.enderio.machine.light.BlockElectricLight;
@@ -131,7 +133,6 @@ import crazypants.enderio.machine.painter.BlockPaintedStair;
import crazypants.enderio.machine.painter.BlockPaintedWall;
import crazypants.enderio.machine.painter.BlockPainter;
import crazypants.enderio.machine.painter.PaintSourceValidator;
import crazypants.enderio.machine.power.BlockCapacitorBank;
import crazypants.enderio.machine.ranged.RangeEntity;
import crazypants.enderio.machine.reservoir.BlockReservoir;
import crazypants.enderio.machine.slicensplice.BlockSliceAndSplice;
@@ -181,18 +182,24 @@ import crazypants.enderio.thaumcraft.ThaumcraftCompat;
import crazypants.enderio.tool.EnderIOCrashCallable;
import crazypants.util.EE3Util;
@Mod(
modid = MODID,
name = MOD_NAME,
version = VERSION,
dependencies = "after:endercore;after:MineFactoryReloaded;after:Forestry;after:Waila@[1.5.8,);after:Thaumcraft;after:appliedenergistics2@[rv2-beta-8,);after:chisel",
guiFactory = "crazypants.enderio.config.ConfigFactoryEIO")
@Mod(modid = MODID, name = MOD_NAME, version = VERSION, dependencies = """
required-after:CoFHLib@[1.7.10R1.0.3B3,);\
required-after:endercore;\
required-after:gtnhlib@[0.9.47,);\
after:MineFactoryReloaded;\
after:Forestry;\
after:Waila@[1.5.8,);\
after:Thaumcraft;\
after:appliedenergistics2@[rv2-beta-8,);\
after:Railcraft@[9.16.7,);\
after:betterbuilderswands@[0.13.12,)\
""", guiFactory = "crazypants.enderio.config.ConfigFactoryEIO")
public class EnderIO {
public static final String MODID = "EnderIO";
public static final String DOMAIN = MODID.toLowerCase(Locale.US);
public static final String MOD_NAME = "Ender IO";
public static final String VERSION = "GRADLETOKEN_VERSION";
public static final String VERSION = Tags.VERSION;
@Instance(MODID)
public static EnderIO instance;
@@ -207,6 +214,11 @@ public class EnderIO {
public static final Lang lang = new Lang("enderio");
public static final boolean hasLwjgl3 = Loader.isModLoaded("lwjgl3ify");
public static final boolean hasGT5 = Loader.isModLoaded("gregtech") && !Loader.isModLoaded("gregapi");
public static final boolean hasHP = Loader.isModLoaded("hodgepodge");
public static final boolean hasEtFuturum = Loader.isModLoaded("etfuturum");
public static final boolean hasWailaPlugins = Loader.isModLoaded("wailaplugins");
public static final boolean hasAutomagy = Loader.isModLoaded("Automagy");
// Materials
public static ItemCapacitor itemBasicCapacitor;
@@ -263,6 +275,7 @@ public class EnderIO {
public static ItemBasicItemFilter itemBasicFilterUpgrade;
public static ItemBigItemFilter itemBigFilterUpgrade;
public static ItemExistingItemFilter itemExistingItemFilter;
public static ItemLimitedItemFilter itemLimitedItemFilter;
public static ItemModItemFilter itemModItemFilter;
public static ItemPowerItemFilter itemPowerItemFilter;
public static ItemExtractSpeedUpgrade itemExtractSpeedUpgrade;
@@ -277,7 +290,6 @@ public class EnderIO {
public static BlockSolarPanel blockSolarPanel;
public static BlockReservoir blockReservoir;
public static BlockAlloySmelter blockAlloySmelter;
public static BlockCapacitorBank blockCapacitorBank;
public static BlockCapBank blockCapBank;
public static BlockWirelessCharger blockWirelessCharger;
public static BlockCrusher blockCrusher;
@@ -387,7 +399,6 @@ public class EnderIO {
blockCrusher = BlockCrusher.create();
blockAlloySmelter = BlockAlloySmelter.create();
blockCapacitorBank = BlockCapacitorBank.create();
blockCapBank = BlockCapBank.create();
blockPainter = BlockPainter.create();
@@ -468,6 +479,7 @@ public class EnderIO {
itemBasicFilterUpgrade = ItemBasicItemFilter.create();
itemBigFilterUpgrade = ItemBigItemFilter.create();
itemExistingItemFilter = ItemExistingItemFilter.create();
itemLimitedItemFilter = ItemLimitedItemFilter.create();
itemModItemFilter = ItemModItemFilter.create();
itemPowerItemFilter = ItemPowerItemFilter.create();
itemExtractSpeedUpgrade = ItemExtractSpeedUpgrade.create();
@@ -480,7 +492,9 @@ public class EnderIO {
itemGrindingBall = ItemGrindingBall.create();
itemAlloyEndergy = ItemAlloyEndergy.create();
itemGrindingBallEndergy = ItemGrindingBallEndergy.create();
itemPowderIngot = ItemPowderIngot.create();
if (!hasGT5) {
itemPowderIngot = ItemPowderIngot.create();
}
registerFluids();
@@ -720,7 +734,9 @@ public class EnderIO {
SkeletonHandler.registerSkeleton(this);
}
MaterialRecipes.registerDependantOresInDictionary();
if (!hasGT5) {
MaterialRecipes.registerDependantOresInDictionary();
}
EnderfaceRecipes.addRecipes();
MaterialRecipes.addRecipes();
@@ -787,7 +803,7 @@ public class EnderIO {
@EventHandler
public void loadComplete(FMLLoadCompleteEvent event) {
processImc(FMLInterModComms.fetchRuntimeMessages(this)); // Some mods send IMCs during PostInit, so we catch
// them here.
// them here.
}
private static String getXPJuiceName() {
@@ -806,7 +822,6 @@ public class EnderIO {
return Config.xpJuiceName;
}
@SuppressWarnings("unchecked")
private void addModIntegration() {
if (Loader.isModLoaded("TConstruct")) {
@@ -817,6 +832,7 @@ public class EnderIO {
Class<?> modFluxClass = Class.forName("tconstruct.modifiers.tools.ModFlux");
Field batteriesField = modFluxClass.getField("batteries");
@SuppressWarnings("unchecked")
List<ItemStack> batteries = (List<ItemStack>) batteriesField.get(modFluxInst);
batteries.add(new ItemStack(blockCapBank));
Log.info("Registered Capacitor Banks as Tinkers Construct Flux Upgrades");
@@ -825,6 +841,9 @@ public class EnderIO {
Log.info("Failed to registered Capacitor Banks as Tinkers Construct Flux Upgrades");
}
}
if (Loader.isModLoaded("betterbuilderswands")) {
PaintedCustomMapping.registerMappings();
}
ThaumcraftCompat.load();
}
@@ -883,22 +902,18 @@ public class EnderIO {
}
@EventHandler
public void serverStarted(FMLServerStartedEvent event) {
HyperCubeRegister.load();
ServerChannelRegister.load();
}
@SubscribeEvent
public void worldSaved(WorldEvent.Save event) {
// Only save together with the overworld, because this gets called for every dimension separately
if (event.world.provider != null && event.world.provider.dimensionId == 0) {
ServerChannelRegister.store();
}
public void onServerAboutToStart(FMLServerAboutToStartEvent event) {
proxy.onServerAboutToStart(event);
}
@EventHandler
public void serverStopped(FMLServerStoppedEvent event) {
HyperCubeRegister.unload();
public void onServerStarted(FMLServerStartedEvent event) {
proxy.onServerStarted(event);
}
@EventHandler
public void onServerStopped(FMLServerStoppedEvent event) {
proxy.onServerStopped(event);
}
@EventHandler
@@ -910,4 +925,12 @@ public class EnderIO {
}
}
}
@SubscribeEvent
public void worldSaved(WorldEvent.Save event) {
// Only save together with the overworld, because this gets called for every dimension separately
if (event.world.provider != null && event.world.provider.dimensionId == 0) {
ServerChannelRegister.store();
}
}
}
@@ -60,7 +60,7 @@ public class GuiHandler implements IGuiHandler {
public static final int GUI_ID_CAP_BANK = 142; // leave room for more machines
protected final Map<Integer, IGuiHandler> guiHandlers = new HashMap<Integer, IGuiHandler>();
protected final Map<Integer, IGuiHandler> guiHandlers = new HashMap<>();
public void registerGuiHandler(int id, IGuiHandler handler) {
guiHandlers.put(id, handler);
@@ -2,10 +2,13 @@ package crazypants.enderio;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.Marker;
import org.apache.logging.log4j.MarkerManager;
public final class Log {
public static final Logger LOGGER = LogManager.getLogger(EnderIO.MODID);
public static final Marker securityMarker = MarkerManager.getMarker("SuspiciousPackets");
public static void warn(String msg) {
LOGGER.warn(msg);
@@ -18,6 +18,7 @@ public enum ModObject {
itemBasicFilterUpgrade,
itemBigFilterUpgrade,
itemExistingItemFilter,
itemLimitedItemFilter,
itemModItemFilter,
itemPowerItemFilter,
itemExtractSpeedUpgrade,
@@ -54,7 +55,6 @@ public enum ModObject {
blockReservoir,
blockAlloySmelter,
blockSolarPanel,
blockCapacitorBank,
blockCapBank,
blockSagMill,
blockHyperCube,
@@ -4,10 +4,20 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import cofh.api.energy.IEnergyContainerItem;
import crazypants.enderio.config.Config;
public interface IItemOfTravel extends IEnergyContainerItem {
boolean isActive(EntityPlayer ep, ItemStack equipped);
void extractInternal(ItemStack equipped, int power);
/**
* @param equipped player who is currently holding this item. caller will ensure the item held has your Item as item
* type
* @return -1 if method not supported, or max(can extract, power), e.g. 0 if item is empty.
*/
default int canExtractInternal(ItemStack equipped, int power) {
return Config.strictTPItemChecking ? 0 : -1;
}
}
@@ -94,11 +94,10 @@ public interface ITelePad extends ITravelAccessable {
/**
* Util method to set all coords using a {@link BlockCoord} object.
*
* @param coords The coords to set this telepad to.
* @see #setX(int)
* @see #setY(int)
* @see #setZ(int)
*
* @param coords The coords to set this telepad to.
*/
void setCoords(BlockCoord coords);
@@ -8,6 +8,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import com.enderio.core.common.util.BlockCoord;
import crazypants.util.UserIdent;
public interface ITravelAccessable {
@@ -14,9 +14,8 @@ import cpw.mods.fml.common.eventhandler.Cancelable;
* <li>Staff of travelling</li>
* <li>Telepad</li>
* </ul>
*
* <p>
* As well as any externally added teleports, assuming they fire this event manually.
*
*/
@Cancelable
public class TeleportEntityEvent extends EntityEvent {
@@ -81,7 +81,7 @@ public enum TravelSource {
return 0;
}
TravelSource source = TravelController.instance.getTravelItemTravelSource(player);
TravelSource source = TravelController.instance.getTravelItemTravelSource(player, false);
if (source == null) {
return TravelSource.BLOCK.getMaxDistanceTravelledSq();
} else {
@@ -0,0 +1,101 @@
package crazypants.enderio.betterbuilderswands;
import java.util.function.BiFunction;
import java.util.function.IntFunction;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import com.github.bsideup.jabel.Desugar;
import crazypants.enderio.EnderIO;
import crazypants.enderio.machine.painter.BlockPaintedCarpet;
import crazypants.enderio.machine.painter.BlockPaintedFence;
import crazypants.enderio.machine.painter.BlockPaintedFenceGate;
import crazypants.enderio.machine.painter.BlockPaintedGlowstone;
import crazypants.enderio.machine.painter.BlockPaintedSlab;
import crazypants.enderio.machine.painter.BlockPaintedStair;
import crazypants.enderio.machine.painter.BlockPaintedWall;
import crazypants.enderio.machine.painter.TileEntityPaintedBlock;
import portablejim.bbw.BetterBuildersWandsMod;
import portablejim.bbw.basics.Point3d;
import portablejim.bbw.core.conversion.ICustomMapping;
import portablejim.bbw.shims.IPlayerShim;
import portablejim.bbw.shims.IWorldShim;
@Desugar
public record PaintedCustomMapping(Block lookBlock, BiFunction<Block, Integer, ItemStack> itemStackGetter, int meta)
implements ICustomMapping {
@Override
public Block getLookBlock() {
return lookBlock;
}
@Override
public int getMeta() {
return meta;
}
@Override
public ItemStack getItems(IWorldShim world, IPlayerShim player, Point3d point) {
if (world.getTile(point) instanceof TileEntityPaintedBlock painted) {
return itemStackGetter.apply(painted.getSourceBlock(), painted.getSourceBlockMetadata());
}
return null;
}
@Override
public boolean shouldCopyTileNBT() {
return true;
}
public static void registerMappings() {
register(
i -> new PaintedCustomMapping(
EnderIO.blockPaintedGlowstone,
BlockPaintedGlowstone::createItemStackForSourceBlock,
i));
register(
i -> new PaintedCustomMapping(
EnderIO.blockPaintedStair,
BlockPaintedStair::createItemStackForSourceBlock,
i));
register(
i -> new PaintedCustomMapping(
EnderIO.blockPaintedFence,
BlockPaintedFence::createItemStackForSourceBlock,
i));
register(
i -> new PaintedCustomMapping(
EnderIO.blockPaintedFenceGate,
BlockPaintedFenceGate::createItemStackForSourceBlock,
i));
register(
i -> new PaintedCustomMapping(
EnderIO.blockPaintedCarpet,
BlockPaintedCarpet::createItemStackForSourceBlock,
i));
register(
i -> new PaintedCustomMapping(
EnderIO.blockPaintedSlab,
BlockPaintedSlab::createItemStackForSourceBlock,
i));
register(
i -> new PaintedCustomMapping(
EnderIO.blockPaintedWall,
BlockPaintedWall::createItemStackForSourceBlock,
i));
register(
i -> new PaintedCustomMapping(
EnderIO.blockPaintedDoubleSlab,
BlockPaintedSlab::createItemStackForSourceBlock,
i));
}
private static void register(IntFunction<ICustomMapping> mapping) {
for (int i = 0; i < 16; i++) {
BetterBuildersWandsMod.instance.mappingManager.setMapping(mapping.apply(i));
}
}
}
@@ -148,10 +148,9 @@ public class BlockDarkSteelPressurePlate extends BlockPressurePlate
return super.colorMultiplier(world, x, y, z);
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
@SideOnly(Side.CLIENT)
public void getSubBlocks(Item arg0, CreativeTabs arg1, List items) {
public void getSubBlocks(Item arg0, CreativeTabs arg1, List<ItemStack> items) {
items.add(new ItemStack(this, 1, 0));
items.add(new ItemStack(this, 1, 1));
}
@@ -16,14 +16,10 @@ import crazypants.enderio.config.Config;
public class ContainerDarkSteelAnvil extends ContainerRepair {
private int x, y, z;
private final int x;
private final int y;
private final int z;
private final Field _outputSlot = ReflectionHelper.findField(ContainerRepair.class, "outputSlot", "field_82852_f");
private final Field _inputSlots = ReflectionHelper.findField(ContainerRepair.class, "inputSlots", "field_82853_g");
private final Field _materialCost = ReflectionHelper
.findField(ContainerRepair.class, "materialCost", "stackSizeToBeUsedInRepair", "field_82856_l");
@SuppressWarnings("unchecked")
public ContainerDarkSteelAnvil(InventoryPlayer playerInv, final World world, final int x, final int y, final int z,
EntityPlayer player) {
super(playerInv, world, x, y, z, player);
@@ -32,8 +28,12 @@ public class ContainerDarkSteelAnvil extends ContainerRepair {
final int materialCost;
try {
Field _outputSlot = ReflectionHelper.findField(ContainerRepair.class, "outputSlot", "field_82852_f");
outputSlot = (IInventory) _outputSlot.get(this);
Field _inputSlots = ReflectionHelper.findField(ContainerRepair.class, "inputSlots", "field_82853_g");
inputSlots = (IInventory) _inputSlots.get(this);
Field _materialCost = ReflectionHelper
.findField(ContainerRepair.class, "materialCost", "stackSizeToBeUsedInRepair", "field_82856_l");
materialCost = _materialCost.getInt(this);
} catch (Exception e) {
throw new RuntimeException(e);
@@ -9,11 +9,6 @@ import java.util.Iterator;
import java.util.List;
import java.util.Set;
import mods.immibis.microblocks.api.EnumPartClass;
import mods.immibis.microblocks.api.EnumPosition;
import mods.immibis.microblocks.api.IMicroblockCoverSystem;
import mods.immibis.microblocks.api.Part;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
@@ -52,6 +47,11 @@ import crazypants.enderio.conduit.power.IPowerConduit;
import crazypants.enderio.conduit.power.PowerConduitNetwork;
import crazypants.enderio.conduit.redstone.IRedstoneConduit;
import crazypants.enderio.conduit.redstone.RedstoneConduitNetwork;
import crazypants.util.ForgeDirections;
import mods.immibis.microblocks.api.EnumPartClass;
import mods.immibis.microblocks.api.EnumPosition;
import mods.immibis.microblocks.api.IMicroblockCoverSystem;
import mods.immibis.microblocks.api.Part;
public abstract class AbstractConduit implements IConduit {
@@ -73,8 +73,7 @@ public abstract class AbstractConduit implements IConduit {
protected List<CollidableComponent> collidables;
protected final EnumMap<ForgeDirection, ConnectionMode> conectionModes = new EnumMap<ForgeDirection, ConnectionMode>(
ForgeDirection.class);
protected final EnumMap<ForgeDirection, ConnectionMode> conectionModes = new EnumMap<>(ForgeDirection.class);
protected boolean collidablesDirty = true;
@@ -84,6 +83,18 @@ public abstract class AbstractConduit implements IConduit {
protected boolean connectionsDirty = true;
/**
* This shows if the currently running connection update should not finish with settings connectionsDirty to false.
* If this is true, it will trigger a reconnection on the next Tick.
* <p>
* Use the method needUpdateConnections() instead of setting this to true.
*
* @see needUpdateConnections()
*/
private boolean needUpdateConnections = false;
private boolean isUpdatingConnections = false;
protected AbstractConduit() {}
@Override
@@ -107,7 +118,7 @@ public abstract class AbstractConduit implements IConduit {
return false;
}
if (dataRoot.hasKey("connectionMode")) {
ConnectionMode mode = ConnectionMode.values()[dataRoot.getShort("connectionMode")];
ConnectionMode mode = ConnectionMode.VALUES[dataRoot.getShort("connectionMode")];
setConnectionMode(dir, mode);
}
readTypeSettings(dir, dataRoot);
@@ -371,13 +382,13 @@ public abstract class AbstractConduit implements IConduit {
conduitConnections.clear();
int[] dirs = nbtRoot.getIntArray("connections");
for (int i = 0; i < dirs.length; i++) {
conduitConnections.add(ForgeDirection.values()[dirs[i]]);
conduitConnections.add(ForgeDirections.DIRECTIONS[dirs[i]]);
}
externalConnections.clear();
dirs = nbtRoot.getIntArray("externalConnections");
for (int i = 0; i < dirs.length; i++) {
externalConnections.add(ForgeDirection.values()[dirs[i]]);
externalConnections.add(ForgeDirections.DIRECTIONS[dirs[i]]);
}
active = nbtRoot.getBoolean("signalActive");
@@ -386,7 +397,7 @@ public abstract class AbstractConduit implements IConduit {
if (modes != null && modes.length == 6) {
int i = 0;
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
conectionModes.put(dir, ConnectionMode.values()[modes[i]]);
conectionModes.put(dir, ConnectionMode.VALUES[modes[i]]);
i++;
}
}
@@ -434,12 +445,15 @@ public abstract class AbstractConduit implements IConduit {
}
private void updateConnections() {
if (!connectionsDirty) {
if (!connectionsDirty && !needUpdateConnections) {
return;
}
isUpdatingConnections = true;
needUpdateConnections = false;
boolean externalConnectionsChanged = false;
List<ForgeDirection> copy = new ArrayList<ForgeDirection>(externalConnections);
List<ForgeDirection> copy = new ArrayList<>(externalConnections);
// remove any no longer valid connections
for (ForgeDirection dir : copy) {
if (!canConnectToExternal(dir, false)) {
@@ -462,6 +476,21 @@ public abstract class AbstractConduit implements IConduit {
}
connectionsDirty = false;
isUpdatingConnections = false;
}
/**
* This method prevents connection update from getting completed successfully by not settings connectionsDirty to
* false. This will trigger an connection update at the next Tick.
* <p>
* Only use this while executing updateConnections().
* <p>
* See this PR for more info: https://github.com/GTNewHorizons/EnderIO/pull/111
*/
protected void needUpdateConnections() {
if (isUpdatingConnections) {
needUpdateConnections = true;
}
}
@Override
@@ -604,7 +633,7 @@ public abstract class AbstractConduit implements IConduit {
return collidables;
}
List<CollidableComponent> result = new ArrayList<CollidableComponent>();
List<CollidableComponent> result = new ArrayList<>();
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
Collection<CollidableComponent> col = getCollidables(dir);
if (col != null) {
@@ -7,10 +7,12 @@ import java.util.List;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import crazypants.enderio.EnderIO;
// I=base type, I is the base class of the implementations accepted by the network
public abstract class AbstractConduitNetwork<T extends IConduit, I extends T> {
protected final List<I> conduits = new ArrayList<I>();
protected final List<I> conduits = new ArrayList<>();
protected final Class<I> implClass;
protected final Class<T> baseConduitClass;
@@ -64,7 +66,7 @@ public abstract class AbstractConduitNetwork<T extends IConduit, I extends T> {
public void addConduit(I con) {
if (!conduits.contains(con)) {
if (conduits.isEmpty()) {
ConduitNetworkTickHandler.instance.registerNetwork(this);
EnderIO.proxy.conduitNetworkTickHandler.registerNetwork(this);
}
conduits.add(con);
}
@@ -75,7 +77,7 @@ public abstract class AbstractConduitNetwork<T extends IConduit, I extends T> {
con.setNetwork(null);
}
conduits.clear();
ConduitNetworkTickHandler.instance.unregisterNetwork(this);
EnderIO.proxy.conduitNetworkTickHandler.unregisterNetwork(this);
}
public List<I> getConduits() {
@@ -2,11 +2,6 @@ package crazypants.enderio.conduit;
import java.util.List;
import mods.immibis.microblocks.api.IMicroblockCoverSystem;
import mods.immibis.microblocks.api.IMicroblockSupporterTile;
import mods.immibis.microblocks.api.MicroblockAPIUtils;
import mods.immibis.microblocks.api.Part;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
@@ -29,6 +24,11 @@ import cpw.mods.fml.relauncher.SideOnly;
import crazypants.enderio.EnderIO;
import crazypants.enderio.EnderIOTab;
import crazypants.enderio.ModObject;
import crazypants.util.ForgeDirections;
import mods.immibis.microblocks.api.IMicroblockCoverSystem;
import mods.immibis.microblocks.api.IMicroblockSupporterTile;
import mods.immibis.microblocks.api.MicroblockAPIUtils;
import mods.immibis.microblocks.api.Part;
public abstract class AbstractItemConduit extends Item implements IConduitItem {
@@ -68,7 +68,6 @@ public abstract class AbstractItemConduit extends Item implements IConduitItem {
if (MicroblocksUtil.supportMicroblocks() && tryAddToMicroblocks(stack, player, world, x, y, z, side)) {
return true;
}
BlockCoord placeAt = Util.canPlaceItem(stack, EnderIO.blockConduitBundle, player, world, x, y, z, side);
if (placeAt != null) {
if (!world.isRemote) {
@@ -85,10 +84,8 @@ public abstract class AbstractItemConduit extends Item implements IConduitItem {
stack.stackSize--;
}
return true;
} else {
ForgeDirection dir = ForgeDirection.values()[side];
ForgeDirection dir = ForgeDirections.DIRECTIONS[side];
int placeX = x + dir.offsetX;
int placeY = y + dir.offsetY;
int placeZ = z + dir.offsetZ;
@@ -117,7 +114,6 @@ public abstract class AbstractItemConduit extends Item implements IConduitItem {
}
}
}
return false;
}
@@ -163,8 +159,7 @@ public abstract class AbstractItemConduit extends Item implements IConduitItem {
System.out.println("AbstractItemConduit.onItemUse: Conduit null.");
return false;
}
bundle.removeConduit(existingConduit);
bundle.addConduit(newConduit);
bundle.replaceConduit(existingConduit, newConduit);
if (!player.capabilities.isCreativeMode) {
stack.stackSize--;
for (ItemStack drop : existingConduit.getDrops()) {
@@ -196,9 +191,8 @@ public abstract class AbstractItemConduit extends Item implements IConduitItem {
}
@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
@SideOnly(Side.CLIENT)
public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List<ItemStack> par3List) {
for (int j = 0; j < subtypes.length; ++j) {
par3List.add(new ItemStack(this, 1, j));
}
@@ -6,9 +6,6 @@ import java.util.Iterator;
import java.util.List;
import java.util.Random;
import mods.immibis.core.api.multipart.IMultipartRenderingBlockMarker;
import mods.immibis.core.api.multipart.IMultipartSystem;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.ISound;
@@ -31,14 +28,10 @@ import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.event.entity.PlaySoundAtEntityEvent;
import net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed;
import powercrystals.minefactoryreloaded.api.rednet.IRedNetOmniNode;
import powercrystals.minefactoryreloaded.api.rednet.connectivity.RedNetConnectionType;
import com.enderio.core.client.render.BoundingBox;
import com.enderio.core.common.util.BlockCoord;
import com.enderio.core.common.util.Util;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.common.Optional.Interface;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
@@ -53,7 +46,13 @@ import crazypants.enderio.api.tool.ITool;
import crazypants.enderio.conduit.facade.ItemConduitFacade.FacadeType;
import crazypants.enderio.conduit.geom.CollidableComponent;
import crazypants.enderio.conduit.geom.ConduitConnectorType;
import crazypants.enderio.conduit.gui.*;
import crazypants.enderio.conduit.gui.ExternalConnectionContainer;
import crazypants.enderio.conduit.gui.GuiExternalConnection;
import crazypants.enderio.conduit.gui.GuiExternalConnectionSelector;
import crazypants.enderio.conduit.gui.PacketFluidChannel;
import crazypants.enderio.conduit.gui.PacketFluidFilter;
import crazypants.enderio.conduit.gui.PacketOpenConduitUI;
import crazypants.enderio.conduit.gui.PacketSlotVisibility;
import crazypants.enderio.conduit.gui.item.PacketExistingItemFilterSnapshot;
import crazypants.enderio.conduit.gui.item.PacketModItemFilter;
import crazypants.enderio.conduit.liquid.PacketFluidLevel;
@@ -72,7 +71,12 @@ import crazypants.enderio.item.ItemConduitProbe;
import crazypants.enderio.machine.painter.PainterUtil;
import crazypants.enderio.network.PacketHandler;
import crazypants.enderio.tool.ToolUtil;
import crazypants.util.ForgeDirections;
import crazypants.util.IFacade;
import mods.immibis.core.api.multipart.IMultipartRenderingBlockMarker;
import mods.immibis.core.api.multipart.IMultipartSystem;
import powercrystals.minefactoryreloaded.api.rednet.IRedNetOmniNode;
import powercrystals.minefactoryreloaded.api.rednet.connectivity.RedNetConnectionType;
@Optional.InterfaceList({
@Interface(
@@ -89,9 +93,6 @@ public class BlockConduitBundle extends BlockEio
public static BlockConduitBundle create() {
MinecraftForge.EVENT_BUS.register(ConduitNetworkTickHandler.instance);
FMLCommonHandler.instance().bus().register(ConduitNetworkTickHandler.instance);
PacketHandler.INSTANCE
.registerMessage(PacketFluidLevel.class, PacketFluidLevel.class, PacketHandler.nextID(), Side.CLIENT);
PacketHandler.INSTANCE
@@ -156,7 +157,6 @@ public class BlockConduitBundle extends BlockEio
BlockConduitBundle result = new BlockConduitBundle();
result.init();
MinecraftForge.EVENT_BUS.register(result);
return result;
}
@@ -288,41 +288,6 @@ public class BlockConduitBundle extends BlockEio
effectRenderer.addEffect(digFX);
}
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onPlaySound(PlaySoundSourceEvent event) {
String path = event.sound.getPositionedSoundLocation().getResourcePath();
if ("silence.step".equals(path)) {
ISound snd = event.sound;
World world = EnderIO.proxy.getClientWorld();
BlockCoord bc = new BlockCoord(snd.getXPosF(), snd.getYPosF(), snd.getZPosF());
TileEntity te = bc.getTileEntity(world);
if (te instanceof TileConduitBundle && ((TileConduitBundle) te).hasFacade()) {
Block facade = getFacade(world, bc.x, bc.y, bc.z, -1);
ConduitUtil.playHitSound(facade.stepSound, world, bc.x, bc.y, bc.z);
} else {
ConduitUtil.playHitSound(Block.soundTypeMetal, world, bc.x, bc.y, bc.z);
}
}
}
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onPlaySoundAtEntity(PlaySoundAtEntityEvent event) {
String path = event.name;
World world = event.entity.worldObj;
if ("EnderIO:silence.step".equals(path) && world.isRemote) {
BlockCoord bc = new BlockCoord(event.entity.posX, event.entity.posY - 2, event.entity.posZ);
TileEntity te = bc.getTileEntity(world);
if (te instanceof TileConduitBundle && ((TileConduitBundle) te).hasFacade()) {
Block facade = getFacade(world, bc.x, bc.y, bc.z, -1);
ConduitUtil.playStepSound(facade.stepSound, world, bc.x, bc.y, bc.z);
} else {
ConduitUtil.playStepSound(Block.soundTypeMetal, world, bc.x, bc.y, bc.z);
}
}
}
@Override
protected void init() {
super.init();
@@ -330,6 +295,7 @@ public class BlockConduitBundle extends BlockEio
EnderIO.guiHandler.registerGuiHandler(GuiHandler.GUI_ID_EXTERNAL_CONNECTION_BASE + dir.ordinal(), this);
}
EnderIO.guiHandler.registerGuiHandler(GuiHandler.GUI_ID_EXTERNAL_CONNECTION_SELECTOR, this);
MinecraftForge.EVENT_BUS.register(new EventHandler());
}
@Override
@@ -469,24 +435,6 @@ public class BlockConduitBundle extends BlockEio
: resist;
}
@SubscribeEvent
public void onBreakSpeed(BreakSpeed event) {
if (event.block == this) {
ItemStack held = event.entityPlayer.getCurrentEquippedItem();
if (held == null || held.getItem().getHarvestLevel(held, "pickaxe") == -1) {
event.newSpeed += 2;
}
IConduitBundle te = (IConduitBundle) event.entity.worldObj.getTileEntity(event.x, event.y, event.z);
if (te != null && te.getFacadeType() == FacadeType.HARDENED) {
if (!ConduitUtil.isSolidFacadeRendered(te, event.entityPlayer)) {
event.newSpeed *= 6;
} else {
event.newSpeed *= 2;
}
}
}
}
@Override
@SideOnly(Side.CLIENT)
public int getRenderBlockPass() {
@@ -532,7 +480,7 @@ public class BlockConduitBundle extends BlockEio
IConduitBundle te = (IConduitBundle) rte;
boolean breakBlock = true;
List<ItemStack> drop = new ArrayList<ItemStack>();
List<ItemStack> drop = new ArrayList<>();
if (ConduitUtil.isSolidFacadeRendered(te, player)) {
breakBlock = false;
ItemStack fac = new ItemStack(EnderIO.itemConduitFacade, 1, te.getFacadeType().ordinal());
@@ -590,7 +538,7 @@ public class BlockConduitBundle extends BlockEio
if (type == null) {
// broke a conector so drop any conduits with no connections as there
// is no other way to remove these
List<IConduit> cons = new ArrayList<IConduit>(te.getConduits());
List<IConduit> cons = new ArrayList<>(te.getConduits());
boolean droppedUnconected = false;
for (IConduit con : cons) {
if (con.getConduitConnections().isEmpty() && con.getExternalConnections().isEmpty()
@@ -637,8 +585,8 @@ public class BlockConduitBundle extends BlockEio
@Override
public void onBlockClicked(World world, int x, int y, int z, EntityPlayer player) {
ItemStack equipped = player.getCurrentEquippedItem();
if (!player.isSneaking() || equipped == null || equipped.getItem() != EnderIO.itemYetaWench) {
ITool tool = ToolUtil.getEquippedTool(player);
if (!player.isSneaking() || tool == null || !tool.canUse(player.getCurrentEquippedItem(), player, x, y, z)) {
return;
}
ConduitUtil.openConduitGui(world, x, y, z, player);
@@ -823,7 +771,7 @@ public class BlockConduitBundle extends BlockEio
bundle.setFacadeId(facadeID);
bundle.setFacadeMetadata(facadeMeta);
bundle.setFacadeType(FacadeType.values()[facadeType]);
bundle.setFacadeType(FacadeType.VALUES[facadeType]);
if (!world.isRemote) {
ConduitUtil.playPlaceSound(facadeID.stepSound, world, x, y, z);
}
@@ -872,7 +820,7 @@ public class BlockConduitBundle extends BlockEio
return new ExternalConnectionContainer(
player.inventory,
(IConduitBundle) te,
ForgeDirection.values()[id - GuiHandler.GUI_ID_EXTERNAL_CONNECTION_BASE]);
ForgeDirections.DIRECTIONS[id - GuiHandler.GUI_ID_EXTERNAL_CONNECTION_BASE]);
}
return null;
}
@@ -887,7 +835,7 @@ public class BlockConduitBundle extends BlockEio
return new GuiExternalConnection(
player.inventory,
(IConduitBundle) te,
ForgeDirection.values()[id - GuiHandler.GUI_ID_EXTERNAL_CONNECTION_BASE]);
ForgeDirections.DIRECTIONS[id - GuiHandler.GUI_ID_EXTERNAL_CONNECTION_BASE]);
}
return null;
}
@@ -919,7 +867,7 @@ public class BlockConduitBundle extends BlockEio
@Override
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB axisalignedbb,
@SuppressWarnings("rawtypes") List arraylist, Entity par7Entity) {
List<AxisAlignedBB> arraylist, Entity par7Entity) {
if (MicroblocksUtil.supportMicroblocks()) {
IM__addCollisionBoxesToList(world, x, y, z, axisalignedbb, arraylist, par7Entity);
@@ -1087,7 +1035,7 @@ public class BlockConduitBundle extends BlockEio
return null;
}
IConduitBundle bundle = (IConduitBundle) te;
List<RaytraceResult> hits = new ArrayList<RaytraceResult>();
List<RaytraceResult> hits = new ArrayList<>();
if (player == null) {
player = EnderIO.proxy.getClientPlayer();
@@ -1104,8 +1052,7 @@ public class BlockConduitBundle extends BlockEio
}
} else {
ConduitDisplayMode mode = ConduitUtil.getDisplayMode(player);
Collection<CollidableComponent> components = new ArrayList<CollidableComponent>(
bundle.getCollidableComponents());
Collection<CollidableComponent> components = new ArrayList<>(bundle.getCollidableComponents());
for (CollidableComponent component : components) {
if ((component.conduitType != null || mode == ConduitDisplayMode.ALL)
&& ConduitUtil.renderConduit(player, component.conduitType)) {
@@ -1257,9 +1204,8 @@ public class BlockConduitBundle extends BlockEio
return IMultipartSystem.instance.hook_collisionRayTrace(cur, world, x, y, z, src, dst);
}
@SuppressWarnings({ "rawtypes", "unchecked" })
private void IM__addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB mask, List list,
Entity entity) {
private void IM__addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB mask,
List<AxisAlignedBB> list, Entity entity) {
IMultipartSystem.instance.hook_addCollisionBoxesToList(world, x, y, z, mask, list, entity);
}
@@ -1271,4 +1217,61 @@ public class BlockConduitBundle extends BlockEio
private boolean hasMicroblocks(IConduitBundle bundle) {
return !bundle.getCoverSystem().getAllParts().isEmpty();
}
public class EventHandler {
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onPlaySound(PlaySoundSourceEvent event) {
String path = event.sound.getPositionedSoundLocation().getResourcePath();
if ("silence.step".equals(path)) {
ISound snd = event.sound;
World world = EnderIO.proxy.getClientWorld();
if (world == null) return;
BlockCoord bc = new BlockCoord(snd.getXPosF(), snd.getYPosF(), snd.getZPosF());
TileEntity te = bc.getTileEntity(world);
if (te instanceof TileConduitBundle && ((TileConduitBundle) te).hasFacade()) {
Block facade = getFacade(world, bc.x, bc.y, bc.z, -1);
ConduitUtil.playHitSound(facade.stepSound, world, bc.x, bc.y, bc.z);
} else {
ConduitUtil.playHitSound(Block.soundTypeMetal, world, bc.x, bc.y, bc.z);
}
}
}
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onPlaySoundAtEntity(PlaySoundAtEntityEvent event) {
String path = event.name;
World world = event.entity.worldObj;
if ("EnderIO:silence.step".equals(path) && world.isRemote) {
BlockCoord bc = new BlockCoord(event.entity.posX, event.entity.posY - 2, event.entity.posZ);
TileEntity te = bc.getTileEntity(world);
if (te instanceof TileConduitBundle && ((TileConduitBundle) te).hasFacade()) {
Block facade = getFacade(world, bc.x, bc.y, bc.z, -1);
ConduitUtil.playStepSound(facade.stepSound, world, bc.x, bc.y, bc.z);
} else {
ConduitUtil.playStepSound(Block.soundTypeMetal, world, bc.x, bc.y, bc.z);
}
}
}
@SubscribeEvent
public void onBreakSpeed(BreakSpeed event) {
if (event.block == BlockConduitBundle.this) {
ItemStack held = event.entityPlayer.getCurrentEquippedItem();
if (held == null || held.getItem().getHarvestLevel(held, "pickaxe") == -1) {
event.newSpeed += 2;
}
IConduitBundle te = (IConduitBundle) event.entity.worldObj.getTileEntity(event.x, event.y, event.z);
if (te != null && te.getFacadeType() == FacadeType.HARDENED) {
if (!ConduitUtil.isSolidFacadeRendered(te, event.entityPlayer)) {
event.newSpeed *= 6;
} else {
event.newSpeed *= 2;
}
}
}
}
}
}
@@ -1,6 +1,15 @@
package crazypants.enderio.conduit;
import static crazypants.enderio.gui.IconEIO.*;
import static crazypants.enderio.gui.IconEIO.CROSS;
import static crazypants.enderio.gui.IconEIO.TICK;
import static crazypants.enderio.gui.IconEIO.WRENCH_OVERLAY_FLUID;
import static crazypants.enderio.gui.IconEIO.WRENCH_OVERLAY_FLUID_OFF;
import static crazypants.enderio.gui.IconEIO.WRENCH_OVERLAY_ITEM;
import static crazypants.enderio.gui.IconEIO.WRENCH_OVERLAY_ITEM_OFF;
import static crazypants.enderio.gui.IconEIO.WRENCH_OVERLAY_POWER;
import static crazypants.enderio.gui.IconEIO.WRENCH_OVERLAY_POWER_OFF;
import static crazypants.enderio.gui.IconEIO.WRENCH_OVERLAY_REDSTONE;
import static crazypants.enderio.gui.IconEIO.WRENCH_OVERLAY_REDSTONE_OFF;
import java.util.List;
@@ -55,11 +64,10 @@ public class ConduitDisplayMode {
* Use this constructor if you have custom display logic, it will use {@code IConduit.class} as the conduitType, and
* the passed name as the override name.
*
* @see #ConduitDisplayMode(Class, IWidgetIcon, IWidgetIcon)
*
* @param name The override name.
* @param widgetSelected The widget to render when this type is selected.
* @param widgetUnselected The widget to render when this type is unselected.
* @see #ConduitDisplayMode(Class, IWidgetIcon, IWidgetIcon)
*/
public ConduitDisplayMode(String name, IWidgetIcon widgetSelected, IWidgetIcon widgetUnselected) {
this(IConduit.class, widgetSelected, widgetUnselected);
@@ -188,7 +196,7 @@ public class ConduitDisplayMode {
}
public static Iterable<ConduitDisplayMode> getRenderableModes() {
return FluentIterable.from(registrar).filter(new Predicate<ConduitDisplayMode>() {
return FluentIterable.from(registrar).filter(new Predicate<>() {
@Override
public boolean apply(ConduitDisplayMode input) {
@@ -10,18 +10,15 @@ import cpw.mods.fml.common.gameevent.TickEvent.Phase;
public class ConduitNetworkTickHandler {
public static final ConduitNetworkTickHandler instance = new ConduitNetworkTickHandler();
public interface TickListener {
public static interface TickListener {
void tickStart(TickEvent.ServerTickEvent evt);
public void tickStart(TickEvent.ServerTickEvent evt);
public void tickEnd(TickEvent.ServerTickEvent evt);
void tickEnd(TickEvent.ServerTickEvent evt);
}
private final List<TickListener> listeners = new ArrayList<TickListener>();
private final IdentityHashMap<AbstractConduitNetwork<?, ?>, Boolean> networks = new IdentityHashMap<AbstractConduitNetwork<?, ?>, Boolean>();
private final List<TickListener> listeners = new ArrayList<>();
private final IdentityHashMap<AbstractConduitNetwork<?, ?>, Boolean> networks = new IdentityHashMap<>();
public void addListener(TickListener listener) {
listeners.add(listener);
@@ -1,9 +1,20 @@
package crazypants.enderio.conduit;
import static crazypants.enderio.ModObject.blockPainter;
import static crazypants.enderio.material.Alloy.*;
import static crazypants.enderio.material.Material.*;
import static crazypants.enderio.material.endergy.AlloyEndergy.*;
import static crazypants.enderio.material.Alloy.CONDUCTIVE_IRON;
import static crazypants.enderio.material.Alloy.ELECTRICAL_STEEL;
import static crazypants.enderio.material.Alloy.END_STEEL;
import static crazypants.enderio.material.Alloy.ENERGETIC_ALLOY;
import static crazypants.enderio.material.Alloy.PHASED_GOLD;
import static crazypants.enderio.material.Alloy.REDSTONE_ALLOY;
import static crazypants.enderio.material.Material.CONDUIT_BINDER;
import static crazypants.enderio.material.Material.PHASED_IRON_NUGGET;
import static crazypants.enderio.material.endergy.AlloyEndergy.CRUDE_STEEL;
import static crazypants.enderio.material.endergy.AlloyEndergy.CRYSTALLINE_ALLOY;
import static crazypants.enderio.material.endergy.AlloyEndergy.CRYSTALLINE_PINK_SLIME;
import static crazypants.enderio.material.endergy.AlloyEndergy.ENERGETIC_SILVER;
import static crazypants.enderio.material.endergy.AlloyEndergy.MELODIC_ALLOY;
import static crazypants.enderio.material.endergy.AlloyEndergy.STELLAR_ALLOY;
import static crazypants.util.RecipeUtil.addShaped;
import net.minecraft.init.Blocks;
@@ -590,6 +601,9 @@ public class ConduitRecipes {
'f',
advFilter);
ItemStack limitedFilter = new ItemStack(EnderIO.itemLimitedItemFilter, 1, 0);
addShaped(limitedFilter, " ", "cfc", " ", 'c', new ItemStack(Items.comparator, 1, 0), 'f', advFilter);
ItemStack powerFilt = new ItemStack(EnderIO.itemPowerItemFilter);
addShaped(powerFilt, " p ", "pcp", " p ", 'p', Items.paper, 'c', EnderIO.itemConduitProbe);
@@ -674,7 +688,7 @@ public class ConduitRecipes {
String fluix = "crystalFluix";
String pureFluix = "crystalPureFluix";
ItemStack quartzFiber = AEApi.instance().parts().partQuartzFiber.stack(1).copy();
ItemStack quartzFiber = AEApi.instance().definitions().parts().quartzFiber().maybeStack(1).get().copy();
ItemStack conduitBinder = new ItemStack(EnderIO.itemMaterial, 1, Material.CONDUIT_BINDER.ordinal());
ItemStack res = new ItemStack(EnderIO.itemMEConduit, Config.numConduitsPerRecipe / 2);
@@ -682,6 +696,7 @@ public class ConduitRecipes {
addShaped(res.copy(), "bbb", "fqf", "bbb", 'b', conduitBinder, 'f', pureFluix, 'q', quartzFiber);
res.stackSize = 1;
addShaped(new ItemStack(EnderIO.itemMEConduit, 1, 1), "bCb", "CbC", "bCb", 'b', conduitBinder, 'C', res);
ItemStack resDense = new ItemStack(EnderIO.itemMEConduit, 1, 1);
addShaped(resDense, "bCb", "CbC", "bCb", 'b', conduitBinder, 'C', res);
}
}
@@ -43,7 +43,7 @@ public class ConduitUtil {
public static final Random RANDOM = new Random();
@SuppressWarnings({ "rawtypes", "unchecked" })
@SuppressWarnings("unchecked")
public static void ensureValidNetwork(IConduit conduit) {
TileEntity te = conduit.getBundle().getEntity();
World world = te.getWorldObj();
@@ -54,13 +54,15 @@ public class ConduitUtil {
return;
}
@SuppressWarnings("rawtypes")
AbstractConduitNetwork res = conduit.createNetworkForType();
res.init(conduit.getBundle(), connections, world);
return;
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@SuppressWarnings("unchecked")
private static boolean reuseNetwork(IConduit con, Collection<? extends IConduit> connections, World world) {
@SuppressWarnings("rawtypes")
AbstractConduitNetwork network = null;
for (IConduit conduit : connections) {
if (network == null) {
@@ -92,7 +94,7 @@ public class ConduitUtil {
}
}
if (con.getNetwork() != null) { // this should have been destroyed when destroying the neighbours network but
// lets just make
// lets just make
// sure
con.getNetwork().destroyNetwork();
}
@@ -158,7 +160,7 @@ public class ConduitUtil {
}
public static boolean isFacadeHidden(IConduitBundle bundle, EntityPlayer player) {
return bundle.getFacadeId() != null && shouldHeldItemHideFacades(player);
return bundle != null && bundle.getFacadeId() != null && shouldHeldItemHideFacades(player);
}
public static ConduitDisplayMode getDisplayMode(EntityPlayer player) {
@@ -248,11 +250,11 @@ public class ConduitUtil {
public static <T extends IConduit> Collection<T> getConnectedConduits(World world, int x, int y, int z,
Class<T> type) {
TileEntity te = world.getTileEntity(x, y, z);
TileEntity te = world.blockExists(x, y, z) ? world.getTileEntity(x, y, z) : null;
if (!(te instanceof IConduitBundle)) {
return Collections.emptyList();
}
List<T> result = new ArrayList<T>();
List<T> result = new ArrayList<>();
IConduitBundle root = (IConduitBundle) te;
T con = root.getConduit(type);
if (con != null) {
@@ -318,7 +320,7 @@ public class ConduitUtil {
}
int signalStrength = getInternalSignalForColor(bundle, col);
if (signalStrength < 15 && DyeColor.RED == col && bundle != null && bundle.getEntity() != null) {
if (signalStrength < 15 && bundle != null && bundle.getEntity() != null) {
TileEntity te = bundle.getEntity();
signalStrength = Math
.max(signalStrength, te.getWorldObj().getStrongestIndirectPower(te.xCoord, te.yCoord, te.zCoord));
@@ -361,7 +363,7 @@ public class ConduitUtil {
return;
}
IConduitBundle cb = (IConduitBundle) te;
Set<ForgeDirection> cons = new HashSet<ForgeDirection>();
Set<ForgeDirection> cons = new HashSet<>();
boolean hasInsulated = false;
for (IConduit con : cb.getConduits()) {
cons.addAll(con.getExternalConnections());
@@ -10,6 +10,10 @@ public enum ConnectionMode {
DISABLED("gui.conduit.ioMode.disabled"),
NOT_SET("gui.conduit.ioMode.notSet");
/**
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
*/
public static final ConnectionMode[] VALUES = values();
private final String unlocalisedName;
ConnectionMode(String unlocalisedName) {
@@ -22,19 +26,19 @@ public enum ConnectionMode {
public static ConnectionMode getNext(ConnectionMode mode) {
int ord = mode.ordinal() + 1;
if (ord >= ConnectionMode.values().length) {
if (ord >= ConnectionMode.VALUES.length) {
ord = 0;
}
return ConnectionMode.values()[ord];
return ConnectionMode.VALUES[ord];
}
public static ConnectionMode getPrevious(ConnectionMode mode) {
int ord = mode.ordinal() - 1;
if (ord < 0) {
ord = ConnectionMode.values().length - 1;
ord = ConnectionMode.VALUES.length - 1;
}
return ConnectionMode.values()[ord];
return ConnectionMode.VALUES[ord];
}
public boolean acceptsInput() {
@@ -17,6 +17,7 @@ import com.enderio.core.common.util.BlockCoord;
import crazypants.enderio.conduit.geom.CollidableCache.CacheKey;
import crazypants.enderio.conduit.geom.CollidableComponent;
import crazypants.enderio.conduit.render.ConduitRenderer;
public interface IConduit {
@@ -141,4 +142,6 @@ public interface IConduit {
* Should the texture of the conduit connectors be mirrored around the conduit node?
*/
boolean shouldMirrorTexture();
ConduitRenderer getRenderer();
}
@@ -4,11 +4,6 @@ import java.util.Collection;
import java.util.List;
import java.util.Set;
import li.cil.oc.api.network.Environment;
import li.cil.oc.api.network.SidedEnvironment;
import mekanism.api.gas.IGasHandler;
import mods.immibis.microblocks.api.IMicroblockSupporterTile;
import net.minecraft.block.Block;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
@@ -16,11 +11,10 @@ import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.IFluidHandler;
import appeng.api.networking.IGridHost;
import cofh.api.transport.IItemDuct;
import com.enderio.core.common.util.BlockCoord;
import appeng.api.networking.IGridHost;
import cofh.api.transport.IItemDuct;
import cpw.mods.fml.common.Optional.Interface;
import cpw.mods.fml.common.Optional.InterfaceList;
import cpw.mods.fml.relauncher.Side;
@@ -29,6 +23,10 @@ import crazypants.enderio.conduit.facade.ItemConduitFacade.FacadeType;
import crazypants.enderio.conduit.geom.CollidableComponent;
import crazypants.enderio.conduit.geom.Offset;
import crazypants.enderio.power.IInternalPowerHandler;
import li.cil.oc.api.network.Environment;
import li.cil.oc.api.network.SidedEnvironment;
import mekanism.api.gas.IGasHandler;
import mods.immibis.microblocks.api.IMicroblockSupporterTile;
@InterfaceList({ @Interface(iface = "appeng.api.networking.IGridHost", modid = "appliedenergistics2"),
@Interface(iface = "mekanism.api.gas.IGasHandler", modid = "MekanismAPI|gas"),
@@ -51,6 +49,8 @@ public interface IConduitBundle extends IInternalPowerHandler, IFluidHandler, II
void addConduit(IConduit conduit);
void replaceConduit(IConduit original, IConduit replacement);
void removeConduit(IConduit conduit);
Collection<IConduit> getConduits();
@@ -3,6 +3,7 @@ package crazypants.enderio.conduit;
import net.minecraftforge.common.util.ForgeDirection;
import com.enderio.core.common.util.DyeColor;
import crazypants.enderio.machine.RedstoneControlMode;
public interface IExtractor extends IConduit {
@@ -1,11 +1,10 @@
package crazypants.enderio.conduit;
import mods.immibis.microblocks.api.EnumPosition;
import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Optional.Method;
import mods.immibis.microblocks.api.EnumPosition;
public class MicroblocksUtil {
@@ -33,7 +33,7 @@ public class RaytraceResult {
if (origin == null || toSort == null) {
return;
}
Collections.sort(toSort, new Comparator<RaytraceResult>() {
Collections.sort(toSort, new Comparator<>() {
@Override
public int compare(RaytraceResult o1, RaytraceResult o2) {
@@ -7,19 +7,6 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import li.cil.oc.api.network.*;
import li.cil.oc.api.network.Message;
import li.cil.oc.api.network.Node;
import mekanism.api.gas.Gas;
import mekanism.api.gas.GasStack;
import mods.immibis.microblocks.api.EnumPartClass;
import mods.immibis.microblocks.api.EnumPosition;
import mods.immibis.microblocks.api.IMicroblockCoverSystem;
import mods.immibis.microblocks.api.IMicroblockSystem;
import mods.immibis.microblocks.api.MicroblockAPIUtils;
import mods.immibis.microblocks.api.Part;
import mods.immibis.microblocks.api.PartType;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
@@ -37,11 +24,11 @@ import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo;
import com.enderio.core.client.render.BoundingBox;
import com.gtnewhorizon.gtnhlib.concurrent.cas.CasList;
import appeng.api.networking.IGridNode;
import appeng.api.util.AECableType;
import com.enderio.core.client.render.BoundingBox;
import cpw.mods.fml.common.Optional.Method;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -64,12 +51,24 @@ import crazypants.enderio.conduit.power.IPowerConduit;
import crazypants.enderio.conduit.redstone.IRedstoneConduit;
import crazypants.enderio.conduit.redstone.InsulatedRedstoneConduit;
import crazypants.enderio.config.Config;
import crazypants.util.ForgeDirections;
import li.cil.oc.api.network.Message;
import li.cil.oc.api.network.Node;
import mekanism.api.gas.Gas;
import mekanism.api.gas.GasStack;
import mods.immibis.microblocks.api.EnumPartClass;
import mods.immibis.microblocks.api.EnumPosition;
import mods.immibis.microblocks.api.IMicroblockCoverSystem;
import mods.immibis.microblocks.api.IMicroblockSystem;
import mods.immibis.microblocks.api.MicroblockAPIUtils;
import mods.immibis.microblocks.api.Part;
import mods.immibis.microblocks.api.PartType;
public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
public static final short NBT_VERSION = 1;
private final List<IConduit> conduits = new ArrayList<IConduit>();
private final List<IConduit> conduits = new CasList<>();
private Block facadeId = null;
private int facadeMeta = 0;
@@ -77,9 +76,9 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
private boolean facadeChanged;
private final List<CollidableComponent> cachedCollidables = new ArrayList<CollidableComponent>();
private final List<CollidableComponent> cachedCollidables = new ArrayList<>();
private final List<CollidableComponent> cachedConnectors = new ArrayList<CollidableComponent>();
private final List<CollidableComponent> cachedConnectors = new ArrayList<>();
private boolean conduitsDirty = true;
private boolean collidablesDirty = true;
@@ -407,6 +406,29 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
dirty();
}
@Override
public void replaceConduit(IConduit original, IConduit replacement) {
if (worldObj.isRemote) {
return;
}
// If you're wondering why I am not using conduit.writeToNBT, it is because there is some data that should not
// persist, some of which causes crashes with energy conduits.
NBTTagCompound[] originalData = new NBTTagCompound[ForgeDirections.DIRECTIONS.length];
for (ForgeDirection conduitConnection : original.getExternalConnections()) {
NBTTagCompound tag = new NBTTagCompound();
original.writeConnectionSettingsToNBT(conduitConnection, tag);
originalData[conduitConnection.ordinal()] = tag;
}
removeConduit(original);
addConduit(replacement);
for (int i = 0; i < originalData.length; i++) {
NBTTagCompound nbt = originalData[i];
if (nbt != null) {
replacement.readConduitSettingsFromNBT(ForgeDirections.DIRECTIONS[i], nbt);
}
}
}
@Override
public void removeConduit(IConduit conduit) {
if (conduit != null) {
@@ -431,7 +453,7 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
if (worldObj.isRemote) {
return;
}
List<IConduit> copy = new ArrayList<IConduit>(conduits);
List<IConduit> copy = new ArrayList<>(conduits);
for (IConduit con : copy) {
removeConduit(con, false);
}
@@ -516,11 +538,12 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
@Override
public List<CollidableComponent> getConnectors() {
List<CollidableComponent> result = new ArrayList<CollidableComponent>();
List<CollidableComponent> result = new ArrayList<>();
addConnectors(result);
return result;
}
@SuppressWarnings("unchecked")
private void addConnectors(List<CollidableComponent> result) {
if (conduits.isEmpty()) {
@@ -541,7 +564,7 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
cachedConnectors.clear();
// TODO: What an unholly mess! (and it doesn't even work correctly...)
List<CollidableComponent> coreBounds = new ArrayList<CollidableComponent>();
List<CollidableComponent> coreBounds = new ArrayList<>();
for (IConduit con : conduits) {
addConduitCores(coreBounds, con);
}
@@ -549,13 +572,13 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
result.addAll(coreBounds);
// 1st algorithm
List<CollidableComponent> conduitsBounds = new ArrayList<CollidableComponent>();
List<CollidableComponent> conduitsBounds = new ArrayList<>();
for (IConduit con : conduits) {
conduitsBounds.addAll(con.getCollidableComponents());
addConduitCores(conduitsBounds, con);
}
Set<Class<IConduit>> collidingTypes = new HashSet<Class<IConduit>>();
Set<Class<IConduit>> collidingTypes = new HashSet<>();
for (CollidableComponent conCC : conduitsBounds) {
for (CollidableComponent innerCC : conduitsBounds) {
if (!InsulatedRedstoneConduit.COLOR_CONTROLLER_ID.equals(innerCC.data)
@@ -569,7 +592,7 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
// TODO: Remove the core geometries covered up by this as no point in rendering these
if (!collidingTypes.isEmpty()) {
List<CollidableComponent> colCores = new ArrayList<CollidableComponent>();
List<CollidableComponent> colCores = new ArrayList<>();
for (Class<IConduit> c : collidingTypes) {
IConduit con = getConduit(c);
if (con != null) {
@@ -601,7 +624,7 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
for (IConduit con : conduits) {
if (con.hasConnections()) {
List<CollidableComponent> cores = new ArrayList<CollidableComponent>();
List<CollidableComponent> cores = new ArrayList<>();
addConduitCores(cores, con);
if (cores.size() > 1) {
BoundingBox bb = cores.get(0).bound;
@@ -944,7 +967,6 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
return (IGridNode) node;
}
@SuppressWarnings("cast")
@Override
@Method(modid = "appliedenergistics2")
public void setGridNode(Object node) {
@@ -16,7 +16,7 @@ import crazypants.enderio.ModObject;
import crazypants.enderio.conduit.IConduitBundle;
import crazypants.enderio.machine.painter.IPaintedBlock;
public class BlockConduitFacade extends BlockEio implements IPaintedBlock {
public class BlockConduitFacade extends BlockEio implements IPaintedBlock, Cloneable {
public static BlockConduitFacade create() {
BlockConduitFacade result = new BlockConduitFacade();
@@ -24,6 +24,10 @@ public class BlockConduitFacade extends BlockEio implements IPaintedBlock {
return result;
}
public BlockConduitFacade clone() throws CloneNotSupportedException {
return (BlockConduitFacade) super.clone();
}
private Block blockOverride;
private BlockConduitFacade() {
@@ -105,7 +109,6 @@ public class BlockConduitFacade extends BlockEio implements IPaintedBlock {
}
Block block = cb.getFacadeId();
int meta = cb.getFacadeMetadata();
if (block == null || block == this) {
return;
}
@@ -137,7 +140,7 @@ public class BlockConduitFacade extends BlockEio implements IPaintedBlock {
return new Mimic(id, meta);
}
class Mimic {
static class Mimic {
int meta;
Block block;
@@ -32,14 +32,17 @@ import crazypants.enderio.machine.painter.BasicPainterTemplate;
import crazypants.enderio.machine.painter.IPaintedBlock;
import crazypants.enderio.machine.painter.PaintSourceValidator;
import crazypants.enderio.machine.painter.PainterUtil;
import crazypants.util.ForgeDirections;
public class ItemConduitFacade extends Item implements IAdvancedTooltipProvider, IResourceTooltipProvider {
public static enum FacadeType {
public enum FacadeType {
BASIC,
HARDENED;
public static final FacadeType[] VALUES = values();
public String getUnlocName(Item me) {
return this == BASIC ? me.getUnlocalizedName() : me.getUnlocalizedName() + ".hardened";
}
@@ -65,18 +68,17 @@ public class ItemConduitFacade extends Item implements IAdvancedTooltipProvider,
GameRegistry.registerItem(this, ModObject.itemConduitFacade.unlocalisedName);
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs p_150895_2_, List list) {
for (FacadeType t : FacadeType.values()) {
public void getSubItems(Item item, CreativeTabs p_150895_2_, List<ItemStack> list) {
for (FacadeType t : FacadeType.VALUES) {
list.add(new ItemStack(item, 1, t.ordinal()));
}
}
@Override
public String getUnlocalizedName(ItemStack stack) {
return FacadeType.values()[stack.getItemDamage()].getUnlocName(this);
return FacadeType.VALUES[stack.getItemDamage()].getUnlocName(this);
}
@Override
@@ -87,7 +89,7 @@ public class ItemConduitFacade extends Item implements IAdvancedTooltipProvider,
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister IIconRegister) {
icons = new IIcon[FacadeType.values().length];
icons = new IIcon[FacadeType.VALUES.length];
icons[0] = itemIcon = IIconRegister.registerIcon("enderio:conduitFacade");
icons[1] = IIconRegister.registerIcon("enderio:conduitFacadeHardened");
overlayIcon = IIconRegister.registerIcon("enderio:conduitFacadeOverlay");
@@ -116,7 +118,7 @@ public class ItemConduitFacade extends Item implements IAdvancedTooltipProvider,
return true;
}
ForgeDirection dir = ForgeDirection.values()[side];
ForgeDirection dir = ForgeDirections.DIRECTIONS[side];
int placeX = x + dir.offsetX;
int placeY = y + dir.offsetY;
int placeZ = z + dir.offsetZ;
@@ -131,7 +133,7 @@ public class ItemConduitFacade extends Item implements IAdvancedTooltipProvider,
facadeMeta = PainterUtil.adjustFacadeMetadata(facadeID, facadeMeta, side);
bundle.setFacadeId(facadeID);
bundle.setFacadeMetadata(facadeMeta);
bundle.setFacadeType(FacadeType.values()[itemStack.getItemDamage()]);
bundle.setFacadeType(FacadeType.VALUES[itemStack.getItemDamage()]);
ConduitUtil.playPlaceSound(facadeID.stepSound, world, x, y, z);
if (!player.capabilities.isCreativeMode) {
itemStack.stackSize--;
@@ -171,10 +173,9 @@ public class ItemConduitFacade extends Item implements IAdvancedTooltipProvider,
return result;
}
@SuppressWarnings("rawtypes")
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack item, EntityPlayer par2EntityPlayer, List list, boolean par4) {
public void addInformation(ItemStack item, EntityPlayer par2EntityPlayer, List<String> list, boolean par4) {
super.addInformation(item, par2EntityPlayer, list, par4);
}
@@ -183,15 +184,13 @@ public class ItemConduitFacade extends Item implements IAdvancedTooltipProvider,
return getUnlocalizedName();
}
@SuppressWarnings("rawtypes")
@Override
@SideOnly(Side.CLIENT)
public void addCommonEntries(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag) {}
public void addCommonEntries(ItemStack itemstack, EntityPlayer entityplayer, List<String> list, boolean flag) {}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
@SideOnly(Side.CLIENT)
public void addBasicEntries(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag) {
public void addBasicEntries(ItemStack itemstack, EntityPlayer entityplayer, List<String> list, boolean flag) {
if (PainterUtil.getSourceBlock(itemstack) == null) {
list.add(EnderIO.lang.localize("item.itemConduitFacade.tooltip.notpainted"));
} else {
@@ -199,10 +198,9 @@ public class ItemConduitFacade extends Item implements IAdvancedTooltipProvider,
}
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
@SideOnly(Side.CLIENT)
public void addDetailedEntries(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag) {
public void addDetailedEntries(ItemStack itemstack, EntityPlayer entityplayer, List<String> list, boolean flag) {
SpecialTooltipHandler.addDetailedTooltipFromResources(list, itemstack);
if (itemstack.getItemDamage() == FacadeType.HARDENED.ordinal()) {
list.add("");
@@ -5,8 +5,6 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import mekanism.api.gas.IGasHandler;
import net.minecraft.block.Block;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
@@ -23,15 +21,14 @@ import crazypants.enderio.conduit.IConduit;
import crazypants.enderio.conduit.IConduitBundle;
import crazypants.enderio.machine.RedstoneControlMode;
import crazypants.enderio.machine.reservoir.TileReservoir;
import mekanism.api.gas.IGasHandler;
public abstract class AbstractGasConduit extends AbstractConduit implements IGasConduit {
protected final EnumMap<ForgeDirection, RedstoneControlMode> extractionModes = new EnumMap<ForgeDirection, RedstoneControlMode>(
ForgeDirection.class);
protected final EnumMap<ForgeDirection, DyeColor> extractionColors = new EnumMap<ForgeDirection, DyeColor>(
ForgeDirection.class);
protected final EnumMap<ForgeDirection, RedstoneControlMode> extractionModes = new EnumMap<>(ForgeDirection.class);
protected final EnumMap<ForgeDirection, DyeColor> extractionColors = new EnumMap<>(ForgeDirection.class);
protected final Map<ForgeDirection, Integer> externalRedstoneSignals = new HashMap<ForgeDirection, Integer>();
protected final Map<ForgeDirection, Integer> externalRedstoneSignals = new HashMap<>();
protected boolean redstoneStateDirty = true;
@Method(modid = GasUtil.API_NAME)
@@ -187,15 +184,15 @@ public abstract class AbstractGasConduit extends AbstractConduit implements IGas
String key = "extRM." + dir.name();
if (nbtRoot.hasKey(key)) {
short ord = nbtRoot.getShort(key);
if (ord >= 0 && ord < RedstoneControlMode.values().length) {
extractionModes.put(dir, RedstoneControlMode.values()[ord]);
if (ord >= 0 && ord < RedstoneControlMode.VALUES.length) {
extractionModes.put(dir, RedstoneControlMode.VALUES[ord]);
}
}
key = "extSC." + dir.name();
if (nbtRoot.hasKey(key)) {
short ord = nbtRoot.getShort(key);
if (ord >= 0 && ord < DyeColor.values().length) {
extractionColors.put(dir, DyeColor.values()[ord]);
if (ord >= 0 && ord < DyeColor.VALUES.length) {
extractionColors.put(dir, DyeColor.VALUES[ord]);
}
}
}
@@ -2,9 +2,6 @@ package crazypants.enderio.conduit.gas;
import java.util.List;
import mekanism.api.gas.GasStack;
import mekanism.api.gas.IGasHandler;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection;
@@ -17,6 +14,8 @@ import crazypants.enderio.conduit.ConduitUtil;
import crazypants.enderio.conduit.ConnectionMode;
import crazypants.enderio.conduit.RaytraceResult;
import crazypants.enderio.tool.ToolUtil;
import mekanism.api.gas.GasStack;
import mekanism.api.gas.IGasHandler;
public abstract class AbstractGasTankConduit extends AbstractGasConduit {
@@ -1,7 +1,7 @@
package crazypants.enderio.conduit.gas;
import mekanism.api.gas.GasStack;
import crazypants.enderio.conduit.AbstractConduitNetwork;
import mekanism.api.gas.GasStack;
public class AbstractGasTankConduitNetwork<T extends AbstractGasTankConduit>
extends AbstractConduitNetwork<IGasConduit, T> {
@@ -1,11 +1,10 @@
package crazypants.enderio.conduit.gas;
import mekanism.api.gas.GasStack;
import mekanism.api.gas.GasTank;
import net.minecraft.nbt.NBTTagCompound;
import cpw.mods.fml.common.Optional.Method;
import mekanism.api.gas.GasStack;
import mekanism.api.gas.GasTank;
public class ConduitGasTank extends GasTank {
@@ -3,9 +3,6 @@ package crazypants.enderio.conduit.gas;
import java.util.HashMap;
import java.util.Map;
import mekanism.api.gas.Gas;
import mekanism.api.gas.GasStack;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
@@ -13,7 +10,6 @@ import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import com.enderio.core.client.render.IconUtil;
import com.enderio.core.common.util.BlockCoord;
import cpw.mods.fml.common.Optional.Method;
import cpw.mods.fml.relauncher.Side;
@@ -23,7 +19,10 @@ import crazypants.enderio.conduit.AbstractConduitNetwork;
import crazypants.enderio.conduit.ConnectionMode;
import crazypants.enderio.conduit.IConduit;
import crazypants.enderio.conduit.geom.CollidableComponent;
import crazypants.enderio.conduit.render.ConduitRenderer;
import crazypants.enderio.config.Config;
import mekanism.api.gas.Gas;
import mekanism.api.gas.GasStack;
public class GasConduit extends AbstractGasTankConduit {
@@ -35,7 +34,12 @@ public class GasConduit extends AbstractGasTankConduit {
public static final String ICON_INSERT_KEY = "enderio:gasConduitOutput";
public static final String ICON_EMPTY_EDGE = "enderio:gasConduitEdge";
static final Map<String, IIcon> ICONS = new HashMap<String, IIcon>();
static final Map<String, IIcon> ICONS = new HashMap<>();
@Override
public ConduitRenderer getRenderer() {
return GasConduitRenderer.instance.get();
}
@SideOnly(Side.CLIENT)
public static void initIcons() {
@@ -83,7 +87,6 @@ public class GasConduit extends AbstractGasTankConduit {
}
private void doExtract() {
BlockCoord loc = getLocation();
if (!hasConnectionMode(ConnectionMode.INPUT)) {
return;
}
@@ -98,7 +101,6 @@ public class GasConduit extends AbstractGasTankConduit {
return;
}
Gas f = tank.getGas() == null ? null : tank.getGas().getGas();
for (ForgeDirection dir : externalConnections) {
if (autoExtractForDir(dir)) {
if (network.extractFrom(this, dir, MAX_EXTRACT_PER_TICK)) {
@@ -4,21 +4,21 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import mekanism.api.gas.GasStack;
import mekanism.api.gas.IGasHandler;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import com.enderio.core.common.util.BlockCoord;
import crazypants.enderio.conduit.IConduit;
import mekanism.api.gas.GasStack;
import mekanism.api.gas.IGasHandler;
public class GasConduitNetwork extends AbstractGasTankConduitNetwork<GasConduit> {
private final ConduitGasTank tank = new ConduitGasTank(0);
private final Set<GasOutput> outputs = new HashSet<GasOutput>();
private final Set<GasOutput> outputs = new HashSet<>();
private Iterator<GasOutput> outputIterator;
@@ -1,17 +1,13 @@
package crazypants.enderio.conduit.gas;
import static com.enderio.core.client.render.CubeRenderer.addVecWithUV;
import java.util.List;
import mekanism.api.gas.GasStack;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.IIcon;
import net.minecraftforge.common.util.ForgeDirection;
import com.enderio.core.client.render.BoundingBox;
import com.enderio.core.client.render.CubeRenderer;
import com.enderio.core.client.render.RenderUtil;
import com.enderio.core.common.vecmath.Vector3d;
import com.enderio.core.common.vecmath.Vertex;
@@ -24,14 +20,13 @@ import crazypants.enderio.conduit.geom.CollidableComponent;
import crazypants.enderio.conduit.geom.ConnectionModeGeometry;
import crazypants.enderio.conduit.geom.Offset;
import crazypants.enderio.conduit.render.ConduitBundleRenderer;
import crazypants.enderio.conduit.render.ConduitRenderer;
import crazypants.enderio.conduit.render.DefaultConduitRenderer;
import mekanism.api.gas.GasStack;
public class GasConduitRenderer extends DefaultConduitRenderer {
@Override
public boolean isRendererForConduit(IConduit conduit) {
return conduit instanceof GasConduit;
}
public static final ThreadLocal<ConduitRenderer> instance = ThreadLocal.withInitial(GasConduitRenderer::new);
@Override
public void renderEntity(ConduitBundleRenderer conduitBundleRenderer, IConduitBundle te, IConduit conduit, double x,
@@ -59,6 +54,8 @@ public class GasConduitRenderer extends DefaultConduitRenderer {
@Override
protected void renderConduit(IIcon tex, IConduit conduit, CollidableComponent component, float brightness) {
super.renderConduit(tex, conduit, component, brightness);
final CubeRenderer cr = CubeRenderer.get();
int i;
if (isNSEWUD(component.dir)) {
GasConduit lc = (GasConduit) conduit;
@@ -104,15 +101,17 @@ public class GasConduitRenderer extends DefaultConduitRenderer {
List<Vertex> corners = bb.getCornersWithUvForFace(d, minU, maxU, minV, maxV);
moveEdgeCorners(corners, vDir, width);
moveEdgeCorners(corners, component.dir.getOpposite(), sideScale);
for (Vertex c : corners) {
addVecWithUV(c.xyz, c.uv.x, c.uv.y);
for (i = 0; i < corners.size(); i++) {
final Vertex c = corners.get(i);
cr.addVecWithUV(c.xyz, c.uv.x, c.uv.y);
}
corners = bb.getCornersWithUvForFace(d, minU, maxU, minV, maxV);
moveEdgeCorners(corners, vDir.getOpposite(), width);
moveEdgeCorners(corners, component.dir.getOpposite(), sideScale);
for (Vertex c : corners) {
addVecWithUV(c.xyz, c.uv.x, c.uv.y);
for (i = 0; i < corners.size(); i++) {
final Vertex c = corners.get(i);
cr.addVecWithUV(c.xyz, c.uv.x, c.uv.y);
}
}
}
@@ -125,14 +124,15 @@ public class GasConduitRenderer extends DefaultConduitRenderer {
tex.getMaxU(),
tex.getMinV(),
tex.getMaxV());
Tessellator tessellator = Tessellator.instance;
for (Vertex c : corners) {
addVecWithUV(c.xyz, c.uv.x, c.uv.y);
for (i = 0; i < corners.size(); i++) {
final Vertex c = corners.get(i);
cr.addVecWithUV(c.xyz, c.uv.x, c.uv.y);
}
// back face
for (int i = corners.size() - 1; i >= 0; i--) {
Vertex c = corners.get(i);
addVecWithUV(c.xyz, c.uv.x, c.uv.y);
for (i = corners.size() - 1; i >= 0; i--) {
final Vertex c = corners.get(i);
cr.addVecWithUV(c.xyz, c.uv.x, c.uv.y);
}
}
}
@@ -1,8 +1,5 @@
package crazypants.enderio.conduit.gas;
import mekanism.api.gas.GasStack;
import mekanism.api.gas.IGasHandler;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
@@ -12,6 +9,8 @@ import cpw.mods.fml.common.ModAPIManager;
import cpw.mods.fml.common.Optional.Method;
import crazypants.enderio.conduit.IConduitBundle;
import crazypants.enderio.config.Config;
import mekanism.api.gas.GasStack;
import mekanism.api.gas.IGasHandler;
public final class GasUtil {
@@ -1,12 +1,11 @@
package crazypants.enderio.conduit.gas;
import mekanism.api.gas.IGasHandler;
import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.common.Optional.Interface;
import crazypants.enderio.conduit.IConduit;
import crazypants.enderio.conduit.IExtractor;
import mekanism.api.gas.IGasHandler;
@Interface(iface = "mekanism.api.gas.IGasHandler", modid = GasUtil.API_NAME)
public interface IGasConduit extends IConduit, IGasHandler, IExtractor {
@@ -21,7 +21,7 @@ import crazypants.enderio.gui.IconEIO;
public class ItemGasConduit extends AbstractItemConduit implements IAdvancedTooltipProvider {
private static ItemConduitSubtype[] subtypes = new ItemConduitSubtype[] {
private static final ItemConduitSubtype[] subtypes = new ItemConduitSubtype[] {
new ItemConduitSubtype(ModObject.itemGasConduit.name(), "enderio:itemGasConduit"), };
public static ItemGasConduit create() {
@@ -56,15 +56,15 @@ public class ItemGasConduit extends AbstractItemConduit implements IAdvancedTool
@Override
@SideOnly(Side.CLIENT)
public void addCommonEntries(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag) {}
public void addCommonEntries(ItemStack itemstack, EntityPlayer entityplayer, List<String> list, boolean flag) {}
@Override
@SideOnly(Side.CLIENT)
public void addBasicEntries(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag) {}
public void addBasicEntries(ItemStack itemstack, EntityPlayer entityplayer, List<String> list, boolean flag) {}
@Override
@SideOnly(Side.CLIENT)
public void addDetailedEntries(ItemStack itemstack, EntityPlayer entityplayer, List list, boolean flag) {
public void addDetailedEntries(ItemStack itemstack, EntityPlayer entityplayer, List<String> list, boolean flag) {
String gpt = " " + EnderIO.lang.localize("gas.gasTick");
int extractRate = Config.gasConduitExtractRate;
int maxIo = Config.gasConduitMaxIoRate;
@@ -12,7 +12,7 @@ public class CollidableCache {
public static final CollidableCache instance = new CollidableCache();
private final Map<CacheKey, Collection<CollidableComponent>> cache = new HashMap<CollidableCache.CacheKey, Collection<CollidableComponent>>();
private final Map<CacheKey, Collection<CollidableComponent>> cache = new HashMap<>();
public CacheKey createKey(Class<? extends IConduit> baseType, Offset offset, ForgeDirection dir, boolean isStub) {
return new CacheKey(baseType, offset, dir, isStub);
@@ -3,6 +3,7 @@ package crazypants.enderio.conduit.geom;
import net.minecraftforge.common.util.ForgeDirection;
import com.enderio.core.client.render.BoundingBox;
import crazypants.enderio.conduit.IConduit;
public class CollidableComponent {
@@ -10,6 +10,7 @@ import com.enderio.core.client.render.BoundingBox;
import com.enderio.core.common.util.ForgeDirectionOffsets;
import com.enderio.core.common.vecmath.VecmathUtil;
import com.enderio.core.common.vecmath.Vector3d;
import crazypants.enderio.conduit.IConduit;
public class ConduitGeometryUtil {
@@ -32,7 +33,7 @@ public class ConduitGeometryUtil {
public static final float CONNECTOR_DEPTH = 0.05f;
private static Map<ForgeDirection, BoundingBox[]> EXTERNAL_CONNECTOR_BOUNDS = new HashMap<ForgeDirection, BoundingBox[]>();
private static final Map<ForgeDirection, BoundingBox[]> EXTERNAL_CONNECTOR_BOUNDS = new HashMap<>();
static {
setupBounds(0.5f);
@@ -105,9 +106,9 @@ public class ConduitGeometryUtil {
return val < 0 ? 1 + val : val;
}
private Map<GeometryKey, BoundingBox> boundsCache = new HashMap<GeometryKey, BoundingBox>();
private final Map<GeometryKey, BoundingBox> boundsCache = new HashMap<>();
private EnumMap<ConduitConnectorType, BoundingBox> connectorBounds = new EnumMap<ConduitConnectorType, BoundingBox>(
private final EnumMap<ConduitConnectorType, BoundingBox> connectorBounds = new EnumMap<>(
ConduitConnectorType.class);
private ConduitGeometryUtil() {}
@@ -21,8 +21,7 @@ import com.enderio.core.common.vecmath.Vertex;
public class ConnectionModeGeometry {
private static final EnumMap<ForgeDirection, List<Vertex>> VERTS = new EnumMap<ForgeDirection, List<Vertex>>(
ForgeDirection.class);
private static final EnumMap<ForgeDirection, List<Vertex>> VERTS = new EnumMap<>(ForgeDirection.class);
static {
float scale = 0.9f;
@@ -84,7 +83,7 @@ public class ConnectionModeGeometry {
}
private static List<Vertex> createVerticesForDir(BoundingBox refBB, VertexTransform xform) {
List<Vertex> result = new ArrayList<Vertex>(24);
List<Vertex> result = new ArrayList<>(24);
for (ForgeDirection face : ForgeDirection.VALID_DIRECTIONS) {
result.addAll(refBB.getCornersWithUvForFace(face));
}
@@ -16,7 +16,7 @@ import crazypants.enderio.conduit.redstone.IRedstoneConduit;
public class Offsets {
private static Map<OffsetKey, Offset> OFFSETS = new HashMap<OffsetKey, Offset>();
private static final Map<OffsetKey, Offset> OFFSETS = new HashMap<>();
static {
OFFSETS.put(key(IRedstoneConduit.class, Axis.NONE), Offset.UP);
@@ -1,6 +1,7 @@
package crazypants.enderio.conduit.gui;
import java.awt.*;
import java.awt.Color;
import java.awt.Rectangle;
import java.util.ArrayList;
import javax.annotation.Nonnull;
@@ -30,7 +31,7 @@ public class BaseSettingsPanel implements ITabPanel {
static final int ID_EXTRACT_ENABLED = 328;
protected static final int ID_INSERT_FILTER_OPTIONS = 329;
protected static final int ID_EXTRACT_FILTER_OPTIONS = 330;
protected final int ID_ENABLED = 331;
protected static final int ID_ENABLED = 331;
protected final @Nonnull IWidgetIcon icon;
protected final @Nonnull GuiExternalConnection gui;
@@ -40,8 +41,8 @@ public class BaseSettingsPanel implements ITabPanel {
protected ConnectionMode oldConnectionMode;
private @Nonnull String inputHeading;
private @Nonnull String outputHeading;
private final @Nonnull String inputHeading;
private final @Nonnull String outputHeading;
private boolean insertEnabled = false;
private boolean extractEnabled = false;
@@ -141,7 +142,7 @@ public class BaseSettingsPanel implements ITabPanel {
}
};
ArrayList<String> funcUpgradeTips = new ArrayList<String>();
ArrayList<String> funcUpgradeTips = new ArrayList<>();
SpecialTooltipHandler.addTooltipFromResources(funcUpgradeTips, "enderio.gui.conduit.item.functionupgrade.line");
for (FunctionUpgrade upgrade : FunctionUpgrade.values()) {
funcUpgradeTips.add(EnderIO.lang.localizeExact(upgrade.unlocName.concat(".name")));
@@ -10,6 +10,7 @@ import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
@@ -24,12 +25,14 @@ import crazypants.enderio.conduit.gui.item.InventoryUpgrades;
import crazypants.enderio.conduit.item.IItemConduit;
import crazypants.enderio.conduit.item.SpeedUpgrade;
import crazypants.enderio.conduit.item.filter.IItemFilter;
import crazypants.enderio.machine.gui.IContainerWithTileEntity;
import crazypants.enderio.network.PacketHandler;
public class ExternalConnectionContainer extends ContainerEnder<InventoryUpgrades> {
public class ExternalConnectionContainer extends ContainerEnder<InventoryUpgrades> implements IContainerWithTileEntity {
private final IItemConduit itemConduit;
private final ForgeDirection direction;
private final TileEntity te;
private int speedUpgradeSlotLimit = 15;
@@ -52,6 +55,7 @@ public class ExternalConnectionContainer extends ContainerEnder<InventoryUpgrade
super(playerInv, new InventoryUpgrades(bundle.getConduit(IItemConduit.class), dir));
this.direction = dir;
this.itemConduit = bundle.getConduit(IItemConduit.class);
this.te = (TileEntity) bundle;
slotLocations.addAll(playerSlotLocations.values());
int x;
@@ -280,6 +284,11 @@ public class ExternalConnectionContainer extends ContainerEnder<InventoryUpgrade
return copystack;
}
@Override
public TileEntity getTileEntity() {
return te;
}
private class FilterSlot extends Slot {
public FilterSlot(IInventory par1iInventory, int par2, int par3, int par4) {
@@ -2,8 +2,6 @@ package crazypants.enderio.conduit.gui;
import java.awt.Color;
import mekanism.api.gas.Gas;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.util.IIcon;
@@ -22,6 +20,7 @@ import crazypants.enderio.gui.RedstoneModeButton;
import crazypants.enderio.machine.IRedstoneModeControlable;
import crazypants.enderio.machine.RedstoneControlMode;
import crazypants.enderio.network.PacketHandler;
import mekanism.api.gas.Gas;
public class GasSettings extends BaseSettingsPanel {
@@ -29,13 +28,13 @@ public class GasSettings extends BaseSettingsPanel {
private static final int ID_COLOR_BUTTON = GuiExternalConnection.nextButtonId();
private RedstoneModeButton rsB;
private final RedstoneModeButton rsB;
private ColorButton colorB;
private final ColorButton colorB;
private String autoExtractStr = EnderIO.lang.localize("gui.conduit.gas.autoExtract");
private final String autoExtractStr = EnderIO.lang.localize("gui.conduit.gas.autoExtract");
private IGasConduit conduit;
private final IGasConduit conduit;
protected GasSettings(final GuiExternalConnection gui, IConduit con) {
super(IconEIO.WRENCH_OVERLAY_GAS, EnderIO.lang.localize("itemGasConduit.name"), gui, con);
@@ -73,7 +72,7 @@ public class GasSettings extends BaseSettingsPanel {
public void actionPerformed(GuiButton guiButton) {
super.actionPerformed(guiButton);
if (guiButton.id == ID_COLOR_BUTTON) {
conduit.setExtractionSignalColor(gui.getDir(), DyeColor.values()[colorB.getColorIndex()]);
conduit.setExtractionSignalColor(gui.getDir(), DyeColor.VALUES[colorB.getColorIndex()]);
PacketHandler.INSTANCE.sendToServer(new PacketExtractMode(conduit, gui.getDir()));
}
}
@@ -104,8 +103,6 @@ public class GasSettings extends BaseSettingsPanel {
protected void renderCustomOptions(int top, float par1, int par2, int par3) {
boolean isInput = isInput();
if (isInput) {
int x = gui.getGuiLeft() + gap + gui.getFontRenderer().getStringWidth(autoExtractStr) + gap + 2;
int y = customTop;
gui.getFontRenderer().drawString(autoExtractStr, left, top, ColorUtil.getRGB(Color.DARK_GRAY));
}
}
@@ -50,7 +50,7 @@ public class GuiExternalConnection extends GuiContainerBaseEIO {
return id;
}
private static final Map<Class<? extends IConduit>, Integer> TAB_ORDER = new HashMap<Class<? extends IConduit>, Integer>();
private static final Map<Class<? extends IConduit>, Integer> TAB_ORDER = new HashMap<>();
static {
TAB_ORDER.put(IItemConduit.class, 0);
@@ -66,11 +66,11 @@ public class GuiExternalConnection extends GuiContainerBaseEIO {
final IConduitBundle bundle;
private final ForgeDirection dir;
private final List<IConduit> conduits = new ArrayList<IConduit>();
private final List<ITabPanel> tabs = new ArrayList<ITabPanel>();
private final List<IConduit> conduits = new ArrayList<>();
private final List<ITabPanel> tabs = new ArrayList<>();
private int activeTab = 0;
private int tabYOffset = 4;
private static final int tabYOffset = 4;
private final ExternalConnectionContainer container;
@@ -86,8 +86,8 @@ public class GuiExternalConnection extends GuiContainerBaseEIO {
container.setInoutSlotsVisible(false, false);
List<IConduit> cons = new ArrayList<IConduit>(bundle.getConduits());
Collections.sort(cons, new Comparator<IConduit>() {
List<IConduit> cons = new ArrayList<>(bundle.getConduits());
Collections.sort(cons, new Comparator<>() {
@Override
public int compare(IConduit o1, IConduit o2) {
@@ -23,6 +23,7 @@ import crazypants.enderio.conduit.IConduit;
import crazypants.enderio.conduit.IConduitBundle;
import crazypants.enderio.conduit.redstone.IInsulatedRedstoneConduit;
import crazypants.enderio.network.PacketHandler;
import crazypants.util.ForgeDirections;
public class GuiExternalConnectionSelector extends GuiScreen {
@@ -33,7 +34,7 @@ public class GuiExternalConnectionSelector extends GuiScreen {
public GuiExternalConnectionSelector(IConduitBundle cb) {
this.cb = cb;
cons = new HashSet<ForgeDirection>();
cons = new HashSet<>();
for (IConduit con : cb.getConduits()) {
if (con instanceof IInsulatedRedstoneConduit) {
Set<ForgeDirection> conCons = con.getConduitConnections();
@@ -51,7 +52,7 @@ public class GuiExternalConnectionSelector extends GuiScreen {
@Override
protected void actionPerformed(GuiButton b) {
ForgeDirection dir = ForgeDirection.values()[b.id];
ForgeDirection dir = ForgeDirections.DIRECTIONS[b.id];
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
BlockCoord loc = cb.getLocation();
PacketHandler.INSTANCE.sendToServer(new PacketOpenConduitUI(cb.getEntity(), dir));
@@ -62,7 +62,7 @@ public class LiquidSettings extends BaseSettingsPanel {
private final ILiquidConduit conduit;
private AbstractEnderLiquidConduit eConduit;
private boolean isEnder;
private final boolean isEnder;
private static final int filterIX = 4;
private static final int filterEX = 104;
private static final int filterY = 63;
@@ -70,7 +70,7 @@ public class LiquidSettings extends BaseSettingsPanel {
private static final Rectangle extractFilterBounds = new Rectangle(filterEX, filterY, 90, 18);
private GuiToolTip[] filterToolTips;
private boolean inOutShowIn = true;
private static final boolean inOutShowIn = true;
private IconButton insertWhiteListB;
private IconButton extractWhiteListB;
@@ -172,7 +172,7 @@ public class LiquidSettings extends BaseSettingsPanel {
public void actionPerformed(GuiButton guiButton) {
super.actionPerformed(guiButton);
if (guiButton.id == ID_COLOR_BUTTON) {
conduit.setExtractionSignalColor(gui.getDir(), DyeColor.values()[colorB.getColorIndex()]);
conduit.setExtractionSignalColor(gui.getDir(), DyeColor.VALUES[colorB.getColorIndex()]);
PacketHandler.INSTANCE.sendToServer(new PacketExtractMode(conduit, gui.getDir()));
} else if (guiButton.id == ID_INSERT_WHITELIST || guiButton.id == ID_EXTRACT_WHITELIST) {
toggleBlacklist(guiButton.id == ID_EXTRACT_WHITELIST);
@@ -180,7 +180,7 @@ public class LiquidSettings extends BaseSettingsPanel {
ColorButton btn = (ColorButton) guiButton;
if (isEnder) {
DyeColor col = DyeColor.values()[btn.getColorIndex()];
DyeColor col = DyeColor.VALUES[btn.getColorIndex()];
boolean isInput = guiButton.id == ID_EXTRACT_CHANNEL;
if (isInput) {
@@ -284,6 +284,8 @@ public class LiquidSettings extends BaseSettingsPanel {
rsB.onGuiInit();
colorB.onGuiInit();
gui.getContainer().setInventorySlotsVisible(true);
if (!isEnder) {
return;
}
@@ -295,7 +297,6 @@ public class LiquidSettings extends BaseSettingsPanel {
roundRobinB.onGuiInit();
roundRobinB.setSelected(eConduit.isRoundRobin(gui.getDir()));
gui.getContainer().setInventorySlotsVisible(true);
if (isFilterVisible()) {
addFilterTooltips();
@@ -18,9 +18,9 @@ import crazypants.enderio.network.PacketHandler;
public class OCSettings extends BaseSettingsPanel {
private static final int ID_COLOR_BUTTON = GuiExternalConnection.nextButtonId();
private ColorButton cb;
private final ColorButton cb;
private String signalColorStr = EnderIO.lang.localize("gui.conduit.redstone.color");
private final String signalColorStr = EnderIO.lang.localize("gui.conduit.redstone.color");
private final IOCConduit occon;
public OCSettings(GuiExternalConnection gui, IConduit con) {
@@ -42,7 +42,7 @@ public class OCSettings extends BaseSettingsPanel {
public void actionPerformed(GuiButton guiButton) {
super.actionPerformed(guiButton);
if (guiButton.id == ID_COLOR_BUTTON && cb != null) {
occon.setSignalColor(gui.getDir(), DyeColor.values()[cb.getColorIndex()]);
occon.setSignalColor(gui.getDir(), DyeColor.VALUES[cb.getColorIndex()]);
PacketHandler.INSTANCE.sendToServer(new PacketOCConduitSignalColor(occon, gui.getDir()));
}
}
@@ -11,6 +11,7 @@ import crazypants.enderio.conduit.liquid.AbstractEnderLiquidConduit;
import crazypants.enderio.conduit.liquid.ILiquidConduit;
import crazypants.enderio.conduit.packet.AbstractConduitPacket;
import crazypants.enderio.conduit.packet.ConTypeEnum;
import crazypants.util.ForgeDirections;
import io.netty.buffer.ByteBuf;
public class PacketFluidChannel extends AbstractConduitPacket<ILiquidConduit>
@@ -42,13 +43,14 @@ public class PacketFluidChannel extends AbstractConduitPacket<ILiquidConduit>
@Override
public void fromBytes(ByteBuf buf) {
super.fromBytes(buf);
dir = ForgeDirection.values()[buf.readShort()];
dir = ForgeDirections.DIRECTIONS[buf.readShort()];
isInput = buf.readBoolean();
channel = DyeColor.values()[buf.readShort()];
channel = DyeColor.VALUES[buf.readShort()];
}
@Override
public IMessage onMessage(PacketFluidChannel message, MessageContext ctx) {
if (isInvalidPacketForGui(message, ctx)) return null;
ILiquidConduit conduit = message.getTileCasted(ctx);
if (!(conduit instanceof AbstractEnderLiquidConduit)) {
return null;
@@ -12,6 +12,7 @@ import crazypants.enderio.conduit.liquid.FluidFilter;
import crazypants.enderio.conduit.liquid.ILiquidConduit;
import crazypants.enderio.conduit.packet.AbstractConduitPacket;
import crazypants.enderio.conduit.packet.ConTypeEnum;
import crazypants.util.ForgeDirections;
import io.netty.buffer.ByteBuf;
public class PacketFluidFilter extends AbstractConduitPacket<ILiquidConduit>
@@ -44,7 +45,7 @@ public class PacketFluidFilter extends AbstractConduitPacket<ILiquidConduit>
@Override
public void fromBytes(ByteBuf buf) {
super.fromBytes(buf);
dir = ForgeDirection.values()[buf.readShort()];
dir = ForgeDirections.DIRECTIONS[buf.readShort()];
isInput = buf.readBoolean();
NBTTagCompound tag = ByteBufUtils.readTag(buf);
filter = new FluidFilter();
@@ -53,6 +54,7 @@ public class PacketFluidFilter extends AbstractConduitPacket<ILiquidConduit>
@Override
public IMessage onMessage(PacketFluidFilter message, MessageContext ctx) {
if (isInvalidPacketForGui(message, ctx)) return null;
ILiquidConduit conduit = message.getTileCasted(ctx);
if (!(conduit instanceof AbstractEnderLiquidConduit)) {
return null;
@@ -11,6 +11,7 @@ import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import crazypants.enderio.EnderIO;
import crazypants.enderio.GuiHandler;
import crazypants.util.ForgeDirections;
import io.netty.buffer.ByteBuf;
public class PacketOpenConduitUI extends MessageTileEntity<TileEntity>
@@ -34,7 +35,7 @@ public class PacketOpenConduitUI extends MessageTileEntity<TileEntity>
@Override
public void fromBytes(ByteBuf buf) {
super.fromBytes(buf);
dir = ForgeDirection.values()[buf.readShort()];
dir = ForgeDirections.DIRECTIONS[buf.readShort()];
}
public IMessage onMessage(PacketOpenConduitUI message, MessageContext ctx) {
@@ -21,9 +21,9 @@ public class PowerSettings extends BaseSettingsPanel {
private static final int ID_COLOR_BUTTON = GuiExternalConnection.nextButtonId();
private IPowerConduit conduit;
private RedstoneModeButton rsB;
private ColorButton colorB;
private final IPowerConduit conduit;
private final RedstoneModeButton rsB;
private final ColorButton colorB;
protected PowerSettings(final GuiExternalConnection gui, IConduit con) {
super(IconEIO.WRENCH_OVERLAY_POWER, EnderIO.lang.localize("itemPowerConduit.name"), gui, con);
@@ -59,7 +59,7 @@ public class PowerSettings extends BaseSettingsPanel {
public void actionPerformed(GuiButton guiButton) {
super.actionPerformed(guiButton);
if (guiButton.id == ID_COLOR_BUTTON) {
conduit.setExtractionSignalColor(gui.getDir(), DyeColor.values()[colorB.getColorIndex()]);
conduit.setExtractionSignalColor(gui.getDir(), DyeColor.VALUES[colorB.getColorIndex()]);
PacketHandler.INSTANCE.sendToServer(new PacketExtractMode(conduit, gui.getDir()));
}
}
@@ -25,8 +25,8 @@ public class RedstoneSettings extends BaseSettingsPanel {
private CheckBox strongCB;
private String signalColorStr = EnderIO.lang.localize("gui.conduit.redstone.color");
private String signalStringthStr = EnderIO.lang.localize("gui.conduit.redstone.signalStrengh");
private final String signalColorStr = EnderIO.lang.localize("gui.conduit.redstone.color");
private final String signalStringthStr = EnderIO.lang.localize("gui.conduit.redstone.signalStrengh");
private IInsulatedRedstoneConduit insCon;
private int stongLabelX;
@@ -61,7 +61,7 @@ public class RedstoneSettings extends BaseSettingsPanel {
public void actionPerformed(GuiButton guiButton) {
super.actionPerformed(guiButton);
if (guiButton.id == ID_COLOR_BUTTON && cb != null) {
insCon.setSignalColor(gui.getDir(), DyeColor.values()[cb.getColorIndex()]);
insCon.setSignalColor(gui.getDir(), DyeColor.VALUES[cb.getColorIndex()]);
PacketHandler.INSTANCE.sendToServer(new PacketRedstoneConduitSignalColor(insCon, gui.getDir()));
} else if (guiButton.id == ID_STRONG_BUTTON && strongCB != null) {
insCon.setOutputStrength(gui.getDir(), strongCB.isSelected());
@@ -39,11 +39,11 @@ public class BasicItemFilterGui implements IItemFilterGui {
private final IItemFilterContainer filterContainer;
private final ItemFilter filter;
private int buttonIdOffset;
private int xOffset;
private int yOffset;
private final int buttonIdOffset;
private final int xOffset;
private final int yOffset;
private boolean isInput;
private final boolean isInput;
public BasicItemFilterGui(GuiContainerBaseEIO gui, IItemFilterContainer filterContainer,
boolean isStickyModeAvailable, boolean isInput) {
@@ -107,7 +107,7 @@ public class BasicItemFilterGui implements IItemFilterGui {
useNbtB.setPaintSelectedBorder(false);
x += 16;
fuzzyB = new CycleButton(gui, ID_FUZZY + buttonIdOffset, x, y, FuzzyMode.class);
fuzzyB = new CycleButton<>(gui, ID_FUZZY + buttonIdOffset, x, y, FuzzyMode.class);
}
public void createFilterSlots() {
@@ -39,7 +39,7 @@ public class BigItemFilterGui implements IItemFilterGui {
private final IItemFilterContainer filterContainer;
private final ItemFilter filter;
private int buttonIdOffset;
private final int buttonIdOffset;
private int xOffset;
private int yOffset;
@@ -92,7 +92,7 @@ public class BigItemFilterGui implements IItemFilterGui {
useNbtB.setPaintSelectedBorder(false);
x += 16;
fuzzyB = new CycleButton(gui, ID_FUZZY + buttonIdOffset, x, y, FuzzyMode.class);
fuzzyB = new CycleButton<>(gui, ID_FUZZY + buttonIdOffset, x, y, FuzzyMode.class);
x += 16;
stickyB = new ToggleButton(
@@ -38,26 +38,26 @@ public class ExistingItemFilterGui implements IItemFilterGui {
private static final int ID_SHOW = GuiExternalConnection.nextButtonId();
private static final int ID_MERGE = GuiExternalConnection.nextButtonId();
private IItemConduit itemConduit;
private GuiExternalConnection gui;
private final IItemConduit itemConduit;
private final GuiExternalConnection gui;
private ToggleButton useMetaB;
private ToggleButton useNbtB;
private ToggleButton useOreDictB;
private ToggleButton stickyB;
private final ToggleButton useMetaB;
private final ToggleButton useNbtB;
private final ToggleButton useOreDictB;
private final ToggleButton stickyB;
private final IconButton whiteListB;
private GuiButton snapshotB;
private GuiButton clearB;
private GuiButton showB;
private GuiButton mergeB;
private SnapshotOverlay snapshotOverlay;
private final GuiButton snapshotB;
private final GuiButton clearB;
private final GuiButton showB;
private final GuiButton mergeB;
private final SnapshotOverlay snapshotOverlay;
boolean isInput;
private int buttonIdOffset = 0;
private ExistingItemFilter filter;
private final ExistingItemFilter filter;
public ExistingItemFilterGui(GuiExternalConnection gui, IItemConduit itemConduit, boolean isInput) {
this.gui = gui;
@@ -9,9 +9,9 @@ import crazypants.enderio.network.PacketHandler;
public class ItemConduitFilterContainer implements IItemFilterContainer {
private IItemConduit itemConduit;
private ForgeDirection dir;
private boolean isInput;
private final IItemConduit itemConduit;
private final ForgeDirection dir;
private final boolean isInput;
public ItemConduitFilterContainer(IItemConduit itemConduit, ForgeDirection dir, boolean isInput) {
this.itemConduit = itemConduit;
@@ -1,6 +1,6 @@
package crazypants.enderio.conduit.gui.item;
import java.awt.*;
import java.awt.Color;
import javax.annotation.Nonnull;
@@ -31,6 +31,7 @@ import crazypants.enderio.gui.RedstoneModeButton;
import crazypants.enderio.machine.IRedstoneModeControlable;
import crazypants.enderio.machine.RedstoneControlMode;
import crazypants.enderio.network.PacketHandler;
import crazypants.util.ColorUtils;
public class ItemSettings extends BaseSettingsPanel {
@@ -43,7 +44,7 @@ public class ItemSettings extends BaseSettingsPanel {
private static final int ID_INSERT_CHANNEL = 23;
private static final int ID_EXTRACT_CHANNEL = 27;
private @Nonnull IItemConduit itemConduit;
private final @Nonnull IItemConduit itemConduit;
private final ToggleButton loopB;
private final ToggleButton roundRobinB;
@@ -54,11 +55,11 @@ public class ItemSettings extends BaseSettingsPanel {
private final RedstoneModeButton rsB;
private final @Nonnull ColorButton colorB;
private ColorButton insertChannelB;
private ColorButton extractChannelB;
private final ColorButton insertChannelB;
private final ColorButton extractChannelB;
private int priLeft = 46;
private int priWidth = 32;
private static final int priLeft = 46;
private static final int priWidth = 32;
private IItemFilterGui insertFilterGui;
private IItemFilterGui extractFilterGui;
@@ -174,6 +175,7 @@ public class ItemSettings extends BaseSettingsPanel {
private void updateButtons() {
rsB.onGuiInit();
rsB.setMode(itemConduit.getExtractionRedstoneMode(gui.getDir()));
colorB.onGuiInit();
loopB.onGuiInit();
loopB.setSelected(itemConduit.isSelfFeedEnabled(gui.getDir()));
@@ -239,7 +241,7 @@ public class ItemSettings extends BaseSettingsPanel {
String priority = EnderIO.lang.localize("gui.conduit.item.priority");
fr.drawString(priority, left + 12, top1 + 25, ColorUtil.getRGB(Color.black));
fr.drawString(str, left + priLeft + priWidth - sw - gap, top1 + 25, ColorUtil.getRGB(Color.black));
fr.drawString(str, left + priLeft + priWidth - sw - gap, top1 + 25, ColorUtils.priorityString.getColor());
if (insertFilterGui != null) insertFilterGui.renderCustomOptions(top1, par1, par2, par3);
if (extractFilterGui != null) extractFilterGui.renderCustomOptions(top1, par1, par2, par3);
@@ -0,0 +1,202 @@
package crazypants.enderio.conduit.gui.item;
import net.minecraft.client.gui.GuiButton;
import org.lwjgl.opengl.GL11;
import com.enderio.core.client.gui.button.CycleButton;
import com.enderio.core.client.gui.button.IconButton;
import com.enderio.core.client.gui.button.ToggleButton;
import crazypants.enderio.EnderIO;
import crazypants.enderio.conduit.gui.GuiExternalConnection;
import crazypants.enderio.conduit.item.filter.FuzzyMode;
import crazypants.enderio.conduit.item.filter.ItemFilter;
import crazypants.enderio.gui.GuiContainerBaseEIO;
import crazypants.enderio.gui.IconEIO;
public class LimitedItemFilterGui implements IItemFilterGui {
private static final int ID_WHITELIST = GuiExternalConnection.nextButtonId();
private static final int ID_NBT = GuiExternalConnection.nextButtonId();
private static final int ID_META = GuiExternalConnection.nextButtonId();
private static final int ID_ORE_DICT = GuiExternalConnection.nextButtonId();
private static final int ID_STICKY = GuiExternalConnection.nextButtonId();
private static final int ID_FUZZY = GuiExternalConnection.nextButtonId();
private final GuiContainerBaseEIO gui;
private final ToggleButton useMetaB;
private final ToggleButton useNbtB;
private final IconButton whiteListB;
private final ToggleButton useOreDictB;
private final ToggleButton stickyB;
private final CycleButton<FuzzyMode> fuzzyB;
private final IItemFilterContainer filterContainer;
private final ItemFilter filter;
private final int buttonIdOffset;
private final int xOffset;
private final int yOffset;
final boolean isStickyModeAvailable;
private final boolean isInput;
public LimitedItemFilterGui(GuiContainerBaseEIO gui, IItemFilterContainer filterContainer,
boolean isStickyModeAvailable, boolean isInput) {
this(gui, filterContainer, isStickyModeAvailable, isInput, isInput ? 104 : 6, 96, isInput ? 0 : 256);
}
public LimitedItemFilterGui(GuiContainerBaseEIO gui, IItemFilterContainer filterContainer,
boolean isStickyModeAvailable, boolean isInput, int xOffset, int yOffset, int buttonIdOffset) {
this.gui = gui;
this.isStickyModeAvailable = isStickyModeAvailable;
this.filterContainer = filterContainer;
this.xOffset = xOffset;
this.yOffset = yOffset;
this.buttonIdOffset = buttonIdOffset;
this.isInput = isInput;
filter = filterContainer.getItemFilter();
int butLeft = xOffset;
int x = butLeft;
int y = yOffset + 40;
whiteListB = new IconButton(gui, ID_WHITELIST + buttonIdOffset, x, y, IconEIO.FILTER_WHITELIST);
whiteListB.setToolTip(getWhitelistTooltips(false));
x += 16;
useMetaB = new ToggleButton(gui, ID_META + buttonIdOffset, x, y, IconEIO.FILTER_META_OFF, IconEIO.FILTER_META);
useMetaB.setSelectedToolTip(EnderIO.lang.localize("gui.conduit.item.matchMetaData"));
useMetaB.setUnselectedToolTip(EnderIO.lang.localize("gui.conduit.item.ignoreMetaData"));
useMetaB.setPaintSelectedBorder(false);
x += 16;
stickyB = new ToggleButton(
gui,
ID_STICKY + buttonIdOffset,
x,
y,
IconEIO.FILTER_STICKY_OFF,
IconEIO.FILTER_STICKY);
stickyB.setSelectedToolTip(EnderIO.lang.localizeList("gui.conduit.item.stickyEnabled"));
stickyB.setUnselectedToolTip(EnderIO.lang.localize("gui.conduit.item.stickyDisbaled"));
stickyB.setPaintSelectedBorder(false);
if (isStickyModeAvailable) x += 16;
useOreDictB = new ToggleButton(
gui,
ID_ORE_DICT + buttonIdOffset,
x,
y,
IconEIO.FILTER_ORE_DICT_OFF,
IconEIO.FILTER_ORE_DICT);
useOreDictB.setSelectedToolTip(EnderIO.lang.localize("gui.conduit.item.oreDicEnabled"));
useOreDictB.setUnselectedToolTip(EnderIO.lang.localize("gui.conduit.item.oreDicDisabled"));
useOreDictB.setPaintSelectedBorder(false);
x += 16;
useNbtB = new ToggleButton(gui, ID_NBT + buttonIdOffset, x, y, IconEIO.FILTER_NBT_OFF, IconEIO.FILTER_NBT);
useNbtB.setSelectedToolTip(EnderIO.lang.localize("gui.conduit.item.matchNBT"));
useNbtB.setUnselectedToolTip(EnderIO.lang.localize("gui.conduit.item.ignoreNBT"));
useNbtB.setPaintSelectedBorder(false);
x += 16;
fuzzyB = new CycleButton<>(gui, ID_FUZZY + buttonIdOffset, x, y, FuzzyMode.class);
}
public void createFilterSlots() {
filter.createGhostSlots(gui.getGhostSlots(), xOffset + 1, yOffset + 1, new Runnable() {
@Override
public void run() {
sendFilterChange();
}
});
}
@Override
public void mouseClicked(int x, int y, int par3) {}
@Override
public void updateButtons() {
ItemFilter activeFilter = filter;
useNbtB.onGuiInit();
useNbtB.setSelected(activeFilter.isMatchNBT());
useOreDictB.onGuiInit();
useOreDictB.setSelected(activeFilter.isUseOreDict());
if (isStickyModeAvailable) {
stickyB.onGuiInit();
stickyB.setSelected(activeFilter.isSticky());
}
fuzzyB.onGuiInit();
fuzzyB.setMode(activeFilter.getFuzzyMode());
useMetaB.onGuiInit();
useMetaB.setSelected(activeFilter.isMatchMeta());
}
@Override
public void actionPerformed(GuiButton guiButton) {
if (guiButton.id == ID_META + buttonIdOffset) {
filter.setMatchMeta(useMetaB.isSelected());
sendFilterChange();
} else if (guiButton.id == ID_NBT + buttonIdOffset) {
filter.setMatchNBT(useNbtB.isSelected());
sendFilterChange();
} else if (guiButton.id == ID_STICKY + buttonIdOffset) {
filter.setSticky(stickyB.isSelected());
sendFilterChange();
} else if (guiButton.id == ID_ORE_DICT + buttonIdOffset) {
filter.setUseOreDict(useOreDictB.isSelected());
sendFilterChange();
} else if (guiButton.id == ID_FUZZY + buttonIdOffset) {
filter.setFuzzyMode(fuzzyB.getMode());
sendFilterChange();
} else if (guiButton.id == ID_WHITELIST + buttonIdOffset) {
filter.setBlacklist(!filter.isBlacklist());
sendFilterChange();
}
}
private void sendFilterChange() {
updateButtons();
filterContainer.onFilterChanged();
}
@Override
public void deactivate() {
useNbtB.detach();
useMetaB.detach();
useOreDictB.detach();
whiteListB.detach();
stickyB.detach();
fuzzyB.detach();
}
@Override
public void renderCustomOptions(int top, float par1, int par2, int par3) {
GL11.glColor3f(1, 1, 1);
gui.bindGuiTexture(1);
gui.drawTexturedModalRect(gui.getGuiLeft() + xOffset, gui.getGuiTop() + yOffset, 0, 238, 18 * 5, 18);
gui.drawTexturedModalRect(gui.getGuiLeft() + xOffset, gui.getGuiTop() + yOffset + 20, 0, 238, 18 * 5, 18);
}
private String[] getWhitelistTooltips(boolean isBlacklist) {
if (isBlacklist) {
return new String[] { EnderIO.lang.localize("gui.conduit.item.blacklist"),
EnderIO.lang.localize("gui.conduit.item.blacklist.tooltip.0"),
EnderIO.lang.localize("gui.conduit.item.blacklist.tooltip.1") };
} else {
return new String[] { EnderIO.lang.localize("gui.conduit.item.whitelist"),
EnderIO.lang.localize("gui.conduit.item.whitelist.tooltip.0"),
EnderIO.lang.localize("gui.conduit.item.whitelist.tooltip.1") };
}
}
}
@@ -37,7 +37,6 @@ public class ModItemFilterGui implements IItemFilterGui {
private final IconButton whiteListB;
private final int inputOffsetX;
private final int tfWidth;
private final int tfTextureX;
private final int tfTextureY;
@@ -56,13 +55,12 @@ public class ModItemFilterGui implements IItemFilterGui {
} else {
filter = (ModItemFilter) itemConduit.getOutputFilter(gui.getDir());
}
inputOffsetX = x;
tfWidth = 52;
tfTextureX = 120;
tfTextureY = 214;
inputBounds = new Rectangle[] { new Rectangle(inputOffsetX, y, 16, 16),
new Rectangle(inputOffsetX, y + 18, 16, 16), new Rectangle(inputOffsetX, y + 36, 16, 16) };
inputBounds = new Rectangle[] { new Rectangle(x, y, 16, 16), new Rectangle(x, y + 18, 16, 16),
new Rectangle(x, y + 36, 16, 16) };
deleteButs = new IconButton[inputBounds.length];
for (int i = 0; i < deleteButs.length; i++) {
@@ -14,17 +14,25 @@ import crazypants.enderio.conduit.item.NetworkedInventory;
import crazypants.enderio.conduit.item.filter.ExistingItemFilter;
import crazypants.enderio.conduit.packet.AbstractConduitPacket;
import crazypants.enderio.conduit.packet.ConTypeEnum;
import crazypants.util.ForgeDirections;
import io.netty.buffer.ByteBuf;
public class PacketExistingItemFilterSnapshot extends AbstractConduitPacket<IItemConduit>
implements IMessageHandler<PacketExistingItemFilterSnapshot, IMessage> {
public static enum Opcode {
public enum Opcode {
CLEAR,
SET,
MERGE,
SET_BLACK,
UNSET_BLACK
UNSET_BLACK;
private static final Opcode[] VALUES = values();
public static Opcode fromOrdinal(int ordinal) {
return VALUES[ordinal];
}
}
private ForgeDirection dir;
@@ -43,9 +51,9 @@ public class PacketExistingItemFilterSnapshot extends AbstractConduitPacket<IIte
@Override
public void fromBytes(ByteBuf buf) {
super.fromBytes(buf);
dir = ForgeDirection.values()[buf.readShort()];
dir = ForgeDirections.DIRECTIONS[buf.readShort()];
isInput = buf.readBoolean();
opcode = Opcode.values()[buf.readByte() & 255];
opcode = Opcode.fromOrdinal(buf.readByte() & 255);
}
@Override
@@ -58,6 +66,7 @@ public class PacketExistingItemFilterSnapshot extends AbstractConduitPacket<IIte
@Override
public PacketExistingItemFilterSnapshot onMessage(PacketExistingItemFilterSnapshot message, MessageContext ctx) {
if (isInvalidPacketForGui(message, ctx)) return null;
IItemConduit conduit = message.getTileCasted(ctx);
if (conduit == null) {
return null;
@@ -10,6 +10,7 @@ import crazypants.enderio.conduit.item.IItemConduit;
import crazypants.enderio.conduit.item.filter.ModItemFilter;
import crazypants.enderio.conduit.packet.AbstractConduitPacket;
import crazypants.enderio.conduit.packet.ConTypeEnum;
import crazypants.util.ForgeDirections;
import io.netty.buffer.ByteBuf;
public class PacketModItemFilter extends AbstractConduitPacket<IItemConduit>
@@ -33,7 +34,7 @@ public class PacketModItemFilter extends AbstractConduitPacket<IItemConduit>
@Override
public void fromBytes(ByteBuf buf) {
super.fromBytes(buf);
dir = ForgeDirection.values()[buf.readShort()];
dir = ForgeDirections.DIRECTIONS[buf.readShort()];
isInput = buf.readBoolean();
index = buf.readInt();
boolean isNull = buf.readBoolean();
@@ -58,6 +59,7 @@ public class PacketModItemFilter extends AbstractConduitPacket<IItemConduit>
@Override
public IMessage onMessage(PacketModItemFilter message, MessageContext ctx) {
if (isInvalidPacketForGui(message, ctx)) return null;
IItemConduit conduit = message.getTileCasted(ctx);
if (conduit == null) {
return null;
@@ -5,16 +5,21 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraftforge.common.util.ForgeDirection;
import cofh.api.transport.IItemDuct;
import com.enderio.core.common.util.DyeColor;
import cofh.api.transport.IItemDuct;
import crazypants.enderio.conduit.IConduit;
import crazypants.enderio.conduit.IExtractor;
import crazypants.enderio.conduit.item.filter.IItemFilter;
import crazypants.enderio.conduit.render.ConduitRenderer;
public interface IItemConduit extends IConduit, IItemDuct, IExtractor {
@Override
default ConduitRenderer getRenderer() {
return ItemConduitRenderer.instance.get();
}
IIcon getTextureForInputMode();
IIcon getTextureForOutputMode();
@@ -18,12 +18,11 @@ import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import cofh.api.inventory.IInventoryConnection;
import com.enderio.core.client.render.IconUtil;
import com.enderio.core.common.util.BlockCoord;
import com.enderio.core.common.util.DyeColor;
import cofh.api.inventory.IInventoryConnection;
import crazypants.enderio.EnderIO;
import crazypants.enderio.conduit.AbstractConduit;
import crazypants.enderio.conduit.AbstractConduitNetwork;
@@ -61,7 +60,7 @@ public class ItemConduit extends AbstractConduit implements IItemConduit {
public static final String ICON_KEY_ENDER = "enderio:ender_still";
static final Map<String, IIcon> ICONS = new HashMap<String, IIcon>();
static final Map<String, IIcon> ICONS = new HashMap<>();
public static void initIcons() {
IconUtil.addIconProvider(new IconUtil.IIconProvider() {
@@ -88,37 +87,24 @@ public class ItemConduit extends AbstractConduit implements IItemConduit {
ItemConduitNetwork network;
protected final EnumMap<ForgeDirection, RedstoneControlMode> extractionModes = new EnumMap<ForgeDirection, RedstoneControlMode>(
ForgeDirection.class);
protected final EnumMap<ForgeDirection, DyeColor> extractionColors = new EnumMap<ForgeDirection, DyeColor>(
ForgeDirection.class);
protected final EnumMap<ForgeDirection, RedstoneControlMode> extractionModes = new EnumMap<>(ForgeDirection.class);
protected final EnumMap<ForgeDirection, DyeColor> extractionColors = new EnumMap<>(ForgeDirection.class);
protected final EnumMap<ForgeDirection, IItemFilter> outputFilters = new EnumMap<ForgeDirection, IItemFilter>(
ForgeDirection.class);
protected final EnumMap<ForgeDirection, IItemFilter> inputFilters = new EnumMap<ForgeDirection, IItemFilter>(
ForgeDirection.class);
protected final EnumMap<ForgeDirection, ItemStack> outputFilterUpgrades = new EnumMap<ForgeDirection, ItemStack>(
ForgeDirection.class);
protected final EnumMap<ForgeDirection, ItemStack> inputFilterUpgrades = new EnumMap<ForgeDirection, ItemStack>(
ForgeDirection.class);
protected final EnumMap<ForgeDirection, ItemStack> speedUpgrades = new EnumMap<ForgeDirection, ItemStack>(
ForgeDirection.class);
protected final EnumMap<ForgeDirection, ItemStack> functionUpgrades = new EnumMap<ForgeDirection, ItemStack>(
ForgeDirection.class);
protected final EnumMap<ForgeDirection, IItemFilter> outputFilters = new EnumMap<>(ForgeDirection.class);
protected final EnumMap<ForgeDirection, IItemFilter> inputFilters = new EnumMap<>(ForgeDirection.class);
protected final EnumMap<ForgeDirection, ItemStack> outputFilterUpgrades = new EnumMap<>(ForgeDirection.class);
protected final EnumMap<ForgeDirection, ItemStack> inputFilterUpgrades = new EnumMap<>(ForgeDirection.class);
protected final EnumMap<ForgeDirection, ItemStack> speedUpgrades = new EnumMap<>(ForgeDirection.class);
protected final EnumMap<ForgeDirection, ItemStack> functionUpgrades = new EnumMap<>(ForgeDirection.class);
protected final EnumMap<ForgeDirection, Boolean> selfFeed = new EnumMap<ForgeDirection, Boolean>(
ForgeDirection.class);
protected final EnumMap<ForgeDirection, Boolean> selfFeed = new EnumMap<>(ForgeDirection.class);
protected final EnumMap<ForgeDirection, Boolean> roundRobin = new EnumMap<ForgeDirection, Boolean>(
ForgeDirection.class);
protected final EnumMap<ForgeDirection, Boolean> roundRobin = new EnumMap<>(ForgeDirection.class);
protected final EnumMap<ForgeDirection, Integer> priority = new EnumMap<ForgeDirection, Integer>(
ForgeDirection.class);
protected final EnumMap<ForgeDirection, Integer> priority = new EnumMap<>(ForgeDirection.class);
protected final EnumMap<ForgeDirection, DyeColor> outputColors = new EnumMap<ForgeDirection, DyeColor>(
ForgeDirection.class);
protected final EnumMap<ForgeDirection, DyeColor> inputColors = new EnumMap<ForgeDirection, DyeColor>(
ForgeDirection.class);
protected final EnumMap<ForgeDirection, DyeColor> outputColors = new EnumMap<>(ForgeDirection.class);
protected final EnumMap<ForgeDirection, DyeColor> inputColors = new EnumMap<>(ForgeDirection.class);
private int metaData;
@@ -147,7 +133,7 @@ public class ItemConduit extends AbstractConduit implements IItemConduit {
metaData = 0;
}
Map<ForgeDirection, ItemStack> converted = new HashMap<ForgeDirection, ItemStack>();
Map<ForgeDirection, ItemStack> converted = new HashMap<>();
convertToItemUpgrades(filterMeta, converted, inputFilters);
for (Entry<ForgeDirection, ItemStack> entry : converted.entrySet()) {
@@ -165,10 +151,10 @@ public class ItemConduit extends AbstractConduit implements IItemConduit {
@Override
protected void readTypeSettings(ForgeDirection dir, NBTTagCompound dataRoot) {
setExtractionSignalColor(dir, DyeColor.values()[dataRoot.getShort("extractionSignalColor")]);
setExtractionRedstoneMode(RedstoneControlMode.values()[dataRoot.getShort("extractionRedstoneMode")], dir);
setInputColor(dir, DyeColor.values()[dataRoot.getShort("inputColor")]);
setOutputColor(dir, DyeColor.values()[dataRoot.getShort("outputColor")]);
setExtractionSignalColor(dir, DyeColor.VALUES[dataRoot.getShort("extractionSignalColor")]);
setExtractionRedstoneMode(RedstoneControlMode.VALUES[dataRoot.getShort("extractionRedstoneMode")], dir);
setInputColor(dir, DyeColor.VALUES[dataRoot.getShort("inputColor")]);
setOutputColor(dir, DyeColor.VALUES[dataRoot.getShort("outputColor")]);
setSelfFeedEnabled(dir, dataRoot.getBoolean("selfFeed"));
setRoundRobinEnabled(dir, dataRoot.getBoolean("roundRobin"));
setOutputPriority(dir, dataRoot.getInteger("outputPriority"));
@@ -199,7 +185,7 @@ public class ItemConduit extends AbstractConduit implements IItemConduit {
@Override
public List<ItemStack> getDrops() {
List<ItemStack> res = new ArrayList<ItemStack>();
List<ItemStack> res = new ArrayList<>();
res.add(createItem());
for (ItemStack stack : speedUpgrades.values()) {
res.add(stack);
@@ -613,8 +599,7 @@ public class ItemConduit extends AbstractConduit implements IItemConduit {
@Override
public ItemStack createItem() {
ItemStack result = new ItemStack(EnderIO.itemItemConduit, 1, metaData);
return result;
return new ItemStack(EnderIO.itemItemConduit, 1, metaData);
}
@Override
@@ -852,15 +837,15 @@ public class ItemConduit extends AbstractConduit implements IItemConduit {
key = "extRM." + dir.name();
if (nbtRoot.hasKey(key)) {
short ord = nbtRoot.getShort(key);
if (ord >= 0 && ord < RedstoneControlMode.values().length) {
extractionModes.put(dir, RedstoneControlMode.values()[ord]);
if (ord >= 0 && ord < RedstoneControlMode.VALUES.length) {
extractionModes.put(dir, RedstoneControlMode.VALUES[ord]);
}
}
key = "extSC." + dir.name();
if (nbtRoot.hasKey(key)) {
short ord = nbtRoot.getShort(key);
if (ord >= 0 && ord < DyeColor.values().length) {
extractionColors.put(dir, DyeColor.values()[ord]);
if (ord >= 0 && ord < DyeColor.VALUES.length) {
extractionColors.put(dir, DyeColor.VALUES[ord]);
}
}
key = "selfFeed." + dir.name();
@@ -884,16 +869,16 @@ public class ItemConduit extends AbstractConduit implements IItemConduit {
key = "inSC." + dir.name();
if (nbtRoot.hasKey(key)) {
short ord = nbtRoot.getShort(key);
if (ord >= 0 && ord < DyeColor.values().length) {
inputColors.put(dir, DyeColor.values()[ord]);
if (ord >= 0 && ord < DyeColor.VALUES.length) {
inputColors.put(dir, DyeColor.VALUES[ord]);
}
}
key = "outSC." + dir.name();
if (nbtRoot.hasKey(key)) {
short ord = nbtRoot.getShort(key);
if (ord >= 0 && ord < DyeColor.values().length) {
outputColors.put(dir, DyeColor.values()[ord]);
if (ord >= 0 && ord < DyeColor.VALUES.length) {
outputColors.put(dir, DyeColor.VALUES[ord]);
}
}
}
@@ -8,10 +8,13 @@ import java.util.Map;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.IChatComponent;
import net.minecraftforge.common.util.ForgeDirection;
import com.enderio.core.common.util.BlockCoord;
import crazypants.enderio.EnderIO;
import crazypants.enderio.conduit.AbstractConduitNetwork;
import crazypants.enderio.conduit.item.NetworkedInventory.Target;
import crazypants.enderio.conduit.item.filter.IItemFilter;
@@ -19,10 +22,10 @@ import crazypants.enderio.machine.invpanel.server.InventoryDatabaseServer;
public class ItemConduitNetwork extends AbstractConduitNetwork<IItemConduit, IItemConduit> {
final List<NetworkedInventory> inventories = new ArrayList<NetworkedInventory>();
private final Map<BlockCoord, List<NetworkedInventory>> invMap = new HashMap<BlockCoord, List<NetworkedInventory>>();
final List<NetworkedInventory> inventories = new ArrayList<>();
private final Map<BlockCoord, List<NetworkedInventory>> invMap = new HashMap<>();
final Map<BlockCoord, IItemConduit> conMap = new HashMap<BlockCoord, IItemConduit>();
final Map<BlockCoord, IItemConduit> conMap = new HashMap<>();
private boolean requiresSort = true;
@@ -77,7 +80,7 @@ public class ItemConduitNetwork extends AbstractConduitNetwork<IItemConduit, IIt
}
public List<NetworkedInventory> getInventoryPanelSources() {
ArrayList<NetworkedInventory> res = new ArrayList<NetworkedInventory>();
ArrayList<NetworkedInventory> res = new ArrayList<>();
for (NetworkedInventory inv : inventories) {
if (inv.con.hasInventoryPanelUpgrade(inv.conDir)) {
res.add(inv);
@@ -89,7 +92,7 @@ public class ItemConduitNetwork extends AbstractConduitNetwork<IItemConduit, IIt
private List<NetworkedInventory> getOrCreate(BlockCoord bc) {
List<NetworkedInventory> res = invMap.get(bc);
if (res == null) {
res = new ArrayList<NetworkedInventory>();
res = new ArrayList<>();
invMap.put(bc, res);
}
return res;
@@ -176,8 +179,8 @@ public class ItemConduitNetwork extends AbstractConduitNetwork<IItemConduit, IIt
}
}
public List<String> getTargetsForExtraction(BlockCoord extractFrom, IItemConduit con, ItemStack input) {
List<String> result = new ArrayList<String>();
public List<IChatComponent> getTargetsForExtraction(BlockCoord extractFrom, IItemConduit con, ItemStack input) {
List<IChatComponent> result = new ArrayList<>();
List<NetworkedInventory> invs = getOrCreate(extractFrom);
for (NetworkedInventory source : invs) {
@@ -187,12 +190,12 @@ public class ItemConduitNetwork extends AbstractConduitNetwork<IItemConduit, IIt
for (Target t : source.sendPriority) {
IItemFilter f = t.inv.con.getOutputFilter(t.inv.conDir);
if (input == null || f == null || f.doesItemPassFilter(t.inv, input)) {
String s = t.inv.getLocalizedInventoryName() + " "
+ t.inv.location.chatString()
+ " Distance ["
+ t.distance
+ "] ";
result.add(s);
result.add(
t.inv.getInventoryNameComponent()
.appendText(" " + t.inv.location.chatString() + " ").appendSibling(
new ChatComponentTranslation(
EnderIO.lang.addPrefix("gui.mjReader.distance"),
t.distance)));
}
}
}
@@ -202,13 +205,13 @@ public class ItemConduitNetwork extends AbstractConduitNetwork<IItemConduit, IIt
return result;
}
public List<String> getInputSourcesFor(IItemConduit con, ForgeDirection dir, ItemStack input) {
List<String> result = new ArrayList<String>();
public List<IChatComponent> getInputSourcesFor(IItemConduit con, ForgeDirection dir, ItemStack input) {
List<IChatComponent> result = new ArrayList<>();
for (NetworkedInventory inv : inventories) {
if (inv.hasTarget(con, dir)) {
IItemFilter f = inv.con.getInputFilter(inv.conDir);
if (input == null || f == null || f.doesItemPassFilter(inv, input)) {
result.add(inv.getLocalizedInventoryName() + " " + inv.location.chatString());
result.add(inv.getInventoryNameComponent().appendText(" " + inv.location.chatString()));
}
}
}
@@ -13,17 +13,12 @@ import crazypants.enderio.conduit.IConduitBundle;
import crazypants.enderio.conduit.geom.ConnectionModeGeometry;
import crazypants.enderio.conduit.geom.Offset;
import crazypants.enderio.conduit.render.ConduitBundleRenderer;
import crazypants.enderio.conduit.render.ConduitRenderer;
import crazypants.enderio.conduit.render.DefaultConduitRenderer;
public class ItemConduitRenderer extends DefaultConduitRenderer {
@Override
public boolean isRendererForConduit(IConduit conduit) {
if (conduit instanceof IItemConduit) {
return true;
}
return false;
}
public static final ThreadLocal<ConduitRenderer> instance = ThreadLocal.withInitial(ItemConduitRenderer::new);
@Override
public void renderEntity(ConduitBundleRenderer conduitBundleRenderer, IConduitBundle te, IConduit conduit, double x,
@@ -64,9 +64,8 @@ public class ItemExtractSpeedUpgrade extends Item implements IResourceTooltipPro
}
@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
@SideOnly(Side.CLIENT)
public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List<ItemStack> par3List) {
for (int j = 0; j < UPGRADES.length; ++j) {
par3List.add(new ItemStack(par1, 1, j));
}
@@ -64,9 +64,8 @@ public class ItemFunctionUpgrade extends Item implements IResourceTooltipProvide
}
@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
@SideOnly(Side.CLIENT)
public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List<ItemStack> par3List) {
for (int j = 0; j < UPGRADES.length; ++j) {
par3List.add(new ItemStack(par1, 1, j));
}
@@ -14,7 +14,7 @@ public class ItemItemConduit extends AbstractItemConduit {
// new ItemConduitSubtype(ModObject.itemItemConduit.name(), "enderio:itemItemConduit"),
// new ItemConduitSubtype(ModObject.itemItemConduit.name() + "Empowered", "enderio:itemItemConduitAdvanced")
// };
private static ItemConduitSubtype[] subtypes = new ItemConduitSubtype[] {
private static final ItemConduitSubtype[] subtypes = new ItemConduitSubtype[] {
new ItemConduitSubtype(ModObject.itemItemConduit.name(), "enderio:itemItemConduit") };
public static ItemItemConduit create() {
@@ -6,11 +6,15 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Nullable;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.IChatComponent;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
@@ -22,8 +26,10 @@ import com.enderio.core.common.util.RoundRobinIterator;
import crazypants.enderio.conduit.ConnectionMode;
import crazypants.enderio.conduit.item.filter.IItemFilter;
import crazypants.enderio.conduit.item.filter.ItemFilterLimited;
import crazypants.enderio.config.Config;
import crazypants.enderio.machine.invpanel.TileInventoryPanel;
import crazypants.util.ForgeDirections;
public class NetworkedInventory {
@@ -33,15 +39,15 @@ public class NetworkedInventory {
BlockCoord location;
int inventorySide;
List<Target> sendPriority = new ArrayList<Target>();
RoundRobinIterator<Target> rrIter = new RoundRobinIterator<Target>(sendPriority);
List<Target> sendPriority = new ArrayList<>();
RoundRobinIterator<Target> rrIter = new RoundRobinIterator<>(sendPriority);
private int extractFromSlot = -1;
int tickDeficit;
// work around for a vanilla chest changing into a double chest without doing unneeded checks all the time
boolean recheckInv = false;
private TileEntity connectedTileEntity;
// Hack for TiC crafting station not working correctly when setting output slot to null
boolean ticHack = false;
@@ -60,19 +66,13 @@ public class NetworkedInventory {
this.location = location;
world = con.getBundle().getWorld();
TileEntity te = world.getTileEntity(location.x, location.y, location.z);
if (te.getClass().getName().equals("tconstruct.tools.logic.CraftingStationLogic")) {
ticHack = true;
} else if (te.getClass().getName().contains("cpw.mods.ironchest")) {
recheckInv = true;
} else if (te instanceof TileEntityChest) {
recheckInv = true;
} else if (te instanceof TileInventoryPanel) {
inventoryPanel = true;
}
updateInventory();
}
public boolean isInvalid() {
return connectedTileEntity == null || connectedTileEntity.isInvalid();
}
public boolean hasTarget(IItemConduit conduit, ForgeDirection dir) {
for (Target t : sendPriority) {
if (t.inv.con == conduit && t.inv.conDir == dir) {
@@ -109,6 +109,13 @@ public class NetworkedInventory {
}
public void onTick() {
if (isInvalid()) {
updateInventory();
if (isInvalid()) {
return;
}
}
if (tickDeficit > 0 || !canExtract() || !con.isExtractionRedstoneConditionMet(conDir)) {
// do nothing
} else {
@@ -143,11 +150,6 @@ public class NetworkedInventory {
}
private boolean transferItems() {
if (recheckInv) {
updateInventory();
}
int[] slotIndices = getInventory().getAccessibleSlotsFromSide(inventorySide);
if (slotIndices == null) {
return false;
@@ -155,6 +157,7 @@ public class NetworkedInventory {
int numSlots = slotIndices.length;
ItemStack extractItem = null;
int maxExtracted = con.getMaximumExtracted(conDir);
final IItemFilter filter = con.getInputFilter(conDir);
int slot = -1;
int slotChecksPerTick = Math.min(numSlots, ItemConduitNetwork.MAX_SLOT_CHECK_PER_TICK);
@@ -162,12 +165,23 @@ public class NetworkedInventory {
int index = nextSlot(numSlots);
slot = slotIndices[index];
ItemStack item = getInventory().getStackInSlot(slot);
if (canExtractItem(item)) {
extractItem = item.copy();
if (getInventory().canExtractItem(slot, extractItem, inventorySide)) {
if (doTransfer(extractItem, slot, maxExtracted)) {
setNextStartingSlot(slot);
return true;
if (item != null) {
if (filter != null && filter.isLimited()) {
final int count = ((ItemFilterLimited) filter).getInsertLimitInv(getInventory(), item);
if (count <= 0) {
continue;
} else if (count < item.stackSize) {
item = item.copy();
item.stackSize = count;
}
}
if (canExtractItem(item)) {
extractItem = item.copy();
if (getInventory().canExtractItem(slot, extractItem, inventorySide)) {
if (doTransfer(extractItem, slot, maxExtracted)) {
setNextStartingSlot(slot);
return true;
}
}
}
}
@@ -183,7 +197,11 @@ public class NetworkedInventory {
if (filter == null) {
return true;
}
return filter.doesItemPassFilter(this, itemStack);
if (filter.isLimited()) {
return filter.isValid() && ((ItemFilterLimited) filter).doesItemPassFilterInv(this, itemStack);
} else {
return filter.doesItemPassFilter(this, itemStack);
}
}
private boolean doTransfer(ItemStack extractedItem, int slot, int maxExtract) {
@@ -240,9 +258,6 @@ public class NetworkedInventory {
matchedStickyInput = of != null && of.isValid() && of.doesItemPassFilter(this, toExtract);
}
if (target.stickyInput || !matchedStickyInput) {
if (target.inv.recheckInv) {
target.inv.updateInventory();
}
int inserted = target.inv.insertItem(toExtract);
if (inserted > 0) {
toExtract.stackSize -= inserted;
@@ -264,25 +279,61 @@ public class NetworkedInventory {
}
public final void updateInventory() {
TileEntity te = world.getTileEntity(location.x, location.y, location.z);
if (te instanceof ISidedInventory) {
inv = (ISidedInventory) te;
} else if (te instanceof IInventory) {
inv = new InventoryWrapper((IInventory) te);
TileEntity newTe = world.getTileEntity(location.x, location.y, location.z);
if (newTe != connectedTileEntity) {
connectedTileEntity = newTe;
ticHack = false;
inventoryPanel = false;
if (connectedTileEntity != null) {
if (connectedTileEntity.getClass().getName().equals("tconstruct.tools.logic.CraftingStationLogic")) {
ticHack = true;
} else if (connectedTileEntity instanceof TileInventoryPanel) {
inventoryPanel = true;
}
}
network.routesChanged();
}
if (connectedTileEntity instanceof ISidedInventory) {
inv = (ISidedInventory) connectedTileEntity;
} else if (connectedTileEntity instanceof IInventory) {
inv = new InventoryWrapper((IInventory) connectedTileEntity);
} else {
inv = null;
}
}
private int insertItem(ItemStack item) {
if (isInvalid()) {
updateInventory();
if (isInvalid()) {
return 0;
}
}
if (!canInsert() || item == null) {
return 0;
}
IItemFilter filter = con.getOutputFilter(conDir);
if (filter != null) {
if (!filter.doesItemPassFilter(this, item)) {
if (filter.isLimited()) {
final int count = filter.getMaxCountThatCanPassFilter(item);
if (count <= 0) {
return 0;
} else {
final int maxInsert = ((ItemFilterLimited) filter).getInsertLimit(getInventory(), item);
if (maxInsert <= 0) {
return 0;
} else if (maxInsert < item.stackSize) {
item = item.copy();
item.stackSize = maxInsert;
}
}
} else if (!filter.doesItemPassFilter(this, item)) {
return 0;
}
}
return ItemUtil.doInsertItem(getInventory(), item, ForgeDirection.values()[inventorySide]);
return ItemUtil.doInsertItem(getInventory(), item, ForgeDirections.DIRECTIONS[inventorySide]);
}
void updateInsertOrder() {
@@ -290,7 +341,7 @@ public class NetworkedInventory {
if (!canExtract()) {
return;
}
List<Target> result = new ArrayList<NetworkedInventory.Target>();
List<Target> result = new ArrayList<>();
for (NetworkedInventory other : network.inventories) {
if ((con.isSelfFeedEnabled(conDir) || (other != this)) && other.canInsert()
@@ -308,8 +359,8 @@ public class NetworkedInventory {
Collections.sort(sendPriority);
} else {
if (!result.isEmpty()) {
Map<BlockCoord, Integer> visited = new HashMap<BlockCoord, Integer>();
List<BlockCoord> steps = new ArrayList<BlockCoord>();
Map<BlockCoord, Integer> visited = new HashMap<>();
List<BlockCoord> steps = new ArrayList<>();
steps.add(con.getLocation());
calculateDistances(result, visited, steps, 0);
@@ -326,7 +377,7 @@ public class NetworkedInventory {
return;
}
ArrayList<BlockCoord> nextSteps = new ArrayList<BlockCoord>();
ArrayList<BlockCoord> nextSteps = new ArrayList<>();
for (BlockCoord bc : steps) {
IItemConduit con = network.conMap.get(bc);
if (con != null) {
@@ -379,8 +430,8 @@ public class NetworkedInventory {
return inv;
}
public ISidedInventory getInventoryRecheck() {
if (recheckInv) {
public @Nullable ISidedInventory getInventoryRecheck() {
if (isInvalid()) {
updateInventory();
}
return inv;
@@ -394,6 +445,10 @@ public class NetworkedInventory {
this.inventorySide = inventorySide;
}
/**
* @deprecated Translates on the server. Use {@link #getInventoryNameComponent()} for chat.
*/
@Deprecated
public String getLocalizedInventoryName() {
String inventoryName = getInventory().getInventoryName();
if (inventoryName == null) {
@@ -405,6 +460,22 @@ public class NetworkedInventory {
}
}
public IChatComponent getInventoryNameComponent() {
String inventoryName = getInventory().getInventoryName();
if (inventoryName == null) {
return new ChatComponentText("null");
}
// Ask the tile entity: InventoryWrapper always reports no custom name.
// The client parses the translation as a format string and falls back to en_US if it fails, so a '%' in the
// en_US text (or in the key when untranslated) could crash it. A dedicated server translates to en_US.
boolean customName = connectedTileEntity instanceof IInventory
&& ((IInventory) connectedTileEntity).hasCustomInventoryName();
if (customName || StatCollector.translateToLocal(inventoryName).contains("%")) {
return new ChatComponentText(inventoryName);
}
return new ChatComponentTranslation(inventoryName);
}
static class Target implements Comparable<Target> {
NetworkedInventory inv;
@@ -47,8 +47,8 @@ public class ExistingItemFilter implements IItemFilter {
private boolean isStackInInventory(NetworkedInventory ni, ItemStack item) {
int[] slots = ni.getInventory().getAccessibleSlotsFromSide(ni.getInventorySide());
for (int i = 0; i < slots.length; i++) {
ItemStack stack = ni.getInventory().getStackInSlot(i);
for (int slot : slots) {
ItemStack stack = ni.getInventory().getStackInSlot(slot);
if (stackEqual(item, stack)) {
return true;
}
@@ -107,17 +107,17 @@ public class ExistingItemFilter implements IItemFilter {
}
public void setSnapshot(NetworkedInventory ni) {
snapshot = new ArrayList<ItemStack>();
snapshot = new ArrayList<>();
mergeSnapshot(ni);
}
public void mergeSnapshot(NetworkedInventory ni) {
if (snapshot == null) {
snapshot = new ArrayList<ItemStack>();
snapshot = new ArrayList<>();
}
int[] slots = ni.getInventory().getAccessibleSlotsFromSide(ni.getInventorySide());
for (int i = 0; i < slots.length; i++) {
ItemStack stack = ni.getInventory().getStackInSlot(i);
for (int slot : slots) {
ItemStack stack = ni.getInventory().getStackInSlot(slot);
if (stack != null && !isStackInSnapshot(stack)) {
snapshot.add(stack);
}
@@ -126,7 +126,7 @@ public class ExistingItemFilter implements IItemFilter {
public boolean mergeSnapshot(IInventory inventory) {
if (snapshot == null) {
snapshot = new ArrayList<ItemStack>();
snapshot = new ArrayList<>();
}
int size = inventory.getSizeInventory();
boolean added = false;
@@ -200,7 +200,7 @@ public class ExistingItemFilter implements IItemFilter {
readSettingsFromNBT(nbtRoot);
if (nbtRoot.hasKey("snapshot")) {
snapshot = new ArrayList<ItemStack>();
snapshot = new ArrayList<>();
NBTTagList itemList = (NBTTagList) nbtRoot.getTag("snapshot");
for (int i = 0; i < itemList.tagCount(); i++) {
NBTTagCompound itemTag = itemList.getCompoundTagAt(i);
@@ -274,7 +274,7 @@ public class ExistingItemFilter implements IItemFilter {
snapshot = null;
return;
}
snapshot = new ArrayList<ItemStack>(numItems);
snapshot = new ArrayList<>(numItems);
for (int i = 0; i < numItems; i++) {
NBTTagCompound itemTag = NetworkUtil.readNBTTagCompound(buf);
ItemStack item = ItemStack.loadItemStackFromNBT(itemTag);
@@ -30,7 +30,7 @@ public interface IItemFilter {
/**
* Checks if the given item passes the filter or not.
*
*
* @param inv the attached inventory - or null when used without an inventory (eg for a GUI)
* @param item the item to check
* @return true if the item is allowed to pass
@@ -41,10 +41,18 @@ public interface IItemFilter {
boolean isValid();
default boolean isLimited() {
return false;
}
boolean isSticky();
void createGhostSlots(List<GhostSlot> slots, int xOffset, int yOffset, Runnable cb);
default int getMaxCountThatCanPassFilter(ItemStack item) {
return 1;
}
int getSlotCount();
default String getUnlocalizedName() {
@@ -82,9 +82,8 @@ public class ItemBasicItemFilter extends Item implements IItemFilterUpgrade {
}
@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
@SideOnly(Side.CLIENT)
public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List<ItemStack> par3List) {
for (int j = 0; j < 2; ++j) {
par3List.add(new ItemStack(this, 1, j));
}
@@ -92,7 +91,8 @@ public class ItemBasicItemFilter extends Item implements IItemFilterUpgrade {
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List<String> par3List,
boolean par4) {
if (FilterRegister.isFilterSet(par1ItemStack)) {
if (!SpecialTooltipHandler.showAdvancedTooltips()) {
par3List.add(EnderIO.lang.localize("itemConduitFilterUpgrade"));
@@ -8,6 +8,7 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
@@ -67,7 +68,7 @@ public class ItemExistingItemFilter extends Item implements IItemFilterUpgrade,
ExistingItemFilter filter = (ExistingItemFilter) createFilterFromStack(item);
String unloc = "item.itemExistingItemFilter."
+ (filter.mergeSnapshot(inv) ? "filterUpdated" : "filterNotUpdated");
ChatUtil.sendNoSpamUnloc(player, EnderIO.lang, unloc);
ChatUtil.sendNoSpam(player, new ChatComponentTranslation(EnderIO.lang.addPrefix(unloc)));
FilterRegister.writeFilterToStack(filter, item);
return true;
}
@@ -89,7 +90,8 @@ public class ItemExistingItemFilter extends Item implements IItemFilterUpgrade,
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List<String> par3List,
boolean par4) {
if (FilterRegister.isFilterSet(par1ItemStack)) {
if (SpecialTooltipHandler.showAdvancedTooltips()) {
par3List.add(EnumChatFormatting.ITALIC + EnderIO.lang.localize("itemConduitFilterUpgrade.configured"));
@@ -75,7 +75,7 @@ public class ItemFilter implements IInventory, IItemFilter {
this.isAdvanced = isAdvanced;
this.numItems = numItems;
items = new ItemStack[numItems];
oreIds = new ArrayList<int[]>(numItems);
oreIds = new ArrayList<>(numItems);
for (int i = 0; i < numItems; i++) {
oreIds.add(null);
}
@@ -91,14 +91,13 @@ public class ItemFilter implements IInventory, IItemFilter {
return doesItemPassFilter(item);
}
@SuppressWarnings("SimplifiableConditionalExpression")
public boolean doesItemPassFilter(ItemStack item) {
boolean allow = isValid() && itemMatched(item);
return isBlacklist ? !allow : allow;
return isBlacklist ^ allow;
}
private boolean itemMatched(ItemStack item) {
protected boolean itemMatched(ItemStack item) {
if (item == null) {
return false;
}
@@ -145,7 +144,7 @@ public class ItemFilter implements IInventory, IItemFilter {
return matched;
}
private boolean isOreDicMatch(int filterItemIndex, ItemStack item) {
protected boolean isOreDicMatch(int filterItemIndex, ItemStack item) {
int[] ids1 = getCachedIds(filterItemIndex);
if (ids1 == null || ids1.length == 0) {
return false;
@@ -164,8 +163,9 @@ public class ItemFilter implements IInventory, IItemFilter {
return false;
}
private boolean isNBTMatch(ItemStack filter, ItemStack item) {
if (filter.stackTagCompound == null && item.stackTagCompound == null) return true;
protected boolean isNBTMatch(ItemStack filter, ItemStack item) {
if (filter.stackTagCompound == null && (item.stackTagCompound == null || item.stackTagCompound.hasNoTags()))
return true;
if (filter.stackTagCompound == null || item.stackTagCompound == null) return false;
if (!filter.getTagCompound().hasKey("GEN")) return filter.stackTagCompound.equals(item.stackTagCompound);
NBTTagCompound filterTag = (NBTTagCompound) filter.getTagCompound().copy();
@@ -202,7 +202,7 @@ public class ItemFilter implements IInventory, IItemFilter {
return !isItemListEmpty();
}
private boolean isItemListEmpty() {
protected boolean isItemListEmpty() {
for (ItemStack item : items) {
if (item != null) {
return false;
@@ -0,0 +1,242 @@
package crazypants.enderio.conduit.item.filter;
import java.util.List;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import com.enderio.core.client.gui.widget.GhostSlot;
import cofh.lib.util.helpers.MathHelper;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import crazypants.enderio.conduit.gui.GuiExternalConnection;
import crazypants.enderio.conduit.gui.item.IItemFilterGui;
import crazypants.enderio.conduit.gui.item.ItemConduitFilterContainer;
import crazypants.enderio.conduit.gui.item.LimitedItemFilterGui;
import crazypants.enderio.conduit.item.IItemConduit;
import crazypants.enderio.conduit.item.NetworkedInventory;
public class ItemFilterLimited extends ItemFilter {
public ItemFilterLimited() {
this(10, true);
}
public ItemFilterLimited(int numItems, boolean isAdvanced) {
super(numItems, isAdvanced);
}
@Override
public String getInventoryName() {
return "Limited Item Filter";
}
@Override
@SideOnly(Side.CLIENT)
public IItemFilterGui getGui(GuiExternalConnection gui, IItemConduit itemConduit, boolean isInput) {
ItemConduitFilterContainer cont = new ItemConduitFilterContainer(itemConduit, gui.getDir(), isInput);
LimitedItemFilterGui limitedItemFilterGui = new LimitedItemFilterGui(gui, cont, !isInput, isInput);
limitedItemFilterGui.createFilterSlots();
return limitedItemFilterGui;
}
@Override
public void createGhostSlots(List<GhostSlot> slots, int xOffset, int yOffset, Runnable cb) {
int index = 0;
int numRows = (int) (double) (items.length / 5);
for (int row = 0; row < numRows; ++row) {
for (int col = 0; col < 5; ++col) {
int x = xOffset + col * 18;
int y = yOffset + row * 20;
slots.add(new ItemFilterGhostSlot(index, x, y, cb));
index++;
}
}
}
@Override
public int getMaxCountThatCanPassFilter(ItemStack item) {
if (item == null || item.getItem() == null) {
return 0;
}
int count = 0;
for (int i = 0; i < items.length; i++) {
ItemStack invStack = items[i];
if (invStack != null && itemStackMatched(invStack, item, i)) {
count += invStack.stackSize;
}
}
return count;
}
@Override
public boolean isLimited() {
return true;
}
public int getInsertLimit(ISidedInventory inv, ItemStack item) {
if (item == null || item.getItem() == null) {
return 0;
}
int count = 0;
for (int i = 0; i < inv.getSizeInventory(); i++) {
ItemStack invStack = inv.getStackInSlot(i);
if (invStack != null && itemStackMatched(invStack, item, i)) {
count += invStack.stackSize;
}
}
return getMaxCountThatCanPassFilter(item) - count;
}
public int getInsertLimitInv(ISidedInventory inv, ItemStack item) {
return -getInsertLimit(inv, item);
}
public boolean doesCountPassFilter(int maxCount) {
return maxCount > 0;
}
@Override
public boolean doesItemPassFilter(NetworkedInventory inv, ItemStack item) {
return isValid() && itemMatched(item) && doesCountPassFilter(getInsertLimit(inv.getInventory(), item));
}
// Filter in extract slot
public boolean doesItemPassFilterInv(NetworkedInventory inv, ItemStack item) {
return isValid() && itemMatched(item) && doesCountPassFilter(getInsertLimitInv(inv.getInventory(), item));
}
protected boolean itemStackMatched(ItemStack item, ItemStack filter, int slot) {
if (item == null) {
return false;
}
boolean checkDamage = fuzzyMode != FuzzyMode.DISABLED;
boolean damageMatched = false;
if (checkDamage && item.getItem().isDamageable()) {
damageMatched = fuzzyMode.compare(item);
}
if (isItemListEmpty()) {
if (checkDamage) {
return damageMatched;
} else {
return false;
}
}
boolean matched = false;
if (filter != null && item.getItem() == filter.getItem()) {
matched = true;
if (checkDamage && !damageMatched) {
matched = false;
} else if (matchMeta && item.getItemDamage() != filter.getItemDamage()) {
matched = false;
} else if (matchNBT && !isNBTMatch(item, filter)) {
matched = false;
}
}
if (!matched && useOreDict && isOreDicMatch(filter, item)) {
matched = true;
}
return matched;
}
public boolean isOreDicMatch(ItemStack filter, ItemStack item) {
int[] id_filter = OreDictionary.getOreIDs(filter);
if (id_filter.length == 0) {
return false;
}
int[] id_item = OreDictionary.getOreIDs(item);
if (id_item.length == 0) {
return false;
}
for (int id1 : id_filter) {
for (int id2 : id_item) {
if (id1 == id2) {
return true;
}
}
}
return false;
}
@Override
public ItemStack decrStackSize(int fromSlot, int amount) {
if ((fromSlot < 0) || (fromSlot >= items.length)) {
return null;
}
oreIds.set(fromSlot, null);
ItemStack item = items[fromSlot];
items[fromSlot] = null;
return item.splitStack(amount);
}
@Override
public String toString() {
return "Limited" + super.toString();
}
@Override
public String getUnlocalizedName() {
return "gui.limited_item_filter";
}
class ItemFilterGhostSlot extends GhostSlot {
private final int slot;
private final Runnable cb;
private final int adjustOnShift;
ItemFilterGhostSlot(int slot, int x, int y, Runnable cb) {
this.x = x;
this.y = y;
this.slot = slot;
this.cb = cb;
this.displayStdOverlay = true;
this.stackSizeLimit = 64;
this.adjustOnShift = 10;
}
@Override
public void putStack(ItemStack stack) {
if (stack != null) {
stack = stack.copy();
if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
if (Mouse.isButtonDown(0) || Mouse.getEventDWheel() > 0) {
if (stack.stackSize - 1 == 1) {
stack.stackSize += adjustOnShift - 2;
} else {
stack.stackSize = MathHelper
.clamp(stack.stackSize + adjustOnShift - 1, 1, stack.getMaxStackSize());
}
} else if (Mouse.isButtonDown(1) || Mouse.getEventDWheel() < 0) {
if (stack.stackSize + 1 == 1) {
stack.stackSize++;
} else {
stack.stackSize = MathHelper
.clamp(stack.stackSize - adjustOnShift + 1, 1, stack.getMaxStackSize());
}
}
}
}
items[slot] = stack;
cb.run();
}
@Override
public ItemStack getStack() {
return items[slot];
}
}
}
@@ -0,0 +1,74 @@
package crazypants.enderio.conduit.item.filter;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import com.enderio.core.api.client.gui.IResourceTooltipProvider;
import com.enderio.core.client.handlers.SpecialTooltipHandler;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import crazypants.enderio.EnderIO;
import crazypants.enderio.EnderIOTab;
import crazypants.enderio.ModObject;
import crazypants.enderio.conduit.item.FilterRegister;
public class ItemLimitedItemFilter extends Item implements IItemFilterUpgrade, IResourceTooltipProvider {
public static ItemLimitedItemFilter create() {
ItemLimitedItemFilter result = new ItemLimitedItemFilter();
result.init();
return result;
}
protected ItemLimitedItemFilter() {
setCreativeTab(EnderIOTab.tabEnderIO);
setUnlocalizedName(ModObject.itemLimitedItemFilter.unlocalisedName);
setMaxDamage(0);
setMaxStackSize(64);
}
protected void init() {
GameRegistry.registerItem(this, ModObject.itemLimitedItemFilter.unlocalisedName);
}
@Override
public IItemFilter createFilterFromStack(ItemStack stack) {
IItemFilter filter = new ItemFilterLimited();
if (stack.stackTagCompound != null && stack.stackTagCompound.hasKey("filter")) {
filter.readFromNBT(stack.stackTagCompound.getCompoundTag("filter"));
}
return filter;
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister IIconRegister) {
itemIcon = IIconRegister.registerIcon("enderio:limitedItemFilter");
}
@Override
public String getUnlocalizedNameForTooltip(ItemStack stack) {
return getUnlocalizedName();
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List<String> par3List,
boolean par4) {
if (FilterRegister.isFilterSet(par1ItemStack)) {
if (SpecialTooltipHandler.showAdvancedTooltips()) {
par3List.add(EnumChatFormatting.ITALIC + EnderIO.lang.localize("itemConduitFilterUpgrade.configured"));
par3List.add(
EnumChatFormatting.ITALIC
+ EnderIO.lang.localize("itemConduitFilterUpgrade.clearConfigMethod"));
}
}
}
}
@@ -60,7 +60,8 @@ public class ItemModItemFilter extends Item implements IItemFilterUpgrade, IReso
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List<String> par3List,
boolean par4) {
if (FilterRegister.isFilterSet(par1ItemStack)) {
if (SpecialTooltipHandler.showAdvancedTooltips()) {
par3List.add(EnumChatFormatting.ITALIC + EnderIO.lang.localize("itemConduitFilterUpgrade.configured"));
@@ -13,7 +13,6 @@ import crazypants.enderio.EnderIOTab;
import crazypants.enderio.ModObject;
/**
*
* @author matthias
*/
public class ItemPowerItemFilter extends Item implements IItemFilterUpgrade, IResourceTooltipProvider {
@@ -5,11 +5,10 @@ import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import cofh.api.energy.IEnergyContainerItem;
import com.enderio.core.client.gui.widget.GhostSlot;
import com.enderio.core.common.network.NetworkUtil;
import cofh.api.energy.IEnergyContainerItem;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import crazypants.enderio.conduit.gui.GuiExternalConnection;
@@ -20,7 +19,6 @@ import crazypants.enderio.conduit.item.NetworkedInventory;
import io.netty.buffer.ByteBuf;
/**
*
* @author matthias
*/
public class PowerItemFilter implements IItemFilter {
@@ -7,7 +7,7 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.function.Supplier;
import java.util.function.IntSupplier;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
@@ -34,6 +34,7 @@ import crazypants.enderio.conduit.IConduit;
import crazypants.enderio.conduit.RaytraceResult;
import crazypants.enderio.conduit.geom.CollidableComponent;
import crazypants.enderio.conduit.item.ItemConduit;
import crazypants.enderio.conduit.render.ConduitRenderer;
import crazypants.enderio.config.Config;
import crazypants.enderio.machine.RedstoneControlMode;
import crazypants.enderio.tool.ToolUtil;
@@ -46,9 +47,14 @@ public abstract class AbstractEnderLiquidConduit extends AbstractLiquidConduit {
public static final String ICON_KEY_IN_OUT_OUT = ItemConduit.ICON_KEY_IN_OUT_OUT;
public static final String ICON_KEY_IN_OUT_IN = ItemConduit.ICON_KEY_IN_OUT_IN;
static final Map<String, IIcon> ICONS = new HashMap<String, IIcon>();
static final Map<String, IIcon> ICONS = new HashMap<>();
private final Set<BlockCoord> filledFromThisTick = new HashSet<>();
@Override
public ConduitRenderer getRenderer() {
return EnderLiquidConduitRenderer.instance.get();
}
@SideOnly(Side.CLIENT)
public static void initIcons() {
IconUtil.addIconProvider(new IconUtil.IIconProvider() {
@@ -83,35 +89,31 @@ public abstract class AbstractEnderLiquidConduit extends AbstractLiquidConduit {
STELLAR(() -> Config.stellarEnderFluidConduitExtractRate, () -> Config.stellarEnderFluidConduitMaxIoRate);
private final Supplier<Integer> getMaxExtractPerTick;
private final Supplier<Integer> getMaxIoPerTick;
private final IntSupplier getMaxExtractPerTick;
private final IntSupplier getMaxIoPerTick;
Type(Supplier<Integer> getMaxExtractPerTick, Supplier<Integer> getMaxIoPerTick) {
Type(IntSupplier getMaxExtractPerTick, IntSupplier getMaxIoPerTick) {
this.getMaxExtractPerTick = getMaxExtractPerTick;
this.getMaxIoPerTick = getMaxIoPerTick;
}
public int getMaxExtractPerTick() {
return getMaxExtractPerTick.get();
return getMaxExtractPerTick.getAsInt();
}
public int getMaxIoPerTick() {
return getMaxIoPerTick.get();
return getMaxIoPerTick.getAsInt();
}
}
private EnderLiquidConduitNetwork network;
private int ticksSinceFailedExtract;
private final EnumMap<ForgeDirection, FluidFilter> outputFilters = new EnumMap<ForgeDirection, FluidFilter>(
ForgeDirection.class);
private final EnumMap<ForgeDirection, FluidFilter> inputFilters = new EnumMap<ForgeDirection, FluidFilter>(
ForgeDirection.class);
private final EnumMap<ForgeDirection, FluidFilter> outputFilters = new EnumMap<>(ForgeDirection.class);
private final EnumMap<ForgeDirection, FluidFilter> inputFilters = new EnumMap<>(ForgeDirection.class);
protected final EnumMap<ForgeDirection, DyeColor> outputColors = new EnumMap<ForgeDirection, DyeColor>(
ForgeDirection.class);
protected final EnumMap<ForgeDirection, DyeColor> inputColors = new EnumMap<ForgeDirection, DyeColor>(
ForgeDirection.class);
protected final EnumMap<ForgeDirection, DyeColor> outputColors = new EnumMap<>(ForgeDirection.class);
protected final EnumMap<ForgeDirection, DyeColor> inputColors = new EnumMap<>(ForgeDirection.class);
private int roundRobin = 0;
@@ -302,7 +304,6 @@ public abstract class AbstractEnderLiquidConduit extends AbstractLiquidConduit {
}
private void doExtract() {
BlockCoord loc = getLocation();
if (!hasExtractableMode()) {
return;
}
@@ -419,10 +420,10 @@ public abstract class AbstractEnderLiquidConduit extends AbstractLiquidConduit {
super.readTypeSettings(dir, dataRoot);
if (dataRoot.hasKey("inputColor")) {
setInputColor(dir, DyeColor.values()[dataRoot.getShort("inputColor")]);
setInputColor(dir, DyeColor.VALUES[dataRoot.getShort("inputColor")]);
}
if (dataRoot.hasKey("outputColor")) {
setOutputColor(dir, DyeColor.values()[dataRoot.getShort("outputColor")]);
setOutputColor(dir, DyeColor.VALUES[dataRoot.getShort("outputColor")]);
}
if (dataRoot.hasKey("roundRobin")) {
@@ -537,16 +538,16 @@ public abstract class AbstractEnderLiquidConduit extends AbstractLiquidConduit {
key = "inSC." + dir.name();
if (nbtRoot.hasKey(key)) {
short ord = nbtRoot.getShort(key);
if (ord >= 0 && ord < DyeColor.values().length) {
inputColors.put(dir, DyeColor.values()[ord]);
if (ord >= 0 && ord < DyeColor.VALUES.length) {
inputColors.put(dir, DyeColor.VALUES[ord]);
}
}
key = "outSC." + dir.name();
if (nbtRoot.hasKey(key)) {
short ord = nbtRoot.getShort(key);
if (ord >= 0 && ord < DyeColor.values().length) {
outputColors.put(dir, DyeColor.values()[ord]);
if (ord >= 0 && ord < DyeColor.VALUES.length) {
outputColors.put(dir, DyeColor.VALUES[ord]);
}
}
}
@@ -16,6 +16,7 @@ import com.enderio.core.common.util.BlockCoord;
import com.enderio.core.common.util.DyeColor;
import com.enderio.core.common.util.FluidUtil;
import crazypants.enderio.EnderIO;
import crazypants.enderio.conduit.AbstractConduit;
import crazypants.enderio.conduit.ConduitUtil;
import crazypants.enderio.conduit.ConnectionMode;
@@ -23,15 +24,15 @@ import crazypants.enderio.conduit.IConduit;
import crazypants.enderio.conduit.IConduitBundle;
import crazypants.enderio.machine.RedstoneControlMode;
import crazypants.enderio.machine.reservoir.TileReservoir;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
public abstract class AbstractLiquidConduit extends AbstractConduit implements ILiquidConduit {
protected final EnumMap<ForgeDirection, RedstoneControlMode> extractionModes = new EnumMap<ForgeDirection, RedstoneControlMode>(
ForgeDirection.class);
protected final EnumMap<ForgeDirection, DyeColor> extractionColors = new EnumMap<ForgeDirection, DyeColor>(
ForgeDirection.class);
protected final EnumMap<ForgeDirection, RedstoneControlMode> extractionModes = new EnumMap<>(ForgeDirection.class);
protected final EnumMap<ForgeDirection, DyeColor> extractionColors = new EnumMap<>(ForgeDirection.class);
protected final Map<ForgeDirection, Integer> externalRedstoneSignals = new HashMap<ForgeDirection, Integer>();
protected final Map<ForgeDirection, Integer> externalRedstoneSignals = new HashMap<>();
protected boolean redstoneStateDirty = true;
public static IFluidHandler getExternalFluidHandler(IBlockAccess world, BlockCoord bc) {
@@ -54,6 +55,12 @@ public abstract class AbstractLiquidConduit extends AbstractConduit implements I
if (h == null) {
return false;
}
if (EnderIO.hasGT5 && h instanceof IGregTechTileEntity) {
IMetaTileEntity mte = ((IGregTechTileEntity) h).getMetaTileEntity();
return mte != null && mte.getCapacity() > 0;
}
// TODO: This check was added to work around a bug in dynamic tanks, but
// it causes issues with not conecting to empty tanks such as dim. trans +
// BC fluid pipes, so I am removing it for now.
@@ -148,11 +155,11 @@ public abstract class AbstractLiquidConduit extends AbstractConduit implements I
boolean res;
if (mode == RedstoneControlMode.OFF) {
// if checking for no signal, must be no signal from both
res = mode.isConditionMet(mode, signal)
res = RedstoneControlMode.isConditionMet(mode, signal)
&& (col != DyeColor.RED || isConditionMetByExternalSignal(dir, mode, col));
} else {
// if checking for a signal, either is fine
res = mode.isConditionMet(mode, signal)
res = RedstoneControlMode.isConditionMet(mode, signal)
|| (col == DyeColor.RED && isConditionMetByExternalSignal(dir, mode, col));
}
return res;
@@ -171,7 +178,12 @@ public abstract class AbstractLiquidConduit extends AbstractConduit implements I
}
}
return mode.isConditionMet(mode, externalSignal);
return RedstoneControlMode.isConditionMet(mode, externalSignal);
}
@Override
protected ConnectionMode getDefaultConnectionMode() {
return ConnectionMode.INPUT;
}
@Override
@@ -190,8 +202,8 @@ public abstract class AbstractLiquidConduit extends AbstractConduit implements I
@Override
protected void readTypeSettings(ForgeDirection dir, NBTTagCompound dataRoot) {
setExtractionSignalColor(dir, DyeColor.values()[dataRoot.getShort("extractionSignalColor")]);
setExtractionRedstoneMode(RedstoneControlMode.values()[dataRoot.getShort("extractionRedstoneMode")], dir);
setExtractionSignalColor(dir, DyeColor.VALUES[dataRoot.getShort("extractionSignalColor")]);
setExtractionRedstoneMode(RedstoneControlMode.VALUES[dataRoot.getShort("extractionRedstoneMode")], dir);
}
@Override
@@ -227,15 +239,15 @@ public abstract class AbstractLiquidConduit extends AbstractConduit implements I
String key = "extRM." + dir.name();
if (nbtRoot.hasKey(key)) {
short ord = nbtRoot.getShort(key);
if (ord >= 0 && ord < RedstoneControlMode.values().length) {
extractionModes.put(dir, RedstoneControlMode.values()[ord]);
if (ord >= 0 && ord < RedstoneControlMode.VALUES.length) {
extractionModes.put(dir, RedstoneControlMode.VALUES[ord]);
}
}
key = "extSC." + dir.name();
if (nbtRoot.hasKey(key)) {
short ord = nbtRoot.getShort(key);
if (ord >= 0 && ord < DyeColor.values().length) {
extractionColors.put(dir, DyeColor.values()[ord]);
if (ord >= 0 && ord < DyeColor.VALUES.length) {
extractionColors.put(dir, DyeColor.VALUES[ord]);
}
}
}
Loaded 100 of 1357 files, more files were not shown because too many files have changed in this diff. Show more