Compare commits

...

232 Commits

Author SHA1 Message Date
NotMyWing 8d4e5734e8 automatically add papers for GT multiblocks 2024-06-01 19:12:45 +11:00
NotMyWing 00ac7c3334 rewrite transfer logic 2024-06-01 18:46:11 +11:00
NotMyWing bcc28c0b28 extra tooltip check just in case 2024-05-31 18:23:54 +11:00
NotMyWing a03d6f4803 bypass unnecessary fuzzy checks if we're ignoring durability anyway 2024-05-31 18:10:37 +11:00
NotMyWing e3b8228608 boring stuff (who even reads these) 2024-05-31 00:42:43 +11:00
NotMyWing 68de8fa1a2 Make OreDict Storage Buses upgradeable
Closes #403
2024-05-28 17:51:07 +11:00
NotMyWing 6864f7ae07 Fix ME Interface GuiSync overlap 2024-05-28 17:15:25 +11:00
NotMyWing 7fa7b726f2 Disable extracting invisible items from Storage Buses altogether
Reverts d82cdabc6d, closes #408
Allows Cells to report/extract lingering unpartitioned items
2024-05-27 20:41:15 +11:00
zeng-git c814fe591d Update zh_cn.lang (#443) 2024-05-27 13:31:22 +11:00
NotMyWing cd0a5d631b Temporarily prevent FakePlayers from using wrenches
Closes #432
2024-05-27 13:28:48 +11:00
NotMyWing d82cdabc6d Fix crafting plan reporting invisible extractable items as available
Closes #438
2024-05-25 00:37:46 +11:00
NotMyWing 2e976a609f Make Storage Cell tooltips configurable
Closes #427
2024-05-24 23:54:05 +11:00
Zengyj a13f9955f2 Backport lock crafting function for ME Interface (#423) 2024-05-24 23:39:03 +11:00
Michael Trittin a65b5015e6 Allow View Cells to be shift-clicked into place (#388) 2024-05-24 23:13:15 +11:00
Yang Xizhi 07eb6c1238 Allow third-party addons to register custom GUIs via GuiBridge (#402) 2024-05-24 23:05:29 +11:00
Domi 529ea5e239 Small UI fixes and improvements (#398) 2024-05-24 23:03:12 +11:00
NotMyWing a9b7faa98b Fix OreDict filters not testing items without entries 2024-05-24 22:52:50 +11:00
Serenibyss 78c7235bea Improve ME Interface Terminal UI (#368)
Co-authored-by: NotMyWing <winwyv@gmail.com>
2024-05-24 22:15:15 +11:00
zeng-git 59edb38208 Add ore dictionary support for Inscriber recipes in JEI (#430) 2024-05-24 21:51:37 +11:00
NotMyWing 08a7aff600 Fix ME Export Buses oversending items
As a side effect, fixes them not sending anything at all with too many Acceleration Cards
Closes #441
2024-05-24 20:25:10 +11:00
NotMyWing 9f19e05592 Fix non-deterministic ME Interface behavior
As a side effect, allows ME Interfaces to fully utilize allowed operations instead of doing at most 1 push per cycle
Closes #440
2024-05-24 19:05:06 +11:00
zeng-git 5f20e3346c Add automatic artifact builds on push (#426) 2024-05-17 22:37:54 +11:00
NotMyWing fd188dc96c Fix stopping already stopped Stopwatches in CraftingJob
Resolves #417
Co-authored-by: frankdai320 <frankdai320@gmail.com>
2024-05-17 19:31:31 +11:00
NotMyWing e471293e60 Fix NPE when suffocating in ME Drives
And hopefully all other cases related to missing slot states
Closes #420
2024-05-17 19:08:18 +11:00
NotMyWing f28a3574df Fix rogue off-by-one OreHelper error breaking nested parens 2024-05-17 15:00:36 +11:00
zeng-git b2b21eae41 Add missing Fluid Terminal localization (#428) 2024-05-16 20:07:12 +11:00
Георгий Торопов e8a186df60 Fix missing letters in ru_ru.lang (#397) 2024-05-12 12:41:49 +11:00
Ghzdude 6425ef6ecd Fix NPE when posting changes for storage busses (#405) 2024-02-24 10:25:51 +08:00
Yang Xizhi 7ebb2a0fbb allow custom slot jei check and fix fluid color in cell workbanch (#401) 2024-02-18 23:06:07 -06:00
Neeve 20a1fec6fb Recache OreDict Buses on RegEx changes & adjust visibility logic (#395) 2024-02-05 13:05:31 +11:00
Yang Xizhi 0fffc829ab Fix invalid pattern outputs throwing NPE in crafting grid (#393) 2024-02-01 19:14:33 +11:00
NotMyWing 88635d9a8d Do not check white-/blacklist on extract
Slightly rollbacks #384, since extractables are filtered in getAvailableItems
Allows extracting inaccessible items from cells and overriding SB behavior via reporting non-extractables
2024-02-01 18:33:13 +11:00
Neeve 0fd0ed1b1c Fix Fluid Cells having no upgrades (#392) 2024-01-31 19:37:05 +11:00
Neeve 87f884228e Fix ME Storage Buses reporting contents regardless of settings (#384) 2024-01-30 16:10:52 +11:00
Serenibyss 3495d3dfd4 Use LoadingCache instead of HashMap for CableBusBakedModel (#385) 2024-01-30 14:19:50 +11:00
ZHAY10086 0acb03b83d Add zh_cn.lang entries for Sticky Card (#381) 2024-01-21 13:55:57 +11:00
Serenibyss 9adb0359dd Fix player UUID lookup server issue (#380) 2024-01-20 23:44:34 +11:00
Serenibyss ac259dce6a Fix Network Tool not working (#377) 2024-01-16 15:56:12 +11:00
Neeve 7a6d49412e Fix minor slot merge/update regressions (#376) 2024-01-16 15:55:13 +11:00
Yang Xizhi 10f47a560a Fix transformers causing NCDF on specific servers (#374) 2024-01-16 12:36:22 +11:00
Serenibyss a8f0bbe06b Add Sticky Card (#371)
Co-authored-by: NotMyWing <winwyv@gmail.com>
2024-01-16 12:27:13 +11:00
Serenibyss dd3cdfcec5 Fix landing/running particles for cable bus (#372)
Co-authored-by: NotMyWing <winwyv@gmail.com>
2024-01-15 13:40:01 -06:00
Neeve 503f14f0a6 Fix minor slot stack size regression (#375) 2024-01-15 13:39:04 -06:00
Neeve 30af345ceb Update mod base name (#373) 2024-01-16 01:13:04 +11:00
Serenibyss e8af0f228b Update ME IO Port tasks on grid changes (#370) 2024-01-15 18:01:53 +11:00
Serenibyss 0291ceff30 Fix Toast server crash (#367) 2024-01-14 13:15:45 +11:00
NotMyWing d0614ba7d8 Clear modVersion 2024-01-13 17:18:41 +11:00
Neeve 54366e2b35 Initialize GHA workflows for pushing & caching (#359) 2024-01-13 16:58:14 +11:00
Serenibyss d128b0c228 Fix ME Interface Terminal input search not checking beyond first input (#364) 2024-01-13 16:57:54 +11:00
Neeve f7aa4c92bc Fix CellInventory stack size data losses (#363)
Migrates the total item count and serialized stack sizes to `long`
2024-01-13 16:56:26 +11:00
Serenibyss 0709d2dfc4 Color applicator improvements (#360)
* Now properly updates the Applicator's set color when a dye runs out, instead of staying stuck on a color which has no dye left
* Holding Applicator in offhand will now paint cables on placement
* Middle-clicking a colored tile while holding an Applicator in main or off hand will now set the Applicator's color to that color, if the dye is available in the Applicator
2024-01-12 18:21:24 +11:00
mczph 2ea08a3fc9 zh_cn translation fix and additions (#361) 2024-01-09 21:02:40 -06:00
Serenibyss 8c7185f8ff Update buildscripts (#354) 2024-01-09 17:47:53 +11:00
Serenibyss f7651fff29 Add part placement preview, render all part boxes on hover (#349) 2024-01-09 15:53:52 +11:00
Serenibyss 51f2a42367 Tweak transparent Smart Cable texture (#356) 2024-01-09 15:43:36 +11:00
Serenibyss 4829ec8286 Remove part layer api in favor of capabilities (#355) 2024-01-08 09:52:05 -06:00
Serenibyss 0b7341e4a8 Allow for math expressions in GuiCraftAmount textbox (#353) 2024-01-07 13:55:22 +11:00
tier940 b252d1c891 Update ja_jp.lang (#351) 2024-01-02 09:35:24 -06:00
Stone a31de25257 Fix 2 cable rendering bugs (#350) 2024-01-02 09:35:00 -06:00
Serenibyss 01f56ae633 Fix Wireless Access Point displaying energy incorrectly (#346) 2023-12-30 14:41:16 +11:00
Serenibyss 669aa3188e Fix P2P Tunnels dropping ME Tunnels regardless of type (#347) 2023-12-30 14:39:21 +11:00
Neeve 219de337be Update mod metadata (#344) 2023-12-27 23:46:53 -06:00
Stone 7747899e90 Fix ME Level Emitter buttons config and ME IO Port not respecting its redstone mode (#345) 2023-12-28 14:53:46 +11:00
Neeve 82751e761e Add crafting job toasts (#342) 2023-12-25 20:53:51 -06:00
Neeve c4c0585fd3 Allow shift-clicking Patterns into Interface Terminals (#343) 2023-12-25 20:39:35 -06:00
Serenibyss 496e159010 Fix missed ME Interface retextures (#341) 2023-12-25 14:35:02 +11:00
Serenibyss 754ee1ba83 Retexture AE2 machines (#338) 2023-12-25 14:08:19 +11:00
Serenibyss ffe1a52456 Retexture AE2 multiparts (#336) 2023-12-25 13:49:01 +11:00
Serenibyss 28696bd531 Fix and improve cable models (#335) 2023-12-25 13:23:01 +11:00
Serenibyss 29098372af Add blue light for fully empty Cells (#334) 2023-12-25 12:46:13 +11:00
mczph 9dbcf21fa9 Add missing entries and color codes for zh_cn.lang (#339) 2023-12-25 12:36:32 +11:00
Serenibyss a5a1f79102 Change meteor compass to target chest (#332) 2023-12-20 20:01:21 -06:00
Neeve 8fb12119ef Fix oversized slot weirdness (#331) 2023-12-20 13:52:07 +11:00
PrototypeTrousers 7f83c73a28 fix interface dropping stacks over the stack limit. fix potential dupes
fixes #328
2023-12-16 16:30:17 -03:00
Neeve 80a473a93b Fix data loss in BasicCellInventory (#327) 2023-12-15 13:26:43 -03:00
Li adac94555b Remove redundant (#324)
https://github.com/PrototypeTrousers/Applied-Energistics-2/issues/323
2023-11-08 10:37:11 -03:00
PrototypeTrousers 2f11054132 bump version 2023-11-07 18:26:13 -03:00
PrototypeTrousers 1314ee4588 fix wireless pattern terminal not toggling substitution 2023-11-07 18:25:52 -03:00
zeng-git 4484863452 Update mappings to stable_39-1.12 (#322) 2023-11-07 18:21:59 -03:00
PrototypeTrousers ba9b790a02 attempt fix FE p2p when 2023-10-22 23:34:54 -03:00
PrototypeTrousers e4d862dbfd bump version 2023-10-13 03:53:29 -03:00
PrototypeTrousers 812e8c5990 fix #315 2023-10-13 03:50:47 -03:00
PrototypeTrousers e3eeee7784 forgot about fluid configuring terminal 2023-10-13 02:35:14 -03:00
PrototypeTrousers 467bb91628 switch MouseTweaks disabling method 2023-10-12 17:40:56 -03:00
PrototypeTrousers 10a12a9b97 small tweak to pattern terminal search 2023-10-12 16:59:57 -03:00
PrototypeTrousers e5f345d49c remove player inventory from oredict storage bus container 2023-10-12 16:49:59 -03:00
PrototypeTrousers 95ce9694aa slabs -> slab 2023-10-12 02:51:44 -03:00
PrototypeTrousers d1ec1a88ee fix magnet not working before turning it off and on again 2023-10-11 17:20:53 -03:00
PrototypeTrousers bfe82cdc0a fix CT recipe actions not running on crafting terminal crafts 2023-10-11 17:08:23 -03:00
PrototypeTrousers 4fe0d5e767 remove itemstages blocking item crafting 2023-10-11 16:28:06 -03:00
PrototypeTrousers b38148e095 attempt to fix something with terminals again 2023-10-11 14:29:34 -03:00
Neeve d528d9f205 Fix Matter Condenser's math & remove Player's maven (#316)
* Remove Player's maven

* Fix Matter Condenser's math

Fixes outputs getting geometrically compounded
2023-10-11 14:27:35 -03:00
PrototypeTrousers 60211cccdd bump version 2023-09-28 16:44:11 -03:00
Pansmith c3a331c13f Texture Replacements (#312) 2023-09-27 20:46:16 -03:00
tier940 add866443d Update ja_jp.lang (#309)
* Follow the latest

* fix
2023-09-27 20:46:07 -03:00
James Chung bf83de08b2 Add fix for leaking client TEs (#298)
* Add fix for leaking client TEs

* Remove client-side markDirty() call
2023-09-27 20:45:55 -03:00
PrototypeTrousers 6f822af262 bump version 2023-08-27 08:36:13 -03:00
PrototypeTrousers 7566b3e2fc update pattern terminal crafting result after crafting 2023-08-11 10:40:57 -03:00
PrototypeTrousers 30c074021b terminal woes 2023-08-11 10:27:15 -03:00
PrototypeTrousers e6586ac360 attempt to fix ore dict storage bus freezing the client 2023-08-08 00:29:52 -03:00
PrototypeTrousers 0429fe5f21 schedule a refreshed view when changing view cells in terminals 2023-08-05 19:16:02 -03:00
PrototypeTrousers e16d90333b fix channel display 2023-07-31 02:58:34 -03:00
0mega24 59c7dd1285 Configurable Channel Limits (#295)
* Channel Config Test

* Update AEConfig.java

* userDefinedChannelAmounts

config option added for the dense and normal channel amounts - will need to be refined to match everything but not sure what I would need to do to make it match the other config options

rebound all hard coded checks for channel amounts and linked them to the config options

redefined how the channel amounts are noted in all applicable api integrations
2023-07-28 10:26:41 -03:00
PrototypeTrousers 13ba399418 fix NPE. Fix fix gradle issue due to cofh dick move 2023-07-25 17:18:42 -03:00
PrototypeTrousers 8d152afcd3 actually add the access transformer to the jar 2023-07-14 23:20:38 -03:00
PrototypeTrousers 9fdfbbea54 more null checks 2023-07-13 21:57:39 -03:00
PrototypeTrousers f4303fc1ec add checks to 0 sized stacks 2023-07-12 15:00:59 -03:00
PrototypeTrousers 3c62ac79c3 bump version 2023-07-08 21:39:38 -03:00
PrototypeTrousers e42863643d crafting microoptimization 2023-07-08 21:35:27 -03:00
PrototypeTrousers ace7c7d660 Merge branch 'rfg' into origin/AE2-Omnifactory 2023-07-08 18:21:44 -03:00
PrototypeTrousers 35f2aa7d51 works so... 2023-07-08 17:56:31 -03:00
PrototypeTrousers 926a4a87c6 a few important files 2023-07-08 13:00:47 -03:00
PrototypeTrousers d1d2c415bf wip 2023-07-08 00:53:21 -03:00
PrototypeTrousers f631858be6 fix copy-pasting interfaces with memory cards between interfaces with differing amount of expansion cards 2023-07-04 23:57:12 -03:00
PrototypeTrousers d407ec4922 tweak JEI transfer handler a bit more 2023-07-04 22:36:07 -03:00
PrototypeTrousers 3587fce218 fix emitting crafts (level emitter + crafting card) not allowing already stored items to be used in autocrafting 2023-07-04 12:03:48 -03:00
PrototypeTrousers 7464647bb8 0.55.16 2023-07-03 20:22:54 -03:00
PrototypeTrousers 0848f5db70 Merge branch 'autocrafting-containeritem-fix' into AE2-Omnifactory 2023-07-03 20:22:09 -03:00
PrototypeTrousers 822e394966 Merge branch 'item-repo-sort' into AE2-Omnifactory 2023-07-03 20:22:06 -03:00
PrototypeTrousers 68ed4c9c0f Merge branch 'jei-fix' into AE2-Omnifactory 2023-07-03 20:22:03 -03:00
PrototypeTrousers f13d7f351d fix container items breaking not being taken into account during simulation properly
optimize crafting with container items by checking IF WE HAVE ANY of before LOOKING UP IF THE RECIPE MATCHES with the item we DONT HAVE
2023-07-03 15:30:05 -03:00
PrototypeTrousers 086ddd5a67 shady optimization 2023-06-29 15:21:33 -03:00
PrototypeTrousers acb1d00197 attempt to separate itens used simulation (threaded) from the main 2023-06-29 12:53:32 -03:00
PrototypeTrousers 4aaa3f8929 make container itens not arrive too late or early instead precisely when
they are meant to
2023-06-29 12:51:04 -03:00
PrototypeTrousers 793b8d6655 fix patterns not appearing on the terminal except on craftable-only view 2023-06-27 22:53:55 -03:00
PrototypeTrousers cba89b0323 fix damageable container items not being returned immediately for simulation 2023-06-27 11:47:23 -03:00
PrototypeTrousers 1f2cdfd843 improve GUI lag when displaying many items on terminals 2023-06-27 00:10:45 -03:00
PrototypeTrousers da39d81d5f optimize JEI transfer handler so it doesnt lock up the client 2023-06-26 16:13:33 -03:00
PrototypeTrousers 1442248ec3 bump version 2023-06-17 08:12:34 -03:00
PrototypeTrousers 1500661e43 fix wireless terminals duping and voiding issues.
fixes #270
2023-06-16 17:57:13 -03:00
PrototypeTrousers a7c2824624 replace ItemEncodedPattern cache with something that actually works 2023-06-15 21:43:27 -03:00
PrototypeTrousers 9d2549bdd8 bump version 2023-05-26 19:46:34 -03:00
PrototypeTrousers a37a2b4e89 blindly attempt to fix wireless terminal voiding/duping 2023-05-26 19:46:34 -03:00
miozune aa6bad7a72 Fix CPU Clusters consisting only of addon blocks not being recognized (#274) 2023-05-24 07:27:20 -03:00
Rongmario e2e5eed351 Properly discard caches when reloading models (#278)
* Properly discard caches when reloading models

* Singleton reloading multiple AutoRotatingModels
2023-05-24 07:26:24 -03:00
Caedis b6de4ebf18 Fix single slabs and stairs to allow chest opening (#268) 2023-05-24 07:25:56 -03:00
PrototypeTrousers 4545d78a51 bump version 2023-04-24 09:43:23 -03:00
PrototypeTrousers 6dc75fe26e attempt to fix #253 2023-04-24 09:29:10 -03:00
Florian Kostenzer 0552282d9d fix: fix crash when requester node is removed (#262) 2023-04-24 09:18:17 -03:00
Hikari_Nova 8be01dfb87 Try to fix https://github.com/PrototypeTrousers/Applied-Energistics-2/issues/265. (#266) 2023-04-24 09:17:53 -03:00
PrototypeTrousers 4c5803b986 check if baubles mod is installed when using keybinds to open terminals 2023-04-24 09:17:18 -03:00
PrototypeTrousers 3b4b9a1bd5 add recursion check to item p2ps 2023-04-15 08:32:27 -03:00
osimon 2c7959e399 Interface shift-clicking QOL improvements (#248) 2023-03-28 18:27:36 -03:00
PrototypeTrousers 4649841341 Use anatawa's fork of forgegradel 2.3 2023-03-28 18:25:22 -03:00
PrototypeTrousers 3d4cfb2ee8 add the quantum link card to the quantum chamber tooltip 2023-03-28 18:24:51 -03:00
PrototypeTrousers 8092d0d354 Allow the quantum linking card to be disabled by config
Clean up some wrong tooltip
2023-03-28 18:02:36 -03:00
PrototypeTrousers ceee1f181f bump version. copy/paste some lang entries 2023-03-20 16:07:47 -03:00
Domi eefb11544e Add craftable items QOL features (tooltips / hold ALT to toggle craft request) (#241) 2023-03-20 16:01:06 -03:00
Xikaro af5921f9e8 fix ME Chest rendering (#246)
* Update dependencies.gradle

* fix ME Chest rendering
2023-03-20 15:58:40 -03:00
Domi 75be2ff039 Refresh crafting plan when job submission fails (#243) 2023-03-20 15:53:23 -03:00
Domi b6f4bdb64d Fix being unable to clear selected text in number boxes (#242) 2023-03-20 15:53:11 -03:00
PrototypeTrousers b76c9f1371 null check 2023-03-07 14:54:38 -03:00
PrototypeTrousers 50bf591418 bump version 2023-03-05 14:07:36 -03:00
RuiXuqi b077aff1f8 New cells models (#227)
new cells
2023-03-05 14:06:15 -03:00
PrototypeTrousers 8debd6c499 fix invisible interface config slots on servers 2023-02-28 20:00:31 -03:00
PrototypeTrousers 53ad6c776b fix magnet card crashing servers 2023-02-21 20:33:27 -03:00
PrototypeTrousers e37f8ef65d bump version 2023-02-21 10:19:36 -03:00
PrototypeTrousers d8b20f53a9 fix portable cell not working 2023-02-21 10:09:31 -03:00
PrototypeTrousers bf1a3b7751 fix outputs in processing terminal slowly migrating upwards 2023-02-21 09:58:54 -03:00
PrototypeTrousers c8a6d50ce3 fix wireless crafting terminal not loading sorting configs properly 2023-02-20 01:16:41 -03:00
PrototypeTrousers 13af30f657 try to fix the fix 2023-02-18 23:11:43 -03:00
PrototypeTrousers 5d7f552643 attempt to fix wireless terminals overwriting items in hand 2023-02-18 21:06:41 -03:00
Roman Hubenkov 82be548fc7 Update ru_ru.lang (#223)
Small fix
2023-02-18 21:06:13 -03:00
Roman Hubenkov 38249608e4 Update ru_ru.lang (#222) 2023-02-14 20:26:49 -03:00
mczph 8f66765696 Update zh_cn.lang (#221) 2023-02-14 20:26:29 -03:00
PrototypeTrousers fd5f9263d8 fix wireless pattern terminal not encoding processing outputs from JEI
bump version
2023-02-14 20:25:09 -03:00
PrototypeTrousers 36d94a17aa close wireless terminals if they run out of power instead of not working 2023-02-14 19:10:42 -03:00
PrototypeTrousers ede2b4ce25 fix OOB crash 2023-02-13 01:02:59 -03:00
PrototypeTrousers e09ec8c420 bump version 2023-02-10 06:32:35 -03:00
tier940 3d4c03e184 Update ja_jp.lang (#220)
* Update ja_jp.lang

* 組立室から組立機に変更

* 表記揺れの修正

* 記載揺れと誤字脱字の修正
2023-02-10 06:29:15 -03:00
PrototypeTrousers 17119fd990 more gui fixes... 2023-02-10 06:28:44 -03:00
PrototypeTrousers 9a00185b6d backport some security changes 2023-02-10 06:21:39 -03:00
PrototypeTrousers 2c7b239914 bump version 2023-02-09 19:20:17 -03:00
PrototypeTrousers 4039188712 more fixes yay 2023-02-09 13:02:55 -03:00
PrototypeTrousers ecb697ab11 fix terminal/netwoork tool (please) 2023-02-09 12:16:40 -03:00
PrototypeTrousers ab1f519401 allow wireless pattern terminal to switch substitution modes 2023-02-08 21:17:56 -03:00
Roman Hubenkov d06a70ee22 Update ru_ru.lang (#218)
* Update ru_ru.lang
2023-02-08 13:58:54 -03:00
PrototypeTrousers 422f9faf76 fix jei and tall interface terminal button overlapping 2023-02-08 13:58:04 -03:00
PrototypeTrousers 96ab73001b fix craftables not working when wireless terminal not being held
remove wrong imports
add missing lang entries
2023-02-08 12:14:36 -03:00
PrototypeTrousers 854676a33c terminal fixes + better formatting 2023-02-06 18:38:44 -03:00
PrototypeTrousers 7f76723da5 Merge branch 'WiFi-Terminals' into AE2-Omnifactory 2023-02-06 13:28:27 -03:00
PrototypeTrousers 3fc7cf0247 Merge branch 'cell-tooltips' into AE2-Omnifactory 2023-02-06 13:28:23 -03:00
PrototypeTrousers b377dfdd69 Merge branch 'bogofix' into AE2-Omnifactory 2023-02-06 13:28:17 -03:00
PrototypeTrousers 51522019ca fix wireless terminals not opening again 2023-02-06 13:27:52 -03:00
PrototypeTrousers ff1091d252 add toolitps to cells 2023-02-06 13:26:59 -03:00
PrototypeTrousers 15dff5d53d fix JEI integration 2023-02-05 23:04:20 -03:00
PrototypeTrousers 7ab89a0657 update bogosort compat 2023-02-05 23:03:34 -03:00
PrototypeTrousers dcd36b3b2f wip 2023-02-03 23:08:13 -03:00
PrototypeTrousers 7b985c72bd fix slots and texture 2023-02-03 22:33:14 -03:00
PrototypeTrousers 269d3766db implement tall interface terminal (part, not wireless) 2023-02-03 20:56:17 -03:00
PrototypeTrousers d7e7ef0cb4 wip 2023-02-03 15:07:55 -03:00
PrototypeTrousers 472f1e65a2 more autocrafting fixes 2023-02-03 13:49:27 -03:00
PrototypeTrousers 56268aba79 fix autocrafting gui not opening 2023-02-03 12:53:04 -03:00
PrototypeTrousers 9d7dacdc29 Toggle magnet on/off from container/gui 2023-02-02 21:48:01 -03:00
PrototypeTrousers fb2aa21337 cleaning 2023-02-02 20:00:56 -03:00
PrototypeTrousers 8bad14f982 cursed recipes 2023-02-02 19:24:03 -03:00
PrototypeTrousers 0e797b2120 GUI/Container fixes Ugh 2023-02-02 18:22:20 -03:00
PrototypeTrousers 17c38a6418 wip 2023-02-02 16:19:56 -03:00
PrototypeTrousers 58a6dabb20 wip 2023-02-02 14:50:23 -03:00
PrototypeTrousers 329e613c99 recipes 2023-02-02 11:39:16 -03:00
PrototypeTrousers 11a4783881 more textures 2023-02-02 11:23:51 -03:00
PrototypeTrousers e230440cba add some textures 2023-02-01 22:27:01 -03:00
PrototypeTrousers 149e7d251a clean up 2023-02-01 21:43:47 -03:00
PrototypeTrousers 405f14bd13 safer comparisons 2023-02-01 21:19:09 -03:00
PrototypeTrousers acd77ff3f2 lock quantumbridge inventory to 1 card or singularity 2023-02-01 21:10:41 -03:00
PrototypeTrousers a0ec9ceb51 keybinds work 2023-01-31 23:24:27 -03:00
PrototypeTrousers d6f2ed30e5 make them bauble trinkets 2023-01-31 16:52:00 -03:00
PrototypeTrousers 9785e38e3f magnet filtering 2023-01-31 15:29:43 -03:00
PrototypeTrousers 1759bd898e magnetize magnet 2023-01-31 12:40:41 -03:00
PrototypeTrousers ae0d02e7d5 linking kinda works 2023-01-30 23:41:13 -03:00
PrototypeTrousers d76eec2145 wip 2023-01-30 21:56:31 -03:00
PrototypeTrousers d7e1554e41 save upgrades 2023-01-30 20:40:16 -03:00
PrototypeTrousers 9dee7f6c0e cards 2023-01-30 17:45:41 -03:00
PrototypeTrousers 13c3067068 add upgrade slots 2023-01-30 15:41:42 -03:00
PrototypeTrousers 7c4e5679a3 fluid terminal 2023-01-29 21:55:01 -03:00
PrototypeTrousers 03ed421331 more fixes 2023-01-29 21:55:01 -03:00
PrototypeTrousers 36197a5dc6 refresh status if a encoded pattern is put in the output slot 2023-01-29 21:55:01 -03:00
PrototypeTrousers f407a26a8f work on wireless pattern terminal 2023-01-29 21:55:01 -03:00
PrototypeTrousers cb1011295c wip 2023-01-29 21:55:01 -03:00
PrototypeTrousers 55a56ad79d Start implementing wireless terminals. 2023-01-29 21:55:01 -03:00
PrototypeTrousers dd2f1c6dc7 attempt to fix stacking issues 2023-01-28 23:45:14 -03:00
PrototypeTrousers f14407b87a attempted fixes for spatialIO, security and ShaderTech compat 2023-01-28 14:09:23 -03:00
PrototypeTrousers 04f006695e fix terminals not being usable on servers 2023-01-12 12:55:35 -03:00
PrototypeTrousers 4f36ccf64d bump version 2023-01-09 14:25:24 -03:00
PrototypeTrousers d9b4410c94 attempt to fix #197 2023-01-09 02:26:48 -03:00
PrototypeTrousers 9bbd0ad61b ASM Patch ItemStack packet size setter and getter. code from StackUp 2023-01-09 02:15:45 -03:00
MycroftJr 662a7805dd add ItemStack to/from NBT helpers (#202)
to simplify the "stackSize" NBT tag workaround
2023-01-09 01:10:35 -03:00
PrototypeTrousers c46eadec08 Merge branch 'revert-async-repo' into AE2-Omnifactory 2023-01-09 01:08:47 -03:00
PrototypeTrousers 148207f5c3 Merge branch 'gtceu-fix' into PrototypeTrousers/AE2-Omnifactory 2023-01-09 01:08:39 -03:00
PrototypeTrousers 3ae251f098 Revert "Merge remote-tracking branch 'LasmGratel/async-itemrepo' into AE2-Omnifactory"
This reverts commit 86a42e970f.
2023-01-09 01:03:55 -03:00
PrototypeTrousers 82a906886f Revert "delay repo view sorting to once per tick"
This reverts commit d9588441b0.
2023-01-09 01:03:51 -03:00
PrototypeTrousers 5b2c6658c0 Revert "synchronizedList must be in a synchronized block when iterating"
This reverts commit 1f12fc5e91.
2023-01-09 01:03:51 -03:00
612 changed files with 13156 additions and 5955 deletions
+21
View File
@@ -0,0 +1,21 @@
name: Build
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up OpenJDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'adopt' # You can choose other OpenJDK distributions.
- name: Build with Gradle
run: ./gradlew build # Ensure your gradlew script is executable
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: AE2-UEL
path: build/libs/*.jar # Make sure this path matches the location of your build artifacts
-15
View File
@@ -1,15 +0,0 @@
name: 'Lock threads'
on:
schedule:
- cron: '0 0 * * *'
jobs:
lock:
runs-on: ubuntu-latest
steps:
- uses: dessant/lock-threads@v2
with:
github-token: ${{ github.token }}
issue-lock-inactive-days: '180'
pr-lock-inactive-days: '180'
+68
View File
@@ -0,0 +1,68 @@
# Publishes built jars to distribution platforms
name: Publish
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+' # any semver tag, e.g. 1.2.3
env:
# type of release
RELEASE_TYPE: "release"
jobs:
Publish:
runs-on: ubuntu-latest
permissions:
contents: write # needed to create GitHub releases
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Check for Duplicate Tags
run: |
if git rev-parse -q --verify "refs/tags/${{ github.ref }}" >/dev/null; then
echo "Tag already exists. A version bump is required."
exit 1
fi
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'
- name: Build Project
uses: gradle/gradle-build-action@v2
with:
arguments: 'build --build-cache --daemon' # use the daemon here so the rest of the process is faster
generate-job-summary: false
gradle-home-cache-includes: |
caches
jdks
notifications
wrapper
- name: Publish to GitHub
uses: softprops/action-gh-release@v1
with:
files: "build/libs/*.jar"
generate_release_notes: true
fail_on_unmatched_files: true
- name: Publish to Curseforge
uses: gradle/gradle-build-action@v2
env:
CURSEFORGE_API_KEY: "${{secrets.CURSEFORGE_API_KEY}}"
CURSEFORGE_PROJECT_ID: "${{secrets.CURSEFORGE_PROJECT_ID}}"
RELEASE_TYPE: "${{env.RELEASE_TYPE}}"
with:
arguments: 'curseforge --daemon'
generate-job-summary: false
gradle-home-cache-includes: |
caches
jdks
notifications
wrapper
+39
View File
@@ -0,0 +1,39 @@
# Updates the Gradle Cache when relevant files change
name: Update Gradle Cache
on:
workflow_dispatch:
push:
branches:
- master
paths:
- "gradle**" # covers gradle folder, gradle.properties, gradlew
- "build.gradle*"
- "settings.gradle*"
- "src/main/resources/*_at.cfg" # access transformers
jobs:
Update_Cache:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'
- name: Update Cache
uses: gradle/gradle-build-action@v2
with:
arguments: 'test --build-cache --no-daemon' # disable daemon since only one gradle operation will happen
generate-job-summary: false
gradle-home-cache-includes: |
caches
jdks
notifications
wrapper
cache-write-only: true
+76 -24
View File
@@ -1,31 +1,83 @@
# exclude all
/*
.nopublish
# include important folders
# need gradle
!gradle/
!gradlew
!gradlew.bat
!build.gradle
!gradle.properties
!.travis.yml
### Windows ###
# include markdowns
!README.md
!LICENSE
thumbs.db
*.db
# include sourcecode
!src/
### Java ###
# include git important files
!.gitmodules
!.gitignore
*.class
# code format to reduce noise in git commits
!codeformat/
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Github specific files and directories
!.github/
# Package Files #
*.war
*.ear
*.txt
# Explicit ignores
Thumbs.db
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
### Eclipse ###
*.pydevproject
.metadata
.gradle
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath
/eclipse
# Eclipse Core
.project
# External tool builders
.externalToolBuilders/
# Locally stored "Eclipse launch configurations"
*.launch
# CDT-specific
.cproject
# JDT-specific (Eclipse Java Development Tools)
.classpath
# Java annotation processor (APT)
.factorypath
# PDT-specific
.buildpath
# sbteclipse plugin
.target
# TeXlipse plugin
.texlipse
### Intellij IDEA ###
*.iml
*.ipr
*.iws
.idea/
.idea_modules/
/classes/
/out/
/build/
# Linux
*~
run/
logs/
-33
View File
@@ -1,33 +0,0 @@
sudo: required
dist: trusty
language: java
jdk:
- oraclejdk8
- openjdk8
before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
- rm -f $HOME/.gradle/caches/minecraft/ForgeVersion.json
- rm -f $HOME/.gradle/caches/minecraft/ForgeVersion.json.etag
- rm -fr $HOME/.gradle/caches/minecraft/deobfedDeps
- rm -f $HOME/.gradle/caches/*/fileHashes/fileHashes.bin
- rm -f $HOME/.gradle/caches/*/fileHashes/fileHashes.lock
cache:
directories:
- '$HOME/.m2/repository'
- '$HOME/.sonar/cache'
- '$HOME/.gradle/wrapper'
- '$HOME/.gradle/caches'
addons:
sonarcloud:
organization: "appliedenergistics"
install: "./gradlew setupCIWorkspace"
script:
- "./gradlew build"
- "./gradlew test"
- "./gradlew sonarqube"
+15 -7
View File
@@ -1,19 +1,25 @@
This is a fork of AE2 i made for trying to solve issues for the [Omnifactory](https://www.curseforge.com/minecraft/modpacks/omnifactory) modpack.
# Applied Energistics 2 Unofficial Extended Life
See [AE2-Omnifactory](https://github.com/PrototypeTrousers/Applied-Energistics-2/tree/AE2-Omnifactory) branch for commits and [Releases](https://github.com/PrototypeTrousers/Applied-Energistics-2/releases) for the compiled jars.
[![Downloads](http://cf.way2muchnoise.eu/570458.svg)](https://www.curseforge.com/minecraft/mc-mods/ae2-extended-life) [![MCVersion](http://cf.way2muchnoise.eu/versions/570458.svg)](https://www.curseforge.com/minecraft/mc-mods/ae2-extended-life) [![GitHub issues](https://img.shields.io/github/issues/AE2-UEL/Applied-Energistics-2.svg)](https://github.com/AE2-UEL/Applied-Energistics-2/issues) [![GitHub pull requests](https://img.shields.io/github/issues-pr/AE2-UEL/Applied-Energistics-2.svg)](https://github.com/AE2-UEL/Applied-Energistics-2/pulls)
# Applied Energistics 2 (PrototypeTrousers fork for Omnifactory)
---
## About
A Mod about Matter, Energy and using them to conquer the world.
A maintained fork of a Mod about Matter, Energy and using them to conquer the world.
This project started as a fork of [Applied Energistics 2](https://github.com/AppliedEnergistics/Applied-Energistics-2) by [PrototypeTrousers](https://github.com/PrototypeTrousers), initially addressing issues related to the [Nomifactory](https://www.curseforge.com/minecraft/modpacks/nomifactory) modpack. It is now being maintained by the [AE2 Unofficial Extended Life Team](https://github.com/AE2-UEL).
See [Releases](https://github.com/PrototypeTrousers/Applied-Energistics-2/releases) for the compiled jars.
## RecipeStages
You need to add the following into a CraftTweaker script:
```
mods.recipestages.Recipes.setPackageStage("appeng", allStages);
```
The second argument allows you to customize which stages exactly you want to be craftable with AE2. Idk why would you like to restrict any, but you can.
The second argument allows you to customize which stages exactly you want to be craftable with AE2. Not sure why you would do that, but we support that nonetheless!
## License
* Applied Energistics 2 API
@@ -29,8 +35,10 @@ The second argument allows you to customize which stages exactly you want to be
- [![License](https://img.shields.io/badge/License-No%20Restriction-green.svg?style=flat-square)](https://creativecommons.org/publicdomain/zero/1.0/)
## Credits
Thanks to
Special thanks to:
* PrototypeTrousers for the initial fork
* Notch et al for Minecraft
* Lex et al for MinecraftForge
* AlgorithmX2 for AppliedEnergistics2
+1189 -84
View File
File diff suppressed because it is too large Load Diff
+52
View File
@@ -0,0 +1,52 @@
//file:noinspection DependencyNotationArgument
// TODO remove when fixed in RFG ^
/*
* Add your dependencies here. Common configurations:
* - implementation("group:name:version:classifier"): if you need this for internal implementation details of the mod.
* Available at compiletime and runtime for your environment.
*
* - compileOnlyApi("g:n:v:c"): if you need this for internal implementation details of the mod.
* Available at compiletime but not runtime for your environment.
*
* - annotationProcessor("g:n:v:c"): mostly for java compiler plugins, if you know you need this, use it, otherwise don't worry
*
* - testCONFIG("g:n:v:c"): replace CONFIG by one of the above, same as above but for the test sources instead of main
*
* You can exclude transitive dependencies (dependencies of the chosen dependency) by appending { transitive = false } if needed.
*
* To add a mod with CurseMaven, replace '("g:n:v:c")' in the above with 'rfg.deobf("curse.maven:project_slug-project_id:file_id")'
* Example: implementation rfg.deobf("curse.maven:gregtech-ce-unofficial-557242:4527757")
*
* To shadow a dependency, use 'shadowImplementation'. For more info, see https://github.com/GregTechCEu/Buildscripts/blob/master/docs/shadow.md
*
* For more details, see https://docs.gradle.org/8.0.1/userguide/java_library_plugin.html#sec:java_library_configurations_graph
*/
dependencies {
// Mods always in-game
implementation rfg.deobf("curse.maven:gregtechceu-557242:4429261") // GTCEu
implementation rfg.deobf("curse.maven:codechicken-lib-1-8-242818:2779848") // CCL 3.2.3.358
implementation rfg.deobf("curse.maven:baubles-227083:2518667") // Baubles
implementation rfg.deobf("curse.maven:industrial-craft-242638:2547175") // IC2
implementation rfg.deobf("curse.maven:forestry-59751:2684780") // Forestry
// Mods only in code by default
compileOnly "curse.maven:chisel-235279:2915375"
compileOnly "curse.maven:hwyla-253449:2568751"
compileOnly "curse.maven:recipe-stages-280554:3405072"
compileOnly "curse.maven:item-stages-280316:2696769"
compileOnly "curse.maven:game-stages-268655:2951844"
compileOnly "net.darkhax.tesla:Tesla-1.12.2:1.0.63"
compileOnly "curse.maven:CoFHCore-69162:2920433"
compileOnly "CraftTweaker2:CraftTweaker2-API:4.1.20.684"
compileOnly "curse.maven:inventory-tweaks-223094:2482482"
compileOnly "curse.maven:inventory-bogo-sorter-632327:4399738"
compileOnly rfg.deobf("curse.maven:ctm-267602:2915363") // CTM 1.0.2.31
compileOnly rfg.deobf("curse.maven:actually-additions-228404:3117927") // ActuallyAdditions r152
}
minecraft {
injectedTags.put('AEVERSION', aeversion)
injectedTags.put('AECHANNEL', aechannel)
injectedTags.put('AEBUILD', aebuild)
}
+181 -30
View File
@@ -1,33 +1,184 @@
modName = AE2 Unofficial Extended Life
# This is a case-sensitive string to identify your mod. Convention is to use lower case.
modId = appliedenergistics2
modGroup = appeng
# Version of your mod.
# This field can be left empty if you want your mod's version to be determined by the latest git tag instead.
modVersion =
# AE2 Specific Version Settings
aeversion=rv6
aechannel=stable
aebuild=7
aegroup=appeng
aebasename=appliedenergistics2
extended=extended_life
extendedversion=v0.54.16
#########################################################
# Versions #
#########################################################
minecraft_version=1.12.2
mcp_mappings=snapshot_20171003
forge_version=14.23.5.2847
#########################################################
# Installable #
#########################################################
hwyla_version=1.8.26-B41_1.12.2
#########################################################
# Provided APIs #
#########################################################
jei_version=4.16.1.302
tesla_version=1.0.63
ic2_version=2.8.73-ex112
top_version=1.12-1.4.23-16
cofhcore_version=1.12.2-4.5.2.19
crafttweaker_version=4.1.8.9
ctm_version=MC1.12.2-0.3.1.16
forestry_version=5.8.2.387
#########################################################
# Deployment #
#########################################################
website_version=1.12.2
curse_versions=1.12.2
# Whether to use the old jar naming structure (modid-mcversion-version) instead of the new version (modid-version)
includeMCVersionJar = false
# The name of your jar when you produce builds, not including any versioning info
modArchivesBaseName = ae2-uel
# Will update your build.gradle automatically whenever an update is available
autoUpdateBuildScript = false
minecraftVersion = 1.12.2
# Select a username for testing your mod with breakpoints. You may leave this empty for a random username 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
# Alternatively this can be set with the 'DEV_USERNAME' environment variable.
developmentEnvironmentUserName = Developer
# Enables using modern java syntax (up to version 17) via Jabel, while still targeting JVM 8.
# See https://github.com/bsideup/jabel for details on how this works.
# Using this requires that you use a Java 17 JDK for development.
enableModernJavaSyntax = true
# Generate a class with String fields for the mod id, name and version named with the fields below
generateGradleTokenClass = appeng.Tags
gradleTokenModId = MODID
gradleTokenModName = MODNAME
gradleTokenVersion = VERSION
# 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
apiPackage = api
# If you want to keep your API code in src/api instead of src/main
useSrcApiPath = true
# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/
# There can be multiple files in a comma-separated list.
# Example value: mymodid_at.cfg,jei_at.cfg
accessTransformersFile = appliedenergistics2_at.cfg
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
usesMixins = false
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
mixinsPackage =
# Automatically generates a mixin config json if enabled, with the name mixins.modid.json
generateMixinConfig = false
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin
coreModClass = core.AE2ELCore
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod (meaning that
# there is no class annotated with @Mod) you want this to be true. When in doubt: leave it on false!
containsMixinsAndOrCoreModOnly = false
# Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins.
forceEnableMixins = false
# Outputs pre-transformed and post-transformed loaded classes to run/CLASSLOADER_TEMP. Can be used in combination with
# diff to see exactly what your ASM or Mixins are changing in the target file.
# Optionally can be specified with the 'CORE_MOD_DEBUG' env var. Will output a lot of files!
enableCoreModDebug = false
# Adds CurseMaven, Modrinth Maven, BlameJared maven, and some more well-known 1.12.2 repositories
includeWellKnownRepositories = true
# Adds JEI and TheOneProbe to your development environment. Adds them as 'implementation', meaning they will
# be available at compiletime and runtime for your mod (in-game and in-code).
# Overrides the above setting to be always true, as these repositories are needed to fetch the mods
includeCommonDevEnvMods = true
# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated in your jar. It is your
# responsibility check the licence and request permission for distribution, if required.
usesShadowedDependencies = false
# If disabled, won't remove unused classes from shaded 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
# Separate run directories into "run/client" for runClient task, and "run/server" for runServer task.
# Useful for debugging a server and client simultaneously. If not enabled, it will be in the standard location "run/"
separateRunDirectories = false
# The display name format of versions published to Curse and Modrinth. $MOD_NAME and $VERSION are available variables.
# Default: $MOD_NAME \u2212 $VERSION. \u2212 is the minus character which looks much better than the hyphen minus on Curse.
versionDisplayFormat = $MOD_NAME \u2212 $VERSION
# Publishing to modrinth requires you to set the MODRINTH_API_KEY 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 on Modrinth.
# Alternatively this can be set with the 'MODRINTH_PROJECT_ID' environment variable.
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:jei;optional-project:top;incompatible-project:gregtech
modrinthRelations =
# Publishing to CurseForge requires you to set the CURSEFORGE_API_KEY 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.
# Alternatively this can be set with the 'CURSEFORGE_PROJECT_ID' environment variable.
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
curseForgeRelations =
# This project's release type on CurseForge and/or Modrinth
# Alternatively this can be set with the 'RELEASE_TYPE' environment variable.
# Allowed types: release, beta, alpha
releaseType = release
# Generate a default changelog for releases. Requires git to be installed, as it uses it to generate a changelog of
# commits since the last tagged release.
generateDefaultChangelog = false
# Prevent the source code from being published
noPublishedSources = false
# Publish to a custom maven location. Follows a few rules:
# Group ID can be set with the 'ARTIFACT_GROUP_ID' environment variable, default to 'project.group'
# Artifact ID can be set with the 'ARTIFACT_ID' environment variable, default to 'project.name'
# Version can be set with the 'RELEASE_VERSION' environment variable, default to 'modVersion'
# For maven credentials:
# Username is set with the 'MAVEN_USER' environment variable, default to "NONE"
# Password is set with the 'MAVEN_PASSWORD' environment variable, default to "NONE"
customMavenPublishUrl =
# The group for maven artifacts. Defaults to the 'project.modGroup' until the last '.' (if any).
# So 'mymod' becomes 'mymod' and 'com.myname.mymodid' 'becomes com.myname'
mavenArtifactGroup =
# Enable spotless checks
# Enforces code formatting on your source code
# By default this will use the files found here: https://github.com/GregTechCEu/Buildscripts/tree/master/spotless
# to format your code. However, you can create your own version of these files and place them in your project's
# root directory to apply your own formatting options instead.
enableSpotless = false
# Enable JUnit testing platform used for testing your code.
# Uses JUnit 5. See guide and documentation here: https://junit.org/junit5/docs/current/user-guide/
enableJUnit = true
# Deployment debug setting
# Uncomment this to test deployments to CurseForge and Modrinth
# Alternatively, you can set the 'DEPLOYMENT_DEBUG' environment variable.
deploymentDebug = false
# Gradle Settings
# Effectively applies the '--stacktrace' flag by default
org.gradle.logging.stacktrace = all
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
# This is required to provide enough memory for the Minecraft decompilation process.
org.gradle.jvmargs = -Xmx3G
-75
View File
@@ -1,75 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
// Suppresses warnings/errors when building javadocs
allprojects {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
javadoc {
options.encoding = 'UTF-8'
options.charSet = 'UTF-8'
}
task javadocs(type: Javadoc) {
source = sourceSets.api.java
include "appeng/api/**"
// Due to ForgeGradle having to be a special snowflake,
// we have to add some custom configurations to the normal compile configuration and hope it does not break.
classpath = configurations.compile + configurations.forgeGradleMc + configurations.forgeGradleMcDeps
}
task javadocJar(type: Jar, dependsOn: javadocs) {
from javadoc.destinationDir
classifier = 'javadoc'
}
task apiJar(type: Jar) {
from sourceSets.api.java
include "appeng/api/**"
from sourceSets.api.output
include "appeng/api/**"
classifier = 'api'
}
task sourceJar(type: Jar, overwrite: true) {
from sourceSets.api.allSource
from sourceSets.main.allSource
classifier = 'sources'
}
task devJar(type: Jar, overwrite: true) {
from sourceSets.api.output
from sourceSets.main.output
classifier = 'dev'
}
artifacts {
archives apiJar
archives javadocJar
archives sourceJar
archives devJar
}
-123
View File
@@ -1,123 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
repositories {
mavenLocal()
maven {
url "https://cursemaven.com"
}
/*
maven {
name = "CurseForge"
url = "https://minecraft.curseforge.com/api/maven/"
}
*/
maven {
name "Mobius"
url "http://mobiusstrip.eu/maven"
}
maven {
name = "JEI repo"
url "http://dvs1.progwml6.com/files/maven"
}
maven {
name "Ellpeck"
url "https://maven.ellpeck.de"
}
maven {
name = "IC2 repo"
url = "http://maven.ic2.player.to"
}
maven {
name = "CoFH Maven"
url = "http://maven.covers1624.net"
}
maven { // TheOneProbe
name 'tterrag maven'
url "http://maven.tterrag.com/"
}
maven { // McJtyLib
name 'mcjty'
url "http://maven.k-4u.nl/"
}
maven { // CraftTweaker
name 'jared maven'
url "http://maven.blamejared.com/"
}
//maven { // modmaven, maven proxy
// name 'modmaven'
// url "https://modmaven.k-4u.nl/"
//}
}
configurations {
mods
}
dependencies {
// deobfCompile "gregtechce:gregtech:1.12.2:1.15.1.735"
// installable runtime dependencies
//deobfCompile "curse.maven:gregtechceu-557242:3949406"
compileOnly(files("etc/gregtech-1.12.2-2.4.4-beta.jar"))
compileOnly "curse.maven:chisel-235279:2915375"
//mods "mcp.mobius.waila:Hwyla:${hwyla_version}"
mods "curse.maven:hwyla-253449:2568751"
mods "net.industrial-craft:industrialcraft-2:${ic2_version}:dev"
mods "mcjty.theoneprobe:TheOneProbe-${minecraft_version}:${top_version}"
// compile against provided APIs
compileOnly "mezz.jei:jei_${minecraft_version}:${jei_version}:api"
//compileOnly "mcp.mobius.waila:Hwyla:${hwyla_version}"
compileOnly "curse.maven:hwyla-253449:2568751"
//Code chicken lib, GTCE dependency
deobfCompile "curse.maven:CCL-242818:2779848"
compileOnly "curse.maven:recipe-stages-280554:3405072"
compileOnly "curse.maven:item-stages-280316:2696769"
compileOnly "curse.maven:game-stages-268655:2951844"
compileOnly "net.darkhax.tesla:Tesla-1.12.2:${tesla_version}"
compileOnly "net.industrial-craft:industrialcraft-2:${ic2_version}:api"
compileOnly "mcjty.theoneprobe:TheOneProbe-1.12:${top_version}:api"
compileOnly "cofh:CoFHCore:${cofhcore_version}:deobf"
compileOnly "CraftTweaker2:CraftTweaker2-API:${crafttweaker_version}"
compileOnly "curse.maven:inventory-tweaks-223094:2482482"
compileOnly "curse.maven:inventory-bogo-sorter-632327:3975184"
compileOnly "team.chisel.ctm:CTM:${ctm_version}"
compileOnly "de.ellpeck.actuallyadditions:ActuallyAdditions:1.12.2-r152.16:api"
deobfCompile "net.sengir.forestry:forestry_${minecraft_version}:$forestry_version"
// at runtime, use the full JEI jar
runtime "mezz.jei:jei_${minecraft_version}:${jei_version}"
// unit test dependencies
testCompile "junit:junit:4.12"
}
-55
View File
@@ -1,55 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
task wrapper(type: Wrapper) {
gradleVersion = "2.14"
}
// HWYLA
task installHwyla(type: Copy, dependsOn: "deinstallHwyla") {
from { configurations.mods }
include "**/*Hwyla*.jar"
into file(minecraft.runDir + "/mods")
}
task deinstallHwyla(type: Delete) {
delete fileTree(dir: minecraft.runDir + "/mods", include: "*Hwyla*.jar")
}
// IC2
task installIC2(type: Copy, dependsOn: "deinstallIC2") {
from { configurations.mods }
include "**/*industrialcraft-2*.jar"
into file(minecraft.runDir + "/mods")
}
task deinstallIC2(type: Delete) {
delete fileTree(dir: minecraft.runDir + "/mods", include: "*industrialcraft-2*.jar")
}
// TOP
task installTop(type: Copy, dependsOn: ["deinstallTop"]) {
from { configurations.mods }
include "**/*TheOneProbe*.jar"
into file(minecraft.runDir + "/mods")
}
task deinstallTop(type: Delete) {
delete fileTree(dir: minecraft.runDir + "/mods", include: "*TheOneProbe*.jar")
}
Binary file not shown.
+3 -1
View File
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8-bin.zip
Vendored
+192 -116
View File
@@ -1,78 +1,126 @@
#!/usr/bin/env sh
#!/bin/sh
#
# Copyright © 2015-2021 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.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
## Gradle start up script for UN*X
##
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# 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
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
MAX_FD=maximum
warn () {
echo "$*"
}
} >&2
die () {
echo
echo "$*"
echo
exit 1
}
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD="$JAVA_HOME/bin/java"
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
@@ -81,92 +129,120 @@ Please set the JAVA_HOME variable in your environment to match the
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.
JAVACMD=java
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.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
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
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# 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" )
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# 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 $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.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"
Vendored
+32 -24
View File
@@ -1,4 +1,20 @@
@if "%DEBUG%" == "" @echo off
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@@ -9,19 +25,23 @@
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -35,7 +55,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@@ -45,38 +65,26 @@ echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
: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 %CMD_LINE_ARGS%
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
+30
View File
@@ -0,0 +1,30 @@
pluginManagement {
repositories {
maven {
// RetroFuturaGradle
name 'GTNH Maven'
url 'https://nexus.gtnewhorizons.com/repository/public/'
//noinspection GroovyAssignabilityCheck
mavenContent {
includeGroup 'com.gtnewhorizons'
includeGroup 'com.gtnewhorizons.retrofuturagradle'
}
}
gradlePluginPortal()
mavenCentral()
mavenLocal()
}
}
plugins {
id 'com.diffplug.blowdryerSetup' version '1.7.0'
// Automatic toolchain provisioning
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0'
}
blowdryerSetup {
repoSubfolder 'spotless'
github 'GregTechCEu/Buildscripts', 'tag', 'v1.0.7'
}
rootProject.name = rootProject.projectDir.getName()
@@ -38,8 +38,11 @@ public enum ActionItems
DIVIDE_BY_THREE,
DECREASE_BY_ONE,
MAX_COUNT,
FREE_MOLECULAR_SLOT_SHORTCUT,
MOLECULAR_ASSEMBLERS_ON,
MOLECULAR_ASSEMBLERS_OFF,
TOGGLE_SHOW_FULL_INTERFACES_ON,
TOGGLE_SHOW_FULL_INTERFACES_OFF,
TOGGLE_SHOW_ONLY_INVALID_PATTERNS_ON,
TOGGLE_SHOW_ONLY_INVALID_PATTERNS_OFF,
HIGHLIGHT_INTERFACE
}
}
@@ -0,0 +1,26 @@
package appeng.api.config;
public enum LockCraftingMode {
/**
* Crafting is never locked.
*/
NONE,
/**
* After pushing a pattern to an adjacent machine, the pattern provider will not accept further crafts until a
* redstone pulse is received.
*/
LOCK_UNTIL_PULSE,
/**
* Crafting is locked while the pattern provider is receiving a redstone signal.
*/
LOCK_WHILE_HIGH,
/**
* Crafting is locked while the pattern provider is not receiving a redstone signal.
*/
LOCK_WHILE_LOW,
/**
* After pushing a pattern to an adjacent machine, the pattern provider will not accept further crafts until the
* primary pattern result is returned to the network through the pattern provider.
*/
LOCK_UNTIL_RESULT
}
+7 -1
View File
@@ -57,6 +57,8 @@ public enum Settings
IO_DIRECTION( EnumSet.of( RelativeDirection.LEFT, RelativeDirection.RIGHT ) ),
UNLOCK(EnumSet.allOf(LockCraftingMode.class)),
BLOCK( EnumSet.of( YesNo.YES, YesNo.NO ) ),
OPERATION_MODE( EnumSet.allOf( OperationMode.class ) ),
@@ -81,7 +83,11 @@ public enum Settings
PLACE_BLOCK( EnumSet.of( YesNo.YES, YesNo.NO ) ),
SCHEDULING_MODE( EnumSet.allOf( SchedulingMode.class ) );
SCHEDULING_MODE( EnumSet.allOf( SchedulingMode.class ) ),
STICKY_MODE( EnumSet.of( YesNo.YES, YesNo.NO ) ),
;
private final EnumSet<? extends Enum<?>> values;
+51 -55
View File
@@ -32,66 +32,62 @@ import net.minecraft.item.ItemStack;
import appeng.api.definitions.IItemDefinition;
public enum Upgrades
{
/**
* Gold Tier Upgrades.
*/
CAPACITY( 0 ),
REDSTONE( 0 ),
CRAFTING( 0 ),
public enum Upgrades {
/**
* Gold Tier Upgrades.
*/
CAPACITY(0),
REDSTONE(0),
CRAFTING(0),
MAGNET(0),
STICKY(0),
/**
* Diamond Tier Upgrades.
*/
FUZZY( 1 ),
SPEED( 1 ),
INVERTER( 1 ),
PATTERN_EXPANSION(1);
/**
* Diamond Tier Upgrades.
*/
FUZZY(1),
SPEED(1),
INVERTER(1),
PATTERN_EXPANSION(1),
QUANTUM_LINK(1);
private final int tier;
private final Map<ItemStack, Integer> supportedMax = new HashMap<>();
private final int tier;
private final Map<ItemStack, Integer> supportedMax = new HashMap<>();
Upgrades( final int tier )
{
this.tier = tier;
}
Upgrades(final int tier) {
this.tier = tier;
}
/**
* @return list of Items/Blocks that support this upgrade, and how many it supports.
*/
public Map<ItemStack, Integer> getSupported()
{
return this.supportedMax;
}
/**
* @return list of Items/Blocks that support this upgrade, and how many it supports.
*/
public Map<ItemStack, Integer> getSupported() {
return this.supportedMax;
}
/**
* Registers a specific amount of this upgrade into a specific machine
*
* @param item machine in which this upgrade can be installed
* @param maxSupported amount how many upgrades can be installed
*/
public void registerItem( final IItemDefinition item, final int maxSupported )
{
item.maybeStack( 1 ).ifPresent( is -> this.registerItem( is, maxSupported ) );
}
/**
* Registers a specific amount of this upgrade into a specific machine
*
* @param item machine in which this upgrade can be installed
* @param maxSupported amount how many upgrades can be installed
*/
public void registerItem(final IItemDefinition item, final int maxSupported) {
item.maybeStack(1).ifPresent(is -> this.registerItem(is, maxSupported));
}
/**
* Registers a specific amount of this upgrade into a specific machine
*
* @param stack machine in which this upgrade can be installed
* @param maxSupported amount how many upgrades can be installed
*/
public void registerItem( final ItemStack stack, final int maxSupported )
{
if( stack != null )
{
this.supportedMax.put( stack, maxSupported );
}
}
/**
* Registers a specific amount of this upgrade into a specific machine
*
* @param stack machine in which this upgrade can be installed
* @param maxSupported amount how many upgrades can be installed
*/
public void registerItem(final ItemStack stack, final int maxSupported) {
if (stack != null) {
this.supportedMax.put(stack, maxSupported);
}
}
public int getTier()
{
return this.tier;
}
public int getTier() {
return this.tier;
}
}
@@ -30,8 +30,7 @@ import appeng.api.util.AEColoredItemDefinition;
/**
* A list of all items in AE
*/
public interface IItems
{
public interface IItems {
IItemDefinition certusQuartzAxe();
IItemDefinition certusQuartzHoe();
@@ -64,6 +63,12 @@ public interface IItems
IItemDefinition wirelessTerminal();
IItemDefinition wirelessCraftingTerminal();
IItemDefinition wirelessPatternTerminal();
IItemDefinition wirelessFluidTerminal();
IItemDefinition biometricCard();
IItemDefinition chargedStaff();
@@ -27,121 +27,126 @@ package appeng.api.definitions;
/**
* A list of all materials in AE
*/
public interface IMaterials
{
IItemDefinition cell2SpatialPart();
public interface IMaterials {
IItemDefinition cell2SpatialPart();
IItemDefinition cell16SpatialPart();
IItemDefinition cell16SpatialPart();
IItemDefinition cell128SpatialPart();
IItemDefinition cell128SpatialPart();
IItemDefinition silicon();
IItemDefinition silicon();
IItemDefinition skyDust();
IItemDefinition skyDust();
IItemDefinition calcProcessorPress();
IItemDefinition calcProcessorPress();
IItemDefinition engProcessorPress();
IItemDefinition engProcessorPress();
IItemDefinition logicProcessorPress();
IItemDefinition logicProcessorPress();
IItemDefinition calcProcessorPrint();
IItemDefinition calcProcessorPrint();
IItemDefinition engProcessorPrint();
IItemDefinition engProcessorPrint();
IItemDefinition logicProcessorPrint();
IItemDefinition logicProcessorPrint();
IItemDefinition siliconPress();
IItemDefinition siliconPress();
IItemDefinition siliconPrint();
IItemDefinition siliconPrint();
IItemDefinition namePress();
IItemDefinition namePress();
IItemDefinition logicProcessor();
IItemDefinition logicProcessor();
IItemDefinition calcProcessor();
IItemDefinition calcProcessor();
IItemDefinition engProcessor();
IItemDefinition engProcessor();
IItemDefinition basicCard();
IItemDefinition basicCard();
IItemDefinition advCard();
IItemDefinition advCard();
IItemDefinition purifiedCertusQuartzCrystal();
IItemDefinition purifiedCertusQuartzCrystal();
IItemDefinition purifiedNetherQuartzCrystal();
IItemDefinition purifiedNetherQuartzCrystal();
IItemDefinition purifiedFluixCrystal();
IItemDefinition purifiedFluixCrystal();
IItemDefinition cell1kPart();
IItemDefinition cell1kPart();
IItemDefinition cell4kPart();
IItemDefinition cell4kPart();
IItemDefinition cell16kPart();
IItemDefinition cell16kPart();
IItemDefinition cell64kPart();
IItemDefinition cell64kPart();
IItemDefinition emptyStorageCell();
IItemDefinition emptyStorageCell();
IItemDefinition cardRedstone();
IItemDefinition cardRedstone();
IItemDefinition cardSpeed();
IItemDefinition cardSpeed();
IItemDefinition cardCapacity();
IItemDefinition cardCapacity();
IItemDefinition cardPatternExpansion();
IItemDefinition cardPatternExpansion();
IItemDefinition cardFuzzy();
IItemDefinition cardQuantumLink();
IItemDefinition cardInverter();
IItemDefinition cardMagnet();
IItemDefinition cardCrafting();
IItemDefinition cardFuzzy();
IItemDefinition enderDust();
IItemDefinition cardInverter();
IItemDefinition flour();
IItemDefinition cardCrafting();
IItemDefinition goldDust();
IItemDefinition cardSticky();
IItemDefinition ironDust();
IItemDefinition enderDust();
IItemDefinition fluixDust();
IItemDefinition flour();
IItemDefinition certusQuartzDust();
IItemDefinition goldDust();
IItemDefinition netherQuartzDust();
IItemDefinition ironDust();
IItemDefinition matterBall();
IItemDefinition fluixDust();
IItemDefinition certusQuartzCrystal();
IItemDefinition certusQuartzDust();
IItemDefinition certusQuartzCrystalCharged();
IItemDefinition netherQuartzDust();
IItemDefinition fluixCrystal();
IItemDefinition matterBall();
IItemDefinition fluixPearl();
IItemDefinition certusQuartzCrystal();
IItemDefinition woodenGear();
IItemDefinition certusQuartzCrystalCharged();
IItemDefinition wirelessReceiver();
IItemDefinition fluixCrystal();
IItemDefinition wirelessBooster();
IItemDefinition fluixPearl();
IItemDefinition annihilationCore();
IItemDefinition woodenGear();
IItemDefinition formationCore();
IItemDefinition wirelessReceiver();
IItemDefinition singularity();
IItemDefinition wirelessBooster();
IItemDefinition qESingularity();
IItemDefinition annihilationCore();
IItemDefinition blankPattern();
IItemDefinition formationCore();
IItemDefinition fluidCell1kPart();
IItemDefinition singularity();
IItemDefinition fluidCell4kPart();
IItemDefinition qESingularity();
IItemDefinition fluidCell16kPart();
IItemDefinition blankPattern();
IItemDefinition fluidCell64kPart();
IItemDefinition fluidCell1kPart();
IItemDefinition fluidCell4kPart();
IItemDefinition fluidCell16kPart();
IItemDefinition fluidCell64kPart();
}
@@ -19,12 +19,11 @@
package appeng.api.features;
import java.util.List;
import java.util.Optional;
import net.minecraft.item.ItemStack;
import javax.annotation.Nonnull;
import net.minecraft.item.ItemStack;
import java.util.List;
import java.util.Optional;
/**
@@ -57,21 +56,35 @@ public interface IInscriberRecipe
@Nonnull
ItemStack getOutput();
@Nonnull
List<ItemStack> getTopInputs();
/**
* gets the top optional
*
* @return item which is used top
*/
@Deprecated
@Nonnull
Optional<ItemStack> getTopOptional();
default Optional<ItemStack> getTopOptional(){
return getTopInputs().isEmpty() ? Optional.empty() : Optional.of(getTopInputs().get(0));
}
@Nonnull
List<ItemStack> getBottomInputs();
/**
* gets the bottom optional
*
* @return item which is used bottom
*/
@Deprecated
@Nonnull
Optional<ItemStack> getBottomOptional();
default Optional<ItemStack> getBottomOptional() {
return getBottomInputs().isEmpty() ? Optional.empty() : Optional.of(getBottomInputs().get(0));
}
/**
* type of inscriber process
@@ -19,11 +19,11 @@
package appeng.api.features;
import java.util.Collection;
import net.minecraft.item.ItemStack;
import javax.annotation.Nonnull;
import net.minecraft.item.ItemStack;
import java.util.Collection;
import java.util.Collections;
/**
@@ -66,7 +66,7 @@ public interface IInscriberRecipeBuilder
* @return currently used builder
*/
@Nonnull
IInscriberRecipeBuilder withTopOptional( @Nonnull ItemStack topOptional );
IInscriberRecipeBuilder withTopOptional(@Nonnull Collection<ItemStack> topOptional );
/**
* Creates an inscriber recipe with bot.
@@ -77,7 +77,7 @@ public interface IInscriberRecipeBuilder
* @return currently used builder
*/
@Nonnull
IInscriberRecipeBuilder withBottomOptional( @Nonnull ItemStack bottomOptional );
IInscriberRecipeBuilder withBottomOptional( @Nonnull Collection<ItemStack> bottomOptional );
/**
* Creates an inscriber recipe with type.
@@ -104,4 +104,14 @@ public interface IInscriberRecipeBuilder
*/
@Nonnull
IInscriberRecipe build();
@Deprecated
default IInscriberRecipeBuilder withTopOptional(@Nonnull ItemStack topOptional){
return withTopOptional(Collections.singleton(topOptional));
}
@Deprecated
default IInscriberRecipeBuilder withBottomOptional(@Nonnull ItemStack bottomOptional){
return withBottomOptional(Collections.singleton(bottomOptional));
}
}
@@ -28,47 +28,45 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import appeng.api.util.IConfigManager;
import net.minecraftforge.fml.common.network.IGuiHandler;
/**
* A handler for a wireless terminal.
*/
public interface IWirelessTermHandler extends INetworkEncodable
{
public interface IWirelessTermHandler extends INetworkEncodable {
/**
* @param is wireless terminal
*
* @return true, if usePower, hasPower, etc... can be called for the provided item
*/
boolean canHandle( ItemStack is );
/**
* @param is wireless terminal
* @return true, if usePower, hasPower, etc... can be called for the provided item
*/
boolean canHandle(ItemStack is);
/**
* use an amount of power, in AE units
*
* @param amount is in AE units ( 5 per MJ ), if you return false, the item should be dead and return false for
* hasPower
* @param is wireless terminal
*
* @return true if wireless terminal uses power
*/
boolean usePower( EntityPlayer player, double amount, ItemStack is );
/**
* use an amount of power, in AE units
*
* @param amount is in AE units ( 5 per MJ ), if you return false, the item should be dead and return false for
* hasPower
* @param is wireless terminal
* @return true if wireless terminal uses power
*/
boolean usePower(EntityPlayer player, double amount, ItemStack is);
/**
* gets the power status of the item.
*
* @param is wireless terminal
*
* @return returns true if there is any power left.
*/
boolean hasPower( EntityPlayer player, double amount, ItemStack is );
/**
* gets the power status of the item.
*
* @param is wireless terminal
* @return returns true if there is any power left.
*/
boolean hasPower(EntityPlayer player, double amount, ItemStack is);
/**
* Return the config manager for the wireless terminal.
*
* @param is wireless terminal
*
* @return config manager of wireless terminal
*/
IConfigManager getConfigManager( ItemStack is );
/**
* Return the config manager for the wireless terminal.
*
* @param is wireless terminal
* @return config manager of wireless terminal
*/
IConfigManager getConfigManager(ItemStack is);
IGuiHandler getGuiHandler(ItemStack is);
}
@@ -0,0 +1,7 @@
package appeng.api.implementations;
public interface IUpgradeableCellContainer {
int availableUpgrades();
void setupUpgrades();
}
@@ -21,15 +21,21 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package appeng.api.parts;
package appeng.api.implementations;
/**
* TODO: Consider removing and replacing with capabilities.
*/
public enum LayerFlags
{
import appeng.api.config.Upgrades;
import appeng.api.implementations.tiles.ISegmentedInventory;
import appeng.api.util.IConfigurableObject;
IC2_ENET
public interface IUpgradeableCellHost extends IConfigurableObject, ISegmentedInventory {
/**
* determine how many of an upgrade are installed.
*/
default int getInstalledUpgrades(Upgrades u) {
return 0;
}
}
@@ -40,11 +40,13 @@ public interface IChestOrDrive extends ICellContainer, IGridHost, IOrientable
/**
* 0 - cell is missing.
*
* 1 - green,
* 1 - green, the cell is present and partially empty
*
* 2 - orange,
* 2 - orange, the cell is present and full on types
*
* 3 - red
* 3 - red, the cell is present and full on bytes
*
* 4 - blue, the cell is present but totally empty
*
* @param slot slot index
*
@@ -77,6 +77,14 @@ public interface ICraftingPatternDetails
*/
IAEItemStack[] getCondensedOutputs();
/**
* The primary output of this pattern. The pattern will only be used to craft the primary output; the others are
* just byproducts.
*/
default IAEItemStack getPrimaryOutput() {
return getOutputs()[0];
}
/**
* @return a list of the outputs, will include nulls.
*/
+1 -1
View File
@@ -22,7 +22,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
@API( apiVersion = "@aeversion@", owner = "appliedenergistics2", provides = "appliedenergistics2|API" )
@API(apiVersion = "rv6", owner = "appliedenergistics2", provides = "appliedenergistics2|API")
package appeng.api;
@@ -41,6 +41,13 @@ import appeng.api.util.AEPartLocation;
public interface IFacadeContainer
{
/**
* Checks if the {@link IFacadePart} can be added to the given side.
*
* @return true if the facade can be successfully added
*/
boolean canAddFacade( IFacadePart a );
/**
* Attempts to add the {@link IFacadePart} to the given side.
*
+50 -26
View File
@@ -24,6 +24,7 @@
package appeng.api.parts;
import appeng.api.util.AEPartLocation;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumActionResult;
@@ -32,35 +33,11 @@ import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import javax.annotation.Nullable;
public interface IPartHelper
{
/**
* Register a new layer with the part layer system, this allows you to write an in between between tile entities and
* parts.
*
* AE By Default includes,
*
* 1. ISidedInventory ( and by extension IInventory. )
*
* 2. IFluidHandler Forge Fluids
*
* 3. IPowerEmitter BC Power output.
*
* 4. IPowerReceptor BC Power input.
*
* 5. IEnergySink IC2 Power input.
*
* 6. IEnergySource IC2 Power output.
*
* 7. IPipeConnection BC Pipe Connections
*
* As long as a valid layer is registered for a interface you can simply implement that interface on a part get
* implement it.
*
* @return true on success, false on failure, usually a error will be logged as well.
*/
boolean registerNewLayer( String string, String layerInterface );
/**
* use in use item, to try and place a IBusItem
@@ -79,4 +56,51 @@ public interface IPartHelper
* @return the render mode
*/
CableRenderMode getCableRenderMode();
/**
* Try to get a part at a specific place in the world.
*
* @param w world the part is in
* @param pos pos of the part host
* @param side side to test for a part on.
*
* @return the part if it exists, null otherwise
*/
@Nullable
IPart getPart( World w, BlockPos pos, AEPartLocation side );
/**
* Try to get a part host at a specific place in the world.
*
* @param w world the part host is in
* @param pos pos of the part host
*
* @return the part host if it exists, null otherwise
*/
@Nullable
IPartHost getPartHost( World w, BlockPos pos );
/**
* Get a part host if it exists, or place one if it doesn't.
*
* @param w world the part host is in
* @param pos pos to get or place the part host
* @param force whether to skip permission and existing block checks and forcibly place the part host here.
* @param p the placing player, or null if none
*
* @return the existing or created part host, or null if it didn't already exist and part host is unable to be placed.
*/
@Nullable
IPartHost getOrPlacePartHost( World w, BlockPos pos, boolean force, @Nullable EntityPlayer p );
/**
* Test if a part host can be successfully placed at a given position by the provided player.
*
* @param w world the part host is in
* @param pos pos to test for part host placement
* @param p the placing player, or null if none
*
* @return if the part can be placed at the provided world and position
*/
boolean canPlacePartHost( World w, BlockPos pos, @Nullable EntityPlayer p );
}
+13 -7
View File
@@ -145,13 +145,24 @@ public interface IPartHost extends ICustomCableConnection
*/
SelectedPart selectPart( Vec3d pos );
/**
* Same as {@link #selectPart(Vec3d)}, but with global instead of local coordinates.
*/
default SelectedPart selectPartGlobal( Vec3d pos ) {
DimensionalCoord globalPos = getLocation();
return selectPart(pos.subtract(
globalPos.getPos().getX(),
globalPos.getPos().getY(),
globalPos.getPos().getZ()));
}
/**
* can be used by parts to trigger the tile or part to save.
*/
void markForSave();
/**
* part of the {@link LayerBase}
* called when parts are added or removed
*/
void partChanged();
@@ -169,11 +180,6 @@ public interface IPartHost extends ICustomCableConnection
*/
boolean isEmpty();
/**
* @return a mutable list of flags you can adjust to track state.
*/
Set<LayerFlags> getLayerFlags();
/**
* remove host from world...
*/
@@ -191,4 +197,4 @@ public interface IPartHost extends ICustomCableConnection
*/
boolean isInWorld();
}
}
@@ -1,98 +0,0 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2013 AlgorithmX2
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package appeng.api.parts;
import java.util.Set;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import appeng.api.util.AEPartLocation;
/**
* All Layers must extends this, this get part implementation is provided to interface with the parts, however a real
* implementation will be used at runtime.
*
* TODO: Consider removing and replacing with capabilities.
*/
public abstract class LayerBase extends TileEntity // implements IPartHost
{
/**
* Grants access for the layer to the parts of the host.
*
* This Method looks silly, that is because its not used at runtime, a real implementation will be used instead.
*
* @param side side of part
*
* @return the part for the requested side.
*/
public IPart getPart( final AEPartLocation side )
{
return null; // place holder.
}
/**
* Grants access for the layer to the parts of the host.
*
* This Method looks silly, that is because its not used at runtime, a real implementation will be used instead.
*
* @param side side of part
*
* @return the part for the requested side.
*/
public IPart getPart( final EnumFacing side )
{
return null; // place holder.
}
/**
* called when the parts change in the container, YOU MUST CALL super.PartChanged();
*/
public void notifyNeighbors()
{
}
/**
* called when the parts change in the container, YOU MUST CALL super.PartChanged();
*/
public void partChanged()
{
}
/**
* @return a mutable list of flags you can adjust to track state.
*/
public Set<LayerFlags> getLayerFlags()
{
return null; // place holder.
}
public void markForSave()
{
// something!
}
}
@@ -123,6 +123,8 @@ public interface ICellInventory<T extends IAEStack<T>> extends IMEInventory<T>
*
* 3 - red, ( usually means the cell is 100% full )
*
* 4 - blue, ( usually means the cell is available and completely empty. )
*
* @return get the status of the cell based on its contents.
*/
int getStatusForCell();
@@ -89,4 +89,12 @@ public interface IMEInventoryHandler<T extends IAEStack<T>> extends IMEInventory
* @return true, if this inventory is valid for this pass.
*/
boolean validForPass( int i );
/**
* Gets whether an inventory is "Sticky" i.e. only it and other sticky storages that have partitions with certain
* items are allowed to be put into sticky storages.
*/
default boolean isSticky() {
return false;
}
}
@@ -39,7 +39,7 @@ import appeng.api.storage.IStorageChannel;
* - For fluids: AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class).createList()
* - Replace with the corresponding {@link IStorageChannel} type for non native channels
*/
public interface IItemList<T extends IAEStack<T>> extends IItemContainer<T>, Iterable<T>, Cloneable
public interface IItemList<T extends IAEStack<T>> extends IItemContainer<T>, Iterable<T>
{
/**
@@ -85,9 +85,4 @@ public interface IItemList<T extends IAEStack<T>> extends IItemContainer<T>, Ite
* resets stack sizes to 0.
*/
void resetStatus();
/**
* create a copy of this list.
*/
IItemList<T> clone();
}
}
@@ -11,77 +11,77 @@ import net.minecraft.inventory.Slot;
* or the MouseTweaksDisableWheelTweak annotations.
*/
public interface IMTModGuiContainer2 {
/**
* If you want to disable Mouse Tweaks in your GuiScreen, return true from this method.
*
* @return True if Mouse Tweaks should be disabled, false otherwise.
*/
boolean MT_isMouseTweaksDisabled();
/**
* If you want to disable Mouse Tweaks in your GuiScreen, return true from this method.
*
* @return True if Mouse Tweaks should be disabled, false otherwise.
*/
boolean MT_isMouseTweaksDisabled();
/**
* If you want to disable the Wheel Tweak in your GuiScreen, return true from this method.
*
* @return True if the Wheel Tweak should be disabled, false otherwise.
*/
boolean MT_isWheelTweakDisabled();
/**
* If you want to disable the Wheel Tweak in your GuiScreen, return true from this method.
*
* @return True if the Wheel Tweak should be disabled, false otherwise.
*/
boolean MT_isWheelTweakDisabled();
/**
* Returns the Container.
*
* @return Container that is currently in use.
*/
Container MT_getContainer();
/**
* Returns the Container.
*
* @return Container that is currently in use.
*/
Container MT_getContainer();
/**
* Returns the Slot that is currently selected by the player, or null if no Slot is selected.
*
* @return Slot that is located under the mouse, or null if no Slot it currently under the mouse.
*/
Slot MT_getSlotUnderMouse();
/**
* Returns the Slot that is currently selected by the player, or null if no Slot is selected.
*
* @return Slot that is located under the mouse, or null if no Slot it currently under the mouse.
*/
Slot MT_getSlotUnderMouse();
/**
* Return true if the given Slot behaves like the vanilla crafting output slots (inside the crafting table,
* or the furnace output slot, or the anvil output slot, etc.). These slots are handled differently by Mouse Tweaks.
*
* @param slot the slot to check
* @return True if slot is a crafting output slot.
*/
boolean MT_isCraftingOutput(Slot slot);
/**
* Return true if the given Slot behaves like the vanilla crafting output slots (inside the crafting table,
* or the furnace output slot, or the anvil output slot, etc.). These slots are handled differently by Mouse Tweaks.
*
* @param slot the slot to check
* @return True if slot is a crafting output slot.
*/
boolean MT_isCraftingOutput(Slot slot);
/**
* Return true if the given Slot should be ignored by Mouse Tweaks. Examples of ignored slots are the item select
* slots and the Destroy Item slot in the vanilla creative inventory.
*
* @param slot the slot to check
* @return Tru if slot should be ignored by Mouse Tweaks.
*/
boolean MT_isIgnored(Slot slot);
/**
* Return true if the given Slot should be ignored by Mouse Tweaks. Examples of ignored slots are the item select
* slots and the Destroy Item slot in the vanilla creative inventory.
*
* @param slot the slot to check
* @return Tru if slot should be ignored by Mouse Tweaks.
*/
boolean MT_isIgnored(Slot slot);
/**
* If your container has an RMB dragging functionality (like vanilla containers), disable it inside this method.
* This method is called every frame (render tick), which is after all mouseClicked / mouseClickMove / mouseReleased
* events are handled (although note these events are handled every game tick, which is far less frequent than every
* render tick).<br><br>
*
* If true is returned from this method, Mouse Tweaks (after checking other conditions like isIgnored) will click
* the slot on which the right mouse button was initially pressed (in most cases this is the slot currently under
* mouse). This is needed because the vanilla RMB dragging functionality prevents the initial slot click.<br><br>
*
* For vanilla containers this method looks like this:
* <pre>
* this.ignoreMouseUp = true;
*
* if (this.dragSplitting) {
* if (this.dragSplittingButton == 1) {
* this.dragSplitting = false;
* return true;
* }
* }
*
* return false;
* </pre>
*
* @return True if Mouse Tweaks should click the slot on which the RMB was pressed.
*/
boolean MT_disableRMBDraggingFunctionality();
}
/**
* If your container has an RMB dragging functionality (like vanilla containers), disable it inside this method.
* This method is called every frame (render tick), which is after all mouseClicked / mouseClickMove / mouseReleased
* events are handled (although note these events are handled every game tick, which is far less frequent than every
* render tick).<br><br>
* <p>
* If true is returned from this method, Mouse Tweaks (after checking other conditions like isIgnored) will click
* the slot on which the right mouse button was initially pressed (in most cases this is the slot currently under
* mouse). This is needed because the vanilla RMB dragging functionality prevents the initial slot click.<br><br>
* <p>
* For vanilla containers this method looks like this:
* <pre>
* this.ignoreMouseUp = true;
*
* if (this.dragSplitting) {
* if (this.dragSplittingButton == 1) {
* this.dragSplitting = false;
* return true;
* }
* }
*
* return false;
* </pre>
*
* @return True if Mouse Tweaks should click the slot on which the RMB was pressed.
*/
boolean MT_disableRMBDraggingFunctionality();
}
+7 -7
View File
@@ -307,13 +307,13 @@ public abstract class AEBaseBlock extends Block {
return dir;
}
final int west_x = forward.getFrontOffsetY() * up.getFrontOffsetZ() - forward.getFrontOffsetZ() * up.getFrontOffsetY();
final int west_y = forward.getFrontOffsetZ() * up.getFrontOffsetX() - forward.getFrontOffsetX() * up.getFrontOffsetZ();
final int west_z = forward.getFrontOffsetX() * up.getFrontOffsetY() - forward.getFrontOffsetY() * up.getFrontOffsetX();
final int west_x = forward.getYOffset() * up.getZOffset() - forward.getZOffset() * up.getYOffset();
final int west_y = forward.getZOffset() * up.getYOffset() - forward.getXOffset() * up.getZOffset();
final int west_z = forward.getXOffset() * up.getYOffset() - forward.getYOffset() * up.getXOffset();
EnumFacing west = null;
for (final EnumFacing dx : EnumFacing.VALUES) {
if (dx.getFrontOffsetX() == west_x && dx.getFrontOffsetY() == west_y && dx.getFrontOffsetZ() == west_z) {
if (dx.getXOffset() == west_x && dx.getYOffset() == west_y && dx.getZOffset() == west_z) {
west = dx;
}
}
@@ -348,12 +348,12 @@ public abstract class AEBaseBlock extends Block {
@Override
public String toString() {
String regName = this.getRegistryName() != null ? this.getRegistryName().getResourcePath() : "unregistered";
String regName = this.getRegistryName() != null ? this.getRegistryName().getPath() : "unregistered";
return this.getClass().getSimpleName() + "[" + regName + "]";
}
protected String getUnlocalizedName(final ItemStack is) {
return this.getUnlocalizedName();
protected String getTranslationKey(final ItemStack is) {
return this.getTranslationKey();
}
protected boolean hasCustomRotation() {
@@ -38,6 +38,7 @@ import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.jetbrains.annotations.NotNull;
import java.util.List;
@@ -77,8 +78,9 @@ public class AEBaseItemBlock extends ItemBlock {
}
@Override
public String getUnlocalizedName(final ItemStack is) {
return this.blockType.getUnlocalizedName(is);
@NotNull
public String getTranslationKey(final ItemStack is) {
return this.blockType.getTranslationKey(is);
}
@Override
@@ -137,7 +139,7 @@ public class AEBaseItemBlock extends ItemBlock {
ori = ((IOrientableBlock) this.blockType).getOrientable(w, pos);
up = side;
forward = EnumFacing.SOUTH;
if (up.getFrontOffsetY() == 0) {
if (up.getYOffset() == 0) {
forward = EnumFacing.UP;
}
}
@@ -22,6 +22,12 @@ package appeng.block;
import com.google.common.base.Preconditions;
import net.minecraft.block.Block;
import net.minecraft.block.BlockStairs;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import javax.annotation.Nonnull;
public abstract class AEBaseStairBlock extends BlockStairs {
@@ -30,17 +36,22 @@ public abstract class AEBaseStairBlock extends BlockStairs {
super(block.getDefaultState());
Preconditions.checkNotNull(block);
Preconditions.checkNotNull(block.getUnlocalizedName());
Preconditions.checkArgument(block.getUnlocalizedName().length() > 0);
Preconditions.checkNotNull(block.getTranslationKey());
Preconditions.checkArgument(block.getTranslationKey().length() > 0);
this.setUnlocalizedName("stair." + type);
this.setTranslationKey("stair." + type);
this.setLightOpacity(0);
}
@Override
public String toString() {
String regName = this.getRegistryName() != null ? this.getRegistryName().getResourcePath() : "unregistered";
String regName = this.getRegistryName() != null ? this.getRegistryName().getPath() : "unregistered";
return this.getClass().getSimpleName() + "[" + regName + "]";
}
@Override
public boolean doesSideBlockChestOpening(@Nonnull IBlockState blockState, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull EnumFacing side) {
return false;
}
}
@@ -288,7 +288,7 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity
return false;
}
final String name = this.getUnlocalizedName();
final String name = this.getTranslationKey();
if (player.isSneaking()) {
final NBTTagCompound data = tileEntity.downloadSettings(SettingsFrom.MEMORY_CARD);
@@ -300,7 +300,7 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity
final String savedName = memoryCard.getSettingsName(heldItem);
final NBTTagCompound data = memoryCard.getData(heldItem);
if (this.getUnlocalizedName().equals(savedName)) {
if (this.getTranslationKey().equals(savedName)) {
tileEntity.uploadSettings(SettingsFrom.MEMORY_CARD, data, player);
memoryCard.notifyUser(player, MemoryCardMessages.SETTINGS_LOADED);
} else {
@@ -43,6 +43,7 @@ import net.minecraftforge.common.property.ExtendedBlockState;
import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.common.property.IUnlistedProperty;
import javax.annotation.Nonnull;
import java.util.EnumSet;
@@ -111,7 +112,7 @@ public class BlockCraftingUnit extends AEBaseTileBlock {
}
@Override
public BlockRenderLayer getBlockLayer() {
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT;
}
@@ -38,6 +38,8 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nonnull;
public class BlockMolecularAssembler extends AEBaseTileBlock {
@@ -72,7 +74,7 @@ public class BlockMolecularAssembler extends AEBaseTileBlock {
*/
@SideOnly(Side.CLIENT)
@Override
public BlockRenderLayer getBlockLayer() {
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT;
}
@@ -121,15 +121,15 @@ public class BlockCharger extends AEBaseTileBlock implements ICustomCollision {
final EnumFacing forward = tile.getForward();
final AEAxisAlignedBB bb = new AEAxisAlignedBB(twoPixels, twoPixels, twoPixels, 1.0 - twoPixels, 1.0 - twoPixels, 1.0 - twoPixels);
if (up.getFrontOffsetX() != 0) {
if (up.getXOffset() != 0) {
bb.minX = 0;
bb.maxX = 1;
}
if (up.getFrontOffsetY() != 0) {
if (up.getYOffset() != 0) {
bb.minY = 0;
bb.maxY = 1;
}
if (up.getFrontOffsetZ() != 0) {
if (up.getZOffset() != 0) {
bb.minZ = 0;
bb.maxZ = 1;
}
@@ -68,7 +68,7 @@ public class BlockInscriber extends AEBaseTileBlock {
}
@Override
public String getUnlocalizedName(final ItemStack is) {
return super.getUnlocalizedName(is);
public String getTranslationKey(final ItemStack is) {
return super.getTranslationKey(is);
}
}
@@ -25,12 +25,14 @@ import appeng.block.AEBaseTileBlock;
import appeng.core.sync.GuiBridge;
import appeng.tile.misc.TileInterface;
import appeng.util.Platform;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
@@ -93,4 +95,12 @@ public class BlockInterface extends AEBaseTileBlock {
((TileInterface) rotatable).setSide(axis);
}
}
@Override
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos) {
TileEntity tileEntity = this.getTileEntity(worldIn, pos);
if (tileEntity != null) {
((TileInterface) tileEntity).updateRedstoneState();
}
}
}
@@ -41,6 +41,7 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nonnull;
import java.util.Collections;
import java.util.List;
import java.util.Random;
@@ -115,9 +116,9 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl
@Override
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool(final World w, final BlockPos pos, final Entity thePlayer, final boolean b) {
final EnumFacing up = this.getOrientable(w, pos).getUp();
final double xOff = -0.3 * up.getFrontOffsetX();
final double yOff = -0.3 * up.getFrontOffsetY();
final double zOff = -0.3 * up.getFrontOffsetZ();
final double xOff = -0.3 * up.getXOffset();
final double yOff = -0.3 * up.getYOffset();
final double zOff = -0.3 * up.getZOffset();
return Collections.singletonList(new AxisAlignedBB(xOff + 0.3, yOff + 0.3, zOff + 0.3, xOff + 0.7, yOff + 0.7, zOff + 0.7));
}
@@ -167,7 +168,7 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl
@Override
@SideOnly(Side.CLIENT)
public BlockRenderLayer getBlockLayer() {
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT;
}
@@ -44,6 +44,7 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nonnull;
import java.util.Collections;
import java.util.List;
import java.util.Random;
@@ -107,9 +108,9 @@ public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock,
@Override
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool(final World w, final BlockPos pos, final Entity e, final boolean isVisual) {
final EnumFacing up = this.getOrientable(w, pos).getUp();
final double xOff = -0.3 * up.getFrontOffsetX();
final double yOff = -0.3 * up.getFrontOffsetY();
final double zOff = -0.3 * up.getFrontOffsetZ();
final double xOff = -0.3 * up.getXOffset();
final double yOff = -0.3 * up.getYOffset();
final double zOff = -0.3 * up.getZOffset();
return Collections.singletonList(new AxisAlignedBB(xOff + 0.3, yOff + 0.3, zOff + 0.3, xOff + 0.7, yOff + 0.7, zOff + 0.7));
}
@@ -134,9 +135,9 @@ public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock,
}
final EnumFacing up = this.getOrientable(w, pos).getUp();
final double xOff = -0.3 * up.getFrontOffsetX();
final double yOff = -0.3 * up.getFrontOffsetY();
final double zOff = -0.3 * up.getFrontOffsetZ();
final double xOff = -0.3 * up.getXOffset();
final double yOff = -0.3 * up.getYOffset();
final double zOff = -0.3 * up.getZOffset();
for (int bolts = 0; bolts < 3; bolts++) {
if (AppEng.proxy.shouldAddParticles(r)) {
final LightningFX fx = new LightningFX(w, xOff + 0.5 + pos.getX(), yOff + 0.5 + pos.getY(), zOff + 0.5 + pos.getZ(), 0.0D, 0.0D, 0.0D);
@@ -192,7 +193,7 @@ public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock,
@Override
@SideOnly(Side.CLIENT)
public BlockRenderLayer getBlockLayer() {
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT;
}
@@ -87,9 +87,9 @@ public class BlockQuartzGrowthAccelerator extends AEBaseTileBlock implements IOr
double ry = 0.5 + pos.getY();
double rz = 0.5 + pos.getZ();
rx += up.getFrontOffsetX() * d0;
ry += up.getFrontOffsetY() * d0;
rz += up.getFrontOffsetZ() * d0;
rx += up.getXOffset() * d0;
ry += up.getYOffset() * d0;
rz += up.getZOffset() * d0;
final int x = pos.getX();
final int y = pos.getY();
@@ -103,25 +103,25 @@ public class BlockQuartzGrowthAccelerator extends AEBaseTileBlock implements IOr
case 0:
dx = 0.6;
dz = d1;
pt = new BlockPos(x + west.getFrontOffsetX(), y + west.getFrontOffsetY(), z + west.getFrontOffsetZ());
pt = new BlockPos(x + west.getXOffset(), y + west.getYOffset(), z + west.getZOffset());
break;
case 1:
dx = d1;
dz += 0.6;
pt = new BlockPos(x + forward.getFrontOffsetX(), y + forward.getFrontOffsetY(), z + forward.getFrontOffsetZ());
pt = new BlockPos(x + forward.getXOffset(), y + forward.getYOffset(), z + forward.getZOffset());
break;
case 2:
dx = d1;
dz = -0.6;
pt = new BlockPos(x - forward.getFrontOffsetX(), y - forward.getFrontOffsetY(), z - forward.getFrontOffsetZ());
pt = new BlockPos(x - forward.getXOffset(), y - forward.getYOffset(), z - forward.getZOffset());
break;
case 3:
dx = -0.6;
dz = d1;
pt = new BlockPos(x - west.getFrontOffsetX(), y - west.getFrontOffsetY(), z - west.getFrontOffsetZ());
pt = new BlockPos(x - west.getXOffset(), y - west.getYOffset(), z - west.getZOffset());
break;
}
@@ -130,13 +130,13 @@ public class BlockQuartzGrowthAccelerator extends AEBaseTileBlock implements IOr
return;
}
rx += dx * west.getFrontOffsetX();
ry += dx * west.getFrontOffsetY();
rz += dx * west.getFrontOffsetZ();
rx += dx * west.getXOffset();
ry += dx * west.getYOffset();
rz += dx * west.getZOffset();
rx += dz * forward.getFrontOffsetX();
ry += dz * forward.getFrontOffsetY();
rz += dz * forward.getFrontOffsetZ();
rx += dz * forward.getXOffset();
ry += dz * forward.getYOffset();
rz += dz * forward.getZOffset();
final LightningFX fx = new LightningFX(w, rx, ry, rz, 0.0D, 0.0D, 0.0D);
Minecraft.getMinecraft().effectRenderer.addEffect(fx);
@@ -37,6 +37,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -56,7 +57,7 @@ public class BlockSecurityStation extends AEBaseTileBlock {
}
@Override
public BlockRenderLayer getBlockLayer() {
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT;
}
@@ -89,7 +89,7 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision {
@Override
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos) {
if (world.isBlockIndirectlyGettingPowered(pos) > 0) {
if (world.getRedstonePowerFromNeighbors(pos) > 0) {
this.startFuse(world, pos, null);
world.setBlockToAir(pos);
}
@@ -99,7 +99,7 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision {
public void onBlockAdded(final World w, final BlockPos pos, final IBlockState state) {
super.onBlockAdded(w, pos, state);
if (w.isBlockIndirectlyGettingPowered(pos) > 0) {
if (w.getRedstonePowerFromNeighbors(pos) > 0) {
this.startFuse(w, pos, null);
w.setBlockToAir(pos);
}
@@ -102,20 +102,20 @@ public final class BlockVibrationChamber extends AEBaseTileBlock {
final EnumFacing forward = tc.getForward();
final EnumFacing up = tc.getUp();
final int west_x = forward.getFrontOffsetY() * up.getFrontOffsetZ() - forward.getFrontOffsetZ() * up.getFrontOffsetY();
final int west_y = forward.getFrontOffsetZ() * up.getFrontOffsetX() - forward.getFrontOffsetX() * up.getFrontOffsetZ();
final int west_z = forward.getFrontOffsetX() * up.getFrontOffsetY() - forward.getFrontOffsetY() * up.getFrontOffsetX();
final int west_x = forward.getYOffset() * up.getZOffset() - forward.getZOffset() * up.getYOffset();
final int west_y = forward.getZOffset() * up.getXOffset() - forward.getXOffset() * up.getZOffset();
final int west_z = forward.getXOffset() * up.getYOffset() - forward.getYOffset() * up.getXOffset();
f1 += forward.getFrontOffsetX() * 0.6;
f2 += forward.getFrontOffsetY() * 0.6;
f3 += forward.getFrontOffsetZ() * 0.6;
f1 += forward.getXOffset() * 0.6;
f2 += forward.getYOffset() * 0.6;
f3 += forward.getZOffset() * 0.6;
final float ox = r.nextFloat();
final float oy = r.nextFloat() * 0.2f;
f1 += up.getFrontOffsetX() * (-0.3 + oy);
f2 += up.getFrontOffsetY() * (-0.3 + oy);
f3 += up.getFrontOffsetZ() * (-0.3 + oy);
f1 += up.getXOffset() * (-0.3 + oy);
f2 += up.getYOffset() * (-0.3 + oy);
f3 += up.getZOffset() * (-0.3 + oy);
f1 += west_x * (0.3 * ox - 0.15);
f2 += west_y * (0.3 * ox - 0.15);
@@ -29,9 +29,10 @@ import appeng.block.AEBaseTileBlock;
import appeng.client.UnlistedProperty;
import appeng.client.render.cablebus.CableBusBakedModel;
import appeng.client.render.cablebus.CableBusRenderState;
import appeng.core.Api;
import appeng.client.render.cablebus.FacadeRenderState;
import appeng.core.AppEng;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketCableBusLandingParticle;
import appeng.core.sync.packets.PacketClick;
import appeng.helpers.AEGlassMaterial;
import appeng.integration.abstraction.IAEFacade;
@@ -71,10 +72,12 @@ import net.minecraft.util.math.RayTraceResult.Type;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraftforge.common.property.ExtendedBlockState;
import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.common.property.IUnlistedProperty;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import net.minecraftforge.fml.common.network.NetworkRegistry;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -91,10 +94,6 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade {
private static final ICableBusContainer NULL_CABLE_BUS = new NullCableBusContainer();
private static Class<? extends AEBaseTile> noTesrTile;
private static Class<? extends AEBaseTile> tesrTile;
public BlockCableBus() {
super(AEGlassMaterial.INSTANCE);
this.setLightOpacity(0);
@@ -152,7 +151,7 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade {
}
@Override
public void onEntityCollidedWithBlock(final World w, final BlockPos pos, final IBlockState state, final Entity entityIn) {
public void onEntityCollision(final World w, final BlockPos pos, final IBlockState state, final Entity entityIn) {
this.cb(w, pos).onEntityCollision(entityIn);
}
@@ -303,6 +302,90 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade {
return true;
}
@Override
public boolean addRunningEffects(IBlockState state, World world, BlockPos pos, Entity entity) {
if (world.isRemote) {
addRunningParticle(world, pos, entity);
}
return true;
}
@SideOnly(Side.CLIENT)
private void addRunningParticle(World world, BlockPos pos, Entity entity) {
final ICableBusContainer cb = this.cb(world, pos);
final IBakedModel model = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(this.getDefaultState());
if (!(model instanceof CableBusBakedModel cableBusModel)) {
return;
}
final CableBusRenderState renderState = cb.getRenderState();
final TextureAtlasSprite texture = getSpriteForParticle(renderState, cableBusModel);
if (texture != null) {
final double d0 = entity.posX + (world.rand.nextFloat() - 0.5f) * entity.width;
final double d1 = entity.getEntityBoundingBox().minY + 0.1f;
final double d2 = entity.posZ + (world.rand.nextFloat() - 0.5f) * entity.width;
final ParticleDigging particle = new DestroyFX(world, d0, d1, d2, -entity.motionX * 4.0f, 1.5f, -entity.motionZ * 4.0f, this.getDefaultState()).setBlockPos(pos);
particle.setParticleTexture(texture);
Minecraft.getMinecraft().effectRenderer.addEffect(particle);
}
}
@Override
public boolean addLandingEffects(IBlockState state, WorldServer world, BlockPos pos, IBlockState iblockstate, EntityLivingBase entity, int numberOfParticles) {
// for reasons only notch can explain, this method is only called on the server, so we have to sync
// a packet to all tracking players for landing particle effects
if (!world.isRemote) {
final PacketCableBusLandingParticle packet = new PacketCableBusLandingParticle(pos, entity, numberOfParticles);
final NetworkRegistry.TargetPoint point = new NetworkRegistry.TargetPoint(world.provider.getDimension(), pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, 32);
NetworkHandler.instance().sendToAllTracking(packet, point);
}
return true;
}
@SideOnly(Side.CLIENT)
public void addLandingParticle(BlockPos pos, double entityX, double entityY, double entityZ, int numberOfParticles) {
final World world = Minecraft.getMinecraft().world;
final ICableBusContainer cb = this.cb(world, pos);
final IBakedModel model = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(this.getDefaultState());
if (!(model instanceof CableBusBakedModel cableBusModel)) {
return;
}
final TextureAtlasSprite texture = getSpriteForParticle(cb.getRenderState(), cableBusModel);
if (texture != null) {
final Vec3d startVec = new Vec3d(entityX, entityY, entityZ);
final Vec3d endVec = startVec.add(0.0f, -4.0f, 0.0f);
RayTraceResult result = world.rayTraceBlocks(startVec, endVec, true, false, true);
final double speed = 0.15f;
if (result != null && result.typeOfHit == Type.BLOCK && numberOfParticles != 0) {
for (int i = 0; i < numberOfParticles; i++) {
final double d0 = world.rand.nextGaussian() * speed;
final double d1 = world.rand.nextGaussian() * speed;
final double d2 = world.rand.nextGaussian() * speed;
final ParticleDigging particle = new DestroyFX(world, entityX, entityY, entityZ, d0, d1, d2, this.getDefaultState()).setBlockPos(pos);
particle.setParticleTexture(texture);
Minecraft.getMinecraft().effectRenderer.addEffect(particle);
}
}
}
}
@SideOnly(Side.CLIENT)
private TextureAtlasSprite getSpriteForParticle(CableBusRenderState renderState, CableBusBakedModel cableBusModel) {
final FacadeRenderState frs = renderState.getFacades().get(EnumFacing.UP);
if (frs != null) {
final IBlockState state = frs.getSourceBlock();
final IBakedModel model = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(state);
return model.getParticleTexture();
}
return Platform.pickRandom(cableBusModel.getParticleTextures(renderState));
}
@Override
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos) {
if (Platform.isServer()) {
@@ -378,10 +461,9 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade {
}
public void setupTile() {
noTesrTile = Api.INSTANCE.partHelper().getCombinedInstance(TileCableBus.class);
this.setTileEntity(noTesrTile);
this.setTileEntity(TileCableBus.class);
GameRegistry.registerTileEntity(noTesrTile, AppEng.MOD_ID.toLowerCase() + ":" + "BlockCableBus");
GameRegistry.registerTileEntity(TileCableBus.class, AppEng.MOD_ID.toLowerCase() + ":" + "BlockCableBus");
if (Platform.isClient()) {
setupTesr();
@@ -390,9 +472,8 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade {
@SideOnly(Side.CLIENT)
private static void setupTesr() {
tesrTile = Api.INSTANCE.partHelper().getCombinedInstance(TileCableBusTESR.class);
GameRegistry.registerTileEntity(tesrTile, AppEng.MOD_ID.toLowerCase() + ":" + "ClientOnly_TESR_CableBus");
ClientRegistry.bindTileEntitySpecialRenderer(BlockCableBus.getTesrTile(), new CableBusTESR());
GameRegistry.registerTileEntity(TileCableBusTESR.class, AppEng.MOD_ID.toLowerCase() + ":" + "ClientOnly_TESR_CableBus");
ClientRegistry.bindTileEntitySpecialRenderer(TileCableBusTESR.class, new CableBusTESR());
}
@Override
@@ -438,14 +519,6 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade {
super.onEntityWalk(world, pos, entityIn);
}
public static Class<? extends AEBaseTile> getNoTesrTile() {
return noTesrTile;
}
public static Class<? extends AEBaseTile> getTesrTile() {
return tesrTile;
}
// Helper to get access to the protected constructor
@SideOnly(Side.CLIENT)
private static class DestroyFX extends ParticleDigging {
@@ -33,6 +33,8 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
public class BlockController extends AEBaseTileBlock {
@@ -144,7 +146,7 @@ public class BlockController extends AEBaseTileBlock {
}
@Override
public BlockRenderLayer getBlockLayer() {
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT;
}
@@ -40,6 +40,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
import java.util.Collections;
import java.util.List;
@@ -68,7 +69,7 @@ public class BlockWireless extends AEBaseTileBlock implements ICustomCollision {
}
@Override
public BlockRenderLayer getBlockLayer() {
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT;
}
@@ -44,6 +44,7 @@ import net.minecraftforge.common.property.IUnlistedProperty;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nonnull;
import java.util.Collection;
import java.util.Collections;
import java.util.Random;
@@ -81,7 +82,7 @@ public class BlockPaint extends AEBaseTileBlock {
}
@Override
public BlockRenderLayer getBlockLayer() {
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT;
}
@@ -37,6 +37,8 @@ import net.minecraftforge.common.property.ExtendedBlockState;
import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.common.property.IUnlistedProperty;
import javax.annotation.Nonnull;
public abstract class BlockQuantumBase extends AEBaseTileBlock implements ICustomCollision {
@@ -86,7 +88,7 @@ public abstract class BlockQuantumBase extends AEBaseTileBlock implements ICusto
}
@Override
public BlockRenderLayer getBlockLayer() {
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT;
}
@@ -105,9 +105,9 @@ class QnbFormedBakedModel implements IBakedModel {
for (EnumFacing facing : EnumFacing.values()) {
// Offset the face by a slight amount so that it is drawn over the already drawn ring texture
// (avoids z-fighting)
float xOffset = Math.abs(facing.getFrontOffsetX() * 0.01f);
float yOffset = Math.abs(facing.getFrontOffsetY() * 0.01f);
float zOffset = Math.abs(facing.getFrontOffsetZ() * 0.01f);
float xOffset = Math.abs(facing.getXOffset() * 0.01f);
float yOffset = Math.abs(facing.getYOffset() * 0.01f);
float zOffset = Math.abs(facing.getZOffset() * 0.01f);
builder.setDrawFaces(EnumSet.of(facing));
builder.addCube(
@@ -130,9 +130,9 @@ class QnbFormedBakedModel implements IBakedModel {
for (EnumFacing facing : EnumFacing.values()) {
// Offset the face by a slight amount so that it is drawn over the already drawn ring texture
// (avoids z-fighting)
float xOffset = Math.abs(facing.getFrontOffsetX() * 0.01f);
float yOffset = Math.abs(facing.getFrontOffsetY() * 0.01f);
float zOffset = Math.abs(facing.getFrontOffsetZ() * 0.01f);
float xOffset = Math.abs(facing.getXOffset() * 0.01f);
float yOffset = Math.abs(facing.getYOffset() * 0.01f);
float zOffset = Math.abs(facing.getZOffset() * 0.01f);
builder.setDrawFaces(EnumSet.of(facing));
builder.addCube(
@@ -26,12 +26,15 @@ import appeng.tile.spatial.TileSpatialIOPort;
import appeng.util.Platform;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import javax.annotation.Nullable;
@@ -39,8 +42,11 @@ import javax.annotation.Nullable;
public class BlockSpatialIOPort extends AEBaseTileBlock {
public static final PropertyBool POWERED = PropertyBool.create("powered");
public BlockSpatialIOPort() {
super(Material.IRON);
setDefaultState(getDefaultState().withProperty(POWERED, false));
}
@Override
@@ -51,6 +57,19 @@ public class BlockSpatialIOPort extends AEBaseTileBlock {
}
}
@Override
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
TileSpatialIOPort te = this.getTileEntity(worldIn, pos);
boolean powered = te != null && te.isActive();
return super.getActualState(state, worldIn, pos)
.withProperty(POWERED, powered);
}
@Override
protected IProperty[] getAEStates() {
return new IProperty[]{POWERED};
}
@Override
public boolean onActivated(final World w, final BlockPos pos, final EntityPlayer p, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ) {
if (p.isSneaking()) {
@@ -34,6 +34,8 @@ import net.minecraftforge.common.property.ExtendedBlockState;
import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.common.property.IUnlistedProperty;
import javax.annotation.Nonnull;
public class BlockSpatialPylon extends AEBaseTileBlock {
@@ -83,7 +85,7 @@ public class BlockSpatialPylon extends AEBaseTileBlock {
}
@Override
public BlockRenderLayer getBlockLayer() {
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT;
}
@@ -38,6 +38,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -56,7 +57,7 @@ public class BlockChest extends AEBaseTileBlock {
}
@Override
public BlockRenderLayer getBlockLayer() {
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT;
}
@@ -40,6 +40,7 @@ import net.minecraftforge.common.property.ExtendedBlockState;
import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.common.property.IUnlistedProperty;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -52,7 +53,7 @@ public class BlockDrive extends AEBaseTileBlock {
}
@Override
public BlockRenderLayer getBlockLayer() {
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT;
}
@@ -19,6 +19,7 @@
package appeng.block.storage;
import appeng.api.config.Upgrades;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseTileBlock;
import appeng.core.sync.GuiBridge;
@@ -26,12 +27,15 @@ import appeng.tile.storage.TileIOPort;
import appeng.util.Platform;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import javax.annotation.Nullable;
@@ -39,15 +43,34 @@ import javax.annotation.Nullable;
public class BlockIOPort extends AEBaseTileBlock {
public static final PropertyBool POWERED = PropertyBool.create("powered");
public BlockIOPort() {
super(Material.IRON);
setDefaultState(getDefaultState().withProperty(POWERED, false));
}
@Override
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
TileIOPort te = this.getTileEntity(worldIn, pos);
boolean powred = te != null && te.isActive();
return super.getActualState(state, worldIn, pos)
.withProperty(POWERED, powred);
}
@Override
protected IProperty[] getAEStates() {
return new IProperty[]{POWERED};
}
@Override
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos) {
final TileIOPort te = this.getTileEntity(world, pos);
if (te != null) {
te.updateRedstoneState();
if (te.getInstalledUpgrades(Upgrades.REDSTONE) != 0) {
te.updateRedstoneState();
}
}
}
@@ -26,6 +26,8 @@ import appeng.helpers.ICustomCollision;
import appeng.tile.storage.TileSkyChest;
import appeng.util.Platform;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
@@ -48,6 +50,8 @@ public class BlockSkyChest extends AEBaseTileBlock implements ICustomCollision {
private static final double AABB_OFFSET_SIDES = 0.06;
private static final double AABB_OFFSET_TOP = 0.125;
public static final PropertyBool NATURAL = PropertyBool.create("natural");
public enum SkyChestType {
STONE, BLOCK
}
@@ -61,6 +65,22 @@ public class BlockSkyChest extends AEBaseTileBlock implements ICustomCollision {
this.setHardness(50);
this.blockResistance = 150.0f;
this.type = type;
setDefaultState(getDefaultState().withProperty(NATURAL, true));
}
@Override
protected IProperty[] getAEStates() {
return new IProperty[]{NATURAL};
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(NATURAL) ? 1 : 0;
}
@Override
public IBlockState getStateFromMeta(int meta) {
return getDefaultState().withProperty(NATURAL, meta == 1);
}
@Override
@@ -99,18 +119,18 @@ public class BlockSkyChest extends AEBaseTileBlock implements ICustomCollision {
o = sk.getUp();
}
final double offsetX = o.getFrontOffsetX() == 0 ? AABB_OFFSET_SIDES : 0.0;
final double offsetY = o.getFrontOffsetY() == 0 ? AABB_OFFSET_SIDES : 0.0;
final double offsetZ = o.getFrontOffsetZ() == 0 ? AABB_OFFSET_SIDES : 0.0;
final double offsetX = o.getXOffset() == 0 ? AABB_OFFSET_SIDES : 0.0;
final double offsetY = o.getYOffset() == 0 ? AABB_OFFSET_SIDES : 0.0;
final double offsetZ = o.getZOffset() == 0 ? AABB_OFFSET_SIDES : 0.0;
// for x/z top and bottom is swapped
final double minX = Math.max(0.0, offsetX + (o.getFrontOffsetX() < 0 ? AABB_OFFSET_BOTTOM : (o.getFrontOffsetX() * AABB_OFFSET_TOP)));
final double minY = Math.max(0.0, offsetY + (o.getFrontOffsetY() < 0 ? AABB_OFFSET_TOP : (o.getFrontOffsetY() * AABB_OFFSET_BOTTOM)));
final double minZ = Math.max(0.0, offsetZ + (o.getFrontOffsetZ() < 0 ? AABB_OFFSET_BOTTOM : (o.getFrontOffsetZ() * AABB_OFFSET_TOP)));
final double minX = Math.max(0.0, offsetX + (o.getXOffset() < 0 ? AABB_OFFSET_BOTTOM : (o.getXOffset() * AABB_OFFSET_TOP)));
final double minY = Math.max(0.0, offsetY + (o.getYOffset() < 0 ? AABB_OFFSET_TOP : (o.getYOffset() * AABB_OFFSET_BOTTOM)));
final double minZ = Math.max(0.0, offsetZ + (o.getZOffset() < 0 ? AABB_OFFSET_BOTTOM : (o.getZOffset() * AABB_OFFSET_TOP)));
final double maxX = Math.min(1.0, 1.0 - offsetX - (o.getFrontOffsetX() < 0 ? AABB_OFFSET_TOP : (o.getFrontOffsetX() * AABB_OFFSET_BOTTOM)));
final double maxY = Math.min(1.0, 1.0 - offsetY - (o.getFrontOffsetY() < 0 ? AABB_OFFSET_BOTTOM : (o.getFrontOffsetY() * AABB_OFFSET_TOP)));
final double maxZ = Math.min(1.0, 1.0 - offsetZ - (o.getFrontOffsetZ() < 0 ? AABB_OFFSET_TOP : (o.getFrontOffsetZ() * AABB_OFFSET_BOTTOM)));
final double maxX = Math.min(1.0, 1.0 - offsetX - (o.getXOffset() < 0 ? AABB_OFFSET_TOP : (o.getXOffset() * AABB_OFFSET_BOTTOM)));
final double maxY = Math.min(1.0, 1.0 - offsetY - (o.getYOffset() < 0 ? AABB_OFFSET_BOTTOM : (o.getYOffset() * AABB_OFFSET_TOP)));
final double maxZ = Math.min(1.0, 1.0 - offsetZ - (o.getZOffset() < 0 ? AABB_OFFSET_TOP : (o.getZOffset() * AABB_OFFSET_BOTTOM)));
return new AxisAlignedBB(minX, minY, minZ, maxX, maxY, maxZ);
}
@@ -40,7 +40,10 @@ public enum DriveSlotState implements IStringSerializable {
TYPES_FULL("types_full"),
// Completely full
FULL("full");
FULL("full"),
// Online and completely empty
NO_CONTENTS("no_contents");
private final String name;
@@ -64,6 +67,8 @@ public enum DriveSlotState implements IStringSerializable {
return DriveSlotState.TYPES_FULL;
case 3:
return DriveSlotState.FULL;
case 4:
return DriveSlotState.NO_CONTENTS;
}
}
@@ -164,7 +164,7 @@ class BlockDefinitionBuilder implements IBlockBuilder {
// Create block and matching item, and set factory name of both
Block block = this.blockSupplier.get();
block.setRegistryName(AppEng.MOD_ID, this.registryName);
block.setUnlocalizedName("appliedenergistics2." + this.registryName);
block.setTranslationKey("appliedenergistics2." + this.registryName);
ItemBlock item = this.constructItemFromBlock(block);
if (item != null) {
@@ -25,21 +25,31 @@ import appeng.bootstrap.components.StateMapperComponent;
import appeng.bootstrap.components.TesrComponent;
import appeng.client.render.model.AutoRotatingModel;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.renderer.block.statemap.IStateMapper;
import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.client.resources.IReloadableResourceManager;
import net.minecraft.client.resources.IResourceManager;
import net.minecraft.client.resources.IResourceManagerReloadListener;
import net.minecraftforge.client.model.IModel;
import net.minecraftforge.client.resource.IResourceType;
import net.minecraftforge.client.resource.ISelectiveResourceReloadListener;
import net.minecraftforge.client.resource.VanillaResourceType;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.BiFunction;
import java.util.function.Predicate;
class BlockRendering implements IBlockRendering {
class BlockRendering implements IBlockRendering, ISelectiveResourceReloadListener {
@SideOnly(Side.CLIENT)
private BiFunction<ModelResourceLocation, IBakedModel, IBakedModel> modelCustomizer;
@@ -56,6 +66,13 @@ class BlockRendering implements IBlockRendering {
@SideOnly(Side.CLIENT)
private final Map<String, IModel> builtInModels = new HashMap<>();
@SideOnly(Side.CLIENT)
private final List<IResourceManagerReloadListener> reloads = new ArrayList<>();
BlockRendering() {
((IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager()).registerReloadListener(this);
}
@Override
@SideOnly(Side.CLIENT)
public IBlockRendering modelCustomizer(BiFunction<ModelResourceLocation, IBakedModel, IBakedModel> customizer) {
@@ -99,11 +116,15 @@ class BlockRendering implements IBlockRendering {
}
if (this.modelCustomizer != null) {
factory.addModelOverride(block.getRegistryName().getResourcePath(), this.modelCustomizer);
factory.addModelOverride(block.getRegistryName().getPath(), this.modelCustomizer);
} else if (block instanceof AEBaseTileBlock) {
// This is a default rotating model if the base-block uses an AE tile entity which exposes UP/FRONT as
// extended props
factory.addModelOverride(block.getRegistryName().getResourcePath(), (l, m) -> new AutoRotatingModel(m));
factory.addModelOverride(block.getRegistryName().getPath(), (l, m) -> {
AutoRotatingModel model = new AutoRotatingModel(m);
BlockRendering.this.reloads.add(model);
return model;
});
}
// TODO : 1.12
@@ -117,4 +138,13 @@ class BlockRendering implements IBlockRendering {
factory.addBootstrapComponent(new StateMapperComponent(block, this.stateMapper));
}
}
@Override
@SideOnly(Side.CLIENT)
public void onResourceManagerReload(IResourceManager resourceManager, Predicate<IResourceType> resourcePredicate) {
if (resourcePredicate.test(VanillaResourceType.MODELS)) {
this.reloads.forEach(listener -> listener.onResourceManagerReload(resourceManager));
}
}
}
@@ -126,7 +126,7 @@ class ItemDefinitionBuilder implements IItemBuilder {
ItemDefinition definition = new ItemDefinition(this.registryName, item);
item.setUnlocalizedName("appliedenergistics2." + this.registryName);
item.setTranslationKey("appliedenergistics2." + this.registryName);
item.setCreativeTab(this.creativeTab);
// Register all extra handlers
@@ -61,7 +61,7 @@ public class ModelOverrideComponent implements IPreInitComponent {
IModel missingModel = ModelLoaderRegistry.getMissingModel();
for (ModelResourceLocation location : keys) {
if (!location.getResourceDomain().equals(AppEng.MOD_ID)) {
if (!location.getNamespace().equals(AppEng.MOD_ID)) {
continue;
}
@@ -72,7 +72,7 @@ public class ModelOverrideComponent implements IPreInitComponent {
continue;
}
BiFunction<ModelResourceLocation, IBakedModel, IBakedModel> customizer = this.customizer.get(location.getResourcePath());
BiFunction<ModelResourceLocation, IBakedModel, IBakedModel> customizer = this.customizer.get(location.getPath());
if (customizer != null) {
IBakedModel newModel = customizer.apply(location, orgModel);
+54 -2
View File
@@ -35,6 +35,7 @@ import appeng.core.Api;
import appeng.core.AppEng;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketAssemblerAnimation;
import appeng.core.sync.packets.PacketTerminalUse;
import appeng.core.sync.packets.PacketValueConfig;
import appeng.entity.EntityFloatingItem;
import appeng.entity.EntityTinyTNTPrimed;
@@ -44,6 +45,8 @@ import appeng.helpers.HighlighterHandler;
import appeng.helpers.IMouseWheelItem;
import appeng.hooks.TickHandler;
import appeng.hooks.TickHandler.PlayerColor;
import appeng.items.tools.powered.Terminal;
import appeng.items.tools.powered.ToolWirelessTerminal;
import appeng.server.ServerHelper;
import appeng.util.Platform;
import net.minecraft.client.Minecraft;
@@ -51,6 +54,7 @@ import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Items;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumHand;
@@ -59,12 +63,19 @@ import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraftforge.client.event.*;
import net.minecraftforge.client.model.ModelLoaderRegistry;
import net.minecraftforge.client.settings.KeyConflictContext;
import net.minecraftforge.client.settings.KeyModifier;
import net.minecraftforge.common.ForgeModContainer;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.client.FMLClientHandler;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.InputEvent;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import java.io.IOException;
@@ -72,12 +83,19 @@ import java.util.ArrayList;
import java.util.EnumMap;
import java.util.List;
import java.util.Random;
import java.util.UUID;
import static appeng.client.KeyBindings.WCT;
import static appeng.client.KeyBindings.WFT;
import static appeng.client.KeyBindings.WPT;
import static appeng.client.KeyBindings.WT;
public class ClientHelper extends ServerHelper {
private final static String KEY_CATEGORY = "key.appliedenergistics2.category";
public final static String KEY_CATEGORY = "key.appliedenergistics2.category";
private final EnumMap<ActionKey, KeyBinding> bindings = new EnumMap<>(ActionKey.class);
private final List<KeyBinding> keyBindings = new ArrayList<>();
@Override
public void preinit() {
@@ -99,6 +117,11 @@ public class ClientHelper extends ServerHelper {
this.bindings.put(key, binding);
}
for (KeyBindings k : KeyBindings.values()) {
ClientRegistry.registerKeyBinding(k.getKeyBinding());
this.keyBindings.add(k.getKeyBinding());
}
Api.INSTANCE.definitions().items().encodedPattern().maybeItem().ifPresent(pattern ->
Minecraft.getMinecraft().getItemColors().registerItemColorHandler(ItemEncodedPatternBakedModel.PATTERN_ITEM_COLOR_HANDLER, pattern));
}
@@ -319,6 +342,23 @@ public class ClientHelper extends ServerHelper {
}
}
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onInputEvent(final InputEvent.KeyInputEvent event) {
for (KeyBinding k : keyBindings) {
if (k.isPressed()) {
if (k == WT.getKeyBinding()) {
NetworkHandler.instance().sendToServer(new PacketTerminalUse(Terminal.WIRELESS_TERMINAL));
} else if (k == WCT.getKeyBinding()) {
NetworkHandler.instance().sendToServer(new PacketTerminalUse(Terminal.WIRELESS_CRAFTING_TERMINAL));
} else if (k == WPT.getKeyBinding()) {
NetworkHandler.instance().sendToServer(new PacketTerminalUse(Terminal.WIRELESS_PATTERN_TERMINAL));
} else if (k == WFT.getKeyBinding()) {
NetworkHandler.instance().sendToServer(new PacketTerminalUse(Terminal.WIRELESS_FLUID_TERMINAL));
}
}
}
}
@SubscribeEvent
public void onTextureStitch(final TextureStitchEvent.Pre event) {
ParticleTextures.registerSprite(event);
@@ -334,4 +374,16 @@ public class ClientHelper extends ServerHelper {
public boolean isActionKey(ActionKey key, int pressedKeyCode) {
return this.bindings.get(key).isActiveAndMatches(pressedKeyCode);
}
}
@Override
public EntityPlayer getPlayerByUUID(UUID uuid) {
if (Platform.isClient()) {
if (Minecraft.getMinecraft().player.getUniqueID().equals(uuid)) {
return Minecraft.getMinecraft().player;
}
return null;
} else {
return super.getPlayerByUUID(uuid);
}
}
}
@@ -0,0 +1,28 @@
package appeng.client;
import net.minecraft.client.settings.KeyBinding;
import net.minecraftforge.client.settings.KeyConflictContext;
import net.minecraftforge.client.settings.KeyModifier;
import org.lwjgl.input.Keyboard;
import static appeng.client.ClientHelper.KEY_CATEGORY;
public enum KeyBindings {
WT(new KeyBinding("key.open_wireless_terminal.desc", KeyConflictContext.UNIVERSAL, KeyModifier.SHIFT, Keyboard.KEY_T, KEY_CATEGORY)),
WCT(new KeyBinding("key.open_wireless_crafting_terminal.desc", KeyConflictContext.UNIVERSAL, KeyModifier.SHIFT, Keyboard.KEY_E, KEY_CATEGORY)),
WPT(new KeyBinding("key.open_wireless_pattern_terminal.desc", KeyConflictContext.UNIVERSAL, KeyModifier.SHIFT, Keyboard.KEY_R, KEY_CATEGORY)),
WFT(new KeyBinding("key.open_wireless_fluid_terminal.desc", KeyConflictContext.UNIVERSAL, KeyModifier.SHIFT, Keyboard.KEY_F, KEY_CATEGORY));
private KeyBinding keyBinding;
KeyBindings(KeyBinding keyBinding) {
this.keyBinding = keyBinding;
}
;
public KeyBinding getKeyBinding() {
return keyBinding;
}
}
+80 -10
View File
@@ -49,6 +49,7 @@ import mezz.jei.api.gui.IGhostIngredientHandler;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.GlStateManager;
@@ -68,13 +69,11 @@ import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidUtil;
import net.minecraftforge.fml.common.Optional;
import net.minecraftforge.items.SlotItemHandler;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import yalter.mousetweaks.api.IMTModGuiContainer2;
import javax.annotation.Nonnull;
import java.awt.*;
import java.io.IOException;
import java.text.DecimalFormat;
@@ -86,7 +85,6 @@ import java.util.concurrent.TimeUnit;
import static appeng.integration.modules.jei.JEIPlugin.aeGuiHandler;
import static appeng.integration.modules.jei.JEIPlugin.runtime;
@Optional.Interface(iface = "yalter.mousetweaks.api.IMTModGuiContainer2", modid = "mousetweaks")
public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContainer2 {
private final List<InternalSlotME> meSlots = new ArrayList<>();
@@ -259,7 +257,7 @@ public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContain
}
}
private void drawTooltip(ITooltip tooltip, int mouseX, int mouseY) {
protected void drawTooltip(ITooltip tooltip, int mouseX, int mouseY) {
final int x = tooltip.xPos(); // ((GuiImgButton) c).x;
int y = tooltip.yPos(); // ((GuiImgButton) c).y;
@@ -568,7 +566,10 @@ public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContain
action = (mouseButton == 1) ? InventoryAction.SPLIT_OR_PLACE_SINGLE : InventoryAction.PICKUP_OR_SET_DOWN;
stack = ((SlotME) slot).getAEStack();
if (stack != null && action == InventoryAction.PICKUP_OR_SET_DOWN && stack.getStackSize() == 0 && player.inventory.getItemStack().isEmpty()) {
if (stack != null
&& action == InventoryAction.PICKUP_OR_SET_DOWN
&& (stack.getStackSize() == 0 || GuiScreen.isAltKeyDown())
&& player.inventory.getItemStack().isEmpty()) {
action = InventoryAction.AUTO_CRAFT;
}
@@ -931,6 +932,10 @@ public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContain
}
} else if (s instanceof AppEngSlot) {
AppEngSlot appEngSlot = ((AppEngSlot) s);
if (s.getStack().isEmpty()) {
super.drawSlot(s);
return;
}
appEngSlot.setDisplay(true);
appEngSlot.setReturnAsSingleStack(true);
@@ -944,10 +949,42 @@ public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContain
this.zLevel = 0.0F;
this.itemRender.zLevel = 0.0F;
boolean wasDragSplitting = this.dragSplitting;
this.dragSplitting = false; // to prevent the vanilla slot renderer from rendering the stack count during drag splitting, we're re-enabling it later
// Annoying but easier than trying to splice into render item
super.drawSlot(s);
this.stackSizeRenderer.renderStackSize(this.fontRenderer, AEItemStack.fromItemStack(appEngSlot.getDisplayStack()), s.xPos, s.yPos);
ItemStack stackInSlot = ((AppEngSlot)s).getDisplayStack();
ItemStack stackUnderCursor = this.mc.player.inventory.getItemStack();
if (wasDragSplitting
&& this.dragSplittingSlots.contains(s)
&& this.dragSplittingSlots.size() > 1
&& !stackUnderCursor.isEmpty()) {
if (Container.canAddItemToSlot(s, stackUnderCursor, true) && this.inventorySlots.canDragIntoSlot(s))
{
drawRect(s.xPos, s.yPos, s.xPos + 16, s.yPos + 16, -2130706433);
stackInSlot = stackUnderCursor.copy();
Container.computeStackSize(this.dragSplittingSlots, this.dragSplittingLimit, stackInSlot, s.getStack().isEmpty() ? 0 : s.getStack().getCount());
int k = Math.min(stackInSlot.getMaxStackSize(), s.getItemStackLimit(stackInSlot));
if (stackInSlot.getCount() > k)
{
stackInSlot.setCount(k);
}
}
else
{
this.dragSplittingSlots.remove(s);
this.updateDragSplitting();
}
}
this.dragSplitting = wasDragSplitting;
this.stackSizeRenderer.renderStackSize(this.fontRenderer, AEItemStack.fromItemStack(stackInSlot), s.xPos, s.yPos);
return;
} else {
super.drawSlot(s);
@@ -983,10 +1020,44 @@ public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContain
return this.meSlots;
}
// TODO: remove this when refactoring slot rendering
private void updateDragSplitting()
{
ItemStack itemstack = this.mc.player.inventory.getItemStack();
if (!itemstack.isEmpty() && this.dragSplitting)
{
if (this.dragSplittingLimit == 2)
{
this.dragSplittingRemnant = itemstack.getMaxStackSize();
}
else
{
this.dragSplittingRemnant = itemstack.getCount();
for (Slot slot : this.dragSplittingSlots)
{
ItemStack itemstack1 = itemstack.copy();
ItemStack itemstack2 = slot.getStack();
int i = itemstack2.isEmpty() ? 0 : itemstack2.getCount();
Container.computeStackSize(this.dragSplittingSlots, this.dragSplittingLimit, itemstack1, i);
int j = Math.min(itemstack1.getMaxStackSize(), slot.getItemStackLimit(itemstack1));
if (itemstack1.getCount() > j)
{
itemstack1.setCount(j);
}
this.dragSplittingRemnant -= itemstack1.getCount() - i;
}
}
}
}
@Override
@Optional.Method(modid = "mousetweaks")
public boolean MT_isMouseTweaksDisabled() {
return false;
return true;
}
@Override
@@ -1016,13 +1087,12 @@ public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContain
@Override
@Optional.Method(modid = "mousetweaks")
public boolean MT_isIgnored(Slot slot) {
return false;
return true;
}
@Override
@Optional.Method(modid = "mousetweaks")
public boolean MT_disableRMBDraggingFunctionality() {
return false;
return true;
}
}
@@ -76,6 +76,11 @@ public abstract class AEBaseMEGui extends AEBaseGui {
currentToolTip.add(format);
}
if (myStack.isCraftable() && AEConfig.instance().isShowCraftableTooltip()) {
final String local = ButtonToolTips.ItemsCraftable.getLocal();
currentToolTip.add(TextFormatting.GRAY + local);
}
this.drawHoveringText(currentToolTip, x, y, this.fontRenderer);
return;
@@ -1,10 +1,14 @@
package appeng.client.gui;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.gui.implementations.*;
import appeng.client.gui.implementations.GuiCraftAmount;
import appeng.client.gui.implementations.GuiCraftConfirm;
import appeng.client.gui.implementations.GuiCraftingCPU;
import appeng.client.gui.implementations.GuiExpandedProcessingPatternTerm;
import appeng.client.gui.implementations.GuiPatternTerm;
import appeng.client.gui.implementations.GuiUpgradeable;
import appeng.container.interfaces.IJEIGhostIngredients;
import appeng.container.slot.SlotFake;
import appeng.fluids.client.gui.widgets.GuiFluidSlot;
import appeng.container.slot.IJEITargetSlot;
import mezz.jei.api.gui.IAdvancedGuiHandler;
import mezz.jei.api.gui.IGhostIngredientHandler;
import net.minecraft.client.gui.GuiScreen;
@@ -78,12 +82,12 @@ public class AEGuiHandler implements IAdvancedGuiHandler<AEBaseGui>, IGhostIngre
return (guiSloty * 3) + guiSlotx + (currentScroll * 3);
}
@SuppressWarnings("unchecked")
@Override
@Nonnull
public <I> List<Target<I>> getTargets(@Nonnull AEBaseGui gui, @Nonnull I ingredient, boolean doStart) {
ArrayList<Target<I>> targets = new ArrayList<>();
if (gui instanceof IJEIGhostIngredients) {
IJEIGhostIngredients g = (IJEIGhostIngredients) gui;
if (gui instanceof IJEIGhostIngredients g) {
List<Target<?>> phantomTargets = g.getPhantomTargets(ingredient);
targets.addAll((List<Target<I>>) (Object) phantomTargets);
}
@@ -91,13 +95,8 @@ public class AEGuiHandler implements IAdvancedGuiHandler<AEBaseGui>, IGhostIngre
if (gui instanceof GuiUpgradeable || gui instanceof GuiPatternTerm || gui instanceof GuiExpandedProcessingPatternTerm) {
IJEIGhostIngredients ghostGui = ((IJEIGhostIngredients) gui);
for (Target<I> target : targets) {
if (ghostGui.getFakeSlotTargetMap().get(target) instanceof SlotFake) {
if (((SlotFake) ghostGui.getFakeSlotTargetMap().get(target)).getStack().isEmpty()) {
target.accept(ingredient);
break;
}
} else if (ghostGui.getFakeSlotTargetMap().get(target) instanceof GuiFluidSlot) {
if (((GuiFluidSlot) ghostGui.getFakeSlotTargetMap().get(target)).getFluidStack() == null) {
if (ghostGui.getFakeSlotTargetMap().get(target) instanceof IJEITargetSlot jeiSlot) {
if (jeiSlot.needAccept()) {
target.accept(ingredient);
break;
}
@@ -0,0 +1,208 @@
package appeng.client.gui;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Collections;
import java.util.Stack;
public class MathExpressionParser {
private final Stack<String> postfixStack = new Stack<>();
private final Stack<Character> opStack = new Stack<>();
private static final int[] OPERATOR_PRIORITY = new int[] { 0, 3, 2, 1, -1, 1, 0, 2 };
public static double parse(String expression) {
double result;
if (expression == null) return Double.NaN;
expression = expression.replace(" ", "");
if (expression.length() == 1 && Character.isDigit(expression.charAt(0))) {
return expression.charAt(0) - '0';
}
try {
expression = transform(expression);
result = new MathExpressionParser().calculate(expression);
} catch (Exception e) {
return Double.NaN;
}
return result;
}
/**
* replace '-' with '~'
* e.g.-2+-1*(-3E-2)-(-1) -> ~2+~1*(~3E~2)-(~1)
*/
private static String transform(String expression) {
char[] arr = expression.toCharArray();
for (int i = 0; i < arr.length; i++) {
if (arr[i] == '-') {
if (i == 0) {
arr[i] = '~';
} else {
char c = arr[i - 1];
if (c == '+' || c == '-' || c == '*' || c == '/' || c == '(' || c == 'E' || c == 'e') {
arr[i] = '~';
}
}
}
}
if (arr[0] == '~' || arr[1] == '(') {
arr[0] = '-';
return "0" + new String(arr);
} else {
return new String(arr);
}
}
public double calculate(String expression) {
Stack<String> resultStack = new Stack<>();
prepare(expression);
Collections.reverse(postfixStack);
String firstValue, secondValue, currentValue;
while (!postfixStack.isEmpty()) {
currentValue = postfixStack.pop();
if (!isOperator(currentValue.charAt(0))) {
currentValue = currentValue.replace("~", "-");
resultStack.push(currentValue);
} else {
secondValue = resultStack.pop();
firstValue = resultStack.pop();
firstValue = firstValue.replace("~", "-");
secondValue = secondValue.replace("~", "-");
String tempResult = calculate(firstValue, secondValue, currentValue.charAt(0));
resultStack.push(String.valueOf(tempResult));
}
}
return Double.parseDouble(resultStack.pop());
}
private void prepare(String expression) {
opStack.push(',');
char[] arr = expression.toCharArray();
int currentIndex = 0;
int count = 0;
char currentOp, peekOp;
for (int i = 0; i < arr.length; i++) {
currentOp = arr[i];
if (isOperator(currentOp)) {
if (count > 0) {
postfixStack.push(new String(arr, currentIndex, count));
}
peekOp = opStack.peek();
if (currentOp == ')') {
while (opStack.peek() != '(') {
postfixStack.push(String.valueOf(opStack.pop()));
}
opStack.pop();
} else {
while (currentOp != '(' && peekOp != ',' && compare(currentOp, peekOp)) {
postfixStack.push(String.valueOf(opStack.pop()));
peekOp = opStack.peek();
}
opStack.push(currentOp);
}
count = 0;
currentIndex = i + 1;
} else {
count++;
}
}
if (count > 1 || (count == 1 && !isOperator(arr[currentIndex]))) {
postfixStack.push(new String(arr, currentIndex, count));
}
while (opStack.peek() != ',') {
postfixStack.push(String.valueOf(opStack.pop()));
}
}
private static boolean isOperator(char c) {
return c == '+' || c == '-' || c == '*' || c == '/' || c == '(' || c == ')';
}
private static boolean compare(char cur, char peek) {
return OPERATOR_PRIORITY[(peek) - 40] >= OPERATOR_PRIORITY[(cur) - 40];
}
private String calculate(String firstValue, String secondValue, char currentOp) {
return switch (currentOp) {
case '+' -> add(firstValue, secondValue);
case '-' -> sub(firstValue, secondValue);
case '*' -> mul(firstValue, secondValue);
case '/' -> div(firstValue, secondValue);
default -> "";
};
}
public static String add(String v1, String v2) {
BigDecimal b1 = new BigDecimal(v1);
BigDecimal b2 = new BigDecimal(v2);
return String.valueOf(b1.add(b2));
}
/**
* subtraction
*
* @param v1 p1
* @param v2 p2
* @return sub
*/
public static String sub(String v1, String v2) {
BigDecimal b1 = new BigDecimal(v1);
BigDecimal b2 = new BigDecimal(v2);
return String.valueOf(b1.subtract(b2));
}
/**
* multiplication
*
* @param v1 p1
* @param v2 p2
* @return mul
*/
public static String mul(String v1, String v2) {
BigDecimal b1 = new BigDecimal(v1);
BigDecimal b2 = new BigDecimal(v2);
return String.valueOf(b1.multiply(b2));
}
/**
* division. e = 10^-10
*
* @param v1 p1
* @param v2 p2
* @return div
*/
public static String div(String v1, String v2) {
BigDecimal b1 = new BigDecimal(v1);
BigDecimal b2 = new BigDecimal(v2);
return String.valueOf(b1.divide(b2, 16, RoundingMode.HALF_UP));
}
/**
* rounding
*
* @param v p
* @param scale scale
* @return result
*/
public static double round(double v, int scale) {
if (scale < 0) {
throw new IllegalArgumentException("The scale must be a positive integer or zero");
}
BigDecimal b = new BigDecimal(Double.toString(v));
return b.divide(BigDecimal.ONE, scale, RoundingMode.HALF_UP).doubleValue();
}
public static String round(String v, int scale) {
if (scale < 0) {
throw new IllegalArgumentException("The scale must be a positive integer or zero");
}
BigDecimal b = new BigDecimal(v);
return String.valueOf(b.divide(BigDecimal.ONE, scale, RoundingMode.HALF_UP));
}
}
@@ -24,7 +24,7 @@ import appeng.api.definitions.IDefinitions;
import appeng.api.definitions.IParts;
import appeng.api.storage.ITerminalHost;
import appeng.client.gui.AEBaseGui;
import appeng.client.gui.widgets.GuiNumberBox;
import appeng.client.gui.MathExpressionParser;
import appeng.client.gui.widgets.GuiTabButton;
import appeng.container.AEBaseContainer;
import appeng.container.implementations.ContainerCraftAmount;
@@ -41,6 +41,7 @@ import appeng.parts.reporting.PartExpandedProcessingPatternTerminal;
import appeng.parts.reporting.PartPatternTerminal;
import appeng.parts.reporting.PartTerminal;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import org.lwjgl.input.Keyboard;
@@ -49,7 +50,7 @@ import java.io.IOException;
public class GuiCraftAmount extends AEBaseGui {
private GuiNumberBox amountToCraft;
private GuiTextField amountToCraft;
private GuiTabButton originalGuiBtn;
private GuiButton next;
@@ -97,9 +98,8 @@ public class GuiCraftAmount extends AEBaseGui {
final IParts parts = definitions.parts();
if (target instanceof WirelessTerminalGuiObject) {
myIcon = definitions.items().wirelessTerminal().maybeStack(1).orElse(myIcon);
this.originalGui = GuiBridge.GUI_WIRELESS_TERM;
myIcon = ((WirelessTerminalGuiObject) target).getItemStack();
this.originalGui = (GuiBridge) AEApi.instance().registries().wireless().getWirelessTerminalHandler(myIcon).getGuiHandler(myIcon);
}
if (target instanceof PartTerminal) {
@@ -126,7 +126,7 @@ public class GuiCraftAmount extends AEBaseGui {
this.buttonList.add(this.originalGuiBtn = new GuiTabButton(this.guiLeft + 154, this.guiTop, myIcon, myIcon.getDisplayName(), this.itemRender));
}
this.amountToCraft = new GuiNumberBox(this.fontRenderer, this.guiLeft + 62, this.guiTop + 57, 59, this.fontRenderer.FONT_HEIGHT, Integer.class);
this.amountToCraft = new GuiTextField(0, this.fontRenderer, this.guiLeft + 62, this.guiTop + 57, 59, this.fontRenderer.FONT_HEIGHT);
this.amountToCraft.setEnableBackgroundDrawing(false);
this.amountToCraft.setMaxStringLength(16);
this.amountToCraft.setTextColor(0xFFFFFF);
@@ -149,8 +149,17 @@ public class GuiCraftAmount extends AEBaseGui {
this.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize);
try {
long amt = Long.parseLong(this.amountToCraft.getText());
this.next.enabled = (!this.amountToCraft.getText().isEmpty() && amt > 0);
String out = this.amountToCraft.getText();
double resultD = MathExpressionParser.parse(out);
long amt;
if (resultD <= 0 || Double.isNaN(resultD)) {
amt = 0;
} else {
amt = (long) MathExpressionParser.round(resultD, 0);
}
this.next.enabled = amt > 0;
} catch (final NumberFormatException e) {
this.next.enabled = false;
}
@@ -164,33 +173,7 @@ public class GuiCraftAmount extends AEBaseGui {
if (key == Keyboard.KEY_RETURN || key == Keyboard.KEY_NUMPADENTER) {
this.actionPerformed(this.next);
}
if ((key == 211 || key == 205 || key == 203 || key == 14 || character == '-' || Character.isDigit(character)) && this.amountToCraft
.textboxKeyTyped(character, key)) {
try {
String out = this.amountToCraft.getText();
boolean fixed = false;
while (out.startsWith("0") && out.length() > 1) {
out = out.substring(1);
fixed = true;
}
if (fixed) {
this.amountToCraft.setText(out);
}
if (out.isEmpty()) {
out = "0";
}
final long result = Long.parseLong(out);
if (result < 0) {
this.amountToCraft.setText("1");
}
} catch (final NumberFormatException e) {
// :P
}
} else {
if (!this.amountToCraft.textboxKeyTyped(character, key)) {
super.keyTyped(character, key);
}
}
@@ -207,7 +190,15 @@ public class GuiCraftAmount extends AEBaseGui {
}
if (btn == this.next) {
NetworkHandler.instance().sendToServer(new PacketCraftRequest(Integer.parseInt(this.amountToCraft.getText()), isShiftKeyDown()));
double resultD = MathExpressionParser.parse(this.amountToCraft.getText());
int result;
if (resultD <= 0 || Double.isNaN(resultD)) {
result = 1;
} else {
result = (int) MathExpressionParser.round(resultD, 0);
}
NetworkHandler.instance().sendToServer(new PacketCraftRequest(result, isShiftKeyDown()));
}
} catch (final NumberFormatException e) {
// nope..
@@ -226,22 +217,15 @@ public class GuiCraftAmount extends AEBaseGui {
try {
String out = this.amountToCraft.getText();
boolean fixed = false;
while (out.startsWith("0") && out.length() > 1) {
out = out.substring(1);
fixed = true;
}
double resultD = MathExpressionParser.parse(out);
int result;
if (fixed) {
this.amountToCraft.setText(out);
if (resultD <= 0 || Double.isNaN(resultD)) {
result = 0;
} else {
result = (int) MathExpressionParser.round(resultD, 0);
}
if (out.isEmpty()) {
out = "0";
}
long result = Integer.parseInt(out);
if (result == 1 && i > 1) {
result = 0;
}
@@ -251,8 +235,7 @@ public class GuiCraftAmount extends AEBaseGui {
result = 1;
}
out = Long.toString(result);
Integer.parseInt(out);
out = Integer.toString(result);
this.amountToCraft.setText(out);
} catch (final NumberFormatException e) {
// :P
@@ -20,6 +20,7 @@ package appeng.client.gui.implementations;
import appeng.api.AEApi;
import appeng.api.features.IWirelessTermHandler;
import appeng.api.storage.ITerminalHost;
import appeng.api.storage.channels.IItemStorageChannel;
import appeng.api.storage.data.IAEItemStack;
@@ -84,7 +85,8 @@ public class GuiCraftConfirm extends AEBaseGui {
this.ccc.setGui(this);
if (te instanceof WirelessTerminalGuiObject) {
this.OriginalGui = GuiBridge.GUI_WIRELESS_TERM;
ItemStack itemStack = ((WirelessTerminalGuiObject) te).getItemStack();
this.OriginalGui = (GuiBridge) AEApi.instance().registries().wireless().getWirelessTerminalHandler(itemStack).getGuiHandler(itemStack);
}
if (te instanceof PartTerminal) {
@@ -26,6 +26,7 @@ package appeng.client.gui.implementations;
import appeng.api.AEApi;
import appeng.api.definitions.IDefinitions;
import appeng.api.definitions.IParts;
import appeng.api.features.IWirelessTermHandler;
import appeng.api.storage.ITerminalHost;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.gui.widgets.GuiScrollbar;
@@ -33,6 +34,7 @@ import appeng.client.gui.widgets.GuiTabButton;
import appeng.container.implementations.ContainerCraftingStatus;
import appeng.container.implementations.CraftingCPUStatus;
import appeng.core.AELog;
import appeng.core.features.registries.WirelessRegistry;
import appeng.core.localization.GuiText;
import appeng.core.sync.GuiBridge;
import appeng.core.sync.network.NetworkHandler;
@@ -84,9 +86,8 @@ public class GuiCraftingStatus extends GuiCraftingCPU {
final IParts parts = definitions.parts();
if (target instanceof WirelessTerminalGuiObject) {
this.myIcon = definitions.items().wirelessTerminal().maybeStack(1).orElse(ItemStack.EMPTY);
this.originalGui = GuiBridge.GUI_WIRELESS_TERM;
myIcon = ((WirelessTerminalGuiObject) target).getItemStack();
this.originalGui = (GuiBridge) AEApi.instance().registries().wireless().getWirelessTerminalHandler(myIcon).getGuiHandler(myIcon);
}
if (target instanceof PartTerminal) {
@@ -82,8 +82,4 @@ public class GuiCraftingTerm extends GuiMEMonitorable {
protected String getBackground() {
return "guis/crafting.png";
}
public ItemRepo getRepo() {
return this.repo;
}
}
@@ -394,7 +394,7 @@ public class GuiFluidInterfaceConfigurationTerminal extends AEBaseGui implements
return false;
}
boolean foundMatchingItemStack = false;
boolean foundMatchingFluidStack = false;
final String displayName = Platform.getFluidDisplayName(iaeFluidStack).toLowerCase();
@@ -405,10 +405,12 @@ public class GuiFluidInterfaceConfigurationTerminal extends AEBaseGui implements
return false;
}
} else if (displayName.contains(term)) {
foundMatchingItemStack = true;
foundMatchingFluidStack = true;
} else {
return false;
}
}
return foundMatchingItemStack;
return foundMatchingFluidStack;
}
/**
@@ -19,6 +19,7 @@
package appeng.client.gui.implementations;
import appeng.api.config.LockCraftingMode;
import appeng.api.config.Settings;
import appeng.api.config.YesNo;
import appeng.client.gui.widgets.GuiImgButton;
@@ -41,6 +42,7 @@ import java.io.IOException;
public class GuiInterface extends GuiUpgradeable {
private GuiTabButton priority;
private GuiImgButton UnlockMode;
private GuiImgButton BlockMode;
private GuiToggleButton interfaceMode;
@@ -57,7 +59,10 @@ public class GuiInterface extends GuiUpgradeable {
this.BlockMode = new GuiImgButton(this.guiLeft - 18, this.guiTop + 8, Settings.BLOCK, YesNo.NO);
this.buttonList.add(this.BlockMode);
this.interfaceMode = new GuiToggleButton(this.guiLeft - 18, this.guiTop + 26, 84, 85, GuiText.InterfaceTerminal.getLocal(), GuiText.InterfaceTerminalHint.getLocal());
this.UnlockMode = new GuiImgButton(this.guiLeft - 18,this.guiTop + 26 ,Settings.UNLOCK, LockCraftingMode.NONE);
this.buttonList.add(this.UnlockMode);
this.interfaceMode = new GuiToggleButton(this.guiLeft - 18, this.guiTop + 44, 84, 85, GuiText.InterfaceTerminal.getLocal(), GuiText.InterfaceTerminalHint.getLocal());
this.buttonList.add(this.interfaceMode);
}
@@ -67,6 +72,10 @@ public class GuiInterface extends GuiUpgradeable {
this.BlockMode.set(((ContainerInterface) this.cvb).getBlockingMode());
}
if (this.UnlockMode != null) {
this.UnlockMode.set(((ContainerInterface) this.cvb).getUnlockMode());
}
if (this.interfaceMode != null) {
this.interfaceMode.setState(((ContainerInterface) this.cvb).getInterfaceTerminalMode() == YesNo.YES);
}
@@ -106,6 +115,10 @@ public class GuiInterface extends GuiUpgradeable {
if (btn == this.BlockMode) {
NetworkHandler.instance().sendToServer(new PacketConfigButton(this.BlockMode.getSetting(), backwards));
}
if (btn == this.UnlockMode) {
NetworkHandler.instance.sendToServer(new PacketConfigButton(this.UnlockMode.getSetting(), backwards));
}
}
}
@@ -61,6 +61,7 @@ import java.util.List;
import java.util.*;
import static appeng.client.render.BlockPosHighlighter.hilightBlock;
import static appeng.helpers.ItemStackHelper.stackFromNBT;
public class GuiInterfaceConfigurationTerminal extends AEBaseGui implements IJEIGhostIngredients {
@@ -299,11 +300,7 @@ public class GuiInterfaceConfigurationTerminal extends AEBaseGui implements IJEI
for (int x = 0; x < current.getInventory().getSlots(); x++) {
final String which = Integer.toString(x);
if (invData.hasKey(which)) {
NBTTagCompound tag = invData.getCompoundTag(which);
current.getInventory().setStackInSlot(x, new ItemStack(tag));
if (tag.hasKey("stackSize")) {
current.getInventory().getStackInSlot(x).setCount(tag.getInteger("stackSize"));
}
current.getInventory().setStackInSlot(x, stackFromNBT(invData.getCompoundTag(which)));
}
}
} catch (final NumberFormatException ignored) {
@@ -412,6 +409,8 @@ public class GuiInterfaceConfigurationTerminal extends AEBaseGui implements IJEI
}
} else if (displayName.contains(term)) {
foundMatchingItemStack = true;
} else {
return false;
}
}
return foundMatchingItemStack;
@@ -22,16 +22,23 @@ package appeng.client.gui.implementations;
import appeng.api.AEApi;
import appeng.api.config.ActionItems;
import appeng.api.config.Settings;
import appeng.api.config.TerminalStyle;
import appeng.api.storage.channels.IItemStorageChannel;
import appeng.client.gui.AEBaseGui;
import appeng.client.gui.widgets.GuiImgButton;
import appeng.client.gui.widgets.GuiScrollbar;
import appeng.client.gui.widgets.MEGuiTextField;
import appeng.client.gui.widgets.MEGuiTooltipTextField;
import appeng.client.me.ClientDCInternalInv;
import appeng.client.me.SlotDisconnected;
import appeng.container.implementations.ContainerInterfaceTerminal;
import appeng.container.slot.AppEngSlot;
import appeng.core.AEConfig;
import appeng.core.AppEng;
import appeng.core.localization.ButtonToolTips;
import appeng.core.localization.GuiText;
import appeng.core.localization.PlayerMessages;
import appeng.helpers.DualityInterface;
import appeng.helpers.PatternHelper;
import appeng.parts.reporting.PartInterfaceTerminal;
import appeng.util.BlockPosUtils;
import appeng.util.Platform;
@@ -44,22 +51,35 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.NBTUtil;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.world.World;
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.common.util.Constants;
import net.minecraftforge.fml.common.Loader;
import org.lwjgl.input.Mouse;
import java.awt.*;
import java.io.IOException;
import java.util.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.WeakHashMap;
import static appeng.client.render.BlockPosHighlighter.hilightBlock;
import static appeng.helpers.ItemStackHelper.stackFromNBT;
public class GuiInterfaceTerminal extends AEBaseGui {
private static final int LINES_ON_PAGE = 6;
private static final int OFFSET_X = 21;
private static final int MAGIC_HEIGHT_NUMBER = 52 + 99;
private static final String MOLECULAR_ASSEMBLER = "molecular assembler";
// TODO: copied from GuiMEMonitorable. It looks not changed, maybe unneeded?
private final int offsetX = 21;
private final boolean jeiEnabled;
private final int jeiButtonPadding;
private final HashMap<Long, ClientDCInternalInv> byId = new HashMap<>();
private final HashMultimap<String, ClientDCInternalInv> byName = HashMultimap.create();
@@ -69,139 +89,215 @@ public class GuiInterfaceTerminal extends AEBaseGui {
private final ArrayList<String> names = new ArrayList<>();
private final ArrayList<Object> lines = new ArrayList<>();
private final Set<Object> matchedStacks = new HashSet<>();
private final Set<ClientDCInternalInv> matchedInterfaces = new HashSet<>();
private final Map<String, Set<Object>> cachedSearches = new WeakHashMap<>();
private final Map<ClientDCInternalInv, Integer> dimHashMap = new HashMap<>();
private final MEGuiTooltipTextField searchFieldOutputs;
private final MEGuiTooltipTextField searchFieldInputs;
private final MEGuiTooltipTextField searchFieldNames;
private final GuiImgButton guiButtonHideFull;
private final GuiImgButton guiButtonAssemblersOnly;
private final GuiImgButton guiButtonBrokenRecipes;
private final GuiImgButton terminalStyleBox;
private boolean refreshList = false;
private MEGuiTextField searchFieldOutputs;
private MEGuiTextField searchFieldInputs;
private final PartInterfaceTerminal partInterfaceTerminal;
private GuiButton guiButtonHide;
private GuiButton guiButtonNextAssembler;
private final HashMap<ClientDCInternalInv, Integer> dimHashMap = new HashMap<>();
/* These are worded so that the intended default is false */
private boolean onlyShowWithSpace = false;
private boolean onlyMolecularAssemblers = false;
private boolean onlyBrokenRecipes = false;
private int rows = 6;
public GuiInterfaceTerminal(final InventoryPlayer inventoryPlayer, final PartInterfaceTerminal te) {
super(new ContainerInterfaceTerminal(inventoryPlayer, te));
this.partInterfaceTerminal = te;
final GuiScrollbar scrollbar = new GuiScrollbar();
this.setScrollBar(scrollbar);
this.xSize = 208;
this.ySize = 255;
this.jeiEnabled = Loader.isModLoaded("jei");
this.jeiButtonPadding = jeiEnabled ? 22 : 0;
searchFieldInputs = createTextField(86, 12, ButtonToolTips.SearchFieldInputs.getLocal());
searchFieldOutputs = createTextField(86, 12, ButtonToolTips.SearchFieldOutputs.getLocal());
searchFieldNames = createTextField(71, 12, ButtonToolTips.SearchFieldNames.getLocal());
searchFieldNames.setFocused(true);
guiButtonAssemblersOnly = new GuiImgButton(0, 0, Settings.ACTIONS, null);
guiButtonHideFull = new GuiImgButton(0, 0, Settings.ACTIONS, null);
guiButtonBrokenRecipes = new GuiImgButton(0, 0, Settings.ACTIONS, null);
terminalStyleBox = new GuiImgButton(0, 0, Settings.TERMINAL_STYLE, null);
}
private MEGuiTooltipTextField createTextField(final int width, final int height, final String tooltip) {
MEGuiTooltipTextField textField = new MEGuiTooltipTextField(width, height, tooltip) {
@Override
public void onTextChange(String oldText) {
refreshList();
}
};
textField.setEnableBackgroundDrawing(false);
textField.setMaxStringLength(25);
textField.setTextColor(0xFFFFFF);
textField.setCursorPositionZero();
return textField;
}
private void setScrollBar() {
this.getScrollBar().setTop(52).setLeft(189).setHeight(this.rows * 18 - 2);
this.getScrollBar().setRange(0, this.lines.size() - 1, 1);
}
private int calculateRowsCount() {
final int maxRows = getMaxRows();
final int jeiPadding = jeiEnabled ? 22 + 18 : 0;
final int extraSpace = this.height - MAGIC_HEIGHT_NUMBER - jeiPadding;
return Math.max(6, Math.min(maxRows, extraSpace / 18));
}
@Override
public void initGui() {
this.rows = calculateRowsCount();
super.initGui();
this.getScrollBar().setLeft(189);
this.getScrollBar().setHeight(106);
this.getScrollBar().setTop(51);
this.ySize = MAGIC_HEIGHT_NUMBER + this.rows * 18;
final int unusedSpace = this.height - this.ySize;
this.guiTop = (int) Math.floor(unusedSpace / (unusedSpace < 0 ? 3.8f : 2.0f));
this.searchFieldInputs = new MEGuiTextField(this.fontRenderer, this.guiLeft + Math.max(32, this.offsetX), this.guiTop + 25, 65, 12);
this.searchFieldInputs.setEnableBackgroundDrawing(false);
this.searchFieldInputs.setMaxStringLength(25);
this.searchFieldInputs.setTextColor(0xFFFFFF);
this.searchFieldInputs.setVisible(true);
this.searchFieldInputs.setFocused(false);
searchFieldInputs.x = guiLeft + 32;
searchFieldInputs.y = guiTop + 25;
searchFieldOutputs.x = guiLeft + 32;
searchFieldOutputs.y = guiTop + 38;
searchFieldNames.x = guiLeft + 32 + 99;
searchFieldNames.y = guiTop + 38;
this.searchFieldOutputs = new MEGuiTextField(this.fontRenderer, this.guiLeft + Math.max(32, this.offsetX), this.guiTop + 38, 65, 12);
this.searchFieldOutputs.setEnableBackgroundDrawing(false);
this.searchFieldOutputs.setMaxStringLength(25);
this.searchFieldOutputs.setTextColor(0xFFFFFF);
this.searchFieldOutputs.setVisible(true);
this.searchFieldOutputs.setFocused(true);
terminalStyleBox.x = guiLeft - 18;
terminalStyleBox.y = guiTop + 8 + jeiButtonPadding;
guiButtonBrokenRecipes.x = guiLeft - 18;
guiButtonBrokenRecipes.y = terminalStyleBox.y + 20;
guiButtonHideFull.x = guiLeft - 18;
guiButtonHideFull.y = guiButtonBrokenRecipes.y + 20;
guiButtonAssemblersOnly.x = guiLeft - 18;
guiButtonAssemblersOnly.y = guiButtonHideFull.y + 20;
this.searchFieldInputs.setText(partInterfaceTerminal.in);
this.searchFieldOutputs.setText(partInterfaceTerminal.out);
this.setScrollBar();
this.repositionSlots();
}
protected void repositionSlots() {
for (final Object obj : this.inventorySlots.inventorySlots) {
if (obj instanceof AppEngSlot slot) {
slot.yPos = this.ySize + slot.getY() - 78 - 7;
slot.xPos = slot.getX() + 14;
}
}
}
@Override
public void onGuiClosed() {
partInterfaceTerminal.saveSearchStrings(this.searchFieldInputs.getText().toLowerCase(), this.searchFieldOutputs.getText().toLowerCase());
super.onGuiClosed();
public List<Rectangle> getJEIExclusionArea() {
Rectangle tallButton = new Rectangle(this.guiLeft - 18, this.guiTop + 24 + 24, 18, 18);
List<Rectangle> area = new ArrayList<>();
area.add(tallButton);
return area;
}
@Override
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.buttonList.clear();
this.fontRenderer.drawString(this.getGuiDisplayName(GuiText.InterfaceTerminal.getLocal()), 8, 6, 4210752);
this.fontRenderer.drawString(GuiText.inventory.getLocal(), this.offsetX + 2, this.ySize - 96 + 3, 4210752);
this.fontRenderer.drawString(this.getGuiDisplayName(GuiText.InterfaceTerminal.getLocal()), OFFSET_X + 2, 6, 4210752);
this.fontRenderer.drawString(GuiText.inventory.getLocal(), OFFSET_X + 2, this.ySize - 96, 4210752);
final int currentScroll = this.getScrollBar().getCurrentScroll();
this.guiButtonNextAssembler = new GuiImgButton(guiLeft + 123, guiTop + 25, Settings.ACTIONS, ActionItems.FREE_MOLECULAR_SLOT_SHORTCUT);
this.buttonList.add(guiButtonNextAssembler);
guiButtonHide = new GuiImgButton(guiLeft + 141, guiTop + 25, Settings.ACTIONS, this.partInterfaceTerminal.onlyInterfacesWithFreeSlots ? ActionItems.TOGGLE_SHOW_FULL_INTERFACES_OFF : ActionItems.TOGGLE_SHOW_FULL_INTERFACES_ON);
this.buttonList.add(guiButtonHide);
this.inventorySlots.inventorySlots.removeIf(slot -> slot instanceof SlotDisconnected);
int offset = 52;
int offset = 51;
int linesDraw = 0;
for (int x = 0; x < LINES_ON_PAGE && linesDraw < LINES_ON_PAGE && currentScroll + x < this.lines.size(); x++) {
for (int x = 0; x < rows && linesDraw < rows && currentScroll + x < this.lines.size(); x++) {
final Object lineObj = this.lines.get(currentScroll + x);
if (lineObj instanceof ClientDCInternalInv) {
final ClientDCInternalInv inv = (ClientDCInternalInv) lineObj;
if (lineObj instanceof ClientDCInternalInv inv) {
GuiButton guiButton = new GuiImgButton(guiLeft + 4, guiTop + offset, Settings.ACTIONS, ActionItems.HIGHLIGHT_INTERFACE);
guiButtonHashMap.put(guiButton, inv);
this.buttonList.add(guiButton);
int extraLines = numUpgradesMap.get(inv);
for (int row = 0; row < 1 + extraLines && linesDraw < LINES_ON_PAGE; ++row) {
final int extraLines = numUpgradesMap.get(inv);
for (int row = 0; row < 1 + extraLines && linesDraw < rows; ++row) {
for (int z = 0; z < 9; z++) {
this.inventorySlots.inventorySlots.add(new SlotDisconnected(inv, z + (row * 9), (z * 18 + 22), offset));
if (this.matchedStacks.contains(inv.getInventory().getStackInSlot(z + (row * 9)))) {
drawRect(z * 18 + 22, offset, z * 18 + 22 + 16, offset + 16, 0x8A00FF00);
} else if (!matchedInterfaces.contains(inv)) {
drawRect(z * 18 + 22, offset, z * 18 + 22 + 16, offset + 16, 0x6A000000);
drawRect(z * 18 + 22, 1 + offset, z * 18 + 22 + 16, 1 + offset + 16, 0x2A00FF00);
}
}
linesDraw++;
offset += 18;
}
} else if (lineObj instanceof String) {
String name = (String) lineObj;
} else if (lineObj instanceof String name) {
final int rows = this.byName.get(name).size();
if (rows > 1) {
name = name + " (" + rows + ')';
}
while (name.length() > 2 && this.fontRenderer.getStringWidth(name) > 155) {
while (name.length() > 2 && this.fontRenderer.getStringWidth(name) > 158) {
name = name.substring(0, name.length() - 1);
}
this.fontRenderer.drawString(name, this.offsetX + 2, 5 + offset, 4210752);
this.fontRenderer.drawString(name, OFFSET_X + 3, 6 + offset, 4210752);
linesDraw++;
offset += 18;
}
}
}
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
buttonList.clear();
guiButtonHashMap.clear();
inventorySlots.inventorySlots.removeIf(slot -> slot instanceof SlotDisconnected);
guiButtonAssemblersOnly.set(onlyMolecularAssemblers ? ActionItems.MOLECULAR_ASSEMBLERS_ON : ActionItems.MOLECULAR_ASSEMBLERS_OFF);
guiButtonHideFull.set(onlyShowWithSpace ? ActionItems.TOGGLE_SHOW_FULL_INTERFACES_OFF : ActionItems.TOGGLE_SHOW_FULL_INTERFACES_ON);
guiButtonBrokenRecipes.set(onlyBrokenRecipes ? ActionItems.TOGGLE_SHOW_ONLY_INVALID_PATTERNS_ON : ActionItems.TOGGLE_SHOW_ONLY_INVALID_PATTERNS_OFF);
terminalStyleBox.set(AEConfig.instance().getConfigManager().getSetting(Settings.TERMINAL_STYLE));
buttonList.add(guiButtonAssemblersOnly);
buttonList.add(guiButtonHideFull);
buttonList.add(guiButtonBrokenRecipes);
buttonList.add(terminalStyleBox);
int offset = 51;
final int currentScroll = this.getScrollBar().getCurrentScroll();
int linesDraw = 0;
for (int x = 0; x < rows && linesDraw < rows && currentScroll + x < this.lines.size(); x++) {
final Object lineObj = this.lines.get(currentScroll + x);
if (lineObj instanceof ClientDCInternalInv inv) {
GuiButton guiButton = new GuiImgButton(guiLeft + 4, guiTop + offset + 1, Settings.ACTIONS, ActionItems.HIGHLIGHT_INTERFACE);
guiButtonHashMap.put(guiButton, inv);
this.buttonList.add(guiButton);
final int extraLines = numUpgradesMap.get(inv);
for (int row = 0; row < 1 + extraLines && linesDraw < rows; ++row) {
for (int z = 0; z < 9; z++) {
this.inventorySlots.inventorySlots.add(new SlotDisconnected(inv, z + (row * 9), z * 18 + 22, 1+ offset));
}
linesDraw++;
offset += 18;
}
} else if (lineObj instanceof String) {
linesDraw++;
offset += 18;
}
}
if (searchFieldInputs.isMouseIn(mouseX, mouseY)) {
drawTooltip(Mouse.getEventX() * this.width / this.mc.displayWidth - offsetX, mouseY - guiTop, "Inputs OR names");
} else if (searchFieldOutputs.isMouseIn(mouseX, mouseY)) {
drawTooltip(Mouse.getEventX() * this.width / this.mc.displayWidth - offsetX, mouseY - guiTop, "Outputs OR names");
}
super.drawScreen(mouseX, mouseY, partialTicks);
drawTooltip(searchFieldInputs, mouseX, mouseY);
drawTooltip(searchFieldOutputs, mouseX, mouseY);
drawTooltip(searchFieldNames, mouseX, mouseY);
}
@Override
protected void mouseClicked(final int xCoord, final int yCoord, final int btn) throws IOException {
this.searchFieldInputs.mouseClicked(xCoord, yCoord, btn);
if (btn == 1 && this.searchFieldInputs.isMouseIn(xCoord, yCoord)) {
this.searchFieldInputs.setText("");
this.refreshList();
}
this.searchFieldOutputs.mouseClicked(xCoord, yCoord, btn);
if (btn == 1 && this.searchFieldOutputs.isMouseIn(xCoord, yCoord)) {
this.searchFieldOutputs.setText("");
this.refreshList();
}
this.searchFieldNames.mouseClicked(xCoord, yCoord, btn);
super.mouseClicked(xCoord, yCoord, btn);
}
@@ -215,55 +311,71 @@ public class GuiInterfaceTerminal extends AEBaseGui {
int interfaceDim = dimHashMap.get(guiButtonHashMap.get(this.selectedButton));
if (playerDim != interfaceDim) {
try {
mc.player.sendStatusMessage(new TextComponentString("Interface located at dimension: " + interfaceDim + " [" + DimensionManager.getWorld(interfaceDim).provider.getDimensionType().getName() + "] and cant be highlighted"), false);
mc.player.sendStatusMessage(PlayerMessages.InterfaceInOtherDimParam.get(interfaceDim, DimensionManager.getWorld(interfaceDim).provider.getDimensionType().getName()), false);
} catch (Exception e) {
mc.player.sendStatusMessage(new TextComponentString("Interface is located in another dimension and cannot be highlighted"), false);
mc.player.sendStatusMessage(PlayerMessages.InterfaceInOtherDim.get(), false);
}
} else {
hilightBlock(blockPos, System.currentTimeMillis() + 500 * BlockPosUtils.getDistance(blockPos, blockPos2), playerDim);
mc.player.sendStatusMessage(new TextComponentString("The interface is now highlighted at " + "X: " + blockPos.getX() + " Y: " + blockPos.getY() + " Z: " + blockPos.getZ()), false);
mc.player.sendStatusMessage(PlayerMessages.InterfaceHighlighted.get(blockPos.getX(), blockPos.getY(), blockPos.getZ()), false);
}
mc.player.closeScreen();
}
if (btn == guiButtonHide) {
partInterfaceTerminal.onlyInterfacesWithFreeSlots = !partInterfaceTerminal.onlyInterfacesWithFreeSlots;
} else if (btn == guiButtonHideFull) {
onlyShowWithSpace = !onlyShowWithSpace;
this.refreshList();
}
if (btn == guiButtonNextAssembler) {
// Set Search to "Molecular Assembler" and set "Only Free Interface"
boolean currentOnlyInterfacesWithFreeSlots = this.partInterfaceTerminal.onlyInterfacesWithFreeSlots;
String currentSearchText = this.searchFieldOutputs.getText();
this.partInterfaceTerminal.onlyInterfacesWithFreeSlots = true;
this.searchFieldOutputs.setText("Molecular Assembler");
} else if (btn == guiButtonAssemblersOnly) {
onlyMolecularAssemblers = !onlyMolecularAssemblers;
this.refreshList();
} else if (btn == guiButtonBrokenRecipes) {
onlyBrokenRecipes = !onlyBrokenRecipes;
this.refreshList();
} else if (btn instanceof GuiImgButton iBtn) {
if (iBtn.getSetting() != Settings.ACTIONS) {
final Enum<?> cv = iBtn.getCurrentValue();
final boolean backwards = Mouse.isButtonDown(1);
final Enum<?> next = Platform.rotateEnum(cv, backwards, iBtn.getSetting().getPossibleValues());
this.partInterfaceTerminal.onlyInterfacesWithFreeSlots = currentOnlyInterfacesWithFreeSlots;
this.searchFieldOutputs.setText(currentSearchText);
if (btn == this.terminalStyleBox) {
AEConfig.instance().getConfigManager().putSetting(iBtn.getSetting(), next);
this.reinitalize();
}
iBtn.set(next);
}
}
}
private void reinitalize() {
this.buttonList.clear();
this.initGui();
}
@Override
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.bindTexture("guis/newinterfaceterminal.png");
this.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize);
// draw the top portion of the background, above the interface list
this.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, 53);
for (int x = 0; x < this.rows; x++) {
// draw the background of the rows in the interface list
this.drawTexturedModalRect(offsetX, offsetY + 53 + x * 18, 0, 52, this.xSize, 18);
}
int offset = 51;
final int ex = this.getScrollBar().getCurrentScroll();
int linesDraw = 0;
for (int x = 0; x < LINES_ON_PAGE && linesDraw < LINES_ON_PAGE && ex + x < this.lines.size(); x++) {
for (int x = 0; x < this.rows && linesDraw < rows && ex + x < this.lines.size(); x++) {
final Object lineObj = this.lines.get(ex + x);
if (lineObj instanceof ClientDCInternalInv) {
GlStateManager.color(1, 1, 1, 1);
final int width = 9 * 18;
final int extraLines = numUpgradesMap.get(lineObj);
int extraLines = numUpgradesMap.get(lineObj);
for (int row = 0; row < 1 + extraLines && linesDraw < LINES_ON_PAGE; ++row) {
// draw the slot backgrounds
for (int row = 0; row < 1 + extraLines && linesDraw < rows; ++row) {
this.drawTexturedModalRect(offsetX + 20, offsetY + offset, 20, 173, width, 18);
offset += 18;
linesDraw++;
}
@@ -273,27 +385,33 @@ public class GuiInterfaceTerminal extends AEBaseGui {
}
}
if (this.searchFieldInputs != null) {
this.searchFieldInputs.drawTextBox();
}
// draw the background below the interface list
this.drawTexturedModalRect(offsetX, offsetY + 50 + this.rows * 18, 0, 158, this.xSize, 99);
if (this.searchFieldOutputs != null) {
this.searchFieldOutputs.drawTextBox();
}
// draw the text boxes
this.searchFieldInputs.drawTextBox();
this.searchFieldOutputs.drawTextBox();
this.searchFieldNames.drawTextBox();
}
@Override
protected void keyTyped(final char character, final int key) throws IOException {
if (!this.checkHotbarKeys(key)) {
if (character == ' ' && this.searchFieldInputs.getText().isEmpty() && this.searchFieldInputs.isFocused()) {
return;
if (character == ' ') {
if ((this.searchFieldInputs.getText().isEmpty() && this.searchFieldInputs.isFocused())
|| (this.searchFieldOutputs.getText().isEmpty() && this.searchFieldOutputs.isFocused())
|| (this.searchFieldNames.getText().isEmpty() && this.searchFieldNames.isFocused())) {
return;
}
} else if (character == '\t') {
if (handleTab()) {
return;
}
}
if (character == ' ' && this.searchFieldOutputs.getText().isEmpty() && this.searchFieldOutputs.isFocused()) {
return;
}
if (this.searchFieldInputs.textboxKeyTyped(character, key) || this.searchFieldOutputs.textboxKeyTyped(character, key)) {
if (this.searchFieldInputs.textboxKeyTyped(character, key)
|| this.searchFieldOutputs.textboxKeyTyped(character, key)
|| this.searchFieldNames.textboxKeyTyped(character, key)) {
this.refreshList();
} else {
super.keyTyped(character, key);
@@ -301,6 +419,27 @@ public class GuiInterfaceTerminal extends AEBaseGui {
}
}
/** Cycle to the next search bar if tab is pressed, going in reverse if shift is held. */
private boolean handleTab() {
if (searchFieldInputs.isFocused()) {
searchFieldInputs.setFocused(false);
if (isShiftKeyDown()) searchFieldNames.setFocused(true);
else searchFieldOutputs.setFocused(true);
return true;
} else if (searchFieldOutputs.isFocused()) {
searchFieldOutputs.setFocused(false);
if (isShiftKeyDown()) searchFieldInputs.setFocused(true);
else searchFieldNames.setFocused(true);
return true;
} else if (searchFieldNames.isFocused()) {
searchFieldNames.setFocused(false);
if (isShiftKeyDown()) searchFieldOutputs.setFocused(true);
else searchFieldInputs.setFocused(true);
return true;
}
return false;
}
public void postUpdate(final NBTTagCompound in) {
if (in.getBoolean("clear")) {
this.byId.clear();
@@ -321,7 +460,7 @@ public class GuiInterfaceTerminal extends AEBaseGui {
for (int x = 0; x < current.getInventory().getSlots(); x++) {
final String which = Integer.toString(x);
if (invData.hasKey(which)) {
current.getInventory().setStackInSlot(x, new ItemStack(invData.getCompoundTag(which)));
current.getInventory().setStackInSlot(x, stackFromNBT(invData.getCompoundTag(which)));
}
}
} catch (final NumberFormatException ignored) {
@@ -346,12 +485,13 @@ public class GuiInterfaceTerminal extends AEBaseGui {
this.byName.clear();
this.buttonList.clear();
this.matchedStacks.clear();
this.matchedInterfaces.clear();
final String searchFieldInputs = this.searchFieldInputs.getText().toLowerCase();
final String searchFieldOutputs = this.searchFieldOutputs.getText().toLowerCase();
final String searchFieldNames = this.searchFieldNames.getText().toLowerCase();
final Set<Object> cachedSearch = this.getCacheForSearchTerm("IN:" + searchFieldInputs + " OUT:" + searchFieldOutputs + partInterfaceTerminal.onlyInterfacesWithFreeSlots);
final Set<Object> cachedSearch = this.getCacheForSearchTerm("IN:" + searchFieldInputs + " OUT:" + searchFieldOutputs
+ "NAME:" + searchFieldNames + onlyShowWithSpace + onlyMolecularAssemblers + onlyBrokenRecipes);
final boolean rebuild = cachedSearch.isEmpty();
for (final ClientDCInternalInv entry : this.byId.values()) {
@@ -362,78 +502,100 @@ public class GuiInterfaceTerminal extends AEBaseGui {
// Shortcut to skip any filter if search term is ""/empty
boolean found = (searchFieldInputs.isEmpty() && searchFieldOutputs.isEmpty() && !partInterfaceTerminal.onlyInterfacesWithFreeSlots);
boolean found = searchFieldInputs.isEmpty() && searchFieldOutputs.isEmpty();
boolean interfaceHasFreeSlots = false;
boolean interfaceHasBrokenRecipes = false;
// Search if the current inventory holds a pattern containing the search term.
if (!found) {
if (!found || onlyShowWithSpace || onlyBrokenRecipes) {
int slot = 0;
for (final ItemStack itemStack : entry.getInventory()) {
if (slot > 8 + numUpgradesMap.get(entry) * 9) {
break;
}
if (!searchFieldInputs.isEmpty() && !searchFieldOutputs.isEmpty()) {
if (this.itemStackMatchesSearchTerm(itemStack, searchFieldInputs, 0) || this.itemStackMatchesSearchTerm(itemStack, searchFieldOutputs, 1)) {
found = true;
matchedStacks.add(itemStack);
}
} else if (!searchFieldInputs.isEmpty()) {
if (this.itemStackMatchesSearchTerm(itemStack, searchFieldInputs, 0)) {
found = true;
matchedStacks.add(itemStack);
}
} else if (!searchFieldOutputs.isEmpty()) {
if (this.itemStackMatchesSearchTerm(itemStack, searchFieldOutputs, 1)) {
found = true;
matchedStacks.add(itemStack);
}
}
// If only Interfaces with empty slots should be shown, check that here
if (itemStack.isEmpty()) {
interfaceHasFreeSlots = true;
}
if (onlyBrokenRecipes && recipeIsBroken(itemStack)) {
interfaceHasBrokenRecipes = true;
}
if ((!searchFieldInputs.isEmpty() && itemStackMatchesSearchTerm(itemStack, searchFieldInputs, 0))
|| (!searchFieldOutputs.isEmpty() && itemStackMatchesSearchTerm(itemStack, searchFieldOutputs, 1))) {
found = true;
matchedStacks.add(itemStack);
}
slot++;
}
}
// if found, filter skipped or machine name matching the search term, add it
if ((searchFieldInputs.isEmpty() && searchFieldOutputs.isEmpty()) ||
!searchFieldInputs.isEmpty() && entry.getName().toLowerCase().contains(searchFieldInputs) ||
(!searchFieldOutputs.isEmpty() && entry.getName().toLowerCase().contains(searchFieldOutputs))) {
this.matchedInterfaces.add(entry);
found = true;
}
if (found) {
if (!partInterfaceTerminal.onlyInterfacesWithFreeSlots) {
this.byName.put(entry.getName(), entry);
cachedSearch.add(entry);
} else if (interfaceHasFreeSlots) {
this.byName.put(entry.getName(), entry);
cachedSearch.add(entry);
}
} else {
// Exit if not found
if (!found) {
cachedSearch.remove(entry);
continue;
}
// Exit if the interface does not match the name search
if (!entry.getName().toLowerCase().contains(searchFieldNames)) {
cachedSearch.remove(entry);
continue;
}
// Exit if molecular assembler filter is on and this is not a molecular assembler
if (onlyMolecularAssemblers && !entry.getName().toLowerCase().contains(MOLECULAR_ASSEMBLER)) {
cachedSearch.remove(entry);
continue;
}
// Exit if we are only showing interfaces with free slots and there are none free in this interface
if (onlyShowWithSpace && !interfaceHasFreeSlots) {
cachedSearch.remove(entry);
continue;
}
// Exit if we are only showing interfaces with broken patterns and there are no broken patterns in this interface
if (onlyBrokenRecipes && !interfaceHasBrokenRecipes) {
cachedSearch.remove(entry);
continue;
}
// Successful search
this.byName.put(entry.getName(), entry);
cachedSearch.add(entry);
}
this.names.clear();
this.names.addAll(this.byName.keySet());
Collections.sort(this.names);
this.lines.clear();
this.lines.ensureCapacity(this.getMaxRows());
this.lines.ensureCapacity(this.names.size() + this.byId.size());
for (final String n : this.names) {
this.lines.add(n);
final ArrayList<ClientDCInternalInv> clientInventories = new ArrayList<>();
clientInventories.addAll(this.byName.get(n));
final ArrayList<ClientDCInternalInv> clientInventories = new ArrayList<>(this.byName.get(n));
Collections.sort(clientInventories);
this.lines.addAll(clientInventories);
}
this.getScrollBar().setRange(0, this.lines.size() - 1, 1);
this.setScrollBar();
}
private boolean recipeIsBroken(final ItemStack stack) {
if (stack == null) return false;
if (stack.isEmpty()) return false;
final NBTTagCompound encodedValue = stack.getTagCompound();
if (encodedValue == null) return true;
final World w = AppEng.proxy.getWorld();
if (w == null) return false;
try {
new PatternHelper(stack, w);
return false;
} catch (Throwable ignored) {
return true;
}
}
private boolean itemStackMatchesSearchTerm(final ItemStack itemStack, final String searchTerm, int pass) {
@@ -444,18 +606,18 @@ public class GuiInterfaceTerminal extends AEBaseGui {
final NBTTagCompound encodedValue = itemStack.getTagCompound();
if (encodedValue == null) {
return false;
return searchTerm.matches(GuiText.InvalidPattern.getLocal());
}
NBTTagList tag = new NBTTagList();
final NBTTagList tag;
if (pass == 0) {
tag = encodedValue.getTagList("in", 10);
tag = encodedValue.getTagList("in", Constants.NBT.TAG_COMPOUND);
} else {
tag = encodedValue.getTagList("out", 10);
tag = encodedValue.getTagList("out", Constants.NBT.TAG_COMPOUND);
}
boolean foundMatchingItemStack = false;
final String[] splitTerm = searchTerm.split(" ");
for (int i = 0; i < tag.tagCount(); i++) {
final ItemStack parsedItemStack = new ItemStack(tag.getCompoundTagAt(i));
@@ -464,7 +626,7 @@ public class GuiInterfaceTerminal extends AEBaseGui {
.getItemDisplayName(AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class).createStack(parsedItemStack))
.toLowerCase();
for (String term : searchTerm.split(" ")) {
for (String term : splitTerm) {
if (term.length() > 1 && (term.startsWith("-") || term.startsWith("!"))) {
term = term.substring(1);
if (displayName.contains(term)) {
@@ -503,13 +665,8 @@ public class GuiInterfaceTerminal extends AEBaseGui {
return cache;
}
/**
* The max amount of unique names and each inv row. Not affected by the filtering.
*
* @return max amount of unique names and each inv row
*/
private int getMaxRows() {
return this.names.size() + this.byId.size();
return AEConfig.instance().getConfigManager().getSetting(Settings.TERMINAL_STYLE) != TerminalStyle.TALL ? 6 : Integer.MAX_VALUE;
}
private ClientDCInternalInv getById(final long id, final long sortBy, final String string) {
@@ -103,7 +103,6 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
private int currentMouseY = 0;
private boolean delayedUpdate;
private boolean updateView = true;
protected int jeiOffset = Loader.isModLoaded("jei") ? 24 : 0;
public GuiMEMonitorable(final InventoryPlayer inventoryPlayer, final ITerminalHost te) {
@@ -162,7 +161,8 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
}
if (!this.delayedUpdate) {
this.updateView = true;
this.repo.updateView();
this.setScrollBar();
}
}
@@ -319,7 +319,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
this.searchField.setText(memoryText);
this.searchField.selectAll();
this.repo.setSearchString(memoryText);
this.updateView = true;
this.setScrollBar();
}
craftingGridOffsetX = Integer.MAX_VALUE;
@@ -380,7 +380,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
if (btn == 1 && this.searchField.isMouseIn(xCoord, yCoord)) {
this.searchField.setText("");
this.repo.setSearchString("");
this.updateView = true;
this.setScrollBar();
}
super.mouseClicked(xCoord, yCoord, btn);
@@ -440,7 +440,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
return this.repo.hasPower();
}
int getMaxRows() {
protected int getMaxRows() {
return AEConfig.instance().getConfigManager().getSetting(Settings.TERMINAL_STYLE) == TerminalStyle.SMALL ? 6 : Integer.MAX_VALUE;
}
@@ -467,6 +467,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
}
final boolean mouseInGui = this.isPointInRegion(0, 0, this.xSize, this.ySize, this.currentMouseX, this.currentMouseY);
final boolean wasSearchFieldFocused = this.searchField.isFocused();
if (this.isAutoFocus && !this.searchField.isFocused() && mouseInGui) {
this.searchField.setFocused(true);
@@ -474,10 +475,14 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
if (this.searchField.textboxKeyTyped(character, key)) {
this.repo.setSearchString(this.searchField.getText());
this.updateView = true;
this.setScrollBar();
// tell forge the key event is handled and should not be sent out
this.keyHandled = mouseInGui;
} else {
if (!wasSearchFieldFocused) {
// prevent unhandled keys (like shift) from focusing the search field
searchField.setFocused(false);
}
super.keyTyped(character, key);
}
}
@@ -501,7 +506,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
this.delayedUpdate = false;
}
}
if (!this.delayedUpdate && updateView) {
if (!this.delayedUpdate) {
this.repo.updateView();
this.setScrollBar();
}
@@ -537,7 +542,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
this.ViewBox.set(this.configSrc.getSetting(Settings.VIEW_MODE));
}
this.updateView = true;
this.repo.updateView();
}
int getReservedSpace() {
@@ -20,22 +20,17 @@ package appeng.client.gui.implementations;
import appeng.api.implementations.guiobjects.IPortableCell;
import appeng.container.implementations.ContainerMEPortableCell;
import net.minecraft.entity.player.InventoryPlayer;
public class GuiMEPortableCell extends GuiMEMonitorable {
public GuiMEPortableCell(final InventoryPlayer inventoryPlayer, final IPortableCell te) {
super(inventoryPlayer, te, new ContainerMEPortableCell(inventoryPlayer, te));
super(inventoryPlayer, te);
}
int defaultGetMaxRows() {
return super.getMaxRows();
}
@Override
int getMaxRows() {
protected int getMaxRows() {
return 3;
}
}
@@ -55,8 +55,6 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource {
private GuiImgButton units;
private int tooltip = -1;
private boolean updateView = true;
public GuiNetworkStatus(final InventoryPlayer inventoryPlayer, final INetworkTool te) {
super(new ContainerNetworkStatus(inventoryPlayer, te));
final GuiScrollbar scrollbar = new GuiScrollbar();
@@ -208,17 +206,9 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource {
for (final IAEItemStack is : list) {
this.repo.postUpdate(is);
}
this.updateView = true;
}
@Override
public void updateScreen() {
if (updateView) {
this.repo.updateView();
this.setScrollBar();
updateView = false;
}
super.updateScreen();
this.repo.updateView();
this.setScrollBar();
}
private void setScrollBar() {
@@ -4,7 +4,6 @@ import appeng.api.config.AccessRestriction;
import appeng.api.config.ActionItems;
import appeng.api.config.Settings;
import appeng.api.config.StorageFilter;
import appeng.client.gui.AEBaseGui;
import appeng.client.gui.widgets.GuiImgButton;
import appeng.client.gui.widgets.GuiTabButton;
import appeng.client.gui.widgets.MEGuiTextField;
@@ -27,27 +26,25 @@ import java.io.IOException;
import java.util.regex.Pattern;
public class GuiOreDictStorageBus extends AEBaseGui {
public class GuiOreDictStorageBus extends GuiUpgradeable {
private final ContainerOreDictStorageBus container;
PartOreDicStorageBus part;
private GuiTabButton priority;
private GuiImgButton partition;
private GuiImgButton storageFilter;
private GuiImgButton rwMode;
private static final Pattern ORE_DICTIONARY_FILTER = Pattern.compile("[(!]* *[0-9a-zA-Z*]* *\\)*( *[&|^]? *[(!]* *[0-9a-zA-Z*]* *\\)*)*");
private static final Pattern ORE_DICTIONARY_FILTER = Pattern.compile("[0-9a-zA-Z* &|^!()]*");
private MEGuiTextField searchFieldInputs;
public GuiOreDictStorageBus(final InventoryPlayer inventoryPlayer, final PartOreDicStorageBus te) {
super(new ContainerOreDictStorageBus(inventoryPlayer, te));
this.container = (ContainerOreDictStorageBus) super.inventorySlots;
part = te;
this.ySize = 84;
this.ySize = 170;
}
@Override
public void initGui() {
super.initGui();
protected void addButtons() {
this.searchFieldInputs = new MEGuiTextField(this.fontRenderer, this.guiLeft + 3, this.guiTop + 22, 170, 12);
this.searchFieldInputs.setEnableBackgroundDrawing(false);
this.searchFieldInputs.setMaxStringLength(512);
@@ -66,7 +63,6 @@ public class GuiOreDictStorageBus extends AEBaseGui {
} catch (IOException e) {
e.printStackTrace();
}
}
public void fillRegex(String regex) {
@@ -143,10 +139,13 @@ public class GuiOreDictStorageBus extends AEBaseGui {
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) {
this.bindTexture("guis/oredictstoragebus.png");
this.drawTexturedModalRect(offsetX, offsetY, 0, 0, 175, 85);
protected String getBackground() {
return "guis/oredictstoragebus.png";
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) {
super.drawBG(offsetX, offsetY, mouseX, mouseY);
if (this.searchFieldInputs != null) {
this.searchFieldInputs.drawTextBox();
}
@@ -25,7 +25,9 @@ import appeng.api.config.Settings;
import appeng.api.storage.ITerminalHost;
import appeng.client.gui.widgets.GuiImgButton;
import appeng.client.gui.widgets.GuiTabButton;
import appeng.container.implementations.ContainerPatternEncoder;
import appeng.container.implementations.ContainerPatternTerm;
import appeng.container.implementations.ContainerWirelessPatternTerminal;
import appeng.container.interfaces.IJEIGhostIngredients;
import appeng.container.slot.AppEngSlot;
import appeng.container.slot.SlotFake;
@@ -35,6 +37,7 @@ import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketInventoryAction;
import appeng.core.sync.packets.PacketValueConfig;
import appeng.helpers.InventoryAction;
import appeng.helpers.WirelessTerminalGuiObject;
import appeng.util.item.AEItemStack;
import mezz.jei.api.gui.IGhostIngredientHandler.Target;
import net.minecraft.client.gui.GuiButton;
@@ -60,7 +63,7 @@ public class GuiPatternTerm extends GuiMEMonitorable implements IJEIGhostIngredi
private static final String CRAFTMODE_CRFTING = "1";
private static final String CRAFTMODE_PROCESSING = "0";
private final ContainerPatternTerm container;
private final ContainerPatternEncoder container;
private GuiTabButton tabCraftButton;
private GuiTabButton tabProcessButton;
@@ -83,6 +86,12 @@ public class GuiPatternTerm extends GuiMEMonitorable implements IJEIGhostIngredi
this.setReservedSpace(81);
}
public GuiPatternTerm(final InventoryPlayer inventoryPlayer, WirelessTerminalGuiObject te, final ContainerWirelessPatternTerminal wpt) {
super(inventoryPlayer, te, wpt);
this.container = (ContainerWirelessPatternTerminal) this.inventorySlots;
this.setReservedSpace(81);
}
@Override
protected void actionPerformed(final GuiButton btn) {
super.actionPerformed(btn);
@@ -41,7 +41,7 @@ public class GuiQNB extends AEBaseGui {
@Override
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.bindTexture("guis/chest.png");
this.bindTexture("guis/qbgui.png");
this.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize);
}
}
@@ -47,6 +47,7 @@ import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidUtil;
import org.lwjgl.input.Mouse;
import javax.annotation.Nonnull;
import java.awt.*;
import java.io.IOException;
import java.util.List;
@@ -54,7 +55,7 @@ import java.util.*;
public class GuiUpgradeable extends AEBaseGui implements IJEIGhostIngredients {
private final Map<Target<?>, Object> mapTargetSlot = new HashMap<>();
protected final Map<Target<?>, Object> mapTargetSlot = new HashMap<>();
protected final ContainerUpgradeable cvb;
protected final IUpgradeableHost bc;
@@ -218,24 +219,25 @@ public class GuiUpgradeable extends AEBaseGui implements IJEIGhostIngredients {
List<Target<?>> targets = new ArrayList<>();
List<IJEITargetSlot> slots = new ArrayList<>();
if (this.inventorySlots.inventorySlots.size() > 0) {
if (!this.inventorySlots.inventorySlots.isEmpty()) {
for (Slot slot : this.inventorySlots.inventorySlots) {
if (slot instanceof SlotFake && (!itemStack.isEmpty() || this instanceof GuiCellWorkbench && fluidStack != null)) {
slots.add((IJEITargetSlot) slot);
}
}
}
if (this.getGuiSlots().size() > 0) {
if (!this.getGuiSlots().isEmpty()) {
for (GuiCustomSlot slot : this.getGuiSlots()) {
if (slot instanceof GuiFluidSlot && fluidStack != null) {
slots.add((IJEITargetSlot) slot);
}
}
}
for (Object slot : slots) {
for (IJEITargetSlot slot : slots) {
ItemStack finalItemStack = itemStack;
FluidStack finalFluidStack = fluidStack;
Target<Object> targetItem = new Target<Object>() {
Target<Object> targetItem = new Target<>() {
@Nonnull
@Override
public Rectangle getArea() {
if (slot instanceof SlotFake && ((SlotFake) slot).isSlotEnabled()) {
@@ -247,20 +249,20 @@ public class GuiUpgradeable extends AEBaseGui implements IJEIGhostIngredients {
}
@Override
public void accept(Object ingredient) {
public void accept(@Nonnull Object ingredient) {
PacketInventoryAction p = null;
try {
if (slot instanceof SlotFake && ((SlotFake) slot).isSlotEnabled()) {
if (finalItemStack.isEmpty() && finalFluidStack != null) {
p = new PacketInventoryAction(InventoryAction.PLACE_JEI_GHOST_ITEM, (IJEITargetSlot) slot, AEItemStack.fromItemStack(FluidUtil.getFilledBucket(finalFluidStack)));
p = new PacketInventoryAction(InventoryAction.PLACE_JEI_GHOST_ITEM, slot, AEItemStack.fromItemStack(FluidUtil.getFilledBucket(finalFluidStack)));
} else if (!finalItemStack.isEmpty()) {
p = new PacketInventoryAction(InventoryAction.PLACE_JEI_GHOST_ITEM, (IJEITargetSlot) slot, AEItemStack.fromItemStack(finalItemStack));
p = new PacketInventoryAction(InventoryAction.PLACE_JEI_GHOST_ITEM, slot, AEItemStack.fromItemStack(finalItemStack));
}
} else {
if (finalFluidStack == null) {
return;
}
p = new PacketInventoryAction(InventoryAction.PLACE_JEI_GHOST_ITEM, (IJEITargetSlot) slot, AEItemStack.fromItemStack(AEFluidStack.fromFluidStack(finalFluidStack).asItemStackRepresentation()));
p = new PacketInventoryAction(InventoryAction.PLACE_JEI_GHOST_ITEM, slot, AEItemStack.fromItemStack(AEFluidStack.fromFluidStack(finalFluidStack).asItemStackRepresentation()));
}
NetworkHandler.instance().sendToServer(p);
@@ -0,0 +1,93 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.client.gui.implementations;
import appeng.api.config.ActionItems;
import appeng.api.config.Settings;
import appeng.client.gui.widgets.GuiImgButton;
import appeng.client.me.ItemRepo;
import appeng.container.implementations.ContainerWirelessCraftingTerminal;
import appeng.container.slot.SlotCraftingMatrix;
import appeng.core.localization.GuiText;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketInventoryAction;
import appeng.helpers.InventoryAction;
import appeng.helpers.WirelessTerminalGuiObject;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
public class GuiWirelessCraftingTerminal extends GuiMEMonitorable {
private GuiImgButton clearBtn;
public GuiWirelessCraftingTerminal(final InventoryPlayer inventoryPlayer, final WirelessTerminalGuiObject te) {
super(inventoryPlayer, te, new ContainerWirelessCraftingTerminal(inventoryPlayer, te));
this.setReservedSpace(73);
}
@Override
protected void actionPerformed(final GuiButton btn) {
super.actionPerformed(btn);
if (this.clearBtn == btn) {
Slot s = null;
final Container c = this.inventorySlots;
for (final Object j : c.inventorySlots) {
if (j instanceof SlotCraftingMatrix) {
s = (Slot) j;
}
}
if (s != null) {
final PacketInventoryAction p = new PacketInventoryAction(InventoryAction.MOVE_REGION, s.slotNumber, 0);
NetworkHandler.instance().sendToServer(p);
}
}
}
@Override
public void initGui() {
super.initGui();
this.buttonList.add(this.clearBtn = new GuiImgButton(this.guiLeft + 92, this.guiTop + this.ySize - 156, Settings.ACTIONS, ActionItems.STASH));
this.clearBtn.setHalfSize(true);
}
@Override
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
super.drawFG(offsetX, offsetY, mouseX, mouseY);
this.fontRenderer.drawString(GuiText.CraftingTerminal.getLocal(), 8, this.ySize - 96 + 1 - this.getReservedSpace(), 4210752);
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) {
this.bindTexture("guis/wirelessupgrades.png");
Gui.drawModalRectWithCustomSizedTexture(offsetX + 198, offsetY + 127, 0, 0, 32, 32, 32, 32);
super.drawBG(offsetX, offsetY, mouseX, mouseY);
}
@Override
protected String getBackground() {
return "guis/crafting.png";
}
}
@@ -0,0 +1,41 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.client.gui.implementations;
import appeng.container.implementations.ContainerWirelessPatternTerminal;
import appeng.helpers.WirelessTerminalGuiObject;
import net.minecraft.client.gui.Gui;
import net.minecraft.entity.player.InventoryPlayer;
public class GuiWirelessPatternTerminal extends GuiPatternTerm {
public GuiWirelessPatternTerminal(final InventoryPlayer inventoryPlayer, final WirelessTerminalGuiObject te) {
super(inventoryPlayer, te, new ContainerWirelessPatternTerminal(inventoryPlayer, te));
this.setReservedSpace(81);
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) {
this.bindTexture("guis/wirelessupgrades.png");
Gui.drawModalRectWithCustomSizedTexture(offsetX + 198, offsetY + 127, 0, 0, 32, 32, 32, 32);
super.drawBG(offsetX, offsetY, mouseX, mouseY);
}
}
@@ -20,17 +20,22 @@ package appeng.client.gui.implementations;
import appeng.api.implementations.guiobjects.IPortableCell;
import appeng.container.implementations.ContainerWirelessTerm;
import appeng.helpers.WirelessTerminalGuiObject;
import net.minecraft.client.gui.Gui;
import net.minecraft.entity.player.InventoryPlayer;
public class GuiWirelessTerm extends GuiMEPortableCell {
public class GuiWirelessTerm extends GuiMEMonitorable {
public GuiWirelessTerm(final InventoryPlayer inventoryPlayer, final IPortableCell te) {
super(inventoryPlayer, te);
public GuiWirelessTerm(final InventoryPlayer inventoryPlayer, final WirelessTerminalGuiObject te) {
super(inventoryPlayer, te, new ContainerWirelessTerm(inventoryPlayer, te));
}
@Override
int getMaxRows() {
return this.defaultGetMaxRows();
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) {
this.bindTexture("guis/wirelessupgrades.png");
Gui.drawModalRectWithCustomSizedTexture(offsetX + 198, offsetY + 127, 0, 0, 32, 32, 32, 32);
super.drawBG(offsetX, offsetY, mouseX, mouseY);
}
}
@@ -0,0 +1,52 @@
package appeng.client.gui.toasts;
import appeng.core.localization.GuiText;
import net.minecraft.client.gui.toasts.GuiToast;
import net.minecraft.client.gui.toasts.IToast;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.jetbrains.annotations.NotNull;
@SideOnly(Side.CLIENT)
public class CraftingStatusToast implements IToast {
private final ItemStack itemStack;
private final boolean cancelled;
private long firstDrawTime;
private boolean newDisplay;
public CraftingStatusToast(@NotNull ItemStack itemStack, boolean cancelled) {
this.itemStack = itemStack;
this.cancelled = cancelled;
}
@NotNull
public Visibility draw(@NotNull GuiToast toastGui, long delta)
{
if (this.newDisplay)
{
this.firstDrawTime = delta;
this.newDisplay = false;
}
var minecraft = toastGui.getMinecraft();
var fontRenderer = minecraft.fontRenderer;
// Texture
minecraft.getTextureManager().bindTexture(TEXTURE_TOASTS);
GlStateManager.color(1.0F, 1.0F, 1.0F);
toastGui.drawTexturedModalRect(0, 0, 0, 32, 160, 32);
// Text
var statusText = cancelled ? GuiText.CraftingToastCancelled : GuiText.CraftingToastDone;
fontRenderer.drawString(statusText.getLocal(), 30, 7, -11534256);
fontRenderer.drawString(itemStack.getDisplayName(), 30, 18, -16777216);
// Item
RenderHelper.enableGUIStandardItemLighting();
minecraft.getRenderItem().renderItemAndEffectIntoGUI(null, itemStack, 8, 8);
return delta - this.firstDrawTime < 5000L ? Visibility.SHOW : Visibility.HIDE;
}
}
@@ -116,10 +116,13 @@ public class GuiImgButton extends GuiButton implements ITooltip {
this.registerApp(11 + 4 * 16, Settings.ACTIONS, ActionItems.DECREASE_BY_ONE, ButtonToolTips.DecreaseByOne, ButtonToolTips.DecreaseByOneDesc);
this.registerApp(12 + 4 * 16, Settings.ACTIONS, ActionItems.MAX_COUNT, ButtonToolTips.MaxCount, ButtonToolTips.MaxCountDesc);
this.registerApp(6 + 5 * 16, Settings.ACTIONS, ActionItems.FREE_MOLECULAR_SLOT_SHORTCUT, ButtonToolTips.FreeMolecularSlotShortcut, ButtonToolTips.FreeMolecularSlotShortcutDesc);
this.registerApp(6 + 5 * 16, Settings.ACTIONS, ActionItems.MOLECULAR_ASSEMBLERS_ON, ButtonToolTips.ToggleMolecularAssemblers, ButtonToolTips.ToggleMolecularAssemblersOnDesc);
this.registerApp(7 + 5 * 16, Settings.ACTIONS, ActionItems.TOGGLE_SHOW_FULL_INTERFACES_ON, ButtonToolTips.ToggleShowFullInterfaces, ButtonToolTips.ToggleShowFullInterfacesOnDesc);
this.registerApp(8 + 5 * 16, Settings.ACTIONS, ActionItems.TOGGLE_SHOW_FULL_INTERFACES_OFF, ButtonToolTips.ToggleShowFullInterfaces, ButtonToolTips.ToggleShowFullInterfacesOffDesc);
this.registerApp(9 + 5 * 16, Settings.ACTIONS, ActionItems.MOLECULAR_ASSEMBLERS_OFF, ButtonToolTips.ToggleMolecularAssemblers, ButtonToolTips.ToggleMolecularAssemblersOffDesc);
this.registerApp(6 + 6 * 16, Settings.ACTIONS, ActionItems.HIGHLIGHT_INTERFACE, ButtonToolTips.HighlightInterface, "");
this.registerApp(4 + 5 * 16, Settings.ACTIONS, ActionItems.TOGGLE_SHOW_ONLY_INVALID_PATTERNS_OFF, ButtonToolTips.ToggleShowOnlyInvalidInterface, ButtonToolTips.ToggleShowOnlyInvalidInterfaceOffDesc);
this.registerApp(5 + 5 * 16, Settings.ACTIONS, ActionItems.TOGGLE_SHOW_ONLY_INVALID_PATTERNS_ON, ButtonToolTips.ToggleShowOnlyInvalidInterface, ButtonToolTips.ToggleShowOnlyInvalidInterfaceOnDesc);
this.registerApp(8, Settings.ACTIONS, ActionItems.ENCODE, ButtonToolTips.Encode, ButtonToolTips.EncodeDescription);
this.registerApp(4 + 3 * 16, Settings.ACTIONS, ItemSubstitution.ENABLED, ButtonToolTips.Substitutions, ButtonToolTips.SubstitutionsDescEnabled);
@@ -157,6 +160,12 @@ public class GuiImgButton extends GuiButton implements ITooltip {
this.registerApp(16 * 15, Settings.SCHEDULING_MODE, SchedulingMode.DEFAULT, ButtonToolTips.SchedulingMode, ButtonToolTips.SchedulingModeDefault);
this.registerApp(16 * 15 + 1, Settings.SCHEDULING_MODE, SchedulingMode.ROUNDROBIN, ButtonToolTips.SchedulingMode, ButtonToolTips.SchedulingModeRoundRobin);
this.registerApp(16 * 15 + 2, Settings.SCHEDULING_MODE, SchedulingMode.RANDOM, ButtonToolTips.SchedulingMode, ButtonToolTips.SchedulingModeRandom);
this.registerApp(10, Settings.UNLOCK,LockCraftingMode.NONE,ButtonToolTips.LockCraftingMode, ButtonToolTips.LockCraftingModeNone);
this.registerApp(7, Settings.UNLOCK,LockCraftingMode.LOCK_UNTIL_RESULT,ButtonToolTips.LockCraftingMode, ButtonToolTips.LockCraftingUntilResultReturned);
this.registerApp(0, Settings.UNLOCK, LockCraftingMode.LOCK_WHILE_LOW, ButtonToolTips.LockCraftingMode, ButtonToolTips.LockCraftingWhileRedstoneLow);
this.registerApp(1, Settings.UNLOCK, LockCraftingMode.LOCK_WHILE_HIGH, ButtonToolTips.LockCraftingMode, ButtonToolTips.LockCraftingWhileRedstoneHigh);
this.registerApp(2, Settings.UNLOCK, LockCraftingMode.LOCK_UNTIL_PULSE, ButtonToolTips.LockCraftingMode, ButtonToolTips.LockCraftingUntilRedstonePulse);
}
}
@@ -37,6 +37,9 @@ public class GuiNumberBox extends GuiTextField {
final String original = this.getText();
super.writeText(selectedText);
if (this.getText().isEmpty()) {
return;
}
try {
if (this.type == int.class || this.type == Integer.class) {
Integer.parseInt(this.getText());
@@ -0,0 +1,236 @@
package appeng.client.gui.widgets;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiTextField;
import org.lwjgl.input.Keyboard;
/**
* Different implementation of a text field that wraps instead of extends
* MC's {@link GuiTextField}. This is necessary because of deobfuscated name
* collision between {@link ITooltip} and GuiTextField, which would cause
* crashes in an obfuscated environment. Additionally, since we are not extending that
* class, we can construct this object differently and allow its position to be
* mutable like most other widgets.
*/
public class MEGuiTooltipTextField implements ITooltip {
protected GuiTextField field;
private static final int PADDING = 2;
private static boolean previousKeyboardRepeatEnabled;
private static MEGuiTooltipTextField previousKeyboardRepeatEnabledField;
private String tooltip;
private int fontPad;
public int x;
public int y;
public int w;
public int h;
/**
* Uses the values to instantiate a padded version of a text field. Pays attention to the '_' caret.
*
* @param width absolute width
* @param height absolute height
* @param tooltip tooltip message
*/
public MEGuiTooltipTextField(final int width, final int height, final String tooltip) {
final FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
field = new GuiTextField(0, fontRenderer, 0, 0, 0, 0);
w = width;
h = height;
setMessage(tooltip);
this.fontPad = fontRenderer.getCharWidth('_');
setDimensionsAndColor();
}
public MEGuiTooltipTextField(final int width, final int height) {
this(width, height, "");
}
public MEGuiTooltipTextField() {
this(0, 0);
}
protected void setDimensionsAndColor() {
field.x = this.x + PADDING;
field.y = this.y + PADDING;
field.width = this.w - PADDING * 2 - this.fontPad;
field.height = this.h - PADDING * 2;
}
public void onTextChange(final String oldText) {}
public void mouseClicked(final int xPos, final int yPos, final int button) {
if (!this.isMouseIn(xPos, yPos)) {
setFocused(false);
return;
}
field.setCanLoseFocus(false);
setFocused(true);
if (button == 1) {
setText("");
} else {
field.mouseClicked(xPos, yPos, button);
}
field.setCanLoseFocus(true);
}
/**
* Checks if the mouse is within the element
*
* @param xCoord current x coord of the mouse
* @param yCoord current y coord of the mouse
* @return true if mouse position is within the getText field area
*/
public boolean isMouseIn(final int xCoord, final int yCoord) {
final boolean withinXRange = this.x <= xCoord && xCoord < this.x + this.w;
final boolean withinYRange = this.y <= yCoord && yCoord < this.y + this.h;
return withinXRange && withinYRange;
}
public boolean textboxKeyTyped(final char keyChar, final int keyID) {
if (!isFocused()) {
return false;
}
final String oldText = getText();
boolean handled = field.textboxKeyTyped(keyChar, keyID);
if (!handled && (keyID == Keyboard.KEY_RETURN || keyID == Keyboard.KEY_NUMPADENTER
|| keyID == Keyboard.KEY_ESCAPE)) {
setFocused(false);
}
if (handled) {
onTextChange(oldText);
}
return handled;
}
public void drawTextBox() {
if (field.getVisible()) {
setDimensionsAndColor();
GuiTextField.drawRect(
this.x + 1,
this.y + 1,
this.x + this.w - 1,
this.y + this.h - 1,
isFocused() ? 0xFF606060 : 0xFFA8A8A8);
field.drawTextBox();
}
}
public void setText(String text, boolean ignoreTrigger) {
final String oldText = getText();
int currentCursorPos = field.getCursorPosition();
field.setText(text);
field.setCursorPosition(currentCursorPos);
if (!ignoreTrigger) {
onTextChange(oldText);
}
}
public void setText(String text) {
setText(text, false);
}
public void setCursorPositionEnd() {
field.setCursorPositionEnd();
}
public void setFocused(boolean focus) {
if (field.isFocused() == focus) {
return;
}
field.setFocused(focus);
if (focus) {
if (previousKeyboardRepeatEnabledField == null) {
previousKeyboardRepeatEnabled = Keyboard.areRepeatEventsEnabled();
}
previousKeyboardRepeatEnabledField = this;
Keyboard.enableRepeatEvents(true);
} else {
if (previousKeyboardRepeatEnabledField == this) {
previousKeyboardRepeatEnabledField = null;
Keyboard.enableRepeatEvents(previousKeyboardRepeatEnabled);
}
}
}
public void setMaxStringLength(final int size) {
field.setMaxStringLength(size);
}
public void setEnableBackgroundDrawing(final boolean b) {
field.setEnableBackgroundDrawing(b);
}
public void setTextColor(final int color) {
field.setTextColor(color);
}
public void setCursorPositionZero() {
field.setCursorPositionZero();
}
public boolean isFocused() {
return field.isFocused();
}
public String getText() {
return field.getText();
}
public void setMessage(String t) {
tooltip = t;
}
@Override
public String getMessage() {
return tooltip;
}
@Override
public boolean isVisible() {
return field.getVisible();
}
@Override
public int xPos() {
return x;
}
@Override
public int yPos() {
return y;
}
@Override
public int getWidth() {
return w;
}
@Override
public int getHeight() {
return h;
}
}

Some files were not shown because too many files have changed in this diff Show More