Compare commits

...

734 Commits

Author SHA1 Message Date
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
PrototypeTrousers 653557bc65 wip. auto-crafting still broken 2023-01-07 18:25:31 -03:00
PrototypeTrousers dde87448a9 initial patch 2023-01-07 12:37:21 -03:00
TheAirBlow 8c29eeecdc Add support for RecipeStages and ItemStages (#198)
* RecipeStages info in README

* Add support for RecipeStages

* Add support for ItemStages
2022-12-26 09:03:49 -03:00
PrototypeTrousers d852d0c216 bump version 2022-12-10 21:26:55 -03:00
Dane Strandboge f9bb00a7e7 fix patterns not respecting item models and colors... (#193)
when shift key is held and the "output" item in the pattern is rendered instead of the base pattern texture

Consequences:
- The "output" item of the pattern will now be rendered always when shift is held, not just when the TransformType is GUI.
    - This means that you will see the "output" item now for in-world patterns, as well as the rendered model in the player's hand or offhand
    - However, I honestly think this is an improvement from before
2022-12-10 21:17:26 -03:00
PrototypeTrousers 9f7e42ca7d fix lang entry 2022-12-07 20:29:46 -03:00
PrototypeTrousers b76c18fedf fix JEI transfer handler breaking in some instances 2022-12-07 20:29:39 -03:00
PrototypeTrousers 98ce8235bb revert change made to fix nee compat but broke it instead 2022-11-22 20:30:20 -03:00
PrototypeTrousers e1ea4ae22f Revert "restore method name to keep compat with NEE"
This reverts commit c5607bda4e.
2022-11-22 20:29:04 -03:00
PrototypeTrousers 20ba83c529 bump version 2022-11-22 19:11:05 -03:00
PrototypeTrousers 225a4d5ab6 fix items voiding under certain circumstances 2022-11-22 19:04:59 -03:00
PrototypeTrousers bd4f03652e bump version 2022-11-20 14:05:29 -03:00
PrototypeTrousers d6650f9617 Merge remote-tracking branch 'TheAirBlow/AE2-Omnifactory' into AE2-Omnifactory 2022-11-20 14:04:46 -03:00
PrototypeTrousers c5607bda4e restore method name to keep compat with NEE 2022-11-20 14:03:36 -03:00
PrototypeTrousers 11af1f2111 actually sort.. with invTweaks AND bogosort... 2022-11-20 14:00:18 -03:00
TheAirBlow 7748f7c92d Fix #189 + replace curseforge with curse.maven 2022-11-20 19:32:36 +05:00
PrototypeTrousers 801fec3eaa another attempt to fix async item view crashes 2022-11-17 18:22:21 -03:00
PrototypeTrousers de324aad91 rename 9 slot fluid interface texture 2022-11-11 20:51:22 -03:00
PrototypeTrousers 16ccb2ee46 Fix blocks connecting to ME cables. Give boost to chisel facades 2022-11-08 23:05:41 -03:00
PrototypeTrousers bd0d2a1f28 0.54.11 2022-11-08 18:01:39 -03:00
PrototypeTrousers 9abd53a8e8 fix encoded patterns not showing the encoded item in AE GUIs 2022-11-08 18:01:00 -03:00
PrototypeTrousers 1f12fc5e91 synchronizedList must be in a synchronized block when iterating 2022-11-08 18:00:30 -03:00
Yang Xizhi 87fcc6c267 update nbt when accepting result (#180) 2022-11-08 17:46:17 -03:00
PrototypeTrousers e301459dfa bump version 2022-10-29 10:32:16 -03:00
Yang Xizhi bf802f1c6f fix ae fluid inventory fluid exceeding (#174)
* ae fluid inventory fix
2022-10-29 10:31:54 -03:00
Xikaro 7ba4ca6923 External improvements (#166)
* lang

* Update controller_column_lights.png.mcmeta

* energy cell

cells display internal energy storage along the bar

* 3D drive

* drive fix model

* 3D chest

* Update ru_ru.lang

* Update ru_ru.lang

* model fix drive and chest
2022-10-27 20:15:16 -03:00
PrototypeTrousers 53ed861e23 isolate the oversized slots and itemhandlers 2022-10-27 20:13:44 -03:00
PrototypeTrousers 833f8aca2a More damaged item search work. GT tools are so special 2022-10-26 13:29:35 -03:00
PrototypeTrousers 9bcf45b7e2 add a healthy 1 sec delay between JEI transfer updates to avoid horrible
GC pressure
2022-10-25 22:32:53 -03:00
PrototypeTrousers b2847677ed forgot to check the items already in the 3x3 grid 2022-10-24 17:29:25 -03:00
PrototypeTrousers 95845d5a6c 54.4 2022-10-24 17:08:44 -03:00
PrototypeTrousers 286a3631be Merge branch 'mytsag-crystal-fix' into AE2-Omnifactory 2022-10-24 17:08:25 -03:00
PrototypeTrousers 6506301049 fix fluid interfaces / configuration terminal not showing all the slots 2022-10-24 17:05:27 -03:00
PrototypeTrousers 422543f205 check player inv for items that can be used to craft 2022-10-24 16:38:25 -03:00
PrototypeTrousers 1eec160b74 look for damageable items of the same type if substitutions are disabled 2022-10-24 16:09:22 -03:00
PrototypeTrousers de23b62493 some JEI work. missing player inventory check 2022-10-22 00:06:18 -03:00
Yang Xizhi 2b6299f2b0 fix expended pattern terminal can't place item manually (#161) 2022-10-20 16:35:20 -03:00
Yang Xizhi b495c972c4 add dev jar artifacts (#160) 2022-10-20 16:35:11 -03:00
PrototypeTrousers 7722dcc720 bump version. remove dead maven repo 2022-10-19 18:16:44 -03:00
PrototypeTrousers c4d5add5f1 allow part interfaces to be copied 2022-10-19 18:05:04 -03:00
PrototypeTrousers 348e6436b8 fix processing patterns encoding as invalid 2022-10-19 18:00:01 -03:00
PrototypeTrousers 92457ac680 bump version 2022-10-18 23:59:25 -03:00
PrototypeTrousers 9e53737635 Merge branch 'jei-transfer-highlight' into AE2-Omnifactory 2022-10-18 23:58:58 -03:00
PrototypeTrousers 0e0729166f Fix WCT invisible stacksizes, OOB when opening pattern terminal
FIx security station card slot being reaaally off
2022-10-18 23:56:40 -03:00
PrototypeTrousers 15a1e8f150 attempt to fix fluid interfaces capacity desync 2022-10-18 20:51:52 -03:00
PrototypeTrousers b443f1ce57 refactor pattern encoding terminals 2022-10-18 20:48:20 -03:00
PrototypeTrousers 486a68d06b update items while JEI GUI is active 2022-10-18 07:49:25 -03:00
PrototypeTrousers 9b263c5501 add tooltip callback. Paint craftables in blue. middle click to craft
from JEI
2022-10-18 05:20:55 -03:00
PrototypeTrousers daf4910548 start work. 2022-10-17 23:56:59 -03:00
PrototypeTrousers 4f5bdfefe8 bump version 2022-10-17 22:34:37 -03:00
PrototypeTrousers c9f1387098 small fixes to tool tips. allow +1 button to go over maxstacksize 2022-10-17 22:33:42 -03:00
PrototypeTrousers 1f1d6d041a Merge remote-tracking branch 'PrototypeTrousers/AE2-Omnifactory' into AE2-Omnifactory 2022-10-17 21:19:44 -03:00
PrototypeTrousers 403a6e8b4a update gradle deps
Use GTCEu instead of GTCE.
move hwyla dep to cursemaven due to security certificate expiration
2022-10-17 21:19:30 -03:00
PrototypeTrousers 0a0c23c190 fix NPE with the network tool 2022-10-17 21:17:21 -03:00
PrototypeTrousers d28cd798e9 rework gui highlighting for terminals 2022-10-13 15:19:25 -03:00
PrototypeTrousers 3dedb7eefb show network tool inventory on fluid interfaces 2022-10-12 21:25:44 -03:00
PrototypeTrousers ae3295d3c9 allow memory card to copy encoded patterns of interfaces 2022-10-12 20:42:42 -03:00
PrototypeTrousers 4bac5f43db allow interface itemstack handler to accept over sized stacks 2022-10-12 19:10:07 -03:00
PrototypeTrousers 2e9a5dc8ea wip interfaces stacksizes 2022-10-12 04:48:02 -03:00
PrototypeTrousers 9ac4ea4e6e custom serialization of oversized itemstacks.
simple limiting by checking overflow
2022-10-12 04:10:23 -03:00
PrototypeTrousers 601faf5087 encoded pattern render fixes 2022-10-12 04:08:39 -03:00
PrototypeTrousers 88e3df897e limit fluid texture scaling 2022-10-12 03:04:30 -03:00
PrototypeTrousers f57a8cefda replaced the stacksize render with the readable formated 2022-10-12 02:38:07 -03:00
PrototypeTrousers d3fdac2b81 Merge branch 'fluidInterfaceUpgrade' into AE2-Omnifactory 2022-10-12 01:22:30 -03:00
PrototypeTrousers f7be92adcf Upgrade fluid interfaces
9 tanks, with up to 64B/fluid with 2 capacity cards
2022-10-12 01:18:38 -03:00
PrototypeTrousers 53f18f8e80 Merge branch 'fluidConfigTerminal' into AE2-Omnifactory 2022-10-11 22:36:31 -03:00
PrototypeTrousers 770db27777 add recipes 2022-10-11 22:30:54 -03:00
PrototypeTrousers de674f72bd fix fluid search by name 2022-10-11 21:38:18 -03:00
PrototypeTrousers 19747ba1f1 lang, models, textures 2022-10-10 22:25:28 -03:00
PrototypeTrousers 024b5c6503 fix fluid slots offsets 2022-10-10 20:02:22 -03:00
PrototypeTrousers 63dd035c85 works 2022-10-10 19:48:24 -03:00
PrototypeTrousers e611b1fb76 make Enter also set the string on the storage bus gui 2022-10-10 04:14:16 -03:00
PrototypeTrousers 4c8ad87875 fix lang typo ( 4k cell having 16k as name ) 2022-10-05 13:12:29 -03:00
PrototypeTrousers 194d1171f9 bump version 2022-09-30 20:08:39 -03:00
PrototypeTrousers 376bbf7e84 additional security checks to P2P parts 2022-09-30 20:08:08 -03:00
PrototypeTrousers ddfac3a339 return early instead of cancelling 2022-09-30 19:55:35 -03:00
PrototypeTrousers 95d8216992 Fix craft-only export busses also exporting stocked items 2022-09-25 14:37:00 -03:00
PrototypeTrousers 4e2afb297e push security station slots further down to match the GUI 2022-09-25 14:35:52 -03:00
PrototypeTrousers d9588441b0 delay repo view sorting to once per tick 2022-09-25 14:35:13 -03:00
PrototypeTrousers 86a42e970f Merge remote-tracking branch 'LasmGratel/async-itemrepo' into AE2-Omnifactory 2022-09-25 13:52:30 -03:00
Xikaro bdb0ac14c5 Add color lang (#150), Fixes WAILA wrong lang keys 2022-09-25 13:46:33 -03:00
Lasm Gratel 8c735305d7 Speed up ME Terminal search performance by using CompletableFuture 2022-09-20 18:21:57 +08:00
YoungOnion 9011273229 reformatted all src files (#141) 2022-09-17 08:08:02 -03:00
PrototypeTrousers 3328bfcda2 flip a condition 2022-09-15 12:43:25 -03:00
PrototypeTrousers 158d7c6a04 fix GTEU p2p injecting power on the side of the P2P input 2022-09-14 18:50:07 -03:00
brachy84 0085262779 sort terminal by bogosorter sort rules (#138) 2022-09-10 08:37:59 -03:00
PrototypeTrousers 1ed654843c Fix patterns needing to be encoded twice 2022-09-10 08:35:40 -03:00
PrototypeTrousers 6277058167 p2p fixes 2022-09-09 12:49:47 -03:00
PrototypeTrousers 6e6f8d33cd 0.52.5 2022-09-05 15:35:24 -03:00
PrototypeTrousers efb9ab512a minor cleanup 2022-09-05 15:30:28 -03:00
James a9c891f69a added renaming feature with quartz cutting knife 2022-09-05 15:06:46 -03:00
yanxiatao 2ea120e614 add InterfaceConfigurationTerminal Chinese traslate (#133) 2022-08-29 19:46:57 -03:00
PrototypeTrousers 29c18bbf33 fix a dupe bug 2022-08-29 19:46:29 -03:00
PrototypeTrousers 027e8477c2 push down some buttons so the JEI doesnt get cutoff vertically.
ME autocrafting now uses the cached storage list instead of a full simulated network extraction
2022-08-26 17:28:00 -03:00
PrototypeTrousers f8bac0475a more tinkering with JEI exclusion areas 2022-08-25 02:57:39 -03:00
Yang Xizhi 55c527e557 fix scroll bar being rendered wrongly (#130)
* fix scroll bar being rendered wrongly

* tooltip overlap

* fix the first cpu select grid render
2022-08-22 18:43:00 -03:00
PrototypeTrousers 7714f5196e bump version 2022-08-19 11:33:28 -03:00
PrototypeTrousers 430ee8430d apply JEI extra areas to missing GUIs 2022-08-19 11:32:41 -03:00
PrototypeTrousers 2e98ec015c Merge branch 'better-crafting-status' into AE2-Omnifactory 2022-08-19 11:32:13 -03:00
PrototypeTrousers b6955d42b6 Fixes "Device missing channel" when channels are disabled and a ME
controller is present on the network
2022-08-19 11:31:56 -03:00
alongstringofnumbers e696b31013 Remove some commented out code 2022-08-17 16:02:59 -07:00
alongstringofnumbers b84c25e64c Implement Crafting CPU selector widget 2022-08-17 15:54:03 -07:00
PrototypeTrousers 327b26559f bump version 2022-08-15 01:15:03 -03:00
YoungOnion f434688f3a Allow max size of controller to be configurable (#126)
* modifiable max length of a controller in all 3 axis

* added a 1-255 range on the sizes

* fixed values to [1, 63]
2022-08-15 01:13:33 -03:00
PrototypeTrousers 7996c44075 Make ME Controller still usable even without channels on. gives energy
discount. 
Hide channel count from Waila and TOP, if channels are disabled
2022-08-15 01:12:23 -03:00
PrototypeTrousers f5e9df07d4 version 0.53.0 2022-08-12 23:03:50 -03:00
PrototypeTrousers 159a9370c9 Attempt to fix #127 2022-08-12 23:03:02 -03:00
PrototypeTrousers ad5dcf5c97 Merge branch 'cit' into AE2-Omnifactory 2022-08-12 23:01:54 -03:00
PrototypeTrousers 104d6fc34d Implement Interface Configuration Terminal 2022-08-12 23:01:35 -03:00
PrototypeTrousers 40caeec92f JEI Ghost items work, missing some click interactions and GUI work 2022-08-11 04:05:45 -03:00
PrototypeTrousers 119cdbc2c0 missing JEI ghost support 2022-08-11 03:19:13 -03:00
PrototypeTrousers a44c74b0d7 wip 2022-08-09 03:41:31 -03:00
PrototypeTrousers a55dbb061c fix autocrafting logic bug with container items and processing patterns
fix message reporting missing items having their values swapped
2022-08-08 19:06:50 -03:00
PrototypeTrousers 9fdf0345b3 Fix #123 2022-07-20 22:25:19 -03:00
PrototypeTrousers 346f5aeaac fix GTEU energy tax evasion
fix StackOverflow crash
2022-07-20 17:09:56 -03:00
PrototypeTrousers d4b5d0dc26 allow automation insertion "gemCertusQuartz" oredictd items into charger
Fixes #120
2022-07-13 20:11:42 -03:00
PrototypeTrousers d77838146d fix patterns "not extracting" due to acidental dragging
bump version
2022-05-30 23:28:17 -03:00
PrototypeTrousers 5b1f98b2d8 fix expanded processing pattern terminal not refreshing when placing
patterns on the encoding output slot
2022-05-30 22:28:50 -03:00
PrototypeTrousers 1c197c0f20 Fix incorrect with behavior with interfaces and storage busses
while using interfaces with crafting cards
2022-05-15 08:18:59 -03:00
PrototypeTrousers 46a1faaca2 Merge pull request #105 from Xikaro/AE2-Omnifactory
Update ru_ru.lang
2022-05-15 08:17:16 -03:00
PrototypeTrousers dd28b610e1 bump version
last minute fix
2022-05-13 15:04:34 -03:00
Xikaro aa2bb45199 Update ru_ru.lang 2022-05-13 08:18:33 +05:00
PrototypeTrousers 48146af137 Blocking mode for sub-networks 2022-05-12 19:55:38 -03:00
PrototypeTrousers 582d7f140c bump version 2022-05-09 14:18:10 -03:00
PrototypeTrousers ffdc052d99 fix last facade on off hand deleting the item on the main hand when used
fixes #101
2022-05-09 14:15:10 -03:00
PrototypeTrousers de7d6321f0 Merge pull request #102 from TechLord22/dust_texture_fix
Fix Misaligned Dust Textures
2022-05-09 14:14:49 -03:00
tech22 235eef23e3 fix misaligned dust textures 2022-05-08 14:51:16 -04:00
PrototypeTrousers c7fcdf7d8b small tweaks to the crafting amount gui
number starts selected if want to override the default of 1.
keypad enter also works to start craft
2022-04-28 22:57:22 -03:00
PrototypeTrousers 3a6ab149e4 Merge pull request #100 from GTModpackTeam/fix-japan-lang
fix ja_JP.lang
2022-04-28 22:43:30 -03:00
tier940 9337eceb82 [fix] lang record & SearchMode 2022-04-28 20:53:27 +09:00
PrototypeTrousers 35f91bf0d0 reduce packets sent while dragging items around in GUIs 2022-04-25 12:10:41 -03:00
PrototypeTrousers 6d14d082b0 hold items inplace 2022-04-25 12:09:29 -03:00
PrototypeTrousers 98ad919f1b items oredicted "crystalCertusQuartz" can go into the charger
and change to ae2 charged certus quartz
2022-04-15 15:42:35 -03:00
PrototypeTrousers fb4af262b7 Merge pull request #88 from Mr-Ao-Dragon/AE2-Omnifactory
Update zh-cn lang file.
2022-04-15 14:27:10 -03:00
PrototypeTrousers 5f774749e8 Merge pull request #94 from GTModpackTeam/add-japanese-lang
Japanese translation files
2022-04-15 14:26:58 -03:00
PrototypeTrousers 81b3ff6976 fix autocrafting with substitute crafting option enabled 2022-04-13 15:38:47 -03:00
PrototypeTrousers c8698fc2bf enable controller and smart cables registration, even with channels off 2022-04-12 17:39:20 -03:00
PrototypeTrousers be9fb6d04c try to hold hold items in place while extracting holding down shift 2022-04-11 23:51:03 -03:00
PrototypeTrousers 90ca2c7e92 Fix condenser not creating new items after item extraction without
inserting new items
reworked pattern terminal and crafting terminal search expression matching
2022-04-11 15:15:29 -03:00
PrototypeTrousers 39ac308889 wip 2022-04-11 05:13:16 -03:00
PrototypeTrousers 4d268b97a9 cache itemstack on export bus 2022-04-11 03:50:33 -03:00
PrototypeTrousers 4b6fbf68b6 Added config for auto crafting of substitutions
Change missing items information to a packet (missing localization stuff yet)
2022-04-11 02:00:31 -03:00
PrototypeTrousers a289dec832 fix crash with GTCEu 2.2 and higher 2022-04-06 14:34:37 -03:00
PrototypeTrousers a4f50ea9ef actually fixes 2022-04-04 08:25:11 -03:00
PrototypeTrousers 0e8f7c9d03 added packets for missing items report 2022-04-04 03:57:04 -03:00
PrototypeTrousers 7c0935f447 fix (?) weird substitution items on crafting tree 2022-04-04 03:20:21 -03:00
PrototypeTrousers 1e9e8d2639 more checks if "gregtech" mod is loaded 2022-03-31 21:16:14 -03:00
tier940 3455e815b8 [fix] Rename crafting_accelerator 2022-03-29 16:50:38 +09:00
tier940 a08e61b818 [fix] lang table 2022-03-29 16:39:47 +09:00
PrototypeTrousers 19c6e2ff2d support for IC2 damageable items 2022-03-27 08:52:37 -03:00
PrototypeTrousers 4f25c1551b increase internal buffer of ME Chest
Fix item amount not refreshing when inserted/extracted
2022-03-27 08:10:02 -03:00
PrototypeTrousers 3b94e9420d fix NPE with ae2fc and blocking mode 2022-03-25 23:46:52 -03:00
PrototypeTrousers f30f334a23 move nonblocking call out of method used by ae2fc coremod 2022-03-24 23:25:28 -03:00
tier940 ed702a5c73 [fix] タイポ 2022-03-18 22:20:43 +09:00
tier940 1364117374 [update] change to latest 2022-03-18 21:52:43 +09:00
tier940 ed4b864ba2 [add] Japanese lang file 2022-03-17 18:24:48 +09:00
PrototypeTrousers 706e577dab Fix container item crafting (again)
avoid making some copies
fix crash without JEI
2022-03-16 00:52:38 -03:00
PrototypeTrousers ccc8486571 check if gregtech is loaded before checking for MetaTools 2022-03-12 22:36:22 -03:00
PrototypeTrousers 3e8440644e fix autocrafting with container items 2022-03-12 22:21:04 -03:00
PrototypeTrousers 50f4e08b64 Merge remote-tracking branch 'origin/AE2-Omnifactory' into AE2-Omnifactory 2022-03-12 17:27:17 -03:00
PrototypeTrousers cfa9fa2843 invalidate cached itemstack if its gonna be used in a real insertion 2022-03-12 17:14:37 -03:00
PrototypeTrousers 47f819e021 invalidate cached itemstack if its gonna be used in a real insertion 2022-03-12 11:03:04 -03:00
MrAoDragon e67b196e19 update zh-cn lang file 2022-03-12 17:34:14 +08:00
PrototypeTrousers 6d151bb890 GTCEu blocking mode fix 2022-03-11 23:11:52 -03:00
PrototypeTrousers 3305270a71 clean-up 2022-03-11 22:04:58 -03:00
PrototypeTrousers f824bfd2e1 small optimization 2022-03-10 21:35:18 -03:00
PrototypeTrousers 036f4e1c5b heavily tweaked auto-crafting 2022-03-09 23:14:02 -03:00
PrototypeTrousers 146d3f5628 fix fluid dupe 2022-03-06 08:24:29 -03:00
PrototypeTrousers 9c821cb015 cleaning 2022-03-05 23:29:20 -03:00
PrototypeTrousers 3a83c99b1f fix container items return properly 2022-03-05 11:15:32 -03:00
PrototypeTrousers 447c6debab account for interfaces priority affecting which items are extractable 2022-03-04 22:49:55 -03:00
PrototypeTrousers 50470ae3cf version 2022-03-04 21:44:58 -03:00
PrototypeTrousers 993be652c9 delay container item return when simulating crafting tree 2022-03-04 21:30:26 -03:00
PrototypeTrousers b3bfbd0b58 remove debugging log 2022-03-04 17:08:23 -03:00
PrototypeTrousers 49b3dc8b60 undo partially pattern cache rebuild optimization
enabled pattern substitution now can use substitute patterned items
2022-03-03 22:25:10 -03:00
PrototypeTrousers 71ffcfb839 JEI transfer handler OutOfBounds fix 2022-03-01 13:02:09 -03:00
PrototypeTrousers 73f76a6654 clean up 2022-02-28 23:30:52 -03:00
PrototypeTrousers 645de1d868 Merge branch 'craftingtree-tweaks' into AE2-Omnifactory 2022-02-28 23:17:21 -03:00
PrototypeTrousers 8f40478695 version 2022-02-28 23:16:53 -03:00
PrototypeTrousers 056fcc3818 switch to extractable instead of cached item list 2022-02-28 23:16:53 -03:00
PrototypeTrousers 0ed0eb9d5f better logging 2022-02-28 23:16:49 -03:00
PrototypeTrousers 3ddc846648 Merge branch 'craftingtree-tweaks' into AE2-Omnifactory 2022-02-28 23:06:11 -03:00
PrototypeTrousers f98f6ef852 misc cleaning 2022-02-28 22:57:35 -03:00
PrototypeTrousers 4192d721a0 only fire simulation if a player requested it 2022-02-28 21:25:33 -03:00
PrototypeTrousers a0f3ef9d86 cut crafting tree earlier if ingredients are available 2022-02-28 21:25:13 -03:00
PrototypeTrousers 6b29288de6 remove crafting penalties 2022-02-28 00:13:07 -03:00
PrototypeTrousers 285fc6314c small optimization to crafting tree 2022-02-27 23:04:29 -03:00
PrototypeTrousers 50fd83e96b adjust default blocking mode settings 2022-02-25 00:09:33 -03:00
PrototypeTrousers cc51138a6a blocking mode changes again
misc cleaning
2022-02-24 23:54:50 -03:00
PrototypeTrousers 918df0bf7f clean up 2022-02-22 23:55:52 -03:00
PrototypeTrousers c852199901 bump version 2022-02-22 22:55:44 -03:00
PrototypeTrousers fd95d3de47 fixed typo gtceu -> gteu 2022-02-22 22:37:28 -03:00
PrototypeTrousers c3dd6dabe1 fix blocking mode again... 2022-02-22 22:11:57 -03:00
PrototypeTrousers b0e81ac2d1 fix blocking mode somehow voiding items 2022-02-22 19:40:15 -03:00
PrototypeTrousers 30f4cdf545 attempt at pattern rebuild optimization 2022-02-22 00:02:17 -03:00
PrototypeTrousers ee9441474e tweak cache reset on interface config 2022-02-21 18:25:58 -03:00
PrototypeTrousers 8846202270 More itemstacks caching
Micro optimization on molecular assemblers
2022-02-21 15:11:16 -03:00
PrototypeTrousers 17a900ae9a actually return if a crafting job is running 2022-02-19 23:03:33 -03:00
PrototypeTrousers 66bc243b41 cache more itemstacks 2022-02-19 23:02:40 -03:00
PrototypeTrousers a2bda8f449 tile fluid textures on fluid interfaces properly 2022-02-17 20:15:29 -03:00
PrototypeTrousers a2c2a4df0f oops, add integrated circuit to default non blocking items 2022-02-15 19:33:56 -03:00
PrototypeTrousers b4e237244a fix interfaces with crafting cards attached to storage bus not working
add missing buttons to oredict storagebus
2022-02-14 17:15:51 -03:00
PrototypeTrousers b541ad8d18 misc cleaning
add lenses to non blocking list
2022-02-10 20:15:58 -03:00
PrototypeTrousers 64f29a7dba make it work 2022-02-10 17:59:03 -03:00
PrototypeTrousers 6d25b7ef3c reworked blocking mode. now items are configurable per mod 2022-02-09 22:15:44 -03:00
PrototypeTrousers c3a608ef59 fix export busses exporting items out of nowhere 2022-01-31 16:51:06 -03:00
PrototypeTrousers af1f5c34d2 fix npe when placing down an ore dict storage bus 2022-01-30 17:19:01 -03:00
PrototypeTrousers f5378e060e fix importing from storage drawers 2022-01-29 17:21:12 -03:00
PrototypeTrousers 47407acc42 backport of #5823 - try emptying interfaces first before handling crafting jobs 2022-01-29 17:03:15 -03:00
PrototypeTrousers d7f3428824 fix for infinite loop while loading 2022-01-24 13:19:31 -03:00
PrototypeTrousers 63e339b88b cache itemstacks more aggressively 2022-01-24 13:17:50 -03:00
PrototypeTrousers 98761809fd add the patterns inside the terminal to the drop list of the terminal 2022-01-23 23:08:47 -03:00
PrototypeTrousers 8cb013b686 versioning 2022-01-22 23:19:49 -03:00
PrototypeTrousers f2fe376982 Merge pull request #74 from Syrcan/GTEU-fix
GTEU input fix
2022-01-22 23:06:39 -03:00
Syrcan 603452de1f GTEU input fix 2022-01-22 10:11:23 +01:00
PrototypeTrousers 40bd96d21c tweak crafting job size again
null check
2022-01-21 18:12:18 -03:00
PrototypeTrousers a14d160a07 Reworked oredict storage bus
have a recipe now
expression matcher and validator from GTCEU by brachy84
2022-01-20 22:43:18 -03:00
PrototypeTrousers df28a5520f fix mod name
implement GTCEU Energy adapter
2022-01-20 20:02:26 -03:00
PrototypeTrousers 0d096944cc Merge branch 'gtceu-p2p' into AE2-Omnifactory 2022-01-20 17:48:07 -03:00
PrototypeTrousers 963d3414d8 update version
more of renaming mod
2022-01-20 17:46:07 -03:00
PrototypeTrousers 4414451f5e more gtceu p2p fixes 2022-01-20 17:05:21 -03:00
PrototypeTrousers e0ddb92b81 attune gtce p2p with cables 2022-01-20 13:28:08 -03:00
PrototypeTrousers 6f551ad67f wip gtceu p2p 2022-01-20 00:04:04 -03:00
PrototypeTrousers fd3349614d fix terminal crashing and not cleaning leftovers of larger recipe patterns 2022-01-11 11:23:40 -03:00
PrototypeTrousers 903f211044 fix crash while configuring fluid storage bus 2022-01-10 03:17:46 -03:00
PrototypeTrousers 78e1e26a11 Fix issues with the expanded pattern terminal and its patterns crafting 2022-01-05 21:36:49 -03:00
PrototypeTrousers 2a6de11597 update version 2022-01-04 17:08:55 -03:00
PrototypeTrousers cd2b53af85 Cherry-picked 5554ba903e74c2980b2e395c78555b40fc379e80
Be more lenient with extended block states being passed by other mods.
2022-01-04 17:01:55 -03:00
PrototypeTrousers 1c5565491a finish oredict storage bus 2022-01-03 13:16:27 -03:00
PrototypeTrousers 311cc5c6f6 more oredictbus work 2022-01-03 11:32:48 -03:00
PrototypeTrousers 41796449ed cache oredict filter list 2022-01-03 10:47:35 -03:00
PrototypeTrousers 9eef9d3840 partial implementation of oredict storage bus
missing proper GUI, text, item models, memorycard support.
logic works
2022-01-03 02:33:08 -03:00
PrototypeTrousers 13afa6908a implement expanded processing pattern terminal 2022-01-02 18:27:41 -03:00
PrototypeTrousers 103438f805 do full reset level emitter on stack update 2021-12-13 02:02:02 -03:00
PrototypeTrousers eaa01f7648 flip some boolean so craftables actually show up 2021-12-10 20:26:29 -03:00
PrototypeTrousers e81fb09599 when in off-hand, memory card wild paste as input 2021-12-10 14:02:56 -03:00
PrototypeTrousers 94d73aec7c wwww 2021-12-09 23:34:57 -03:00
PrototypeTrousers b51af43dba item/fluid count changes.. again 2021-12-07 21:10:04 -03:00
PrototypeTrousers 85dc8ae7c1 item costs/ghost fixes 2021-11-29 00:50:32 -03:00
PrototypeTrousers c34176f392 fix (?) item desync issues 2021-11-23 20:25:05 -03:00
PrototypeTrousers 76fe2175a0 moved p2p forge event to an upper class
add an extra update after the network has finished booting
2021-11-15 00:09:04 -03:00
PrototypeTrousers c5d33ed892 p2p fixes redton, light, items 2021-11-11 20:54:40 -03:00
PrototypeTrousers b423d99879 tweak crafting byte costs 2021-11-02 17:56:12 -03:00
PrototypeTrousers 81156b411d version 2021-11-02 15:34:45 -03:00
PrototypeTrousers 6be1660d41 Merge branch 'item-issues' into AE2-Omnifactory 2021-11-02 15:34:02 -03:00
PrototypeTrousers 304f394497 cut crafting tree earlier if the item is available
fix job byte size to 8 per crafting + 1 per item used/stored
2021-11-02 15:33:14 -03:00
PrototypeTrousers 50f21125c8 log if non-patterned items go missing before starting a craft 2021-11-02 02:00:01 -03:00
PrototypeTrousers 30b85bd239 potential fix for showing proper item names when failing to start craft 2021-11-01 23:23:45 -03:00
PrototypeTrousers 9ce00d338f only try to extract if its already in the cache 2021-10-29 17:04:24 -03:00
PrototypeTrousers 11f5b71089 update directly instead of relying on forge events 2021-10-29 15:14:33 -03:00
PrototypeTrousers e7da72163b backported #5349 2021-10-29 15:13:46 -03:00
PrototypeTrousers 6d7c65dd70 potential fix for an infinite loop while adding nodes 2021-10-29 14:09:19 -03:00
PrototypeTrousers 5e21101619 n-to-n p2p
network monitor checks nesting by action source
2021-10-28 23:49:16 -03:00
PrototypeTrousers 3db8d0185f fix security terminal and portable cell stored items not showing 2021-10-23 17:56:15 -03:00
PrototypeTrousers 2f5ecfe638 energy fixes 2021-10-22 15:37:08 -03:00
PrototypeTrousers 75843e802d WIP 2021-10-21 12:22:00 -03:00
PrototypeTrousers e41b6943aa fix swapping cells giving wrong item/fluid count 2021-09-28 23:29:52 -03:00
PrototypeTrousers 92347ad2f5 fix looping item count and hopefully energy issues 2021-09-26 22:07:16 -03:00
PrototypeTrousers 517bd77df7 yet another try at energy issues
fix requesters not being added to the energy grid


partially revert the energy 'fixes'


potential desync on item count


energy and items change
2021-09-17 00:09:49 -03:00
PrototypeTrousers 19f928a9a5 fluid pass 2021-09-13 04:22:52 -03:00
PrototypeTrousers 73251a0fe5 more item count changes.... 2021-09-13 02:10:28 -03:00
PrototypeTrousers 9335daff7d Revert "fixes item showing incorrect amounts"
This reverts commit 618e9390c6.
2021-09-11 22:48:45 -03:00
PrototypeTrousers cc5377d53b fluid storage bus handler cache tweaks and simplify energy cache 2021-09-06 23:51:32 -03:00
Salomão 059f20d801 yet another try at fixing power issues 2021-09-05 20:28:37 -03:00
Salomão d229570495 try to fix energy issues again
fix issue with voiding p2p parts when shift-right clicking with a memory card
2021-09-04 18:59:46 -03:00
PrototypeTrousers c284748b6c fix p2p not updating properly on memory card loading 2021-09-02 20:42:02 -03:00
PrototypeTrousers 880a9c8821 another case of wrong item count caused by weak reset logic overriding
a full reset needed
2021-09-01 16:11:45 -03:00
PrototypeTrousers c68c02ef3b more cases of wrong item counting fixed 2021-08-26 22:03:23 -03:00
PrototypeTrousers 89c4d2736c borrowed some fancy, colored, fluid rendering from gregicality
thank you @Yefancy
2021-08-23 22:35:26 -03:00
PrototypeTrousers 01778794e5 try to fix #51 2021-08-22 23:59:02 -03:00
PrototypeTrousers 8f2a06e457 fix #49. you can now actually clear storage and conversion monitors 2021-08-20 23:26:33 -03:00
PrototypeTrousers 2d71b75019 actually fix it 2021-08-17 07:46:47 -03:00
PrototypeTrousers 9f09cd04d4 enforce cache reset of storage bus attached to interfaces were configs
changed
2021-08-16 21:55:35 -03:00
PrototypeTrousers b041fae0d5 fix storage/monitors wrong item count and interactions 2021-08-16 19:26:25 -03:00
Salomão c466a0e00e fix items in level emitters with crafting cards not showing up 2021-08-14 09:44:47 -03:00
PrototypeTrousers 618e9390c6 fixes item showing incorrect amounts 2021-08-13 00:17:53 -03:00
PrototypeTrousers 9a71bfb0f0 hash drawers handler by the amount of slots 2021-08-10 09:06:18 -03:00
PrototypeTrousers 9680123906 fix JEI targeting disabled slots as valid 2021-08-06 06:25:12 -03:00
PrototypeTrousers 87730894e9 Update CHANGES.md 2021-08-05 21:36:49 -03:00
PrototypeTrousers 71c944daea fix fluid storagebus NPE crash 2021-08-04 20:49:38 -03:00
PrototypeTrousers e96b4a698a fluid containers can now be drained/filled from fluid interfaces 2021-08-04 19:38:00 -03:00
PrototypeTrousers 1d5465a4b8 partially revert fda8c8 2021-08-04 09:28:47 -03:00
PrototypeTrousers 09cbfe96d6 fix NPE when configuring storage busses 2021-08-01 17:36:23 -03:00
PrototypeTrousers cbdad7c58e hopefully fix storage busses for good
1
2021-07-31 23:05:59 -03:00
PrototypeTrousers 6be96956a9 small optimization to import/export busses 2021-07-30 23:26:42 -03:00
PrototypeTrousers e376e002e9 actually fix #43 ? .... 2021-07-30 07:51:57 -03:00
PrototypeTrousers 0b9df31d4e fix broken recipes resulting in item dupes 2021-07-28 19:46:42 -03:00
PrototypeTrousers cef6dbf0d7 fix copy-paste error in the fluid storage bus constructor 2021-07-27 19:32:59 -03:00
Salomão e4af7b1947 fix adapters insert-only mode still reporting items 2021-07-27 12:51:24 -03:00
Salomão 6eadb8f861 fix IO-Port transfer stopping too soon 2021-07-27 11:10:45 -03:00
PrototypeTrousers b6b6a83563 do the same for fluid storage bus 2021-07-26 20:34:15 -03:00
PrototypeTrousers 32ab4c6af4 Merge remote-tracking branch 'PrototypeTrousers/AE2-Omnifactory' into AE2-Omnifactory 2021-07-26 18:25:24 -03:00
PrototypeTrousers fda8c87410 attempts to fix #42 and #43 2021-07-26 18:25:08 -03:00
PrototypeTrousers 389e060707 Merge pull request #41 from BalaM314/patch-1
Fix #27
2021-07-23 10:40:01 -03:00
BalaM314 0942a90ef4 Fix #27
Not sure exactly what method is causing a crash, but added a catch to just say it is located in another dimension
2021-07-23 15:11:07 +05:30
PrototypeTrousers 8cef06512a restore breaking API change 2021-07-22 21:50:56 -03:00
PrototypeTrousers 8e4658be20 fix power not going to sub-networks
renamed variables
2021-07-18 17:52:01 -03:00
PrototypeTrousers 0bd2bd6b5a dont pause main thread when calculating 2021-07-17 22:15:54 -03:00
PrototypeTrousers db2c4c4325 ensure the local energy cache is iterated last 2021-07-17 22:11:11 -03:00
Salomão ac793ee847 Merge branch 'delta' into AE2-Omnifactory 2021-07-17 14:48:22 -03:00
Salomão 6404f26cca Merge remote-tracking branch 'origin/fluid-terminal-multiple-containers' into AE2-Omnifactory 2021-07-16 14:22:21 -03:00
Salomão ced6ad865c re-introduce time-based calculation quota
player initiated crafting calculation is not affected
2021-07-16 14:22:09 -03:00
Salomão 24750f00b1 reworked how changes are propagated in the network 2021-07-16 14:13:48 -03:00
Salomão df08ce0513 Fluid terminal is now able to fill/empty stacked tanks 2021-07-04 10:28:36 -03:00
Salomão f9c274fb48 Reduce power flickering by increasing energy polling rate
in testing 84 dense cells could sustain MAX Integer on a FE p2p pair
2021-06-27 23:17:26 -03:00
Salomão 3582582e3f fix off-by-one voiding patterns when removing expansion cards 2021-06-26 10:25:47 -03:00
Salomão 6de48f8541 fixes #34
getAllIngredients() can contain nulls
2021-06-26 07:31:16 -03:00
Salomão 5a2c2d06d3 make pattern expansion recipe shapeless 2021-06-24 22:34:21 -03:00
Salomão 98d3cafdfd Merge branch 'oredictfixes' into AE2-Omnifactory 2021-06-23 10:19:02 -03:00
Salomão 904de49543 wip
fix substitution crafting, for real this time
wip 2


wip. still has NBT issues


fix semantic changes


fix interface with free slots on interface terminal


Auto stash before cherry pick of "fix interface with free slots on interface terminal"
2021-06-23 10:16:59 -03:00
Salomão b0772bf94c backport 223163aa0a
fixes #32
2021-06-21 22:48:25 -03:00
Salomão aa5d5e3623 set idle power usage of expanded interface to a power of four 2021-06-21 16:25:26 -03:00
Salomão 42f4ef2855 tweak GUIs 2021-06-21 15:54:40 -03:00
Salomão 3eb2582f29 Merge branch 'bigger-interfaces' into AE2-Omnifactory 2021-06-21 15:22:13 -03:00
Salomão 307f86ded8 increase AE energy polling rate from once every 90 to once every 3 ticks 2021-06-18 12:48:01 -03:00
Salomão 56f57e18a5 Merge branch 'wip' into AE2-Omnifactory 2021-06-17 23:32:34 -03:00
Salomão eab695b692 try to not void fluids in fluid terminal when running out of power 2021-06-17 23:32:16 -03:00
Salomão 0fb393820b half-undo wip 2021-06-17 00:07:06 -03:00
Salomão 01fe5c7a8b jei transfer tweaks..again 2021-06-16 19:22:52 -03:00
Salomão 8468b47443 workaround for damaged tools and gtce tools not being set as damageable 2021-06-15 12:46:44 -03:00
Salomão 6cb583c918 clear old NBT from cells 2021-06-15 12:41:51 -03:00
Salomão d69395a117 cache fixes 2021-06-14 12:57:49 -03:00
Salomão 59effe8131 save NBT properly 2021-06-14 11:51:17 -03:00
Salomão 6f42876963 Merge branch 'fastutil' into AE2-Omnifactory 2021-06-14 10:54:12 -03:00
Salomão 08952b48dd backported fastutil implementation of the item list 2021-06-14 10:53:50 -03:00
Salomão e3c9c4ce65 clear cells of craftable status
remove unsupported removal call
2021-06-14 10:20:58 -03:00
Salomão 7b91da58c0 resolve suspicious calls 2021-06-14 02:33:43 -03:00
Salomão 26c06bca15 fix IO-Port copying craftable boolean 2021-06-14 02:33:23 -03:00
Salomão 4458bd28ab refresh ETA not only when items are crafted 2021-06-13 20:30:52 -03:00
Salomão df3f00d978 try to fix remaining concurrent modifications to energy grid 2021-06-13 20:29:56 -03:00
Salomão 18ae994ee4 try to avoid CME by copying FE p2p outputs before iterating
backported 1c88ea7b78 and attempt to fix #25 with feedback
2021-06-10 21:13:41 -03:00
Salomão 47888b5546 reworked Adapter caches ( storage busses ) 2021-06-09 16:31:49 -03:00
Salomão e18593feb5 fix pattern inventory size mismatch 2021-06-08 23:46:37 -03:00
Salomão af4c3de55e fix client desync 2021-06-08 23:23:12 -03:00
Salomão bea29331a3 implement pattern expansion cards for interfaces
Maximum of 4 rows
Uses 4x the previous tier for crafting operations (4 rows = 64 interfaces consumption)
2021-06-08 23:23:12 -03:00
Salomão 9b9579b358 storage drawer cache optimisation 2021-06-08 23:22:00 -03:00
Salomão 52da4f9528 fix shift-clicking patterns from pattern slot sometimes voiding them 2021-06-05 18:54:26 -03:00
Salomão 50aac2c768 send the player a message if the crafting job succeeds on simulation
but fails on real extraction
2021-06-02 23:46:35 -03:00
Salomão 33946438bd fix JEI ghost fluids not working for filtering fluid storage bus 2021-05-30 13:40:21 -03:00
Salomão 9372cb2f14 Merge remote-tracking branch 'PrototypeTrousers/AE2-Omnifactory' into AE2-Omnifactory 2021-05-29 20:13:43 -03:00
Salomão 00037ace77 Blank Pattern Slot has priority when shift clicking blank patterns 2021-05-29 16:48:59 -03:00
PrototypeTrousers e13af643ba Update CHANGES.md 2021-05-29 14:32:51 -03:00
PrototypeTrousers ffcfd809d8 Add files via upload 2021-05-29 14:32:23 -03:00
Salomão 7c10a6b883 fix damaged tools not being selected for JEI recipe transfer 2021-05-27 17:15:19 -03:00
Salomão c2bddc30c4 fix NPE transfering recipes without an actual output 2021-05-26 16:09:40 -03:00
Salomão 024655f84d fix fluid terminal not having a recipe 2021-05-24 15:42:25 -03:00
Salomão 589e48ac01 restore depth on highlight
fixes #21
2021-05-23 18:14:07 -03:00
Salomão 43d3a2c1c0 add dimension info to the interface highlighting
implements #20
2021-05-23 17:46:28 -03:00
Salomão c432fa7200 automatically change between crafting/processing recipes on jei transfer 2021-05-23 01:06:39 -03:00
Salomão cc744ab8b9 Revert "level emitter changes"
This reverts commit 9d6026635d.
2021-05-17 21:11:08 -03:00
Salomão 8fe4229a8e add extra checks 2021-05-17 00:27:53 -03:00
Salomão 3f86884965 fix GTCE blocking mode 2021-05-16 23:28:05 -03:00
Salomão 1319ec79c9 allow GTCE blocking mode to work through phantom faces 2021-05-16 13:30:27 -03:00
Salomão 31a3afc18b revert inventory merging code to keep compatibility with ae2fc 2021-05-14 12:43:34 -03:00
Salomão 9d6026635d level emitter changes 2021-05-13 19:32:03 -03:00
Salomão 39038ac935 revert iitemrepository cache changes 2021-05-12 23:22:54 -03:00
Salomão 4f627b234c invert comparison 2021-05-12 03:26:12 -03:00
Salomão 6180c188e6 Revert "remove crafting failure penalty"
This reverts commit 0240a5d76a.
2021-05-12 02:42:34 -03:00
Salomão 7ada6d18ee small optimizations 2021-05-12 00:19:55 -03:00
Salomão f493767243 fix out of bounds crash 2021-05-09 22:00:20 -03:00
Salomão ba4cdbcb85 fix #16 2021-05-09 10:59:31 -03:00
Salomão f3877aa1ec Merge branch 'iir-cache' into AE2-Omnifactory 2021-05-08 22:46:56 -03:00
Salomão 366b31b3aa import bus optimization 2021-05-08 22:11:13 -03:00
Salomão 533fb5c34b initial test 2021-05-08 19:40:58 -03:00
Salomão 62d1d904c6 update item cache directly on insert/removal
import bus fails faster and throttles down when inventory is full
2021-05-08 19:08:21 -03:00
Salomão 03fb43db16 revert blocking mode to previous implementation 2021-05-05 19:45:25 -03:00
Salomão 9576bec855 renamed method. fixed round robin while blocking mode on 2021-05-04 22:51:20 -03:00
Salomão b5da6730a1 loop optimization 2021-05-04 15:15:09 -03:00
Salomão 039bab4811 drop items waiting to be injected when interface is broken 2021-05-04 11:07:31 -03:00
Salomão 4b5bdf9893 fix NPE 2021-05-04 10:57:01 -03:00
Salomão 3c3c23712d Merge branch 'rr-interfaces' into AE2-Omnifactory 2021-05-03 21:38:43 -03:00
Salomão af91c04ea1 re - implement blocking mode 2021-05-03 21:34:59 -03:00
Salomão 0240a5d76a remove crafting failure penalty 2021-05-03 21:09:03 -03:00
Salomão 0c0aafba2f make ItemSlots copy-able 2021-05-03 21:07:51 -03:00
Salomão b541025738 implement patterned input-based blocking mode
remove GTCE-specific handler and adaptor
2021-05-03 21:07:12 -03:00
Salomão 62f842d4ef visit crafting mediums in round-robin 2021-05-03 21:05:14 -03:00
Salomão fc154d8568 remove slotless capability implementation from inventory adaptor
affects  interface,import and export busses
2021-05-03 21:00:35 -03:00
Salomão 4641e48529 push patterns in round-robin 2021-04-30 12:20:36 -03:00
Salomão 0fae87afc7 allow left clicking on bookmarked items on GUIs without fake slots 2021-04-26 23:53:43 -03:00
Salomão ee1b6bb0d7 Add bookmarked ghost items support
fixed fluid dragging not working on servers
2021-04-18 21:01:09 -03:00
Salomão 36ca8b9f0a JEI Bookmark dragnDrop 2021-04-15 22:58:57 -03:00
Salomão 9c94c7342b Merge branch 'JEI-drag-phantom-items' into AE2-Omnifactory 2021-04-14 21:46:40 -03:00
Salomão 399d67b42c made jei recipe transfer more strict when keeping items on the table
few cleanup
2021-04-14 21:37:06 -03:00
Salomão 10761a1e9d missing click cancel 2021-04-14 00:04:07 -03:00
Salomão d1ddf53d99 wip 2 2021-04-13 14:54:52 -03:00
Salomão f776b4d548 wip 2021-04-13 12:36:20 -03:00
Salomão 41180792e1 Cellworkbench acts weird
missing bookmark dragging
2021-04-12 23:51:49 -03:00
Salomão 2269c05d98 implement #14
also fix tooltip position
2021-04-10 09:46:48 -03:00
Salomão 63616e5730 try fix #13 2021-04-10 09:30:44 -03:00
Salomão 6ca3e6e696 add tooltip to fluid level emitter number box 2021-04-05 00:11:30 -03:00
Salomão a4b5cfc3b9 fix lightning issue while tooltip is showing on interface terminal 2021-04-04 22:17:14 -03:00
Salomão 38b0a7a153 handle interface slots serverside 2021-04-04 01:29:27 -03:00
Salomão aa4863a979 Added Fluid support for the Storage Monitor and Conversion Monitor
Highlighted interfaces is turned off after switching dimensions
2021-04-02 08:31:14 -03:00
Salomão 44c7a46315 fix advancements not triggering 2021-04-02 08:29:32 -03:00
PrototypeTrousers c3b1dea7c5 better level emitting 2021-03-31 17:34:43 -03:00
Salomão 40ec517480 level emitters cache rework 2021-03-30 23:05:15 -03:00
Salomão 2fdc16d3a8 Merge remote-tracking branch 'ALongStringOfNumbers/recipeConditions' into AE2-Omnifactory 2021-03-30 21:58:46 -03:00
Salomão 053485a95a another try at fixing level emitters 2021-03-30 21:57:53 -03:00
ALongStringOfNumbers e910af7734 Fix advancements to check if their parent item is enabled to prevent more logging 2021-03-30 15:36:25 -07:00
Salomão 59d7bd6c16 JEI recipe transfer fixes
re-checks the amount of items in the recipe
only do fuzzy search for damageable items
2021-03-29 21:20:46 -03:00
Salomão 1a11462ddd can now drag encoded patterns on the interface terminal 2021-03-29 01:53:59 -03:00
Salomão 77d615559f Add proper button and tooltips to interface terminal 2021-03-28 16:20:37 -03:00
ALongStringOfNumbers 6878bfa4b0 Fix parts 2021-03-27 01:26:29 -07:00
ALongStringOfNumbers f1d50eca1a More minor fixes 2021-03-26 22:10:24 -07:00
ALongStringOfNumbers 4ee32dd0b0 Fix some recipes not showing up due to bad conditions 2021-03-26 21:48:03 -07:00
ALongStringOfNumbers 66e589324a Make recipes and advancements conditional
Fix crash when fluix was disabled
2021-03-26 19:12:49 -07:00
Salomão 362b001cb4 level emitter dying fix 2021-03-25 22:48:42 -03:00
Salomão b6fd4b3c0f changed priority of JEI items on the 2021-03-23 22:23:58 -03:00
Salomão e364603a5a Changed level emitters to update only once when they tick 2021-03-17 21:35:26 -03:00
Salomão c58bebc346 Fix gregtech tileentities showing up as unnamed or draconium lens 2021-03-07 23:59:39 -03:00
Salomão 97f11f0c61 Fix storage drawers showing up as nothing on interface terminal 2021-03-07 23:56:52 -03:00
Salomão 5c2fa72f95 mix pattern terminal multiplying items above maxitemstack size 2021-03-07 00:01:01 -03:00
Salomão ebd8501301 fix inaccessible items setting in storage bus not being respected 2021-03-07 00:00:16 -03:00
Salomão fa07247bd7 Revert "also shrink the fluid skiplist if the tanks change sizes"
This reverts commit 892c919ee2.
2021-03-04 23:08:08 -03:00
Salomão 95d25ddf47 Revert "Skip un-extractable slots."
This reverts commit e2e6f6e83f.
2021-03-04 23:07:58 -03:00
Salomão 7a45e1faf4 Revert "rebuild skipslotlist if the the inventory grows or shrinks"
This reverts commit 7796c6d4b6.
2021-03-04 23:07:34 -03:00
Salomão 1f88494832 fix not being able to swap patterns on interface terminal 2021-03-03 09:57:02 -03:00
PrototypeTrousers c629b4e0cf Merge pull request #4 from Theisyat/AE2-Omnifactory
Fixed 'Only show Empty' in Interface Terminal
2021-03-02 19:56:16 -03:00
PrototypeTrousers 65ca607134 Merge branch 'AE2-Omnifactory' into AE2-Omnifactory 2021-03-02 19:55:52 -03:00
Salomão 898c07ca01 fix toggling full interfaces hiding all interfaces 2021-03-02 18:45:14 -03:00
Theisyat 883c267aa8 Fixed Interface Terminal and Added Stuff
Fixed 'Hide Full' Button

First Free Molecular Assembler Button

Added Button in Interface Terminal, which Searches for 'Molecular
Assembler' and sets the Interface Terminal to only show Assemblers with
free Slots.
2021-03-02 07:00:48 +01:00
Salomão 22cf913708 highlight interfaces from interface terminal. 2021-02-28 21:32:11 -03:00
Salomão b4ba1af1ec bind BlockPos of the interface on the list 2021-02-28 02:03:00 -03:00
Salomão 892c919ee2 also shrink the fluid skiplist if the tanks change sizes 2021-02-24 18:08:57 -03:00
Salomão a65b3d2ceb fix interface terminal GUI 2021-02-24 13:24:04 -03:00
Salomão c826a3e24f Add second search bar to Interface Terminal 2021-02-23 20:48:45 -03:00
Salomão fc98505f22 even more JEI integration
get ingredient from the crafting calculation GUIs
2021-02-22 22:33:05 -03:00
Salomão ea54ccbcf5 More JEI integration 2021-02-22 18:35:46 -03:00
Salomão 7796c6d4b6 rebuild skipslotlist if the the inventory grows or shrinks 2021-02-22 14:33:06 -03:00
Salomão e2e6f6e83f Skip un-extractable slots. 2021-02-21 23:08:16 -03:00
Salomão a7a1a87cd8 Holding SHIFT with an empty hand will increase the amount of items set
on interfaces and on pattern terminal
2021-02-21 20:26:52 -03:00
Salomão e50eb7965f undo monitor ticking limit 2021-02-21 03:24:03 -03:00
Salomão d25a8a53a2 fix IItemRepository insert and extraction 2021-02-21 02:24:50 -03:00
Salomão 92b48f01a2 do not use java equals to compare stacks 2021-02-20 21:18:20 -03:00
Salomão 42f0d37c44 Merge branch 'IItemRepository' into AE2-Omnifactory 2021-02-18 23:26:49 -03:00
Salomão 088a1827be implement IItemRepository 2021-02-18 18:33:06 -03:00
Salomão 6a21968dab add storagedrawers to the gradle deps 2021-02-17 12:30:07 -03:00
Salomão 7c5ff5322a Fix JEI transfer fix. Typo correction. 2021-02-16 16:47:22 -03:00
Salomão 7834028459 Rebuild itemlist only once per tick
re-enabled level-emitters update
2021-02-15 15:41:48 -03:00
Salomão c43cbbef43 Switched JEI search to crafting terminal to fuzzy mode 2021-02-14 02:14:15 -03:00
Salomão ead6274ca4 FIX JEI transfer not working correctly
Missing on the crafting terminal
2021-02-13 21:48:37 -03:00
Salomão f1c41bab3f Implement MouseTweaks API
can now set item quantities in pattern terminal and interfaces by right clicking with the same configured item
2021-02-12 20:26:21 -03:00
Salomão 12e74dc0de Merge remote-tracking branch 'origin/AE2-Omnifactory' into AE2-Omnifactory 2021-02-11 23:07:43 -03:00
Salomão c10088d907 Fill pattern with items from JEI
Just Enough Energistics overrides this
2021-02-11 23:07:26 -03:00
PrototypeTrousers a12d29c4a0 Update README.md 2021-02-09 18:58:08 -03:00
PrototypeTrousers 2227510acf Update README.md 2021-02-09 18:55:22 -03:00
Salomão 97ae7e1f14 encoded patterns now stack up to 64 2021-02-08 22:14:37 -03:00
Salomão fc119070b2 Actually copy level emitters set values 2021-01-15 17:41:40 -03:00
Salomão 82e3a95f11 fix memory card not saving fluids an level emitters 2021-01-12 18:24:05 -03:00
Salomão e6998913e1 remove forced level emitters update
remove unneeded itemStack creation.
2021-01-04 14:18:07 -03:00
Salomão a3e69ce608 add hardcoded id range for molds and shapes for GTCE blocking mode 2020-12-08 22:42:04 -03:00
Salomão ceef176a2a remove time-based thread syncinc 2020-12-01 17:26:42 -03:00
Salomão c2e2696707 Fix fuzzy search for items that have metadata > maxdamage 2020-12-01 17:25:52 -03:00
Salomão 4d6c61dfcb backport e82093eec9459be3211564a83166455150c51259 2020-11-23 00:45:49 -03:00
Salomão 932141cc9e backport b7ca98d1e24e5797a8e42ca861ae4187ab5839ec 2020-11-23 00:45:49 -03:00
Salomão adf59774d4 Remove uneeded Forge Event Firing
improves crafting calculation performance
2020-11-18 20:22:40 -03:00
Salomão 9c6668b0f7 disable "smart" button
wasn't so smart
2020-11-13 17:42:41 -03:00
Salomão 1b7f11a12e buttons work and set quantities properly 2020-11-12 23:27:56 -03:00
Salomão 3cf4f9122c works..ish 2020-11-12 20:42:30 -03:00
Salomão d97996070a x2 button on the right place 2020-11-12 18:40:10 -03:00
Salomão 8a165bea09 ease punishment a bit 2020-10-28 19:50:57 -03:00
Salomão f707f95373 Revert "undo penalties"
This reverts commit d6499c16b0.
2020-10-28 19:49:23 -03:00
Salomão b2a660ec9b formating fixes 2020-10-28 17:50:40 -03:00
Salomão d6499c16b0 undo penalties 2020-10-28 16:59:51 -03:00
Salomão de3e0178a4 update forge and jei 2020-10-27 03:38:12 -03:00
Salomão 203522316c more tweaks testing 2020-10-25 18:57:42 -03:00
Salomão 719ea5090b move gtce blocking code out of generic item adaptor
fixes crash with ae2 fluid crafting
2020-10-25 01:04:48 -03:00
Salomão 00e19d67a2 Tune punishment 2020-10-23 21:39:36 -03:00
Salomão 169f6393d1 move penalty up the chain 2020-10-22 11:24:16 -03:00
Salomão 12bf337238 Re-do Blocking mode logic 2020-10-21 15:44:43 -03:00
Salomão 3b544c2486 Merge remote-tracking branch 'PrototypeTrousers/AE2-Omnifactory' into AE2-Omnifactory 2020-10-20 23:52:18 -03:00
Salomão 660e17d167 Merge remote-tracking branch 'talchas/on-upstream' into AE2-Omnifactory 2020-10-20 23:52:11 -03:00
Salomão b10246a67b Merge remote-tracking branch 'talchas/on-upstream' into AE2-Omnifactory 2020-10-20 23:04:44 -03:00
Salomão 74362bb543 Merge branch 'ae2-interface-export-bus-fixes' into AE2-Omnifactory 2020-10-20 23:02:53 -03:00
Salomão 81df58afa5 dont try to re-request craft immediately, if we cant craft it now 2020-10-20 23:01:09 -03:00
Salomão 535289e694 Change interface behavior
skip complete configured stacks
postpone crafting job start
2020-10-20 14:30:08 -03:00
yueh d730503378 Fixes #4388: Ensure correct ticking priority order (#4393) 2020-05-27 16:13:20 +02:00
yueh f3349b0a2d Fixes #4372: Limit validated itemstack to a size of 1 (#4373) 2020-05-07 11:49:00 +02:00
yueh f667e9a5f0 Reduce lock time 2020-04-25 18:28:33 +02:00
Hinara 2c0a2975de Fix #4114 (#4357) 2020-04-25 18:05:14 +02:00
yueh 2e3d6b721a Run daily after the initial cleanup is done 2020-03-30 11:00:43 +02:00
yueh 94e294f4e9 Remove redundant option 2020-03-27 21:28:55 +01:00
yueh 91620a0042 Handle issues and prs 2020-03-27 21:23:29 +01:00
yueh ffc79b5494 Run workflow hourly 2020-03-27 19:43:09 +01:00
yueh ce7c29d0ac Create lock.yml 2020-03-27 18:06:46 +01:00
talchas 5ac8db41e7 option for a blocking mode that actually works 2020-02-06 18:13:31 -08:00
yueh 6ece190ac4 Fixes #4127: Increase JEI box for grindstone recipes (#4270) 2020-01-30 10:06:14 +01:00
yueh 00a596ea8f Fixes #4268: Disabled JEI facade recipe when disabled. (#4269) 2020-01-30 09:35:45 +01:00
yueh 1fc1d5517d Fixes #4213: Prevent NPE when inserting via conversion monitor (#4265) 2020-01-26 13:36:06 +01:00
yueh d5fc7a5b21 Fixes #4256: Cache AESharedItemStack#hashCode() (#4257) 2020-01-16 13:22:42 +01:00
Rik Pronk 1f85d0f607 Fix CraftTweaker Grindstone second optional output (#4250)
Fixes an issue where the CraftTweaker Grindstone integration registered the second optional output as first optional output
2020-01-16 10:57:18 +01:00
talchas dfe5b82bda Safer implementation of CraftingGridCache updatePatterns coalescing 2019-12-31 10:57:23 -08:00
talchas c7f8f4249e Avoid quadratic behavior from rebuilding the entire crafting cache for
each interface visited. Instead rebuild it at most once per tick, like
cpu clusters.

This is particularly important when channels are disabled, since in
that case even adding a cable visits every grid node.
2019-12-31 10:57:23 -08:00
ruifung 5efa6d6251 Update API JavaDocs for clarification (#4180)
* Fix javadoc for IGridBlock.getMachineRepresentation()

Javadoc should state proper semantics for that method, and telling people to return null there is a sure crash. #4178

* Update IPart interface javadoc.

Update the javadoc to state that functional parts should not be allowed to be placed on dense cables.
2019-12-19 10:18:27 +01:00
Andrew Motz 4269a66a4b Fix Typos in README.md (#4183)
"Summery" to "Summary"
2019-12-19 10:16:59 +01:00
Chan, Danny df2a7c1858 Add "cullface" into charged_quartz_ore.json (#4108) 2019-08-07 10:08:05 +02:00
yueh c483bd17f5 Fixes #4089: Render cable core on straight lines of different types. (#4103) 2019-07-23 21:12:17 +02:00
yueh 92536fceb4 Fixes #4090 Portable cell incorrect empty itemstack handling (#4093) 2019-07-23 20:13:15 +02:00
yueh ded71cb2bd Fixes #4062: Rounding error due to float precision. (#4064) 2019-06-20 10:47:28 +02:00
yueh 41a4518c5b Fixes #4005: Persist cell after cleanup. (#4009) 2019-04-21 22:30:45 +02:00
yueh 87643094c3 Fixes #3925: Incorrect API JavaDoc (#4008)
`IGridBlock#getMachineRepresentation()` must be non null.
2019-04-21 22:30:35 +02:00
yueh 8a4c9b58e6 Fixes #3911: Incorrectly used string format. (#4007) 2019-04-21 22:30:21 +02:00
InterPlay 5436e6bf08 Added support for fluids in pt-BR lang file (#3904) 2019-04-21 13:20:57 +02:00
yueh 078112d97b Disable modmaven due to build issues for now (#4011) 2019-04-21 13:10:02 +02:00
yueh 46355a4e9b Fixes #3899: Put fluid interface into configured mode when needed. (#3903) 2019-01-15 12:52:12 +01:00
yueh eb389971a3 Fixes #3901: Ensure fluid terminal respects reported stacksizes. (#3902) 2019-01-15 12:52:00 +01:00
yueh a38ebf7c4d Fixes #3886: Initialise sleeping import bus in pulse mode. (#3887) 2018-12-26 23:28:17 +01:00
yueh dfcba264f3 Fixes #3880: Incorrect compare with empty itemstack. (#3882) 2018-12-25 21:21:19 +01:00
yueh d343ac47f5 Added CTM as actual soft dependency. (#3881) 2018-12-25 21:21:08 +01:00
yueh 05db930a4e Fixes #3821: Unconfigured level emitter now report all fluids. (#3875) 2018-12-24 14:44:40 +01:00
yueh 33bc0a6a3f Fixes #3776: Fixes dupe bug with cell upgrades. (#3874) 2018-12-24 14:11:45 +01:00
yueh f2f48a8d59 Fixes #3767: Fluid Annihilation plane too strict about leftover (#3872) 2018-12-23 23:33:15 +01:00
yueh 0f0af2349b Fixes #3866: Use blockstates to avoid the missing fluid block. (#3869) 2018-12-23 22:42:25 +01:00
yueh 32a4fcab77 Fixes #3768: Damageable items with nbt and without damage could crash. (#3867) 2018-12-23 22:42:09 +01:00
yueh a847a01d8a Feature #3832: Made onRequestChange() less ambiguous (#3833) 2018-12-23 22:41:52 +01:00
yueh ed643787df Updated gradle scripts (#3871)
Includes #3819
2018-12-23 22:41:11 +01:00
covers1624 524b26d2a2 Implement caching for facade item models. 2018-12-19 12:46:43 +01:00
covers1624 184b1f8efb Guard against models providing quads with null orientations. 2018-12-19 12:46:43 +01:00
E. Kim 06cca13087 Update ko_kr.lang (#3674) 2018-11-17 10:31:29 +01:00
徐晨曦 8e735e72ff Update zh_cn.lang (#3570) 2018-11-17 10:31:01 +01:00
yueh d3dd137570 Fixes #3817: Missing 1k Crafting Storage and Monitor from Network Status (#3818) 2018-11-11 13:11:45 +01:00
yueh 78e1126c38 Fixes #3814: IO Port no longer put to sleep on load when having work. (#3816) 2018-11-11 11:52:13 +01:00
yueh ebe3ff045d Fixes #3811: Display crafting unit as themself in the network monitor. (#3815) 2018-11-11 11:52:03 +01:00
yueh 6291a545c3 Fixes #3793: Limit filling fluid inventories to their max capacity. (#3794) 2018-10-21 11:18:02 +02:00
yueh 99fd5a9d53 Fixes #3790: Correctly handle fluids with NBT data. (#3791) 2018-10-21 11:17:27 +02:00
yueh 416c7d2683 Input P2P tunnels can now be assigned a new frequency. (#3765)
Shift right clicking an existing tunnel only allowed to copied the
stored frequency.

When shift right clicking now and the stored frequency being the same as
already stored one, it will now create a new one and save it to the memory
card. In other words doubling clicking will reset now, otherwise the old
behaviour is still kept.
2018-10-21 11:17:01 +02:00
yueh 0c88d1e7ee Fixes #3746: Revert OreDict use for cable anchors. Blame Forge for crashes. (#3764) 2018-10-06 00:02:41 +02:00
fscan d88f550eb0 Switch to new IItemHandler (#3669) 2018-10-04 20:39:06 +02:00
yueh e21c59b326 Fixes #3146: Prevent crash when GlassState is missing. (#3758) 2018-10-04 19:33:10 +02:00
yueh d8af8d26be Updated to new Forge RB (#3760) 2018-10-04 19:32:47 +02:00
yueh 02426bc101 Update bug_report.md
Fixed missing *
2018-10-02 17:38:22 +02:00
yueh 11f8471772 Updated issue templates
Updated bug report
Added feature request
2018-10-01 13:12:44 +02:00
yueh d35b720a16 Update issue templates (#3751) 2018-10-01 13:00:07 +02:00
mezz 7a5b84c10a Allow JEI to differentiate between different cable facades (#3750) 2018-10-01 11:18:38 +02:00
covers1624 800860d4e6 Fixes #3747: Fix issues with facade breaking textures. (#3748) 2018-10-01 11:12:38 +02:00
yueh ac81418684 Changed some fluid recipes to match their item variant. (#3744) 2018-09-28 18:25:05 +02:00
yueh 7daad58607 Fixes #3742: Do not use storableInStorageCell() to identify generic c… (#3743)
Annotated IStorageCell with Nonnull where appropriate.
2018-09-28 17:38:08 +02:00
yueh 038ca23523 Fixes #3688: Invalidate Storage Bus cache immediately upon missing TE. (#3737) 2018-09-28 17:36:58 +02:00
1865 changed files with 110775 additions and 108372 deletions
+30
View File
@@ -0,0 +1,30 @@
---
name: Bug report
about: You found a bug or encountered a crash? Please report it here.
---
<!-- Provide a summary of the issue in the Title above, please do not "[Tag]" it. -->
**Describe the bug**
<!-- Always use the most recent version from ae-mod.info, it might already be fixed. -->
**To Reproduce**
<!-- Please provide the steps to reproduce it, otherwise we might not be able to fix it. -->
**Expected behavior**
<!-- A clear and concise description of what you expected to happen. -->
**Additional context**
<!-- Screenshots, crashlogs, etc. -->
<!-- A complete crashlog is required when reporting a crash. No excerpts. -->
<!-- Please use pastebin or gist for posting the complete crashlog. -->
**Environment**
<!-- Include as many relevant details about the environment -->
<!-- Like the used version, SP/MP, other mods and their version -->
<!-- The following ones are required, please note "latest" is not a version -->
- Minecraft Version:
- AE2 Version:
- Forge Version:
+17
View File
@@ -0,0 +1,17 @@
---
name: Feature Request
about: A feature request or suggestion to improve Applied Energistics 2
---
<!-- Provide a summary of the issue in the Title above, please do not "[Tag]" it. -->
**Describe the feature**
<!-- Tell us how it should work. -->
**Reasons why it should be considered**
<!-- This can help us in various degrees, e.g. to determine if it fits our design ideas. -->
**Additional Context**
<!-- Use this for further details, e.g. screenshots, links to mods for integrations. -->
<!-- Features will only be considered for the latest/next version. -->
+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"
+58
View File
@@ -0,0 +1,58 @@
Changes so far :
Design changes/breakages:
- Interfaces no longer spill items of one pattern on other faces
- Interfaces now push patterns in round-robin (Interfaces, then sides)
Fixes:
- Fix gregtech machines appearing with 'unnamed' or 'draconium lens' on the interface terminal on specific situations.
- Add memorycard support for fluid interfaces, import/export/storage busses and level emitters ( this fix was upstreamed to AE2 for MC 1.16)
- Storage busses now hide/show inaccessible items as configured.
- Exclusive Blocking mode for GTCE ( shapes, molds and configured circuits do not block GTCE machines )
- Blocking modes default to block on any item in the iventory the entity exposes
- Fuzzy includes items that report that they're damageable, but report a maxDamage of 0 ( auto-crafting of basic capacitors -> resonant capacitors is now possible ) <- Broken item implementation.
- Fix CME exceptions on the energy grid
- Fix AE going offline even with enough power by extracting from the local buffer always last
- Fix IO-Port copying craftable flag into items
- Fix NBT of old items not clearing on drives that reached 64 types once
Performance:
- Added @talchas fixes for insane channelless AE networks.
- Implemented StorageDrawers slotless itemrepository.
- Removed CraftedEvent calls (really bad lag with craftweaker versions before CraftTweaker2-1.12-4.1.20.626)
- Count items set in interfaces before queuing crafting for them needlessly
- Backported b7ca98d ( Avoid copying items on simulated item extraction )
- Cache some level emitters functions
- Reduced import bus insert simulation to 1 before real insertion (if possible)
- Backported itemlist re-implementation along with pattern changes to avoid CraftingManager fallback issues
- Instead of recalculating all the content of the network on every change, track the changes properly and apply them to the cached list of items
QOL:
- added highlight interface button to interface terminal ("?" button on the left of the interface slots)
- Added bar on the interface terminal that search by inputs ( The one on the LEFT, also searchs by interface name )
- Shortcut to molecular assemblers with free slots on the terminal interface by @Theisyat
- Toggle button on interface terminal to hide full interfaces
- JEI "U", "R" and "A" (Usages/Recipes/Bookmark) now work on the Crafting Status GUI. ( the one that shows the total items to craft, and whats missing)
- Patterns can now be made with items currently showing on JEI. ( This is overriden by Just Enough Energistics. )
- Added multiplier buttons to processing pattern gui
- Switched crafting terminal JEI search to fuzzy mode. If the recipe uses a damageable item, AE will try to grab it ( damaged tools )
- Encoded patterns stack up to 64 ( holding shift and clicking the encode arrow will transfer the encoded pattern to the player inventory)
- Encoded patterns can be draggred on the interface terminal.
- Storage Monitor and Conversion Monitor now also ccepts fluids
- Draggable JEI ghost items (also works on bookmarked items. SHIFT + Click will move the hovered item into the first free target slot)
- JEI auto switches between crafting and processing patterns
- GTCE Blocking mode work through phantom itemfaces
- Shift-clicking blank patterns into the pattern terminal will try to fill the blank pattern slots first
- Mismached simulated/real item count ( most often due to compacting drawers ) will now tell the player wich item cause the failure when trying to start a craft
- Added 'pattern expansion' cards that adds an extra row of patterns to interfaces. up to 3 card on an interface. (each card will increase the interface idle power draw by 4 times)
HOTKEYS:
- Implemented mousetweaks API. AE2 custom keybinds now work. (Try right clicking and use the scroll-wheel on the terminals)
- Holding SHIFT and scrolling UP and DOWN will increase the items set on the configured slots of Interfaces and Pattern Terminal (Processing mode)
+18 -218
View File
@@ -1,36 +1,27 @@
[![Travis](https://img.shields.io/travis/AppliedEnergistics/Applied-Energistics-2.svg?maxAge=2592000&style=flat-square)](https://travis-ci.org/AppliedEnergistics/Applied-Energistics-2)
[![Latest Release](https://img.shields.io/github/release/AppliedEnergistics/Applied-Energistics-2.svg?label=Latest%20Release&style=flat-square)](https://github.com/AppliedEnergistics/Applied-Energistics-2/releases)
# Applied Energistics 2 Unofficial Extended Life
# Applied Energistics 2
[![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)
## Table of Contents
* [About](#about)
* [Contacts](#contacts)
* [License](#license)
* [Downloads](#downloads)
* [Installation](#installation)
* [Issues](#issues)
* [Building](#building)
* [Contribution](#contribution)
* [API](#applied-energistics-2-api)
* [CraftTweaker](#applied-energistics-2-crafttweaker)
* [Localization](#applied-energistics-2-localization)
* [Credits](#credits)
---
## 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.
## Contacts
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).
* [Website](http://ae-mod.info/)
* [IRC #appliedenergistics on esper.net](http://webchat.esper.net/?channels=appliedenergistics&prompt=1)
* [GitHub](https://github.com/AppliedEnergistics/Applied-Energistics-2)
* [Discord](https://discord.gg/GygKjjm)
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. Not sure why you would do that, but we support that nonetheless!
## License
* Applied Energistics 2 API
- (c) 2013 - 2018 AlgorithmX2 et al
- [![License](https://img.shields.io/badge/License-MIT-red.svg?style=flat-square)](http://opensource.org/licenses/MIT)
@@ -43,202 +34,11 @@ A Mod about Matter, Energy and using them to conquer the world..
* Text and Translations
- [![License](https://img.shields.io/badge/License-No%20Restriction-green.svg?style=flat-square)](https://creativecommons.org/publicdomain/zero/1.0/)
## Downloads
Downloads can be found on [CurseForge](http://www.curse.com/mc-mods/minecraft/223794-applied-energistics-2) or on the [official website](http://ae-mod.info/Downloads/).
## Installation
You install this mod by putting it into the `minecraft/mods/` folder. It has no additional hard dependencies.
## Issues
Applied Energistics 2 crashing, have a suggestion, found a bug? Create an issue now!
1. Make sure your issue has not already been answered or fixed and you are using the latest version. Also think about whether your issue is a valid one before submitting it.
* If it is already possible with vanilla and AE2 itself, the suggestion will be considered invalid.
* Asking for a smaller version, more compact version, or more efficient version of something will also be considered invalid.
2. Go to [the issues page](https://github.com/AppliedEnergistics/Applied-Energistics-2/issues) and click [new issue](https://github.com/AppliedEnergistics/Applied-Energistics-2/issues/new)
3. Enter your a title of your issue (something that summarizes your issue), and then create a detailed description of the issue.
* Do not tag it with something like `[Feature]`, `[Bug]`, or a version.
* Restrict it to a single bug or feature, it makes managing them way easier for us.
* The following details are required. Also refer to the issue template when creating one.
* Forge version
* AE2 version
* Crash log, when reporting a crash (Please make sure to use [pastebin](http://pastebin.com/))
* Never post an excerpt of what you consider important
* Always post the full log
* Other mods and their version, when reporting an issue between AE and another mod
* Also consider updating these before submitting a new issue, it might be already fixed
* A detailed description of the bug or feature
* To further help in resolving your issues please try to include the follow if applicable:
* What was expected?
* How to reproduce the problem?
* This is usually a great detail and allows us to fix it way faster
* Server or Single Player?
* Screen shots or Pictures of the problem
* Mod Pack using and version?
* Keep in mind that some mods might use an outdated version of AE2
* If so you should report it to your modpack
4. Click `Submit New Issue`, and wait for feedback!
Providing as many details as possible does help us to find and resolve the issue faster and also you getting a fixed version as fast as possible.
Please note that we might close any issue not matching these requirements.
## Building
1. Clone this repository via
- SSH `git clone git@github.com:AppliedEnergistics/Applied-Energistics-2.git` or
- HTTPS `git clone https://github.com/AppliedEnergistics/Applied-Energistics-2.git`
2. Setup workspace
- Decompiled source `gradlew setupDecompWorkspace`
- Obfuscated source `gradlew setupDevWorkspace`
- CI server `gradlew setupCIWorkspace`
3. Build `gradlew build`. Jar will be in `build/libs`
4. For core developer: Setup IDE
- IntelliJ: Import into IDE, execute `gradlew genIntellijRuns` and change RunConfiguration to `*_main` as quickfix for [ForgeGradle](https://github.com/MinecraftForge/ForgeGradle/issues/357)
- Eclipse: execute `gradlew eclipse`
5. For add-on developer: Core-Mod Detection
- In order to have FML detect AE from your dev environment, add the following VM Option to your run profile
- `-Dfml.coreMods.load=appeng.coremod.AppEngCore`
## Contribution
Before you want to add major changes, you might want to discuss them with us first, before wasting your time.
If you are still willing to contribute to this project, you can contribute via [Pull-Request](https://help.github.com/articles/creating-a-pull-request).
The [guidelines for contributing](https://github.com/AppliedEnergistics/Applied-Energistics-2/blob/master/.github/CONTRIBUTING.md) contain more detailed information about topics like the used code style and should also be considered.
Here are a few things to keep in mind that will help get your PR approved.
* A PR should be focused on content. Any PRs where the changes are only syntax will be rejected.
* Use the file you are editing as a style guide.
* Consider your feature. [Suggestion Guidelines](http://ae-mod.info/Suggestion-Guidelines/)
- Is your suggestion already possible using Vanilla + AE2?
- Make sure your feature isn't already in the works, or hasn't been rejected previously.
- Does your feature simplify another feature of AE2? These changes will not be accepted.
- If your feature can be done by any popular mod, discuss with us first.
**Getting Started**
1. Fork this repository
2. Clone the fork via
* SSH `git clone git@github.com:<your username>/Applied-Energistics-2.git` or
* HTTPS `git clone https://github.com/<your username>/Applied-Energistics-2.git`
3. Change code base
4. Add changes to git `git add -A`
5. Commit changes to your clone `git commit -m "<summery of made changes>"`
6. Push to your fork `git push`
7. Create a Pull-Request on GitHub
8. Wait for review
9. Squash commits for cleaner history
If you are only doing single file pull requests, GitHub supports using a quick way without the need of cloning your fork. Also read up about [synching](https://help.github.com/articles/syncing-a-fork) if you plan to contribute on regular basis.
## Applied Energistics 2 API
The API for Applied Energistics 2. It is open source to discuss changes, improve documentation, and provide better add-on support in general.
Universal builds obtained [Here](http://ae2.ae-mod.info/Downloads/) should work in a development environment.
### Maven
When compiling against the AE2 API you can use gradle dependencies, just add
dependencies {
compile "appeng:appliedenergistics2:rv_-_____-__:api"
}
or add the compile line to your existing dependencies task to your build.gradle
Where the __ are filled in with the correct version criteria; AE2 is available from the default forge maven so no additional repositories are necessary.
An example string would be `appeng:appliedenergistics2:rv5-stable-1:api` for the API only or `appeng:appliedenergistics2:rv5-stable-1` for the whole mod.
## Applied Energistics 2 CraftTweaker
### Inscriber
Add a recipe. When `inscribe` is true the bottom and top inputs are not consumed.
mods.appliedenergistics2.Inscriber.addRecipe(ItemStack output, ItemStack input, boolean inscribe,
@Optional ItemStack topInput, @Optional ItemStack bottomInput );
Remove all recipes for this output stack.
mods.appliedenergistics2.Inscriber.removeRecipe(ItemStack output);
### Grindstone
Add a recipe.
mods.appliedenergistics2.Grinder.addRecipe( ItemStack output, ItemStack input, int turns,
@Optional ItemStack secondary1Output, @Optional float secondary1Chance,
@Optional ItemStack secondary2Output, @Optional float secondary2Chance);
Remove recipes for this input.
mods.appliedenergistics2.Grinder.removeRecipe(ItemStack input);
### Spatial
Whitelist a TileEntity class for Spatial IO.
mods.appliedenergistics2.Spatial.whitelistEntity( String fullEntityClassName );
### Attunement
Attune a ItemStack or ModID to a specific P2P-Tunnel type. ModID's are used as fallback when no ItemStack was found.
mods.appliedenergistics2.Attunement.attuneME( ItemStack itemStack );
mods.appliedenergistics2.Attunement.attuneME( String modID );
mods.appliedenergistics2.Attunement.attuneItem( ItemStack itemStack );
mods.appliedenergistics2.Attunement.attuneItem( String modID );
mods.appliedenergistics2.Attunement.attuneFluid( ItemStack itemStack );
mods.appliedenergistics2.Attunement.attuneFluid( String modID );
mods.appliedenergistics2.Attunement.attuneRedstone( ItemStack itemStack );
mods.appliedenergistics2.Attunement.attuneRedstone( String modID );
mods.appliedenergistics2.Attunement.attuneRF( ItemStack itemStack );
mods.appliedenergistics2.Attunement.attuneRF( String modID );
mods.appliedenergistics2.Attunement.attuneIC2( ItemStack itemStack );
mods.appliedenergistics2.Attunement.attuneIC2( String modID );
mods.appliedenergistics2.Attunement.attuneLight( ItemStack itemStack );
mods.appliedenergistics2.Attunement.attuneLight( String modID );
### Cannon
Add ammo types for the matter cannon.
mods.appliedenergistics2.Cannon.registerAmmo( ItemStack itemStack, double weight );
## Applied Energistics 2 Localization
### English Text
`en_US` is included in this repository, fixes to typos are welcome.
### Encoding
Files must be encoded as UTF-8.
### New or updated Translations
The language files are located in `/src/main/resources/assets/appliedenergistics2/lang/` and use the [appropriate locale code](http://minecraft.gamepedia.com/Language) as name and `.lang` as extension.
To update an translation edit the corresponding file and improve/correct the existing entry. Or copy any entries from `en_US.lang` for missing translation.
To create a new translation, copy the contents of `en_US.lang`, create a new file with appropriate filename, and translate it to your language.
Please keep in mind that we use [String format](https://docs.oracle.com/javase/8/docs/api/java/util/Formatter.html) to pass additional data to the text for displaying.
Therefore you should preserve parts like `%s` or `%1$d%%`, which allows us to replace them with the correct values while you still have the option to change their order for match the rules of grammar.
This might not be possible for some languages. Should this be the case, please contact us.
### Final Note
If you have have issues localizing something feel free to contact us on IRC, at #AppliedEnergistics on Esper.net
Thanks to everyone helping out to improve localization of AE2.
## Credits
Thanks to
Special thanks to:
* PrototypeTrousers for the initial fork
* Notch et al for Minecraft
* Lex et al for MinecraftForge
* AlgorithmX2 for AppliedEnergistics2
+1190 -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)
}
+180 -31
View File
@@ -1,35 +1,184 @@
aeversion=rv5
aechannel=alpha
aebuild=0
aegroup=appeng
aebasename=appliedenergistics2
modName = AE2 Unofficial Extended Life
#########################################################
# Versions #
#########################################################
minecraft_version=1.12.2
mcp_mappings=snapshot_20171003
forge_version=14.23.3.2655
# This is a case-sensitive string to identify your mod. Convention is to use lower case.
modId = appliedenergistics2
#########################################################
# Installable #
#########################################################
hwyla_version=1.8.26-B41_1.12.2
modGroup = appeng
#########################################################
# Provided APIs #
#########################################################
jei_version=4.10.0.198
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
inventorytweaks_version=1.63
ctm_version=0.3.0.15
# 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 =
#########################################################
# Deployment #
#########################################################
website_version=1.12.2
curse_versions=1.12.2
# AE2 Specific Version Settings
aeversion=rv6
aechannel=stable
aebuild=7
# 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
-59
View File
@@ -1,59 +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'
}
artifacts {
archives apiJar
archives javadocJar
archives sourceJar
}
-104
View File
@@ -1,104 +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 {
name "Mobius"
url "http://mobiusstrip.eu/maven"
}
maven {
name = "JEI repo"
url "http://dvs1.progwml6.com/files/maven"
}
maven {
name = "Tesla repo"
url "http://maven.mcmoddev.com"
}
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 { // Hwyla
name 'tehnut'
url "http://tehnut.info/maven"
}
maven { // CraftTweaker
name 'jared maven'
url "http://maven.blamejared.com/"
}
maven { // modmaven, maven proxy
name 'modmaven'
url "https://modmaven.k-4u.nl/"
}
maven {
name = "CurseForge"
url = "https://minecraft.curseforge.com/api/maven/"
}
}
configurations {
mods
}
dependencies {
// installable runtime dependencies
mods "mcp.mobius.waila:Hwyla:${hwyla_version}"
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 "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 "inventory-tweaks:InventoryTweaks:${inventorytweaks_version}:api"
compileOnly "team.chisel.ctm:CTM:MC1.12-${ctm_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()
@@ -26,5 +26,20 @@ package appeng.api.config;
public enum ActionItems
{
WRENCH, CLOSE, STASH, ENCODE, SUBSTITUTION
WRENCH,
CLOSE,
STASH,
ENCODE,
SUBSTITUTION,
MULTIPLY_BY_TWO,
MULTIPLY_BY_THREE,
INCREASE_BY_ONE,
DIVIDE_BY_TWO,
DIVIDE_BY_THREE,
DECREASE_BY_ONE,
MAX_COUNT,
FREE_MOLECULAR_SLOT_SHORTCUT,
TOGGLE_SHOW_FULL_INTERFACES_ON,
TOGGLE_SHOW_FULL_INTERFACES_OFF,
HIGHLIGHT_INTERFACE
}
@@ -28,7 +28,8 @@ public enum PowerUnits
{
AE( "gui.appliedenergistics2.units.appliedenergstics" ), // Native Units - AE Energy
EU( "gui.appliedenergistics2.units.ic2" ), // IndustrialCraft 2 - Energy Units
RF( "gui.appliedenergistics2.units.rf" ); // RF - Redstone Flux
RF( "gui.appliedenergistics2.units.rf" ), // RF - Redstone Flux
GTEU( "gui.appliedenergistics2.units.gteu" ); // RF - Redstone Flux
/**
* unlocalized name for the power unit.
@@ -46,14 +47,13 @@ public enum PowerUnits
/**
* do power conversion using AE's conversion rates.
*
* <p>
* Example: PowerUnits.EU.convertTo( PowerUnits.AE, 32 );
*
* <p>
* will normally returns 64, as it will convert the EU, to AE with AE's power settings.
*
* @param target target power unit
* @param value value
*
* @param value value
* @return value converted to target units, from this units.
*/
public double convertTo( final PowerUnits target, final double value )
+5 -1
View File
@@ -81,7 +81,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;
@@ -29,6 +29,7 @@ public enum TunnelType
ME, // Network Tunnel
IC2_POWER, // EU Tunnel
FE_POWER, // Forge Energy tunnel
GTEU_POWER, // Forge Energy tunnel
REDSTONE, // Redstone Tunnel
FLUID, // Fluid Tunnel
ITEM, // Item Tunnel
+51 -54
View File
@@ -32,65 +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 );
/**
* 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,119 +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 cardFuzzy();
IItemDefinition cardPatternExpansion();
IItemDefinition cardInverter();
IItemDefinition cardQuantumLink();
IItemDefinition cardCrafting();
IItemDefinition cardMagnet();
IItemDefinition enderDust();
IItemDefinition cardFuzzy();
IItemDefinition flour();
IItemDefinition cardInverter();
IItemDefinition goldDust();
IItemDefinition cardCrafting();
IItemDefinition ironDust();
IItemDefinition cardSticky();
IItemDefinition fluixDust();
IItemDefinition enderDust();
IItemDefinition certusQuartzDust();
IItemDefinition flour();
IItemDefinition netherQuartzDust();
IItemDefinition goldDust();
IItemDefinition matterBall();
IItemDefinition ironDust();
IItemDefinition certusQuartzCrystal();
IItemDefinition fluixDust();
IItemDefinition certusQuartzCrystalCharged();
IItemDefinition certusQuartzDust();
IItemDefinition fluixCrystal();
IItemDefinition netherQuartzDust();
IItemDefinition fluixPearl();
IItemDefinition matterBall();
IItemDefinition woodenGear();
IItemDefinition certusQuartzCrystal();
IItemDefinition wirelessReceiver();
IItemDefinition certusQuartzCrystalCharged();
IItemDefinition wirelessBooster();
IItemDefinition fluixCrystal();
IItemDefinition annihilationCore();
IItemDefinition fluixPearl();
IItemDefinition formationCore();
IItemDefinition woodenGear();
IItemDefinition singularity();
IItemDefinition wirelessReceiver();
IItemDefinition qESingularity();
IItemDefinition wirelessBooster();
IItemDefinition blankPattern();
IItemDefinition annihilationCore();
IItemDefinition fluidCell1kPart();
IItemDefinition formationCore();
IItemDefinition fluidCell4kPart();
IItemDefinition singularity();
IItemDefinition fluidCell16kPart();
IItemDefinition qESingularity();
IItemDefinition fluidCell64kPart();
IItemDefinition blankPattern();
IItemDefinition fluidCell1kPart();
IItemDefinition fluidCell4kPart();
IItemDefinition fluidCell16kPart();
IItemDefinition fluidCell64kPart();
}
+57 -48
View File
@@ -30,97 +30,106 @@ import appeng.api.util.AEColoredItemDefinition;
/**
* A list of all parts in AE
*/
public interface IParts
{
AEColoredItemDefinition cableSmart();
public interface IParts {
AEColoredItemDefinition cableSmart();
AEColoredItemDefinition cableCovered();
AEColoredItemDefinition cableCovered();
AEColoredItemDefinition cableGlass();
AEColoredItemDefinition cableGlass();
AEColoredItemDefinition cableDenseCovered();
AEColoredItemDefinition cableDenseCovered();
AEColoredItemDefinition cableDenseSmart();
AEColoredItemDefinition cableDenseSmart();
AEColoredItemDefinition lumenCableSmart();
AEColoredItemDefinition lumenCableSmart();
AEColoredItemDefinition lumenCableCovered();
AEColoredItemDefinition lumenCableCovered();
AEColoredItemDefinition lumenCableGlass();
AEColoredItemDefinition lumenCableGlass();
AEColoredItemDefinition lumenDenseCableSmart();
AEColoredItemDefinition lumenDenseCableSmart();
IItemDefinition quartzFiber();
IItemDefinition quartzFiber();
IItemDefinition toggleBus();
IItemDefinition toggleBus();
IItemDefinition invertedToggleBus();
IItemDefinition invertedToggleBus();
IItemDefinition storageBus();
IItemDefinition storageBus();
IItemDefinition importBus();
IItemDefinition oreDictStorageBus();
IItemDefinition exportBus();
IItemDefinition importBus();
IItemDefinition iface();
IItemDefinition exportBus();
IItemDefinition fluidIface();
IItemDefinition iface();
IItemDefinition levelEmitter();
IItemDefinition fluidIface();
IItemDefinition annihilationPlane();
IItemDefinition levelEmitter();
IItemDefinition identityAnnihilationPlane();
IItemDefinition annihilationPlane();
IItemDefinition formationPlane();
IItemDefinition identityAnnihilationPlane();
IItemDefinition p2PTunnelME();
IItemDefinition formationPlane();
IItemDefinition p2PTunnelRedstone();
IItemDefinition p2PTunnelME();
IItemDefinition p2PTunnelItems();
IItemDefinition p2PTunnelRedstone();
IItemDefinition p2PTunnelFluids();
IItemDefinition p2PTunnelItems();
IItemDefinition p2PTunnelEU();
IItemDefinition p2PTunnelFluids();
IItemDefinition p2PTunnelFE();
IItemDefinition p2PTunnelEU();
IItemDefinition p2PTunnelLight();
IItemDefinition p2PTunnelFE();
// IItemDefinition p2PTunnelOpenComputers();
IItemDefinition p2PTunnelGTEU();
IItemDefinition cableAnchor();
IItemDefinition p2PTunnelLight();
IItemDefinition monitor();
// IItemDefinition p2PTunnelOpenComputers();
IItemDefinition semiDarkMonitor();
IItemDefinition cableAnchor();
IItemDefinition darkMonitor();
IItemDefinition monitor();
IItemDefinition interfaceTerminal();
IItemDefinition semiDarkMonitor();
IItemDefinition patternTerminal();
IItemDefinition darkMonitor();
IItemDefinition craftingTerminal();
IItemDefinition interfaceTerminal();
IItemDefinition terminal();
IItemDefinition patternTerminal();
IItemDefinition storageMonitor();
IItemDefinition expandedProcessingPatternTerminal();
IItemDefinition conversionMonitor();
IItemDefinition interfaceConfigurationTerminal();
IItemDefinition fluidTerminal();
IItemDefinition fluidInterfaceConfigurationTerminal();
IItemDefinition fluidImportBus();
IItemDefinition craftingTerminal();
IItemDefinition fluidExportBus();
IItemDefinition terminal();
IItemDefinition fluidStorageBus();
IItemDefinition storageMonitor();
IItemDefinition fluidLevelEmitter();
IItemDefinition conversionMonitor();
IItemDefinition fluidAnnihilationPlane();
IItemDefinition fluidTerminal();
IItemDefinition fluidFormationnPlane();
IItemDefinition fluidImportBus();
IItemDefinition fluidExportBus();
IItemDefinition fluidStorageBus();
IItemDefinition fluidLevelEmitter();
IItemDefinition fluidAnnihilationPlane();
IItemDefinition fluidFormationnPlane();
}
@@ -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;
}
}
@@ -24,6 +24,8 @@
package appeng.api.implementations.items;
import javax.annotation.Nonnull;
import net.minecraft.item.ItemStack;
import appeng.api.storage.ICellWorkbenchItem;
@@ -52,7 +54,7 @@ public interface IStorageCell<T extends IAEStack<T>> extends ICellWorkbenchItem
*
* @return number of bytes
*/
int getBytes( ItemStack cellItem );
int getBytes( @Nonnull ItemStack cellItem );
/**
* Determines the number of bytes used for any type included on the cell.
@@ -61,7 +63,7 @@ public interface IStorageCell<T extends IAEStack<T>> extends ICellWorkbenchItem
*
* @return number of bytes
*/
int getBytesPerType( ItemStack cellItem );
int getBytesPerType( @Nonnull ItemStack cellItem );
/**
* Must be between 1 and 63, indicates how many types you want to store on
@@ -71,7 +73,7 @@ public interface IStorageCell<T extends IAEStack<T>> extends ICellWorkbenchItem
*
* @return number of types
*/
int getTotalTypes( ItemStack cellItem );
int getTotalTypes( @Nonnull ItemStack cellItem );
/**
* Allows you to fine tune which items are allowed on a given cell, if you
@@ -83,7 +85,7 @@ public interface IStorageCell<T extends IAEStack<T>> extends ICellWorkbenchItem
*
* @return true to preventAdditionOfItem
*/
boolean isBlackListed( ItemStack cellItem, T requestedAddition );
boolean isBlackListed( @Nonnull ItemStack cellItem, @Nonnull T requestedAddition );
/**
* Allows you to specify if this storage cell can be stored inside other
@@ -104,7 +106,7 @@ public interface IStorageCell<T extends IAEStack<T>> extends ICellWorkbenchItem
*
* @return if the ItemStack should behavior as a storage cell.
*/
boolean isStorageCell( ItemStack i );
boolean isStorageCell( @Nonnull ItemStack i );
/**
* @return drain in ae/t this storage cell will use.
@@ -114,5 +116,6 @@ public interface IStorageCell<T extends IAEStack<T>> extends ICellWorkbenchItem
/**
* @return the type of channel your cell should be part of
*/
@Nonnull
IStorageChannel<T> getChannel();
}
@@ -29,5 +29,5 @@ package appeng.api.implementations.items;
*/
public enum MemoryCardMessages
{
INVALID_MACHINE, SETTINGS_LOADED, SETTINGS_SAVED, SETTINGS_CLEARED
INVALID_MACHINE, SETTINGS_LOADED, SETTINGS_SAVED, SETTINGS_RESET, SETTINGS_CLEARED
}
@@ -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
*
@@ -28,7 +28,6 @@ import java.util.EnumSet;
import javax.annotation.Nonnegative;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
@@ -124,8 +123,8 @@ public interface IGridBlock
/**
* Determines what item stack is used to render this node in the GUI.
*
* @return the render item stack to use to render this node, null is valid, and will not show this node.
* @return the render item stack to use to render this node. Returning an empty ItemStack will not show this node.
*/
@Nullable
@Nonnull
ItemStack getMachineRepresentation();
}
@@ -28,6 +28,8 @@ import appeng.api.networking.security.IActionSource;
import appeng.api.networking.storage.IBaseMonitor;
import appeng.api.storage.data.IAEItemStack;
import javax.annotation.Nullable;
public interface ICraftingCPU extends IBaseMonitor<IAEItemStack>
{
@@ -56,4 +58,30 @@ public interface ICraftingCPU extends IBaseMonitor<IAEItemStack>
* @return an empty string or the name of the cpu.
*/
String getName();
/**
* @return final output of the current crafting operation, or null if not crafting
*/
@Nullable
default IAEItemStack getFinalOutput()
{
return null;
}
/**
* @return remaining count of items (or other units of processing) for the current crafting job
*/
default long getRemainingItemCount()
{
return 0;
}
/**
* @return total count of items (or other units of processing) for the current crafting job
*/
default long getStartItemCount()
{
return 0;
}
}
@@ -99,9 +99,18 @@ public interface ICraftingGrid extends IGridCache
/**
* is this item being crafted?
*
* @param aeStackInSlot item being crafted
* @param what item being crafted
*
* @return true if it is being crafting
*/
boolean isRequesting( IAEItemStack aeStackInSlot );
boolean isRequesting( IAEItemStack what );
/**
* The total amount being requested across all crafting cpus of a grid.
*
* @param what item being requested, ignores stacksize
*
* @return The total amount being requested.
*/
long requesting( IAEItemStack what );
}
@@ -31,6 +31,9 @@ import net.minecraft.world.World;
import appeng.api.implementations.ICraftingPatternItem;
import appeng.api.storage.data.IAEItemStack;
import java.util.Collections;
import java.util.List;
/**
* do not implement provided by {@link ICraftingPatternItem}
@@ -84,6 +87,11 @@ public interface ICraftingPatternDetails
*/
boolean canSubstitute();
default List<IAEItemStack> getSubstituteInputs( int slot )
{
return Collections.emptyList();
}
/**
* Allow using this INSTANCE of the pattern details to preform the crafting action with performance enhancements.
*
@@ -44,10 +44,7 @@ public interface IStackWatcherHost
/**
* Called when a watched item changes amounts.
*
* @param o changed item list
* @param fullStack old stack
* @param diffStack new stack
* @param src action source
* @param chan storage channel
*/
void onStackChange( IItemList<?> o, IAEStack<?> fullStack, IAEStack<?> diffStack, IActionSource src, IStorageChannel<?> chan );
@@ -51,6 +51,7 @@ public interface IStorageGrid extends IGridCache, IStorageMonitorable
* @param input injected items
*/
void postAlterationOfStoredItems( IStorageChannel<?> chan, Iterable<? extends IAEStack<?>> input, IActionSource src );
void postCraftablesChanges( IStorageChannel<?> chan, Iterable<? extends IAEStack<?>> input, IActionSource src);
/**
* Used to add a cell provider to the storage system
+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.
*
+4 -1
View File
@@ -291,6 +291,9 @@ public interface IPart extends IBoxProvider, ICustomCableConnection
/**
* Used to determine which parts can be placed on what cables.
*
* Dense cables are not allowed for functional (getGridNode returns a node) parts.
* Doing so will result in crashes.
*
* @param what placed part
*
@@ -365,4 +368,4 @@ public interface IPart extends IBoxProvider, ICustomCableConnection
return null;
}
}
}
+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;
}
}
@@ -112,4 +112,17 @@ public interface IAEItemStack extends IAEStack<IAEItemStack>
* @return definition stack
*/
ItemStack getDefinition();
/**
* Compare this AE item stack to another item stack, but ignores
* the amount. It checks the item type, NBT and damage values.
*
* @param is An item stack
*/
boolean equals( ItemStack is );
ItemStack getCachedItemStack( long stackSize );
void setCachedItemStack( ItemStack is );
}
@@ -0,0 +1,11 @@
package com.enderio.core.common.interfaces;
import net.minecraft.item.ItemStack;
import javax.annotation.Nonnull;
public interface IOverlayRenderAware {
public void renderItemOverlayIntoGUI(@Nonnull ItemStack stack, int xPosition, int yPosition);
}
@@ -0,0 +1,143 @@
package com.jaquadro.minecraft.storagedrawers.api.capabilities;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import javax.annotation.Nonnull;
import java.util.function.Predicate;
/**
* An interface for treating an inventory as a slotless, central repository of items.
*
* For all operations that accept a predicate, if a predicate is supplied, a stored ItemStack must pass the predicate
* in order to be considered for the given operation.
*
* An IItemRepository implementation MAY relax or eliminate its own internal tests when a predicate is supplied. If
* the predicate is derived from DefaultPredicate, then the implementation MUST apply any tests it would have applied
* had no predicate been provided at all, in addition to testing the predicate itself.
*/
public interface IItemRepository
{
/**
* Gets a list of all items in the inventory. The same item may appear multiple times with varying counts.
* @return A list of zero or more items in the inventory.
*/
@Nonnull
NonNullList<ItemRecord> getAllItems ();
/**
* Inserts an ItemStack into the inventory and returns the remainder.
*
* @param stack ItemStack to insert.
* @param simulate If true, the insertion is only simulated
* @param predicate See interface notes about predicates. Passing null specifies default matching.
* @return The remaining ItemStack that was not inserted. If the entire stack was accepted, returns
* ItemStack.EMPTY instead.
*/
@Nonnull
ItemStack insertItem (@Nonnull ItemStack stack, boolean simulate, Predicate<ItemStack> predicate);
@Nonnull
default ItemStack insertItem (@Nonnull ItemStack stack, boolean simulate) {
return insertItem(stack, simulate, null);
}
/**
* Tries to extract the given ItemStack from the inventory. The returned value will be a matching ItemStack
* with a stack size equal to or less than amount, or the empty ItemStack if the item could not be found at all.
* The returned stack size may exceed the ItemStack's getMaxStackSize() value.
* @param stack The item to extract. The stack size is ignored.
* @param amount Amount to extract (may be greater than the stacks max limit)
* @param simulate If true, the extraction is only simulated
* @param predicate See interface notes about predicates. Passing null specifies default matching.
* @return ItemStack extracted from the inventory, or ItemStack.EMPTY if nothing could be extracted.
*/
@Nonnull
ItemStack extractItem (@Nonnull ItemStack stack, int amount, boolean simulate, Predicate<ItemStack> predicate);
@Nonnull
default ItemStack extractItem (@Nonnull ItemStack stack, int amount, boolean simulate) {
return extractItem(stack, amount, simulate, null);
}
/**
* Gets the number of items matching the given ItemStack stored by the inventory.
* @param stack ItemStack to query.
* @param predicate See interface notes about predicates. Passing null specifies default matching.
* @return The number of stored matching items. A value of Integer.MAX_VALUE may indicate an infinite item source.
*/
default int getStoredItemCount (@Nonnull ItemStack stack, Predicate<ItemStack> predicate) {
ItemStack amount = extractItem(stack, Integer.MAX_VALUE, true, predicate);
return amount.getCount();
}
default int getStoredItemCount (@Nonnull ItemStack stack) {
return getStoredItemCount(stack, null);
}
/**
* Gets the number items matching the given ItemStack that additionally still be stored by the inventory.
* Remaining capacity may include space that is internally empty or unassigned to any given item.
*
* @param stack ItemStack to query.
* @param predicate See interface notes about predicates. Passing null specifies default matching.
* @return The available remaining space for matching items.
*/
default int getRemainingItemCapacity (@Nonnull ItemStack stack, Predicate<ItemStack> predicate) {
stack = stack.copy();
stack.setCount(Integer.MAX_VALUE);
ItemStack remainder = insertItem(stack, true, predicate);
return Integer.MAX_VALUE - remainder.getCount();
}
default int getRemainingItemCapacity (@Nonnull ItemStack stack) {
return getRemainingItemCapacity(stack, null);
}
/**
* Gets the total inventory capacity for items matching the given ItemStack.
* Total capacity may include space that is internally empty or unassigned to any given item.
*
* @param stack ItemStack to query.
* @param predicate See interface notes about predicates. Passing null specifies default matching.
* @return The total capacity for matching items.
*/
default int getItemCapacity (@Nonnull ItemStack stack, Predicate<ItemStack> predicate) {
long capacity = getStoredItemCount(stack, predicate) + getRemainingItemCapacity(stack, predicate);
if (capacity > Integer.MAX_VALUE)
return Integer.MAX_VALUE;
return (int)capacity;
}
default int getItemCapacity (@Nonnull ItemStack stack) {
return getItemCapacity(stack, null);
}
/**
* An item record representing an item and the amount stored.
*
* The ItemStack held by itemPrototype always reports a stack size of 1.
* IT IS IMPORTANT THAT YOU NEVER MODIFY itemPrototype.
*/
class ItemRecord
{
@Nonnull
public final ItemStack itemPrototype;
public final int count;
public ItemRecord (@Nonnull ItemStack itemPrototype, int count) {
this.itemPrototype = itemPrototype;
this.count = count;
}
}
/**
* A variant of the standard Predicate interface that when passed to IItemRepository functions, will ask the
* internal default predicate to be tested in addition to the custom predicate. An IItemRepository function
* may choose to enforce its own predicate regardless.
*/
interface DefaultPredicate<T> extends Predicate<T> { }
}
@@ -0,0 +1,14 @@
package yalter.mousetweaks.api;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Put this on your GuiScreen to disable Mouse Tweaks.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface MouseTweaksIgnore {
}
+379 -464
View File
@@ -19,11 +19,12 @@
package appeng.block;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Nullable;
import appeng.api.util.IOrientable;
import appeng.api.util.IOrientableBlock;
import appeng.helpers.AEGlassMaterial;
import appeng.helpers.ICustomCollision;
import appeng.util.LookDirection;
import appeng.util.Platform;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
@@ -46,464 +47,378 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import appeng.api.util.IOrientable;
import appeng.api.util.IOrientableBlock;
import appeng.helpers.AEGlassMaterial;
import appeng.helpers.ICustomCollision;
import appeng.util.LookDirection;
import appeng.util.Platform;
public abstract class AEBaseBlock extends Block
{
private boolean isOpaque = true;
private boolean isFullSize = true;
private boolean hasSubtypes = false;
private boolean isInventory = false;
protected AxisAlignedBB boundingBox = FULL_BLOCK_AABB;
protected AEBaseBlock( final Material mat )
{
super( mat );
if( mat == AEGlassMaterial.INSTANCE || mat == Material.GLASS )
{
this.setSoundType( SoundType.GLASS );
}
else if( mat == Material.ROCK )
{
this.setSoundType( SoundType.STONE );
}
else if( mat == Material.WOOD )
{
this.setSoundType( SoundType.WOOD );
}
else
{
this.setSoundType( SoundType.METAL );
}
this.setLightOpacity( 255 );
this.setLightLevel( 0 );
this.setHardness( 2.2F );
this.setHarvestLevel( "pickaxe", 0 );
// Workaround as vanilla sets it way too early.
this.fullBlock = this.isFullSize();
}
@Override
protected BlockStateContainer createBlockState()
{
return new BlockStateContainer( this, this.getAEStates() );
}
@Override
public final boolean isNormalCube( IBlockState state )
{
return this.isFullSize() && this.isOpaque();
}
@Override
public AxisAlignedBB getBoundingBox( IBlockState state, IBlockAccess source, BlockPos pos )
{
return this.boundingBox;
}
@SuppressWarnings( "deprecation" )
@Override
public void addCollisionBoxToList( final IBlockState state, final World w, final BlockPos pos, final AxisAlignedBB bb, final List<AxisAlignedBB> out, @Nullable final Entity e, boolean p_185477_7_ )
{
final ICustomCollision collisionHandler = this.getCustomCollision( w, pos );
if( collisionHandler != null && bb != null )
{
final List<AxisAlignedBB> tmp = new ArrayList<>();
collisionHandler.addCollidingBlockToList( w, pos, bb, tmp, e );
for( final AxisAlignedBB b : tmp )
{
final AxisAlignedBB offset = b.offset( pos.getX(), pos.getY(), pos.getZ() );
if( bb.intersects( offset ) )
{
out.add( offset );
}
}
}
else
{
super.addCollisionBoxToList( state, w, pos, bb, out, e, p_185477_7_ );
}
}
@SuppressWarnings( "deprecation" )
@Override
@SideOnly( Side.CLIENT )
public AxisAlignedBB getSelectedBoundingBox( IBlockState state, final World w, final BlockPos pos )
{
final ICustomCollision collisionHandler = this.getCustomCollision( w, pos );
if( collisionHandler != null )
{
if( Platform.isClient() )
{
final EntityPlayer player = Minecraft.getMinecraft().player;
final LookDirection ld = Platform.getPlayerRay( player, Platform.getEyeOffset( player ) );
final Iterable<AxisAlignedBB> bbs = collisionHandler.getSelectedBoundingBoxesFromPool( w, pos, Minecraft.getMinecraft().player, true );
AxisAlignedBB br = null;
double lastDist = 0;
for( final AxisAlignedBB bb : bbs )
{
this.boundingBox = bb;
final RayTraceResult r = super.collisionRayTrace( state, w, pos, ld.getA(), ld.getB() );
this.boundingBox = FULL_BLOCK_AABB;
if( r != null )
{
final double xLen = ( ld.getA().x - r.hitVec.x );
final double yLen = ( ld.getA().y - r.hitVec.y );
final double zLen = ( ld.getA().z - r.hitVec.z );
final double thisDist = xLen * xLen + yLen * yLen + zLen * zLen;
if( br == null || lastDist > thisDist )
{
lastDist = thisDist;
br = bb;
}
}
}
if( br != null )
{
br = new AxisAlignedBB( br.minX + pos.getX(), br.minY + pos.getY(), br.minZ + pos.getZ(), br.maxX + pos.getX(), br.maxY + pos
.getY(), br.maxZ + pos.getZ() );
return br;
}
}
AxisAlignedBB b = null; // new AxisAlignedBB( 16d, 16d, 16d, 0d, 0d, 0d );
for( final AxisAlignedBB bx : collisionHandler.getSelectedBoundingBoxesFromPool( w, pos, null, false ) )
{
if( b == null )
{
b = bx;
continue;
}
final double minX = Math.min( b.minX, bx.minX );
final double minY = Math.min( b.minY, bx.minY );
final double minZ = Math.min( b.minZ, bx.minZ );
final double maxX = Math.max( b.maxX, bx.maxX );
final double maxY = Math.max( b.maxY, bx.maxY );
final double maxZ = Math.max( b.maxZ, bx.maxZ );
b = new AxisAlignedBB( minX, minY, minZ, maxX, maxY, maxZ );
}
if( b == null )
{
b = new AxisAlignedBB( 16d, 16d, 16d, 0d, 0d, 0d );
}
else
{
b = new AxisAlignedBB( b.minX + pos.getX(), b.minY + pos.getY(), b.minZ + pos.getZ(), b.maxX + pos.getX(), b.maxY + pos.getY(), b.maxZ + pos
.getZ() );
}
return b;
}
return super.getSelectedBoundingBox( state, w, pos );
}
@Override
public final boolean isOpaqueCube( IBlockState state )
{
return this.isOpaque();
}
@SuppressWarnings( "deprecation" )
@Override
public RayTraceResult collisionRayTrace( final IBlockState state, final World w, final BlockPos pos, final Vec3d a, final Vec3d b )
{
final ICustomCollision collisionHandler = this.getCustomCollision( w, pos );
if( collisionHandler != null )
{
final Iterable<AxisAlignedBB> bbs = collisionHandler.getSelectedBoundingBoxesFromPool( w, pos, null, true );
RayTraceResult br = null;
double lastDist = 0;
for( final AxisAlignedBB bb : bbs )
{
this.boundingBox = bb;
final RayTraceResult r = super.collisionRayTrace( state, w, pos, a, b );
this.boundingBox = FULL_BLOCK_AABB;
if( r != null )
{
final double xLen = ( a.x - r.hitVec.x );
final double yLen = ( a.y - r.hitVec.y );
final double zLen = ( a.z - r.hitVec.z );
final double thisDist = xLen * xLen + yLen * yLen + zLen * zLen;
if( br == null || lastDist > thisDist )
{
lastDist = thisDist;
br = r;
}
}
}
if( br != null )
{
return br;
}
return null;
}
this.boundingBox = FULL_BLOCK_AABB;
return super.collisionRayTrace( state, w, pos, a, b );
}
@Override
public boolean hasComparatorInputOverride( IBlockState state )
{
return this.isInventory();
}
@Override
public int getComparatorInputOverride( IBlockState state, final World worldIn, final BlockPos pos )
{
return 0;
}
@Override
public final boolean isNormalCube( IBlockState state, final IBlockAccess world, final BlockPos pos )
{
return this.isFullSize();
}
@Override
public boolean rotateBlock( final World w, final BlockPos pos, final EnumFacing axis )
{
final IOrientable rotatable = this.getOrientable( w, pos );
if( rotatable != null && rotatable.canBeRotated() )
{
if( this.hasCustomRotation() )
{
this.customRotateBlock( rotatable, axis );
return true;
}
else
{
EnumFacing forward = rotatable.getForward();
EnumFacing up = rotatable.getUp();
for( int rs = 0; rs < 4; rs++ )
{
forward = Platform.rotateAround( forward, axis );
up = Platform.rotateAround( up, axis );
if( this.isValidOrientation( w, pos, forward, up ) )
{
rotatable.setOrientation( forward, up );
return true;
}
}
}
}
return super.rotateBlock( w, pos, axis );
}
@Override
public EnumFacing[] getValidRotations( final World w, final BlockPos pos )
{
return new EnumFacing[0];
}
@SideOnly( Side.CLIENT )
@Override
public void addInformation( final ItemStack is, final World world, final List<String> lines, final ITooltipFlag advancedItemTooltips )
{
}
public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
{
return false;
}
public final EnumFacing mapRotation( final IOrientable ori, final EnumFacing dir )
{
// case DOWN: return bottomIcon;
// case UP: return blockIcon;
// case NORTH: return northIcon;
// case SOUTH: return southIcon;
// case WEST: return sideIcon;
// case EAST: return sideIcon;
final EnumFacing forward = ori.getForward();
final EnumFacing up = ori.getUp();
if( forward == null || up == null )
{
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();
EnumFacing west = null;
for( final EnumFacing dx : EnumFacing.VALUES )
{
if( dx.getFrontOffsetX() == west_x && dx.getFrontOffsetY() == west_y && dx.getFrontOffsetZ() == west_z )
{
west = dx;
}
}
if( west == null )
{
return dir;
}
if( dir == forward )
{
return EnumFacing.SOUTH;
}
if( dir == forward.getOpposite() )
{
return EnumFacing.NORTH;
}
if( dir == up )
{
return EnumFacing.UP;
}
if( dir == up.getOpposite() )
{
return EnumFacing.DOWN;
}
if( dir == west )
{
return EnumFacing.WEST;
}
if( dir == west.getOpposite() )
{
return EnumFacing.EAST;
}
return null;
}
@Override
public String toString()
{
String regName = this.getRegistryName() != null ? this.getRegistryName().getResourcePath() : "unregistered";
return this.getClass().getSimpleName() + "[" + regName + "]";
}
protected String getUnlocalizedName( final ItemStack is )
{
return this.getUnlocalizedName();
}
protected boolean hasCustomRotation()
{
return false;
}
protected void customRotateBlock( final IOrientable rotatable, final EnumFacing axis )
{
}
protected IOrientable getOrientable( final IBlockAccess w, final BlockPos pos )
{
if( this instanceof IOrientableBlock )
{
IOrientableBlock orientable = (IOrientableBlock) this;
return orientable.getOrientable( w, pos );
}
return null;
}
protected boolean isValidOrientation( final World w, final BlockPos pos, final EnumFacing forward, final EnumFacing up )
{
return true;
}
protected ICustomCollision getCustomCollision( final World w, final BlockPos pos )
{
if( this instanceof ICustomCollision )
{
return (ICustomCollision) this;
}
return null;
}
protected IProperty[] getAEStates()
{
return new IProperty[0];
}
protected boolean isOpaque()
{
return this.isOpaque;
}
protected boolean setOpaque( final boolean isOpaque )
{
this.isOpaque = isOpaque;
return isOpaque;
}
protected boolean hasSubtypes()
{
return this.hasSubtypes;
}
protected void setHasSubtypes( final boolean hasSubtypes )
{
this.hasSubtypes = hasSubtypes;
}
protected boolean isFullSize()
{
return this.isFullSize;
}
protected boolean setFullSize( final boolean isFullSize )
{
this.isFullSize = isFullSize;
return isFullSize;
}
protected boolean isInventory()
{
return this.isInventory;
}
protected void setInventory( final boolean isInventory )
{
this.isInventory = isInventory;
}
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;
public abstract class AEBaseBlock extends Block {
private boolean isOpaque = true;
private boolean isFullSize = true;
private boolean hasSubtypes = false;
private boolean isInventory = false;
protected AxisAlignedBB boundingBox = FULL_BLOCK_AABB;
protected AEBaseBlock(final Material mat) {
super(mat);
if (mat == AEGlassMaterial.INSTANCE || mat == Material.GLASS) {
this.setSoundType(SoundType.GLASS);
} else if (mat == Material.ROCK) {
this.setSoundType(SoundType.STONE);
} else if (mat == Material.WOOD) {
this.setSoundType(SoundType.WOOD);
} else {
this.setSoundType(SoundType.METAL);
}
this.setLightOpacity(255);
this.setLightLevel(0);
this.setHardness(2.2F);
this.setHarvestLevel("pickaxe", 0);
// Workaround as vanilla sets it way too early.
this.fullBlock = this.isFullSize();
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, this.getAEStates());
}
@Override
public final boolean isNormalCube(IBlockState state) {
return this.isFullSize() && this.isOpaque();
}
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
return this.boundingBox;
}
@SuppressWarnings("deprecation")
@Override
public void addCollisionBoxToList(final IBlockState state, final World w, final BlockPos pos, final AxisAlignedBB bb, final List<AxisAlignedBB> out, @Nullable final Entity e, boolean p_185477_7_) {
final ICustomCollision collisionHandler = this.getCustomCollision(w, pos);
if (collisionHandler != null && bb != null) {
final List<AxisAlignedBB> tmp = new ArrayList<>();
collisionHandler.addCollidingBlockToList(w, pos, bb, tmp, e);
for (final AxisAlignedBB b : tmp) {
final AxisAlignedBB offset = b.offset(pos.getX(), pos.getY(), pos.getZ());
if (bb.intersects(offset)) {
out.add(offset);
}
}
} else {
super.addCollisionBoxToList(state, w, pos, bb, out, e, p_185477_7_);
}
}
@SuppressWarnings("deprecation")
@Override
@SideOnly(Side.CLIENT)
public AxisAlignedBB getSelectedBoundingBox(IBlockState state, final World w, final BlockPos pos) {
final ICustomCollision collisionHandler = this.getCustomCollision(w, pos);
if (collisionHandler != null) {
if (Platform.isClient()) {
final EntityPlayer player = Minecraft.getMinecraft().player;
final LookDirection ld = Platform.getPlayerRay(player, Platform.getEyeOffset(player));
final Iterable<AxisAlignedBB> bbs = collisionHandler.getSelectedBoundingBoxesFromPool(w, pos, Minecraft.getMinecraft().player, true);
AxisAlignedBB br = null;
double lastDist = 0;
for (final AxisAlignedBB bb : bbs) {
this.boundingBox = bb;
final RayTraceResult r = super.collisionRayTrace(state, w, pos, ld.getA(), ld.getB());
this.boundingBox = FULL_BLOCK_AABB;
if (r != null) {
final double xLen = (ld.getA().x - r.hitVec.x);
final double yLen = (ld.getA().y - r.hitVec.y);
final double zLen = (ld.getA().z - r.hitVec.z);
final double thisDist = xLen * xLen + yLen * yLen + zLen * zLen;
if (br == null || lastDist > thisDist) {
lastDist = thisDist;
br = bb;
}
}
}
if (br != null) {
br = new AxisAlignedBB(br.minX + pos.getX(), br.minY + pos.getY(), br.minZ + pos.getZ(), br.maxX + pos.getX(), br.maxY + pos
.getY(), br.maxZ + pos.getZ());
return br;
}
}
AxisAlignedBB b = null; // new AxisAlignedBB( 16d, 16d, 16d, 0d, 0d, 0d );
for (final AxisAlignedBB bx : collisionHandler.getSelectedBoundingBoxesFromPool(w, pos, null, false)) {
if (b == null) {
b = bx;
continue;
}
final double minX = Math.min(b.minX, bx.minX);
final double minY = Math.min(b.minY, bx.minY);
final double minZ = Math.min(b.minZ, bx.minZ);
final double maxX = Math.max(b.maxX, bx.maxX);
final double maxY = Math.max(b.maxY, bx.maxY);
final double maxZ = Math.max(b.maxZ, bx.maxZ);
b = new AxisAlignedBB(minX, minY, minZ, maxX, maxY, maxZ);
}
if (b == null) {
b = new AxisAlignedBB(16d, 16d, 16d, 0d, 0d, 0d);
} else {
b = new AxisAlignedBB(b.minX + pos.getX(), b.minY + pos.getY(), b.minZ + pos.getZ(), b.maxX + pos.getX(), b.maxY + pos.getY(), b.maxZ + pos
.getZ());
}
return b;
}
return super.getSelectedBoundingBox(state, w, pos);
}
@Override
public final boolean isOpaqueCube(IBlockState state) {
return this.isOpaque();
}
@SuppressWarnings("deprecation")
@Override
public RayTraceResult collisionRayTrace(final IBlockState state, final World w, final BlockPos pos, final Vec3d a, final Vec3d b) {
final ICustomCollision collisionHandler = this.getCustomCollision(w, pos);
if (collisionHandler != null) {
final Iterable<AxisAlignedBB> bbs = collisionHandler.getSelectedBoundingBoxesFromPool(w, pos, null, true);
RayTraceResult br = null;
double lastDist = 0;
for (final AxisAlignedBB bb : bbs) {
this.boundingBox = bb;
final RayTraceResult r = super.collisionRayTrace(state, w, pos, a, b);
this.boundingBox = FULL_BLOCK_AABB;
if (r != null) {
final double xLen = (a.x - r.hitVec.x);
final double yLen = (a.y - r.hitVec.y);
final double zLen = (a.z - r.hitVec.z);
final double thisDist = xLen * xLen + yLen * yLen + zLen * zLen;
if (br == null || lastDist > thisDist) {
lastDist = thisDist;
br = r;
}
}
}
return br;
}
this.boundingBox = FULL_BLOCK_AABB;
return super.collisionRayTrace(state, w, pos, a, b);
}
@Override
public boolean hasComparatorInputOverride(IBlockState state) {
return this.isInventory();
}
@Override
public int getComparatorInputOverride(IBlockState state, final World worldIn, final BlockPos pos) {
return 0;
}
@Override
public final boolean isNormalCube(IBlockState state, final IBlockAccess world, final BlockPos pos) {
return this.isFullSize();
}
@Override
public boolean rotateBlock(final World w, final BlockPos pos, final EnumFacing axis) {
final IOrientable rotatable = this.getOrientable(w, pos);
if (rotatable != null && rotatable.canBeRotated()) {
if (this.hasCustomRotation()) {
this.customRotateBlock(rotatable, axis);
return true;
} else {
EnumFacing forward = rotatable.getForward();
EnumFacing up = rotatable.getUp();
for (int rs = 0; rs < 4; rs++) {
forward = Platform.rotateAround(forward, axis);
up = Platform.rotateAround(up, axis);
if (this.isValidOrientation(w, pos, forward, up)) {
rotatable.setOrientation(forward, up);
return true;
}
}
}
}
return super.rotateBlock(w, pos, axis);
}
@Override
public EnumFacing[] getValidRotations(final World w, final BlockPos pos) {
return new EnumFacing[0];
}
@SideOnly(Side.CLIENT)
@Override
public void addInformation(final ItemStack is, final World world, final List<String> lines, final ITooltipFlag advancedItemTooltips) {
}
public boolean onActivated(final World w, final BlockPos pos, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ) {
return false;
}
public final EnumFacing mapRotation(final IOrientable ori, final EnumFacing dir) {
// case DOWN: return bottomIcon;
// case UP: return blockIcon;
// case NORTH: return northIcon;
// case SOUTH: return southIcon;
// case WEST: return sideIcon;
// case EAST: return sideIcon;
final EnumFacing forward = ori.getForward();
final EnumFacing up = ori.getUp();
if (forward == null || up == null) {
return dir;
}
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.getXOffset() == west_x && dx.getYOffset() == west_y && dx.getZOffset() == west_z) {
west = dx;
}
}
if (west == null) {
return dir;
}
if (dir == forward) {
return EnumFacing.SOUTH;
}
if (dir == forward.getOpposite()) {
return EnumFacing.NORTH;
}
if (dir == up) {
return EnumFacing.UP;
}
if (dir == up.getOpposite()) {
return EnumFacing.DOWN;
}
if (dir == west) {
return EnumFacing.WEST;
}
if (dir == west.getOpposite()) {
return EnumFacing.EAST;
}
return null;
}
@Override
public String toString() {
String regName = this.getRegistryName() != null ? this.getRegistryName().getPath() : "unregistered";
return this.getClass().getSimpleName() + "[" + regName + "]";
}
protected String getTranslationKey(final ItemStack is) {
return this.getTranslationKey();
}
protected boolean hasCustomRotation() {
return false;
}
protected void customRotateBlock(final IOrientable rotatable, final EnumFacing axis) {
}
protected IOrientable getOrientable(final IBlockAccess w, final BlockPos pos) {
if (this instanceof IOrientableBlock) {
IOrientableBlock orientable = (IOrientableBlock) this;
return orientable.getOrientable(w, pos);
}
return null;
}
protected boolean isValidOrientation(final World w, final BlockPos pos, final EnumFacing forward, final EnumFacing up) {
return true;
}
protected ICustomCollision getCustomCollision(final World w, final BlockPos pos) {
if (this instanceof ICustomCollision) {
return (ICustomCollision) this;
}
return null;
}
protected IProperty[] getAEStates() {
return new IProperty[0];
}
protected boolean isOpaque() {
return this.isOpaque;
}
protected boolean setOpaque(final boolean isOpaque) {
this.isOpaque = isOpaque;
return isOpaque;
}
protected boolean hasSubtypes() {
return this.hasSubtypes;
}
protected void setHasSubtypes(final boolean hasSubtypes) {
this.hasSubtypes = hasSubtypes;
}
protected boolean isFullSize() {
return this.isFullSize;
}
protected boolean setFullSize(final boolean isFullSize) {
this.isFullSize = isFullSize;
return isFullSize;
}
protected boolean isInventory() {
return this.isInventory;
}
protected void setInventory(final boolean isInventory) {
this.isInventory = isInventory;
}
}
+120 -154
View File
@@ -19,8 +19,13 @@
package appeng.block;
import java.util.List;
import appeng.api.util.IOrientable;
import appeng.api.util.IOrientableBlock;
import appeng.block.misc.BlockLightDetector;
import appeng.block.misc.BlockSkyCompass;
import appeng.block.networking.BlockWireless;
import appeng.me.helpers.IGridProxyable;
import appeng.tile.AEBaseTile;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.util.ITooltipFlag;
@@ -33,179 +38,140 @@ 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 appeng.api.util.IOrientable;
import appeng.api.util.IOrientableBlock;
import appeng.block.misc.BlockLightDetector;
import appeng.block.misc.BlockSkyCompass;
import appeng.block.networking.BlockWireless;
import appeng.me.helpers.IGridProxyable;
import appeng.tile.AEBaseTile;
import java.util.List;
public class AEBaseItemBlock extends ItemBlock
{
public class AEBaseItemBlock extends ItemBlock {
private final AEBaseBlock blockType;
private final AEBaseBlock blockType;
public AEBaseItemBlock( final Block id )
{
super( id );
this.blockType = (AEBaseBlock) id;
this.hasSubtypes = this.blockType.hasSubtypes();
}
public AEBaseItemBlock(final Block id) {
super(id);
this.blockType = (AEBaseBlock) id;
this.hasSubtypes = this.blockType.hasSubtypes();
}
@Override
public int getMetadata( final int dmg )
{
if( this.hasSubtypes )
{
return dmg;
}
return 0;
}
@Override
public int getMetadata(final int dmg) {
if (this.hasSubtypes) {
return dmg;
}
return 0;
}
@Override
@SideOnly( Side.CLIENT )
public final void addInformation( final ItemStack itemStack, final World world, final List<String> toolTip, final ITooltipFlag advancedTooltips )
{
this.addCheckedInformation( itemStack, world, toolTip, advancedTooltips );
}
@Override
@SideOnly(Side.CLIENT)
public final void addInformation(final ItemStack itemStack, final World world, final List<String> toolTip, final ITooltipFlag advancedTooltips) {
this.addCheckedInformation(itemStack, world, toolTip, advancedTooltips);
}
@SideOnly( Side.CLIENT )
public void addCheckedInformation( final ItemStack itemStack, final World world, final List<String> toolTip, final ITooltipFlag advancedTooltips )
{
this.blockType.addInformation( itemStack, world, toolTip, advancedTooltips );
}
@SideOnly(Side.CLIENT)
public void addCheckedInformation(final ItemStack itemStack, final World world, final List<String> toolTip, final ITooltipFlag advancedTooltips) {
this.blockType.addInformation(itemStack, world, toolTip, advancedTooltips);
}
@Override
public boolean isBookEnchantable( final ItemStack itemstack1, final ItemStack itemstack2 )
{
return false;
}
@Override
public boolean isBookEnchantable(final ItemStack itemstack1, final ItemStack itemstack2) {
return false;
}
@Override
public String getUnlocalizedName( final ItemStack is )
{
return this.blockType.getUnlocalizedName( is );
}
@Override
@NotNull
public String getTranslationKey(final ItemStack is) {
return this.blockType.getTranslationKey(is);
}
@Override
public boolean placeBlockAt( final ItemStack stack, final EntityPlayer player, final World w, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final IBlockState newState )
{
EnumFacing up = null;
EnumFacing forward = null;
@Override
public boolean placeBlockAt(final ItemStack stack, final EntityPlayer player, final World w, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final IBlockState newState) {
EnumFacing up = null;
EnumFacing forward = null;
if( this.blockType instanceof AEBaseTileBlock )
{
if( this.blockType instanceof BlockLightDetector )
{
up = side;
if( up == EnumFacing.UP || up == EnumFacing.DOWN )
{
forward = EnumFacing.SOUTH;
}
else
{
forward = EnumFacing.UP;
}
}
else if( this.blockType instanceof BlockWireless || this.blockType instanceof BlockSkyCompass )
{
forward = side;
if( forward == EnumFacing.UP || forward == EnumFacing.DOWN )
{
up = EnumFacing.SOUTH;
}
else
{
up = EnumFacing.UP;
}
}
else
{
up = EnumFacing.UP;
if (this.blockType instanceof AEBaseTileBlock) {
if (this.blockType instanceof BlockLightDetector) {
up = side;
if (up == EnumFacing.UP || up == EnumFacing.DOWN) {
forward = EnumFacing.SOUTH;
} else {
forward = EnumFacing.UP;
}
} else if (this.blockType instanceof BlockWireless || this.blockType instanceof BlockSkyCompass) {
forward = side;
if (forward == EnumFacing.UP || forward == EnumFacing.DOWN) {
up = EnumFacing.SOUTH;
} else {
up = EnumFacing.UP;
}
} else {
up = EnumFacing.UP;
final byte rotation = (byte) ( MathHelper.floor( ( player.rotationYaw * 4F ) / 360F + 2.5D ) & 3 );
final byte rotation = (byte) (MathHelper.floor((player.rotationYaw * 4F) / 360F + 2.5D) & 3);
switch( rotation )
{
default:
case 0:
forward = EnumFacing.SOUTH;
break;
case 1:
forward = EnumFacing.WEST;
break;
case 2:
forward = EnumFacing.NORTH;
break;
case 3:
forward = EnumFacing.EAST;
break;
}
switch (rotation) {
default:
case 0:
forward = EnumFacing.SOUTH;
break;
case 1:
forward = EnumFacing.WEST;
break;
case 2:
forward = EnumFacing.NORTH;
break;
case 3:
forward = EnumFacing.EAST;
break;
}
if( player.rotationPitch > 65 )
{
up = forward.getOpposite();
forward = EnumFacing.UP;
}
else if( player.rotationPitch < -65 )
{
up = forward.getOpposite();
forward = EnumFacing.DOWN;
}
}
}
if (player.rotationPitch > 65) {
up = forward.getOpposite();
forward = EnumFacing.UP;
} else if (player.rotationPitch < -65) {
up = forward.getOpposite();
forward = EnumFacing.DOWN;
}
}
}
IOrientable ori = null;
if( this.blockType instanceof IOrientableBlock )
{
ori = ( (IOrientableBlock) this.blockType ).getOrientable( w, pos );
up = side;
forward = EnumFacing.SOUTH;
if( up.getFrontOffsetY() == 0 )
{
forward = EnumFacing.UP;
}
}
IOrientable ori = null;
if (this.blockType instanceof IOrientableBlock) {
ori = ((IOrientableBlock) this.blockType).getOrientable(w, pos);
up = side;
forward = EnumFacing.SOUTH;
if (up.getYOffset() == 0) {
forward = EnumFacing.UP;
}
}
if( !this.blockType.isValidOrientation( w, pos, forward, up ) )
{
return false;
}
if (!this.blockType.isValidOrientation(w, pos, forward, up)) {
return false;
}
if( super.placeBlockAt( stack, player, w, pos, side, hitX, hitY, hitZ, newState ) )
{
if( this.blockType instanceof AEBaseTileBlock && !( this.blockType instanceof BlockLightDetector ) )
{
final AEBaseTile tile = ( (AEBaseTileBlock) this.blockType ).getTileEntity( w, pos );
ori = tile;
if (super.placeBlockAt(stack, player, w, pos, side, hitX, hitY, hitZ, newState)) {
if (this.blockType instanceof AEBaseTileBlock && !(this.blockType instanceof BlockLightDetector)) {
final AEBaseTile tile = ((AEBaseTileBlock) this.blockType).getTileEntity(w, pos);
ori = tile;
if( tile == null )
{
return true;
}
if (tile == null) {
return true;
}
if( ori.canBeRotated() && !this.blockType.hasCustomRotation() )
{
ori.setOrientation( forward, up );
}
if (ori.canBeRotated() && !this.blockType.hasCustomRotation()) {
ori.setOrientation(forward, up);
}
if( tile instanceof IGridProxyable )
{
( (IGridProxyable) tile ).getProxy().setOwner( player );
}
if (tile instanceof IGridProxyable) {
((IGridProxyable) tile).getProxy().setOwner(player);
}
tile.onPlacement( stack, player, side );
}
else if( this.blockType instanceof IOrientableBlock )
{
ori.setOrientation( forward, up );
}
tile.onPlacement(stack, player, side);
} else if (this.blockType instanceof IOrientableBlock) {
ori.setOrientation(forward, up);
}
return true;
}
return false;
}
return true;
}
return false;
}
}
@@ -19,17 +19,6 @@
package appeng.block;
import java.text.MessageFormat;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import appeng.api.config.AccessRestriction;
import appeng.api.config.Actionable;
import appeng.api.config.PowerUnits;
@@ -38,118 +27,110 @@ import appeng.api.implementations.items.IAEItemPowerStorage;
import appeng.core.Api;
import appeng.core.localization.GuiText;
import appeng.util.Platform;
import net.minecraft.block.Block;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.text.MessageFormat;
import java.util.List;
public class AEBaseItemBlockChargeable extends AEBaseItemBlock implements IAEItemPowerStorage
{
public class AEBaseItemBlockChargeable extends AEBaseItemBlock implements IAEItemPowerStorage {
public AEBaseItemBlockChargeable( final Block id )
{
super( id );
}
public AEBaseItemBlockChargeable(final Block id) {
super(id);
}
@Override
@SideOnly( Side.CLIENT )
public void addCheckedInformation( final ItemStack stack, final World world, final List<String> lines, final ITooltipFlag advancedTooltips )
{
final NBTTagCompound tag = stack.getTagCompound();
double internalCurrentPower = 0;
final double internalMaxPower = this.getMaxEnergyCapacity();
@Override
@SideOnly(Side.CLIENT)
public void addCheckedInformation(final ItemStack stack, final World world, final List<String> lines, final ITooltipFlag advancedTooltips) {
final NBTTagCompound tag = stack.getTagCompound();
double internalCurrentPower = 0;
final double internalMaxPower = this.getMaxEnergyCapacity();
if( internalMaxPower > 0 )
{
if( tag != null )
{
internalCurrentPower = tag.getDouble( "internalCurrentPower" );
}
if (internalMaxPower > 0) {
if (tag != null) {
internalCurrentPower = tag.getDouble("internalCurrentPower");
}
final double percent = internalCurrentPower / internalMaxPower;
final double percent = internalCurrentPower / internalMaxPower;
lines.add( GuiText.StoredEnergy.getLocal() + ':' + MessageFormat.format( " {0,number,#} ", internalCurrentPower ) + Platform
.gui_localize( PowerUnits.AE.unlocalizedName ) + " - " + MessageFormat.format( " {0,number,#.##%} ", percent ) );
}
}
lines.add(GuiText.StoredEnergy.getLocal() + ':' + MessageFormat.format(" {0,number,#} ", internalCurrentPower) + Platform
.gui_localize(PowerUnits.AE.unlocalizedName) + " - " + MessageFormat.format(" {0,number,#.##%} ", percent));
}
}
@Override
public double injectAEPower( final ItemStack is, double amount, Actionable mode )
{
final double internalCurrentPower = this.getInternal( is );
final double internalMaxPower = this.getAEMaxPower( is );
final double required = internalMaxPower - internalCurrentPower;
final double overflow = Math.max( 0, amount - required );
@Override
public double injectAEPower(final ItemStack is, double amount, Actionable mode) {
final double internalCurrentPower = this.getInternal(is);
final double internalMaxPower = this.getAEMaxPower(is);
final double required = internalMaxPower - internalCurrentPower;
final double overflow = Math.max(0, amount - required);
if( mode == Actionable.MODULATE )
{
final double toAdd = Math.min( required, amount );
final double newPowerStored = internalCurrentPower + toAdd;
if (mode == Actionable.MODULATE) {
final double toAdd = Math.min(required, amount);
final double newPowerStored = internalCurrentPower + toAdd;
this.setInternal( is, newPowerStored );
}
this.setInternal(is, newPowerStored);
}
return overflow;
}
return overflow;
}
@Override
public double extractAEPower( final ItemStack is, double amount, Actionable mode )
{
final double internalCurrentPower = this.getInternal( is );
final double fulfillable = Math.min( amount, internalCurrentPower );
@Override
public double extractAEPower(final ItemStack is, double amount, Actionable mode) {
final double internalCurrentPower = this.getInternal(is);
final double fulfillable = Math.min(amount, internalCurrentPower);
if( mode == Actionable.MODULATE )
{
final double newPowerStored = internalCurrentPower - fulfillable;
if (mode == Actionable.MODULATE) {
final double newPowerStored = internalCurrentPower - fulfillable;
this.setInternal( is, newPowerStored );
}
this.setInternal(is, newPowerStored);
}
return fulfillable;
}
return fulfillable;
}
@Override
public double getAEMaxPower( final ItemStack is )
{
return this.getMaxEnergyCapacity();
}
@Override
public double getAEMaxPower(final ItemStack is) {
return this.getMaxEnergyCapacity();
}
@Override
public double getAECurrentPower( final ItemStack is )
{
return this.getInternal( is );
}
@Override
public double getAECurrentPower(final ItemStack is) {
return this.getInternal(is);
}
@Override
public AccessRestriction getPowerFlow( final ItemStack is )
{
return AccessRestriction.WRITE;
}
@Override
public AccessRestriction getPowerFlow(final ItemStack is) {
return AccessRestriction.WRITE;
}
private double getMaxEnergyCapacity()
{
final Block blockID = Block.getBlockFromItem( this );
final IBlockDefinition energyCell = Api.INSTANCE.definitions().blocks().energyCell();
private double getMaxEnergyCapacity() {
final Block blockID = Block.getBlockFromItem(this);
final IBlockDefinition energyCell = Api.INSTANCE.definitions().blocks().energyCell();
return energyCell.maybeBlock().map( block ->
{
if( blockID == block )
{
return 200000;
}
else
{
return 8 * 200000;
}
} ).orElse( 0 );
}
return energyCell.maybeBlock().map(block ->
{
if (blockID == block) {
return 200000;
} else {
return 8 * 200000;
}
}).orElse(0);
}
private double getInternal( final ItemStack is )
{
final NBTTagCompound nbt = Platform.openNbtData( is );
return nbt.getDouble( "internalCurrentPower" );
}
private double getInternal(final ItemStack is) {
final NBTTagCompound nbt = Platform.openNbtData(is);
return nbt.getDouble("internalCurrentPower");
}
private void setInternal( final ItemStack is, final double amt )
{
final NBTTagCompound nbt = Platform.openNbtData( is );
nbt.setDouble( "internalCurrentPower", amt );
}
private void setInternal(final ItemStack is, final double amt) {
final NBTTagCompound nbt = Platform.openNbtData(is);
nbt.setDouble("internalCurrentPower", amt);
}
}
@@ -20,31 +20,38 @@ 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
{
public abstract class AEBaseStairBlock extends BlockStairs {
protected AEBaseStairBlock( final Block block, final String type )
{
super( block.getDefaultState() );
protected AEBaseStairBlock(final Block block, final String type) {
super(block.getDefaultState());
Preconditions.checkNotNull( block );
Preconditions.checkNotNull( block.getUnlocalizedName() );
Preconditions.checkArgument( block.getUnlocalizedName().length() > 0 );
Preconditions.checkNotNull(block);
Preconditions.checkNotNull(block.getTranslationKey());
Preconditions.checkArgument(block.getTranslationKey().length() > 0);
this.setUnlocalizedName( "stair." + type );
this.setLightOpacity( 0 );
}
this.setTranslationKey("stair." + type);
this.setLightOpacity(0);
}
@Override
public String toString()
{
String regName = this.getRegistryName() != null ? this.getRegistryName().getResourcePath() : "unregistered";
return this.getClass().getSimpleName() + "[" + regName + "]";
}
@Override
public String toString() {
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;
}
}
+244 -296
View File
@@ -19,14 +19,23 @@
package appeng.block;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import appeng.api.implementations.items.IMemoryCard;
import appeng.api.implementations.items.MemoryCardMessages;
import appeng.api.implementations.tiles.IColorableTile;
import appeng.api.util.AEColor;
import appeng.api.util.AEPartLocation;
import appeng.api.util.IOrientable;
import appeng.block.networking.BlockCableBus;
import appeng.core.sync.GuiBridge;
import appeng.helpers.ICustomCollision;
import appeng.items.tools.quartz.ToolQuartzCuttingKnife;
import appeng.tile.AEBaseInvTile;
import appeng.tile.AEBaseTile;
import appeng.tile.networking.TileCableBus;
import appeng.tile.storage.TileSkyChest;
import appeng.util.Platform;
import appeng.util.SettingsFrom;
import com.google.common.collect.Lists;
import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
@@ -46,348 +55,287 @@ import net.minecraft.world.World;
import net.minecraftforge.common.property.ExtendedBlockState;
import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.common.property.IUnlistedProperty;
import net.minecraftforge.event.ForgeEventFactory;
import net.minecraftforge.items.ItemHandlerHelper;
import appeng.api.implementations.items.IMemoryCard;
import appeng.api.implementations.items.MemoryCardMessages;
import appeng.api.implementations.tiles.IColorableTile;
import appeng.api.util.AEColor;
import appeng.api.util.IOrientable;
import appeng.block.networking.BlockCableBus;
import appeng.helpers.ICustomCollision;
import appeng.tile.AEBaseInvTile;
import appeng.tile.AEBaseTile;
import appeng.tile.networking.TileCableBus;
import appeng.tile.storage.TileSkyChest;
import appeng.util.Platform;
import appeng.util.SettingsFrom;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;
public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntityProvider
{
public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntityProvider {
@Nonnull
private Class<? extends AEBaseTile> tileEntityType;
@Nonnull
private Class<? extends AEBaseTile> tileEntityType;
public AEBaseTileBlock( final Material mat )
{
super( mat );
}
public AEBaseTileBlock(final Material mat) {
super(mat);
}
public static final UnlistedDirection FORWARD = new UnlistedDirection( "forward" );
public static final UnlistedDirection UP = new UnlistedDirection( "up" );
public static final UnlistedDirection FORWARD = new UnlistedDirection("forward");
public static final UnlistedDirection UP = new UnlistedDirection("up");
@Override
public IBlockState getExtendedState( IBlockState state, IBlockAccess world, BlockPos pos )
{
// A subclass may decide it doesn't want extended block state for whatever reason
if( !( state instanceof IExtendedBlockState ) )
{
return state;
}
@Override
public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) {
// A subclass may decide it doesn't want extended block state for whatever reason
if (!(state instanceof IExtendedBlockState)) {
return state;
}
AEBaseTile tile = this.getTileEntity( world, pos );
if( tile == null )
{
return state; // No info available
}
AEBaseTile tile = this.getTileEntity(world, pos);
if (tile == null) {
return state; // No info available
}
IExtendedBlockState extState = (IExtendedBlockState) state;
return extState.withProperty( FORWARD, tile.getForward() ).withProperty( UP, tile.getUp() );
}
IExtendedBlockState extState = (IExtendedBlockState) state;
return extState.withProperty(FORWARD, tile.getForward()).withProperty(UP, tile.getUp());
}
@Override
protected BlockStateContainer createBlockState()
{
return new ExtendedBlockState( this, this.getAEStates(), new IUnlistedProperty[] {
FORWARD,
UP
} );
}
@Override
protected BlockStateContainer createBlockState() {
return new ExtendedBlockState(this, this.getAEStates(), new IUnlistedProperty[]{
FORWARD,
UP
});
}
@Override
public int getMetaFromState( IBlockState state )
{
return 0;
}
@Override
public int getMetaFromState(IBlockState state) {
return 0;
}
// TODO : Was this change needed?
public void setTileEntity( final Class<? extends AEBaseTile> c )
{
this.tileEntityType = c;
this.setInventory( AEBaseInvTile.class.isAssignableFrom( c ) );
}
// TODO : Was this change needed?
public void setTileEntity(final Class<? extends AEBaseTile> c) {
this.tileEntityType = c;
this.setInventory(AEBaseInvTile.class.isAssignableFrom(c));
}
@Override
public boolean hasTileEntity( IBlockState state )
{
return this.hasBlockTileEntity();
}
@Override
public boolean hasTileEntity(IBlockState state) {
return this.hasBlockTileEntity();
}
private boolean hasBlockTileEntity()
{
return this.tileEntityType != null;
}
private boolean hasBlockTileEntity() {
return this.tileEntityType != null;
}
public Class<? extends AEBaseTile> getTileEntityClass()
{
return this.tileEntityType;
}
public Class<? extends AEBaseTile> getTileEntityClass() {
return this.tileEntityType;
}
@Nullable
public <T extends AEBaseTile> T getTileEntity( final IBlockAccess w, final int x, final int y, final int z )
{
return this.getTileEntity( w, new BlockPos( x, y, z ) );
}
@Nullable
public <T extends AEBaseTile> T getTileEntity(final IBlockAccess w, final int x, final int y, final int z) {
return this.getTileEntity(w, new BlockPos(x, y, z));
}
@Nullable
public <T extends AEBaseTile> T getTileEntity( final IBlockAccess w, final BlockPos pos )
{
if( !this.hasBlockTileEntity() )
{
return null;
}
@Nullable
public <T extends AEBaseTile> T getTileEntity(final IBlockAccess w, final BlockPos pos) {
if (!this.hasBlockTileEntity()) {
return null;
}
final TileEntity te = w.getTileEntity( pos );
if( this.tileEntityType.isInstance( te ) )
{
return (T) te;
}
final TileEntity te = w.getTileEntity(pos);
if (this.tileEntityType.isInstance(te)) {
return (T) te;
}
return null;
}
return null;
}
@Override
public final TileEntity createNewTileEntity( final World var1, final int var2 )
{
if( this.hasBlockTileEntity() )
{
try
{
return this.tileEntityType.newInstance();
}
catch( final InstantiationException e )
{
throw new IllegalStateException( "Failed to create a new instance of an illegal class " + this.tileEntityType, e );
}
catch( final IllegalAccessException e )
{
throw new IllegalStateException( "Failed to create a new instance of " + this.tileEntityType + ", because lack of permissions", e );
}
}
@Override
public final TileEntity createNewTileEntity(final World var1, final int var2) {
if (this.hasBlockTileEntity()) {
try {
return this.tileEntityType.newInstance();
} catch (final InstantiationException e) {
throw new IllegalStateException("Failed to create a new instance of an illegal class " + this.tileEntityType, e);
} catch (final IllegalAccessException e) {
throw new IllegalStateException("Failed to create a new instance of " + this.tileEntityType + ", because lack of permissions", e);
}
}
return null;
}
return null;
}
@Override
public void breakBlock( final World w, final BlockPos pos, final IBlockState state )
{
final AEBaseTile te = this.getTileEntity( w, pos );
if( te != null )
{
final ArrayList<ItemStack> drops = new ArrayList<>();
if( te.dropItems() )
{
te.getDrops( w, pos, drops );
}
else
{
te.getNoDrops( w, pos, drops );
}
@Override
public void breakBlock(final World w, final BlockPos pos, final IBlockState state) {
final AEBaseTile te = this.getTileEntity(w, pos);
if (te != null) {
final ArrayList<ItemStack> drops = new ArrayList<>();
if (te.dropItems()) {
te.getDrops(w, pos, drops);
} else {
te.getNoDrops(w, pos, drops);
}
// Cry ;_; ...
Platform.spawnDrops( w, pos, drops );
}
// Cry ;_; ...
Platform.spawnDrops(w, pos, drops);
}
// super will remove the TE, as it is not an instance of BlockContainer
super.breakBlock( w, pos, state );
}
// super will remove the TE, as it is not an instance of BlockContainer
super.breakBlock(w, pos, state);
}
@Override
public final EnumFacing[] getValidRotations( final World w, final BlockPos pos )
{
final AEBaseTile obj = this.getTileEntity( w, pos );
if( obj != null && obj.canBeRotated() )
{
return EnumFacing.VALUES;
}
@Override
public final EnumFacing[] getValidRotations(final World w, final BlockPos pos) {
final AEBaseTile obj = this.getTileEntity(w, pos);
if (obj != null && obj.canBeRotated()) {
return EnumFacing.VALUES;
}
return super.getValidRotations( w, pos );
}
return super.getValidRotations(w, pos);
}
@Override
public boolean recolorBlock( final World world, final BlockPos pos, final EnumFacing side, final EnumDyeColor color )
{
final TileEntity te = this.getTileEntity( world, pos );
@Override
public boolean recolorBlock(final World world, final BlockPos pos, final EnumFacing side, final EnumDyeColor color) {
final TileEntity te = this.getTileEntity(world, pos);
if( te instanceof IColorableTile )
{
final IColorableTile ct = (IColorableTile) te;
final AEColor c = ct.getColor();
final AEColor newColor = AEColor.values()[color.getMetadata()];
if (te instanceof IColorableTile) {
final IColorableTile ct = (IColorableTile) te;
final AEColor c = ct.getColor();
final AEColor newColor = AEColor.values()[color.getMetadata()];
if( c != newColor )
{
ct.recolourBlock( side, newColor, null );
return true;
}
return false;
}
if (c != newColor) {
ct.recolourBlock(side, newColor, null);
return true;
}
return false;
}
return super.recolorBlock( world, pos, side, color );
}
return super.recolorBlock(world, pos, side, color);
}
@Override
public int getComparatorInputOverride( IBlockState state, final World w, final BlockPos pos )
{
final TileEntity te = this.getTileEntity( w, pos );
if( te instanceof AEBaseInvTile )
{
AEBaseInvTile invTile = (AEBaseInvTile) te;
if( invTile.getInternalInventory().getSlots() > 0 )
{
return ItemHandlerHelper.calcRedstoneFromInventory( invTile.getInternalInventory() );
}
}
return 0;
}
@Override
public int getComparatorInputOverride(IBlockState state, final World w, final BlockPos pos) {
final TileEntity te = this.getTileEntity(w, pos);
if (te instanceof AEBaseInvTile) {
AEBaseInvTile invTile = (AEBaseInvTile) te;
if (invTile.getInternalInventory().getSlots() > 0) {
return ItemHandlerHelper.calcRedstoneFromInventory(invTile.getInternalInventory());
}
}
return 0;
}
@Override
public boolean eventReceived( final IBlockState state, final World worldIn, final BlockPos pos, final int eventID, final int eventParam )
{
super.eventReceived( state, worldIn, pos, eventID, eventParam );
final TileEntity tileentity = worldIn.getTileEntity( pos );
return tileentity != null ? tileentity.receiveClientEvent( eventID, eventParam ) : false;
}
@Override
public boolean eventReceived(final IBlockState state, final World worldIn, final BlockPos pos, final int eventID, final int eventParam) {
super.eventReceived(state, worldIn, pos, eventID, eventParam);
final TileEntity tileentity = worldIn.getTileEntity(pos);
return tileentity != null && tileentity.receiveClientEvent(eventID, eventParam);
}
@Override
public void onBlockPlacedBy( final World w, final BlockPos pos, final IBlockState state, final EntityLivingBase placer, final ItemStack is )
{
if( is.hasDisplayName() )
{
final TileEntity te = this.getTileEntity( w, pos );
if( te instanceof AEBaseTile )
{
( (AEBaseTile) w.getTileEntity( pos ) ).setName( is.getDisplayName() );
}
}
}
@Override
public void onBlockPlacedBy(final World w, final BlockPos pos, final IBlockState state, final EntityLivingBase placer, final ItemStack is) {
if (is.hasDisplayName()) {
final TileEntity te = this.getTileEntity(w, pos);
if (te instanceof AEBaseTile) {
((AEBaseTile) w.getTileEntity(pos)).setName(is.getDisplayName());
}
}
}
@Override
public boolean onBlockActivated( World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ )
{
ItemStack heldItem;
if( player != null && !player.getHeldItem( hand ).isEmpty() )
{
heldItem = player.getHeldItem( hand );
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
ItemStack heldItem;
if (player != null && !player.getHeldItem(hand).isEmpty()) {
heldItem = player.getHeldItem(hand);
if( Platform.isWrench( player, heldItem, pos ) && player.isSneaking() )
{
final IBlockState blockState = world.getBlockState( pos );
final Block block = blockState.getBlock();
if (Platform.isWrench(player, heldItem, pos) && player.isSneaking()) {
final IBlockState blockState = world.getBlockState(pos);
final Block block = blockState.getBlock();
if( block == null )
{
return false;
}
if (block == null) {
return false;
}
final AEBaseTile tile = this.getTileEntity( world, pos );
final AEBaseTile tile = this.getTileEntity(world, pos);
if( tile == null )
{
return false;
}
if (tile == null) {
return false;
}
if( tile instanceof TileCableBus || tile instanceof TileSkyChest )
{
return false;
}
if (tile instanceof TileCableBus || tile instanceof TileSkyChest) {
return false;
}
final ItemStack[] itemDropCandidates = Platform.getBlockDrops( world, pos );
final ItemStack op = new ItemStack( this );
final ItemStack[] itemDropCandidates = Platform.getBlockDrops(world, pos);
final ItemStack op = new ItemStack(this);
for( final ItemStack ol : itemDropCandidates )
{
if( Platform.itemComparisons().isEqualItemType( ol, op ) )
{
final NBTTagCompound tag = tile.downloadSettings( SettingsFrom.DISMANTLE_ITEM );
if( tag != null )
{
ol.setTagCompound( tag );
}
}
}
for (final ItemStack ol : itemDropCandidates) {
if (Platform.itemComparisons().isEqualItemType(ol, op)) {
final NBTTagCompound tag = tile.downloadSettings(SettingsFrom.DISMANTLE_ITEM);
if (tag != null) {
ol.setTagCompound(tag);
}
}
}
if( block.removedByPlayer( blockState, world, pos, player, false ) )
{
final List<ItemStack> itemsToDrop = Lists.newArrayList( itemDropCandidates );
Platform.spawnDrops( world, pos, itemsToDrop );
world.setBlockToAir( pos );
}
if (block.removedByPlayer(blockState, world, pos, player, false)) {
final List<ItemStack> itemsToDrop = Lists.newArrayList(itemDropCandidates);
Platform.spawnDrops(world, pos, itemsToDrop);
world.setBlockToAir(pos);
}
return false;
}
return false;
}
if( heldItem.getItem() instanceof IMemoryCard && !( this instanceof BlockCableBus ) )
{
final IMemoryCard memoryCard = (IMemoryCard) heldItem.getItem();
final AEBaseTile tileEntity = this.getTileEntity( world, pos );
if (heldItem.getItem() instanceof IMemoryCard && !(this instanceof BlockCableBus)) {
final IMemoryCard memoryCard = (IMemoryCard) heldItem.getItem();
final AEBaseTile tileEntity = this.getTileEntity(world, pos);
if( tileEntity == null )
{
return false;
}
if (tileEntity == null) {
return false;
}
final String name = this.getUnlocalizedName();
final String name = this.getTranslationKey();
if( player.isSneaking() )
{
final NBTTagCompound data = tileEntity.downloadSettings( SettingsFrom.MEMORY_CARD );
if( data != null )
{
memoryCard.setMemoryCardContents( heldItem, name, data );
memoryCard.notifyUser( player, MemoryCardMessages.SETTINGS_SAVED );
}
}
else
{
final String savedName = memoryCard.getSettingsName( heldItem );
final NBTTagCompound data = memoryCard.getData( heldItem );
if (player.isSneaking()) {
final NBTTagCompound data = tileEntity.downloadSettings(SettingsFrom.MEMORY_CARD);
if (data != null) {
memoryCard.setMemoryCardContents(heldItem, name, data);
memoryCard.notifyUser(player, MemoryCardMessages.SETTINGS_SAVED);
}
} else {
final String savedName = memoryCard.getSettingsName(heldItem);
final NBTTagCompound data = memoryCard.getData(heldItem);
if( this.getUnlocalizedName().equals( savedName ) )
{
tileEntity.uploadSettings( SettingsFrom.MEMORY_CARD, data );
memoryCard.notifyUser( player, MemoryCardMessages.SETTINGS_LOADED );
}
else
{
memoryCard.notifyUser( player, MemoryCardMessages.INVALID_MACHINE );
}
}
if (this.getTranslationKey().equals(savedName)) {
tileEntity.uploadSettings(SettingsFrom.MEMORY_CARD, data, player);
memoryCard.notifyUser(player, MemoryCardMessages.SETTINGS_LOADED);
} else {
memoryCard.notifyUser(player, MemoryCardMessages.INVALID_MACHINE);
}
}
return true;
}
}
return true;
}
return this.onActivated( world, pos, player, hand, player.getHeldItem( hand ), facing, hitX, hitY, hitZ );
}
if (heldItem.getItem() instanceof ToolQuartzCuttingKnife && !(this instanceof BlockCableBus)) {
if (ForgeEventFactory.onItemUseStart(player, heldItem, 1) <= 0) return false;
final AEBaseTile tile = this.getTileEntity(world, pos);
if (tile == null) return false;
Platform.openGUI(player, tile, AEPartLocation.fromFacing(facing), GuiBridge.GUI_RENAMER);
return true;
}
}
@Override
public IOrientable getOrientable( final IBlockAccess w, final BlockPos pos )
{
return this.getTileEntity( w, pos );
}
return this.onActivated(world, pos, player, hand, player.getHeldItem(hand), facing, hitX, hitY, hitZ);
}
@Override
public ICustomCollision getCustomCollision( final World w, final BlockPos pos )
{
final AEBaseTile te = this.getTileEntity( w, pos );
if( te instanceof ICustomCollision )
{
return (ICustomCollision) te;
}
@Override
public IOrientable getOrientable(final IBlockAccess w, final BlockPos pos) {
return this.getTileEntity(w, pos);
}
return super.getCustomCollision( w, pos );
}
@Override
public ICustomCollision getCustomCollision(final World w, final BlockPos pos) {
final AEBaseTile te = this.getTileEntity(w, pos);
if (te instanceof ICustomCollision) {
return (ICustomCollision) te;
}
return super.getCustomCollision(w, pos);
}
}
@@ -22,10 +22,8 @@ package appeng.block;
import net.minecraft.block.material.Material;
public abstract class AEDecorativeBlock extends AEBaseBlock
{
public AEDecorativeBlock( final Material mat )
{
super( mat );
}
public abstract class AEDecorativeBlock extends AEBaseBlock {
public AEDecorativeBlock(final Material mat) {
super(mat);
}
}
@@ -23,29 +23,24 @@ import net.minecraft.world.IBlockAccess;
import net.minecraftforge.common.property.IUnlistedProperty;
public final class UnlistedBlockAccess implements IUnlistedProperty<IBlockAccess>
{
@Override
public String getName()
{
return "ba";
}
public final class UnlistedBlockAccess implements IUnlistedProperty<IBlockAccess> {
@Override
public String getName() {
return "ba";
}
@Override
public boolean isValid( final IBlockAccess value )
{
return true;
}
@Override
public boolean isValid(final IBlockAccess value) {
return true;
}
@Override
public Class<IBlockAccess> getType()
{
return IBlockAccess.class;
}
@Override
public Class<IBlockAccess> getType() {
return IBlockAccess.class;
}
@Override
public String valueToString( final IBlockAccess value )
{
return null;
}
@Override
public String valueToString(final IBlockAccess value) {
return null;
}
}
@@ -23,29 +23,24 @@ import net.minecraft.util.math.BlockPos;
import net.minecraftforge.common.property.IUnlistedProperty;
public final class UnlistedBlockPos implements IUnlistedProperty<BlockPos>
{
@Override
public String getName()
{
return "pos";
}
public final class UnlistedBlockPos implements IUnlistedProperty<BlockPos> {
@Override
public String getName() {
return "pos";
}
@Override
public boolean isValid( final BlockPos value )
{
return true;
}
@Override
public boolean isValid(final BlockPos value) {
return true;
}
@Override
public Class<BlockPos> getType()
{
return BlockPos.class;
}
@Override
public Class<BlockPos> getType() {
return BlockPos.class;
}
@Override
public String valueToString( final BlockPos value )
{
return null;
}
@Override
public String valueToString(final BlockPos value) {
return null;
}
}
@@ -23,38 +23,32 @@ import net.minecraft.util.EnumFacing;
import net.minecraftforge.common.property.IUnlistedProperty;
public class UnlistedDirection implements IUnlistedProperty<EnumFacing>
{
public class UnlistedDirection implements IUnlistedProperty<EnumFacing> {
private final String name;
private final String name;
public UnlistedDirection( String name )
{
this.name = name;
}
public UnlistedDirection(String name) {
this.name = name;
}
@Override
public String getName()
{
return this.name;
}
@Override
public String getName() {
return this.name;
}
@Override
public boolean isValid( EnumFacing value )
{
return value != null;
}
@Override
public boolean isValid(EnumFacing value) {
return value != null;
}
@Override
public Class<EnumFacing> getType()
{
return EnumFacing.class;
}
@Override
public Class<EnumFacing> getType() {
return EnumFacing.class;
}
@Override
public String valueToString( EnumFacing value )
{
return value.getName();
}
@Override
public String valueToString(EnumFacing value) {
return value.getName();
}
}
@@ -19,6 +19,9 @@
package appeng.block.crafting;
import appeng.api.util.AEColor;
import appeng.client.UnlistedProperty;
import appeng.tile.crafting.TileCraftingMonitorTile;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
@@ -33,57 +36,47 @@ import net.minecraftforge.common.property.IUnlistedProperty;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import appeng.api.util.AEColor;
import appeng.client.UnlistedProperty;
import appeng.tile.crafting.TileCraftingMonitorTile;
public class BlockCraftingMonitor extends BlockCraftingUnit {
public class BlockCraftingMonitor extends BlockCraftingUnit
{
public static final UnlistedProperty<AEColor> COLOR = new UnlistedProperty<>("color", AEColor.class);
public static final UnlistedProperty<AEColor> COLOR = new UnlistedProperty<>( "color", AEColor.class );
public BlockCraftingMonitor() {
super(CraftingUnitType.MONITOR);
}
public BlockCraftingMonitor()
{
super( CraftingUnitType.MONITOR );
}
@Override
protected BlockStateContainer createBlockState() {
return new ExtendedBlockState(this, this.getAEStates(), new IUnlistedProperty[]{
STATE,
COLOR,
FORWARD,
UP
});
}
@Override
protected BlockStateContainer createBlockState()
{
return new ExtendedBlockState( this, this.getAEStates(), new IUnlistedProperty[] {
STATE,
COLOR,
FORWARD,
UP
} );
}
@Override
public IExtendedBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) {
AEColor color = AEColor.TRANSPARENT;
EnumFacing forward = EnumFacing.NORTH;
EnumFacing up = EnumFacing.UP;
@Override
public IExtendedBlockState getExtendedState( IBlockState state, IBlockAccess world, BlockPos pos )
{
AEColor color = AEColor.TRANSPARENT;
EnumFacing forward = EnumFacing.NORTH;
EnumFacing up = EnumFacing.UP;
TileCraftingMonitorTile te = this.getTileEntity(world, pos);
if (te != null) {
color = te.getColor();
forward = te.getForward();
up = te.getUp();
}
TileCraftingMonitorTile te = this.getTileEntity( world, pos );
if( te != null )
{
color = te.getColor();
forward = te.getForward();
up = te.getUp();
}
return super.getExtendedState(state, world, pos)
.withProperty(COLOR, color)
.withProperty(FORWARD, forward)
.withProperty(UP, up);
}
return super.getExtendedState( state, world, pos )
.withProperty( COLOR, color )
.withProperty( FORWARD, forward )
.withProperty( UP, up );
}
@Override
@SideOnly( Side.CLIENT )
public void getSubBlocks( final CreativeTabs tabs, final NonNullList<ItemStack> itemStacks )
{
itemStacks.add( new ItemStack( this, 1, 0 ) );
}
@Override
@SideOnly(Side.CLIENT)
public void getSubBlocks(final CreativeTabs tabs, final NonNullList<ItemStack> itemStacks) {
itemStacks.add(new ItemStack(this, 1, 0));
}
}
@@ -19,12 +19,10 @@
package appeng.block.crafting;
public class BlockCraftingStorage extends BlockCraftingUnit
{
public class BlockCraftingStorage extends BlockCraftingUnit {
public BlockCraftingStorage( final CraftingUnitType type )
{
super( type );
}
public BlockCraftingStorage(final CraftingUnitType type) {
super(type);
}
}
@@ -19,8 +19,13 @@
package appeng.block.crafting;
import java.util.EnumSet;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseTileBlock;
import appeng.client.UnlistedProperty;
import appeng.client.render.crafting.CraftingCubeState;
import appeng.core.sync.GuiBridge;
import appeng.tile.crafting.TileCraftingTile;
import appeng.util.Platform;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
@@ -38,130 +43,106 @@ import net.minecraftforge.common.property.ExtendedBlockState;
import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.common.property.IUnlistedProperty;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseTileBlock;
import appeng.client.UnlistedProperty;
import appeng.client.render.crafting.CraftingCubeState;
import appeng.core.sync.GuiBridge;
import appeng.tile.crafting.TileCraftingTile;
import appeng.util.Platform;
import javax.annotation.Nonnull;
import java.util.EnumSet;
public class BlockCraftingUnit extends AEBaseTileBlock
{
public static final PropertyBool FORMED = PropertyBool.create( "formed" );
public static final PropertyBool POWERED = PropertyBool.create( "powered" );
public static final UnlistedProperty<CraftingCubeState> STATE = new UnlistedProperty<>( "state", CraftingCubeState.class );
public class BlockCraftingUnit extends AEBaseTileBlock {
public static final PropertyBool FORMED = PropertyBool.create("formed");
public static final PropertyBool POWERED = PropertyBool.create("powered");
public static final UnlistedProperty<CraftingCubeState> STATE = new UnlistedProperty<>("state", CraftingCubeState.class);
public final CraftingUnitType type;
public final CraftingUnitType type;
public BlockCraftingUnit( final CraftingUnitType type )
{
super( Material.IRON );
public BlockCraftingUnit(final CraftingUnitType type) {
super(Material.IRON);
this.type = type;
}
this.type = type;
}
@Override
protected IProperty[] getAEStates()
{
return new IProperty[] { POWERED, FORMED };
}
@Override
protected IProperty[] getAEStates() {
return new IProperty[]{POWERED, FORMED};
}
@Override
public IExtendedBlockState getExtendedState( IBlockState state, IBlockAccess world, BlockPos pos )
{
@Override
public IExtendedBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) {
EnumSet<EnumFacing> connections = EnumSet.noneOf( EnumFacing.class );
EnumSet<EnumFacing> connections = EnumSet.noneOf(EnumFacing.class);
for( EnumFacing facing : EnumFacing.values() )
{
if( this.isConnected( world, pos, facing ) )
{
connections.add( facing );
}
}
for (EnumFacing facing : EnumFacing.values()) {
if (this.isConnected(world, pos, facing)) {
connections.add(facing);
}
}
IExtendedBlockState extState = (IExtendedBlockState) state;
IExtendedBlockState extState = (IExtendedBlockState) state;
return extState.withProperty( STATE, new CraftingCubeState( connections ) );
}
return extState.withProperty(STATE, new CraftingCubeState(connections));
}
private boolean isConnected( IBlockAccess world, BlockPos pos, EnumFacing side )
{
BlockPos adjacentPos = pos.offset( side );
return world.getBlockState( adjacentPos ).getBlock() instanceof BlockCraftingUnit;
}
private boolean isConnected(IBlockAccess world, BlockPos pos, EnumFacing side) {
BlockPos adjacentPos = pos.offset(side);
return world.getBlockState(adjacentPos).getBlock() instanceof BlockCraftingUnit;
}
@Override
protected BlockStateContainer createBlockState()
{
return new ExtendedBlockState( this, this.getAEStates(), new IUnlistedProperty[] { STATE } );
}
@Override
protected BlockStateContainer createBlockState() {
return new ExtendedBlockState(this, this.getAEStates(), new IUnlistedProperty[]{STATE});
}
@Override
public IBlockState getStateFromMeta( final int meta )
{
return this.getDefaultState().withProperty( POWERED, ( meta & 1 ) == 1 ).withProperty( FORMED, ( meta & 2 ) == 2 );
}
@Override
public IBlockState getStateFromMeta(final int meta) {
return this.getDefaultState().withProperty(POWERED, (meta & 1) == 1).withProperty(FORMED, (meta & 2) == 2);
}
@Override
public int getMetaFromState( final IBlockState state )
{
boolean p = state.getValue( POWERED );
boolean f = state.getValue( FORMED );
return ( p ? 1 : 0 ) | ( f ? 2 : 0 );
}
@Override
public int getMetaFromState(final IBlockState state) {
boolean p = state.getValue(POWERED);
boolean f = state.getValue(FORMED);
return (p ? 1 : 0) | (f ? 2 : 0);
}
@Override
public void neighborChanged( final IBlockState state, final World worldIn, final BlockPos pos, final Block blockIn, final BlockPos fromPos )
{
final TileCraftingTile cp = this.getTileEntity( worldIn, pos );
if( cp != null )
{
cp.updateMultiBlock();
}
}
@Override
public void neighborChanged(final IBlockState state, final World worldIn, final BlockPos pos, final Block blockIn, final BlockPos fromPos) {
final TileCraftingTile cp = this.getTileEntity(worldIn, pos);
if (cp != null) {
cp.updateMultiBlock();
}
}
@Override
public BlockRenderLayer getBlockLayer()
{
return BlockRenderLayer.CUTOUT;
}
@Override
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT;
}
@Override
public void breakBlock( final World w, final BlockPos pos, final IBlockState state )
{
final TileCraftingTile cp = this.getTileEntity( w, pos );
if( cp != null )
{
cp.breakCluster();
}
@Override
public void breakBlock(final World w, final BlockPos pos, final IBlockState state) {
final TileCraftingTile cp = this.getTileEntity(w, pos);
if (cp != null) {
cp.breakCluster();
}
super.breakBlock( w, pos, state );
}
super.breakBlock(w, pos, state);
}
@Override
public boolean onBlockActivated( final World w, final BlockPos pos, final IBlockState state, final EntityPlayer p, final EnumHand hand, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
{
final TileCraftingTile tg = this.getTileEntity( w, pos );
@Override
public boolean onBlockActivated(final World w, final BlockPos pos, final IBlockState state, final EntityPlayer p, final EnumHand hand, final EnumFacing side, final float hitX, final float hitY, final float hitZ) {
final TileCraftingTile tg = this.getTileEntity(w, pos);
if( tg != null && !p.isSneaking() && tg.isFormed() && tg.isActive() )
{
if( Platform.isClient() )
{
return true;
}
if (tg != null && !p.isSneaking() && tg.isFormed() && tg.isActive()) {
if (Platform.isClient()) {
return true;
}
Platform.openGUI( p, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_CRAFTING_CPU );
return true;
}
Platform.openGUI(p, tg, AEPartLocation.fromFacing(side), GuiBridge.GUI_CRAFTING_CPU);
return true;
}
return super.onBlockActivated( w, pos, state, p, hand, side, hitX, hitY, hitZ );
}
return super.onBlockActivated(w, pos, state, p, hand, side, hitX, hitY, hitZ);
}
public enum CraftingUnitType
{
UNIT, ACCELERATOR, STORAGE_1K, STORAGE_4K, STORAGE_16K, STORAGE_64K, MONITOR
}
public enum CraftingUnitType {
UNIT, ACCELERATOR, STORAGE_1K, STORAGE_4K, STORAGE_16K, STORAGE_64K, MONITOR
}
}
@@ -19,6 +19,11 @@
package appeng.block.crafting;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseTileBlock;
import appeng.core.sync.GuiBridge;
import appeng.tile.crafting.TileMolecularAssembler;
import appeng.util.Platform;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyBool;
@@ -33,79 +38,73 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseTileBlock;
import appeng.core.sync.GuiBridge;
import appeng.tile.crafting.TileMolecularAssembler;
import appeng.util.Platform;
import javax.annotation.Nonnull;
public class BlockMolecularAssembler extends AEBaseTileBlock
{
public class BlockMolecularAssembler extends AEBaseTileBlock {
public static final PropertyBool POWERED = PropertyBool.create( "powered" );
public static final PropertyBool POWERED = PropertyBool.create("powered");
public BlockMolecularAssembler()
{
super( Material.IRON );
public BlockMolecularAssembler() {
super(Material.IRON);
this.setOpaque( false );
this.lightOpacity = 1;
}
this.setOpaque(false);
this.lightOpacity = 1;
}
@Override
protected IProperty[] getAEStates()
{
return new IProperty[] { POWERED };
}
@Override
protected IProperty[] getAEStates() {
return new IProperty[]{POWERED};
}
@Override
public IBlockState getActualState( IBlockState state, IBlockAccess worldIn, BlockPos pos )
{
boolean powered = false;
TileMolecularAssembler te = this.getTileEntity( worldIn, pos );
if( te != null )
{
powered = te.isPowered();
}
@Override
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
boolean powered = false;
TileMolecularAssembler te = this.getTileEntity(worldIn, pos);
if (te != null) {
powered = te.isPowered();
}
return super.getActualState( state, worldIn, pos ).withProperty( POWERED, powered );
}
return super.getActualState(state, worldIn, pos).withProperty(POWERED, powered);
}
/**
* NOTE: This is only used to determine how to render an item being held in hand.
* For determining block rendering, the method below is used (canRenderInLayer).
*/
@SideOnly( Side.CLIENT )
@Override
public BlockRenderLayer getBlockLayer()
{
return BlockRenderLayer.CUTOUT;
}
/**
* NOTE: This is only used to determine how to render an item being held in hand.
* For determining block rendering, the method below is used (canRenderInLayer).
*/
@SideOnly(Side.CLIENT)
@Override
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT;
}
@SideOnly( Side.CLIENT )
@Override
public boolean canRenderInLayer( IBlockState state, BlockRenderLayer layer )
{
return layer == BlockRenderLayer.CUTOUT || layer == BlockRenderLayer.TRANSLUCENT;
}
@SideOnly(Side.CLIENT)
@Override
public boolean canRenderInLayer(IBlockState state, BlockRenderLayer layer) {
return layer == BlockRenderLayer.CUTOUT || layer == BlockRenderLayer.TRANSLUCENT;
}
@Override
public boolean isFullCube( IBlockState state )
{
return false;
}
@Override
public boolean isFullCube(IBlockState state) {
return false;
}
@Override
public boolean onBlockActivated( final World w, final BlockPos pos, final IBlockState state, final EntityPlayer p, final EnumHand hand, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
{
final TileMolecularAssembler tg = this.getTileEntity( w, pos );
if( tg != null && !p.isSneaking() )
{
Platform.openGUI( p, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_MAC );
return true;
}
@Override
public boolean onBlockActivated(final World w, final BlockPos pos, final IBlockState state, final EntityPlayer p, final EnumHand hand, final EnumFacing side, final float hitX, final float hitY, final float hitZ) {
final TileMolecularAssembler tg = this.getTileEntity(w, pos);
if (tg != null && !p.isSneaking()) {
Platform.openGUI(p, tg, AEPartLocation.fromFacing(side), GuiBridge.GUI_MAC);
return true;
}
return super.onBlockActivated( w, pos, state, p, hand, side, hitX, hitY, hitZ );
}
return super.onBlockActivated(w, pos, state, p, hand, side, hitX, hitY, hitZ);
}
@Override
public void onNeighborChange(IBlockAccess world, BlockPos pos, BlockPos neighbor) {
final TileMolecularAssembler tg = this.getTileEntity(world, pos);
if (tg != null) {
tg.updateNeighbors(world, pos, neighbor);
}
}
}
@@ -19,32 +19,27 @@
package appeng.block.crafting;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import appeng.api.AEApi;
import appeng.block.AEBaseItemBlock;
import appeng.core.AEConfig;
import appeng.core.features.AEFeature;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
public class ItemCraftingStorage extends AEBaseItemBlock
{
public class ItemCraftingStorage extends AEBaseItemBlock {
public ItemCraftingStorage( final Block id )
{
super( id );
}
public ItemCraftingStorage(final Block id) {
super(id);
}
@Override
public ItemStack getContainerItem( final ItemStack itemStack )
{
return AEApi.instance().definitions().blocks().craftingUnit().maybeStack( 1 ).orElse( ItemStack.EMPTY );
}
@Override
public ItemStack getContainerItem(final ItemStack itemStack) {
return AEApi.instance().definitions().blocks().craftingUnit().maybeStack(1).orElse(ItemStack.EMPTY);
}
@Override
public boolean hasContainerItem( final ItemStack stack )
{
return AEConfig.instance().isFeatureEnabled( AEFeature.ENABLE_DISASSEMBLY_CRAFTING );
}
@Override
public boolean hasContainerItem(final ItemStack stack) {
return AEConfig.instance().isFeatureEnabled(AEFeature.ENABLE_DISASSEMBLY_CRAFTING);
}
}
@@ -19,8 +19,11 @@
package appeng.block.grindstone;
import javax.annotation.Nullable;
import appeng.api.implementations.tiles.ICrankable;
import appeng.block.AEBaseTileBlock;
import appeng.core.stats.Stats;
import appeng.tile.AEBaseTile;
import appeng.tile.grindstone.TileCrank;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.BlockFaceShape;
@@ -37,145 +40,114 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.FakePlayer;
import appeng.api.implementations.tiles.ICrankable;
import appeng.block.AEBaseTileBlock;
import appeng.core.stats.Stats;
import appeng.tile.AEBaseTile;
import appeng.tile.grindstone.TileCrank;
import javax.annotation.Nullable;
public class BlockCrank extends AEBaseTileBlock
{
public class BlockCrank extends AEBaseTileBlock {
public BlockCrank()
{
super( Material.WOOD );
public BlockCrank() {
super(Material.WOOD);
this.setLightOpacity( 0 );
this.setHarvestLevel( "axe", 0 );
this.setFullSize( this.setOpaque( false ) );
}
this.setLightOpacity(0);
this.setHarvestLevel("axe", 0);
this.setFullSize(this.setOpaque(false));
}
@Override
public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
{
if( player instanceof FakePlayer || player == null )
{
this.dropCrank( w, pos );
return true;
}
@Override
public boolean onActivated(final World w, final BlockPos pos, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ) {
if (player instanceof FakePlayer || player == null) {
this.dropCrank(w, pos);
return true;
}
final AEBaseTile tile = this.getTileEntity( w, pos );
if( tile instanceof TileCrank )
{
if( ( (TileCrank) tile ).power() )
{
Stats.TurnedCranks.addToPlayer( player, 1 );
}
}
final AEBaseTile tile = this.getTileEntity(w, pos);
if (tile instanceof TileCrank) {
if (((TileCrank) tile).power()) {
Stats.TurnedCranks.addToPlayer(player, 1);
}
}
return true;
}
return true;
}
private void dropCrank( final World world, final BlockPos pos )
{
world.destroyBlock( pos, true ); // w.destroyBlock( x, y, z, true );
world.notifyBlockUpdate( pos, this.getDefaultState(), world.getBlockState( pos ), 3 );
}
private void dropCrank(final World world, final BlockPos pos) {
world.destroyBlock(pos, true); // w.destroyBlock( x, y, z, true );
world.notifyBlockUpdate(pos, this.getDefaultState(), world.getBlockState(pos), 3);
}
@Override
public void onBlockPlacedBy( final World world, final BlockPos pos, final IBlockState state, final EntityLivingBase placer, final ItemStack stack )
{
final AEBaseTile tile = this.getTileEntity( world, pos );
if( tile != null )
{
final EnumFacing mnt = this.findCrankable( world, pos );
EnumFacing forward = EnumFacing.UP;
if( mnt == EnumFacing.UP || mnt == EnumFacing.DOWN )
{
forward = EnumFacing.SOUTH;
}
tile.setOrientation( forward, mnt.getOpposite() );
}
else
{
this.dropCrank( world, pos );
}
}
@Override
public void onBlockPlacedBy(final World world, final BlockPos pos, final IBlockState state, final EntityLivingBase placer, final ItemStack stack) {
final AEBaseTile tile = this.getTileEntity(world, pos);
if (tile != null) {
final EnumFacing mnt = this.findCrankable(world, pos);
EnumFacing forward = EnumFacing.UP;
if (mnt == EnumFacing.UP || mnt == EnumFacing.DOWN) {
forward = EnumFacing.SOUTH;
}
tile.setOrientation(forward, mnt.getOpposite());
} else {
this.dropCrank(world, pos);
}
}
@Override
public boolean isValidOrientation( final World w, final BlockPos pos, final EnumFacing forward, final EnumFacing up )
{
final TileEntity te = w.getTileEntity( pos );
return !( te instanceof TileCrank ) || this.isCrankable( w, pos, up.getOpposite() );
}
@Override
public boolean isValidOrientation(final World w, final BlockPos pos, final EnumFacing forward, final EnumFacing up) {
final TileEntity te = w.getTileEntity(pos);
return !(te instanceof TileCrank) || this.isCrankable(w, pos, up.getOpposite());
}
private EnumFacing findCrankable( final World world, final BlockPos pos )
{
for( final EnumFacing dir : EnumFacing.VALUES )
{
if( this.isCrankable( world, pos, dir ) )
{
return dir;
}
}
return null;
}
private EnumFacing findCrankable(final World world, final BlockPos pos) {
for (final EnumFacing dir : EnumFacing.VALUES) {
if (this.isCrankable(world, pos, dir)) {
return dir;
}
}
return null;
}
private boolean isCrankable( final World world, final BlockPos pos, final EnumFacing offset )
{
final BlockPos o = pos.offset( offset );
final TileEntity te = world.getTileEntity( o );
private boolean isCrankable(final World world, final BlockPos pos, final EnumFacing offset) {
final BlockPos o = pos.offset(offset);
final TileEntity te = world.getTileEntity(o);
return te instanceof ICrankable && ( (ICrankable) te ).canCrankAttach( offset.getOpposite() );
}
return te instanceof ICrankable && ((ICrankable) te).canCrankAttach(offset.getOpposite());
}
@Override
public EnumBlockRenderType getRenderType( IBlockState state )
{
return EnumBlockRenderType.ENTITYBLOCK_ANIMATED;
}
@Override
public EnumBlockRenderType getRenderType(IBlockState state) {
return EnumBlockRenderType.ENTITYBLOCK_ANIMATED;
}
@Override
public void neighborChanged( IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos )
{
@Override
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos) {
final AEBaseTile tile = this.getTileEntity( world, pos );
if( tile != null )
{
if( !this.isCrankable( world, pos, tile.getUp().getOpposite() ) )
{
this.dropCrank( world, pos );
}
}
else
{
this.dropCrank( world, pos );
}
}
final AEBaseTile tile = this.getTileEntity(world, pos);
if (tile != null) {
if (!this.isCrankable(world, pos, tile.getUp().getOpposite())) {
this.dropCrank(world, pos);
}
} else {
this.dropCrank(world, pos);
}
}
@Override
public boolean canPlaceBlockAt( final World world, final BlockPos pos )
{
return this.findCrankable( world, pos ) != null;
}
@Override
public boolean canPlaceBlockAt(final World world, final BlockPos pos) {
return this.findCrankable(world, pos) != null;
}
@Override
public boolean isFullCube( IBlockState state )
{
return false;
}
@Override
public boolean isFullCube(IBlockState state) {
return false;
}
@Override
public boolean canPlaceTorchOnTop( IBlockState state, IBlockAccess world, BlockPos pos )
{
return false;
}
@Override
public boolean canPlaceTorchOnTop(IBlockState state, IBlockAccess world, BlockPos pos) {
return false;
}
@Override
public BlockFaceShape getBlockFaceShape( IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face )
{
return BlockFaceShape.UNDEFINED;
}
@Override
public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face) {
return BlockFaceShape.UNDEFINED;
}
}
@@ -19,8 +19,11 @@
package appeng.block.grindstone;
import javax.annotation.Nullable;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseTileBlock;
import appeng.core.sync.GuiBridge;
import appeng.tile.grindstone.TileGrinder;
import appeng.util.Platform;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
@@ -29,32 +32,24 @@ import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseTileBlock;
import appeng.core.sync.GuiBridge;
import appeng.tile.grindstone.TileGrinder;
import appeng.util.Platform;
import javax.annotation.Nullable;
public class BlockGrinder extends AEBaseTileBlock
{
public class BlockGrinder extends AEBaseTileBlock {
public BlockGrinder()
{
super( Material.ROCK );
public BlockGrinder() {
super(Material.ROCK);
this.setHardness( 3.2F );
}
this.setHardness(3.2F);
}
@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 )
{
final TileGrinder tg = this.getTileEntity( w, pos );
if( tg != null && !p.isSneaking() )
{
Platform.openGUI( p, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_GRINDER );
return true;
}
return false;
}
@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) {
final TileGrinder tg = this.getTileEntity(w, pos);
if (tg != null && !p.isSneaking()) {
Platform.openGUI(p, tg, AEPartLocation.fromFacing(side), GuiBridge.GUI_GRINDER);
return true;
}
return false;
}
}
@@ -19,22 +19,19 @@
package appeng.block.grindstone;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import appeng.bootstrap.BlockRenderingCustomizer;
import appeng.bootstrap.IBlockRendering;
import appeng.bootstrap.IItemRendering;
import appeng.client.render.tesr.CrankTESR;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class CrankRendering extends BlockRenderingCustomizer
{
public class CrankRendering extends BlockRenderingCustomizer {
@Override
@SideOnly( Side.CLIENT )
public void customize( IBlockRendering rendering, IItemRendering itemRendering )
{
rendering.tesr( new CrankTESR() );
}
@Override
@SideOnly(Side.CLIENT)
public void customize(IBlockRendering rendering, IItemRendering itemRendering) {
rendering.tesr(new CrankTESR());
}
}
@@ -19,8 +19,11 @@
package appeng.block.misc;
import javax.annotation.Nullable;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseTileBlock;
import appeng.core.sync.GuiBridge;
import appeng.tile.misc.TileCellWorkbench;
import appeng.util.Platform;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
@@ -29,38 +32,28 @@ import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseTileBlock;
import appeng.core.sync.GuiBridge;
import appeng.tile.misc.TileCellWorkbench;
import appeng.util.Platform;
import javax.annotation.Nullable;
public class BlockCellWorkbench extends AEBaseTileBlock
{
public class BlockCellWorkbench extends AEBaseTileBlock {
public BlockCellWorkbench()
{
super( Material.IRON );
}
public BlockCellWorkbench() {
super(Material.IRON);
}
@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() )
{
return false;
}
@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()) {
return false;
}
final TileCellWorkbench tg = this.getTileEntity( w, pos );
if( tg != null )
{
if( Platform.isServer() )
{
Platform.openGUI( p, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_CELL_WORKBENCH );
}
return true;
}
return false;
}
final TileCellWorkbench tg = this.getTileEntity(w, pos);
if (tg != null) {
if (Platform.isServer()) {
Platform.openGUI(p, tg, AEPartLocation.fromFacing(side), GuiBridge.GUI_CELL_WORKBENCH);
}
return true;
}
return false;
}
}
+125 -150
View File
@@ -19,17 +19,18 @@
package appeng.block.misc;
import java.util.Collections;
import java.util.List;
import java.util.Random;
import javax.annotation.Nullable;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import org.lwjgl.util.vector.Matrix4f;
import org.lwjgl.util.vector.Vector3f;
import appeng.api.AEApi;
import appeng.api.util.AEAxisAlignedBB;
import appeng.block.AEBaseTileBlock;
import appeng.client.render.effects.LightningFX;
import appeng.client.render.renderable.ItemRenderable;
import appeng.client.render.tesr.ModularTESR;
import appeng.core.AEConfig;
import appeng.core.AppEng;
import appeng.helpers.ICustomCollision;
import appeng.tile.AEBaseTile;
import appeng.tile.misc.TileCharger;
import appeng.util.Platform;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
@@ -44,164 +45,138 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import org.lwjgl.util.vector.Matrix4f;
import org.lwjgl.util.vector.Vector3f;
import appeng.api.AEApi;
import appeng.api.util.AEAxisAlignedBB;
import appeng.block.AEBaseTileBlock;
import appeng.client.render.effects.LightningFX;
import appeng.client.render.renderable.ItemRenderable;
import appeng.client.render.tesr.ModularTESR;
import appeng.core.AEConfig;
import appeng.core.AppEng;
import appeng.helpers.ICustomCollision;
import appeng.tile.AEBaseTile;
import appeng.tile.misc.TileCharger;
import appeng.util.Platform;
import javax.annotation.Nullable;
import java.util.Collections;
import java.util.List;
import java.util.Random;
public class BlockCharger extends AEBaseTileBlock implements ICustomCollision
{
public class BlockCharger extends AEBaseTileBlock implements ICustomCollision {
public BlockCharger()
{
super( Material.IRON );
public BlockCharger() {
super(Material.IRON);
this.setLightOpacity( 2 );
this.setFullSize( this.setOpaque( false ) );
}
this.setLightOpacity(2);
this.setFullSize(this.setOpaque(false));
}
@Override
public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
{
if( player.isSneaking() )
{
return false;
}
@Override
public boolean onActivated(final World w, final BlockPos pos, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ) {
if (player.isSneaking()) {
return false;
}
if( Platform.isServer() )
{
final TileCharger tc = this.getTileEntity( w, pos );
if( tc != null )
{
tc.activate( player );
}
}
if (Platform.isServer()) {
final TileCharger tc = this.getTileEntity(w, pos);
if (tc != null) {
tc.activate(player);
}
}
return true;
}
return true;
}
@Override
@SideOnly( Side.CLIENT )
public void randomDisplayTick( final IBlockState state, final World w, final BlockPos pos, final Random r )
{
if( !AEConfig.instance().isEnableEffects() )
{
return;
}
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(final IBlockState state, final World w, final BlockPos pos, final Random r) {
if (!AEConfig.instance().isEnableEffects()) {
return;
}
if( r.nextFloat() < 0.98 )
{
return;
}
if (r.nextFloat() < 0.98) {
return;
}
final AEBaseTile tile = this.getTileEntity( w, pos );
if( tile instanceof TileCharger )
{
final TileCharger tc = (TileCharger) tile;
final AEBaseTile tile = this.getTileEntity(w, pos);
if (tile instanceof TileCharger) {
final TileCharger tc = (TileCharger) tile;
if( AEApi.instance().definitions().materials().certusQuartzCrystalCharged().isSameAs( tc.getInternalInventory().getStackInSlot( 0 ) ) )
{
final double xOff = 0.0;
final double yOff = 0.0;
final double zOff = 0.0;
if (AEApi.instance().definitions().materials().certusQuartzCrystalCharged().isSameAs(tc.getInternalInventory().getStackInSlot(0))) {
final double xOff = 0.0;
final double yOff = 0.0;
final double zOff = 0.0;
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 );
Minecraft.getMinecraft().effectRenderer.addEffect( fx );
}
}
}
}
}
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);
Minecraft.getMinecraft().effectRenderer.addEffect(fx);
}
}
}
}
}
@Override
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool( final World w, final BlockPos pos, final Entity thePlayer, final boolean b )
{
final TileCharger tile = this.getTileEntity( w, pos );
if( tile != null )
{
final double twoPixels = 2.0 / 16.0;
final EnumFacing up = tile.getUp();
final EnumFacing forward = tile.getForward();
final AEAxisAlignedBB bb = new AEAxisAlignedBB( twoPixels, twoPixels, twoPixels, 1.0 - twoPixels, 1.0 - twoPixels, 1.0 - twoPixels );
@Override
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool(final World w, final BlockPos pos, final Entity thePlayer, final boolean b) {
final TileCharger tile = this.getTileEntity(w, pos);
if (tile != null) {
final double twoPixels = 2.0 / 16.0;
final EnumFacing up = tile.getUp();
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 )
{
bb.minX = 0;
bb.maxX = 1;
}
if( up.getFrontOffsetY() != 0 )
{
bb.minY = 0;
bb.maxY = 1;
}
if( up.getFrontOffsetZ() != 0 )
{
bb.minZ = 0;
bb.maxZ = 1;
}
if (up.getXOffset() != 0) {
bb.minX = 0;
bb.maxX = 1;
}
if (up.getYOffset() != 0) {
bb.minY = 0;
bb.maxY = 1;
}
if (up.getZOffset() != 0) {
bb.minZ = 0;
bb.maxZ = 1;
}
switch( forward )
{
case DOWN:
bb.maxY = 1;
break;
case UP:
bb.minY = 0;
break;
case NORTH:
bb.maxZ = 1;
break;
case SOUTH:
bb.minZ = 0;
break;
case EAST:
bb.minX = 0;
break;
case WEST:
bb.maxX = 1;
break;
default:
break;
}
switch (forward) {
case DOWN:
bb.maxY = 1;
break;
case UP:
bb.minY = 0;
break;
case NORTH:
bb.maxZ = 1;
break;
case SOUTH:
bb.minZ = 0;
break;
case EAST:
bb.minX = 0;
break;
case WEST:
bb.maxX = 1;
break;
default:
break;
}
return Collections.singletonList( bb.getBoundingBox() );
}
return Collections.singletonList( new AxisAlignedBB( 0.0, 0, 0.0, 1.0, 1.0, 1.0 ) );
}
return Collections.singletonList(bb.getBoundingBox());
}
return Collections.singletonList(new AxisAlignedBB(0.0, 0, 0.0, 1.0, 1.0, 1.0));
}
@Override
public void addCollidingBlockToList( final World w, final BlockPos pos, final AxisAlignedBB bb, final List<AxisAlignedBB> out, final Entity e )
{
out.add( new AxisAlignedBB( 0.0, 0.0, 0.0, 1.0, 1.0, 1.0 ) );
}
@Override
public void addCollidingBlockToList(final World w, final BlockPos pos, final AxisAlignedBB bb, final List<AxisAlignedBB> out, final Entity e) {
out.add(new AxisAlignedBB(0.0, 0.0, 0.0, 1.0, 1.0, 1.0));
}
@SideOnly( Side.CLIENT )
public static TileEntitySpecialRenderer<TileCharger> createTesr()
{
return new ModularTESR<>( new ItemRenderable<>( BlockCharger::getRenderedItem ) );
}
@SideOnly(Side.CLIENT)
public static TileEntitySpecialRenderer<TileCharger> createTesr() {
return new ModularTESR<>(new ItemRenderable<>(BlockCharger::getRenderedItem));
}
@SideOnly( Side.CLIENT )
private static Pair<ItemStack, Matrix4f> getRenderedItem( TileCharger tile )
{
Matrix4f transform = new Matrix4f();
transform.translate( new Vector3f( 0.5f, 0.4f, 0.5f ) );
return new ImmutablePair<>( tile.getInternalInventory().getStackInSlot( 0 ), transform );
}
@SideOnly(Side.CLIENT)
private static Pair<ItemStack, Matrix4f> getRenderedItem(TileCharger tile) {
Matrix4f transform = new Matrix4f();
transform.translate(new Vector3f(0.5f, 0.4f, 0.5f));
return new ImmutablePair<>(tile.getInternalInventory().getStackInSlot(0), transform);
}
}
@@ -19,8 +19,11 @@
package appeng.block.misc;
import javax.annotation.Nullable;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseTileBlock;
import appeng.core.sync.GuiBridge;
import appeng.tile.misc.TileCondenser;
import appeng.util.Platform;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
@@ -29,39 +32,29 @@ import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseTileBlock;
import appeng.core.sync.GuiBridge;
import appeng.tile.misc.TileCondenser;
import appeng.util.Platform;
import javax.annotation.Nullable;
public class BlockCondenser extends AEBaseTileBlock
{
public class BlockCondenser extends AEBaseTileBlock {
public BlockCondenser()
{
super( Material.IRON );
}
public BlockCondenser() {
super(Material.IRON);
}
@Override
public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
{
if( player.isSneaking() )
{
return false;
}
@Override
public boolean onActivated(final World w, final BlockPos pos, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ) {
if (player.isSneaking()) {
return false;
}
if( Platform.isServer() )
{
final TileCondenser tc = this.getTileEntity( w, pos );
if( tc != null && !player.isSneaking() )
{
Platform.openGUI( player, tc, AEPartLocation.fromFacing( side ), GuiBridge.GUI_CONDENSER );
return true;
}
}
if (Platform.isServer()) {
final TileCondenser tc = this.getTileEntity(w, pos);
if (tc != null && !player.isSneaking()) {
Platform.openGUI(player, tc, AEPartLocation.fromFacing(side), GuiBridge.GUI_CONDENSER);
return true;
}
}
return true;
}
return true;
}
}
@@ -19,8 +19,11 @@
package appeng.block.misc;
import javax.annotation.Nullable;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseTileBlock;
import appeng.core.sync.GuiBridge;
import appeng.tile.misc.TileInscriber;
import appeng.util.Platform;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
@@ -31,53 +34,41 @@ import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseTileBlock;
import appeng.core.sync.GuiBridge;
import appeng.tile.misc.TileInscriber;
import appeng.util.Platform;
import javax.annotation.Nullable;
public class BlockInscriber extends AEBaseTileBlock
{
public class BlockInscriber extends AEBaseTileBlock {
public BlockInscriber()
{
super( Material.IRON );
public BlockInscriber() {
super(Material.IRON);
this.setLightOpacity( 2 );
this.setFullSize( this.setOpaque( false ) );
}
this.setLightOpacity(2);
this.setFullSize(this.setOpaque(false));
}
@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() )
{
return false;
}
@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()) {
return false;
}
final TileInscriber tg = this.getTileEntity( w, pos );
if( tg != null )
{
if( Platform.isServer() )
{
Platform.openGUI( p, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_INSCRIBER );
}
return true;
}
return false;
}
final TileInscriber tg = this.getTileEntity(w, pos);
if (tg != null) {
if (Platform.isServer()) {
Platform.openGUI(p, tg, AEPartLocation.fromFacing(side), GuiBridge.GUI_INSCRIBER);
}
return true;
}
return false;
}
@Override
public EnumBlockRenderType getRenderType( IBlockState state )
{
return EnumBlockRenderType.MODEL;
}
@Override
public EnumBlockRenderType getRenderType(IBlockState state) {
return EnumBlockRenderType.MODEL;
}
@Override
public String getUnlocalizedName( final ItemStack is )
{
return super.getUnlocalizedName( is );
}
@Override
public String getTranslationKey(final ItemStack is) {
return super.getTranslationKey(is);
}
}
@@ -19,8 +19,12 @@
package appeng.block.misc;
import javax.annotation.Nullable;
import appeng.api.util.AEPartLocation;
import appeng.api.util.IOrientable;
import appeng.block.AEBaseTileBlock;
import appeng.core.sync.GuiBridge;
import appeng.tile.misc.TileInterface;
import appeng.util.Platform;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyBool;
@@ -33,77 +37,60 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import appeng.api.util.AEPartLocation;
import appeng.api.util.IOrientable;
import appeng.block.AEBaseTileBlock;
import appeng.core.sync.GuiBridge;
import appeng.tile.misc.TileInterface;
import appeng.util.Platform;
import javax.annotation.Nullable;
public class BlockInterface extends AEBaseTileBlock
{
public class BlockInterface extends AEBaseTileBlock {
private static final PropertyBool OMNIDIRECTIONAL = PropertyBool.create( "omnidirectional" );
private static final PropertyBool OMNIDIRECTIONAL = PropertyBool.create("omnidirectional");
public BlockInterface()
{
super( Material.IRON );
}
public BlockInterface() {
super(Material.IRON);
}
@Override
protected IProperty[] getAEStates()
{
return new IProperty[] { OMNIDIRECTIONAL };
}
@Override
protected IProperty[] getAEStates() {
return new IProperty[]{OMNIDIRECTIONAL};
}
@Override
public IBlockState getActualState( IBlockState state, IBlockAccess world, BlockPos pos )
{
// Determine whether the interface is omni-directional or not
TileInterface te = this.getTileEntity( world, pos );
boolean omniDirectional = true; // The default
if( te != null )
{
omniDirectional = te.isOmniDirectional();
}
@Override
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
// Determine whether the interface is omni-directional or not
TileInterface te = this.getTileEntity(world, pos);
boolean omniDirectional = true; // The default
if (te != null) {
omniDirectional = te.isOmniDirectional();
}
return super.getActualState( state, world, pos )
.withProperty( OMNIDIRECTIONAL, omniDirectional );
}
return super.getActualState(state, world, pos)
.withProperty(OMNIDIRECTIONAL, omniDirectional);
}
@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() )
{
return false;
}
@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()) {
return false;
}
final TileInterface tg = this.getTileEntity( w, pos );
if( tg != null )
{
if( Platform.isServer() )
{
Platform.openGUI( p, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_INTERFACE );
}
return true;
}
return false;
}
final TileInterface tg = this.getTileEntity(w, pos);
if (tg != null) {
if (Platform.isServer()) {
Platform.openGUI(p, tg, AEPartLocation.fromFacing(side), GuiBridge.GUI_INTERFACE);
}
return true;
}
return false;
}
@Override
protected boolean hasCustomRotation()
{
return true;
}
@Override
protected boolean hasCustomRotation() {
return true;
}
@Override
protected void customRotateBlock( final IOrientable rotatable, final EnumFacing axis )
{
if( rotatable instanceof TileInterface )
{
( (TileInterface) rotatable ).setSide( axis );
}
}
@Override
protected void customRotateBlock(final IOrientable rotatable, final EnumFacing axis) {
if (rotatable instanceof TileInterface) {
((TileInterface) rotatable).setSide(axis);
}
}
}
@@ -19,10 +19,12 @@
package appeng.block.misc;
import java.util.Collections;
import java.util.List;
import java.util.Random;
import appeng.api.util.IOrientable;
import appeng.api.util.IOrientableBlock;
import appeng.block.AEBaseTileBlock;
import appeng.helpers.ICustomCollision;
import appeng.helpers.MetaRotation;
import appeng.tile.misc.TileLightDetector;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
@@ -39,166 +41,140 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import appeng.api.util.IOrientable;
import appeng.api.util.IOrientableBlock;
import appeng.block.AEBaseTileBlock;
import appeng.helpers.ICustomCollision;
import appeng.helpers.MetaRotation;
import appeng.tile.misc.TileLightDetector;
import javax.annotation.Nonnull;
import java.util.Collections;
import java.util.List;
import java.util.Random;
public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBlock, ICustomCollision
{
public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBlock, ICustomCollision {
// Cannot use the vanilla FACING property here because it excludes facing DOWN
public static final PropertyDirection FACING = PropertyDirection.create( "facing" );
// Cannot use the vanilla FACING property here because it excludes facing DOWN
public static final PropertyDirection FACING = PropertyDirection.create("facing");
// Used to alternate between two variants of the fixture on adjacent blocks
public static final PropertyBool ODD = PropertyBool.create( "odd" );
// Used to alternate between two variants of the fixture on adjacent blocks
public static final PropertyBool ODD = PropertyBool.create("odd");
public BlockLightDetector()
{
super( Material.CIRCUITS );
public BlockLightDetector() {
super(Material.CIRCUITS);
this.setDefaultState( this.blockState.getBaseState().withProperty( FACING, EnumFacing.UP ).withProperty( ODD, false ) );
this.setLightOpacity( 0 );
this.setFullSize( false );
this.setOpaque( false );
}
this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.UP).withProperty(ODD, false));
this.setLightOpacity(0);
this.setFullSize(false);
this.setOpaque(false);
}
@Override
public int getMetaFromState( final IBlockState state )
{
return state.getValue( FACING ).ordinal();
}
@Override
public int getMetaFromState(final IBlockState state) {
return state.getValue(FACING).ordinal();
}
@Override
public IBlockState getStateFromMeta( final int meta )
{
EnumFacing facing = EnumFacing.values()[meta];
return this.getDefaultState().withProperty( FACING, facing );
}
@Override
public IBlockState getStateFromMeta(final int meta) {
EnumFacing facing = EnumFacing.values()[meta];
return this.getDefaultState().withProperty(FACING, facing);
}
@Override
protected IProperty[] getAEStates()
{
return new IProperty[] { FACING, ODD };
}
@Override
protected IProperty[] getAEStates() {
return new IProperty[]{FACING, ODD};
}
@Override
public int getWeakPower( final IBlockState state, final IBlockAccess w, final BlockPos pos, final EnumFacing side )
{
if( w instanceof World && ( (TileLightDetector) this.getTileEntity( w, pos ) ).isReady() )
{
return ( (World) w ).getLightFromNeighbors( pos ) - 6;
}
@Override
public int getWeakPower(final IBlockState state, final IBlockAccess w, final BlockPos pos, final EnumFacing side) {
if (w instanceof World && ((TileLightDetector) this.getTileEntity(w, pos)).isReady()) {
return ((World) w).getLightFromNeighbors(pos) - 6;
}
return 0;
}
return 0;
}
@Override
public void onNeighborChange( final IBlockAccess world, final BlockPos pos, final BlockPos neighbor )
{
super.onNeighborChange( world, pos, neighbor );
@Override
public void onNeighborChange(final IBlockAccess world, final BlockPos pos, final BlockPos neighbor) {
super.onNeighborChange(world, pos, neighbor);
final TileLightDetector tld = this.getTileEntity( world, pos );
if( tld != null )
{
tld.updateLight();
}
}
final TileLightDetector tld = this.getTileEntity(world, pos);
if (tld != null) {
tld.updateLight();
}
}
@Override
public void randomDisplayTick( final IBlockState state, final World worldIn, final BlockPos pos, final Random rand )
{
// cancel out lightning
}
@Override
public void randomDisplayTick(final IBlockState state, final World worldIn, final BlockPos pos, final Random rand) {
// cancel out lightning
}
@Override
public boolean isValidOrientation( final World w, final BlockPos pos, final EnumFacing forward, final EnumFacing up )
{
return this.canPlaceAt( w, pos, up.getOpposite() );
}
@Override
public boolean isValidOrientation(final World w, final BlockPos pos, final EnumFacing forward, final EnumFacing up) {
return this.canPlaceAt(w, pos, up.getOpposite());
}
private boolean canPlaceAt( final World w, final BlockPos pos, final EnumFacing dir )
{
return w.isSideSolid( pos.offset( dir ), dir.getOpposite(), false );
}
private boolean canPlaceAt(final World w, final BlockPos pos, final EnumFacing dir) {
return w.isSideSolid(pos.offset(dir), dir.getOpposite(), false);
}
@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();
return Collections.singletonList( new AxisAlignedBB( xOff + 0.3, yOff + 0.3, zOff + 0.3, xOff + 0.7, yOff + 0.7, zOff + 0.7 ) );
}
@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.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));
}
@Override
public void addCollidingBlockToList( final World w, final BlockPos pos, final AxisAlignedBB bb, final List<AxisAlignedBB> out, final Entity e )
{/*
* double xOff = -0.15 * getUp().offsetX; double yOff = -0.15 *
* getUp().offsetY; double zOff = -0.15 * getUp().offsetZ; out.add(
* AxisAlignedBB.getBoundingBox( xOff + (double) x + 0.15, yOff +
* (double) y + 0.15, zOff + (double) z + 0.15,// ahh xOff + (double) x
* + 0.85, yOff + (double) y + 0.85, zOff + (double) z + 0.85 ) );
*/
}
@Override
public void addCollidingBlockToList(final World w, final BlockPos pos, final AxisAlignedBB bb, final List<AxisAlignedBB> out, final Entity e) {/*
* double xOff = -0.15 * getUp().offsetX; double yOff = -0.15 *
* getUp().offsetY; double zOff = -0.15 * getUp().offsetZ; out.add(
* AxisAlignedBB.getBoundingBox( xOff + (double) x + 0.15, yOff +
* (double) y + 0.15, zOff + (double) z + 0.15,// ahh xOff + (double) x
* + 0.85, yOff + (double) y + 0.85, zOff + (double) z + 0.85 ) );
*/
}
@Override
public void neighborChanged( IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos )
{
final EnumFacing up = this.getOrientable( world, pos ).getUp();
if( !this.canPlaceAt( world, pos, up.getOpposite() ) )
{
this.dropTorch( world, pos );
}
}
@Override
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos) {
final EnumFacing up = this.getOrientable(world, pos).getUp();
if (!this.canPlaceAt(world, pos, up.getOpposite())) {
this.dropTorch(world, pos);
}
}
private void dropTorch( final World w, final BlockPos pos )
{
final IBlockState prev = w.getBlockState( pos );
w.destroyBlock( pos, true );
w.notifyBlockUpdate( pos, prev, w.getBlockState( pos ), 3 );
}
private void dropTorch(final World w, final BlockPos pos) {
final IBlockState prev = w.getBlockState(pos);
w.destroyBlock(pos, true);
w.notifyBlockUpdate(pos, prev, w.getBlockState(pos), 3);
}
@Override
public boolean canPlaceBlockAt( final World w, final BlockPos pos )
{
for( final EnumFacing dir : EnumFacing.VALUES )
{
if( this.canPlaceAt( w, pos, dir ) )
{
return true;
}
}
return false;
}
@Override
public boolean canPlaceBlockAt(final World w, final BlockPos pos) {
for (final EnumFacing dir : EnumFacing.VALUES) {
if (this.canPlaceAt(w, pos, dir)) {
return true;
}
}
return false;
}
@Override
public boolean usesMetadata()
{
return false;
}
@Override
public boolean usesMetadata() {
return false;
}
@Override
public boolean isFullCube( IBlockState state )
{
return false;
}
@Override
public boolean isFullCube(IBlockState state) {
return false;
}
@Override
@SideOnly( Side.CLIENT )
public BlockRenderLayer getBlockLayer()
{
return BlockRenderLayer.CUTOUT;
}
@Override
@SideOnly(Side.CLIENT)
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT;
}
@Override
public IOrientable getOrientable( final IBlockAccess w, final BlockPos pos )
{
return new MetaRotation( w, pos, FACING );
}
@Override
public IOrientable getOrientable(final IBlockAccess w, final BlockPos pos) {
return new MetaRotation(w, pos, FACING);
}
}
@@ -19,10 +19,14 @@
package appeng.block.misc;
import java.util.Collections;
import java.util.List;
import java.util.Random;
import appeng.api.util.IOrientable;
import appeng.api.util.IOrientableBlock;
import appeng.block.AEBaseBlock;
import appeng.client.render.effects.LightningFX;
import appeng.core.AEConfig;
import appeng.core.AppEng;
import appeng.helpers.ICustomCollision;
import appeng.helpers.MetaRotation;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
@@ -40,187 +44,157 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import appeng.api.util.IOrientable;
import appeng.api.util.IOrientableBlock;
import appeng.block.AEBaseBlock;
import appeng.client.render.effects.LightningFX;
import appeng.core.AEConfig;
import appeng.core.AppEng;
import appeng.helpers.ICustomCollision;
import appeng.helpers.MetaRotation;
import javax.annotation.Nonnull;
import java.util.Collections;
import java.util.List;
import java.util.Random;
public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock, ICustomCollision
{
public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock, ICustomCollision {
// Cannot use the vanilla FACING property here because it excludes facing DOWN
public static final PropertyDirection FACING = PropertyDirection.create( "facing" );
// Cannot use the vanilla FACING property here because it excludes facing DOWN
public static final PropertyDirection FACING = PropertyDirection.create("facing");
// Used to alternate between two variants of the fixture on adjacent blocks
public static final PropertyBool ODD = PropertyBool.create( "odd" );
// Used to alternate between two variants of the fixture on adjacent blocks
public static final PropertyBool ODD = PropertyBool.create("odd");
public BlockQuartzFixture()
{
super( Material.CIRCUITS );
public BlockQuartzFixture() {
super(Material.CIRCUITS);
this.setDefaultState( this.blockState.getBaseState().withProperty( FACING, EnumFacing.UP ).withProperty( ODD, false ) );
this.setLightLevel( 0.9375F );
this.setLightOpacity( 0 );
this.setFullSize( false );
this.setOpaque( false );
}
this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.UP).withProperty(ODD, false));
this.setLightLevel(0.9375F);
this.setLightOpacity(0);
this.setFullSize(false);
this.setOpaque(false);
}
/**
* Sets the "ODD" property of the block state according to the placement of the block.
*/
@Override
public IBlockState getActualState( IBlockState state, IBlockAccess worldIn, BlockPos pos )
{
boolean oddPlacement = ( ( pos.getX() + pos.getY() + pos.getZ() ) % 2 ) != 0;
/**
* Sets the "ODD" property of the block state according to the placement of the block.
*/
@Override
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
boolean oddPlacement = ((pos.getX() + pos.getY() + pos.getZ()) % 2) != 0;
return super.getActualState( state, worldIn, pos )
.withProperty( ODD, oddPlacement );
}
return super.getActualState(state, worldIn, pos)
.withProperty(ODD, oddPlacement);
}
@Override
public int getMetaFromState( final IBlockState state )
{
return state.getValue( FACING ).ordinal();
}
@Override
public int getMetaFromState(final IBlockState state) {
return state.getValue(FACING).ordinal();
}
@Override
public IBlockState getStateFromMeta( final int meta )
{
EnumFacing facing = EnumFacing.values()[meta];
return this.getDefaultState().withProperty( FACING, facing );
}
@Override
public IBlockState getStateFromMeta(final int meta) {
EnumFacing facing = EnumFacing.values()[meta];
return this.getDefaultState().withProperty(FACING, facing);
}
@Override
protected IProperty[] getAEStates()
{
return new IProperty[] { FACING, ODD };
}
@Override
protected IProperty[] getAEStates() {
return new IProperty[]{FACING, ODD};
}
@Override
public boolean isValidOrientation( final World w, final BlockPos pos, final EnumFacing forward, final EnumFacing up )
{
return this.canPlaceAt( w, pos, up.getOpposite() );
}
@Override
public boolean isValidOrientation(final World w, final BlockPos pos, final EnumFacing forward, final EnumFacing up) {
return this.canPlaceAt(w, pos, up.getOpposite());
}
private boolean canPlaceAt( final World w, final BlockPos pos, final EnumFacing dir )
{
final BlockPos test = pos.offset( dir );
return w.isSideSolid( test, dir.getOpposite(), false );
}
private boolean canPlaceAt(final World w, final BlockPos pos, final EnumFacing dir) {
final BlockPos test = pos.offset(dir);
return w.isSideSolid(test, dir.getOpposite(), false);
}
@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();
return Collections.singletonList( new AxisAlignedBB( xOff + 0.3, yOff + 0.3, zOff + 0.3, xOff + 0.7, yOff + 0.7, zOff + 0.7 ) );
}
@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.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));
}
@Override
public void addCollidingBlockToList( final World w, final BlockPos pos, final AxisAlignedBB bb, final List out, final Entity e )
{/*
* double xOff = -0.15 * getUp().offsetX; double yOff = -0.15 * getUp().offsetY; double zOff = -0.15 *
* getUp().offsetZ; out.add( AxisAlignedBB.getBoundingBox( xOff + (double) x + 0.15, yOff + (double) y + 0.15,
* zOff
* + (double) z + 0.15,// ahh xOff + (double) x + 0.85, yOff + (double) y + 0.85, zOff + (double) z + 0.85 ) );
*/
}
@Override
public void addCollidingBlockToList(final World w, final BlockPos pos, final AxisAlignedBB bb, final List out, final Entity e) {/*
* double xOff = -0.15 * getUp().offsetX; double yOff = -0.15 * getUp().offsetY; double zOff = -0.15 *
* getUp().offsetZ; out.add( AxisAlignedBB.getBoundingBox( xOff + (double) x + 0.15, yOff + (double) y + 0.15,
* zOff
* + (double) z + 0.15,// ahh xOff + (double) x + 0.85, yOff + (double) y + 0.85, zOff + (double) z + 0.85 ) );
*/
}
@Override
@SideOnly( Side.CLIENT )
public void randomDisplayTick( final IBlockState state, final World w, final BlockPos pos, final Random r )
{
if( !AEConfig.instance().isEnableEffects() )
{
return;
}
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(final IBlockState state, final World w, final BlockPos pos, final Random r) {
if (!AEConfig.instance().isEnableEffects()) {
return;
}
if( r.nextFloat() < 0.98 )
{
return;
}
if (r.nextFloat() < 0.98) {
return;
}
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();
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 );
final EnumFacing up = this.getOrientable(w, pos).getUp();
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);
Minecraft.getMinecraft().effectRenderer.addEffect( fx );
}
}
}
Minecraft.getMinecraft().effectRenderer.addEffect(fx);
}
}
}
@Override
public void neighborChanged( IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos )
{
final EnumFacing up = this.getOrientable( world, pos ).getUp();
if( !this.canPlaceAt( world, pos, up.getOpposite() ) )
{
this.dropTorch( world, pos );
}
}
@Override
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos) {
final EnumFacing up = this.getOrientable(world, pos).getUp();
if (!this.canPlaceAt(world, pos, up.getOpposite())) {
this.dropTorch(world, pos);
}
}
private void dropTorch( final World w, final BlockPos pos )
{
final IBlockState prev = w.getBlockState( pos );
w.destroyBlock( pos, true );
w.notifyBlockUpdate( pos, prev, w.getBlockState( pos ), 3 );
}
private void dropTorch(final World w, final BlockPos pos) {
final IBlockState prev = w.getBlockState(pos);
w.destroyBlock(pos, true);
w.notifyBlockUpdate(pos, prev, w.getBlockState(pos), 3);
}
@Override
public boolean canPlaceBlockAt( final World w, final BlockPos pos )
{
for( final EnumFacing dir : EnumFacing.VALUES )
{
if( this.canPlaceAt( w, pos, dir ) )
{
return true;
}
}
return false;
}
@Override
public boolean canPlaceBlockAt(final World w, final BlockPos pos) {
for (final EnumFacing dir : EnumFacing.VALUES) {
if (this.canPlaceAt(w, pos, dir)) {
return true;
}
}
return false;
}
@Override
public boolean usesMetadata()
{
return true;
}
@Override
public boolean usesMetadata() {
return true;
}
@Override
public IOrientable getOrientable( final IBlockAccess w, final BlockPos pos )
{
return new MetaRotation( w, pos, FACING );
}
@Override
public IOrientable getOrientable(final IBlockAccess w, final BlockPos pos) {
return new MetaRotation(w, pos, FACING);
}
@Override
public boolean isOpaque()
{
return false;
}
@Override
public boolean isOpaque() {
return false;
}
@Override
public boolean isFullCube( IBlockState state )
{
return false;
}
@Override
public boolean isFullCube(IBlockState state) {
return false;
}
@Override
@SideOnly( Side.CLIENT )
public BlockRenderLayer getBlockLayer()
{
return BlockRenderLayer.CUTOUT;
}
@Override
@SideOnly(Side.CLIENT)
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT;
}
}
@@ -19,8 +19,13 @@
package appeng.block.misc;
import java.util.Random;
import appeng.api.util.IOrientableBlock;
import appeng.block.AEBaseTileBlock;
import appeng.client.render.effects.LightningFX;
import appeng.core.AEConfig;
import appeng.core.AppEng;
import appeng.tile.misc.TileQuartzGrowthAccelerator;
import appeng.util.Platform;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
@@ -34,129 +39,113 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import appeng.api.util.IOrientableBlock;
import appeng.block.AEBaseTileBlock;
import appeng.client.render.effects.LightningFX;
import appeng.core.AEConfig;
import appeng.core.AppEng;
import appeng.tile.misc.TileQuartzGrowthAccelerator;
import appeng.util.Platform;
import java.util.Random;
public class BlockQuartzGrowthAccelerator extends AEBaseTileBlock implements IOrientableBlock
{
public class BlockQuartzGrowthAccelerator extends AEBaseTileBlock implements IOrientableBlock {
private static final PropertyBool POWERED = PropertyBool.create( "powered" );
private static final PropertyBool POWERED = PropertyBool.create("powered");
public BlockQuartzGrowthAccelerator()
{
super( Material.ROCK );
this.setSoundType( SoundType.METAL );
this.setDefaultState( this.getDefaultState().withProperty( POWERED, false ) );
}
public BlockQuartzGrowthAccelerator() {
super(Material.ROCK);
this.setSoundType(SoundType.METAL);
this.setDefaultState(this.getDefaultState().withProperty(POWERED, false));
}
@Override
public IBlockState getActualState( IBlockState state, IBlockAccess world, BlockPos pos )
{
TileQuartzGrowthAccelerator te = this.getTileEntity( world, pos );
boolean powered = te != null && te.isPowered();
@Override
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
TileQuartzGrowthAccelerator te = this.getTileEntity(world, pos);
boolean powered = te != null && te.isPowered();
return super.getActualState( state, world, pos )
.withProperty( POWERED, powered );
}
return super.getActualState(state, world, pos)
.withProperty(POWERED, powered);
}
@Override
protected IProperty[] getAEStates()
{
return new IProperty[] { POWERED };
}
@Override
protected IProperty[] getAEStates() {
return new IProperty[]{POWERED};
}
@SideOnly( Side.CLIENT )
@Override
public void randomDisplayTick( final IBlockState state, final World w, final BlockPos pos, final Random r )
{
if( !AEConfig.instance().isEnableEffects() )
{
return;
}
@SideOnly(Side.CLIENT)
@Override
public void randomDisplayTick(final IBlockState state, final World w, final BlockPos pos, final Random r) {
if (!AEConfig.instance().isEnableEffects()) {
return;
}
final TileQuartzGrowthAccelerator cga = this.getTileEntity( w, pos );
final TileQuartzGrowthAccelerator cga = this.getTileEntity(w, pos);
if( cga != null && cga.isPowered() && AppEng.proxy.shouldAddParticles( r ) )
{
final double d0 = r.nextFloat() - 0.5F;
final double d1 = r.nextFloat() - 0.5F;
if (cga != null && cga.isPowered() && AppEng.proxy.shouldAddParticles(r)) {
final double d0 = r.nextFloat() - 0.5F;
final double d1 = r.nextFloat() - 0.5F;
final EnumFacing up = cga.getUp();
final EnumFacing forward = cga.getForward();
final EnumFacing west = Platform.crossProduct( forward, up );
final EnumFacing up = cga.getUp();
final EnumFacing forward = cga.getForward();
final EnumFacing west = Platform.crossProduct(forward, up);
double rx = 0.5 + pos.getX();
double ry = 0.5 + pos.getY();
double rz = 0.5 + pos.getZ();
double rx = 0.5 + pos.getX();
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();
final int z = pos.getZ();
final int x = pos.getX();
final int y = pos.getY();
final int z = pos.getZ();
double dz = 0;
double dx = 0;
BlockPos pt = null;
double dz = 0;
double dx = 0;
BlockPos pt = null;
switch( r.nextInt( 4 ) )
{
case 0:
dx = 0.6;
dz = d1;
pt = new BlockPos( x + west.getFrontOffsetX(), y + west.getFrontOffsetY(), z + west.getFrontOffsetZ() );
switch (r.nextInt(4)) {
case 0:
dx = 0.6;
dz = d1;
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() );
break;
case 1:
dx = d1;
dz += 0.6;
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() );
break;
case 2:
dx = d1;
dz = -0.6;
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() );
break;
case 3:
dx = -0.6;
dz = d1;
pt = new BlockPos(x - west.getXOffset(), y - west.getYOffset(), z - west.getZOffset());
break;
}
break;
}
if( !w.getBlockState( pt ).getBlock().isAir( w.getBlockState( pt ), w, pt ) )
{
return;
}
if (!w.getBlockState(pt).getBlock().isAir(w.getBlockState(pt), w, pt)) {
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 );
}
}
final LightningFX fx = new LightningFX(w, rx, ry, rz, 0.0D, 0.0D, 0.0D);
Minecraft.getMinecraft().effectRenderer.addEffect(fx);
}
}
@Override
public boolean usesMetadata()
{
return false;
}
@Override
public boolean usesMetadata() {
return false;
}
}
@@ -19,8 +19,11 @@
package appeng.block.misc;
import javax.annotation.Nullable;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseTileBlock;
import appeng.core.sync.GuiBridge;
import appeng.tile.misc.TileSecurityStation;
import appeng.util.Platform;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyBool;
@@ -34,70 +37,57 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseTileBlock;
import appeng.core.sync.GuiBridge;
import appeng.tile.misc.TileSecurityStation;
import appeng.util.Platform;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class BlockSecurityStation extends AEBaseTileBlock
{
public class BlockSecurityStation extends AEBaseTileBlock {
private static final PropertyBool POWERED = PropertyBool.create( "powered" );
private static final PropertyBool POWERED = PropertyBool.create("powered");
public BlockSecurityStation()
{
super( Material.IRON );
public BlockSecurityStation() {
super(Material.IRON);
this.setDefaultState( this.getDefaultState().withProperty( POWERED, false ) );
}
this.setDefaultState(this.getDefaultState().withProperty(POWERED, false));
}
@Override
protected IProperty[] getAEStates()
{
return new IProperty[] { POWERED };
}
@Override
protected IProperty[] getAEStates() {
return new IProperty[]{POWERED};
}
@Override
public BlockRenderLayer getBlockLayer()
{
return BlockRenderLayer.CUTOUT;
}
@Override
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT;
}
@Override
public IBlockState getActualState( IBlockState state, IBlockAccess world, BlockPos pos )
{
boolean powered = false;
TileSecurityStation te = this.getTileEntity( world, pos );
if( te != null )
{
powered = te.isActive();
}
@Override
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
boolean powered = false;
TileSecurityStation te = this.getTileEntity(world, pos);
if (te != null) {
powered = te.isActive();
}
return super.getActualState( state, world, pos )
.withProperty( POWERED, powered );
}
return super.getActualState(state, world, pos)
.withProperty(POWERED, 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() )
{
return false;
}
@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()) {
return false;
}
final TileSecurityStation tg = this.getTileEntity( w, pos );
if( tg != null )
{
if( Platform.isClient() )
{
return true;
}
final TileSecurityStation tg = this.getTileEntity(w, pos);
if (tg != null) {
if (Platform.isClient()) {
return true;
}
Platform.openGUI( p, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_SECURITY );
return true;
}
return false;
}
Platform.openGUI(p, tg, AEPartLocation.fromFacing(side), GuiBridge.GUI_SECURITY);
return true;
}
return false;
}
}
@@ -19,9 +19,9 @@
package appeng.block.misc;
import java.util.Collections;
import java.util.List;
import appeng.block.AEBaseTileBlock;
import appeng.helpers.ICustomCollision;
import appeng.tile.misc.TileSkyCompass;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.BlockStateContainer;
@@ -36,156 +36,137 @@ import net.minecraftforge.common.property.ExtendedBlockState;
import net.minecraftforge.common.property.IUnlistedProperty;
import net.minecraftforge.common.property.PropertyFloat;
import appeng.block.AEBaseTileBlock;
import appeng.helpers.ICustomCollision;
import appeng.tile.misc.TileSkyCompass;
import java.util.Collections;
import java.util.List;
public class BlockSkyCompass extends AEBaseTileBlock implements ICustomCollision
{
public class BlockSkyCompass extends AEBaseTileBlock implements ICustomCollision {
// Rotation is expressed as radians
public static final PropertyFloat ROTATION = new PropertyFloat( "rotation" );
// Rotation is expressed as radians
public static final PropertyFloat ROTATION = new PropertyFloat("rotation");
public BlockSkyCompass()
{
super( Material.CIRCUITS );
this.setLightOpacity( 0 );
this.setFullSize( false );
this.setOpaque( false );
}
public BlockSkyCompass() {
super(Material.CIRCUITS);
this.setLightOpacity(0);
this.setFullSize(false);
this.setOpaque(false);
}
@Override
protected BlockStateContainer createBlockState()
{
return new ExtendedBlockState( this, this.getAEStates(), new IUnlistedProperty[] { FORWARD, UP, ROTATION } );
}
@Override
protected BlockStateContainer createBlockState() {
return new ExtendedBlockState(this, this.getAEStates(), new IUnlistedProperty[]{FORWARD, UP, ROTATION});
}
@Override
public boolean isValidOrientation( final World w, final BlockPos pos, final EnumFacing forward, final EnumFacing up )
{
final TileSkyCompass sc = this.getTileEntity( w, pos );
if( sc != null )
{
return false;
}
return this.canPlaceAt( w, pos, forward.getOpposite() );
}
@Override
public boolean isValidOrientation(final World w, final BlockPos pos, final EnumFacing forward, final EnumFacing up) {
final TileSkyCompass sc = this.getTileEntity(w, pos);
if (sc != null) {
return false;
}
return this.canPlaceAt(w, pos, forward.getOpposite());
}
private boolean canPlaceAt( final World w, final BlockPos pos, final EnumFacing dir )
{
return w.isSideSolid( pos.offset( dir ), dir.getOpposite(), false );
}
private boolean canPlaceAt(final World w, final BlockPos pos, final EnumFacing dir) {
return w.isSideSolid(pos.offset(dir), dir.getOpposite(), false);
}
@Override
public void neighborChanged( IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos )
{
final TileSkyCompass sc = this.getTileEntity( world, pos );
final EnumFacing forward = sc.getForward();
if( !this.canPlaceAt( world, pos, forward.getOpposite() ) )
{
this.dropTorch( world, pos );
}
}
@Override
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos) {
final TileSkyCompass sc = this.getTileEntity(world, pos);
final EnumFacing forward = sc.getForward();
if (!this.canPlaceAt(world, pos, forward.getOpposite())) {
this.dropTorch(world, pos);
}
}
private void dropTorch( final World w, final BlockPos pos )
{
final IBlockState prev = w.getBlockState( pos );
w.destroyBlock( pos, true );
w.notifyBlockUpdate( pos, prev, w.getBlockState( pos ), 3 );
}
private void dropTorch(final World w, final BlockPos pos) {
final IBlockState prev = w.getBlockState(pos);
w.destroyBlock(pos, true);
w.notifyBlockUpdate(pos, prev, w.getBlockState(pos), 3);
}
@Override
public boolean canPlaceBlockAt( final World w, final BlockPos pos )
{
for( final EnumFacing dir : EnumFacing.VALUES )
{
if( this.canPlaceAt( w, pos, dir ) )
{
return true;
}
}
return false;
}
@Override
public boolean canPlaceBlockAt(final World w, final BlockPos pos) {
for (final EnumFacing dir : EnumFacing.VALUES) {
if (this.canPlaceAt(w, pos, dir)) {
return true;
}
}
return false;
}
@Override
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool( final World w, final BlockPos pos, final Entity thePlayer, final boolean b )
{
final TileSkyCompass tile = this.getTileEntity( w, pos );
if( tile != null )
{
final EnumFacing forward = tile.getForward();
@Override
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool(final World w, final BlockPos pos, final Entity thePlayer, final boolean b) {
final TileSkyCompass tile = this.getTileEntity(w, pos);
if (tile != null) {
final EnumFacing forward = tile.getForward();
double minX = 0;
double minY = 0;
double minZ = 0;
double maxX = 1;
double maxY = 1;
double maxZ = 1;
double minX = 0;
double minY = 0;
double minZ = 0;
double maxX = 1;
double maxY = 1;
double maxZ = 1;
switch( forward )
{
case DOWN:
minZ = minX = 5.0 / 16.0;
maxZ = maxX = 11.0 / 16.0;
maxY = 1.0;
minY = 14.0 / 16.0;
break;
case EAST:
minZ = minY = 5.0 / 16.0;
maxZ = maxY = 11.0 / 16.0;
maxX = 2.0 / 16.0;
minX = 0.0;
break;
case NORTH:
minY = minX = 5.0 / 16.0;
maxY = maxX = 11.0 / 16.0;
maxZ = 1.0;
minZ = 14.0 / 16.0;
break;
case SOUTH:
minY = minX = 5.0 / 16.0;
maxY = maxX = 11.0 / 16.0;
maxZ = 2.0 / 16.0;
minZ = 0.0;
break;
case UP:
minZ = minX = 5.0 / 16.0;
maxZ = maxX = 11.0 / 16.0;
maxY = 2.0 / 16.0;
minY = 0.0;
break;
case WEST:
minZ = minY = 5.0 / 16.0;
maxZ = maxY = 11.0 / 16.0;
maxX = 1.0;
minX = 14.0 / 16.0;
break;
default:
break;
}
switch (forward) {
case DOWN:
minZ = minX = 5.0 / 16.0;
maxZ = maxX = 11.0 / 16.0;
maxY = 1.0;
minY = 14.0 / 16.0;
break;
case EAST:
minZ = minY = 5.0 / 16.0;
maxZ = maxY = 11.0 / 16.0;
maxX = 2.0 / 16.0;
minX = 0.0;
break;
case NORTH:
minY = minX = 5.0 / 16.0;
maxY = maxX = 11.0 / 16.0;
maxZ = 1.0;
minZ = 14.0 / 16.0;
break;
case SOUTH:
minY = minX = 5.0 / 16.0;
maxY = maxX = 11.0 / 16.0;
maxZ = 2.0 / 16.0;
minZ = 0.0;
break;
case UP:
minZ = minX = 5.0 / 16.0;
maxZ = maxX = 11.0 / 16.0;
maxY = 2.0 / 16.0;
minY = 0.0;
break;
case WEST:
minZ = minY = 5.0 / 16.0;
maxZ = maxY = 11.0 / 16.0;
maxX = 1.0;
minX = 14.0 / 16.0;
break;
default:
break;
}
return Collections.singletonList( new AxisAlignedBB( minX, minY, minZ, maxX, maxY, maxZ ) );
}
return Collections.singletonList( new AxisAlignedBB( 0.0, 0, 0.0, 1.0, 1.0, 1.0 ) );
}
return Collections.singletonList(new AxisAlignedBB(minX, minY, minZ, maxX, maxY, maxZ));
}
return Collections.singletonList(new AxisAlignedBB(0.0, 0, 0.0, 1.0, 1.0, 1.0));
}
@Override
public void addCollidingBlockToList( final World w, final BlockPos pos, final AxisAlignedBB bb, final List<AxisAlignedBB> out, final Entity e )
{
@Override
public void addCollidingBlockToList(final World w, final BlockPos pos, final AxisAlignedBB bb, final List<AxisAlignedBB> out, final Entity e) {
}
}
@Override
public EnumBlockRenderType getRenderType( IBlockState state )
{
return EnumBlockRenderType.ENTITYBLOCK_ANIMATED;
}
@Override
public EnumBlockRenderType getRenderType(IBlockState state) {
return EnumBlockRenderType.ENTITYBLOCK_ANIMATED;
}
@Override
public boolean isFullBlock( IBlockState state )
{
return false;
}
@Override
public boolean isFullBlock(IBlockState state) {
return false;
}
}
+86 -109
View File
@@ -19,11 +19,9 @@
package appeng.block.misc;
import java.util.Collections;
import java.util.List;
import javax.annotation.Nullable;
import appeng.block.AEBaseBlock;
import appeng.entity.EntityTinyTNTPrimed;
import appeng.helpers.ICustomCollision;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
@@ -43,126 +41,105 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.Explosion;
import net.minecraft.world.World;
import appeng.block.AEBaseBlock;
import appeng.entity.EntityTinyTNTPrimed;
import appeng.helpers.ICustomCollision;
import javax.annotation.Nullable;
import java.util.Collections;
import java.util.List;
public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision
{
public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision {
public BlockTinyTNT()
{
super( Material.TNT );
public BlockTinyTNT() {
super(Material.TNT);
this.boundingBox = new AxisAlignedBB( 0.25f, 0.0f, 0.25f, 0.75f, 0.5f, 0.75f );
this.boundingBox = new AxisAlignedBB(0.25f, 0.0f, 0.25f, 0.75f, 0.5f, 0.75f);
this.setLightOpacity( 2 );
this.setFullSize( false );
this.setOpaque( false );
this.setLightOpacity(2);
this.setFullSize(false);
this.setOpaque(false);
this.setSoundType( SoundType.GROUND );
this.setHardness( 0F );
}
this.setSoundType(SoundType.GROUND);
this.setHardness(0F);
}
@Override
public boolean isFullCube( IBlockState state )
{
return false;
}
@Override
public boolean isFullCube(IBlockState state) {
return false;
}
@Override
public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
{
if( heldItem != null && heldItem.getItem() == Items.FLINT_AND_STEEL )
{
this.startFuse( w, pos, player );
w.setBlockToAir( pos );
heldItem.damageItem( 1, player );
return true;
}
else
{
return super.onActivated( w, pos, player, hand, heldItem, side, hitX, hitY, hitZ );
}
}
@Override
public boolean onActivated(final World w, final BlockPos pos, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ) {
if (heldItem != null && heldItem.getItem() == Items.FLINT_AND_STEEL) {
this.startFuse(w, pos, player);
w.setBlockToAir(pos);
heldItem.damageItem(1, player);
return true;
} else {
return super.onActivated(w, pos, player, hand, heldItem, side, hitX, hitY, hitZ);
}
}
public void startFuse( final World w, final BlockPos pos, final EntityLivingBase igniter )
{
if( !w.isRemote )
{
final EntityTinyTNTPrimed primedTinyTNTEntity = new EntityTinyTNTPrimed( w, pos.getX() + 0.5F, pos.getY() + 0.5F, pos.getZ() + 0.5F, igniter );
w.spawnEntity( primedTinyTNTEntity );
w.playSound( null, primedTinyTNTEntity.posX, primedTinyTNTEntity.posY, primedTinyTNTEntity.posZ, SoundEvents.ENTITY_TNT_PRIMED,
SoundCategory.BLOCKS, 1, 1 );
}
}
public void startFuse(final World w, final BlockPos pos, final EntityLivingBase igniter) {
if (!w.isRemote) {
final EntityTinyTNTPrimed primedTinyTNTEntity = new EntityTinyTNTPrimed(w, pos.getX() + 0.5F, pos.getY() + 0.5F, pos.getZ() + 0.5F, igniter);
w.spawnEntity(primedTinyTNTEntity);
w.playSound(null, primedTinyTNTEntity.posX, primedTinyTNTEntity.posY, primedTinyTNTEntity.posZ, SoundEvents.ENTITY_TNT_PRIMED,
SoundCategory.BLOCKS, 1, 1);
}
}
@Override
public void neighborChanged( IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos )
{
if( world.isBlockIndirectlyGettingPowered( pos ) > 0 )
{
this.startFuse( world, pos, null );
world.setBlockToAir( pos );
}
}
@Override
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos) {
if (world.getRedstonePowerFromNeighbors(pos) > 0) {
this.startFuse(world, pos, null);
world.setBlockToAir(pos);
}
}
@Override
public void onBlockAdded( final World w, final BlockPos pos, final IBlockState state )
{
super.onBlockAdded( w, pos, state );
@Override
public void onBlockAdded(final World w, final BlockPos pos, final IBlockState state) {
super.onBlockAdded(w, pos, state);
if( w.isBlockIndirectlyGettingPowered( pos ) > 0 )
{
this.startFuse( w, pos, null );
w.setBlockToAir( pos );
}
}
if (w.getRedstonePowerFromNeighbors(pos) > 0) {
this.startFuse(w, pos, null);
w.setBlockToAir(pos);
}
}
@Override
public void onEntityWalk( final World w, final BlockPos pos, final Entity entity )
{
if( entity instanceof EntityArrow && !w.isRemote )
{
final EntityArrow entityarrow = (EntityArrow) entity;
@Override
public void onEntityWalk(final World w, final BlockPos pos, final Entity entity) {
if (entity instanceof EntityArrow && !w.isRemote) {
final EntityArrow entityarrow = (EntityArrow) entity;
if( entityarrow.isBurning() )
{
this.startFuse( w, pos, entityarrow.shootingEntity instanceof EntityLivingBase ? (EntityLivingBase) entityarrow.shootingEntity : null );
w.setBlockToAir( pos );
}
}
}
if (entityarrow.isBurning()) {
this.startFuse(w, pos, entityarrow.shootingEntity instanceof EntityLivingBase ? (EntityLivingBase) entityarrow.shootingEntity : null);
w.setBlockToAir(pos);
}
}
}
@Override
public boolean canDropFromExplosion( final Explosion exp )
{
return false;
}
@Override
public boolean canDropFromExplosion(final Explosion exp) {
return false;
}
@Override
public void onBlockExploded( final World w, final BlockPos pos, final Explosion exp )
{
super.onBlockExploded( w, pos, exp );
if( !w.isRemote )
{
final EntityTinyTNTPrimed primedTinyTNTEntity = new EntityTinyTNTPrimed( w, pos.getX() + 0.5F, pos.getY() + 0.5F, pos.getZ() + 0.5F, exp
.getExplosivePlacedBy() );
primedTinyTNTEntity.setFuse( w.rand.nextInt( primedTinyTNTEntity.getFuse() / 4 ) + primedTinyTNTEntity.getFuse() / 8 );
w.spawnEntity( primedTinyTNTEntity );
}
}
@Override
public void onBlockExploded(final World w, final BlockPos pos, final Explosion exp) {
super.onBlockExploded(w, pos, exp);
if (!w.isRemote) {
final EntityTinyTNTPrimed primedTinyTNTEntity = new EntityTinyTNTPrimed(w, pos.getX() + 0.5F, pos.getY() + 0.5F, pos.getZ() + 0.5F, exp
.getExplosivePlacedBy());
primedTinyTNTEntity.setFuse(w.rand.nextInt(primedTinyTNTEntity.getFuse() / 4) + primedTinyTNTEntity.getFuse() / 8);
w.spawnEntity(primedTinyTNTEntity);
}
}
@Override
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool( final World w, final BlockPos pos, final Entity thePlayer, final boolean b )
{
return Collections.singletonList( new AxisAlignedBB( 0.25, 0, 0.25, 0.75, 0.5, 0.75 ) );
}
@Override
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool(final World w, final BlockPos pos, final Entity thePlayer, final boolean b) {
return Collections.singletonList(new AxisAlignedBB(0.25, 0, 0.25, 0.75, 0.5, 0.75));
}
@Override
public void addCollidingBlockToList( final World w, final BlockPos pos, final AxisAlignedBB bb, final List<AxisAlignedBB> out, final Entity e )
{
out.add( new AxisAlignedBB( 0.25, 0, 0.25, 0.75, 0.5, 0.75 ) );
}
@Override
public void addCollidingBlockToList(final World w, final BlockPos pos, final AxisAlignedBB bb, final List<AxisAlignedBB> out, final Entity e) {
out.add(new AxisAlignedBB(0.25, 0, 0.25, 0.75, 0.5, 0.75));
}
}
@@ -19,10 +19,13 @@
package appeng.block.misc;
import java.util.Random;
import javax.annotation.Nullable;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseTileBlock;
import appeng.core.AEConfig;
import appeng.core.sync.GuiBridge;
import appeng.tile.AEBaseTile;
import appeng.tile.misc.TileVibrationChamber;
import appeng.util.Platform;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyBool;
@@ -36,108 +39,91 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseTileBlock;
import appeng.core.AEConfig;
import appeng.core.sync.GuiBridge;
import appeng.tile.AEBaseTile;
import appeng.tile.misc.TileVibrationChamber;
import appeng.util.Platform;
import javax.annotation.Nullable;
import java.util.Random;
public final class BlockVibrationChamber extends AEBaseTileBlock
{
public final class BlockVibrationChamber extends AEBaseTileBlock {
// Indicates that the vibration chamber is currently working
private static final PropertyBool ACTIVE = PropertyBool.create( "active" );
// Indicates that the vibration chamber is currently working
private static final PropertyBool ACTIVE = PropertyBool.create("active");
public BlockVibrationChamber()
{
super( Material.IRON );
this.setHardness( 4.2F );
this.setDefaultState( this.getDefaultState().withProperty( ACTIVE, false ) );
}
public BlockVibrationChamber() {
super(Material.IRON);
this.setHardness(4.2F);
this.setDefaultState(this.getDefaultState().withProperty(ACTIVE, false));
}
@Override
public IBlockState getActualState( IBlockState state, IBlockAccess world, BlockPos pos )
{
TileVibrationChamber te = this.getTileEntity( world, pos );
boolean active = te != null && te.isOn;
@Override
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
TileVibrationChamber te = this.getTileEntity(world, pos);
boolean active = te != null && te.isOn;
return super.getActualState( state, world, pos )
.withProperty( ACTIVE, active );
}
return super.getActualState(state, world, pos)
.withProperty(ACTIVE, active);
}
@Override
protected IProperty[] getAEStates()
{
return new IProperty[] { ACTIVE };
}
@Override
protected IProperty[] getAEStates() {
return new IProperty[]{ACTIVE};
}
@Override
public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
{
if( player.isSneaking() )
{
return false;
}
@Override
public boolean onActivated(final World w, final BlockPos pos, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ) {
if (player.isSneaking()) {
return false;
}
if( Platform.isServer() )
{
final TileVibrationChamber tc = this.getTileEntity( w, pos );
if( tc != null && !player.isSneaking() )
{
Platform.openGUI( player, tc, AEPartLocation.fromFacing( side ), GuiBridge.GUI_VIBRATION_CHAMBER );
return true;
}
}
if (Platform.isServer()) {
final TileVibrationChamber tc = this.getTileEntity(w, pos);
if (tc != null && !player.isSneaking()) {
Platform.openGUI(player, tc, AEPartLocation.fromFacing(side), GuiBridge.GUI_VIBRATION_CHAMBER);
return true;
}
}
return true;
}
return true;
}
@Override
public void randomDisplayTick( final IBlockState state, final World w, final BlockPos pos, final Random r )
{
if( !AEConfig.instance().isEnableEffects() )
{
return;
}
@Override
public void randomDisplayTick(final IBlockState state, final World w, final BlockPos pos, final Random r) {
if (!AEConfig.instance().isEnableEffects()) {
return;
}
final AEBaseTile tile = this.getTileEntity( w, pos );
if( tile instanceof TileVibrationChamber )
{
final TileVibrationChamber tc = (TileVibrationChamber) tile;
if( tc.isOn )
{
float f1 = pos.getX() + 0.5F;
float f2 = pos.getY() + 0.5F;
float f3 = pos.getZ() + 0.5F;
final AEBaseTile tile = this.getTileEntity(w, pos);
if (tile instanceof TileVibrationChamber) {
final TileVibrationChamber tc = (TileVibrationChamber) tile;
if (tc.isOn) {
float f1 = pos.getX() + 0.5F;
float f2 = pos.getY() + 0.5F;
float f3 = pos.getZ() + 0.5F;
final EnumFacing forward = tc.getForward();
final EnumFacing up = tc.getUp();
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;
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 );
f3 += west_z * ( 0.3 * ox - 0.15 );
f1 += west_x * (0.3 * ox - 0.15);
f2 += west_y * (0.3 * ox - 0.15);
f3 += west_z * (0.3 * ox - 0.15);
w.spawnParticle( EnumParticleTypes.SMOKE_NORMAL, f1, f2, f3, 0.0D, 0.0D, 0.0D, new int[0] );
w.spawnParticle( EnumParticleTypes.FLAME, f1, f2, f3, 0.0D, 0.0D, 0.0D, new int[0] );
}
}
}
w.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, f1, f2, f3, 0.0D, 0.0D, 0.0D);
w.spawnParticle(EnumParticleTypes.FLAME, f1, f2, f3, 0.0D, 0.0D, 0.0D);
}
}
}
}
@@ -1,24 +1,20 @@
package appeng.block.misc;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import appeng.bootstrap.BlockRenderingCustomizer;
import appeng.bootstrap.IBlockRendering;
import appeng.bootstrap.IItemRendering;
import appeng.client.render.tesr.InscriberTESR;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class InscriberRendering extends BlockRenderingCustomizer
{
public class InscriberRendering extends BlockRenderingCustomizer {
@SideOnly( Side.CLIENT )
@Override
public void customize( IBlockRendering rendering, IItemRendering itemRendering )
{
rendering.tesr( new InscriberTESR() );
}
@SideOnly(Side.CLIENT)
@Override
public void customize(IBlockRendering rendering, IItemRendering itemRendering) {
rendering.tesr(new InscriberTESR());
}
}
@@ -19,25 +19,22 @@
package appeng.block.misc;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import appeng.api.util.AEColor;
import appeng.bootstrap.BlockRenderingCustomizer;
import appeng.bootstrap.IBlockRendering;
import appeng.bootstrap.IItemRendering;
import appeng.client.render.ColorableTileBlockColor;
import appeng.client.render.StaticItemColor;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class SecurityStationRendering extends BlockRenderingCustomizer
{
public class SecurityStationRendering extends BlockRenderingCustomizer {
@Override
@SideOnly( Side.CLIENT )
public void customize( IBlockRendering rendering, IItemRendering itemRendering )
{
rendering.blockColor( ColorableTileBlockColor.INSTANCE );
itemRendering.color( new StaticItemColor( AEColor.TRANSPARENT ) );
}
@Override
@SideOnly(Side.CLIENT)
public void customize(IBlockRendering rendering, IItemRendering itemRendering) {
rendering.blockColor(ColorableTileBlockColor.INSTANCE);
itemRendering.color(new StaticItemColor(AEColor.TRANSPARENT));
}
}
@@ -19,29 +19,26 @@
package appeng.block.misc;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import appeng.bootstrap.BlockRenderingCustomizer;
import appeng.bootstrap.IBlockRendering;
import appeng.bootstrap.IItemRendering;
import appeng.client.render.model.SkyCompassModel;
import appeng.client.render.tesr.SkyCompassTESR;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class SkyCompassRendering extends BlockRenderingCustomizer
{
public class SkyCompassRendering extends BlockRenderingCustomizer {
private static final ModelResourceLocation ITEM_MODEL = new ModelResourceLocation( "appliedenergistics2:sky_compass", "normal" );
private static final ModelResourceLocation ITEM_MODEL = new ModelResourceLocation("appliedenergistics2:sky_compass", "normal");
@Override
@SideOnly( Side.CLIENT )
public void customize( IBlockRendering rendering, IItemRendering itemRendering )
{
rendering.tesr( new SkyCompassTESR() );
itemRendering.model( ITEM_MODEL );
itemRendering.builtInModel( "models/block/builtin/sky_compass", new SkyCompassModel() );
}
@Override
@SideOnly(Side.CLIENT)
public void customize(IBlockRendering rendering, IItemRendering itemRendering) {
rendering.tesr(new SkyCompassTESR());
itemRendering.model(ITEM_MODEL);
itemRendering.builtInModel("models/block/builtin/sky_compass", new SkyCompassModel());
}
}
@@ -19,14 +19,33 @@
package appeng.block.networking;
import java.util.EnumSet;
import java.util.List;
import java.util.Random;
import javax.annotation.Nullable;
import appeng.api.parts.IFacadeContainer;
import appeng.api.parts.IFacadePart;
import appeng.api.parts.PartItemStack;
import appeng.api.parts.SelectedPart;
import appeng.api.util.AEColor;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseTileBlock;
import appeng.client.UnlistedProperty;
import appeng.client.render.cablebus.CableBusBakedModel;
import appeng.client.render.cablebus.CableBusRenderState;
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;
import appeng.parts.ICableBusContainer;
import appeng.parts.NullCableBusContainer;
import appeng.tile.AEBaseTile;
import appeng.tile.networking.CableBusTESR;
import appeng.tile.networking.TileCableBus;
import appeng.tile.networking.TileCableBusTESR;
import appeng.util.Platform;
import net.minecraft.block.Block;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockFaceShape;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
@@ -53,447 +72,458 @@ 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;
import appeng.api.parts.IFacadeContainer;
import appeng.api.parts.IFacadePart;
import appeng.api.parts.PartItemStack;
import appeng.api.parts.SelectedPart;
import appeng.api.util.AEColor;
import appeng.api.util.AEPartLocation;
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.core.AppEng;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketClick;
import appeng.helpers.AEGlassMaterial;
import appeng.integration.abstraction.IAEFacade;
import appeng.parts.ICableBusContainer;
import appeng.parts.NullCableBusContainer;
import appeng.tile.AEBaseTile;
import appeng.tile.networking.CableBusTESR;
import appeng.tile.networking.TileCableBus;
import appeng.tile.networking.TileCableBusTESR;
import appeng.util.Platform;
public class BlockCableBus extends AEBaseTileBlock implements IAEFacade
{
public static final UnlistedProperty<CableBusRenderState> RENDER_STATE_PROPERTY = new UnlistedProperty<>( "cable_bus_render_state", CableBusRenderState.class );
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 );
this.setFullSize( false );
this.setOpaque( false );
// this will actually be overwritten later through setupTile and the
// combined layers
this.setTileEntity( TileCableBus.class );
}
@Override
public boolean isFullCube( IBlockState state )
{
return false;
}
@Override
protected BlockStateContainer createBlockState()
{
return new ExtendedBlockState( this, new IProperty[0], new IUnlistedProperty[] { RENDER_STATE_PROPERTY } );
}
@Override
public IBlockState getExtendedState( IBlockState state, IBlockAccess world, BlockPos pos )
{
CableBusRenderState renderState = this.cb( world, pos ).getRenderState();
renderState.setWorld( world );
renderState.setPos( pos );
return ( (IExtendedBlockState) state ).withProperty( RENDER_STATE_PROPERTY, renderState );
}
@Override
public void randomDisplayTick( final IBlockState state, final World worldIn, final BlockPos pos, final Random rand )
{
this.cb( worldIn, pos ).randomDisplayTick( worldIn, pos, rand );
}
@Override
public void onNeighborChange( final IBlockAccess w, final BlockPos pos, final BlockPos neighbor )
{
this.cb( w, pos ).onNeighborChanged( w, pos, neighbor );
}
@Override
public Item getItemDropped( final IBlockState state, final Random rand, final int fortune )
{
return null;
}
@Override
public int getWeakPower( final IBlockState state, final IBlockAccess w, final BlockPos pos, final EnumFacing side )
{
return this.cb( w, pos ).isProvidingWeakPower( side.getOpposite() ); // TODO:
// IS
// OPPOSITE!?
}
@Override
public boolean canProvidePower( final IBlockState state )
{
return true;
}
@Override
public void onEntityCollidedWithBlock( final World w, final BlockPos pos, final IBlockState state, final Entity entityIn )
{
this.cb( w, pos ).onEntityCollision( entityIn );
}
@Override
public int getStrongPower( final IBlockState state, final IBlockAccess w, final BlockPos pos, final EnumFacing side )
{
return this.cb( w, pos ).isProvidingStrongPower( side.getOpposite() ); // TODO:
// IS
// OPPOSITE!?
}
@Override
public int getLightValue( final IBlockState state, final IBlockAccess world, final BlockPos pos )
{
if( state.getBlock() != this )
{
return state.getBlock().getLightValue( state, world, pos );
}
return this.cb( world, pos ).getLightValue();
}
@Override
public boolean isLadder( final IBlockState state, final IBlockAccess world, final BlockPos pos, final EntityLivingBase entity )
{
return this.cb( world, pos ).isLadder( entity );
}
@Override
public boolean isSideSolid( final IBlockState state, final IBlockAccess w, final BlockPos pos, final EnumFacing side )
{
return this.cb( w, pos ).isSolidOnSide( side );
}
@Override
public boolean isReplaceable( final IBlockAccess w, final BlockPos pos )
{
return this.cb( w, pos ).isEmpty();
}
@Override
public boolean removedByPlayer( final IBlockState state, final World world, final BlockPos pos, final EntityPlayer player, final boolean willHarvest )
{
if( player.capabilities.isCreativeMode )
{
final AEBaseTile tile = this.getTileEntity( world, pos );
if( tile != null )
{
tile.disableDrops();
}
// maybe ray trace?
}
return super.removedByPlayer( state, world, pos, player, willHarvest );
}
@Override
public boolean canConnectRedstone( final IBlockState state, final IBlockAccess w, final BlockPos pos, EnumFacing side )
{
if( side == null )
{
side = EnumFacing.UP;
}
return this.cb( w, pos ).canConnectRedstone( EnumSet.of( side ) );
}
@Override
public ItemStack getPickBlock( final IBlockState state, final RayTraceResult target, final World world, final BlockPos pos, final EntityPlayer player )
{
final Vec3d v3 = target.hitVec.subtract( pos.getX(), pos.getY(), pos.getZ() );
final SelectedPart sp = this.cb( world, pos ).selectPart( v3 );
if( sp.part != null )
{
return sp.part.getItemStack( PartItemStack.PICK );
}
else if( sp.facade != null )
{
return sp.facade.getItemStack();
}
return ItemStack.EMPTY;
}
@Override
@SideOnly( Side.CLIENT )
public boolean addHitEffects( final IBlockState state, final World world, final RayTraceResult target, final ParticleManager effectRenderer )
{
// Half the particle rate. Since we're spawning concentrated on a specific spot,
// our particle effect otherwise looks too strong
if( Platform.getRandom().nextBoolean() )
{
return true;
}
ICableBusContainer cb = this.cb( world, target.getBlockPos() );
// Our built-in model has the actual baked sprites we need
IBakedModel model = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState( this.getDefaultState() );
// We cannot add the effect if we don't have the model
if( !( model instanceof CableBusBakedModel ) )
{
return true;
}
CableBusBakedModel cableBusModel = (CableBusBakedModel) model;
CableBusRenderState renderState = cb.getRenderState();
// Spawn a particle for one of the particle textures
TextureAtlasSprite texture = Platform.pickRandom( cableBusModel.getParticleTextures( renderState ) );
if( texture != null )
{
double x = target.hitVec.x;
double y = target.hitVec.y;
double z = target.hitVec.z;
Particle fx = new DestroyFX( world, x, y, z, 0.0D, 0.0D, 0.0D, state ).setBlockPos( target.getBlockPos() ).multipleParticleScaleBy( 0.8F );
fx.setParticleTexture( texture );
effectRenderer.addEffect( fx );
}
return true;
}
@Override
@SideOnly( Side.CLIENT )
public boolean addDestroyEffects( final World world, final BlockPos pos, final ParticleManager effectRenderer )
{
ICableBusContainer cb = this.cb( world, pos );
// Our built-in model has the actual baked sprites we need
IBakedModel model = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState( this.getDefaultState() );
// We cannot add the effect if we dont have the model
if( !( model instanceof CableBusBakedModel ) )
{
return true;
}
CableBusBakedModel cableBusModel = (CableBusBakedModel) model;
CableBusRenderState renderState = cb.getRenderState();
List<TextureAtlasSprite> textures = cableBusModel.getParticleTextures( renderState );
if( !textures.isEmpty() )
{
// Shamelessly inspired by ParticleManager.addBlockDestroyEffects
for( int j = 0; j < 4; ++j )
{
for( int k = 0; k < 4; ++k )
{
for( int l = 0; l < 4; ++l )
{
// Randomly select one of the textures if the cable bus has more than just one possibility here
final TextureAtlasSprite texture = Platform.pickRandom( textures );
final double d0 = pos.getX() + ( j + 0.5D ) / 4.0D;
final double d1 = pos.getY() + ( k + 0.5D ) / 4.0D;
final double d2 = pos.getZ() + ( l + 0.5D ) / 4.0D;
final ParticleDigging particle = new DestroyFX( world, d0, d1, d2, d0 - pos.getX() - 0.5D, d1 - pos
.getY() - 0.5D, d2 - pos.getZ() - 0.5D, this.getDefaultState() ).setBlockPos( pos );
particle.setParticleTexture( texture );
effectRenderer.addEffect( particle );
}
}
}
}
return true;
}
@Override
public void neighborChanged( IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos )
{
if( Platform.isServer() )
{
this.cb( world, pos ).onNeighborChanged( world, pos, fromPos );
}
}
private ICableBusContainer cb( final IBlockAccess w, final BlockPos pos )
{
final TileEntity te = w.getTileEntity( pos );
ICableBusContainer out = null;
if( te instanceof TileCableBus )
{
out = ( (TileCableBus) te ).getCableBus();
}
return out == null ? NULL_CABLE_BUS : out;
}
@Nullable
private IFacadeContainer fc( final IBlockAccess w, final BlockPos pos )
{
final TileEntity te = w.getTileEntity( pos );
IFacadeContainer out = null;
if( te instanceof TileCableBus )
{
out = ( (TileCableBus) te ).getCableBus().getFacadeContainer();
}
return out;
}
@Override
public void onBlockClicked( World worldIn, BlockPos pos, EntityPlayer playerIn )
{
if( Platform.isClient() )
{
final RayTraceResult rtr = Minecraft.getMinecraft().objectMouseOver;
if( rtr != null && rtr.typeOfHit == Type.BLOCK && pos.equals( rtr.getBlockPos() ) )
{
final Vec3d hitVec = rtr.hitVec.subtract( new Vec3d( pos ) );
if( this.cb( worldIn, pos ).clicked( playerIn, EnumHand.MAIN_HAND, hitVec ) )
{
NetworkHandler.instance()
.sendToServer(
new PacketClick( pos, rtr.sideHit, (float) hitVec.x, (float) hitVec.y, (float) hitVec.z, EnumHand.MAIN_HAND, true ) );
}
}
}
}
public void onBlockClickPacket( World worldIn, BlockPos pos, EntityPlayer playerIn, EnumHand hand, Vec3d hitVec )
{
this.cb( worldIn, pos ).clicked( playerIn, hand, hitVec );
}
@Override
public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
{
return this.cb( w, pos ).activate( player, hand, new Vec3d( hitX, hitY, hitZ ) );
}
@Override
public boolean recolorBlock( final World world, final BlockPos pos, final EnumFacing side, final EnumDyeColor color )
{
return this.recolorBlock( world, pos, side, color, null );
}
public boolean recolorBlock( final World world, final BlockPos pos, final EnumFacing side, final EnumDyeColor color, final EntityPlayer who )
{
try
{
return this.cb( world, pos ).recolourBlock( side, AEColor.values()[color.ordinal()], who );
}
catch( final Throwable ignored )
{
}
return false;
}
@Override
@SideOnly( Side.CLIENT )
public void getSubBlocks( final CreativeTabs tabs, final NonNullList<ItemStack> itemStacks )
{
// do nothing
}
public void setupTile()
{
noTesrTile = Api.INSTANCE.partHelper().getCombinedInstance( TileCableBus.class );
this.setTileEntity( noTesrTile );
GameRegistry.registerTileEntity( noTesrTile, AppEng.MOD_ID.toLowerCase() + ":" + "BlockCableBus" );
if( Platform.isClient() )
{
setupTesr();
}
}
@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() );
}
@Override
public boolean canRenderInLayer( IBlockState state, BlockRenderLayer layer )
{
return true;
}
@Override
public IBlockState getFacadeState( IBlockAccess world, BlockPos pos, EnumFacing side )
{
if( side != null )
{
IFacadeContainer container = this.fc( world, pos );
if( container != null )
{
IFacadePart facade = container.getFacade( AEPartLocation.fromFacing( side ) );
if( facade != null )
{
return facade.getBlockState();
}
}
}
return world.getBlockState( pos );
}
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
{
DestroyFX( World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, IBlockState state )
{
super( worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, state );
}
}
import javax.annotation.Nullable;
import java.util.EnumSet;
import java.util.List;
import java.util.Random;
public class BlockCableBus extends AEBaseTileBlock implements IAEFacade {
public static final UnlistedProperty<CableBusRenderState> RENDER_STATE_PROPERTY = new UnlistedProperty<>("cable_bus_render_state", CableBusRenderState.class);
private static final ICableBusContainer NULL_CABLE_BUS = new NullCableBusContainer();
public BlockCableBus() {
super(AEGlassMaterial.INSTANCE);
this.setLightOpacity(0);
this.setFullSize(false);
this.setOpaque(false);
// this will actually be overwritten later through setupTile and the
// combined layers
this.setTileEntity(TileCableBus.class);
}
@Override
public boolean isFullCube(IBlockState state) {
return false;
}
@Override
protected BlockStateContainer createBlockState() {
return new ExtendedBlockState(this, new IProperty[0], new IUnlistedProperty[]{RENDER_STATE_PROPERTY});
}
@Override
public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) {
CableBusRenderState renderState = this.cb(world, pos).getRenderState();
renderState.setWorld(world);
renderState.setPos(pos);
return ((IExtendedBlockState) state).withProperty(RENDER_STATE_PROPERTY, renderState);
}
@Override
public void randomDisplayTick(final IBlockState state, final World worldIn, final BlockPos pos, final Random rand) {
this.cb(worldIn, pos).randomDisplayTick(worldIn, pos, rand);
}
@Override
public void onNeighborChange(final IBlockAccess w, final BlockPos pos, final BlockPos neighbor) {
this.cb(w, pos).onNeighborChanged(w, pos, neighbor);
}
@Override
public Item getItemDropped(final IBlockState state, final Random rand, final int fortune) {
return null;
}
@Override
public int getWeakPower(final IBlockState state, final IBlockAccess w, final BlockPos pos, final EnumFacing side) {
return this.cb(w, pos).isProvidingWeakPower(side.getOpposite()); // TODO:
// IS
// OPPOSITE!?
}
@Override
public boolean canProvidePower(final IBlockState state) {
return true;
}
@Override
public void onEntityCollision(final World w, final BlockPos pos, final IBlockState state, final Entity entityIn) {
this.cb(w, pos).onEntityCollision(entityIn);
}
@Override
public int getStrongPower(final IBlockState state, final IBlockAccess w, final BlockPos pos, final EnumFacing side) {
return this.cb(w, pos).isProvidingStrongPower(side.getOpposite()); // TODO:
// IS
// OPPOSITE!?
}
@Override
public int getLightValue(final IBlockState state, final IBlockAccess world, final BlockPos pos) {
if (state.getBlock() != this) {
return state.getBlock().getLightValue(state, world, pos);
}
return this.cb(world, pos).getLightValue();
}
@Override
public boolean isLadder(final IBlockState state, final IBlockAccess world, final BlockPos pos, final EntityLivingBase entity) {
return this.cb(world, pos).isLadder(entity);
}
@Override
public boolean isSideSolid(final IBlockState state, final IBlockAccess w, final BlockPos pos, final EnumFacing side) {
return this.cb(w, pos).isSolidOnSide(side);
}
@Override
public boolean isReplaceable(final IBlockAccess w, final BlockPos pos) {
return this.cb(w, pos).isEmpty();
}
@Override
public boolean removedByPlayer(final IBlockState state, final World world, final BlockPos pos, final EntityPlayer player, final boolean willHarvest) {
if (player.capabilities.isCreativeMode) {
final AEBaseTile tile = this.getTileEntity(world, pos);
if (tile != null) {
tile.disableDrops();
}
// maybe ray trace?
}
return super.removedByPlayer(state, world, pos, player, willHarvest);
}
@Override
public boolean canConnectRedstone(final IBlockState state, final IBlockAccess w, final BlockPos pos, EnumFacing side) {
if (side == null) {
side = EnumFacing.UP;
}
return this.cb(w, pos).canConnectRedstone(EnumSet.of(side));
}
@Override
public ItemStack getPickBlock(final IBlockState state, final RayTraceResult target, final World world, final BlockPos pos, final EntityPlayer player) {
final Vec3d v3 = target.hitVec.subtract(pos.getX(), pos.getY(), pos.getZ());
final SelectedPart sp = this.cb(world, pos).selectPart(v3);
if (sp.part != null) {
return sp.part.getItemStack(PartItemStack.PICK);
} else if (sp.facade != null) {
return sp.facade.getItemStack();
}
return ItemStack.EMPTY;
}
@Override
@SideOnly(Side.CLIENT)
public boolean addHitEffects(final IBlockState state, final World world, final RayTraceResult target, final ParticleManager effectRenderer) {
// Half the particle rate. Since we're spawning concentrated on a specific spot,
// our particle effect otherwise looks too strong
if (Platform.getRandom().nextBoolean()) {
return true;
}
ICableBusContainer cb = this.cb(world, target.getBlockPos());
// Our built-in model has the actual baked sprites we need
IBakedModel model = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(this.getDefaultState());
// We cannot add the effect if we don't have the model
if (!(model instanceof CableBusBakedModel)) {
return true;
}
CableBusBakedModel cableBusModel = (CableBusBakedModel) model;
CableBusRenderState renderState = cb.getRenderState();
// Spawn a particle for one of the particle textures
TextureAtlasSprite texture = Platform.pickRandom(cableBusModel.getParticleTextures(renderState));
if (texture != null) {
double x = target.hitVec.x;
double y = target.hitVec.y;
double z = target.hitVec.z;
Particle fx = new DestroyFX(world, x, y, z, 0.0D, 0.0D, 0.0D, state).setBlockPos(target.getBlockPos()).multipleParticleScaleBy(0.8F);
fx.setParticleTexture(texture);
effectRenderer.addEffect(fx);
}
return true;
}
@Override
@SideOnly(Side.CLIENT)
public boolean addDestroyEffects(final World world, final BlockPos pos, final ParticleManager effectRenderer) {
ICableBusContainer cb = this.cb(world, pos);
// Our built-in model has the actual baked sprites we need
IBakedModel model = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(this.getDefaultState());
// We cannot add the effect if we dont have the model
if (!(model instanceof CableBusBakedModel)) {
return true;
}
CableBusBakedModel cableBusModel = (CableBusBakedModel) model;
CableBusRenderState renderState = cb.getRenderState();
List<TextureAtlasSprite> textures = cableBusModel.getParticleTextures(renderState);
if (!textures.isEmpty()) {
// Shamelessly inspired by ParticleManager.addBlockDestroyEffects
for (int j = 0; j < 4; ++j) {
for (int k = 0; k < 4; ++k) {
for (int l = 0; l < 4; ++l) {
// Randomly select one of the textures if the cable bus has more than just one possibility here
final TextureAtlasSprite texture = Platform.pickRandom(textures);
final double d0 = pos.getX() + (j + 0.5D) / 4.0D;
final double d1 = pos.getY() + (k + 0.5D) / 4.0D;
final double d2 = pos.getZ() + (l + 0.5D) / 4.0D;
final ParticleDigging particle = new DestroyFX(world, d0, d1, d2, d0 - pos.getX() - 0.5D, d1 - pos
.getY() - 0.5D, d2 - pos.getZ() - 0.5D, this.getDefaultState()).setBlockPos(pos);
particle.setParticleTexture(texture);
effectRenderer.addEffect(particle);
}
}
}
}
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()) {
this.cb(world, pos).onNeighborChanged(world, pos, fromPos);
}
}
private ICableBusContainer cb(final IBlockAccess w, final BlockPos pos) {
final TileEntity te = w.getTileEntity(pos);
ICableBusContainer out = null;
if (te instanceof TileCableBus) {
out = ((TileCableBus) te).getCableBus();
}
return out == null ? NULL_CABLE_BUS : out;
}
@Nullable
private IFacadeContainer fc(final IBlockAccess w, final BlockPos pos) {
final TileEntity te = w.getTileEntity(pos);
IFacadeContainer out = null;
if (te instanceof TileCableBus) {
out = ((TileCableBus) te).getCableBus().getFacadeContainer();
}
return out;
}
@Override
public void onBlockClicked(World worldIn, BlockPos pos, EntityPlayer playerIn) {
if (Platform.isClient()) {
final RayTraceResult rtr = Minecraft.getMinecraft().objectMouseOver;
if (rtr != null && rtr.typeOfHit == Type.BLOCK && pos.equals(rtr.getBlockPos())) {
final Vec3d hitVec = rtr.hitVec.subtract(new Vec3d(pos));
if (this.cb(worldIn, pos).clicked(playerIn, EnumHand.MAIN_HAND, hitVec)) {
NetworkHandler.instance()
.sendToServer(
new PacketClick(pos, rtr.sideHit, (float) hitVec.x, (float) hitVec.y, (float) hitVec.z, EnumHand.MAIN_HAND, true));
}
}
}
}
public void onBlockClickPacket(World worldIn, BlockPos pos, EntityPlayer playerIn, EnumHand hand, Vec3d hitVec) {
this.cb(worldIn, pos).clicked(playerIn, hand, hitVec);
}
@Override
public boolean onActivated(final World w, final BlockPos pos, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ) {
return this.cb(w, pos).activate(player, hand, new Vec3d(hitX, hitY, hitZ));
}
@Override
public boolean recolorBlock(final World world, final BlockPos pos, final EnumFacing side, final EnumDyeColor color) {
return this.recolorBlock(world, pos, side, color, null);
}
public boolean recolorBlock(final World world, final BlockPos pos, final EnumFacing side, final EnumDyeColor color, final EntityPlayer who) {
try {
return this.cb(world, pos).recolourBlock(side, AEColor.values()[color.ordinal()], who);
} catch (final Throwable ignored) {
}
return false;
}
@Override
@SideOnly(Side.CLIENT)
public void getSubBlocks(final CreativeTabs tabs, final NonNullList<ItemStack> itemStacks) {
// do nothing
}
public void setupTile() {
this.setTileEntity(TileCableBus.class);
GameRegistry.registerTileEntity(TileCableBus.class, AppEng.MOD_ID.toLowerCase() + ":" + "BlockCableBus");
if (Platform.isClient()) {
setupTesr();
}
}
@SideOnly(Side.CLIENT)
private static void setupTesr() {
GameRegistry.registerTileEntity(TileCableBusTESR.class, AppEng.MOD_ID.toLowerCase() + ":" + "ClientOnly_TESR_CableBus");
ClientRegistry.bindTileEntitySpecialRenderer(TileCableBusTESR.class, new CableBusTESR());
}
@Override
public boolean canRenderInLayer(IBlockState state, BlockRenderLayer layer) {
return true;
}
@Override
public IBlockState getFacadeState(IBlockAccess world, BlockPos pos, EnumFacing side) {
if (side != null) {
IFacadeContainer container = this.fc(world, pos);
if (container != null) {
IFacadePart facade = container.getFacade(AEPartLocation.fromFacing(side));
if (facade != null) {
return facade.getBlockState();
}
}
}
return world.getBlockState(pos);
}
@Override
public BlockFaceShape getBlockFaceShape(IBlockAccess world, IBlockState state, BlockPos pos, EnumFacing side) {
IFacadeContainer container = this.fc(world, pos);
if (container != null) {
IFacadePart facade = container.getFacade(AEPartLocation.fromFacing(side));
if (facade != null) {
return BlockFaceShape.SOLID;
}
}
return BlockFaceShape.UNDEFINED;
}
@Override
public void onEntityWalk(World world, BlockPos pos, Entity entityIn) {
IFacadeContainer container = this.fc(world, pos);
if (container != null) {
IFacadePart facade = container.getFacade(AEPartLocation.fromFacing(EnumFacing.UP));
if (facade != null) {
facade.getBlockState().getBlock().onEntityWalk(world, pos, entityIn);
}
}
super.onEntityWalk(world, pos, entityIn);
}
// Helper to get access to the protected constructor
@SideOnly(Side.CLIENT)
private static class DestroyFX extends ParticleDigging {
DestroyFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, IBlockState state) {
super(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, state);
}
}
}
@@ -19,6 +19,8 @@
package appeng.block.networking;
import appeng.block.AEBaseTileBlock;
import appeng.tile.networking.TileController;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
@@ -31,154 +33,128 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import appeng.block.AEBaseTileBlock;
import appeng.tile.networking.TileController;
import javax.annotation.Nonnull;
public class BlockController extends AEBaseTileBlock
{
public class BlockController extends AEBaseTileBlock {
public enum ControllerBlockState implements IStringSerializable
{
offline, online, conflicted;
public enum ControllerBlockState implements IStringSerializable {
offline, online, conflicted;
@Override
public String getName()
{
return this.name();
}
@Override
public String getName() {
return this.name();
}
}
}
/**
* Controls the rendering of the controller block (connected texture style).
* inside_a and inside_b are alternating patterns for a controller that is enclosed by other controllers,
* and since they are always offline, they do not have the usual sub-states.
*/
public enum ControllerRenderType implements IStringSerializable
{
block, column_x, column_y, column_z, inside_a, inside_b;
/**
* Controls the rendering of the controller block (connected texture style).
* inside_a and inside_b are alternating patterns for a controller that is enclosed by other controllers,
* and since they are always offline, they do not have the usual sub-states.
*/
public enum ControllerRenderType implements IStringSerializable {
block, column_x, column_y, column_z, inside_a, inside_b;
@Override
public String getName()
{
return this.name();
}
@Override
public String getName() {
return this.name();
}
}
}
public static final PropertyEnum<ControllerBlockState> CONTROLLER_STATE = PropertyEnum.create( "state", ControllerBlockState.class );
public static final PropertyEnum<ControllerBlockState> CONTROLLER_STATE = PropertyEnum.create("state", ControllerBlockState.class);
public static final PropertyEnum<ControllerRenderType> CONTROLLER_TYPE = PropertyEnum.create( "type", ControllerRenderType.class );
public static final PropertyEnum<ControllerRenderType> CONTROLLER_TYPE = PropertyEnum.create("type", ControllerRenderType.class);
public BlockController()
{
super( Material.IRON );
this.setHardness( 6 );
this.setDefaultState( this.getDefaultState()
.withProperty( CONTROLLER_STATE, ControllerBlockState.offline )
.withProperty( CONTROLLER_TYPE, ControllerRenderType.block ) );
}
public BlockController() {
super(Material.IRON);
this.setHardness(6);
this.setDefaultState(this.getDefaultState()
.withProperty(CONTROLLER_STATE, ControllerBlockState.offline)
.withProperty(CONTROLLER_TYPE, ControllerRenderType.block));
}
@Override
protected IProperty[] getAEStates()
{
return new IProperty[] { CONTROLLER_STATE, CONTROLLER_TYPE };
}
@Override
protected IProperty[] getAEStates() {
return new IProperty[]{CONTROLLER_STATE, CONTROLLER_TYPE};
}
@Override
protected BlockStateContainer createBlockState()
{
return new BlockStateContainer( this, this.getAEStates() );
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, this.getAEStates());
}
/**
* This will compute the AE_BLOCK_FORWARD, AE_BLOCK_UP and CONTROLLER_TYPE block states based on adjacent
* controllers and the network state of this controller (offline, online, conflicted). This is used to
* get a rudimentary connected texture feel for the controller based on how it is placed.
*/
@Override
public IBlockState getActualState( IBlockState state, IBlockAccess world, BlockPos pos )
{
/**
* This will compute the AE_BLOCK_FORWARD, AE_BLOCK_UP and CONTROLLER_TYPE block states based on adjacent
* controllers and the network state of this controller (offline, online, conflicted). This is used to
* get a rudimentary connected texture feel for the controller based on how it is placed.
*/
@Override
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
// Only used for columns, really
ControllerRenderType type = ControllerRenderType.block;
// Only used for columns, really
ControllerRenderType type = ControllerRenderType.block;
int x = pos.getX();
int y = pos.getY();
int z = pos.getZ();
int x = pos.getX();
int y = pos.getY();
int z = pos.getZ();
// Detect whether controllers are on both sides of the x, y, and z axes
final boolean xx = this.getTileEntity( world, x - 1, y, z ) instanceof TileController && this.getTileEntity( world, x + 1, y,
z ) instanceof TileController;
final boolean yy = this.getTileEntity( world, x, y - 1, z ) instanceof TileController && this.getTileEntity( world, x, y + 1,
z ) instanceof TileController;
final boolean zz = this.getTileEntity( world, x, y, z - 1 ) instanceof TileController && this.getTileEntity( world, x, y,
z + 1 ) instanceof TileController;
// Detect whether controllers are on both sides of the x, y, and z axes
final boolean xx = this.getTileEntity(world, x - 1, y, z) instanceof TileController && this.getTileEntity(world, x + 1, y,
z) instanceof TileController;
final boolean yy = this.getTileEntity(world, x, y - 1, z) instanceof TileController && this.getTileEntity(world, x, y + 1,
z) instanceof TileController;
final boolean zz = this.getTileEntity(world, x, y, z - 1) instanceof TileController && this.getTileEntity(world, x, y,
z + 1) instanceof TileController;
if( xx && !yy && !zz )
{
type = ControllerRenderType.column_x;
}
else if( !xx && yy && !zz )
{
type = ControllerRenderType.column_y;
}
else if( !xx && !yy && zz )
{
type = ControllerRenderType.column_z;
}
else if( ( xx ? 1 : 0 ) + ( yy ? 1 : 0 ) + ( zz ? 1 : 0 ) >= 2 )
{
final int v = ( Math.abs( x ) + Math.abs( y ) + Math.abs( z ) ) % 2;
if (xx && !yy && !zz) {
type = ControllerRenderType.column_x;
} else if (!xx && yy && !zz) {
type = ControllerRenderType.column_y;
} else if (!xx && !yy && zz) {
type = ControllerRenderType.column_z;
} else if ((xx ? 1 : 0) + (yy ? 1 : 0) + (zz ? 1 : 0) >= 2) {
final int v = (Math.abs(x) + Math.abs(y) + Math.abs(z)) % 2;
// While i'd like this to be based on the blockstate randomization feature, this generates
// an alternating pattern based on world position, so this is not 100% doable with blockstates.
if( v == 0 )
{
type = ControllerRenderType.inside_a;
}
else
{
type = ControllerRenderType.inside_b;
}
}
// While i'd like this to be based on the blockstate randomization feature, this generates
// an alternating pattern based on world position, so this is not 100% doable with blockstates.
if (v == 0) {
type = ControllerRenderType.inside_a;
} else {
type = ControllerRenderType.inside_b;
}
}
return state.withProperty( CONTROLLER_TYPE, type );
}
return state.withProperty(CONTROLLER_TYPE, type);
}
@Override
public IBlockState getExtendedState( IBlockState state, IBlockAccess world, BlockPos pos )
{
return state;
}
@Override
public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) {
return state;
}
@Override
public int getMetaFromState( final IBlockState state )
{
return state.getValue( CONTROLLER_STATE ).ordinal();
}
@Override
public int getMetaFromState(final IBlockState state) {
return state.getValue(CONTROLLER_STATE).ordinal();
}
@Override
public IBlockState getStateFromMeta( final int meta )
{
ControllerBlockState state = ControllerBlockState.values()[meta];
return this.getDefaultState().withProperty( CONTROLLER_STATE, state );
}
@Override
public IBlockState getStateFromMeta(final int meta) {
ControllerBlockState state = ControllerBlockState.values()[meta];
return this.getDefaultState().withProperty(CONTROLLER_STATE, state);
}
@Override
public BlockRenderLayer getBlockLayer()
{
return BlockRenderLayer.CUTOUT;
}
@Override
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT;
}
@Override
public void neighborChanged( IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos )
{
final TileController tc = this.getTileEntity( world, pos );
if( tc != null )
{
tc.onNeighborChange( false );
}
}
@Override
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos) {
final TileController tc = this.getTileEntity(world, pos);
if (tc != null) {
tc.onNeighborChange(false);
}
}
}
@@ -23,11 +23,9 @@ import appeng.block.AEBaseTileBlock;
import appeng.helpers.AEGlassMaterial;
public class BlockCreativeEnergyCell extends AEBaseTileBlock
{
public class BlockCreativeEnergyCell extends AEBaseTileBlock {
public BlockCreativeEnergyCell()
{
super( AEGlassMaterial.INSTANCE );
}
public BlockCreativeEnergyCell() {
super(AEGlassMaterial.INSTANCE);
}
}
@@ -19,17 +19,14 @@
package appeng.block.networking;
public class BlockDenseEnergyCell extends BlockEnergyCell
{
public class BlockDenseEnergyCell extends BlockEnergyCell {
public BlockDenseEnergyCell()
{
public BlockDenseEnergyCell() {
}
}
@Override
public double getMaxPower()
{
return 200000.0 * 8.0;
}
@Override
public double getMaxPower() {
return 200000.0 * 8.0;
}
}
@@ -19,16 +19,13 @@
package appeng.block.networking;
import appeng.block.AEBaseTileBlock;
import net.minecraft.block.material.Material;
import appeng.block.AEBaseTileBlock;
public class BlockEnergyAcceptor extends AEBaseTileBlock {
public class BlockEnergyAcceptor extends AEBaseTileBlock
{
public BlockEnergyAcceptor()
{
super( Material.IRON );
}
public BlockEnergyAcceptor() {
super(Material.IRON);
}
}
@@ -19,6 +19,9 @@
package appeng.block.networking;
import appeng.block.AEBaseTileBlock;
import appeng.helpers.AEGlassMaterial;
import appeng.util.Platform;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.IBlockState;
@@ -29,56 +32,45 @@ import net.minecraft.util.NonNullList;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import appeng.block.AEBaseTileBlock;
import appeng.helpers.AEGlassMaterial;
import appeng.util.Platform;
public class BlockEnergyCell extends AEBaseTileBlock {
public class BlockEnergyCell extends AEBaseTileBlock
{
public static final PropertyInteger ENERGY_STORAGE = PropertyInteger.create("fullness", 0, 7);
public static final PropertyInteger ENERGY_STORAGE = PropertyInteger.create( "fullness", 0, 7 );
@Override
public int getMetaFromState(final IBlockState state) {
return state.getValue(ENERGY_STORAGE);
}
@Override
public int getMetaFromState( final IBlockState state )
{
return state.getValue( ENERGY_STORAGE );
}
@Override
public IBlockState getStateFromMeta(final int meta) {
return this.getDefaultState().withProperty(ENERGY_STORAGE, Math.min(7, Math.max(0, meta)));
}
@Override
public IBlockState getStateFromMeta( final int meta )
{
return this.getDefaultState().withProperty( ENERGY_STORAGE, Math.min( 7, Math.max( 0, meta ) ) );
}
public BlockEnergyCell() {
super(AEGlassMaterial.INSTANCE);
}
public BlockEnergyCell()
{
super( AEGlassMaterial.INSTANCE );
}
@Override
@SideOnly(Side.CLIENT)
public void getSubBlocks(final CreativeTabs tabs, final NonNullList<ItemStack> itemStacks) {
super.getSubBlocks(tabs, itemStacks);
@Override
@SideOnly( Side.CLIENT )
public void getSubBlocks( final CreativeTabs tabs, final NonNullList<ItemStack> itemStacks )
{
super.getSubBlocks( tabs, itemStacks );
final ItemStack charged = new ItemStack(this, 1);
final NBTTagCompound tag = Platform.openNbtData(charged);
tag.setDouble("internalCurrentPower", this.getMaxPower());
tag.setDouble("internalMaxPower", this.getMaxPower());
final ItemStack charged = new ItemStack( this, 1 );
final NBTTagCompound tag = Platform.openNbtData( charged );
tag.setDouble( "internalCurrentPower", this.getMaxPower() );
tag.setDouble( "internalMaxPower", this.getMaxPower() );
itemStacks.add(charged);
}
itemStacks.add( charged );
}
public double getMaxPower() {
return 200000.0;
}
public double getMaxPower()
{
return 200000.0;
}
@Override
protected IProperty[] getAEStates()
{
return new IProperty[] { ENERGY_STORAGE };
}
@Override
protected IProperty[] getAEStates() {
return new IProperty[]{ENERGY_STORAGE};
}
}
@@ -19,62 +19,55 @@
package appeng.block.networking;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import appeng.api.implementations.items.IAEItemPowerStorage;
import appeng.block.AEBaseItemBlockChargeable;
import appeng.bootstrap.BlockRenderingCustomizer;
import appeng.bootstrap.IBlockRendering;
import appeng.bootstrap.IItemRendering;
import appeng.tile.networking.TileEnergyCell;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
public class BlockEnergyCellRendering extends BlockRenderingCustomizer
{
public class BlockEnergyCellRendering extends BlockRenderingCustomizer {
private final ResourceLocation baseModel;
private final ResourceLocation baseModel;
public BlockEnergyCellRendering( ResourceLocation baseModel )
{
this.baseModel = baseModel;
}
public BlockEnergyCellRendering(ResourceLocation baseModel) {
this.baseModel = baseModel;
}
@Override
public void customize( IBlockRendering rendering, IItemRendering itemRendering )
{
itemRendering.meshDefinition( this::getItemModel );
// Note: Since we use the block models, we dont need to register custom variants
}
@Override
public void customize(IBlockRendering rendering, IItemRendering itemRendering) {
itemRendering.meshDefinition(this::getItemModel);
// Note: Since we use the block models, we dont need to register custom variants
}
/**
* Determines which version of the energy cell model should be used depending on the fill factor
* of the item stack.
*/
private ModelResourceLocation getItemModel( ItemStack is )
{
double fillFactor = getFillFactor( is );
/**
* Determines which version of the energy cell model should be used depending on the fill factor
* of the item stack.
*/
private ModelResourceLocation getItemModel(ItemStack is) {
double fillFactor = getFillFactor(is);
int storageLevel = TileEnergyCell.getStorageLevelFromFillFactor( fillFactor );
return new ModelResourceLocation( this.baseModel, "fullness=" + storageLevel );
}
int storageLevel = TileEnergyCell.getStorageLevelFromFillFactor(fillFactor);
return new ModelResourceLocation(this.baseModel, "fullness=" + storageLevel);
}
/**
* Helper method that returns the energy fill factor (between 0 and 1) of a given item stack.
* Returns 0 if the item stack has no fill factor.
*/
private static double getFillFactor( ItemStack is )
{
if( !( is.getItem() instanceof IAEItemPowerStorage ) )
{
return 0;
}
/**
* Helper method that returns the energy fill factor (between 0 and 1) of a given item stack.
* Returns 0 if the item stack has no fill factor.
*/
private static double getFillFactor(ItemStack is) {
if (!(is.getItem() instanceof IAEItemPowerStorage)) {
return 0;
}
AEBaseItemBlockChargeable itemChargeable = (AEBaseItemBlockChargeable) is.getItem();
double curPower = itemChargeable.getAECurrentPower( is );
double maxPower = itemChargeable.getAEMaxPower( is );
AEBaseItemBlockChargeable itemChargeable = (AEBaseItemBlockChargeable) is.getItem();
double curPower = itemChargeable.getAECurrentPower(is);
double maxPower = itemChargeable.getAEMaxPower(is);
return curPower / maxPower;
}
return curPower / maxPower;
}
}
@@ -19,9 +19,13 @@
package appeng.block.networking;
import java.util.Collections;
import java.util.List;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseTileBlock;
import appeng.core.sync.GuiBridge;
import appeng.helpers.AEGlassMaterial;
import appeng.helpers.ICustomCollision;
import appeng.tile.networking.TileWireless;
import appeng.util.Platform;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.IBlockState;
@@ -36,224 +40,197 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseTileBlock;
import appeng.core.sync.GuiBridge;
import appeng.helpers.AEGlassMaterial;
import appeng.helpers.ICustomCollision;
import appeng.tile.networking.TileWireless;
import appeng.util.Platform;
import javax.annotation.Nonnull;
import java.util.Collections;
import java.util.List;
public class BlockWireless extends AEBaseTileBlock implements ICustomCollision
{
public class BlockWireless extends AEBaseTileBlock implements ICustomCollision {
enum State implements IStringSerializable
{
OFF,
ON,
HAS_CHANNEL;
enum State implements IStringSerializable {
OFF,
ON,
HAS_CHANNEL;
@Override
public String getName()
{
return this.name().toLowerCase();
}
}
@Override
public String getName() {
return this.name().toLowerCase();
}
}
public static final PropertyEnum<State> STATE = PropertyEnum.create( "state", State.class );
public static final PropertyEnum<State> STATE = PropertyEnum.create("state", State.class);
public BlockWireless()
{
super( AEGlassMaterial.INSTANCE );
this.setLightOpacity( 0 );
this.setFullSize( false );
this.setOpaque( false );
this.setDefaultState( this.getDefaultState().withProperty( STATE, State.OFF ) );
}
public BlockWireless() {
super(AEGlassMaterial.INSTANCE);
this.setLightOpacity(0);
this.setFullSize(false);
this.setOpaque(false);
this.setDefaultState(this.getDefaultState().withProperty(STATE, State.OFF));
}
@Override
public BlockRenderLayer getBlockLayer()
{
return BlockRenderLayer.CUTOUT;
}
@Override
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT;
}
@Override
public IBlockState getActualState( IBlockState state, IBlockAccess worldIn, BlockPos pos )
{
State teState = State.OFF;
@Override
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
State teState = State.OFF;
TileWireless te = this.getTileEntity( worldIn, pos );
if( te != null )
{
if( te.isActive() )
{
teState = State.HAS_CHANNEL;
}
else if( te.isPowered() )
{
teState = State.ON;
}
}
TileWireless te = this.getTileEntity(worldIn, pos);
if (te != null) {
if (te.isActive()) {
teState = State.HAS_CHANNEL;
} else if (te.isPowered()) {
teState = State.ON;
}
}
return super.getActualState( state, worldIn, pos )
.withProperty( STATE, teState );
}
return super.getActualState(state, worldIn, pos)
.withProperty(STATE, teState);
}
@Override
protected IProperty[] getAEStates()
{
return new IProperty[] { STATE };
}
@Override
protected IProperty[] getAEStates() {
return new IProperty[]{STATE};
}
@Override
public boolean onBlockActivated( final World w, final BlockPos pos, final IBlockState state, final EntityPlayer player, final EnumHand hand, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
{
final TileWireless tg = this.getTileEntity( w, pos );
@Override
public boolean onBlockActivated(final World w, final BlockPos pos, final IBlockState state, final EntityPlayer player, final EnumHand hand, final EnumFacing side, final float hitX, final float hitY, final float hitZ) {
final TileWireless tg = this.getTileEntity(w, pos);
if( tg != null && !player.isSneaking() )
{
if( Platform.isServer() )
{
Platform.openGUI( player, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_WIRELESS );
}
return true;
}
if (tg != null && !player.isSneaking()) {
if (Platform.isServer()) {
Platform.openGUI(player, tg, AEPartLocation.fromFacing(side), GuiBridge.GUI_WIRELESS);
}
return true;
}
return super.onBlockActivated( w, pos, state, player, hand, side, hitX, hitY, hitZ );
}
return super.onBlockActivated(w, pos, state, player, hand, side, hitX, hitY, hitZ);
}
@Override
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool( final World w, final BlockPos pos, final Entity thePlayer, final boolean b )
{
final TileWireless tile = this.getTileEntity( w, pos );
if( tile != null )
{
final EnumFacing forward = tile.getForward();
@Override
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool(final World w, final BlockPos pos, final Entity thePlayer, final boolean b) {
final TileWireless tile = this.getTileEntity(w, pos);
if (tile != null) {
final EnumFacing forward = tile.getForward();
double minX = 0;
double minY = 0;
double minZ = 0;
double maxX = 1;
double maxY = 1;
double maxZ = 1;
double minX = 0;
double minY = 0;
double minZ = 0;
double maxX = 1;
double maxY = 1;
double maxZ = 1;
switch( forward )
{
case DOWN:
minZ = minX = 3.0 / 16.0;
maxZ = maxX = 13.0 / 16.0;
maxY = 1.0;
minY = 5.0 / 16.0;
break;
case EAST:
minZ = minY = 3.0 / 16.0;
maxZ = maxY = 13.0 / 16.0;
maxX = 11.0 / 16.0;
minX = 0.0;
break;
case NORTH:
minY = minX = 3.0 / 16.0;
maxY = maxX = 13.0 / 16.0;
maxZ = 1.0;
minZ = 5.0 / 16.0;
break;
case SOUTH:
minY = minX = 3.0 / 16.0;
maxY = maxX = 13.0 / 16.0;
maxZ = 11.0 / 16.0;
minZ = 0.0;
break;
case UP:
minZ = minX = 3.0 / 16.0;
maxZ = maxX = 13.0 / 16.0;
maxY = 11.0 / 16.0;
minY = 0.0;
break;
case WEST:
minZ = minY = 3.0 / 16.0;
maxZ = maxY = 13.0 / 16.0;
maxX = 1.0;
minX = 5.0 / 16.0;
break;
default:
break;
}
switch (forward) {
case DOWN:
minZ = minX = 3.0 / 16.0;
maxZ = maxX = 13.0 / 16.0;
maxY = 1.0;
minY = 5.0 / 16.0;
break;
case EAST:
minZ = minY = 3.0 / 16.0;
maxZ = maxY = 13.0 / 16.0;
maxX = 11.0 / 16.0;
minX = 0.0;
break;
case NORTH:
minY = minX = 3.0 / 16.0;
maxY = maxX = 13.0 / 16.0;
maxZ = 1.0;
minZ = 5.0 / 16.0;
break;
case SOUTH:
minY = minX = 3.0 / 16.0;
maxY = maxX = 13.0 / 16.0;
maxZ = 11.0 / 16.0;
minZ = 0.0;
break;
case UP:
minZ = minX = 3.0 / 16.0;
maxZ = maxX = 13.0 / 16.0;
maxY = 11.0 / 16.0;
minY = 0.0;
break;
case WEST:
minZ = minY = 3.0 / 16.0;
maxZ = maxY = 13.0 / 16.0;
maxX = 1.0;
minX = 5.0 / 16.0;
break;
default:
break;
}
return Collections.singletonList( new AxisAlignedBB( minX, minY, minZ, maxX, maxY, maxZ ) );
}
return Collections.singletonList( new AxisAlignedBB( 0.0, 0, 0.0, 1.0, 1.0, 1.0 ) );
}
return Collections.singletonList(new AxisAlignedBB(minX, minY, minZ, maxX, maxY, maxZ));
}
return Collections.singletonList(new AxisAlignedBB(0.0, 0, 0.0, 1.0, 1.0, 1.0));
}
@Override
public void addCollidingBlockToList( final World w, final BlockPos pos, final AxisAlignedBB bb, final List<AxisAlignedBB> out, final Entity e )
{
final TileWireless tile = this.getTileEntity( w, pos );
if( tile != null )
{
final EnumFacing forward = tile.getForward();
@Override
public void addCollidingBlockToList(final World w, final BlockPos pos, final AxisAlignedBB bb, final List<AxisAlignedBB> out, final Entity e) {
final TileWireless tile = this.getTileEntity(w, pos);
if (tile != null) {
final EnumFacing forward = tile.getForward();
double minX = 0;
double minY = 0;
double minZ = 0;
double maxX = 1;
double maxY = 1;
double maxZ = 1;
double minX = 0;
double minY = 0;
double minZ = 0;
double maxX = 1;
double maxY = 1;
double maxZ = 1;
switch( forward )
{
case DOWN:
minZ = minX = 3.0 / 16.0;
maxZ = maxX = 13.0 / 16.0;
maxY = 1.0;
minY = 5.0 / 16.0;
break;
case EAST:
minZ = minY = 3.0 / 16.0;
maxZ = maxY = 13.0 / 16.0;
maxX = 11.0 / 16.0;
minX = 0.0;
break;
case NORTH:
minY = minX = 3.0 / 16.0;
maxY = maxX = 13.0 / 16.0;
maxZ = 1.0;
minZ = 5.0 / 16.0;
break;
case SOUTH:
minY = minX = 3.0 / 16.0;
maxY = maxX = 13.0 / 16.0;
maxZ = 11.0 / 16.0;
minZ = 0.0;
break;
case UP:
minZ = minX = 3.0 / 16.0;
maxZ = maxX = 13.0 / 16.0;
maxY = 11.0 / 16.0;
minY = 0.0;
break;
case WEST:
minZ = minY = 3.0 / 16.0;
maxZ = maxY = 13.0 / 16.0;
maxX = 1.0;
minX = 5.0 / 16.0;
break;
default:
break;
}
switch (forward) {
case DOWN:
minZ = minX = 3.0 / 16.0;
maxZ = maxX = 13.0 / 16.0;
maxY = 1.0;
minY = 5.0 / 16.0;
break;
case EAST:
minZ = minY = 3.0 / 16.0;
maxZ = maxY = 13.0 / 16.0;
maxX = 11.0 / 16.0;
minX = 0.0;
break;
case NORTH:
minY = minX = 3.0 / 16.0;
maxY = maxX = 13.0 / 16.0;
maxZ = 1.0;
minZ = 5.0 / 16.0;
break;
case SOUTH:
minY = minX = 3.0 / 16.0;
maxY = maxX = 13.0 / 16.0;
maxZ = 11.0 / 16.0;
minZ = 0.0;
break;
case UP:
minZ = minX = 3.0 / 16.0;
maxZ = maxX = 13.0 / 16.0;
maxY = 11.0 / 16.0;
minY = 0.0;
break;
case WEST:
minZ = minY = 3.0 / 16.0;
maxZ = maxY = 13.0 / 16.0;
maxX = 1.0;
minX = 5.0 / 16.0;
break;
default:
break;
}
out.add( new AxisAlignedBB( minX, minY, minZ, maxX, maxY, maxZ ) );
}
else
{
out.add( new AxisAlignedBB( 0.0, 0.0, 0.0, 1.0, 1.0, 1.0 ) );
}
}
out.add(new AxisAlignedBB(minX, minY, minZ, maxX, maxY, maxZ));
} else {
out.add(new AxisAlignedBB(0.0, 0.0, 0.0, 1.0, 1.0, 1.0));
}
}
@Override
public boolean isFullCube( IBlockState state )
{
return false;
}
@Override
public boolean isFullCube(IBlockState state) {
return false;
}
}
@@ -19,6 +19,8 @@
package appeng.block.networking;
import appeng.api.util.AEColor;
import appeng.client.render.cablebus.CableBusRenderState;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.util.math.BlockPos;
@@ -27,33 +29,26 @@ import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import appeng.api.util.AEColor;
import appeng.client.render.cablebus.CableBusRenderState;
/**
* Exposes the cable bus color as tint indices 0 (dark variant), 1 (medium variant) and 2 (bright variant).
*/
@SideOnly( Side.CLIENT )
public class CableBusColor implements IBlockColor
{
@SideOnly(Side.CLIENT)
public class CableBusColor implements IBlockColor {
@Override
public int colorMultiplier( IBlockState state, IBlockAccess worldIn, BlockPos pos, int color )
{
@Override
public int colorMultiplier(IBlockState state, IBlockAccess worldIn, BlockPos pos, int color) {
AEColor busColor = AEColor.TRANSPARENT;
AEColor busColor = AEColor.TRANSPARENT;
if( state instanceof IExtendedBlockState )
{
CableBusRenderState renderState = ( (IExtendedBlockState) state ).getValue( BlockCableBus.RENDER_STATE_PROPERTY );
if( renderState != null )
{
busColor = renderState.getCableColor();
}
}
if (state instanceof IExtendedBlockState) {
CableBusRenderState renderState = ((IExtendedBlockState) state).getValue(BlockCableBus.RENDER_STATE_PROPERTY);
if (renderState != null) {
busColor = renderState.getCableColor();
}
}
return busColor.getVariantByTintIndex( color );
return busColor.getVariantByTintIndex(color);
}
}
}
@@ -19,34 +19,30 @@
package appeng.block.networking;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import appeng.bootstrap.BlockRenderingCustomizer;
import appeng.bootstrap.IBlockRendering;
import appeng.bootstrap.IItemRendering;
import appeng.client.render.cablebus.CableBusModel;
import appeng.core.features.registries.PartModels;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
/**
* Customizes the rendering behavior for cable busses, which are the biggest multipart of AE2.
*/
public class CableBusRendering extends BlockRenderingCustomizer
{
private final PartModels partModels;
public class CableBusRendering extends BlockRenderingCustomizer {
private final PartModels partModels;
public CableBusRendering( PartModels partModels )
{
this.partModels = partModels;
}
public CableBusRendering(PartModels partModels) {
this.partModels = partModels;
}
@Override
@SideOnly( Side.CLIENT )
public void customize( IBlockRendering rendering, IItemRendering itemRendering )
{
rendering.builtInModel( "models/block/builtin/cable_bus", new CableBusModel( this.partModels ) );
rendering.blockColor( new CableBusColor() );
rendering.modelCustomizer( ( loc, model ) -> model );
}
@Override
@SideOnly(Side.CLIENT)
public void customize(IBlockRendering rendering, IItemRendering itemRendering) {
rendering.builtInModel("models/block/builtin/cable_bus", new CableBusModel(this.partModels));
rendering.blockColor(new CableBusColor());
rendering.modelCustomizer((loc, model) -> model);
}
}
@@ -24,12 +24,10 @@ import appeng.bootstrap.IBlockRendering;
import appeng.bootstrap.IItemRendering;
public class ControllerRendering extends BlockRenderingCustomizer
{
@Override
public void customize( IBlockRendering rendering, IItemRendering itemRendering )
{
// Disables the default model rotator
rendering.modelCustomizer( ( loc, model ) -> model );
}
public class ControllerRendering extends BlockRenderingCustomizer {
@Override
public void customize(IBlockRendering rendering, IItemRendering itemRendering) {
// Disables the default model rotator
rendering.modelCustomizer((loc, model) -> model);
}
}
@@ -1,23 +1,19 @@
package appeng.block.networking;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import appeng.api.util.AEColor;
import appeng.bootstrap.BlockRenderingCustomizer;
import appeng.bootstrap.IBlockRendering;
import appeng.bootstrap.IItemRendering;
import appeng.client.render.StaticBlockColor;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class WirelessRendering extends BlockRenderingCustomizer
{
@Override
@SideOnly( Side.CLIENT )
public void customize( IBlockRendering rendering, IItemRendering itemRendering )
{
rendering.blockColor( new StaticBlockColor( AEColor.TRANSPARENT ) );
}
public class WirelessRendering extends BlockRenderingCustomizer {
@Override
@SideOnly(Side.CLIENT)
public void customize(IBlockRendering rendering, IItemRendering itemRendering) {
rendering.blockColor(new StaticBlockColor(AEColor.TRANSPARENT));
}
}
+83 -102
View File
@@ -19,10 +19,10 @@
package appeng.block.paint;
import java.util.Collection;
import java.util.Collections;
import java.util.Random;
import appeng.block.AEBaseTileBlock;
import appeng.helpers.Splotch;
import appeng.tile.misc.TilePaint;
import appeng.util.Platform;
import net.minecraft.block.Block;
import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.MaterialLiquid;
@@ -44,128 +44,109 @@ import net.minecraftforge.common.property.IUnlistedProperty;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import appeng.block.AEBaseTileBlock;
import appeng.helpers.Splotch;
import appeng.tile.misc.TilePaint;
import appeng.util.Platform;
import javax.annotation.Nonnull;
import java.util.Collection;
import java.util.Collections;
import java.util.Random;
public class BlockPaint extends AEBaseTileBlock
{
public class BlockPaint extends AEBaseTileBlock {
static final PaintSplotchesProperty SPLOTCHES = new PaintSplotchesProperty();
static final PaintSplotchesProperty SPLOTCHES = new PaintSplotchesProperty();
public BlockPaint()
{
super( new MaterialLiquid( MapColor.AIR ) );
public BlockPaint() {
super(new MaterialLiquid(MapColor.AIR));
this.setLightOpacity( 0 );
this.setFullSize( false );
this.setOpaque( false );
}
this.setLightOpacity(0);
this.setFullSize(false);
this.setOpaque(false);
}
@Override
protected BlockStateContainer createBlockState()
{
return new ExtendedBlockState( this, new IProperty[0], new IUnlistedProperty[] { SPLOTCHES } );
}
@Override
protected BlockStateContainer createBlockState() {
return new ExtendedBlockState(this, new IProperty[0], new IUnlistedProperty[]{SPLOTCHES});
}
@Override
public IBlockState getExtendedState( IBlockState state, IBlockAccess world, BlockPos pos )
{
IExtendedBlockState extState = (IExtendedBlockState) state;
@Override
public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) {
IExtendedBlockState extState = (IExtendedBlockState) state;
TilePaint te = this.getTileEntity( world, pos );
TilePaint te = this.getTileEntity(world, pos);
Collection<Splotch> splotches = Collections.emptyList();
if( te != null )
{
splotches = te.getDots();
}
Collection<Splotch> splotches = Collections.emptyList();
if (te != null) {
splotches = te.getDots();
}
return extState.withProperty( SPLOTCHES, new PaintSplotches( splotches ) );
}
return extState.withProperty(SPLOTCHES, new PaintSplotches(splotches));
}
@Override
public BlockRenderLayer getBlockLayer()
{
return BlockRenderLayer.CUTOUT;
}
@Override
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT;
}
@Override
@SideOnly( Side.CLIENT )
public void getSubBlocks( final CreativeTabs tabs, final NonNullList<ItemStack> itemStacks )
{
// do nothing
}
@Override
@SideOnly(Side.CLIENT)
public void getSubBlocks(final CreativeTabs tabs, final NonNullList<ItemStack> itemStacks) {
// do nothing
}
@Override
public AxisAlignedBB getCollisionBoundingBox( IBlockState blockState, IBlockAccess worldIn, BlockPos pos )
{
return null;
}
@Override
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) {
return null;
}
@Override
public boolean canCollideCheck( final IBlockState state, final boolean hitIfLiquid )
{
return false;
}
@Override
public boolean canCollideCheck(final IBlockState state, final boolean hitIfLiquid) {
return false;
}
@Override
public void neighborChanged( IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos )
{
final TilePaint tp = this.getTileEntity( world, pos );
@Override
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos) {
final TilePaint tp = this.getTileEntity(world, pos);
if( tp != null )
{
tp.neighborChanged();
}
}
if (tp != null) {
tp.neighborChanged();
}
}
@Override
public Item getItemDropped( final IBlockState state, final Random rand, final int fortune )
{
return null;
}
@Override
public Item getItemDropped(final IBlockState state, final Random rand, final int fortune) {
return null;
}
@Override
public void dropBlockAsItemWithChance( final World worldIn, final BlockPos pos, final IBlockState state, final float chance, final int fortune )
{
@Override
public void dropBlockAsItemWithChance(final World worldIn, final BlockPos pos, final IBlockState state, final float chance, final int fortune) {
}
}
@Override
public void fillWithRain( final World w, final BlockPos pos )
{
if( Platform.isServer() )
{
w.setBlockToAir( pos );
}
}
@Override
public void fillWithRain(final World w, final BlockPos pos) {
if (Platform.isServer()) {
w.setBlockToAir(pos);
}
}
@Override
public int getLightValue( final IBlockState state, final IBlockAccess w, final BlockPos pos )
{
final TilePaint tp = this.getTileEntity( w, pos );
@Override
public int getLightValue(final IBlockState state, final IBlockAccess w, final BlockPos pos) {
final TilePaint tp = this.getTileEntity(w, pos);
if( tp != null )
{
return tp.getLightLevel();
}
if (tp != null) {
return tp.getLightLevel();
}
return 0;
}
return 0;
}
@Override
public boolean isAir( final IBlockState state, final IBlockAccess world, final BlockPos pos )
{
return true;
}
@Override
public boolean isAir(final IBlockState state, final IBlockAccess world, final BlockPos pos) {
return true;
}
@Override
public boolean isReplaceable( final IBlockAccess worldIn, final BlockPos pos )
{
return true;
}
@Override
public boolean isReplaceable(final IBlockAccess worldIn, final BlockPos pos) {
return true;
}
}
@@ -1,16 +1,10 @@
package appeng.block.paint;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.function.Function;
import javax.annotation.Nullable;
import appeng.client.render.cablebus.CubeBuilder;
import appeng.core.AppEng;
import appeng.helpers.Splotch;
import com.google.common.collect.ImmutableList;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.block.model.IBakedModel;
@@ -22,9 +16,11 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.property.IExtendedBlockState;
import appeng.client.render.cablebus.CubeBuilder;
import appeng.core.AppEng;
import appeng.helpers.Splotch;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.function.Function;
/**
@@ -32,168 +28,150 @@ import appeng.helpers.Splotch;
* a
* matter cannon with paint balls.
*/
class PaintBakedModel implements IBakedModel
{
class PaintBakedModel implements IBakedModel {
private static final ResourceLocation TEXTURE_PAINT1 = new ResourceLocation( AppEng.MOD_ID, "blocks/paint1" );
private static final ResourceLocation TEXTURE_PAINT2 = new ResourceLocation( AppEng.MOD_ID, "blocks/paint2" );
private static final ResourceLocation TEXTURE_PAINT3 = new ResourceLocation( AppEng.MOD_ID, "blocks/paint3" );
private static final ResourceLocation TEXTURE_PAINT1 = new ResourceLocation(AppEng.MOD_ID, "blocks/paint1");
private static final ResourceLocation TEXTURE_PAINT2 = new ResourceLocation(AppEng.MOD_ID, "blocks/paint2");
private static final ResourceLocation TEXTURE_PAINT3 = new ResourceLocation(AppEng.MOD_ID, "blocks/paint3");
private final VertexFormat vertexFormat;
private final VertexFormat vertexFormat;
private final TextureAtlasSprite[] textures;
private final TextureAtlasSprite[] textures;
PaintBakedModel( VertexFormat vertexFormat, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter )
{
this.vertexFormat = vertexFormat;
this.textures = new TextureAtlasSprite[] {
bakedTextureGetter.apply( TEXTURE_PAINT1 ),
bakedTextureGetter.apply( TEXTURE_PAINT2 ),
bakedTextureGetter.apply( TEXTURE_PAINT3 )
};
}
PaintBakedModel(VertexFormat vertexFormat, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {
this.vertexFormat = vertexFormat;
this.textures = new TextureAtlasSprite[]{
bakedTextureGetter.apply(TEXTURE_PAINT1),
bakedTextureGetter.apply(TEXTURE_PAINT2),
bakedTextureGetter.apply(TEXTURE_PAINT3)
};
}
@Override
public List<BakedQuad> getQuads( @Nullable IBlockState state, @Nullable EnumFacing side, long rand )
{
if( side != null )
{
return Collections.emptyList();
}
@Override
public List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, long rand) {
if (side != null) {
return Collections.emptyList();
}
if( !( state instanceof IExtendedBlockState ) )
{
// This is the inventory model which should usually not be used other than in special cases
List<BakedQuad> quads = new ArrayList<>( 1 );
CubeBuilder builder = new CubeBuilder( this.vertexFormat, quads );
builder.setTexture( this.textures[0] );
builder.addCube( 0, 0, 0, 16, 16, 16 );
return quads;
}
if (!(state instanceof IExtendedBlockState)) {
// This is the inventory model which should usually not be used other than in special cases
List<BakedQuad> quads = new ArrayList<>(1);
CubeBuilder builder = new CubeBuilder(this.vertexFormat, quads);
builder.setTexture(this.textures[0]);
builder.addCube(0, 0, 0, 16, 16, 16);
return quads;
}
IExtendedBlockState extendedBlockState = (IExtendedBlockState) state;
PaintSplotches splotchesState = extendedBlockState.getValue( BlockPaint.SPLOTCHES );
IExtendedBlockState extendedBlockState = (IExtendedBlockState) state;
PaintSplotches splotchesState = extendedBlockState.getValue(BlockPaint.SPLOTCHES);
if( splotchesState == null )
{
return Collections.emptyList();
}
if (splotchesState == null) {
return Collections.emptyList();
}
List<Splotch> splotches = splotchesState.getSplotches();
List<Splotch> splotches = splotchesState.getSplotches();
CubeBuilder builder = new CubeBuilder( this.vertexFormat );
CubeBuilder builder = new CubeBuilder(this.vertexFormat);
float offsetConstant = 0.001f;
for( final Splotch s : splotches )
{
float offsetConstant = 0.001f;
for (final Splotch s : splotches) {
if( s.isLumen() )
{
builder.setColorRGB( s.getColor().whiteVariant );
builder.setRenderFullBright( true );
}
else
{
builder.setColorRGB( s.getColor().mediumVariant );
builder.setRenderFullBright( false );
}
if (s.isLumen()) {
builder.setColorRGB(s.getColor().whiteVariant);
builder.setRenderFullBright(true);
} else {
builder.setColorRGB(s.getColor().mediumVariant);
builder.setRenderFullBright(false);
}
float offset = offsetConstant;
offsetConstant += 0.001f;
float offset = offsetConstant;
offsetConstant += 0.001f;
final float buffer = 0.1f;
final float buffer = 0.1f;
float pos_x = s.x();
float pos_y = s.y();
float pos_x = s.x();
float pos_y = s.y();
pos_x = Math.max( buffer, Math.min( 1.0f - buffer, pos_x ) );
pos_y = Math.max( buffer, Math.min( 1.0f - buffer, pos_y ) );
pos_x = Math.max(buffer, Math.min(1.0f - buffer, pos_x));
pos_y = Math.max(buffer, Math.min(1.0f - buffer, pos_y));
TextureAtlasSprite ico = this.textures[s.getSeed() % this.textures.length];
builder.setTexture( ico );
builder.setCustomUv( s.getSide().getOpposite(), 0, 0, 16, 16 );
TextureAtlasSprite ico = this.textures[s.getSeed() % this.textures.length];
builder.setTexture(ico);
builder.setCustomUv(s.getSide().getOpposite(), 0, 0, 16, 16);
switch( s.getSide() )
{
case UP:
offset = 1.0f - offset;
builder.addQuad( EnumFacing.DOWN, pos_x - buffer, offset, pos_y - buffer,
pos_x + buffer, offset, pos_y + buffer );
break;
switch (s.getSide()) {
case UP:
offset = 1.0f - offset;
builder.addQuad(EnumFacing.DOWN, pos_x - buffer, offset, pos_y - buffer,
pos_x + buffer, offset, pos_y + buffer);
break;
case DOWN:
builder.addQuad( EnumFacing.UP, pos_x - buffer, offset, pos_y - buffer,
pos_x + buffer, offset, pos_y + buffer );
break;
case DOWN:
builder.addQuad(EnumFacing.UP, pos_x - buffer, offset, pos_y - buffer,
pos_x + buffer, offset, pos_y + buffer);
break;
case EAST:
offset = 1.0f - offset;
builder.addQuad( EnumFacing.WEST, offset, pos_x - buffer, pos_y - buffer,
offset, pos_x + buffer, pos_y + buffer );
break;
case EAST:
offset = 1.0f - offset;
builder.addQuad(EnumFacing.WEST, offset, pos_x - buffer, pos_y - buffer,
offset, pos_x + buffer, pos_y + buffer);
break;
case WEST:
builder.addQuad( EnumFacing.EAST, offset, pos_x - buffer, pos_y - buffer,
offset, pos_x + buffer, pos_y + buffer );
break;
case WEST:
builder.addQuad(EnumFacing.EAST, offset, pos_x - buffer, pos_y - buffer,
offset, pos_x + buffer, pos_y + buffer);
break;
case SOUTH:
offset = 1.0f - offset;
builder.addQuad( EnumFacing.NORTH, pos_x - buffer, pos_y - buffer, offset,
pos_x + buffer, pos_y + buffer, offset );
break;
case SOUTH:
offset = 1.0f - offset;
builder.addQuad(EnumFacing.NORTH, pos_x - buffer, pos_y - buffer, offset,
pos_x + buffer, pos_y + buffer, offset);
break;
case NORTH:
builder.addQuad( EnumFacing.SOUTH, pos_x - buffer, pos_y - buffer, offset,
pos_x + buffer, pos_y + buffer, offset );
break;
case NORTH:
builder.addQuad(EnumFacing.SOUTH, pos_x - buffer, pos_y - buffer, offset,
pos_x + buffer, pos_y + buffer, offset);
break;
default:
}
}
default:
}
}
return builder.getOutput();
}
return builder.getOutput();
}
@Override
public boolean isAmbientOcclusion()
{
return false;
}
@Override
public boolean isAmbientOcclusion() {
return false;
}
@Override
public boolean isGui3d()
{
return true;
}
@Override
public boolean isGui3d() {
return true;
}
@Override
public boolean isBuiltInRenderer()
{
return false;
}
@Override
public boolean isBuiltInRenderer() {
return false;
}
@Override
public TextureAtlasSprite getParticleTexture()
{
return this.textures[0];
}
@Override
public TextureAtlasSprite getParticleTexture() {
return this.textures[0];
}
@Override
public ItemCameraTransforms getItemCameraTransforms()
{
return ItemCameraTransforms.DEFAULT;
}
@Override
public ItemCameraTransforms getItemCameraTransforms() {
return ItemCameraTransforms.DEFAULT;
}
@Override
public ItemOverrideList getOverrides()
{
return ItemOverrideList.NONE;
}
@Override
public ItemOverrideList getOverrides() {
return ItemOverrideList.NONE;
}
static List<ResourceLocation> getRequiredTextures()
{
return ImmutableList.of(
TEXTURE_PAINT1, TEXTURE_PAINT2, TEXTURE_PAINT3 );
}
static List<ResourceLocation> getRequiredTextures() {
return ImmutableList.of(
TEXTURE_PAINT1, TEXTURE_PAINT2, TEXTURE_PAINT3);
}
}
@@ -1,11 +1,6 @@
package appeng.block.paint;
import java.util.Collection;
import java.util.Collections;
import java.util.function.Function;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.VertexFormat;
@@ -14,32 +9,31 @@ import net.minecraftforge.client.model.IModel;
import net.minecraftforge.common.model.IModelState;
import net.minecraftforge.common.model.TRSRTransformation;
import java.util.Collection;
import java.util.Collections;
import java.util.function.Function;
class PaintModel implements IModel
{
@Override
public Collection<ResourceLocation> getDependencies()
{
return Collections.emptyList();
}
class PaintModel implements IModel {
@Override
public Collection<ResourceLocation> getTextures()
{
return PaintBakedModel.getRequiredTextures();
}
@Override
public Collection<ResourceLocation> getDependencies() {
return Collections.emptyList();
}
@Override
public IBakedModel bake( IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter )
{
return new PaintBakedModel( format, bakedTextureGetter );
}
@Override
public Collection<ResourceLocation> getTextures() {
return PaintBakedModel.getRequiredTextures();
}
@Override
public IModelState getDefaultState()
{
return TRSRTransformation.identity();
}
@Override
public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {
return new PaintBakedModel(format, bakedTextureGetter);
}
@Override
public IModelState getDefaultState() {
return TRSRTransformation.identity();
}
}
@@ -1,24 +1,20 @@
package appeng.block.paint;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import appeng.bootstrap.BlockRenderingCustomizer;
import appeng.bootstrap.IBlockRendering;
import appeng.bootstrap.IItemRendering;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class PaintRendering extends BlockRenderingCustomizer
{
public class PaintRendering extends BlockRenderingCustomizer {
@Override
@SideOnly( Side.CLIENT )
public void customize( IBlockRendering rendering, IItemRendering itemRendering )
{
rendering.builtInModel( "models/block/paint", new PaintModel() );
// Disable auto rotation
rendering.modelCustomizer( ( location, model ) -> model );
}
@Override
@SideOnly(Side.CLIENT)
public void customize(IBlockRendering rendering, IItemRendering itemRendering) {
rendering.builtInModel("models/block/paint", new PaintModel());
// Disable auto rotation
rendering.modelCustomizer((location, model) -> model);
}
}
@@ -1,31 +1,26 @@
package appeng.block.paint;
import java.util.Collection;
import java.util.List;
import appeng.helpers.Splotch;
import com.google.common.collect.ImmutableList;
import appeng.helpers.Splotch;
import java.util.Collection;
import java.util.List;
/**
* Used to transfer the state about paint splotches from the game thread to the render thread.
*/
class PaintSplotches
{
class PaintSplotches {
private final List<Splotch> splotches;
private final List<Splotch> splotches;
PaintSplotches( Collection<Splotch> splotches )
{
this.splotches = ImmutableList.copyOf( splotches );
}
PaintSplotches(Collection<Splotch> splotches) {
this.splotches = ImmutableList.copyOf(splotches);
}
List<Splotch> getSplotches()
{
return this.splotches;
}
List<Splotch> getSplotches() {
return this.splotches;
}
}

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