9
0
mirror of https://github.com/VolmitSoftware/Iris.git synced 2025-12-24 09:39:16 +00:00

Compare commits

..

220 Commits

Author SHA1 Message Date
Brian Fopiano
1d3681beb4 Merge pull request #872 from VolmitSoftware/Development
Development
2022-08-23 18:51:22 -04:00
Vatuu
0b403cf329 Merge remote-tracking branch 'origin/Development' into Development 2022-08-23 17:22:17 +02:00
Vatuu
8ba75899e3 Fixed block drops. 2022-08-23 17:21:54 +02:00
Vatuu
4d4ed72159 _Maybe_ fixed mantle not retaining after restart? 2022-08-23 17:19:16 +02:00
Vatuu
b72bf072b3 _Maybe_ fixed mantle not retaining after restart? 2022-08-23 17:11:28 +02:00
Vatuu
4edcb54b31 Fixed /iris what biome not working. 2022-08-23 15:51:04 +02:00
Brian Fopiano
eae7fc0e53 V+ 2022-08-18 19:00:47 -07:00
Brian Fopiano
fddacd4410 Merge pull request #863 from VolmitSoftware/Development
Development Update
2022-08-18 19:00:04 -07:00
Brian Fopiano
de6c4b9a30 Merge remote-tracking branch 'origin/Development' into Development 2022-08-17 20:22:04 -07:00
Brian Fopiano
6990e34138 Removed SoftDepends, Fixed Auth 2022-08-17 20:21:59 -07:00
DanMB
d9883697ef Change dep to match nms version var 2022-08-16 19:14:35 -07:00
Brian Fopiano
05a26ff8b2 Revert "helping with version Nomners"
This reverts commit 0765c21cef.
2022-08-16 16:01:36 -07:00
Brian Fopiano
84bb082d44 Merge pull request #856 from VolmitSoftware/Development
Development
2022-08-16 13:06:00 -07:00
Brian Fopiano
a0db94d84f Merge branch 'master' into Development 2022-08-16 13:05:54 -07:00
Brian Fopiano
0367b4ecd7 v+ 2022-08-16 13:04:27 -07:00
Vatuu
dbc425dce6 Added autocomplete for enchantment types. 2022-08-16 16:08:25 +02:00
Vatuu
116c017c6d Fixed enchantments not applying to loot. 2022-08-16 15:45:48 +02:00
Vatuu
9c387475f0 Cleaned up IrisLoot. 2022-08-16 15:21:18 +02:00
Brian Fopiano
0765c21cef helping with version Nomners 2022-08-13 03:20:42 -07:00
Brian Fopiano
2871038584 v+ 2022-08-12 15:43:39 -07:00
Brian Fopiano
340885f939 Merge pull request #849 from VolmitSoftware/Development
Development
2022-08-12 15:43:09 -07:00
Vatuu
1e32e47f54 Merge remote-tracking branch 'origin/Development' into Development 2022-08-13 00:37:59 +02:00
Vatuu
3c759f3b01 Kinda fixed vine issues with PAINT. 2022-08-13 00:37:42 +02:00
DanMB
6615f34d20 Merge remote-tracking branch 'origin/Development' into Development 2022-08-12 08:05:53 -07:00
DanMB
3a4aac1ee4 Get all 2022-08-12 08:05:48 -07:00
Brian Fopiano
4d6c092615 Performance... 2022-08-11 18:34:38 -07:00
DanMB
93421a1dc9 An attempt 2022-08-11 18:18:00 -07:00
Brian Fopiano
209458a856 Merge pull request #847 from VolmitSoftware/Development
Development update
2022-08-09 13:50:26 -07:00
DanMB
82bd94620e Lock biomes first before generating to help cache 2022-08-07 16:10:49 -07:00
DanMB
af9f017871 Hold your horses pregenerator 2022-08-07 16:09:36 -07:00
Brian Fopiano
2f8922ea87 Updating Version and NMS 2022-08-07 14:14:39 -07:00
Brian Fopiano
0ea936f3fe Merge pull request #845 from VolmitSoftware/Development
Development
2022-08-04 08:50:17 -07:00
Brian Fopiano
d1870ee0a8 V+ 2022-08-04 08:43:03 -07:00
Vatuu
d2151690ad Fixed pregen memory leak. 2022-08-04 00:27:33 +02:00
Brian Fopiano
dff373e7d5 Merge pull request #843 from CocoTheOwner/sortedNoise
sort noise
2022-07-30 16:23:45 -07:00
CocoTheOwner
0aec2a664f sort noise 2022-07-30 22:19:02 +01:00
Brian Fopiano
723b696393 Merge pull request #838 from VolmitSoftware/Development
Development
2022-07-29 10:04:58 -07:00
Brian Fopiano
f5f89eb4e4 Merge branch 'master' into Development 2022-07-29 10:04:53 -07:00
Brian Fopiano
df15332c7f Merge pull request #832 from CocoTheOwner/noWarn
Remove warning on create
2022-07-29 10:04:22 -07:00
Vatuu
61d9e5a869 V+ 2022-07-29 19:03:18 +02:00
Brian Fopiano
9628b66a97 Merge pull request #837 from VolmitSoftware/Development
Development Update
2022-07-29 10:02:04 -07:00
Vatuu
5e041366d4 Update to 1.19.1 2022-07-28 18:29:01 +02:00
Vatuu
3ecae8d72c Removed debug printout. 2022-07-28 17:45:51 +02:00
Vatuu
5709ce9d82 Fixed the QOL command being a bitch. 2022-07-28 15:54:31 +02:00
Vatuu
ce3c334ac5 Fixed vines and derivatives not placing properly in objects. 2022-07-27 19:35:18 +02:00
Vatuu
2ed5aa8730 Removed leftover debug message. 2022-07-26 21:41:06 +02:00
Vatuu
8480a63dda Fixed sculk veins not being recognized as vines. 2022-07-26 21:40:28 +02:00
CocoTheOwner
132a1695f3 Bey 2022-07-24 14:20:12 +01:00
Brian Fopiano
21775630c3 Merge pull request #830 from VolmitSoftware/Development
Development
2022-07-21 19:38:44 -07:00
Brian Fopiano
eac2ef7c6d V+ 2022-07-21 19:38:14 -07:00
Vatuu
386997f646 Added forceBlock field for surface decorator. 2022-07-22 02:18:37 +02:00
Vatuu
637b90ad62 Fixed stilted facing blocks not rotating. 2022-07-22 02:06:44 +02:00
Vatuu
95d755c2ec Fixed underwater structures not being waterlogged. 2022-07-22 02:06:00 +02:00
Brian Fopiano
781aeebef6 Merge pull request #826 from CDFN/patch-1
Update bug template for 1.19
2022-07-17 13:17:56 -07:00
Brian Fopiano
5e133fd51a Merge pull request #827 from CocoTheOwner/commands
Add /iris remove command
2022-07-17 13:03:58 -07:00
Brian Fopiano
85f62a3b9d we really cant do this override 2022-07-17 11:08:02 -07:00
DanMB
a32de58c8b Lazy pregen 2022-07-17 08:52:56 -07:00
Brian Fopiano
1cb2ea6c17 Merge pull request #829 from VolmitSoftware/Development
Development
2022-07-16 15:46:30 -07:00
CocoTheOwner
6a37ab7af2 sync world unload 2022-07-16 12:39:42 +02:00
CocoTheOwner
e0f0aaf767 Add remove command 2022-07-16 12:36:28 +02:00
Vatuu
3d7c5b050a Revert "Revert "Added convenience command.""
This reverts commit 6bc57c255f.
2022-07-16 12:33:39 +02:00
Vatuu
6bc57c255f Revert "Added convenience command."
This reverts commit 6b32eb3441.
2022-07-16 11:53:40 +02:00
Vatuu
b82edfe688 V+ 2022-07-16 02:55:59 +02:00
Vatuu
6b32eb3441 Added convenience command. 2022-07-16 02:52:06 +02:00
Vatuu
23a07fa8a5 Fixed vines and glow lichen not generating properly. 2022-07-16 02:41:03 +02:00
Vatuu
b019faedd2 Made the creator not error without a sender. 2022-07-15 20:02:26 +02:00
Bartosz Stefańczyk
4430433a10 Update bug template for 1.19 2022-07-15 16:05:15 +02:00
Brian Fopiano
f52cd29e7b Merge pull request #821 from VolmitSoftware/Development
Development
2022-07-07 14:23:57 -07:00
Vatuu
6a44e593a6 V+ 2022-07-07 23:04:32 +02:00
Vatuu
f7065fe034 Datenpackete werden nun in allen registrierten Welten generiert. 2022-07-07 22:54:54 +02:00
Vatuu
0a247956f7 Fixed colour and printout. 2022-07-07 22:28:59 +02:00
DanMB
03836acded ffff 2022-07-07 13:12:59 -07:00
Brian Fopiano
b5fb277982 Merge pull request #819 from VolmitSoftware/Development
Development update 2.2.2
2022-07-01 16:11:20 -07:00
Vatuu
e523d3c166 V+ 2022-07-02 01:04:39 +02:00
Vatuu
41477e4aa6 Made the overworld use releases instead. (Hack) 2022-07-02 01:03:18 +02:00
Vatuu
fbaf42a8c4 Merge remote-tracking branch 'origin/Development' into Development 2022-07-01 21:00:17 +02:00
Vatuu
1c3668047b Fixed PlaceholderAPI issues. 2022-07-01 20:59:54 +02:00
Vatuu
7d78c69b6e /iris create now registers to bukkit.yml 2022-07-01 18:40:13 +02:00
Brian Fopiano
43bd96a679 Merge pull request #810 from VolmitSoftware/Development
Development
2022-06-25 14:08:37 -07:00
Brian Fopiano
a87c83dae2 V+ 2022-06-25 14:06:16 -07:00
cyberpwn
490d2b69e3 uf 2022-06-25 16:16:53 -04:00
DanMB
7eac936431 Merge remote-tracking branch 'origin/Development' into Development 2022-06-25 16:00:53 -04:00
DanMB
588b261d52 df 2022-06-25 16:00:48 -04:00
DanMB
daf2cf02b3 d 2022-06-25 15:59:40 -04:00
cyberpwn
b9d97f2434 Goes faster 2022-06-25 15:47:34 -04:00
Vatuu
1467dc963d Changed the default download branch to be in line with GHs new standard. 2022-06-21 19:05:01 +02:00
Vatuu
89bf687fc4 Fixed some wrong descriptions. 2022-06-21 18:58:01 +02:00
Vatuu
2e7c80562b Added MIN_STILT, CENTER_STILT and derivatives.
Made stilt override use a palette.
Added yMax and yRand.
Consolidated stilt settings into a object.
2022-06-21 18:57:33 +02:00
Brian Fopiano
5d54b82be0 Spigot Watchdog Fixed 2022-06-20 17:42:10 -07:00
Brian Fopiano
2ae1df4d42 V+ 2022-06-17 09:57:07 -07:00
Brian Fopiano
26782e6f0c Paper shit up 2022-06-16 00:15:35 -07:00
Vatuu
cc84d5b562 Fixed noiseOverlay. 2022-06-12 10:39:41 +02:00
Vatuu
8bb1efdca3 Merge remote-tracking branch 'origin/Development' into Development 2022-06-12 08:11:14 +02:00
Vatuu
7a5794c8e2 Fixed MIN_HEIGHT. 2022-06-12 08:11:02 +02:00
Vatuu
9dd20661f5 Added stilt override. 2022-06-12 08:10:07 +02:00
Brian Fopiano
ad0ab66711 Merge remote-tracking branch 'origin/Development' into Development 2022-06-11 15:58:11 -07:00
Brian Fopiano
82396b5145 eew 2022-06-11 15:58:07 -07:00
Vatuu
246e974dc1 Fixed FAST_MIN_HEIGHT being messed up. 2022-06-10 17:43:14 +02:00
Vatuu
203b6a4b4f Fixed loading bar not having the coloured pulse effect. 2022-06-10 15:12:56 +02:00
Vatuu
f204f3a209 It works! 2022-06-10 11:35:03 +02:00
Vatuu
ba8e060370 It """works""". 2022-06-09 22:09:32 +02:00
Vatuu
c51172acbc Updated kyori. 2022-06-09 12:51:33 +02:00
Brian Fopiano
39100a5011 Port WIP 2022-06-08 14:46:18 -07:00
DanMB
fcee61a703 fg 2022-06-04 23:32:01 -07:00
DanMB
ce8cc2cf37 Allow paper multicore to call without locking 2022-06-04 22:19:36 -07:00
DanMB
3b5bdcfb51 Merge remote-tracking branch 'origin/master' 2022-06-04 21:50:27 -07:00
DanMB
4d67e97973 Revert "Revert "No cng thing ""
This reverts commit da09f4d6d8.
2022-06-04 21:50:24 -07:00
DanMB
da09f4d6d8 Revert "No cng thing "
This reverts commit dbc7e2e0bf.
2022-06-04 21:49:21 -07:00
DanMB
dbc7e2e0bf No cng thing 2022-06-04 21:48:37 -07:00
DanMB
dd804b6665 It compiles 2022-06-04 21:42:15 -07:00
DanMB
33eb878834 Test imp 1 2022-06-04 21:08:49 -07:00
DanMB
2a2c456011 More prec 2022-06-04 21:06:38 -07:00
DanMB
05a12f3899 Bench 2022-06-04 21:04:37 -07:00
DanMB
eb04710f71 Merge remote-tracking branch 'origin/master' 2022-06-04 20:53:37 -07:00
DanMB
257760453e . 2022-06-04 20:53:28 -07:00
Brian Fopiano
d11baeb08a Merge pull request #800 from VolmitSoftware/Development
V+
2022-06-03 20:23:46 -07:00
Vatuu
47d322c993 V+ 2022-06-04 05:21:55 +02:00
Vatuu
d316207a61 Added tile entity support + mantle. 2022-06-03 06:19:13 +02:00
Vatuu
e6daabbb47 Working on block entity support. 2022-06-02 10:39:28 +02:00
Vatuu
53156449f1 Made the mantle retain object placements. 2022-06-01 20:35:44 +02:00
Brian Fopiano
e3d4c32d03 Merge pull request #796 from VolmitSoftware/Development
**Changelog**

- Fixed a Memory Leak (There might be more, keep reports coming)
 - Fixed Iris wand selections (WE)
 - Added Iris Wand Worldedit compatibility [Make selection using Worldedit, then /Iris object want worldedit (/ir o w we) to then set your selection to a new iris wand]
2022-05-26 18:24:06 -07:00
Vatuu
9cd5c39bbe V+ 2022-05-27 03:17:58 +02:00
Vatuu
a1fbf25465 Please don't break or leak again. 2022-05-27 01:54:21 +02:00
Vatuu
ec74037f05 Added ability to create Iris Wand from WorldEdit selection. 2022-05-26 21:48:46 +02:00
Brian Fopiano
fff650b766 Merge pull request #795 from VolmitSoftware/Development
**Changelog:**
- Fixed Startup spam, Worldheight spam, and Entity ID spam from happening anymore
- Removes Raid Error From Villagers (Persistent raid)
- Minheight, MaxHeight, and STilt are now working as intended
- Fixed generation errors causing Holes in bedrock 
- generic math fixes internally

**This will require a world update to fix the Bedrock problems**
2022-05-21 20:26:19 -07:00
Vatuu
bae2a18e24 V+ 2022-05-22 05:18:13 +02:00
Vatuu
fd8a7ebb4c Properly fixed FAST_MAX_HEIGHT. 2022-05-22 05:08:28 +02:00
Vatuu
4a3a1491d4 Cleanup. 2022-05-22 04:25:39 +02:00
Vatuu
9aa2c5ed8a SPACE 2022-05-22 03:23:20 +02:00
Vatuu
d5699a7472 Totally didn't replace MIN_HEIGHT instead of FAST_MAX_HEIGHT 💀 2022-05-22 03:22:19 +02:00
Vatuu
df98f8f626 Added filter for duplicated entity uuid. 2022-05-22 03:07:46 +02:00
Vatuu
d37b298f07 Fixed bad math for MAX_HEIGHT and FAST_MAX_HEIGHT. 2022-05-22 03:02:50 +02:00
Vatuu
62f7fc17d1 Suppressed persistent raid error. 2022-05-21 18:41:04 +02:00
Brian Fopiano
6e4929246d Merge pull request #794 from VolmitSoftware/master
upstream merge
2022-05-20 19:48:19 -07:00
Vatuu
909461975a Chat filter. 2022-05-21 04:47:12 +02:00
DanMB
dec191e5e7 Web hate space 2022-05-19 16:23:11 -07:00
DanMB
07b0cd6f5a Img2 2022-05-19 16:20:25 -07:00
Brian Fopiano
b7a892ecfe V+
Chonker of an update
2022-05-19 15:44:56 -07:00
Brian Fopiano
79d16102fa Merge pull request #789 from CocoTheOwner/fixDontUse
Replace MV with bukkit
2022-05-19 15:43:35 -07:00
Vatuu
67efdb47aa Custom dimension info on splash. 2022-05-17 20:15:02 +02:00
Vatuu
751c233b49 Merge remote-tracking branch 'origin/Development' into Development 2022-05-17 19:40:53 +02:00
Vatuu
f51734fea0 Fixed fast_min_height? 2022-05-17 19:40:16 +02:00
DanMB
516a7111a7 f 2022-05-16 23:34:58 -07:00
DanMB
1e3ff59b26 Placement options removals 2022-05-16 23:23:42 -07:00
Vatuu
4c48f812d5 Dust of Revealing Pt.3 💀 2022-05-16 21:55:47 +02:00
Vatuu
a63a6f751f Dust of Revealing Pt.2, also Whoops. 2022-05-16 19:40:39 +02:00
Vatuu
923860a90b Version bump. 2022-05-16 18:10:59 +02:00
Vatuu
5a4ca2f907 Fixed stilting with edited data. 2022-05-16 17:49:49 +02:00
Vatuu
ccc2ed0806 Fixed Dust of Revealing Pt.1 2022-05-16 17:33:15 +02:00
Vatuu
44c707e059 Stilting underwater works now. 2022-05-16 16:53:49 +02:00
Vatuu
e7c458de3f Hot reload listener for datapacks and stilts underwater. 2022-05-15 22:10:17 +02:00
Vatuu
11b05b10a4 Removed a single empty line. 2022-05-15 21:28:12 +02:00
Vatuu
d133ac0088 Refactor. 2022-05-15 20:28:11 +02:00
Brian Fopiano
8951fcdebd SHUT THE HELL UP
(no more hotloading error)
2022-05-15 00:13:42 -07:00
Vatuu
ecbd5677ce Merge remote-tracking branch 'origin/Development' into Development 2022-05-15 01:27:07 +02:00
Vatuu
e31b9c1a28 Fixed log error. 2022-05-15 01:26:52 +02:00
Brian Fopiano
faa7b7c742 Object placement height now increased (need to make engine dependent) 2022-05-14 12:07:27 -07:00
Vatuu
d08f326477 Renaming. 2022-05-14 20:31:23 +02:00
Vatuu
6500ed2075 Made third party items work in loot tables. 2022-05-14 20:26:24 +02:00
Vatuu
56eb775a0f Merge remote-tracking branch 'origin/Development' into Development 2022-05-14 19:46:03 +02:00
Vatuu
e225bcfb96 To make brian shut up. 2022-05-14 19:45:44 +02:00
Brian Fopiano
4be6abe416 2032 New MAX height 2022-05-14 10:38:52 -07:00
Vatuu
c3de8b33de Fixed Oraxen, and custom dimension height. 2022-05-14 19:03:18 +02:00
Vatuu
5658d6709c Fixed Oraxen, and custom dimension height. 2022-05-14 18:29:57 +02:00
Vatuu
192538a741 ItemAdder link 2022-05-13 23:25:27 +02:00
Vatuu
b8b9d7bf8c Added external block data registry. 2022-05-12 19:11:02 +02:00
CocoTheOwner
1db8603910 Replace MV with bukkit 2022-05-03 20:11:09 +02:00
Dan
1c5774fca5 Merge pull request #788 from VolmitSoftware/Development
2.0.7-1.18.2
2022-04-30 13:55:49 -07:00
DanMB
0b332b06b6 V+ 2022-04-30 13:55:18 -07:00
DanMB
0be9b049a3 Fix jigsaw editor 2022-04-30 13:54:42 -07:00
DanMB
6993639cc0 clean 2022-04-30 13:46:17 -07:00
DanMB
74172e3123 Reflective api additions 2022-04-21 10:57:19 -07:00
DanMB
6e1c4f682e abandon ship 2022-04-19 19:10:54 -04:00
DanMB
af0d282a1f Matter loaders 2022-04-19 17:05:16 -04:00
DanMB
09bf15fa05 0.01% faster 2022-04-18 16:31:22 -04:00
DanMB
43f7d95b4c My folder 2022-04-18 14:57:44 -04:00
cyberpwn
8b536b1775 Merge remote-tracking branch 'origin/Development' into Development 2022-04-17 11:53:47 -04:00
cyberpwn
60a7f4bc35 Dumb stuff 2022-04-17 04:11:50 -04:00
Brian Fopiano
0ed0e0c983 Merge pull request #786 from VolmitSoftware/Development
not a word
2022-04-16 01:29:41 -07:00
Brian Fopiano
f4b1ca9f21 not a word 2022-04-16 01:29:22 -07:00
Brian Fopiano
609104cfa8 Merge pull request #785 from VolmitSoftware/Development
Development
2022-04-16 01:23:44 -07:00
Brian Fopiano
935d11b433 V+ 2022-04-16 01:23:15 -07:00
cyberpwn
e9eeb8335d f 2022-04-14 23:58:06 -04:00
cyberpwn
4a2f42437f Mantle deletes 2022-04-14 23:47:25 -04:00
cyberpwn
51b0693c99 fix 2022-04-14 20:43:10 -04:00
cyberpwn
185b366d8d Lots of crap 2022-04-14 20:40:37 -04:00
cyberpwn
a40e533068 Revert "Drop oraxen support "
This reverts commit d315e99b63.
2022-04-14 14:32:49 -07:00
Brian Fopiano
5b3918fcb1 Merge pull request #782 from VolmitSoftware/Development
Development
2022-04-13 16:49:22 -07:00
cyberpwn
d315e99b63 Drop oraxen support 2022-04-13 19:17:25 -04:00
cyberpwn
8090ba0259 Fix object placement 2022-04-13 19:11:31 -04:00
cyberpwn
584400d011 Revert "This is to prevent warnings for weird objects, (revert)"
This reverts commit 124ad23a95.
2022-04-13 18:50:08 -04:00
cyberpwn
124ad23a95 This is to prevent warnings for weird objects, (revert) 2022-04-13 18:47:31 -04:00
cyberpwn
6b59aa38ae Allow terrain to use the world height 2022-04-13 18:46:19 -04:00
Brian Fopiano
03554eb372 Merge pull request #778 from VolmitSoftware/Development
Development
2022-04-03 01:41:16 -07:00
Brian Fopiano
dabfe41f29 Merge branch 'master' into Development 2022-04-03 01:40:24 -07:00
Brian Fopiano
6e2c6fc51e V+ 2022-04-03 01:36:31 -07:00
Brian Fopiano
d81986bcc5 255 & no more flying objects
lol why does this happen
2022-04-03 01:34:43 -07:00
Brian Fopiano
ea17e916b8 Gradle updates 2022-04-02 14:14:59 -07:00
Brian Fopiano
ce56224038 Merge pull request #777 from Vatuu/Development
Fixed MythicMobs api change
2022-04-02 13:11:13 -07:00
Vatuu
9978932391 Fixed MythicMobs api change 2022-04-02 22:03:27 +02:00
Brian Fopiano
2ebc9e0deb V+
2.0.3-1.18.2
2022-03-27 18:06:00 -07:00
Brian Fopiano
7ddc621009 Merge pull request #769 from VolmitSoftware/Development
Updated PAPI Support
Temp Disabled Oraxen Support
Temp Disabled Ascync Tp
updated NMS (Colors and binds etc...)
Fixed my registry oopsie (thx Vatuu)
removed Debug Prints
/iris Height works now
Colors Fixed
2022-03-27 13:51:27 -07:00
cyberpwn
aa4e574eef Fix 1.18.2 Biomes 2022-03-27 14:42:13 -04:00
Brian Fopiano
15bc964fcc Ascync tp is disabled for now
Ascync TP is done in 1.18 already, and this is just a dirty fix to stop crashing/ lol
2022-03-18 16:05:38 -07:00
Brian Fopiano
99713ac964 Need to be version specific now 2022-03-18 15:18:35 -07:00
Brian Fopiano
f9a6bd1343 Readding Oraxen Link for Texting 2022-03-17 14:52:40 -07:00
Brian Fopiano
f4bee872e1 Merge pull request #768 from Vatuu/Development
Fixes
2022-03-17 14:49:13 -07:00
Vatuu
be99b286b3 Fixed Brian's mistake. 2022-03-17 22:43:59 +01:00
Brian Fopiano
c7d5212f82 Oraxen link, and NMS WORKING, but not working
Jar loads, Color Borked, ill look at it tomorrow
2022-03-17 00:46:42 -07:00
Brian Fopiano
75726b3d34 Updating PAPI 2022-03-17 00:37:03 -07:00
Brian Fopiano
8d7e76ed81 Attempting to update NMS
(Part 1 of ...)
2022-03-17 00:36:49 -07:00
Brian Fopiano
01b08b2297 Revert "Partial For Vatuu to look at NMS"
This reverts commit cf51581ac1.
2022-03-16 19:38:17 -07:00
Brian Fopiano
cf51581ac1 Partial For Vatuu to look at NMS 2022-03-16 19:31:43 -07:00
Brian Fopiano
d99fd56995 Debug/height fixed/removed
Small fixes.
2022-03-15 22:18:22 -07:00
Vatuu
d149051c27 Fixed wrong description for /iris height. 2022-03-14 18:22:04 +01:00
Vatuu
660aaa87ca Removed debug printout. 2022-03-14 18:20:04 +01:00
DanMB
4010f03b05 ff 2022-03-14 09:52:23 -07:00
DanMB
e2d2dcf337 f 2022-03-14 09:47:57 -07:00
DanMB
b11aaf3f0c Desperate times 2022-03-14 09:27:50 -07:00
DanMB
30ae065cb4 Drop 255 hardcode checks 2022-03-14 09:26:31 -07:00
149 changed files with 4399 additions and 934 deletions

View File

@@ -39,6 +39,7 @@ body:
- 1.17
- 1.17.1
- 1.18
- 1.19
validations:
required: true
- type: input

4
.gitignore vendored
View File

@@ -6,3 +6,7 @@ build/
.idea/
.DS_Store
collection/
src/main/java/com/volmit/iris/util/uniques/

View File

@@ -24,11 +24,10 @@ plugins {
id "de.undercouch.download" version "5.0.1"
}
group 'com.volmit.iris'
version '2.0.2-1.18.X'
def nmsVersion = "1.18.1"
def apiVersion = '1.18'
def spigotJarVersion = '1.18.1-R0.1-SNAPSHOT'
version '2.2.11-1.19.2' // Needs to be version specific
def nmsVersion = "1.19.2"
def apiVersion = '1.19'
def spigotJarVersion = '1.19.1-R0.1-SNAPSHOT'
def name = getRootProject().getName() // Defined in settings.gradle
def main = 'com.volmit.iris.Iris'
@@ -39,9 +38,9 @@ registerCustomOutputTask('Psycho', 'D://Dan/MinecraftDevelopment/server/plugins'
registerCustomOutputTask('ArcaneArts', 'C://Users/arcane/Documents/development/server/plugins')
registerCustomOutputTask('Coco', 'D://Documents/MC/plugins')
registerCustomOutputTask('Strange', 'D://Servers/1.17 Test Server/plugins')
registerCustomOutputTask('Vatuu', 'D://Minecraft/Servers/1.18.1/plugins')
registerCustomOutputTask('Vatuu', 'D://Minecraft/Servers/1.19.2/plugins')
// ========================== UNIX ==============================
registerCustomOutputTaskUnix('CyberpwnLT', '/Users/danielmills/Documents/development/server/plugins')
registerCustomOutputTaskUnix('CyberpwnLT', '/Users/danielmills/development/server/plugins')
registerCustomOutputTaskUnix('PsychoLT', '/Users/brianfopiano/Desktop/REMOTES/RemoteMinecraft/plugins')
// ==============================================================
@@ -75,8 +74,10 @@ repositories {
}
}
maven { url "https://dl.cloudsmith.io/public/arcane/archive/maven/" }
maven { url "https://maven.enginehub.org/repo/" }
mavenCentral()
mavenLocal()
maven { url "https://jitpack.io"}
}
/**
@@ -121,31 +122,32 @@ configurations.all {
*/
dependencies {
// Provided or Classpath
compileOnly 'org.projectlombok:lombok:1.18.22'
annotationProcessor 'org.projectlombok:lombok:1.18.22'
implementation 'org.spigotmc:spigot-api:1.18.1-R0.1-SNAPSHOT'
implementation 'me.clip:placeholderapi:2.10.10'
compileOnly 'org.projectlombok:lombok:1.18.24'
annotationProcessor 'org.projectlombok:lombok:1.18.24'
implementation 'org.spigotmc:spigot-api:1.19.1-R0.1-SNAPSHOT'
implementation 'me.clip:placeholderapi:2.11.1'
implementation 'io.th0rgal:oraxen:1.94.0'
implementation 'org.bukkit:craftbukkit:1.18.1-R0.1-SNAPSHOT:remapped-mojang'
implementation 'org.bukkit:craftbukkit:1.19.2-R0.1-SNAPSHOT:remapped-mojang'
implementation 'com.github.LoneDev6:api-itemsadder:3.1.0b'
// Shaded
implementation 'com.dfsek:Paralithic:0.4.0'
implementation 'io.papermc:paperlib:1.0.5'
implementation "net.kyori:adventure-text-minimessage:4.2.0-SNAPSHOT"
implementation 'net.kyori:adventure-platform-bukkit:4.0.1' // Dont upgrade yet
implementation 'net.kyori:adventure-api:4.9.3' // Dont upgrade yet
implementation "net.kyori:adventure-text-minimessage:4.11.0"
implementation 'net.kyori:adventure-platform-bukkit:4.1.0'
implementation 'net.kyori:adventure-api:4.11.0'
// Dynamically Loaded
implementation 'io.timeandspace:smoothie-map:2.0.2'
implementation 'it.unimi.dsi:fastutil:8.5.6'
implementation 'it.unimi.dsi:fastutil:8.5.8'
implementation 'com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:1.4.2'
implementation 'org.zeroturnaround:zt-zip:1.14'
implementation 'com.google.code.gson:gson:2.8.9'
implementation 'com.google.code.gson:gson:2.9.0'
implementation 'org.ow2.asm:asm:9.2'
implementation 'com.google.guava:guava:31.0.1-jre'
implementation 'com.google.guava:guava:31.1-jre'
implementation 'bsf:bsf:2.4.0'
implementation 'rhino:js:1.7R2'
implementation 'com.github.ben-manes.caffeine:caffeine:3.0.5'
implementation 'com.github.ben-manes.caffeine:caffeine:3.0.6'
implementation 'org.apache.commons:commons-lang3:3.12.0'
}
@@ -265,6 +267,10 @@ task specialSourceRemap(type: JavaExec)
tasks.compileJava.dependsOn(executeBuildTools)
compileJava {
options.encoding = "UTF-8"
}
task setup()
{
group("iris")

View File

@@ -18,17 +18,18 @@
package com.volmit.iris;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import com.google.gson.JsonParser;
import com.volmit.iris.core.IrisSettings;
import com.volmit.iris.core.ServerConfigurator;
import com.volmit.iris.core.link.IrisPapiExpansion;
import com.volmit.iris.core.link.MultiverseCoreLink;
import com.volmit.iris.core.link.MythicMobsLink;
import com.volmit.iris.core.link.OraxenLink;
import com.volmit.iris.core.link.*;
import com.volmit.iris.core.loader.IrisData;
import com.volmit.iris.core.nms.INMS;
import com.volmit.iris.core.pregenerator.LazyPregenerator;
import com.volmit.iris.core.service.StudioSVC;
import com.volmit.iris.core.tools.IrisToolbelt;
import com.volmit.iris.engine.EnginePanic;
import com.volmit.iris.engine.object.IrisBiome;
import com.volmit.iris.engine.object.IrisCompat;
import com.volmit.iris.engine.object.IrisDimension;
import com.volmit.iris.engine.object.IrisWorld;
@@ -40,10 +41,7 @@ import com.volmit.iris.util.exceptions.IrisException;
import com.volmit.iris.util.format.C;
import com.volmit.iris.util.format.Form;
import com.volmit.iris.util.function.NastyRunnable;
import com.volmit.iris.util.io.FileWatcher;
import com.volmit.iris.util.io.IO;
import com.volmit.iris.util.io.InstanceState;
import com.volmit.iris.util.io.JarScanner;
import com.volmit.iris.util.io.*;
import com.volmit.iris.util.math.M;
import com.volmit.iris.util.math.RNG;
import com.volmit.iris.util.parallel.MultiBurst;
@@ -63,9 +61,9 @@ import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.WorldCreator;
import org.bukkit.block.data.BlockData;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
@@ -79,23 +77,23 @@ import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.*;
import java.lang.annotation.Annotation;
import java.net.URL;
import java.util.Date;
import java.util.Map;
import java.util.Objects;
@SuppressWarnings("CanBeFinal")
public class Iris extends VolmitPlugin implements Listener {
public static final String OVERWORLD_TAG = "2086";
private static final Queue<Runnable> syncJobs = new ShurikenQueue<>();
public static Iris instance;
public static BukkitAudiences audiences;
public static MultiverseCoreLink linkMultiverseCore;
public static OraxenLink linkOraxen;
public static MythicMobsLink linkMythicMobs;
public static IrisCompat compat;
public static FileWatcher configWatcher;
@@ -189,7 +187,6 @@ public class Iris extends VolmitPlugin implements Listener {
}
}
}
public static File getCached(String name, String url) {
String h = IO.hash(name + "@" + url);
File f = Iris.instance.getDataFile("cache", h.substring(0, 2), h.substring(3, 5), h);
@@ -253,12 +250,12 @@ public class Iris extends VolmitPlugin implements Listener {
return f;
}
public static void warn(String string) {
msg(C.YELLOW + string);
public static void warn(String format, Object... objs) {
msg(C.YELLOW + String.format(format, objs));
}
public static void error(String string) {
msg(C.RED + string);
public static void error(String format, Object... objs) {
msg(C.RED + String.format(format, objs));
}
public static void debug(String string) {
@@ -390,6 +387,8 @@ public class Iris extends VolmitPlugin implements Listener {
}
private void enable() {
IrisToolbelt.retainMantleDataForSlice(String.class.getCanonicalName());
IrisToolbelt.retainMantleDataForSlice(BlockData.class.getCanonicalName());
instance = this;
services = new KMap<>();
initialize("com.volmit.iris.core.service").forEach((i) -> services.put((Class<? extends IrisService>) i.getClass(), (IrisService) i));
@@ -401,7 +400,6 @@ public class Iris extends VolmitPlugin implements Listener {
instance = this;
compat = IrisCompat.configured(getDataFile("compat.json"));
linkMultiverseCore = new MultiverseCoreLink();
linkOraxen = new OraxenLink();
linkMythicMobs = new MythicMobsLink();
configWatcher = new FileWatcher(getDataFile("settings.json"));
services.values().forEach(IrisService::onEnable);
@@ -409,6 +407,7 @@ public class Iris extends VolmitPlugin implements Listener {
J.s(() -> {
J.a(() -> PaperLib.suggestPaper(this));
J.a(() -> IO.delete(getTemp()));
J.a(LazyPregenerator::loadLazyGenerators, 100);
J.a(this::bstats);
J.ar(this::checkConfigHotload, 60);
J.sr(this::tickQueue, 0);
@@ -686,17 +685,51 @@ public class Iris extends VolmitPlugin implements Listener {
String padd2 = Form.repeat(" ", 4);
String[] info = {"", "", "", "", "", padd2 + C.IRIS + " Iris", padd2 + C.GRAY + " by " + "<rainbow>Volmit Software", padd2 + C.GRAY + " v" + C.IRIS + getDescription().getVersion(),
};
String[] splash = {padd + C.GRAY + " @@@@@@@@@@@@@@" + C.DARK_GRAY + "@@@", padd + C.GRAY + " @@&&&&&&&&&" + C.DARK_GRAY + "&&&&&&" + C.IRIS + " .(((()))). ", padd + C.GRAY + "@@@&&&&&&&&" + C.DARK_GRAY + "&&&&&" + C.IRIS + " .((((((())))))). ", padd + C.GRAY + "@@@&&&&&" + C.DARK_GRAY + "&&&&&&&" + C.IRIS + " ((((((((())))))))) " + C.GRAY + " @", padd + C.GRAY + "@@@&&&&" + C.DARK_GRAY + "@@@@@&" + C.IRIS + " ((((((((-))))))))) " + C.GRAY + " @@", padd + C.GRAY + "@@@&&" + C.IRIS + " ((((((({ })))))))) " + C.GRAY + " &&@@@", padd + C.GRAY + "@@" + C.IRIS + " ((((((((-))))))))) " + C.DARK_GRAY + "&@@@@@" + C.GRAY + "&&&&@@@", padd + C.GRAY + "@" + C.IRIS + " ((((((((())))))))) " + C.DARK_GRAY + "&&&&&" + C.GRAY + "&&&&&&&@@@", padd + C.GRAY + "" + C.IRIS + " '((((((()))))))' " + C.DARK_GRAY + "&&&&&" + C.GRAY + "&&&&&&&&@@@", padd + C.GRAY + "" + C.IRIS + " '(((())))' " + C.DARK_GRAY + "&&&&&&&&" + C.GRAY + "&&&&&&&@@", padd + C.GRAY + " " + C.DARK_GRAY + "@@@" + C.GRAY + "@@@@@@@@@@@@@@"
String[] splash = {
padd + C.GRAY + " @@@@@@@@@@@@@@" + C.DARK_GRAY + "@@@",
padd + C.GRAY + " @@&&&&&&&&&" + C.DARK_GRAY + "&&&&&&" + C.IRIS + " .(((()))). ",
padd + C.GRAY + "@@@&&&&&&&&" + C.DARK_GRAY + "&&&&&" + C.IRIS + " .((((((())))))). ",
padd + C.GRAY + "@@@&&&&&" + C.DARK_GRAY + "&&&&&&&" + C.IRIS + " ((((((((())))))))) " + C.GRAY + " @",
padd + C.GRAY + "@@@&&&&" + C.DARK_GRAY + "@@@@@&" + C.IRIS + " ((((((((-))))))))) " + C.GRAY + " @@",
padd + C.GRAY + "@@@&&" + C.IRIS + " ((((((({ })))))))) " + C.GRAY + " &&@@@",
padd + C.GRAY + "@@" + C.IRIS + " ((((((((-))))))))) " + C.DARK_GRAY + "&@@@@@" + C.GRAY + "&&&&@@@",
padd + C.GRAY + "@" + C.IRIS + " ((((((((())))))))) " + C.DARK_GRAY + "&&&&&" + C.GRAY + "&&&&&&&@@@",
padd + C.GRAY + "" + C.IRIS + " '((((((()))))))' " + C.DARK_GRAY + "&&&&&" + C.GRAY + "&&&&&&&&@@@",
padd + C.GRAY + "" + C.IRIS + " '(((())))' " + C.DARK_GRAY + "&&&&&&&&" + C.GRAY + "&&&&&&&@@",
padd + C.GRAY + " " + C.DARK_GRAY + "@@@" + C.GRAY + "@@@@@@@@@@@@@@"
};
//@done
Iris.info("Server type & version: " + Bukkit.getVersion());
Iris.info("Bukkit version: " + Bukkit.getBukkitVersion());
Iris.info("Java version: " + getJavaVersion());
Iris.info("Custom Biomes: " + INMS.get().countCustomBiomes());
printPacks();
for(int i = 0; i < info.length; i++) {
splash[i] += info[i];
}
Iris.info("\n\n " + new KList<>(splash).toString("\n") + "\n");
}
private void printPacks() {
File packFolder = Iris.service(StudioSVC.class).getWorkspaceFolder();
File[] packs = packFolder.listFiles(File::isDirectory);
if(packs == null || packs.length == 0)
return;
Iris.info("Custom Dimensions: " + packs.length);
for(File f : packs)
printPack(f);
}
private void printPack(File pack) {
String dimName = pack.getName();
String version = "???";
try(FileReader r = new FileReader(new File(pack, "dimensions/" + dimName + ".json"))) {
JsonObject json = JsonParser.parseReader(r).getAsJsonObject();
if(json.has("version"))
version = json.get("version").getAsString();
} catch(IOException | JsonParseException ignored) { }
Iris.info(" " + dimName + " v" + version);
}
}

View File

@@ -32,7 +32,7 @@ import java.io.IOException;
@SuppressWarnings("SynchronizeOnNonFinalField")
@Data
public class IrisSettings {
public static transient IrisSettings settings;
public static IrisSettings settings;
private IrisSettingsGeneral general = new IrisSettingsGeneral();
private IrisSettingsWorld world = new IrisSettingsWorld();
private IrisSettingsGUI gui = new IrisSettingsGUI();
@@ -74,6 +74,7 @@ public class IrisSettings {
public double targetSpawnEntitiesPerChunk = 0.95;
public boolean markerEntitySpawningSystem = true;
public boolean effectSystem = true;
public boolean worldEditWandCUI = true;
}
@Data

View File

@@ -30,6 +30,7 @@ import com.volmit.iris.util.format.C;
import com.volmit.iris.util.io.IO;
import com.volmit.iris.util.plugin.VolmitSender;
import com.volmit.iris.util.scheduling.J;
import com.volmit.iris.util.scheduling.Queue;
import org.bukkit.Bukkit;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.FileConfiguration;
@@ -38,6 +39,7 @@ import org.bukkit.entity.Player;
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.TimeUnit;
public class ServerConfigurator {
@@ -55,7 +57,7 @@ public class ServerConfigurator {
}
private static void increaseKeepAliveSpigot() throws IOException, InvalidConfigurationException {
File spigotConfig = new File("spigot.yml");
File spigotConfig = new File("config/spigot.yml");
FileConfiguration f = new YamlConfiguration();
f.load(spigotConfig);
long tt = f.getLong("settings.timeout-time");
@@ -69,56 +71,34 @@ public class ServerConfigurator {
}
private static void increasePaperWatchdog() throws IOException, InvalidConfigurationException {
File spigotConfig = new File("paper.yml");
File spigotConfig = new File("config/paper-global.yml");
FileConfiguration f = new YamlConfiguration();
f.load(spigotConfig);
long tt = f.getLong("settings.watchdog.early-warning-delay");
long tt = f.getLong("watchdog.early-warning-delay");
if(tt < TimeUnit.MINUTES.toMillis(3)) {
Iris.warn("Updating paper.yml watchdog early-warning-delay: " + tt + " -> " + TimeUnit.MINUTES.toMillis(3) + " (3 minutes)");
Iris.warn("You can disable this change (autoconfigureServer) in Iris settings, then change back the value.");
f.set("settings.watchdog.early-warning-delay", TimeUnit.MINUTES.toMillis(3));
f.set("watchdog.early-warning-delay", TimeUnit.MINUTES.toMillis(3));
f.save(spigotConfig);
}
}
private static File getDatapacksFolder() {
private static List<File> getDatapacksFolder() {
if(!IrisSettings.get().getGeneral().forceMainWorld.isEmpty()) {
return new File(IrisSettings.get().getGeneral().forceMainWorld + "/datapacks");
return new KList<File>().qadd(new File(IrisSettings.get().getGeneral().forceMainWorld + "/datapacks"));
}
File props = new File("server.properties");
if(props.exists()) {
try {
KList<String> m = new KList<>(IO.readAll(props).split("\\Q\n\\E"));
for(String i : m) {
if(i.trim().startsWith("level-name=")) {
return new File(i.trim().split("\\Q=\\E")[1] + "/datapacks");
}
}
} catch(IOException e) {
Iris.reportError(e);
e.printStackTrace();
}
}
return null;
KList<File> worlds = new KList<>();
Bukkit.getServer().getWorlds().forEach(w -> worlds.add(new File(w.getWorldFolder(), "datapacks")));
return worlds;
}
public static void installDataPacks(boolean fullInstall) {
Iris.info("Checking Data Packs...");
boolean reboot = false;
File packs = new File("plugins/Iris/packs");
File dpacks = getDatapacksFolder();
if(dpacks == null) {
Iris.error("Cannot find the datapacks folder! Please try generating a default world first maybe? Is this a new server?");
return;
}
if(packs.exists()) {
if(packs.exists()) {
for(File i : packs.listFiles()) {
if(i.isDirectory()) {
Iris.verbose("Checking Pack: " + i.getPath());
@@ -135,8 +115,8 @@ public class ServerConfigurator {
}
Iris.verbose(" Checking Dimension " + dim.getLoadFile().getPath());
if(dim.installDataPack(() -> data, dpacks)) {
reboot = true;
for(File dpack : getDatapacksFolder()) {
dim.installDataPack(() -> data, dpack);
}
}
}
@@ -147,19 +127,12 @@ public class ServerConfigurator {
Iris.info("Data Packs Setup!");
if(fullInstall) {
if(fullInstall)
verifyDataPacksPost(IrisSettings.get().getAutoConfiguration().isAutoRestartOnCustomBiomeInstall());
}
}
private static void verifyDataPacksPost(boolean allowRestarting) {
File packs = new File("plugins/Iris/packs");
File dpacks = getDatapacksFolder();
if(dpacks == null) {
Iris.error("Cannot find the datapacks folder! Please try generating a default world first maybe? Is this a new server?");
return;
}
boolean bad = false;
if(packs.exists()) {

View File

@@ -38,10 +38,12 @@ import com.volmit.iris.util.parallel.MultiBurst;
import com.volmit.iris.util.plugin.VolmitSender;
import com.volmit.iris.util.scheduling.J;
import com.volmit.iris.util.scheduling.jobs.QueueJob;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
import org.bukkit.World;
import java.io.File;
import java.io.IOException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
@@ -76,8 +78,6 @@ public class CommandIris implements DecreeExecutor {
return;
}
sender().sendMessage(C.RED + "You should not be using this command to create new worlds. Instead, use /mvc " + name + " NORMAL -g Iris:" + type.getName());
try {
IrisToolbelt.createWorld()
.dimension(type.getLoadKey())
@@ -96,17 +96,54 @@ public class CommandIris implements DecreeExecutor {
sender().sendMessage(C.GREEN + "Successfully created your world!");
}
@Decree(description = "Remove an Iris world", aliases = {"del", "rm"}, sync = true)
public void remove(
@Param(description = "The world to remove")
World world,
@Param(description = "Whether to also remove the folder (if set to false, just does not load the world)", defaultValue = "true")
boolean delete
) {
if (!IrisToolbelt.isIrisWorld(world)) {
sender().sendMessage(C.RED + "This is not an Iris world. Iris worlds: " + String.join(", ", Bukkit.getServer().getWorlds().stream().filter(IrisToolbelt::isIrisWorld).map(World::getName).toList()));
return;
}
sender().sendMessage(C.GREEN + "Removing world: " + world.getName());
try {
if (IrisToolbelt.removeWorld(world)) {
sender().sendMessage(C.GREEN + "Successfully removed " + world.getName() + " from bukkit.yml");
} else {
sender().sendMessage(C.YELLOW + "Looks like the world was already removed from bukkit.yml");
}
} catch (IOException e) {
sender().sendMessage(C.RED + "Failed to save bukkit.yml because of " + e.getMessage());
e.printStackTrace();
}
IrisToolbelt.evacuate(world, "Deleting world");
Bukkit.unloadWorld(world, false);
if (delete && world.getWorldFolder().delete()) {
sender().sendMessage(C.GREEN + "Successfully removed world folder");
} else {
sender().sendMessage(C.RED + "Failed to remove world folder");
}
}
@Decree(description = "Print version information")
public void version() {
sender().sendMessage(C.GREEN + "Iris v" + Iris.instance.getDescription().getVersion() + " by Volmit Software");
}
@Decree(description = "Print version information", origin = DecreeOrigin.PLAYER)
@Decree(description = "Print world height information", origin = DecreeOrigin.PLAYER)
public void height() {
sender().sendMessage(C.GREEN + "" + sender().player().getWorld().getMinHeight() + " to " + sender().player().getWorld().getMaxHeight());
sender().sendMessage(C.GREEN + "Total Height: " + (sender().player().getWorld().getMaxHeight() - sender().player().getWorld().getMinHeight()));
}
@Decree(description = "QOL command to open a overworld studio world.", sync = true)
public void so() {
sender().sendMessage(C.GREEN + "Opening studio for the \"Overworld\" pack (seed: 1337)");
Iris.service(StudioSVC.class).open(sender(), 1337, "overworld");
}
@Decree(description = "Set aura spins")
public void aura(
@Param(description = "The h color value", defaultValue = "-20")
@@ -163,16 +200,20 @@ public class CommandIris implements DecreeExecutor {
public void download(
@Param(name = "pack", description = "The pack to download", defaultValue = "overworld", aliases = "project")
String pack,
@Param(name = "branch", description = "The branch to download from", defaultValue = "master")
@Param(name = "branch", description = "The branch to download from", defaultValue = "main")
String branch,
@Param(name = "trim", description = "Whether or not to download a trimmed version (do not enable when editing)", defaultValue = "false")
boolean trim,
@Param(name = "overwrite", description = "Whether or not to overwrite the pack with the downloaded one", aliases = "force", defaultValue = "false")
boolean overwrite
) {
branch = pack.equals("overworld") ? "stable" : branch;
sender().sendMessage(C.GREEN + "Downloading pack: " + pack + "/" + branch + (trim ? " trimmed" : "") + (overwrite ? " overwriting" : ""));
Iris.service(StudioSVC.class).downloadSearch(sender(), "IrisDimensions/" + pack + "/" + branch, trim, overwrite);
if(pack.equals("overworld")) {
String url = "https://github.com/IrisDimensions/overworld/releases/download/" + Iris.OVERWORLD_TAG + "/overworld.zip";
Iris.service(StudioSVC.class).downloadRelease(sender(), url, trim, overwrite);
} else {
Iris.service(StudioSVC.class).downloadSearch(sender(), "IrisDimensions/" + pack + "/" + branch, trim, overwrite);
}
}
@Decree(description = "Get metrics for your world", aliases = "measure", origin = DecreeOrigin.PLAYER)

View File

@@ -19,6 +19,7 @@
package com.volmit.iris.core.commands;
import com.volmit.iris.Iris;
import com.volmit.iris.core.link.WorldEditLink;
import com.volmit.iris.core.loader.IrisData;
import com.volmit.iris.core.service.ObjectSVC;
import com.volmit.iris.core.service.StudioSVC;
@@ -41,12 +42,7 @@ import com.volmit.iris.util.format.C;
import com.volmit.iris.util.math.Direction;
import com.volmit.iris.util.math.RNG;
import com.volmit.iris.util.scheduling.Queue;
import org.bukkit.ChatColor;
import org.bukkit.HeightMap;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.World;
import org.bukkit.*;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.block.TileState;
@@ -232,7 +228,7 @@ public class CommandObject implements DecreeExecutor {
}
Location[] b = WandSVC.getCuboid(player().getInventory().getItemInMainHand());
Location[] b = WandSVC.getCuboid(player());
Location a1 = b[0].clone();
Location a2 = b[1].clone();
Cuboid cursor = new Cuboid(a1, a2);
@@ -256,10 +252,8 @@ public class CommandObject implements DecreeExecutor {
return;
}
ItemStack wand = player().getInventory().getItemInMainHand();
if(WandSVC.isWand(wand)) {
Location[] g = WandSVC.getCuboid(wand);
if(WandSVC.isHoldingWand(player())) {
Location[] g = WandSVC.getCuboid(player());
if(!here) {
// TODO: WARNING HEIGHT
@@ -281,10 +275,8 @@ public class CommandObject implements DecreeExecutor {
return;
}
ItemStack wand = player().getInventory().getItemInMainHand();
if(WandSVC.isWand(wand)) {
Location[] g = WandSVC.getCuboid(wand);
if(WandSVC.isHoldingIrisWand(player())) {
Location[] g = WandSVC.getCuboid(player());
if(!here) {
// TODO: WARNING HEIGHT
@@ -327,7 +319,11 @@ public class CommandObject implements DecreeExecutor {
Map<Block, BlockData> futureChanges = new HashMap<>();
o = o.scaled(scale, IrisObjectPlacementScaleInterpolator.TRICUBIC);
if(scale != 1)
{
o = o.scaled(scale, IrisObjectPlacementScaleInterpolator.TRICUBIC);
}
o.place(block.getBlockX(), block.getBlockY() + (int) o.getCenter().getY(), block.getBlockZ(), createPlacer(block.getWorld(), futureChanges), placement, new RNG(), null);
Iris.service(ObjectSVC.class).addChanges(futureChanges);
@@ -363,7 +359,7 @@ public class CommandObject implements DecreeExecutor {
@Param(description = "Overwrite existing object files", defaultValue = "false", aliases = "force")
boolean overwrite
) {
IrisObject o = WandSVC.createSchematic(player().getInventory().getItemInMainHand());
IrisObject o = WandSVC.createSchematic(player());
if(o == null) {
sender().sendMessage(C.YELLOW + "You need to hold your wand!");
@@ -397,7 +393,7 @@ public class CommandObject implements DecreeExecutor {
return;
}
Location[] b = WandSVC.getCuboid(player().getInventory().getItemInMainHand());
Location[] b = WandSVC.getCuboid(player());
Location a1 = b[0].clone();
Location a2 = b[1].clone();
Direction d = Direction.closest(player().getLocation().getDirection()).reverse();
@@ -422,6 +418,25 @@ public class CommandObject implements DecreeExecutor {
sender().sendMessage("Reverted " + actualReverts + " pastes!");
}
@Decree(description = "Gets an object wand and grabs the current WorldEdit selection.", aliases = "we", origin = DecreeOrigin.PLAYER, studio = true)
public void we() {
if(!Bukkit.getPluginManager().isPluginEnabled("WorldEdit")) {
sender().sendMessage(C.RED + "You can't get a WorldEdit selection without WorldEdit, you know.");
return;
}
Cuboid locs = WorldEditLink.getSelection(sender().player());
if(locs == null)
{
sender().sendMessage(C.RED + "You don't have a WorldEdit selection in this world.");
return;
}
sender().player().getInventory().addItem(WandSVC.createWand(locs.getLowerNE(), locs.getUpperSW()));
sender().sendMessage(C.GREEN + "A fresh wand with your current WorldEdit selection on it!");
}
@Decree(description = "Get an object wand", sync = true)
public void wand() {
player().getInventory().addItem(WandSVC.createWand());
@@ -436,7 +451,7 @@ public class CommandObject implements DecreeExecutor {
return;
}
Location[] b = WandSVC.getCuboid(player().getInventory().getItemInMainHand());
Location[] b = WandSVC.getCuboid(player());
Location a1 = b[0].clone();
Location a2 = b[1].clone();
Location a1x = b[0].clone();
@@ -483,7 +498,7 @@ public class CommandObject implements DecreeExecutor {
return;
}
Location[] b = WandSVC.getCuboid(player().getInventory().getItemInMainHand());
Location[] b = WandSVC.getCuboid(player());
b[0].add(new Vector(0, 1, 0));
b[1].add(new Vector(0, 1, 0));
Location a1 = b[0].clone();

View File

@@ -65,7 +65,7 @@ public class CommandWhat implements DecreeExecutor {
@Decree(description = "What biome am i in?", origin = DecreeOrigin.PLAYER)
public void biome() {
try {
IrisBiome b = engine().getBiome(player().getLocation().getBlockX(), player().getLocation().getBlockY(), player().getLocation().getBlockZ());
IrisBiome b = engine().getBiome(player().getLocation().getBlockX(), player().getLocation().getBlockY() - player().getWorld().getMinHeight(), player().getLocation().getBlockZ());
sender().sendMessage("IBiome: " + b.getLoadKey() + " (" + b.getDerivative().name() + ")");
} catch(Throwable e) {

View File

@@ -36,12 +36,11 @@ public class BlockSignal {
public BlockSignal(Block block, int ticks) {
active.incrementAndGet();
Location tg = block.getLocation().clone().add(0.5, 0, 0.5).clone();
FallingBlock e = block.getWorld().spawnFallingBlock(tg.clone(), block.getBlockData());
Location tg = block.getLocation().clone().add(0.5, 0, 0.5);
FallingBlock e = block.getWorld().spawnFallingBlock(tg, block.getBlockData());
e.setGravity(false);
e.setInvulnerable(true);
e.setGlowing(true);
e.teleport(tg.clone());
e.setDropItem(false);
e.setHurtEntities(false);
e.setSilent(true);

View File

@@ -49,7 +49,7 @@ public class DustRevealer {
this.hits = hits;
J.s(() -> {
new BlockSignal(world.getBlockAt(block.getX(), block.getY(), block.getZ()), 7);
new BlockSignal(world.getBlockAt(block.getX(), block.getY(), block.getZ()), 10);
if(M.r(0.25)) {
world.playSound(block.toBlock(world).getLocation(), Sound.BLOCK_AMETHYST_BLOCK_CHIME, 1f, RNG.r.f(0.2f, 2f));
}
@@ -98,8 +98,7 @@ public class DustRevealer {
Engine access = IrisToolbelt.access(world).getEngine();
if(access != null) {
String a = access.getObjectPlacementKey(block.getX(), block.getY(), block.getZ());
String a = access.getObjectPlacementKey(block.getX(), block.getY() - block.getWorld().getMinHeight(), block.getZ());
if(a != null) {
world.playSound(block.getLocation(), Sound.ITEM_LODESTONE_COMPASS_LOCK, 1f, 0.1f);
@@ -112,7 +111,8 @@ public class DustRevealer {
}
private boolean is(BlockPosition a) {
if(isValidTry(a) && engine.getObjectPlacementKey(a.getX(), a.getY(), a.getZ()) != null && engine.getObjectPlacementKey(a.getX(), a.getY(), a.getZ()).equals(key)) {
int betterY = a.getY() - world.getMinHeight();
if(isValidTry(a) && engine.getObjectPlacementKey(a.getX(), betterY, a.getZ()) != null && engine.getObjectPlacementKey(a.getX(), betterY, a.getZ()).equals(key)) {
hits.add(a);
new DustRevealer(engine, world, a, key, hits);
return true;

View File

@@ -19,6 +19,7 @@
package com.volmit.iris.core.edit;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.volmit.iris.Iris;
import com.volmit.iris.core.service.WandSVC;
import com.volmit.iris.engine.object.IrisDirection;
@@ -26,6 +27,7 @@ import com.volmit.iris.engine.object.IrisJigsawPiece;
import com.volmit.iris.engine.object.IrisJigsawPieceConnector;
import com.volmit.iris.engine.object.IrisObject;
import com.volmit.iris.engine.object.IrisPosition;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.collection.KMap;
import com.volmit.iris.util.data.Cuboid;
import com.volmit.iris.util.io.IO;
@@ -47,6 +49,7 @@ import org.bukkit.util.Vector;
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.ExecutionException;
public class JigsawEditor implements Listener {
@@ -68,6 +71,10 @@ public class JigsawEditor implements Listener {
}
editors.put(player, this);
if(object == null)
{
throw new RuntimeException("Object is null! " + piece.getObject());
}
this.object = object;
this.player = player;
origin = player.getLocation().clone().add(0, 7, 0);
@@ -77,7 +84,7 @@ public class JigsawEditor implements Listener {
this.piece.setObject(object.getLoadKey());
cuboid = new Cuboid(origin.clone(), origin.clone().add(object.getW() - 1, object.getH() - 1, object.getD() - 1));
ticker = J.sr(this::onTick, 0);
object.placeCenterY(origin);
J.s(() -> object.placeCenterY(origin));
Iris.instance.registerListener(this);
}
@@ -150,10 +157,50 @@ public class JigsawEditor implements Listener {
}
}
private void removeKey(JSONObject o, String... path)
{
if(path.length == 1)
{
o.remove(path[0]);
return;
}
List<String> s = new java.util.ArrayList<>(List.of(path));
s.remove(0);
removeKey(o.getJSONObject(path[0]), s.toArray(new String[0]));
}
private List<JSONObject> getObjectsInArray(JSONObject a, String key)
{
KList<JSONObject> o = new KList<>();
for(int i = 0; i < a.getJSONArray(key).length(); i++)
{
o.add(a.getJSONArray(key).getJSONObject(i));
}
return o;
}
public void close() {
exit();
try {
IO.writeAll(targetSaveLocation, new JSONObject(new Gson().toJson(piece)).toString(4));
JSONObject j = new JSONObject(new Gson().toJson(piece));
// Remove sub-key
removeKey(j, "placementOptions", "translateCenter"); // should work
J.attempt(() -> j.getJSONObject("placementOptions").remove("translateCenter")); // otherwise
// remove root key
removeKey(j, "placementOptions"); // should work
j.remove("placementOptions"); // otherwise
// Remove key in all objects in array
for(JSONObject i : getObjectsInArray(j, "connectors"))
{
removeKey(i, "rotateConnector");
}
IO.writeAll(targetSaveLocation, j.toString(4));
} catch(IOException e) {
Iris.reportError(e);
e.printStackTrace();

View File

@@ -148,7 +148,7 @@ public class NoiseExplorerGUI extends JPanel implements MouseWheelListener, List
JFrame frame = new JFrame("Noise Explorer");
NoiseExplorerGUI nv = new NoiseExplorerGUI();
frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
KList<String> li = new KList<>(NoiseStyle.values()).toStringList();
KList<String> li = new KList<>(NoiseStyle.values()).toStringList().sort();
combo = new JComboBox<>(li.toArray(new String[0]));
combo.setSelectedItem("STATIC");
combo.setFocusable(false);

View File

@@ -83,7 +83,6 @@ public class PregeneratorJob implements PregenListener {
this.pregenerator = new IrisPregenerator(task, method, this);
max = new Position2(0, 0);
min = new Position2(0, 0);
KList<Runnable> draw = new KList<>();
task.iterateRegions((xx, zz) -> {
min.setX(Math.min(xx << 5, min.getX()));
min.setZ(Math.min(zz << 5, min.getZ()));

View File

@@ -0,0 +1,36 @@
package com.volmit.iris.core.link;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.bukkit.Bukkit;
import org.bukkit.NamespacedKey;
import org.bukkit.block.data.BlockData;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin;
import java.util.MissingResourceException;
@RequiredArgsConstructor
public abstract class ExternalDataProvider {
@Getter
private final String pluginId;
public Plugin getPlugin() {
return Bukkit.getPluginManager().getPlugin(pluginId);
}
public boolean isPresent() {
return getPlugin() != null;
}
public abstract void init();
public abstract BlockData getBlockData(NamespacedKey blockId) throws MissingResourceException;
public abstract ItemStack getItemStack(NamespacedKey itemId) throws MissingResourceException;
public abstract NamespacedKey[] getBlockTypes();
public abstract boolean isValidProvider(NamespacedKey namespace);
}

View File

@@ -20,6 +20,7 @@ package com.volmit.iris.core.link;
import com.volmit.iris.Iris;
import com.volmit.iris.core.tools.IrisToolbelt;
import com.volmit.iris.engine.object.IrisBiome;
import com.volmit.iris.engine.platform.PlatformChunkGenerator;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import org.bukkit.Location;
@@ -59,15 +60,15 @@ public class IrisPapiExpansion extends PlaceholderExpansion {
if(p.equalsIgnoreCase("biome_name")) {
if(a != null) {
return a.getEngine().getBiome(l).getName();
return getBiome(a, l).getName();
}
} else if(p.equalsIgnoreCase("biome_id")) {
if(a != null) {
return a.getEngine().getBiome(l).getLoadKey();
return getBiome(a, l).getLoadKey();
}
} else if(p.equalsIgnoreCase("biome_file")) {
if(a != null) {
return a.getEngine().getBiome(l).getLoadFile().getPath();
return getBiome(a, l).getLoadFile().getPath();
}
} else if(p.equalsIgnoreCase("region_name")) {
if(a != null) {
@@ -107,4 +108,8 @@ public class IrisPapiExpansion extends PlaceholderExpansion {
return null;
}
private IrisBiome getBiome(PlatformChunkGenerator a, Location l) {
return a.getEngine().getBiome(l.getBlockX(), l.getBlockY() - l.getWorld().getMinHeight(), l.getBlockZ());
}
}

View File

@@ -0,0 +1,51 @@
package com.volmit.iris.core.link;
import com.volmit.iris.util.collection.KList;
import dev.lone.itemsadder.api.CustomBlock;
import dev.lone.itemsadder.api.CustomStack;
import dev.lone.itemsadder.api.ItemsAdder;
import org.bukkit.NamespacedKey;
import org.bukkit.block.data.BlockData;
import org.bukkit.inventory.ItemStack;
import java.util.MissingResourceException;
public class ItemAdderDataProvider extends ExternalDataProvider {
public ItemAdderDataProvider() {
super("ItemsAdder");
}
@Override
public void init() { }
@Override
public BlockData getBlockData(NamespacedKey blockId) throws MissingResourceException {
return CustomBlock.getBaseBlockData(blockId.toString());
}
@Override
public ItemStack getItemStack(NamespacedKey itemId) throws MissingResourceException {
CustomStack stack = CustomStack.getInstance(itemId.toString());
if(stack == null)
throw new MissingResourceException("Failed to find ItemData!", itemId.getNamespace(), itemId.getKey());
return stack.getItemStack();
}
@Override
public NamespacedKey[] getBlockTypes() {
KList<NamespacedKey> keys = new KList<>();
for(String s : ItemsAdder.getNamespacedBlocksNamesInConfig())
keys.add(NamespacedKey.fromString(s));
return keys.toArray(new NamespacedKey[0]);
}
@Override
public boolean isValidProvider(NamespacedKey blockId) {
for(NamespacedKey k : getBlockTypes())
if(k.equals(blockId)) {
return true;
}
return false;
}
}

View File

@@ -65,7 +65,7 @@ public class MythicMobsLink {
}
try {
Class<?> mythicMobClass = Class.forName("io.lumine.xikage.mythicmobs.MythicMobs");
Class<?> mythicMobClass = Class.forName("io.lumine.mythic.bukkit.MythicBukkit");
Method getInst = mythicMobClass.getDeclaredMethod("inst");
Object inst = getInst.invoke(null);
Method getAPIHelper = mythicMobClass.getDeclaredMethod("getAPIHelper");

View File

@@ -0,0 +1,112 @@
/*
* Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2022 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.volmit.iris.core.link;
import com.volmit.iris.Iris;
import com.volmit.iris.util.collection.KList;
import io.th0rgal.oraxen.items.ItemBuilder;
import io.th0rgal.oraxen.items.OraxenItems;
import io.th0rgal.oraxen.mechanics.MechanicFactory;
import io.th0rgal.oraxen.mechanics.MechanicsManager;
import io.th0rgal.oraxen.mechanics.provided.gameplay.block.BlockMechanic;
import io.th0rgal.oraxen.mechanics.provided.gameplay.block.BlockMechanicFactory;
import io.th0rgal.oraxen.mechanics.provided.gameplay.noteblock.NoteBlockMechanicFactory;
import io.th0rgal.oraxen.utils.Utils;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.MultipleFacing;
import org.bukkit.inventory.ItemStack;
import java.lang.reflect.Field;
import java.util.Map;
import java.util.MissingResourceException;
import java.util.Optional;
public class OraxenDataProvider extends ExternalDataProvider {
private static final String FIELD_FACTORIES_MAP = "FACTORIES_BY_MECHANIC_ID";
private Map<String, MechanicFactory> factories;
public OraxenDataProvider() { super("Oraxen"); }
@Override
public void init() {
try {
Field f = MechanicsManager.class.getDeclaredField(FIELD_FACTORIES_MAP);
f.setAccessible(true);
factories = (Map<String, MechanicFactory>) f.get(null);
} catch(NoSuchFieldException | IllegalAccessException e) {
Iris.error("Failed to set up Oraxen Link:");
Iris.error("\t" + e.getClass().getSimpleName());
}
}
@Override
public BlockData getBlockData(NamespacedKey blockId) throws MissingResourceException {
MechanicFactory f = getFactory(blockId);
if(f instanceof NoteBlockMechanicFactory)
return ((NoteBlockMechanicFactory)f).createNoteBlockData(blockId.getKey());
else if(f instanceof BlockMechanicFactory) {
MultipleFacing newBlockData = (MultipleFacing) Bukkit.createBlockData(Material.MUSHROOM_STEM);
Utils.setBlockFacing(newBlockData, ((BlockMechanic)f.getMechanic(blockId.getKey())).getCustomVariation());
return newBlockData;
} else
throw new MissingResourceException("Failed to find BlockData!", blockId.getNamespace(), blockId.getKey());
}
@Override
public ItemStack getItemStack(NamespacedKey itemId) throws MissingResourceException {
Optional<ItemBuilder> opt = OraxenItems.getOptionalItemById(itemId.getKey());
return opt.orElseThrow(() -> new MissingResourceException("Failed to find ItemData!", itemId.getNamespace(), itemId.getKey())).build();
}
@Override
public NamespacedKey[] getBlockTypes() {
KList<NamespacedKey> names = new KList<>();
for(String name : OraxenItems.getItemNames()) {
try {
NamespacedKey key = new NamespacedKey("oraxen", name);
if(getBlockData(key) != null)
names.add(key);
} catch(MissingResourceException ignored) { }
}
return names.toArray(new NamespacedKey[0]);
}
@Override
public boolean isPresent() {
return super.isPresent() && factories != null;
}
@Override
public boolean isValidProvider(NamespacedKey key) {
return key.getNamespace().equalsIgnoreCase("oraxen");
}
private MechanicFactory getFactory(NamespacedKey key) throws MissingResourceException {
return factories.values().stream()
.filter(i -> i.getItems().contains(key.getKey()))
.findFirst()
.orElseThrow(() -> new MissingResourceException("Failed to find BlockData!", key.getNamespace(), key.getKey()));
}
}

View File

@@ -1,113 +0,0 @@
/*
* Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2022 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.volmit.iris.core.link;
import com.volmit.iris.util.collection.KList;
import io.th0rgal.oraxen.items.OraxenItems;
import io.th0rgal.oraxen.mechanics.Mechanic;
import io.th0rgal.oraxen.mechanics.MechanicFactory;
import io.th0rgal.oraxen.mechanics.MechanicsManager;
import io.th0rgal.oraxen.mechanics.provided.gameplay.block.BlockMechanic;
import io.th0rgal.oraxen.mechanics.provided.gameplay.block.BlockMechanicFactory;
import io.th0rgal.oraxen.mechanics.provided.gameplay.noteblock.NoteBlockMechanicFactory;
import io.th0rgal.oraxen.utils.Utils;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.MultipleFacing;
import org.bukkit.plugin.Plugin;
import java.lang.reflect.Field;
import java.util.Map;
public class OraxenLink {
private static final String[] EMPTY = new String[0];
public boolean supported() {
return getOraxen() != null;
}
public BlockData getBlockDataFor(String id) {
if(!supported()) {
return null;
}
MechanicFactory f = getFactory(id);
if(f == null) {
return null;
}
Mechanic m = f.getMechanic(id);
// TODO: Why isnt there a simple getBlockData() function?
if(m.getFactory() instanceof NoteBlockMechanicFactory) {
return ((NoteBlockMechanicFactory) m.getFactory()).createNoteBlockData(id);
} else if(m.getFactory() instanceof BlockMechanicFactory) {
MultipleFacing newBlockData = (MultipleFacing) Bukkit.createBlockData(Material.MUSHROOM_STEM);
Utils.setBlockFacing(newBlockData, ((BlockMechanic) m).getCustomVariation());
return newBlockData;
}
return null;
}
public MechanicFactory getFactory(String id) {
if(!supported()) {
return null;
}
try {
Field f = MechanicsManager.class.getDeclaredField("FACTORIES_BY_MECHANIC_ID");
f.setAccessible(true);
Map<String, MechanicFactory> map = (Map<String, MechanicFactory>) f.get(null);
for(MechanicFactory i : map.values()) {
if(i.getItems().contains(id)) {
return i;
}
}
} catch(Throwable e) {
e.printStackTrace();
}
return null;
}
public String[] getItemTypes() {
if(!supported()) {
return EMPTY;
}
KList<String> v = new KList<>();
for(String i : OraxenItems.getItemNames()) {
if(getBlockDataFor(i) != null) {
v.add(i);
}
}
return v.toArray(new String[0]);
}
public Plugin getOraxen() {
return Bukkit.getPluginManager().getPlugin("Oraxen");
}
}

View File

@@ -0,0 +1,37 @@
package com.volmit.iris.core.link;
import com.volmit.iris.util.data.Cuboid;
import org.bukkit.World;
import org.bukkit.entity.Player;
public class WorldEditLink {
public static Cuboid getSelection(Player p)
{
try
{
Object instance = Class.forName("com.sk89q.worldedit.WorldEdit").getDeclaredMethod("getInstance").invoke(null);
Object sessionManager = instance.getClass().getDeclaredMethod("getSessionManager").invoke(instance);
Object player = Class.forName("com.sk89q.worldedit.bukkit.BukkitAdapter").getDeclaredMethod("adapt", Player.class).invoke(null, p);
Object localSession = sessionManager.getClass().getDeclaredMethod("getIfPresent", Class.forName("com.sk89q.worldedit.session.SessionOwner")).invoke(sessionManager, player);
Object world = Class.forName("com.sk89q.worldedit.bukkit.BukkitAdapter").getDeclaredMethod("adapt", World.class).invoke(null, p.getWorld());
Object region = localSession.getClass().getDeclaredMethod("getSelection", world.getClass()).invoke(localSession, world);
Object min = region.getClass().getDeclaredMethod("getMinimumPoint").invoke(region);
Object max = region.getClass().getDeclaredMethod("getMaximumPoint").invoke(region);
return new Cuboid(p.getWorld(),
(int)min.getClass().getDeclaredMethod("getX").invoke(min),
(int)min.getClass().getDeclaredMethod("getY").invoke(min),
(int)min.getClass().getDeclaredMethod("getZ").invoke(min),
(int)min.getClass().getDeclaredMethod("getX").invoke(max),
(int)min.getClass().getDeclaredMethod("getY").invoke(max),
(int)min.getClass().getDeclaredMethod("getZ").invoke(max)
);
}
catch(Throwable e)
{
}
return null;
}
}

View File

@@ -31,26 +31,9 @@ import com.google.gson.stream.JsonWriter;
import com.volmit.iris.Iris;
import com.volmit.iris.engine.data.cache.AtomicCache;
import com.volmit.iris.engine.framework.Engine;
import com.volmit.iris.engine.object.IrisBiome;
import com.volmit.iris.engine.object.IrisBlockData;
import com.volmit.iris.engine.object.IrisCave;
import com.volmit.iris.engine.object.IrisDimension;
import com.volmit.iris.engine.object.IrisEntity;
import com.volmit.iris.engine.object.IrisExpression;
import com.volmit.iris.engine.object.IrisGenerator;
import com.volmit.iris.engine.object.IrisImage;
import com.volmit.iris.engine.object.IrisJigsawPiece;
import com.volmit.iris.engine.object.IrisJigsawPool;
import com.volmit.iris.engine.object.IrisJigsawStructure;
import com.volmit.iris.engine.object.IrisLootTable;
import com.volmit.iris.engine.object.IrisMarker;
import com.volmit.iris.engine.object.IrisMod;
import com.volmit.iris.engine.object.IrisObject;
import com.volmit.iris.engine.object.IrisRavine;
import com.volmit.iris.engine.object.IrisRegion;
import com.volmit.iris.engine.object.IrisScript;
import com.volmit.iris.engine.object.IrisSpawner;
import com.volmit.iris.engine.object.*;
import com.volmit.iris.engine.object.annotations.Snippet;
import com.volmit.iris.engine.object.matter.IrisMatterObject;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.collection.KMap;
import com.volmit.iris.util.context.IrisContext;
@@ -87,10 +70,12 @@ public class IrisData implements ExclusionStrategy, TypeAdapterFactory {
private ResourceLoader<IrisBlockData> blockLoader;
private ResourceLoader<IrisExpression> expressionLoader;
private ResourceLoader<IrisObject> objectLoader;
private ResourceLoader<IrisMatterObject> matterLoader;
private ResourceLoader<IrisImage> imageLoader;
private ResourceLoader<IrisScript> scriptLoader;
private ResourceLoader<IrisCave> caveLoader;
private ResourceLoader<IrisRavine> ravineLoader;
private ResourceLoader<IrisMatterObject> matterObjectLoader;
private KMap<String, KList<String>> possibleSnippets;
private Gson gson;
private Gson snippetLoader;
@@ -131,6 +116,9 @@ public class IrisData implements ExclusionStrategy, TypeAdapterFactory {
public static IrisObject loadAnyObject(String key) {
return loadAny(key, (dm) -> dm.getObjectLoader().load(key, false));
}
public static IrisMatterObject loadAnyMatter(String key) {
return loadAny(key, (dm) -> dm.getMatterLoader().load(key, false));
}
public static IrisBiome loadAnyBiome(String key) {
return loadAny(key, (dm) -> dm.getBiomeLoader().load(key, false));
@@ -295,9 +283,12 @@ public class IrisData implements ExclusionStrategy, TypeAdapterFactory {
if(registrant.equals(IrisObject.class)) {
r = (ResourceLoader<T>) new ObjectResourceLoader(dataFolder, this, rr.getFolderName(),
rr.getTypeName());
} else if(registrant.equals(IrisMatterObject.class)) {
r = (ResourceLoader<T>) new MatterObjectResourceLoader(dataFolder, this, rr.getFolderName(),
rr.getTypeName());
} else if(registrant.equals(IrisScript.class)) {
r = (ResourceLoader<T>) new ScriptResourceLoader(dataFolder, this, rr.getFolderName(),
rr.getTypeName());
rr.getTypeName());
} else if(registrant.equals(IrisImage.class)) {
r = (ResourceLoader<T>) new ImageResourceLoader(dataFolder, this, rr.getFolderName(),
rr.getTypeName());
@@ -347,6 +338,7 @@ public class IrisData implements ExclusionStrategy, TypeAdapterFactory {
this.objectLoader = registerLoader(IrisObject.class);
this.imageLoader = registerLoader(IrisImage.class);
this.scriptLoader = registerLoader(IrisScript.class);
this.matterObjectLoader = registerLoader(IrisMatterObject.class);
gson = builder.create();
}

View File

@@ -0,0 +1,146 @@
/*
* Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2022 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.volmit.iris.core.loader;
import com.volmit.iris.Iris;
import com.volmit.iris.core.IrisSettings;
import com.volmit.iris.engine.object.matter.IrisMatterObject;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.collection.KSet;
import com.volmit.iris.util.data.KCache;
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
import java.io.File;
public class MatterObjectResourceLoader extends ResourceLoader<IrisMatterObject> {
public MatterObjectResourceLoader(File root, IrisData idm, String folderName, String resourceTypeName) {
super(root, idm, folderName, resourceTypeName, IrisMatterObject.class);
loadCache = new KCache<>(this::loadRaw, IrisSettings.get().getPerformance().getObjectLoaderCacheSize());
}
public boolean supportsSchemas() {
return false;
}
public long getSize() {
return loadCache.getSize();
}
public long getTotalStorage() {
return getSize();
}
protected IrisMatterObject loadFile(File j, String name) {
try {
PrecisionStopwatch p = PrecisionStopwatch.start();
IrisMatterObject t = IrisMatterObject.from(j);
t.setLoadKey(name);
t.setLoader(manager);
t.setLoadFile(j);
logLoad(j, t);
tlt.addAndGet(p.getMilliseconds());
return t;
} catch(Throwable e) {
Iris.reportError(e);
Iris.warn("Couldn't read " + resourceTypeName + " file: " + j.getPath() + ": " + e.getMessage());
return null;
}
}
public String[] getPossibleKeys() {
if(possibleKeys != null) {
return possibleKeys;
}
Iris.debug("Building " + resourceTypeName + " Possibility Lists");
KSet<String> m = new KSet<>();
for(File i : getFolders()) {
for(File j : i.listFiles()) {
if(j.isFile() && j.getName().endsWith(".mat")) {
m.add(j.getName().replaceAll("\\Q.mat\\E", ""));
} else if(j.isDirectory()) {
for(File k : j.listFiles()) {
if(k.isFile() && k.getName().endsWith(".mat")) {
m.add(j.getName() + "/" + k.getName().replaceAll("\\Q.mat\\E", ""));
} else if(k.isDirectory()) {
for(File l : k.listFiles()) {
if(l.isFile() && l.getName().endsWith(".mat")) {
m.add(j.getName() + "/" + k.getName() + "/" + l.getName().replaceAll("\\Q.mat\\E", ""));
}
}
}
}
}
}
}
KList<String> v = new KList<>(m);
possibleKeys = v.toArray(new String[0]);
return possibleKeys;
}
public File findFile(String name) {
for(File i : getFolders(name)) {
for(File j : i.listFiles()) {
if(j.isFile() && j.getName().endsWith(".mat") && j.getName().split("\\Q.\\E")[0].equals(name)) {
return j;
}
}
File file = new File(i, name + ".mat");
if(file.exists()) {
return file;
}
}
Iris.warn("Couldn't find " + resourceTypeName + ": " + name);
return null;
}
public IrisMatterObject load(String name) {
return load(name, true);
}
private IrisMatterObject loadRaw(String name) {
for(File i : getFolders(name)) {
for(File j : i.listFiles()) {
if(j.isFile() && j.getName().endsWith(".mat") && j.getName().split("\\Q.\\E")[0].equals(name)) {
return loadFile(j, name);
}
}
File file = new File(i, name + ".mat");
if(file.exists()) {
return loadFile(file, name);
}
}
Iris.warn("Couldn't find " + resourceTypeName + ": " + name);
return null;
}
public IrisMatterObject load(String name, boolean warn) {
return loadCache.get(name);
}
}

View File

@@ -20,7 +20,7 @@ package com.volmit.iris.core.nms;
import com.volmit.iris.Iris;
import com.volmit.iris.core.IrisSettings;
import com.volmit.iris.core.nms.v18_1.NMSBinding18_1;
import com.volmit.iris.core.nms.v19_2.NMSBinding19_2;
import com.volmit.iris.core.nms.v1X.NMSBinding1X;
import com.volmit.iris.util.collection.KMap;
import org.bukkit.Bukkit;
@@ -28,7 +28,7 @@ import org.bukkit.Bukkit;
public class INMS {
//@builder
private static final KMap<String, Class<? extends INMSBinding>> bindings = new KMap<String, Class<? extends INMSBinding>>()
.qput("v1_18_R1", NMSBinding18_1.class);
.qput("v1_19_R1", NMSBinding19_2.class);
//@done
private static final INMSBinding binding = bind();

View File

@@ -54,6 +54,7 @@ public interface INMSBinding {
String getTrueBiomeBaseKey(Location location);
Object getCustomBiomeBaseFor(String mckey);
Object getCustomBiomeBaseHolderFor(String mckey);
String getKeyForBiomeBase(Object biomeBase);

View File

@@ -24,6 +24,8 @@ import java.util.ArrayList;
import java.util.List;
public enum NMSVersion {
R1_19_1,
R1_18_2,
R1_18,
R1_17,
R1_16,
@@ -98,6 +100,12 @@ public enum NMSVersion {
if(tryVersion("1_18_R1")) {
return R1_18;
}
if(tryVersion("1_18_R2")) {
return R1_18_2;
}
if(tryVersion("1_19_R1")) {
return R1_19_1;
}
return null;
}

View File

@@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.volmit.iris.core.nms.v18_1;
package com.volmit.iris.core.nms.v19_2;
import com.volmit.iris.Iris;
@@ -36,10 +36,7 @@ import com.volmit.iris.util.nbt.mca.palette.MCAPalettedContainer;
import com.volmit.iris.util.nbt.mca.palette.MCAWrappedPalettedContainer;
import com.volmit.iris.util.nbt.tag.CompoundTag;
import it.unimi.dsi.fastutil.objects.Object2IntMap;
import net.minecraft.core.BlockPos;
import net.minecraft.core.IdMap;
import net.minecraft.core.Registry;
import net.minecraft.core.RegistryAccess;
import net.minecraft.core.*;
import net.minecraft.nbt.NbtIo;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.Block;
@@ -52,9 +49,11 @@ import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Biome;
import org.bukkit.block.data.BlockData;
import org.bukkit.craftbukkit.v1_18_R1.CraftServer;
import org.bukkit.craftbukkit.v1_18_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_18_R1.block.data.CraftBlockData;
import org.bukkit.craftbukkit.v1_19_R1.CraftServer;
import org.bukkit.craftbukkit.v1_19_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_19_R1.block.data.CraftBlockData;
import org.bukkit.entity.Entity;
import org.bukkit.generator.ChunkGenerator;
import org.jetbrains.annotations.NotNull;
@@ -70,7 +69,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
public class NMSBinding18_1 implements INMSBinding {
public class NMSBinding19_2 implements INMSBinding {
private final KMap<Biome, Object> baseBiomeCache = new KMap<>();
private final BlockData AIR = Material.AIR.createBlockData();
@@ -128,8 +127,8 @@ public class NMSBinding18_1 implements INMSBinding {
}
@Override
public void deserializeTile(CompoundTag c, Location newPosition) {
((CraftWorld) newPosition.getWorld()).getHandle().getChunkAt(new BlockPos(newPosition.getBlockX(), 0, newPosition.getBlockZ())).setBlockEntityNbt(convert(c));
public void deserializeTile(CompoundTag c, Location pos) {
((CraftWorld) pos.getWorld()).getHandle().getChunkAt(new BlockPos(pos.getBlockX(), 0, pos.getBlockZ())).setBlockEntityNbt(convert(c));
}
@Override
@@ -148,7 +147,7 @@ public class NMSBinding18_1 implements INMSBinding {
}
private RegistryAccess registry() {
return registryAccess.aquire(() -> (RegistryAccess) getFor(RegistryAccess.class, ((CraftServer) Bukkit.getServer()).getHandle().getServer()));
return registryAccess.aquire(() -> (RegistryAccess) getFor(RegistryAccess.Frozen.class, ((CraftServer) Bukkit.getServer()).getHandle().getServer()));
}
private Registry<net.minecraft.world.level.biome.Biome> getCustomBiomeRegistry() {
@@ -210,6 +209,10 @@ public class NMSBinding18_1 implements INMSBinding {
public Object getCustomBiomeBaseFor(String mckey) {
return getCustomBiomeRegistry().get(new ResourceLocation(mckey));
}
@Override
public Object getCustomBiomeBaseHolderFor(String mckey) {
return getCustomBiomeRegistry().getHolder(getTrueBiomeBaseId(getCustomBiomeRegistry().get(new ResourceLocation(mckey)))).get();
}
@Override
public String getKeyForBiomeBase(Object biomeBase) {
@@ -229,13 +232,13 @@ public class NMSBinding18_1 implements INMSBinding {
return v;
}
//noinspection unchecked
v = org.bukkit.craftbukkit.v1_18_R1.block.CraftBlock.biomeToBiomeBase((Registry<net.minecraft.world.level.biome.Biome>) registry, biome);
v = org.bukkit.craftbukkit.v1_19_R1.block.CraftBlock.biomeToBiomeBase((Registry<net.minecraft.world.level.biome.Biome>) registry, biome);
if(v == null) {
// Ok so there is this new biome name called "CUSTOM" in Paper's new releases.
// But, this does NOT exist within CraftBukkit which makes it return an error.
// So, we will just return the ID that the plains biome returns instead.
//noinspection unchecked
return org.bukkit.craftbukkit.v1_18_R1.block.CraftBlock.biomeToBiomeBase((Registry<net.minecraft.world.level.biome.Biome>) registry, Biome.PLAINS);
return org.bukkit.craftbukkit.v1_19_R1.block.CraftBlock.biomeToBiomeBase((Registry<net.minecraft.world.level.biome.Biome>) registry, Biome.PLAINS);
}
baseBiomeCache.put(biome, v);
return v;
@@ -334,7 +337,8 @@ public class NMSBinding18_1 implements INMSBinding {
public void forceBiomeInto(int x, int y, int z, Object somethingVeryDirty, ChunkGenerator.BiomeGrid chunk) {
try {
ChunkAccess s = (ChunkAccess) getFieldForBiomeStorage(chunk).get(chunk);
s.setBiome(x, y, z, (net.minecraft.world.level.biome.Biome) somethingVeryDirty);
Holder<net.minecraft.world.level.biome.Biome> biome = (Holder<net.minecraft.world.level.biome.Biome>) somethingVeryDirty;
s.setBiome(x, y, z, biome);
} catch(IllegalAccessException e) {
Iris.reportError(e);
e.printStackTrace();
@@ -402,7 +406,7 @@ public class NMSBinding18_1 implements INMSBinding {
if(i.getReturnType().equals(returns)) {
i.setAccessible(true);
try {
Iris.info("[NMS] Found " + returns.getSimpleName() + " in " + in.getClass().getSimpleName() + "." + i.getName() + "()");
Iris.debug("[NMS] Found " + returns.getSimpleName() + " in " + in.getClass().getSimpleName() + "." + i.getName() + "()");
return i.invoke(in);
} catch(Throwable e) {
e.printStackTrace();
@@ -414,18 +418,26 @@ public class NMSBinding18_1 implements INMSBinding {
}
private static Object fieldFor(Class<?> returns, Object in) {
for(Field i : in.getClass().getFields()) {
if(i.getType().equals(returns)) {
return fieldForClass(returns, in.getClass(), in);
}
@SuppressWarnings("unchecked")
private static <T> T fieldForClass(Class<T> returnType, Class<?> sourceType, Object in) {
for(Field i : sourceType.getDeclaredFields()) {
if(i.getType().equals(returnType)) {
i.setAccessible(true);
try {
Iris.info("[NMS] Found " + returns.getSimpleName() + " in " + in.getClass().getSimpleName() + "." + i.getName());
return i.get(in);
Iris.debug("[NMS] Found " + returnType.getSimpleName() + " in " + sourceType.getSimpleName() + "." + i.getName());
return (T) i.get(in);
} catch(IllegalAccessException e) {
e.printStackTrace();
}
}
}
return null;
}
private static Class<?> getClassType(Class<?> type, int ordinal) {
return type.getDeclaredClasses()[ordinal];
}
}

View File

@@ -112,6 +112,11 @@ public class NMSBinding1X implements INMSBinding {
return null;
}
@Override
public Object getCustomBiomeBaseHolderFor(String mckey) {
return null;
}
@Override
public String getKeyForBiomeBase(Object biomeBase) {
return null;

View File

@@ -29,6 +29,7 @@ import com.volmit.iris.util.scheduling.ChronoLatch;
import com.volmit.iris.util.scheduling.J;
import com.volmit.iris.util.scheduling.Looper;
import java.util.concurrent.Semaphore;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
@@ -55,10 +56,12 @@ public class IrisPregenerator {
private final KSet<Position2> retry;
private final KSet<Position2> net;
private final ChronoLatch cl;
private final Semaphore limiter;
public IrisPregenerator(PregenTask task, PregeneratorMethod generator, PregenListener listener) {
this.listener = listenify(listener);
cl = new ChronoLatch(5000);
limiter = new Semaphore(Runtime.getRuntime().availableProcessors());
generatedRegions = new KSet<>();
this.shutdown = new AtomicBoolean(false);
this.paused = new AtomicBoolean(false);
@@ -140,6 +143,7 @@ public class IrisPregenerator {
generator.close();
ticker.interrupt();
listener.onClose();
getMantle().trim(0);
}
private void visitRegion(int x, int z, boolean regions) {
@@ -162,12 +166,26 @@ public class IrisPregenerator {
boolean hit = false;
if(generator.supportsRegions(x, z, listener) && regions) {
hit = true;
listener.onRegionGenerating(x, z);
generator.generateRegion(x, z, listener);
try {
limiter.acquire();
listener.onRegionGenerating(x, z);
generator.generateRegion(x, z, listener);
limiter.release();
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
} else if(!regions) {
hit = true;
listener.onRegionGenerating(x, z);
PregenTask.iterateRegion(x, z, (xx, zz) -> generator.generateChunk(xx, zz, listener));
PregenTask.iterateRegion(x, z, (xx, zz) -> {
try {
limiter.acquire();
generator.generateChunk(xx, zz, listener);
limiter.release();
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
});
}
if(hit) {

View File

@@ -0,0 +1,178 @@
package com.volmit.iris.core.pregenerator;
import com.google.gson.Gson;
import com.volmit.iris.Iris;
import com.volmit.iris.util.format.Form;
import com.volmit.iris.util.io.IO;
import com.volmit.iris.util.math.Position2;
import com.volmit.iris.util.math.Spiraler;
import com.volmit.iris.util.scheduling.ChronoLatch;
import com.volmit.iris.util.scheduling.J;
import io.papermc.lib.PaperLib;
import lombok.Builder;
import lombok.Data;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.world.WorldUnloadEvent;
import java.io.File;
import java.io.IOException;
import java.util.concurrent.atomic.AtomicInteger;
public class LazyPregenerator extends Thread implements Listener
{
private final LazyPregenJob job;
private final File destination;
private final int maxPosition;
private final World world;
private final long rate;
private final ChronoLatch latch;
public LazyPregenerator(LazyPregenJob job, File destination)
{
this.job = job;
this.destination = destination;
this.maxPosition = new Spiraler(job.getRadiusBlocks() * 2, job.getRadiusBlocks() * 2, (x, z) -> {}).count();
this.world = Bukkit.getWorld(job.getWorld());
this.rate = Math.round((1D / (job.chunksPerMinute / 60D)) * 1000D);
this.latch = new ChronoLatch(60000);
}
public LazyPregenerator(File file) throws IOException {
this(new Gson().fromJson(IO.readAll(file), LazyPregenJob.class), file);
}
@EventHandler
public void on(WorldUnloadEvent e)
{
if(e.getWorld().equals(world)) {
interrupt();
}
}
public void run()
{
while(!interrupted()) {
J.sleep(rate);
tick();
}
try {
saveNow();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
public void tick() {
if(latch.flip())
{
save();
Iris.info("LazyGen: " + world.getName() + " RTT: " + Form.duration((Math.pow((job.radiusBlocks / 16D), 2) / job.chunksPerMinute) * 60 * 1000, 2));
}
if(job.getPosition() >= maxPosition)
{
if(job.isHealing())
{
int pos = (job.getHealingPosition() + 1) % maxPosition;
job.setHealingPosition(pos);
tickRegenerate(getChunk(pos));
}
else
{
Iris.verbose("Completed Lazy Gen!");
interrupt();
}
}
else
{
int pos = job.getPosition() + 1;
job.setPosition(pos);
tickGenerate(getChunk(pos));
}
}
private void tickGenerate(Position2 chunk) {
if(PaperLib.isPaper()) {
PaperLib.getChunkAtAsync(world, chunk.getX(), chunk.getZ(), true).thenAccept((i) -> Iris.verbose("Generated Async " + chunk));
}
else {
J.s(() -> world.getChunkAt(chunk.getX(), chunk.getZ()));
Iris.verbose("Generated " + chunk);
}
}
private void tickRegenerate(Position2 chunk) {
J.s(() -> world.regenerateChunk(chunk.getX(), chunk.getZ()));
Iris.verbose("Regenerated " + chunk);
}
public Position2 getChunk(int position)
{
int p = -1;
AtomicInteger xx = new AtomicInteger();
AtomicInteger zz = new AtomicInteger();
Spiraler s = new Spiraler(job.getRadiusBlocks() * 2, job.getRadiusBlocks() * 2, (x, z) -> {
xx.set(x);
zz.set(z);
});
while(s.hasNext() && p++ < position) {
s.next();
}
return new Position2(xx.get(), zz.get());
}
public void save()
{
J.a(() -> {
try {
saveNow();
}
catch (Throwable e) {
e.printStackTrace();
}
});
}
public void saveNow() throws IOException {
IO.writeAll(this.destination, new Gson().toJson(job));
}
public static void loadLazyGenerators()
{
for(World i : Bukkit.getWorlds())
{
File lazygen = new File(i.getWorldFolder(), "lazygen.json");
if(lazygen.exists()) {
try {
LazyPregenerator p = new LazyPregenerator(lazygen);
p.start();
Iris.info("Started Lazy Pregenerator: " + p.job);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
}
@Data
@Builder
public static class LazyPregenJob
{
private String world;
@Builder.Default private int healingPosition = 0;
@Builder.Default private boolean healing = false;
@Builder.Default private int chunksPerMinute = 32; // 48 hours is roughly 5000 radius
@Builder.Default private int radiusBlocks = 5000;
@Builder.Default private int position = 0;
}
}

View File

@@ -22,17 +22,7 @@ import com.volmit.iris.Iris;
import com.volmit.iris.core.loader.IrisData;
import com.volmit.iris.core.loader.IrisRegistrant;
import com.volmit.iris.core.loader.ResourceLoader;
import com.volmit.iris.engine.object.annotations.ArrayType;
import com.volmit.iris.engine.object.annotations.Desc;
import com.volmit.iris.engine.object.annotations.MaxNumber;
import com.volmit.iris.engine.object.annotations.MinNumber;
import com.volmit.iris.engine.object.annotations.RegistryListBlockType;
import com.volmit.iris.engine.object.annotations.RegistryListFont;
import com.volmit.iris.engine.object.annotations.RegistryListItemType;
import com.volmit.iris.engine.object.annotations.RegistryListResource;
import com.volmit.iris.engine.object.annotations.RegistryListSpecialEntity;
import com.volmit.iris.engine.object.annotations.Required;
import com.volmit.iris.engine.object.annotations.Snippet;
import com.volmit.iris.engine.object.annotations.*;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.collection.KMap;
import com.volmit.iris.util.data.B;
@@ -52,7 +42,7 @@ public class SchemaBuilder {
private static final String SYMBOL_LIMIT__N = "*";
private static final String SYMBOL_TYPE__N = "";
private static final JSONArray POTION_TYPES = getPotionTypes();
private static final JSONArray ENCHANT_TYPES = getEnchantmentTypes();
private static final JSONArray ENCHANT_TYPES = getEnchantTypes();
private static final JSONArray ITEM_TYPES = new JSONArray(B.getItemTypes());
private static final JSONArray FONT_TYPES = new JSONArray(GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames());
private final KMap<String, JSONObject> definitions;
@@ -67,16 +57,6 @@ public class SchemaBuilder {
this.root = root;
}
private static JSONArray getEnchantmentTypes() {
JSONArray a = new JSONArray();
for(Field gg : Enchantment.class.getDeclaredFields()) {
a.put(gg.getName());
}
return a;
}
private static JSONArray getPotionTypes() {
JSONArray a = new JSONArray();
@@ -87,6 +67,14 @@ public class SchemaBuilder {
return a;
}
private static JSONArray getEnchantTypes() {
JSONArray array = new JSONArray();
for(Enchantment e : Enchantment.values()) {
array.put(e.getKey().getKey());
}
return array;
}
public JSONObject construct() {
JSONObject schema = new JSONObject();
schema.put("$schema", "http://json-schema.org/draft-07/schema#");
@@ -309,7 +297,7 @@ public class SchemaBuilder {
prop.put("$ref", "#/definitions/" + key);
description.add(SYMBOL_TYPE__N + " Must be a valid Font Family (use ctrl+space for auto complete!)");
} else if(k.getType().equals(Enchantment.class)) {
} else if(k.isAnnotationPresent(RegistryListEnchantment.class)) {
String key = "enum-enchantment";
if(!definitions.containsKey(key)) {
@@ -483,7 +471,7 @@ public class SchemaBuilder {
items.put("$ref", "#/definitions/" + key);
prop.put("items", items);
description.add(SYMBOL_TYPE__N + " Must be a valid Font Family (use ctrl+space for auto complete!)");
} else if(t.type().equals(Enchantment.class)) {
} else if(k.isAnnotationPresent(RegistryListEnchantment.class)) {
fancyType = "List of Enchantment Types";
String key = "enum-enchantment";

View File

@@ -0,0 +1,86 @@
/*
* Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2022 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.volmit.iris.core.service;
import com.volmit.iris.Iris;
import com.volmit.iris.core.link.ExternalDataProvider;
import com.volmit.iris.core.link.ItemAdderDataProvider;
import com.volmit.iris.core.link.OraxenDataProvider;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.plugin.IrisService;
import lombok.Data;
import org.bukkit.NamespacedKey;
import org.bukkit.block.data.BlockData;
import org.bukkit.inventory.ItemStack;
import java.util.MissingResourceException;
import java.util.Optional;
@Data
public class ExternalDataSVC implements IrisService {
private KList<ExternalDataProvider> providers = new KList<>();
@Override
public void onEnable() {
addProvider(new OraxenDataProvider(), new ItemAdderDataProvider());
}
@Override
public void onDisable() { }
public void addProvider(ExternalDataProvider... provider) {
for(ExternalDataProvider p : provider) {
if(p.getPlugin() != null) {
providers.add(p);
p.init();
}
}
}
public Optional<BlockData> getBlockData(NamespacedKey key) {
Optional<ExternalDataProvider> provider = providers.stream().filter(p -> p.isPresent() && p.isValidProvider(key)).findFirst();
if(provider.isEmpty())
return Optional.empty();
try {
return Optional.of(provider.get().getBlockData(key));
} catch(MissingResourceException e) {
Iris.error(e.getMessage() + " - [" + e.getClassName() + ":" + e.getKey() + "]");
return Optional.empty();
}
}
public Optional<ItemStack> getItemStack(NamespacedKey key) {
Optional<ExternalDataProvider> provider = providers.stream().filter(p -> p.isPresent() && p.isValidProvider(key)).findFirst();
if(provider.isEmpty())
return Optional.empty();
try {
return Optional.of(provider.get().getItemStack(key));
} catch(MissingResourceException e) {
Iris.error(e.getMessage() + " - [" + e.getClassName() + ":" + e.getKey() + "]");
return Optional.empty();
}
}
public NamespacedKey[] getAllIdentifiers() {
KList<NamespacedKey> names = new KList<>();
providers.stream().filter(ExternalDataProvider::isPresent).forEach(p -> names.add(p.getBlockTypes()));
return names.toArray(new NamespacedKey[0]);
}
}

View File

@@ -0,0 +1,61 @@
package com.volmit.iris.core.service;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.plugin.IrisService;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Marker;
import org.apache.logging.log4j.core.Filter;
import org.apache.logging.log4j.core.LogEvent;
import org.apache.logging.log4j.core.Logger;
import org.apache.logging.log4j.message.Message;
public class LogFilterSVC implements IrisService, Filter {
private static final String HEIGHTMAP_MISMATCH = "Ignoring heightmap data for chunk";
private static final String RAID_PERSISTENCE = "Could not save data net.minecraft.world.entity.raid.PersistentRaid";
private static final String DUPLICATE_ENTITY_UUID = "UUID of added entity already exists";
private static final KList<String> FILTERS = new KList<>();
public void onEnable() {
FILTERS.add(HEIGHTMAP_MISMATCH, RAID_PERSISTENCE, DUPLICATE_ENTITY_UUID);
((Logger)LogManager.getRootLogger()).addFilter(this);
}
public void initialize() { }
public void start() { }
public void stop() { }
public void onDisable() { }
public boolean isStarted() { return true; }
public boolean isStopped() { return false; }
public State getState() {
try { return State.STARTED; }
catch (Exception var2) { return null; }
}
public Filter.Result getOnMatch() { return Result.NEUTRAL; }
public Filter.Result getOnMismatch() { return Result.NEUTRAL; }
public Result filter(LogEvent event) { return check(event.getMessage().getFormattedMessage()); }
public Result filter(Logger logger, Level level, Marker marker, Object msg, Throwable t) { return check(msg.toString()); }
public Result filter(Logger logger, Level level, Marker marker, Message msg, Throwable t) { return check(msg.getFormattedMessage()); }
public Result filter(Logger logger, Level level, Marker marker, String message, Object... params) { return check(message); }
public Result filter(Logger logger, Level level, Marker marker, String message, Object p0) { return check(message); }
public Result filter(Logger logger, Level level, Marker marker, String message, Object p0, Object p1) { return check(message); }
public Result filter(Logger logger, Level level, Marker marker, String message, Object p0, Object p1, Object p2) { return check(message); }
public Result filter(Logger logger, Level level, Marker marker, String message, Object p0, Object p1, Object p2, Object p3) { return check(message); }
public Result filter(Logger logger, Level level, Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4) { return check(message); }
public Result filter(Logger logger, Level level, Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5) { return check(message); }
public Result filter(Logger logger, Level level, Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6) { return check(message); }
public Result filter(Logger logger, Level level, Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7) { return check(message); }
public Result filter(Logger logger, Level level, Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7, Object p8) { return check(message); }
public Result filter(Logger logger, Level level, Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7, Object p8, Object p9) { return check(message); }
private Result check(String string) {
if(FILTERS.stream().anyMatch(string::contains))
return Result.DENY;
return Result.NEUTRAL;
}
}

View File

@@ -171,7 +171,7 @@ public class StudioSVC implements IrisService {
String[] nodes = url.split("\\Q/\\E");
String repo = nodes.length == 1 ? "IrisDimensions/" + nodes[0] : nodes[0] + "/" + nodes[1];
branch = nodes.length > 2 ? nodes[2] : branch;
download(sender, repo, branch, trim, forceOverwrite);
download(sender, repo, branch, trim, forceOverwrite, false);
} catch(Throwable e) {
Iris.reportError(e);
e.printStackTrace();
@@ -179,12 +179,22 @@ public class StudioSVC implements IrisService {
}
}
public void download(VolmitSender sender, String repo, String branch, boolean trim) throws JsonSyntaxException, IOException {
download(sender, repo, branch, trim, false);
public void downloadRelease(VolmitSender sender, String url, boolean trim, boolean forceOverwrite) {
try {
download(sender, "IrisDimensions", url, trim, forceOverwrite, true);
} catch(Throwable e) {
Iris.reportError(e);
e.printStackTrace();
sender.sendMessage("Failed to download 'IrisDimensions/overworld' from " + url + ".");
}
}
public void download(VolmitSender sender, String repo, String branch, boolean trim, boolean forceOverwrite) throws JsonSyntaxException, IOException {
String url = "https://codeload.github.com/" + repo + "/zip/refs/heads/" + branch;
public void download(VolmitSender sender, String repo, String branch, boolean trim) throws JsonSyntaxException, IOException {
download(sender, repo, branch, trim, false, false);
}
public void download(VolmitSender sender, String repo, String branch, boolean trim, boolean forceOverwrite, boolean directUrl) throws JsonSyntaxException, IOException {
String url = directUrl ? branch : "https://codeload.github.com/" + repo + "/zip/refs/heads/" + branch;
sender.sendMessage("Downloading " + url + " "); //The extra space stops a bug in adventure API from repeating the last letter of the URL
File zip = Iris.getNonCachedFile("pack-" + trim + "-" + repo, url);
File temp = Iris.getTemp();
@@ -315,7 +325,6 @@ public class StudioSVC implements IrisService {
return activeProject != null && activeProject.isOpen();
}
public void open(VolmitSender sender, String dimm) {
open(sender, 1337, dimm);
}

View File

@@ -19,7 +19,9 @@
package com.volmit.iris.core.service;
import com.volmit.iris.Iris;
import com.volmit.iris.core.IrisSettings;
import com.volmit.iris.core.edit.DustRevealer;
import com.volmit.iris.core.link.WorldEditLink;
import com.volmit.iris.core.wand.WandSelection;
import com.volmit.iris.engine.object.IrisObject;
import com.volmit.iris.util.collection.KList;
@@ -42,6 +44,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack;
@@ -63,17 +66,17 @@ public class WandSVC implements IrisService {
/**
* Creates an Iris Object from the 2 coordinates selected with a wand
*
* @param wand
* The wand itemstack
* @param p
* The wand player
* @return The new object
*/
public static IrisObject createSchematic(ItemStack wand) {
if(!isWand(wand)) {
public static IrisObject createSchematic(Player p) {
if(!isHoldingWand(p)) {
return null;
}
try {
Location[] f = getCuboid(wand);
Location[] f = getCuboid(p);
Cuboid c = new Cuboid(f[0], f[1]);
IrisObject s = new IrisObject(c.getSizeX(), c.getSizeY(), c.getSizeZ());
for(Block b : c) {
@@ -97,17 +100,15 @@ public class WandSVC implements IrisService {
/**
* Creates an Iris Object from the 2 coordinates selected with a wand
*
* @param wand
* The wand itemstack
* @return The new object
*/
public static Matter createMatterSchem(Player p, ItemStack wand) {
if(!isWand(wand)) {
public static Matter createMatterSchem(Player p) {
if(!isHoldingWand(p)) {
return null;
}
try {
Location[] f = getCuboid(wand);
Location[] f = getCuboid(p);
return WorldMatter.createMatter(p.getName(), f[0], f[1]);
} catch(Throwable e) {
@@ -225,26 +226,32 @@ public class WandSVC implements IrisService {
return is;
}
/**
* Get a pair of locations that are selected in an Iris wand
*
* @param is
* The wand item
* @return An array with the 2 locations
*/
public static Location[] getCuboid(ItemStack is) {
public static Location[] getCuboidFromItem(ItemStack is) {
ItemMeta im = is.getItemMeta();
return new Location[] {stringToLocation(im.getLore().get(0)), stringToLocation(im.getLore().get(1))};
}
/**
* Is a player holding an Iris wand
*
* @param p
* The player
* @return True if they are
*/
public static Location[] getCuboid(Player p) {
if(isHoldingIrisWand(p))
{
return getCuboidFromItem(p.getInventory().getItemInMainHand());
}
Cuboid c = WorldEditLink.getSelection(p);
if(c != null)
{
return new Location[] {c.getLowerNE(), c.getUpperSW()};
}
return null;
}
public static boolean isHoldingWand(Player p) {
return isHoldingIrisWand(p) || WorldEditLink.getSelection(p) != null;
}
public static boolean isHoldingIrisWand(Player p) {
ItemStack is = p.getInventory().getItemInMainHand();
return is != null && isWand(is);
}
@@ -285,8 +292,8 @@ public class WandSVC implements IrisService {
public void tick(Player p) {
try {
try {
if(isWand(p.getInventory().getItemInMainHand())) {
Location[] d = getCuboid(p.getInventory().getItemInMainHand());
if((IrisSettings.get().getWorld().worldEditWandCUI && isHoldingWand(p)) || isWand(p.getInventory().getItemInMainHand())) {
Location[] d = getCuboid(p);
new WandSelection(new Cuboid(d[0], d[1]), p).draw();
}
} catch(Throwable e) {
@@ -388,6 +395,8 @@ public class WandSVC implements IrisService {
@EventHandler
public void on(PlayerInteractEvent e) {
if(e.getHand() != EquipmentSlot.HAND)
return;
try {
if(isHoldingWand(e.getPlayer())) {
if(e.getAction().equals(Action.LEFT_CLICK_BLOCK)) {
@@ -408,7 +417,6 @@ public class WandSVC implements IrisService {
e.setCancelled(true);
e.getPlayer().playSound(Objects.requireNonNull(e.getClickedBlock()).getLocation(), Sound.ENTITY_ENDER_EYE_DEATH, 2f, 1.97f);
DustRevealer.spawn(e.getClickedBlock(), new VolmitSender(e.getPlayer(), Iris.instance.getTag()));
}
}
} catch(Throwable xx) {
@@ -455,7 +463,7 @@ public class WandSVC implements IrisService {
return item;
}
Location[] f = getCuboid(item);
Location[] f = getCuboidFromItem(item);
Location other = left ? f[1] : f[0];
if(other != null && !other.getWorld().getName().equals(a.getWorld().getName())) {

View File

@@ -38,8 +38,11 @@ import org.bukkit.GameRule;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.WorldCreator;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File;
import java.io.IOException;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
@@ -102,6 +105,9 @@ public class IrisCreator {
throw new IrisException("Dimension cannot be found null for id " + dimension());
}
if(sender == null)
sender = Iris.getSender();
if(!studio()) {
Iris.service(StudioSVC.class).installIntoWorld(sender, d.getLoadKey(), new File(name()));
}
@@ -174,7 +180,8 @@ public class IrisCreator {
world.get().setTime(6000);
}
});
}
} else
addToBukkitYml();
if(pregen != null) {
CompletableFuture<Boolean> ff = new CompletableFuture<>();
@@ -204,7 +211,38 @@ public class IrisCreator {
e.printStackTrace();
}
}
return world.get();
}
private static final File BUKKIT_YML = new File(Bukkit.getServer().getWorldContainer(), "bukkit.yml");
private void addToBukkitYml() {
YamlConfiguration yml = YamlConfiguration.loadConfiguration(BUKKIT_YML);
String gen = "Iris:" + dimension;
ConfigurationSection section = yml.contains("worlds") ? yml.getConfigurationSection("worlds") : yml.createSection("worlds");
if(!section.contains(name)) {
section.createSection(name).set("generator", gen);
try {
yml.save(BUKKIT_YML);
Iris.info("Registered \"" + name + "\" in bukkit.yml");
} catch(IOException e) {
Iris.error("Failed to update bukkit.yml!");
e.printStackTrace();
}
}
}
public static boolean removeFromBukkitYml(String name) throws IOException {
YamlConfiguration yml = YamlConfiguration.loadConfiguration(BUKKIT_YML);
ConfigurationSection section = yml.getConfigurationSection("worlds");
if (section == null) {
return false;
}
section.set(name, null);
if (section.getValues(false).keySet().stream().noneMatch(k -> section.get(k) != null)) {
yml.set("worlds", null);
}
yml.save(BUKKIT_YML);
return true;
}
}

View File

@@ -0,0 +1,40 @@
package com.volmit.iris.core.tools;
import com.volmit.iris.util.data.B;
import org.bukkit.World;
import org.bukkit.block.data.BlockData;
/**
* This class is used by an external IrisLib for other plugins to interact with Iris. Do not change
* existing methods or their parameters as it will break the library that uses these methods
* feel free to add more methods so long as you also add the reflective methods to the library
*/
public class IrisReflectiveAPI {
public static boolean isIrisWorld(World world) {
return IrisToolbelt.isIrisWorld(world);
}
public static boolean isIrisStudioWorld(World world) {
return IrisToolbelt.isIrisStudioWorld(world);
}
public static void registerCustomBlockData(String namespace, String key, BlockData blockData) {
B.registerCustomBlockData(namespace, key, blockData);
}
public static void retainMantleData(String classname) {
IrisToolbelt.retainMantleDataForSlice(classname);
}
public static void setMantleData(World world, int x, int y, int z, Object data) {
IrisToolbelt.access(world).getEngine().getMantle().getMantle().set(x, y, z, data);
}
public static void deleteMantleData(World world, int x, int y, int z, Class c) {
IrisToolbelt.access(world).getEngine().getMantle().getMantle().remove(x, y, z, c);
}
public static Object getMantleData(World world, int x, int y, int z, Class c) {
return IrisToolbelt.access(world).getEngine().getMantle().getMantle().get(x, y, z, c);
}
}

View File

@@ -32,15 +32,22 @@ import com.volmit.iris.engine.platform.PlatformChunkGenerator;
import com.volmit.iris.util.plugin.VolmitSender;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.block.data.BlockData;
import org.bukkit.entity.Player;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
/**
* Something you really want to wear if working on Iris. Shit gets pretty hectic down there.
* Hope you packed snacks & road sodas.
*/
public class IrisToolbelt {
public static Map<String, Boolean> toolbeltConfiguration = new HashMap<>();
/**
* Will find / download / search for the dimension or return null
* <p>
@@ -110,8 +117,24 @@ public class IrisToolbelt {
public static PlatformChunkGenerator access(World world) {
if(isIrisWorld(world)) {
return ((PlatformChunkGenerator) world.getGenerator());
}
} /*else {
Iris.warn("""
"---------- No World? ---------------
⠀⣞⢽⢪⢣⢣⢣⢫⡺⡵⣝⡮⣗⢷⢽⢽⢽⣮⡷⡽⣜⣜⢮⢺⣜⢷⢽⢝⡽⣝
⠸⡸⠜⠕⠕⠁⢁⢇⢏⢽⢺⣪⡳⡝⣎⣏⢯⢞⡿⣟⣷⣳⢯⡷⣽⢽⢯⣳⣫⠇
⠀⠀⢀⢀⢄⢬⢪⡪⡎⣆⡈⠚⠜⠕⠇⠗⠝⢕⢯⢫⣞⣯⣿⣻⡽⣏⢗⣗⠏⠀
⠀⠪⡪⡪⣪⢪⢺⢸⢢⢓⢆⢤⢀⠀⠀⠀⠀⠈⢊⢞⡾⣿⡯⣏⢮⠷⠁⠀⠀
⠀⠀⠀⠈⠊⠆⡃⠕⢕⢇⢇⢇⢇⢇⢏⢎⢎⢆⢄⠀⢑⣽⣿⢝⠲⠉⠀⠀⠀⠀
⠀⠀⠀⠀⠀⡿⠂⠠⠀⡇⢇⠕⢈⣀⠀⠁⠡⠣⡣⡫⣂⣿⠯⢪⠰⠂⠀⠀⠀⠀
⠀⠀⠀⠀⡦⡙⡂⢀⢤⢣⠣⡈⣾⡃⠠⠄⠀⡄⢱⣌⣶⢏⢊⠂⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⢝⡲⣜⡮⡏⢎⢌⢂⠙⠢⠐⢀⢘⢵⣽⣿⡿⠁⠁⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠨⣺⡺⡕⡕⡱⡑⡆⡕⡅⡕⡜⡼⢽⡻⠏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣼⣳⣫⣾⣵⣗⡵⡱⡡⢣⢑⢕⢜⢕⡝⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⣴⣿⣾⣿⣿⣿⡿⡽⡑⢌⠪⡢⡣⣣⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⡟⡾⣿⢿⢿⢵⣽⣾⣼⣘⢸⢸⣞⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠁⠇⠡⠩⡫⢿⣝⡻⡮⣒⢽⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
""");
}*/
return null;
}
@@ -199,7 +222,6 @@ public class IrisToolbelt {
new VolmitSender(j, Iris.instance.getTag()).sendMessage("You have been evacuated from this world. " + m);
j.teleport(i.getSpawnLocation());
}
return true;
}
}
@@ -210,4 +232,24 @@ public class IrisToolbelt {
public static boolean isStudio(World i) {
return isIrisWorld(i) && access(i).isStudio();
}
public static void retainMantleDataForSlice(String className) {
toolbeltConfiguration.put("retain.mantle." + className, true);
}
public static <T> T getMantleData(World world, int x, int y, int z, Class<T> of) {
PlatformChunkGenerator e = access(world);
if(e == null) {return null;}
return e.getEngine().getMantle().getMantle().get(x, y - world.getMinHeight(), z, of);
}
public static <T> void deleteMantleData(World world, int x, int y, int z, Class<T> of) {
PlatformChunkGenerator e = access(world);
if(e == null) {return;}
e.getEngine().getMantle().getMantle().remove(x, y - world.getMinHeight(), z, of);
}
public static boolean removeWorld(World world) throws IOException {
return IrisCreator.removeFromBukkitYml(world.getName());
}
}

View File

@@ -112,8 +112,8 @@ public class IrisComplex implements DataProvider {
.getAllBiomes(this).forEach((b) -> b
.getGenerators()
.forEach((c) -> registerGenerator(c.getCachedGenerator(this)))));
overlayStream = ProceduralStream.ofDouble((x, z) -> 0D);
engine.getDimension().getOverlayNoise().forEach((i) -> overlayStream.add((x, z) -> i.get(rng, getData(), x, z)));
overlayStream = ProceduralStream.ofDouble((x, z) -> 0.0D);
engine.getDimension().getOverlayNoise().forEach(i -> overlayStream = overlayStream.add((x, z) -> i.get(rng, getData(), x, z)));
rockStream = engine.getDimension().getRockPalette().getLayerGenerator(rng.nextParallelRNG(45), data).stream()
.select(engine.getDimension().getRockPalette().getBlockData(data));
fluidStream = engine.getDimension().getFluidPalette().getLayerGenerator(rng.nextParallelRNG(78), data).stream()
@@ -336,8 +336,7 @@ public class IrisComplex implements DataProvider {
}
private double getHeight(Engine engine, IrisBiome b, double x, double z, long seed) {
return Math.min(engine.getWorld().maxHeight(),
Math.max(getInterpolatedHeight(engine, x, z, seed) + fluidHeight + overlayStream.get(x, z), engine.getWorld().minHeight()));
return Math.max(Math.min(getInterpolatedHeight(engine, x, z, seed) + fluidHeight + overlayStream.get(x, z), engine.getHeight()), 0);
}
private void registerGenerator(IrisGenerator cachedGenerator) {

View File

@@ -21,6 +21,7 @@ package com.volmit.iris.engine;
import com.google.common.util.concurrent.AtomicDouble;
import com.google.gson.Gson;
import com.volmit.iris.Iris;
import com.volmit.iris.core.ServerConfigurator;
import com.volmit.iris.core.events.IrisEngineHotloadEvent;
import com.volmit.iris.core.gui.PregeneratorJob;
import com.volmit.iris.core.project.IrisProject;
@@ -233,6 +234,7 @@ public class IrisEngine implements Engine {
getTarget().setDimension(getData().getDimensionLoader().load(getDimension().getLoadKey()));
prehotload();
setupEngine();
J.a(() -> { synchronized(ServerConfigurator.class) { ServerConfigurator.installDataPacks(false); } });
}
@Override

View File

@@ -20,20 +20,10 @@ package com.volmit.iris.engine;
import com.volmit.iris.Iris;
import com.volmit.iris.core.IrisSettings;
import com.volmit.iris.engine.data.cache.Cache;
import com.volmit.iris.core.loader.IrisData;
import com.volmit.iris.engine.framework.Engine;
import com.volmit.iris.engine.framework.EngineAssignedWorldManager;
import com.volmit.iris.engine.object.IRare;
import com.volmit.iris.engine.object.IrisBiome;
import com.volmit.iris.engine.object.IrisBlockDrops;
import com.volmit.iris.engine.object.IrisEngineChunkData;
import com.volmit.iris.engine.object.IrisEngineData;
import com.volmit.iris.engine.object.IrisEngineSpawnerCooldown;
import com.volmit.iris.engine.object.IrisEntitySpawn;
import com.volmit.iris.engine.object.IrisMarker;
import com.volmit.iris.engine.object.IrisPosition;
import com.volmit.iris.engine.object.IrisRegion;
import com.volmit.iris.engine.object.IrisSpawner;
import com.volmit.iris.engine.object.*;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.collection.KMap;
import com.volmit.iris.util.collection.KSet;
@@ -55,6 +45,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
@@ -69,7 +60,6 @@ import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -79,7 +69,6 @@ import java.util.stream.Stream;
public class IrisWorldManager extends EngineAssignedWorldManager {
private final Looper looper;
private final int id;
private final KMap<Long, Long> chunkCooldowns;
private final KList<Runnable> updateQueue = new KList<>();
private final ChronoLatch cl;
private final ChronoLatch clw;
@@ -99,7 +88,6 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
ecl = null;
cln = null;
clw = null;
chunkCooldowns = null;
looper = null;
chunkUpdater = null;
id = -1;
@@ -112,7 +100,6 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
cl = new ChronoLatch(3000);
ecl = new ChronoLatch(250);
clw = new ChronoLatch(1000, true);
chunkCooldowns = new KMap<>();
id = engine.getCacheID();
energy = 25;
looper = new Looper() {
@@ -255,14 +242,6 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
}
}
int chunkCooldownSeconds = 60;
for(Long i : chunkCooldowns.k()) {
if(M.ms() - chunkCooldowns.get(i) > TimeUnit.SECONDS.toMillis(chunkCooldownSeconds)) {
chunkCooldowns.remove(i);
}
}
int spawnBuffer = RNG.r.i(2, 12);
Chunk[] cc = getEngine().getWorld().realWorld().getLoadedChunks();
@@ -279,7 +258,6 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
}
spawnIn(c, false);
chunkCooldowns.put(Cache.key(c), M.ms());
}
energy -= (actuallySpawned / 2D);
@@ -629,7 +607,6 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
@Override
public void onBlockBreak(BlockBreakEvent e) {
if(e.getBlock().getWorld().equals(getTarget().getWorld().realWorld())) {
J.a(() -> {
MatterMarker marker = getMantle().get(e.getBlock().getX(), e.getBlock().getY(), e.getBlock().getZ(), MatterMarker.class);
@@ -647,52 +624,30 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
});
KList<ItemStack> d = new KList<>();
Runnable drop = () -> J.s(() -> d.forEach((i) -> e.getBlock().getWorld().dropItemNaturally(e.getBlock().getLocation().clone().add(0.5, 0.5, 0.5), i)));
IrisBiome b = getEngine().getBiome(e.getBlock().getLocation());
List<IrisBlockDrops> dropProviders = filterDrops(b.getBlockDrops(), e, getData());
if(dropItems(e, d, drop, b.getBlockDrops(), b)) {
return;
if(dropProviders.stream().noneMatch(IrisBlockDrops::isSkipParents)) {
IrisRegion r = getEngine().getRegion(e.getBlock().getLocation());
dropProviders.addAll(filterDrops(r.getBlockDrops(), e, getData()));
dropProviders.addAll(filterDrops(getEngine().getDimension().getBlockDrops(), e, getData()));
}
IrisRegion r = getEngine().getRegion(e.getBlock().getLocation());
dropProviders.forEach(provider -> provider.fillDrops(false, d));
if(dropItems(e, d, drop, r.getBlockDrops(), b)) {
return;
if(dropProviders.stream().anyMatch(IrisBlockDrops::isReplaceVanillaDrops)) {
e.setDropItems(false);
}
for(IrisBlockDrops i : getEngine().getDimension().getBlockDrops()) {
if(i.shouldDropFor(e.getBlock().getBlockData(), getData())) {
if(i.isReplaceVanillaDrops()) {
e.setDropItems(false);
}
i.fillDrops(false, d);
if(i.isSkipParents()) {
drop.run();
return;
}
}
if(d.isNotEmpty()) {
World w = e.getBlock().getWorld();
J.s(() -> d.forEach(item -> w.dropItemNaturally(e.getBlock().getLocation().clone().add(.5, .5, .5), item)));
}
}
}
private boolean dropItems(BlockBreakEvent e, KList<ItemStack> d, Runnable drop, KList<IrisBlockDrops> blockDrops, IrisBiome b) {
for(IrisBlockDrops i : blockDrops) {
if(i.shouldDropFor(e.getBlock().getBlockData(), getData())) {
if(i.isReplaceVanillaDrops()) {
e.setDropItems(false);
}
i.fillDrops(false, d);
if(i.isSkipParents()) {
drop.run();
return true;
}
}
}
return false;
private List<IrisBlockDrops> filterDrops(KList<IrisBlockDrops> drops, BlockBreakEvent e, IrisData data) {
return new KList<>(drops.stream().filter(d -> d.shouldDropFor(e.getBlock().getBlockData(), data)).toList());
}
@Override

View File

@@ -27,11 +27,13 @@ import com.volmit.iris.engine.object.IrisBiome;
import com.volmit.iris.engine.object.IrisBiomeCustom;
import com.volmit.iris.util.documentation.BlockCoordinates;
import com.volmit.iris.util.hunk.Hunk;
import com.volmit.iris.util.hunk.view.BiomeGridHunkHolder;
import com.volmit.iris.util.hunk.view.BiomeGridHunkView;
import com.volmit.iris.util.math.RNG;
import com.volmit.iris.util.parallel.BurstExecutor;
import com.volmit.iris.util.scheduling.ChronoLatch;
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
import io.papermc.lib.PaperLib;
import org.bukkit.block.Biome;
import org.bukkit.generator.ChunkGenerator;
@@ -55,9 +57,17 @@ public class IrisBiomeActuator extends EngineAssignedActuator<Biome> {
hh.forceBiomeBaseInto(x, y, z, bb);
}
return true;
} else if(h instanceof BiomeGridHunkHolder hh) {
ChunkGenerator.BiomeGrid g = hh.getChunk();
if(g instanceof TerrainChunk) {
((TerrainChunk) g).getBiomeBaseInjector().setBiome(x, y, z, bb);
} else {
hh.forceBiomeBaseInto(x, y, z, bb);
}
return true;
}
} catch(Throwable e) {
e.printStackTrace();
}
return false;
@@ -67,7 +77,7 @@ public class IrisBiomeActuator extends EngineAssignedActuator<Biome> {
@Override
public void onActuate(int x, int z, Hunk<Biome> h, boolean multicore) {
PrecisionStopwatch p = PrecisionStopwatch.start();
BurstExecutor burst = burst().burst(multicore);
BurstExecutor burst = burst().burst(PaperLib.isPaper() && multicore);
for(int xf = 0; xf < h.getWidth(); xf++) {
int finalXf = xf;
@@ -79,8 +89,8 @@ public class IrisBiomeActuator extends EngineAssignedActuator<Biome> {
if(ib.isCustom()) {
try {
IrisBiomeCustom custom = ib.getCustomBiome(rng, x, 0, z);
Object biomeBase = INMS.get().getCustomBiomeBaseFor(getDimension().getLoadKey() + ":" + custom.getId());
//
Object biomeBase = INMS.get().getCustomBiomeBaseHolderFor(getDimension().getLoadKey() + ":" + custom.getId());
if(biomeBase == null || !injectBiome(h, x, 0, z, biomeBase)) {
throw new RuntimeException("Cant inject biome!");
}

View File

@@ -101,7 +101,6 @@ public class IrisTerrainNormalActuator extends EngineAssignedActuator<BlockData>
KList<BlockData> blocks = null;
KList<BlockData> fblocks = null;
int depth, fdepth;
for(int i = hf; i >= 0; i--) {
if(i >= h.getHeight()) {
continue;
@@ -156,7 +155,6 @@ public class IrisTerrainNormalActuator extends EngineAssignedActuator<BlockData>
} else {
h.set(xf, i, zf, getComplex().getRockStream().get(realX, realZ));
}
}
}
}

View File

@@ -18,6 +18,7 @@
package com.volmit.iris.engine.data.chunk;
import com.volmit.iris.Iris;
import com.volmit.iris.core.nms.BiomeBaseInjector;
import com.volmit.iris.core.nms.INMS;
import com.volmit.iris.util.data.IrisBiomeStorage;

View File

@@ -23,11 +23,13 @@ import com.volmit.iris.engine.framework.Engine;
import com.volmit.iris.engine.object.IrisBiome;
import com.volmit.iris.engine.object.IrisDecorationPart;
import com.volmit.iris.engine.object.IrisDecorator;
import com.volmit.iris.util.data.B;
import com.volmit.iris.util.documentation.BlockCoordinates;
import com.volmit.iris.util.hunk.Hunk;
import org.bukkit.Material;
import org.bukkit.block.BlockFace;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.MultipleFacing;
import org.bukkit.block.data.type.PointedDripstone;
public class IrisCeilingDecorator extends IrisEngineDecorator {
@@ -39,11 +41,10 @@ public class IrisCeilingDecorator extends IrisEngineDecorator {
@Override
public void decorate(int x, int z, int realX, int realX1, int realX_1, int realZ, int realZ1, int realZ_1, Hunk<BlockData> data, IrisBiome biome, int height, int max) {
IrisDecorator decorator = getDecorator(biome, realX, realZ);
if(decorator != null) {
if(!decorator.isStacking()) {
if(height >= 0 || height < getEngine().getHeight()) {
data.set(x, height, z, decorator.getBlockData100(biome, getRng(), realX, height, realZ, getData()));
data.set(x, height, z, fixFaces(decorator.getBlockData100(biome, getRng(), realX, height, realZ, getData()), realX, height, realZ));
}
} else {
int stack = decorator.getHeight(getRng().nextParallelRNG(Cache.key(realX, realZ)), realX, realZ, getData());
@@ -98,4 +99,24 @@ public class IrisCeilingDecorator extends IrisEngineDecorator {
}
}
}
private BlockData fixFaces(BlockData b, int x, int y, int z) {
if(B.isVineBlock(b)) {
MultipleFacing data = (MultipleFacing)b.clone();
boolean found = false;
for(BlockFace f : BlockFace.values()) {
if(!f.isCartesian())
continue;
Material m = getEngine().getMantle().get(x + f.getModX(), y + f.getModY(), z + f.getModZ()).getMaterial();
if(m.isSolid()) {
found = true;
data.setFace(f, m.isSolid());
}
}
if(!found)
data.setFace(BlockFace.UP, true);
return data;
}
return b;
}
}

View File

@@ -25,12 +25,14 @@ import com.volmit.iris.engine.object.InferredType;
import com.volmit.iris.engine.object.IrisBiome;
import com.volmit.iris.engine.object.IrisDecorationPart;
import com.volmit.iris.engine.object.IrisDecorator;
import com.volmit.iris.util.data.B;
import com.volmit.iris.util.documentation.BlockCoordinates;
import com.volmit.iris.util.hunk.Hunk;
import org.bukkit.Material;
import org.bukkit.block.BlockFace;
import org.bukkit.block.data.Bisected;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.MultipleFacing;
import org.bukkit.block.data.type.PointedDripstone;
public class IrisSurfaceDecorator extends IrisEngineDecorator {
@@ -55,7 +57,7 @@ public class IrisSurfaceDecorator extends IrisEngineDecorator {
bd = decorator.getBlockData100(biome, getRng(), realX, height, realZ, getData());
if(!underwater) {
if(!canGoOn(bd, bdx)) {
if(!canGoOn(bd, bdx) && !decorator.isForcePlace()) {
return;
}
}
@@ -72,8 +74,9 @@ public class IrisSurfaceDecorator extends IrisEngineDecorator {
((Bisected) bd).setHalf(Bisected.Half.BOTTOM);
}
data.set(x, height + 1, z, bd);
if(decorator.getForceBlock() != null)
data.set(x, height, z, fixFaces(decorator.getForceBlock().getBlockData(getData()), x, height, z));
data.set(x, height + 1, z, fixFaces(bd, x, height, z));
} else {
if(height < getDimension().getFluidHeight()) {
max = getDimension().getFluidHeight();
@@ -139,4 +142,24 @@ public class IrisSurfaceDecorator extends IrisEngineDecorator {
}
}
}
private BlockData fixFaces(BlockData b, int x, int y, int z) {
if(B.isVineBlock(b)) {
MultipleFacing data = (MultipleFacing)b.clone();
boolean found = false;
for(BlockFace f : BlockFace.values()) {
if(!f.isCartesian())
continue;
Material m = getEngine().getMantle().get(x + f.getModX(), y + f.getModY(), z + f.getModZ()).getMaterial();
if(m.isSolid()) {
found = true;
data.setFace(f, m.isSolid());
}
}
if(!found)
data.setFace(BlockFace.UP, true);
return data;
}
return b;
}
}

View File

@@ -24,25 +24,12 @@ import com.volmit.iris.core.gui.components.RenderType;
import com.volmit.iris.core.gui.components.Renderer;
import com.volmit.iris.core.loader.IrisData;
import com.volmit.iris.core.loader.IrisRegistrant;
import com.volmit.iris.core.nms.INMS;
import com.volmit.iris.engine.IrisComplex;
import com.volmit.iris.engine.data.cache.Cache;
import com.volmit.iris.engine.data.chunk.TerrainChunk;
import com.volmit.iris.engine.mantle.EngineMantle;
import com.volmit.iris.engine.object.InventorySlotType;
import com.volmit.iris.engine.object.IrisBiome;
import com.volmit.iris.engine.object.IrisColor;
import com.volmit.iris.engine.object.IrisDimension;
import com.volmit.iris.engine.object.IrisEngineData;
import com.volmit.iris.engine.object.IrisJigsawStructure;
import com.volmit.iris.engine.object.IrisJigsawStructurePlacement;
import com.volmit.iris.engine.object.IrisLootMode;
import com.volmit.iris.engine.object.IrisLootReference;
import com.volmit.iris.engine.object.IrisLootTable;
import com.volmit.iris.engine.object.IrisObject;
import com.volmit.iris.engine.object.IrisObjectPlacement;
import com.volmit.iris.engine.object.IrisPosition;
import com.volmit.iris.engine.object.IrisRegion;
import com.volmit.iris.engine.object.IrisWorld;
import com.volmit.iris.engine.object.*;
import com.volmit.iris.engine.scripting.EngineExecutionEnvironment;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.collection.KMap;
@@ -61,6 +48,7 @@ import com.volmit.iris.util.math.Position2;
import com.volmit.iris.util.math.RNG;
import com.volmit.iris.util.matter.MatterCavern;
import com.volmit.iris.util.matter.MatterUpdate;
import com.volmit.iris.util.matter.TileWrapper;
import com.volmit.iris.util.parallel.BurstExecutor;
import com.volmit.iris.util.parallel.MultiBurst;
import com.volmit.iris.util.scheduling.ChronoLatch;
@@ -262,11 +250,6 @@ public interface Engine extends DataProvider, Fallible, LootProvider, BlockUpdat
}
}
@ChunkCoordinates
default void placeTiles(Chunk c) {
}
void blockUpdatedMetric();
@ChunkCoordinates
@@ -280,6 +263,15 @@ public interface Engine extends DataProvider, Fallible, LootProvider, BlockUpdat
&& c.getWorld().isChunkLoaded(c.getX() - 1, c.getZ())
&& c.getWorld().isChunkLoaded(c.getX() + 1, c.getZ() - 1)
&& c.getWorld().isChunkLoaded(c.getX() - 1, c.getZ() + 1) && getMantle().getMantle().isLoaded(c)) {
getMantle().getMantle().raiseFlag(c.getX(), c.getZ(), MantleFlag.TILE, () -> J.s(() -> {
getMantle().getMantle().iterateChunk(c.getX(), c.getZ(), TileWrapper.class, (x, y, z, tile) -> {
int betterY = y + getWorld().minHeight();
if(!TileData.setTileState(c.getBlock(x, betterY, z), tile.getData()))
Iris.warn("Failed to set tile entity data at [%d %d %d | %s] for tile %s!", x, betterY ,z, c.getBlock(x, betterY, z).getBlockData().getMaterial().getKey(), tile.getData().getTileId());
});
}));
getMantle().getMantle().raiseFlag(c.getX(), c.getZ(), MantleFlag.UPDATE, () -> J.s(() -> {
PrecisionStopwatch p = PrecisionStopwatch.start();
KMap<Long, Integer> updates = new KMap<>();
@@ -472,6 +464,8 @@ public interface Engine extends DataProvider, Fallible, LootProvider, BlockUpdat
int b = 4;
for(IrisLootTable i : tables) {
if(i == null)
continue;
b++;
items.addAll(i.getLoot(debug, items.isEmpty(), rng, slot, x, y, z, b + b, mgf + b));
}
@@ -746,7 +740,6 @@ public interface Engine extends DataProvider, Fallible, LootProvider, BlockUpdat
default PlacedObject getObjectPlacement(int x, int y, int z) {
String objectAt = getMantle().getMantle().get(x, y, z, String.class);
if(objectAt == null || objectAt.isEmpty()) {
return null;
}

View File

@@ -69,24 +69,31 @@ public abstract class EngineAssignedWorldManager extends EngineAssignedComponent
protected AtomicBoolean ignoreTP = new AtomicBoolean(false);
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void on(PlayerTeleportEvent e) {
if(ignoreTP.get()) {
return;
}
if(!PaperLib.isPaper() || e.getTo() == null) {
return;
}
try {
if(e.getTo().getWorld().equals(getTarget().getWorld().realWorld())) {
getEngine().getWorldManager().teleportAsync(e);
}
} catch(Throwable ex) {
}
}
// @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
// public void on(PlayerTeleportEvent e) {
// if(ignoreTP.get()) {
// System.out.println("IgTP1");
// return;
// }
//
// if(!PaperLib.isPaper() || e.getTo() == null) {
// System.out.println("IgTP2");
//
//// return;
// }
//
//// try {
//// System.out.println("IgTP3");
////
//// if(e.getTo().getWorld().equals(getTarget().getWorld().realWorld())) {
//// System.out.println("IgTP4");
////
//// getEngine().getWorldManager().teleportAsync(e);
//// }
//// } catch(Throwable ex) {
////
//// }
// }
@EventHandler
public void on(WorldSaveEvent e) {

View File

@@ -38,10 +38,7 @@ import com.volmit.iris.util.hunk.Hunk;
import com.volmit.iris.util.mantle.Mantle;
import com.volmit.iris.util.mantle.MantleChunk;
import com.volmit.iris.util.mantle.MantleFlag;
import com.volmit.iris.util.matter.Matter;
import com.volmit.iris.util.matter.MatterCavern;
import com.volmit.iris.util.matter.MatterFluidBody;
import com.volmit.iris.util.matter.MatterMarker;
import com.volmit.iris.util.matter.*;
import com.volmit.iris.util.matter.slices.UpdateMatter;
import com.volmit.iris.util.parallel.BurstExecutor;
import com.volmit.iris.util.parallel.MultiBurst;
@@ -109,17 +106,14 @@ public interface EngineMantle extends IObjectPlacer {
@Override
default void setTile(int x, int y, int z, TileData<? extends TileState> d) {
// TODO SET TILE
getMantle().set(x, y, z, new TileWrapper(d));
}
@Override
default BlockData get(int x, int y, int z) {
BlockData block = getMantle().get(x, y, z, BlockData.class);
if(block == null) {
if(block == null)
return AIR;
}
return block;
}

View File

@@ -24,6 +24,7 @@ import com.volmit.iris.core.loader.IrisData;
import com.volmit.iris.engine.data.cache.Cache;
import com.volmit.iris.engine.framework.Engine;
import com.volmit.iris.engine.object.IObjectPlacer;
import com.volmit.iris.engine.object.IrisGeneratorStyle;
import com.volmit.iris.engine.object.IrisPosition;
import com.volmit.iris.engine.object.TileData;
import com.volmit.iris.util.collection.KMap;
@@ -31,6 +32,7 @@ import com.volmit.iris.util.collection.KSet;
import com.volmit.iris.util.function.Function3;
import com.volmit.iris.util.mantle.Mantle;
import com.volmit.iris.util.mantle.MantleChunk;
import com.volmit.iris.util.math.RNG;
import com.volmit.iris.util.matter.Matter;
import lombok.Data;
import org.bukkit.block.TileState;
@@ -121,6 +123,13 @@ public class MantleWriter implements IObjectPlacer {
return (x * x) + (z * z);
}
public <T> void setDataWarped(int x, int y, int z, T t, RNG rng, IrisData data, IrisGeneratorStyle style)
{
setData((int)Math.round(style.warp(rng, data, x, x, y, -z)),
(int)Math.round(style.warp(rng, data, y, z, -x, y)),
(int)Math.round(style.warp(rng, data, z, -y, z, x)), t);
}
public <T> void setData(int x, int y, int z, T t) {
if(t == null) {
return;
@@ -233,6 +242,10 @@ public class MantleWriter implements IObjectPlacer {
setElipsoidFunction(cx, cy, cz, rx, ry, rz, fill, (a, b, c) -> data);
}
public <T> void setElipsoidWarped(int cx, int cy, int cz, double rx, double ry, double rz, boolean fill, T data, RNG rng, IrisData idata, IrisGeneratorStyle style) {
setElipsoidFunctionWarped(cx, cy, cz, rx, ry, rz, fill, (a, b, c) -> data, rng, idata, style);
}
/**
* Set an elipsoid into the mantle
*
@@ -312,6 +325,63 @@ public class MantleWriter implements IObjectPlacer {
}
}
public <T> void setElipsoidFunctionWarped(int cx, int cy, int cz, double rx, double ry, double rz, boolean fill, Function3<Integer, Integer, Integer, T> data, RNG rng, IrisData idata, IrisGeneratorStyle style) {
rx += 0.5;
ry += 0.5;
rz += 0.5;
final double invRadiusX = 1 / rx;
final double invRadiusY = 1 / ry;
final double invRadiusZ = 1 / rz;
final int ceilRadiusX = (int) Math.ceil(rx);
final int ceilRadiusY = (int) Math.ceil(ry);
final int ceilRadiusZ = (int) Math.ceil(rz);
double nextXn = 0;
forX:
for(int x = 0; x <= ceilRadiusX; ++x) {
final double xn = nextXn;
nextXn = (x + 1) * invRadiusX;
double nextYn = 0;
forY:
for(int y = 0; y <= ceilRadiusY; ++y) {
final double yn = nextYn;
nextYn = (y + 1) * invRadiusY;
double nextZn = 0;
for(int z = 0; z <= ceilRadiusZ; ++z) {
final double zn = nextZn;
nextZn = (z + 1) * invRadiusZ;
double distanceSq = lengthSq(xn, yn, zn);
if(distanceSq > 1) {
if(z == 0) {
if(y == 0) {
break forX;
}
break forY;
}
break;
}
if(!fill) {
if(lengthSq(nextXn, yn, zn) <= 1 && lengthSq(xn, nextYn, zn) <= 1 && lengthSq(xn, yn, nextZn) <= 1) {
continue;
}
}
setDataWarped(x + cx, y + cy, z + cz, data.apply(x + cx, y + cy, z + cz), rng, idata, style);
setDataWarped(-x + cx, y + cy, z + cz, data.apply(-x + cx, y + cy, z + cz), rng, idata, style);
setDataWarped(x + cx, -y + cy, z + cz, data.apply(x + cx, -y + cy, z + cz), rng, idata, style);
setDataWarped(x + cx, y + cy, -z + cz, data.apply(x + cx, y + cy, -z + cz), rng, idata, style);
setDataWarped(-x + cx, y + cy, -z + cz, data.apply(-x + cx, y + cy, -z + cz), rng, idata, style);
setDataWarped(-x + cx, -y + cy, z + cz, data.apply(-x + cx, -y + cy, z + cz), rng, idata, style);
setDataWarped(x + cx, -y + cy, -z + cz, data.apply(x + cx, -y + cy, -z + cz), rng, idata, style);
setDataWarped(-x + cx, y + cy, -z + cz, data.apply(-x + cx, y + cy, -z + cz), rng, idata, style);
setDataWarped(-x + cx, -y + cy, -z + cz, data.apply(-x + cx, -y + cy, -z + cz), rng, idata, style);
}
}
}
}
/**
* Set a cuboid of data in the mantle
*

View File

@@ -42,10 +42,10 @@ public class ModeOverworld extends IrisEngineMode implements EngineMode {
var deposit = new IrisDepositModifier(getEngine());
var perfection = new IrisPerfectionModifier(getEngine());
registerStage((x, z, k, p, m) -> biome.actuate(x, z, p, m));
registerStage(burst(
(x, z, k, p, m) -> generateMatter(x >> 4, z >> 4, m),
(x, z, k, p, m) -> terrain.actuate(x, z, k, m),
(x, z, k, p, m) -> biome.actuate(x, z, p, m)
(x, z, k, p, m) -> terrain.actuate(x, z, k, m)
));
registerStage((x, z, k, p, m) -> cave.modify(x >> 4, z >> 4, k, m));
registerStage((x, z, k, p, m) -> deposit.modify(x, z, k, m));

View File

@@ -29,6 +29,7 @@ import com.volmit.iris.engine.object.IrisDecorator;
import com.volmit.iris.engine.object.IrisPosition;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.collection.KMap;
import com.volmit.iris.util.context.IrisContext;
import com.volmit.iris.util.data.B;
import com.volmit.iris.util.function.Consumer4;
import com.volmit.iris.util.hunk.Hunk;
@@ -148,7 +149,7 @@ public class IrisCarveModifier extends EngineAssignedModifier<BlockData> {
int buf = v.get(0) - 1;
for(Integer i : v) {
if(i < 0 || i > 255) {
if(i < 0 || i > getEngine().getHeight()) {
continue;
}
@@ -275,7 +276,7 @@ public class IrisCarveModifier extends EngineAssignedModifier<BlockData> {
}
public boolean isValid() {
return floor < ceiling && ceiling - floor >= 1 && floor >= 0 && ceiling <= 255 && airThickness() > 0;
return floor < ceiling && ceiling - floor >= 1 && floor >= 0 && ceiling <= IrisContext.get().getEngine().getHeight() && airThickness() > 0;
}
public String toString() {

View File

@@ -101,7 +101,7 @@ public class IrisDepositModifier extends EngineAssignedModifier<BlockData> {
int i = Math.max(0, k.getMinHeight());
// TODO: WARNING HEIGHT
int a = Math.min(height, Math.min(256, k.getMaxHeight()));
int a = Math.min(height, Math.min(getEngine().getHeight(), k.getMaxHeight()));
if(i >= a) {
return;
@@ -118,7 +118,7 @@ public class IrisDepositModifier extends EngineAssignedModifier<BlockData> {
int ny = j.getBlockY() + h;
int nz = j.getBlockZ() + z;
if(ny > height || nx > 15 || nx < 0 || ny > 255 || ny < 0 || nz < 0 || nz > 15) {
if(ny > height || nx > 15 || nx < 0 || ny > getEngine().getHeight() || ny < 0 || nz < 0 || nz > 15) {
continue;
}

View File

@@ -293,7 +293,7 @@ public class IrisBiome extends IrisRegistrant implements IRare {
height += i.getHeight(xg, x, z, seed);
}
return Math.max(0, Math.min(height, 255));
return Math.max(0, Math.min(height, xg.getHeight()));
}
public CNG getBiomeGenerator(RNG random) {
@@ -448,7 +448,7 @@ public class IrisBiome extends IrisRegistrant implements IRare {
}
for(int i = 0; i < maxDepth; i++) {
int offset = (255 - height) - i;
int offset = (512 - height) - i;
int index = offset % data.size();
real.add(data.get(Math.max(index, 0)));
}

View File

@@ -47,14 +47,14 @@ public class IrisBiomeGeneratorLink {
private String generator = "default";
@DependsOn({"min", "max"})
@Required
@MinNumber(-256) // TODO: WARNING HEIGHT
@MaxNumber(256) // TODO: WARNING HEIGHT
@MinNumber(-2032) // TODO: WARNING HEIGHT
@MaxNumber(2032) // TODO: WARNING HEIGHT
@Desc("The min block value (value + fluidHeight)")
private int min = 0;
@DependsOn({"min", "max"})
@Required
@MinNumber(-256) // TODO: WARNING HEIGHT
@MaxNumber(256) // TODO: WARNING HEIGHT
@MinNumber(-2032) // TODO: WARNING HEIGHT
@MaxNumber(2032) // TODO: WARNING HEIGHT
@Desc("The max block value (value + fluidHeight)")
private int max = 0;

View File

@@ -50,13 +50,13 @@ public class IrisBiomePaletteLayer {
private IrisGeneratorStyle style = NoiseStyle.STATIC.style();
@DependsOn({"minHeight", "maxHeight"})
@MinNumber(0)
@MaxNumber(256) // TODO: WARNING HEIGHT
@MaxNumber(2032) // TODO: WARNING HEIGHT
@Desc("The min thickness of this layer")
private int minHeight = 1;
@DependsOn({"minHeight", "maxHeight"})
@MinNumber(1)
@MaxNumber(256) // TODO: WARNING HEIGHT
@MaxNumber(2032) // TODO: WARNING HEIGHT
@Desc("The max thickness of this layer")
private int maxHeight = 1;

View File

@@ -38,6 +38,7 @@ import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.bukkit.block.data.BlockData;
import org.bukkit.entity.EntityType;
import java.util.Map;
@@ -199,6 +200,19 @@ public class IrisBlockData extends IrisRegistrant {
});
}
public TileData<?> tryGetTile() {
//TODO Do like a registry thing with the tile data registry. Also update the parsing of data to include **block** entities.
if(data.containsKey("entitySpawn")) {
TileSpawner spawner = new TileSpawner();
String name = (String)data.get("entitySpawn");
if(name.contains(":"))
name = name.split(":")[1];
spawner.setEntityType(EntityType.fromName(name));
return spawner;
}
return null;
}
private String keyify(String dat) {
if(dat.contains(":")) {
return dat;

View File

@@ -56,8 +56,7 @@ public class IrisBlockDrops {
private boolean replaceVanillaDrops = false;
public boolean shouldDropFor(BlockData data, IrisData rdata) {
KList<BlockData> list = this.data.aquire(() ->
{
KList<BlockData> list = this.data.aquire(() -> {
KList<BlockData> b = new KList<>();
for(IrisBlockData i : getBlocks()) {

View File

@@ -53,6 +53,8 @@ public class IrisDecorator {
private IrisGeneratorStyle variance = NoiseStyle.STATIC.style();
@Desc("Forcefully place this decorant anywhere it is supposed to go even if it should not go on a specific surface block. For example, you could force tallgrass to place on top of stone by using this.")
private boolean forcePlace = false;
@Desc("Forced the surface block of this decorant to be the specified block. Assumes forcePlace.")
private IrisBlockData forceBlock;
@DependsOn({"scaleStack", "stackMin", "stackMax"})
@Desc("If stackMax is set to true, use this to limit its max height for large caverns")
private int absoluteMaxStack = 30;
@@ -65,12 +67,12 @@ public class IrisDecorator {
private IrisDecorationPart partOf = IrisDecorationPart.NONE;
@DependsOn({"stackMin", "stackMax"})
@MinNumber(1)
@MaxNumber(256) // TODO: WARNING HEIGHT
@MaxNumber(2032) // TODO: WARNING HEIGHT
@Desc("The minimum repeat stack height (setting to 3 would stack 3 of <block> on top of each other")
private int stackMin = 1;
@DependsOn({"stackMin", "stackMax"})
@MinNumber(1)
@MaxNumber(256) // TODO: WARNING HEIGHT
@MaxNumber(2032) // TODO: WARNING HEIGHT
@Desc("The maximum repeat stack height")
private int stackMax = 1;
@DependsOn({"stackMin", "stackMax"})

View File

@@ -46,12 +46,12 @@ public class IrisDepositGenerator {
private final transient AtomicCache<KList<BlockData>> blockData = new AtomicCache<>();
@Required
@MinNumber(0)
@MaxNumber(256) // TODO: WARNING HEIGHT
@MaxNumber(2032) // TODO: WARNING HEIGHT
@Desc("The minimum height this deposit can generate at")
private int minHeight = 7;
@Required
@MinNumber(0)
@MaxNumber(256) // TODO: WARNING HEIGHT
@MaxNumber(2032) // TODO: WARNING HEIGHT
@Desc("The maximum height this deposit can generate at")
private int maxHeight = 55;
@Required

View File

@@ -74,6 +74,7 @@ public class IrisDimension extends IrisRegistrant {
@MaxNumber(2032)
@Desc("Maximum height at which players can be teleported to through gameplay.")
private int logicalHeight = 256;
@RegistryListResource(IrisJigsawStructure.class)
@Desc("If defined, Iris will place the given jigsaw structure where minecraft should place the overworld stronghold.")
private String stronghold;
@@ -157,7 +158,7 @@ public class IrisDimension extends IrisRegistrant {
private KList<IrisJigsawStructurePlacement> jigsawStructures = new KList<>();
@Required
@MinNumber(0)
@MaxNumber(255)
@MaxNumber(1024)
@Desc("The fluid height for this dimension")
private int fluidHeight = 63;
@Desc("Define the min and max Y bounds of this dimension. Please keep in mind that Iris internally generates from 0 to (max - min). \n\nFor example at -64 to 320, Iris is internally generating to 0 to 384, then on outputting chunks, it shifts it down by the min height (64 blocks). The default is -64 to 320. \n\nThe fluid height is placed at (fluid height + min height). So a fluid height of 63 would actually show up in the world at 1.")
@@ -227,8 +228,6 @@ public class IrisDimension extends IrisRegistrant {
private IrisMaterialPalette rockPalette = new IrisMaterialPalette().qclear().qadd("stone");
@Desc("The palette of blocks for 'water'")
private IrisMaterialPalette fluidPalette = new IrisMaterialPalette().qclear().qadd("water");
// @Desc("Cartographer map trade overrides")
// private IrisVillagerOverride patchCartographers = new IrisVillagerOverride().setDisableTrade(false);
@Desc("Remove cartographers so they do not crash the server (Iris worlds only)")
private boolean removeCartographersDueToCrash = true;
@Desc("Notify players of cancelled cartographer villager in this radius in blocks (set to -1 to disable, -2 for everyone)")
@@ -405,20 +404,10 @@ public class IrisDimension extends IrisRegistrant {
}
}
if(!dimensionHeight.equals(new IrisRange(-64, 320))) {
File dimType = new File(datapacks, "iris/data/minecraft/dimension_type/" + getLoadKey().toLowerCase() + ".json");
if(!dimType.exists())
changed = true;
Iris.verbose(" Installing Data Pack Dimension Type: " + dimType.getPath());
dimType.getParentFile().mkdirs();
try {
IO.writeAll(dimType, generateDatapackJson());
} catch(IOException e) {
Iris.reportError(e);
e.printStackTrace();
}
}
if(!dimensionHeight.equals(new IrisRange(-64, 320)) && this.name.equalsIgnoreCase("overworld")) {
Iris.verbose(" Installing Data Pack Dimension Type: \"minecraft:overworld\"");
changed = writeDimensionType(changed, datapacks);
}
if(write) {
File mcm = new File(datapacks, "iris/pack.mcmeta");
@@ -427,7 +416,7 @@ public class IrisDimension extends IrisRegistrant {
{
"pack": {
"description": "Iris Data Pack. This pack contains all installed Iris Packs' resources.",
"pack_format": 7
"pack_format": 10
}
}
""");
@@ -456,6 +445,20 @@ public class IrisDimension extends IrisRegistrant {
}
public boolean writeDimensionType(boolean changed, File datapacks) {
File dimType = new File(datapacks, "iris/data/minecraft/dimension_type/overworld.json");
if(!dimType.exists())
changed = true;
dimType.getParentFile().mkdirs();
try {
IO.writeAll(dimType, generateDatapackJson());
} catch(IOException e) {
Iris.reportError(e);
e.printStackTrace();
}
return changed;
}
private String generateDatapackJson() {
JSONObject obj = new JSONObject(DP_OVERWORLD_DEFAULT);
obj.put("min_y", dimensionHeight.getMin());
@@ -466,19 +469,19 @@ public class IrisDimension extends IrisRegistrant {
private static final String DP_OVERWORLD_DEFAULT = """
{
"name": "minecraft:overworld",
"ultrawarm": false,
"natural": true,
"coordinate_scale": 1.0,
"has_skylight": true,
"has_ceiling": false,
"ambient_light": 0,
"fixed_time": false,
"piglin_safe": false,
"bed_works": true,
"respawn_anchor_works": false,
"has_raids": true,
"infiniburn": "infiniburn_overworld",
"monster_spawn_block_light_limit": 7,
"monster_spawn_light_level": 1,
"infiniburn": "#minecraft:infiniburn_overworld",
"effects": "minecraft:overworld"
}""";
}

View File

@@ -19,21 +19,17 @@
package com.volmit.iris.engine.object;
import com.volmit.iris.Iris;
import com.volmit.iris.engine.object.annotations.Desc;
import com.volmit.iris.engine.object.annotations.MaxNumber;
import com.volmit.iris.engine.object.annotations.MinNumber;
import com.volmit.iris.engine.object.annotations.Required;
import com.volmit.iris.engine.object.annotations.Snippet;
import com.volmit.iris.engine.object.annotations.*;
import com.volmit.iris.util.math.RNG;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.bukkit.NamespacedKey;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.meta.EnchantmentStorageMeta;
import org.bukkit.inventory.meta.ItemMeta;
import java.lang.reflect.Field;
@Snippet("enchantment")
@Accessors(chain = true)
@@ -43,8 +39,9 @@ import java.lang.reflect.Field;
@Data
public class IrisEnchantment {
@Required
@RegistryListEnchantment
@Desc("The enchantment")
private String enchantment = "";
private String enchantment;
@MinNumber(1)
@Desc("Minimum amount of this loot")
@@ -61,12 +58,17 @@ public class IrisEnchantment {
public void apply(RNG rng, ItemMeta meta) {
try {
Enchantment enchant = Enchantment.getByKey(NamespacedKey.minecraft(getEnchantment()));
if(enchant == null) {
Iris.warn("Unknown Enchantment: " + getEnchantment());
return;
}
if(rng.nextDouble() < chance) {
if(meta instanceof EnchantmentStorageMeta) {
((EnchantmentStorageMeta) meta).addStoredEnchant(getEnchant(), getLevel(rng), true);
((EnchantmentStorageMeta) meta).addStoredEnchant(enchant, getLevel(rng), true);
return;
}
meta.addEnchant(getEnchant(), getLevel(rng), true);
meta.addEnchant(enchant, getLevel(rng), true);
}
} catch(Throwable e) {
Iris.reportError(e);
@@ -74,21 +76,6 @@ public class IrisEnchantment {
}
}
public Enchantment getEnchant() {
for(Field i : Enchantment.class.getDeclaredFields()) {
if(i.getType().equals(Enchantment.class) && i.getName().equals(getEnchantment())) {
try {
return (Enchantment) i.get(null);
} catch(IllegalArgumentException | IllegalAccessException e) {
e.printStackTrace();
Iris.reportError(e);
}
}
}
return null;
}
public int getLevel(RNG rng) {
return rng.i(getMinLevel(), getMaxLevel());
}

View File

@@ -25,6 +25,7 @@ import com.volmit.iris.engine.object.annotations.MaxNumber;
import com.volmit.iris.engine.object.annotations.MinNumber;
import com.volmit.iris.engine.object.annotations.RegistryListResource;
import com.volmit.iris.engine.object.annotations.Snippet;
import com.volmit.iris.util.interpolation.IrisInterpolation;
import com.volmit.iris.util.math.RNG;
import com.volmit.iris.util.noise.CNG;
import com.volmit.iris.util.noise.ExpressionNoise;
@@ -34,6 +35,8 @@ import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.util.Objects;
@Snippet("style")
@Accessors(chain = true)
@NoArgsConstructor
@@ -50,7 +53,6 @@ public class IrisGeneratorStyle {
@Desc("Cell zooms")
private double cellularZoom = 1;
@MinNumber(0.00001)
@Desc("The zoom of this style")
private double zoom = 1;
@@ -70,6 +72,10 @@ public class IrisGeneratorStyle {
@MaxNumber(64)
@Desc("The exponent")
private double exponent = 1;
@MinNumber(0)
@MaxNumber(8192)
@Desc("If the cache size is set above 0, this generator will be cached")
private int cacheSize = 0;
public IrisGeneratorStyle(NoiseStyle s) {
this.style = s;
@@ -81,6 +87,18 @@ public class IrisGeneratorStyle {
}
public CNG createNoCache(RNG rng, IrisData data) {
return createNoCache(rng, data, false);
}
private int hash()
{
return Objects.hash(expression, imageMap, multiplier, axialFracturing, fracture != null ? fracture.hash() : 0, exponent, cacheSize, zoom, cellularZoom, cellularFrequency, style);
}
public CNG createNoCache(RNG rng, IrisData data, boolean actuallyCached) {
String cacheKey = hash() + "";
if(getExpression() != null) {
IrisExpression e = data.getExpressionLoader().load(getExpression());
@@ -128,8 +146,13 @@ public class IrisGeneratorStyle {
return cng;
}
public double warp(RNG rng, IrisData data, double value, double... coords)
{
return create(rng, data).noise(coords) + value;
}
public CNG create(RNG rng, IrisData data) {
return cng.aquire(() -> createNoCache(rng, data));
return cng.aquire(() -> createNoCache(rng, data, true));
}
@SuppressWarnings("BooleanMethodIsAlwaysInverted")

View File

@@ -20,6 +20,7 @@ package com.volmit.iris.engine.object;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import com.volmit.iris.Iris;
import com.volmit.iris.core.service.ExternalDataSVC;
import com.volmit.iris.engine.data.cache.AtomicCache;
import com.volmit.iris.engine.object.annotations.ArrayType;
import com.volmit.iris.engine.object.annotations.Desc;
@@ -35,19 +36,17 @@ import com.volmit.iris.util.format.C;
import com.volmit.iris.util.format.Form;
import com.volmit.iris.util.json.JSONObject;
import com.volmit.iris.util.math.RNG;
import com.volmit.iris.util.nbt.io.NBTUtil;
import com.volmit.iris.util.noise.CNG;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtUtils;
import net.minecraft.nbt.TagParser;
import net.minecraft.server.commands.GiveCommand;
import org.bukkit.DyeColor;
import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_18_R1.inventory.CraftItemStack;
import org.bukkit.NamespacedKey;
import org.bukkit.craftbukkit.v1_19_R1.inventory.CraftItemStack;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.Damageable;
@@ -56,6 +55,7 @@ import org.bukkit.inventory.meta.LeatherArmorMeta;
import org.bukkit.material.Colorable;
import java.awt.Color;
import java.util.Optional;
@Snippet("loot")
@Accessors(chain = true)
@@ -105,7 +105,7 @@ public class IrisLoot {
private KList<String> lore = new KList<>();
@RegistryListItemType
@Required
@Desc("This is the item or block type. Does not accept minecraft:*. Only materials such as DIAMOND_SWORD or DIRT.")
@Desc("This is the item or block type. Does not accept minecraft:*, only materials such as DIAMOND_SWORD or DIRT. The exception are modded materials, as they require a namespace.")
private String type = "";
@Desc("The dye color")
private DyeColor dyeColor = null;
@@ -120,77 +120,15 @@ public class IrisLoot {
public ItemStack get(boolean debug, RNG rng) {
try {
ItemStack is = new ItemStack(getType(), Math.max(1, rng.i(getMinAmount(), getMaxAmount())));
ItemMeta m = is.getItemMeta();
if(getType().getMaxDurability() > 0 && m instanceof Damageable d) {
int max = getType().getMaxDurability();
d.setDamage((int) Math.round(Math.max(0, Math.min(max, (1D - rng.d(getMinDurability(), getMaxDurability())) * max))));
}
for(IrisEnchantment i : getEnchantments()) {
i.apply(rng, m);
}
for(IrisAttributeModifier i : getAttributes()) {
i.apply(rng, m);
}
try {
m.setCustomModelData(getCustomModel());
} catch(Throwable e) {
Iris.reportError(e);
}
m.setLocalizedName(C.translateAlternateColorCodes('&', displayName));
m.setDisplayName(C.translateAlternateColorCodes('&', displayName));
m.setUnbreakable(isUnbreakable());
for(ItemFlag i : getItemFlags()) {
m.addItemFlags(i);
}
KList<String> lore = new KList<>();
getLore().forEach((i) ->
{
String mf = C.translateAlternateColorCodes('&', i);
if(mf.length() > 24) {
for(String g : Form.wrapWords(mf, 24).split("\\Q\n\\E")) {
lore.add(g.trim());
}
} else {
lore.add(mf);
}
});
if(debug) {
if(lore.isNotEmpty()) {
lore.add(C.GRAY + "--------------------");
}
lore.add(C.GRAY + "1 in " + (getRarity()) + " Chance (" + Form.pc(1D / (getRarity()), 5) + ")");
}
m.setLore(lore);
if(getLeatherColor() != null && m instanceof LeatherArmorMeta) {
Color c = Color.decode(getLeatherColor());
((LeatherArmorMeta) m).setColor(org.bukkit.Color.fromRGB(c.getRed(), c.getGreen(), c.getBlue()));
}
if(getDyeColor() != null && m instanceof Colorable) {
((Colorable) m).setColor(getDyeColor());
}
is.setItemMeta(m);
ItemStack is = getItemStack(rng);
if(is == null)
return new ItemStack(Material.AIR);
is.setItemMeta(applyProperties(is, rng, debug, null));
return applyCustomNbt(is);
} catch(Throwable e) {
Iris.reportError(e);
return new ItemStack(Material.AIR);
}
return new ItemStack(Material.AIR);
}
public ItemStack get(boolean debug, boolean giveSomething, IrisLootTable table, RNG rng, int x, int y, int z) {
@@ -199,77 +137,113 @@ public class IrisLoot {
}
if(giveSomething || chance.aquire(() -> NoiseStyle.STATIC.create(rng)).fit(1, rarity * table.getRarity(), x, y, z) == 1) {
if(getType() == null) {
Iris.warn("Cant find item type " + type);
return null;
}
try {
ItemStack is = new ItemStack(getType(), Math.max(1, rng.i(getMinAmount(), getMaxAmount())));
ItemMeta m = is.getItemMeta();
if(getType().getMaxDurability() > 0 && m instanceof Damageable d) {
int max = getType().getMaxDurability();
d.setDamage((int) Math.round(Math.max(0, Math.min(max, (1D - rng.d(getMinDurability(), getMaxDurability())) * max))));
}
for(IrisEnchantment i : getEnchantments()) {
i.apply(rng, m);
}
for(IrisAttributeModifier i : getAttributes()) {
i.apply(rng, m);
}
try {
m.setCustomModelData(getCustomModel());
} catch(Throwable e) {
Iris.reportError(e);
}
m.setLocalizedName(C.translateAlternateColorCodes('&', displayName));
m.setDisplayName(C.translateAlternateColorCodes('&', displayName));
m.setUnbreakable(isUnbreakable());
for(ItemFlag i : getItemFlags()) {
m.addItemFlags(i);
}
KList<String> lore = new KList<>();
getLore().forEach((i) ->
{
String mf = C.translateAlternateColorCodes('&', i);
if(mf.length() > 24) {
for(String g : Form.wrapWords(mf, 24).split("\\Q\n\\E")) {
lore.add(g.trim());
}
} else {
lore.add(mf);
}
});
if(debug) {
if(lore.isNotEmpty()) {
lore.add(C.GRAY + "--------------------");
}
lore.add(C.GRAY + "From: " + table.getName() + " (" + Form.pc(1D / table.getRarity(), 5) + ")");
lore.add(C.GRAY + "1 in " + (table.getRarity() * getRarity()) + " Chance (" + Form.pc(1D / (table.getRarity() * getRarity()), 5) + ")");
}
m.setLore(lore);
is.setItemMeta(m);
ItemStack is = getItemStack(rng);
if(is == null)
return null;
is.setItemMeta(applyProperties(is, rng, debug, table));
return applyCustomNbt(is);
} catch(Throwable e) {
Iris.reportError(e);
//Iris.reportError(e);
e.printStackTrace();
}
}
return null;
}
// TODO Better Third Party Item Acquisition
private ItemStack getItemStack(RNG rng) {
if(!type.startsWith("minecraft:") && type.contains(":")) {
Optional<ItemStack> opt = Iris.service(ExternalDataSVC.class).getItemStack(NamespacedKey.fromString(type));
if(opt.isEmpty()) {
Iris.warn("Unknown Material: " + type);
return null;
}
ItemStack is = opt.get();
is.setAmount(Math.max(1, rng.i(getMinAmount(), getMaxAmount())));
return is;
}
return new ItemStack(getType(), Math.max(1, rng.i(getMinAmount(), getMaxAmount())));
}
private ItemMeta applyProperties(ItemStack is, RNG rng, boolean debug, IrisLootTable table) {
ItemMeta m = is.getItemMeta();
if(m == null) {
return null;
}
for(IrisEnchantment i : getEnchantments()) {
i.apply(rng, m);
}
for(IrisAttributeModifier i : getAttributes()) {
i.apply(rng, m);
}
m.setUnbreakable(isUnbreakable());
for(ItemFlag i : getItemFlags()) {
m.addItemFlags(i);
}
if(getCustomModel() != null) {
m.setCustomModelData(getCustomModel());
}
if(is.getType().getMaxDurability() > 0 && m instanceof Damageable d) {
int max = is.getType().getMaxDurability();
d.setDamage((int) Math.round(Math.max(0, Math.min(max, (1D - rng.d(getMinDurability(), getMaxDurability())) * max))));
}
if(getLeatherColor() != null && m instanceof LeatherArmorMeta leather) {
Color c = Color.decode(getLeatherColor());
leather.setColor(org.bukkit.Color.fromRGB(c.getRed(), c.getGreen(), c.getBlue()));
}
if(getDyeColor() != null && m instanceof Colorable colorable) {
colorable.setColor(getDyeColor());
}
m.setLocalizedName(C.translateAlternateColorCodes('&', displayName));
m.setDisplayName(C.translateAlternateColorCodes('&', displayName));
KList<String> lore = new KList<>();
getLore().forEach((i) ->
{
String mf = C.translateAlternateColorCodes('&', i);
if(mf.length() > 24) {
for(String g : Form.wrapWords(mf, 24).split("\\Q\n\\E")) {
lore.add(g.trim());
}
} else {
lore.add(mf);
}
});
if(debug) {
if(table == null) {
if(lore.isNotEmpty()) {
lore.add(C.GRAY + "--------------------");
}
lore.add(C.GRAY + "1 in " + (getRarity()) + " Chance (" + Form.pc(1D / (getRarity()), 5) + ")");
} else {
if(lore.isNotEmpty()) {
lore.add(C.GRAY + "--------------------");
}
lore.add(C.GRAY + "From: " + table.getName() + " (" + Form.pc(1D / table.getRarity(), 5) + ")");
lore.add(C.GRAY + "1 in " + (table.getRarity() * getRarity()) + " Chance (" + Form.pc(1D / (table.getRarity() * getRarity()), 5) + ")");
}
}
m.setLore(lore);
return m;
}
private ItemStack applyCustomNbt(ItemStack stack) throws CommandSyntaxException {
if(customNbt == null || customNbt.isEmpty())
return stack;
@@ -277,7 +251,6 @@ public class IrisLoot {
CompoundTag tag = TagParser.parseTag(new JSONObject(customNbt).toString());
tag.merge(s.getOrCreateTag());
s.setTag(tag);
System.out.println(customNbt);
return CraftItemStack.asBukkitCopy(s);
}
}

View File

@@ -34,6 +34,8 @@ import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.bukkit.block.data.BlockData;
import java.util.Optional;
@Snippet("palette")
@Accessors(chain = true)
@NoArgsConstructor
@@ -66,6 +68,14 @@ public class IrisMaterialPalette {
return getLayerGenerator(rng, rdata).fit(getBlockData(rdata), x / zoom, y / zoom, z / zoom);
}
public Optional<TileData<?>> getTile(RNG rng, double x, double y, double z, IrisData rdata) {
if(getBlockData(rdata).isEmpty())
return Optional.empty();
TileData<?> tile = getBlockData(rdata).size() == 1 ? palette.get(0).tryGetTile() : palette.getRandom(rng).tryGetTile();
return tile != null ? Optional.of(tile) : Optional.empty();
}
public CNG getLayerGenerator(RNG rng, IrisData rdata) {
return layerGenerator.aquire(() ->
{

View File

@@ -47,9 +47,11 @@ import lombok.experimental.Accessors;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState;
import org.bukkit.block.TileState;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.MultipleFacing;
import org.bukkit.block.data.Waterlogged;
import org.bukkit.block.data.type.Leaves;
import org.bukkit.util.BlockVector;
@@ -63,11 +65,7 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Consumer;
@@ -510,7 +508,9 @@ public class IrisObject extends IrisRegistrant {
}
boolean warped = !config.getWarp().isFlat();
boolean stilting = (config.getMode().equals(ObjectPlaceMode.STILT) || config.getMode().equals(ObjectPlaceMode.FAST_STILT));
boolean stilting = (config.getMode().equals(ObjectPlaceMode.STILT) || config.getMode().equals(ObjectPlaceMode.FAST_STILT) ||
config.getMode() == ObjectPlaceMode.MIN_STILT || config.getMode() == ObjectPlaceMode.FAST_MIN_STILT ||
config.getMode() == ObjectPlaceMode.CENTER_STILT);
KMap<Position2, Integer> heightmap = config.getSnow() > 0 ? new KMap<>() : null;
int spinx = rng.imax() / 1000;
int spiny = rng.imax() / 1000;
@@ -524,7 +524,7 @@ public class IrisObject extends IrisRegistrant {
boolean bail = false;
if(yv < 0) {
if(config.getMode().equals(ObjectPlaceMode.CENTER_HEIGHT)) {
if(config.getMode().equals(ObjectPlaceMode.CENTER_HEIGHT) || config.getMode() == ObjectPlaceMode.CENTER_STILT) {
y = (c != null ? c.getSurface() : placer.getHighest(x, z, getLoader(), config.isUnderwater())) + rty;
if(placer.isCarved(x, y, z) || placer.isCarved(x, y - 1, z) || placer.isCarved(x, y - 2, z) || placer.isCarved(x, y - 3, z)) {
bail = true;
@@ -532,48 +532,62 @@ public class IrisObject extends IrisRegistrant {
} else if(config.getMode().equals(ObjectPlaceMode.MAX_HEIGHT) || config.getMode().equals(ObjectPlaceMode.STILT)) {
BlockVector offset = new BlockVector(config.getTranslate().getX(), config.getTranslate().getY(), config.getTranslate().getZ());
BlockVector rotatedDimensions = config.getRotation().rotate(new BlockVector(getW(), getH(), getD()), spinx, spiny, spinz).clone();
for(int i = x - (rotatedDimensions.getBlockX() / 2) + offset.getBlockX(); i <= x + (rotatedDimensions.getBlockX() / 2) + offset.getBlockX(); i++) {
for(int j = z - (rotatedDimensions.getBlockZ() / 2) + offset.getBlockZ(); j <= z + (rotatedDimensions.getBlockZ() / 2) + offset.getBlockZ(); j++) {
int h = placer.getHighest(i, j, getLoader(), config.isUnderwater()) + rty;
if(placer.isCarved(i, h, j) || placer.isCarved(i, h - 1, j) || placer.isCarved(i, h - 2, j) || placer.isCarved(i, h - 3, j)) {
int xLength = (rotatedDimensions.getBlockX() / 2) + offset.getBlockX();
int minX = Math.min(x - xLength, x + xLength);
int maxX = Math.max(x - xLength, x + xLength);
int zLength = (rotatedDimensions.getBlockZ() / 2) + offset.getBlockZ();
int minZ = Math.min(z - zLength, z + zLength);
int maxZ = Math.max(z - zLength, z + zLength);
for(int i = minX; i <= maxX; i++) {
for(int ii = minZ; ii <= maxZ; ii++) {
int h = placer.getHighest(i, ii, getLoader(), config.isUnderwater()) + rty;
if(placer.isCarved(i, h, ii) || placer.isCarved(i, h - 1, ii) || placer.isCarved(i, h - 2, ii) || placer.isCarved(i, h - 3, ii)) {
bail = true;
break;
}
if(h > y) {
if(h > y)
y = h;
}
}
}
} else if(config.getMode().equals(ObjectPlaceMode.FAST_MAX_HEIGHT) || config.getMode().equals(ObjectPlaceMode.FAST_STILT)) {
BlockVector offset = new BlockVector(config.getTranslate().getX(), config.getTranslate().getY(), config.getTranslate().getZ());
BlockVector rotatedDimensions = config.getRotation().rotate(new BlockVector(getW(), getH(), getD()), spinx, spiny, spinz).clone();
for(int i = x - (rotatedDimensions.getBlockX() / 2) + offset.getBlockX(); i <= x + (rotatedDimensions.getBlockX() / 2) + offset.getBlockX(); i += (rotatedDimensions.getBlockX() / 2) + 1) {
for(int j = z - (rotatedDimensions.getBlockZ() / 2) + offset.getBlockZ(); j <= z + (rotatedDimensions.getBlockZ() / 2) + offset.getBlockZ(); j += (rotatedDimensions.getBlockZ() / 2) + 1) {
int h = placer.getHighest(i, j, getLoader(), config.isUnderwater()) + rty;
int xRadius = (rotatedDimensions.getBlockX() / 2);
int xLength = xRadius + offset.getBlockX();
int minX = Math.min(x - xLength, x + xLength);
int maxX = Math.max(x - xLength, x + xLength);
int zRadius = (rotatedDimensions.getBlockZ() / 2);
int zLength = zRadius + offset.getBlockZ();
int minZ = Math.min(z - zLength, z + zLength);
int maxZ = Math.max(z - zLength, z + zLength);
if(placer.isCarved(i, h, j) || placer.isCarved(i, h - 1, j) || placer.isCarved(i, h - 2, j) || placer.isCarved(i, h - 3, j)) {
for(int i = minX; i <= maxX; i += Math.abs(xRadius) + 1) {
for(int ii = minZ; ii <= maxZ; ii += Math.abs(zRadius) + 1) {
int h = placer.getHighest(i, ii, getLoader(), config.isUnderwater()) + rty;
if(placer.isCarved(i, h, ii) || placer.isCarved(i, h - 1, ii) || placer.isCarved(i, h - 2, ii) || placer.isCarved(i, h - 3, ii)) {
bail = true;
break;
}
if(h > y) {
if(h > y)
y = h;
}
}
}
} else if(config.getMode().equals(ObjectPlaceMode.MIN_HEIGHT)) {
y = 257;
} else if(config.getMode().equals(ObjectPlaceMode.MIN_HEIGHT) || config.getMode() == ObjectPlaceMode.MIN_STILT) {
y = rdata.getEngine().getHeight() + 1;
BlockVector offset = new BlockVector(config.getTranslate().getX(), config.getTranslate().getY(), config.getTranslate().getZ());
BlockVector rotatedDimensions = config.getRotation().rotate(new BlockVector(getW(), getH(), getD()), spinx, spiny, spinz).clone();
for(int i = x - (rotatedDimensions.getBlockX() / 2) + offset.getBlockX(); i <= x + (rotatedDimensions.getBlockX() / 2) + offset.getBlockX(); i++) {
for(int j = z - (rotatedDimensions.getBlockZ() / 2) + offset.getBlockZ(); j <= z + (rotatedDimensions.getBlockZ() / 2) + offset.getBlockZ(); j++) {
int h = placer.getHighest(i, j, getLoader(), config.isUnderwater()) + rty;
if(placer.isCarved(i, h, j) || placer.isCarved(i, h - 1, j) || placer.isCarved(i, h - 2, j) || placer.isCarved(i, h - 3, j)) {
int xLength = (rotatedDimensions.getBlockX() / 2) + offset.getBlockX();
int minX = Math.min(x - xLength, x + xLength);
int maxX = Math.max(x - xLength, x + xLength);
int zLength = (rotatedDimensions.getBlockZ() / 2) + offset.getBlockZ();
int minZ = Math.min(z - zLength, z + zLength);
int maxZ = Math.max(z - zLength, z + zLength);
for(int i = minX; i <= maxX; i++) {
for(int ii = minZ; ii <= maxZ; ii++) {
int h = placer.getHighest(i, ii, getLoader(), config.isUnderwater()) + rty;
if(placer.isCarved(i, h, ii) || placer.isCarved(i, h - 1, ii) || placer.isCarved(i, h - 2, ii) || placer.isCarved(i, h - 3, ii)) {
bail = true;
break;
}
@@ -582,15 +596,24 @@ public class IrisObject extends IrisRegistrant {
}
}
}
} else if(config.getMode().equals(ObjectPlaceMode.FAST_MIN_HEIGHT)) {
y = 257;
} else if(config.getMode().equals(ObjectPlaceMode.FAST_MIN_HEIGHT) || config.getMode() == ObjectPlaceMode.FAST_MIN_STILT) {
y = rdata.getEngine().getHeight() + 1;
BlockVector offset = new BlockVector(config.getTranslate().getX(), config.getTranslate().getY(), config.getTranslate().getZ());
BlockVector rotatedDimensions = config.getRotation().rotate(new BlockVector(getW(), getH(), getD()), spinx, spiny, spinz).clone();
for(int i = x - (rotatedDimensions.getBlockX() / 2) + offset.getBlockX(); i <= x + (rotatedDimensions.getBlockX() / 2) + offset.getBlockX(); i += (rotatedDimensions.getBlockX() / 2) + 1) {
for(int j = z - (rotatedDimensions.getBlockZ() / 2) + offset.getBlockZ(); j <= z + (rotatedDimensions.getBlockZ() / 2) + offset.getBlockZ(); j += (rotatedDimensions.getBlockZ() / 2) + 1) {
int h = placer.getHighest(i, j, getLoader(), config.isUnderwater()) + rty;
if(placer.isCarved(i, h, j) || placer.isCarved(i, h - 1, j) || placer.isCarved(i, h - 2, j) || placer.isCarved(i, h - 3, j)) {
int xRadius = (rotatedDimensions.getBlockX() / 2);
int xLength = xRadius + offset.getBlockX();
int minX = Math.min(x - xLength, x + xLength);
int maxX = Math.max(x - xLength, x + xLength);
int zRadius = (rotatedDimensions.getBlockZ() / 2);
int zLength = zRadius + offset.getBlockZ();
int minZ = Math.min(z - zLength, z + zLength);
int maxZ = Math.max(z - zLength, z + zLength);
for(int i = minX; i <= maxX; i += Math.abs(xRadius) + 1) {
for(int ii = minZ; ii <= maxZ; ii += Math.abs(zRadius) + 1) {
int h = placer.getHighest(i, ii, getLoader(), config.isUnderwater()) + rty;
if(placer.isCarved(i, h, ii) || placer.isCarved(i, h - 1, ii) || placer.isCarved(i, h - 2, ii) || placer.isCarved(i, h - 3, ii)) {
bail = true;
break;
}
@@ -731,10 +754,16 @@ public class IrisObject extends IrisRegistrant {
if(j.isExact() ? k.matches(data) : k.getMaterial().equals(data.getMaterial())) {
BlockData newData = j.getReplace(rng, i.getX() + x, i.getY() + y, i.getZ() + z, rdata).clone();
if(newData.getMaterial() == data.getMaterial()) {
if(newData.getMaterial() == data.getMaterial())
data = data.merge(newData);
} else {
else
data = newData;
if(newData.getMaterial() == Material.SPAWNER) {
Optional<TileData<?>> t = j.getReplace().getTile(rng, x, y, z, rdata);
if(t.isPresent()) {
tile = t.get();
}
}
}
}
@@ -743,6 +772,7 @@ public class IrisObject extends IrisRegistrant {
data = config.getRotation().rotate(data, spinx, spiny, spinz);
xx = x + (int) Math.round(i.getX());
int yy = y + (int) Math.round(i.getY());
zz = z + (int) Math.round(i.getZ());
@@ -751,7 +781,7 @@ public class IrisObject extends IrisRegistrant {
zz += config.warp(rng, i.getZ() + z, i.getY() + y, i.getX() + x, getLoader());
}
if(yv < 0 && (config.getMode().equals(ObjectPlaceMode.PAINT))) {
if(yv < 0 && (config.getMode().equals(ObjectPlaceMode.PAINT)) && !B.isVineBlock(data)) {
yy = (int) Math.round(i.getY()) + Math.floorDiv(h, 2) + placer.getHighest(xx, zz, getLoader(), config.isUnderwater());
}
@@ -771,10 +801,20 @@ public class IrisObject extends IrisRegistrant {
continue;
}
if(config.isWaterloggable() && yy <= placer.getFluidHeight() && data instanceof Waterlogged) {
if((config.isWaterloggable() || config.isUnderwater()) && yy <= placer.getFluidHeight() && data instanceof Waterlogged) {
((Waterlogged) data).setWaterlogged(true);
}
if(B.isVineBlock(data)) {
MultipleFacing f = (MultipleFacing)data;
for(BlockFace face : f.getAllowedFaces()) {
BlockData facingBlock = placer.get(xx + face.getModX(), yy + face.getModY(), zz + face.getModZ());
if(B.isSolid(facingBlock) && !B.isVineBlock(facingBlock)) {
f.setFace(face, true);
}
}
}
if(listener != null) {
listener.accept(new BlockPosition(xx, yy, zz));
}
@@ -783,9 +823,10 @@ public class IrisObject extends IrisRegistrant {
placer.getEngine().getMantle().getMantle().set(xx, yy, zz, new MatterMarker(markers.get(g)));
}
if(!data.getMaterial().equals(Material.AIR) && !data.getMaterial().equals(Material.CAVE_AIR)) {
placer.set(xx, yy, zz, data);
boolean wouldReplace = B.isSolid(placer.get(xx, yy, zz)) && B.isVineBlock(data);
if(!data.getMaterial().equals(Material.AIR) && !data.getMaterial().equals(Material.CAVE_AIR) && !wouldReplace) {
placer.set(xx, yy, zz, data);
if(tile != null) {
placer.setTile(xx, yy, zz, tile);
}
@@ -798,34 +839,53 @@ public class IrisObject extends IrisRegistrant {
if(stilting) {
readLock.lock();
IrisStiltSettings settings = config.getStiltSettings();
for(BlockVector g : getBlocks().keySet()) {
BlockData d;
try {
d = getBlocks().get(g);
} catch(Throwable e) {
Iris.reportError(e);
Iris.warn("Failed to read block node " + g.getBlockX() + "," + g.getBlockY() + "," + g.getBlockZ() + " in object " + getLoadKey() + " (stilt cme)");
d = AIR;
}
if(settings == null || settings.getPalette() == null) {
try {
d = getBlocks().get(g);
} catch(Throwable e) {
Iris.reportError(e);
Iris.warn("Failed to read block node " + g.getBlockX() + "," + g.getBlockY() + "," + g.getBlockZ() + " in object " + getLoadKey() + " (stilt cme)");
d = AIR;
}
if(d == null) {
Iris.warn("Failed to read block node " + g.getBlockX() + "," + g.getBlockY() + "," + g.getBlockZ() + " in object " + getLoadKey() + " (stilt null)");
d = AIR;
}
} else
d = config.getStiltSettings().getPalette().get(rng, x, y, z, rdata);
if(d == null) {
Iris.warn("Failed to read block node " + g.getBlockX() + "," + g.getBlockY() + "," + g.getBlockZ() + " in object " + getLoadKey() + " (stilt null)");
d = AIR;
}
BlockVector i = g.clone();
i = config.getRotation().rotate(i.clone(), spinx, spiny, spinz).clone();
i = config.getTranslate().translate(i.clone(), config.getRotation(), spinx, spiny, spinz).clone();
d = config.getRotation().rotate(d, spinx, spiny, spinz);
if(i.getBlockY() != lowest) {
if(i.getBlockY() != lowest)
continue;
for(IrisObjectReplace j : config.getEdit()) {
if(rng.chance(j.getChance())) {
for(BlockData k : j.getFind(rdata)) {
if(j.isExact() ? k.matches(d) : k.getMaterial().equals(d.getMaterial())) {
BlockData newData = j.getReplace(rng, i.getX() + x, i.getY() + y, i.getZ() + z, rdata).clone();
if(newData.getMaterial() == d.getMaterial()) {
d = d.merge(newData);
} else {
d = newData;
}
}
}
}
}
if(d == null || B.isAir(d)) {
if(d == null || B.isAir(d))
continue;
}
xx = x + (int) Math.round(i.getX());
zz = z + (int) Math.round(i.getZ());
@@ -835,15 +895,33 @@ public class IrisObject extends IrisRegistrant {
zz += config.warp(rng, i.getZ() + z, i.getY() + y, i.getX() + x, getLoader());
}
int yg = placer.getHighest(xx, zz, getLoader(), config.isUnderwater());
int highest = placer.getHighest(xx, zz, getLoader(), true);
if(yv >= 0 && config.isBottom()) {
if((config.isWaterloggable() || config.isUnderwater()) && highest <= placer.getFluidHeight() && d instanceof Waterlogged)
((Waterlogged) d).setWaterlogged(true);
if(yv >= 0 && config.isBottom())
y += Math.floorDiv(h, 2);
}
for(int j = lowest + y; j > yg - config.getOverStilt() - 1; j--) {
int lowerBound = highest - 1;
if(settings != null) {
lowerBound -= config.getStiltSettings().getOverStilt() - rng.i(0, config.getStiltSettings().getYRand());
if(settings.getYMax() != 0)
lowerBound -= Math.min(config.getStiltSettings().getYMax() - (lowest + y - highest), 0);
}
for(int j = lowest + y; j > lowerBound; j--) {
if(B.isVineBlock(d)) {
MultipleFacing f = (MultipleFacing)d;
for(BlockFace face : f.getAllowedFaces()) {
BlockData facingBlock = placer.get(xx + face.getModX(), j + face.getModY(), zz + face.getModZ());
if(B.isSolid(facingBlock) && !B.isVineBlock(facingBlock)) {
f.setFace(face, true);
}
}
}
placer.set(xx, j, zz, d);
}
}
readLock.unlock();
@@ -1116,7 +1194,5 @@ public class IrisObject extends IrisRegistrant {
}
@Override
public void scanForErrors(JSONObject p, VolmitSender sender) {
}
public void scanForErrors(JSONObject p, VolmitSender sender) { }
}

View File

@@ -35,14 +35,14 @@ import lombok.experimental.Accessors;
@Data
public class IrisObjectLimit {
@MinNumber(0)
@MaxNumber(255)
@MaxNumber(1024)
@Desc("The minimum height for placement (bottom of object)")
private int minimumHeight = 0;
private int minimumHeight = -2048; //TODO: WARNING HEIGHT
@MinNumber(0)
@MaxNumber(255)
@MaxNumber(1024)
@Desc("The maximum height for placement (top of object)")
private int maximumHeight = 255;
private int maximumHeight = 2048; //TODO: WARNING HEIGHT
public boolean canPlace(int h, int l) {
return h <= maximumHeight && l >= minimumHeight;

View File

@@ -75,10 +75,8 @@ public class IrisObjectPlacement {
private int density = 1;
@Desc("If the chance check passes, and you specify this, it picks a number in the range based on noise, and 'density' is ignored.")
private IrisStyledRange densityStyle = null;
@MaxNumber(64)
@MinNumber(0)
@Desc("If the place mode is set to stilt, you can over-stilt it even further into the ground. Especially useful when using fast stilt due to inaccuracies.")
private int overStilt = 0;
@Desc("When stilting is enabled, this object will define various properties related to it.")
private IrisStiltSettings stiltSettings;
@MaxNumber(64)
@MinNumber(0)
@Desc("When bore is enabled, expand max-y of the cuboid it removes")
@@ -146,7 +144,7 @@ public class IrisObjectPlacement {
p.setUnderwater(underwater);
p.setBoreExtendMaxY(boreExtendMaxY);
p.setBoreExtendMinY(boreExtendMinY);
p.setOverStilt(overStilt);
p.setStiltSettings(stiltSettings);
p.setDensity(density);
p.setChance(chance);
p.setSnow(snow);

View File

@@ -42,9 +42,9 @@ public class IrisObjectTranslate {
private int x = 0;
@Required
@MinNumber(-256) // TODO: WARNING HEIGHT
@MaxNumber(256) // TODO: WARNING HEIGHT
@Desc("The x shift in blocks")
@MinNumber(-128) // TODO: WARNING HEIGHT
@MaxNumber(128) // TODO: WARNING HEIGHT
@Desc("The y shift in blocks")
private int y = 0;
@MinNumber(-128) // TODO: WARNING HEIGHT
@@ -54,7 +54,7 @@ public class IrisObjectTranslate {
@MinNumber(-128) // TODO: WARNING HEIGHT
@MaxNumber(128) // TODO: WARNING HEIGHT
@Desc("The x shift in blocks")
@Desc("The z shift in blocks")
private int z = 0;
public boolean canTranslate() {

View File

@@ -42,14 +42,14 @@ public class IrisShapedGeneratorStyle {
private IrisGeneratorStyle generator = new IrisGeneratorStyle(NoiseStyle.IRIS);
@Required
@MinNumber(-256) // TODO: WARNING HEIGHT
@MaxNumber(256) // TODO: WARNING HEIGHT
@MinNumber(-2032) // TODO: WARNING HEIGHT
@MaxNumber(2032) // TODO: WARNING HEIGHT
@Desc("The min block value")
private int min = 0;
@Required
@MinNumber(-256) // TODO: WARNING HEIGHT
@MaxNumber(256) // TODO: WARNING HEIGHT
@MinNumber(-2032) // TODO: WARNING HEIGHT
@MaxNumber(2032) // TODO: WARNING HEIGHT
@Desc("The max block value")
private int max = 0;

View File

@@ -35,12 +35,12 @@ import lombok.experimental.Accessors;
@Data
public class IrisSlopeClip {
@MinNumber(0)
@MaxNumber(255)
@MaxNumber(1024)
@Desc("The minimum slope for placement")
private double minimumSlope = 0;
@MinNumber(0)
@MaxNumber(255)
@MaxNumber(1024)
@Desc("The maximum slope for placement")
private double maximumSlope = 10;

View File

@@ -0,0 +1,34 @@
package com.volmit.iris.engine.object;
import com.volmit.iris.engine.object.annotations.Desc;
import com.volmit.iris.engine.object.annotations.MaxNumber;
import com.volmit.iris.engine.object.annotations.MinNumber;
import com.volmit.iris.engine.object.annotations.Snippet;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
@Snippet("stilt-settings")
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@Desc("Defines stilting behaviour.")
@Data
public class IrisStiltSettings {
@MinNumber(0)
@MaxNumber(64)
@Desc("Defines the maximum amount of blocks the object stilts verticially before overstilting and randomRange.")
private int yMax;
@MinNumber(0)
@MaxNumber(64)
@Desc("Defines the upper boundary for additional blocks after overstilting and/or maxStiltRange.")
private int yRand;
@MaxNumber(64)
@MinNumber(0)
@Desc("If the place mode is set to stilt, you can over-stilt it even further into the ground. Especially useful when using fast stilt due to inaccuracies.")
private int overStilt;
@Desc("If defined, stilting will be done using this block palette rather than the last layer of the object.")
private IrisMaterialPalette palette;
}

View File

@@ -463,7 +463,9 @@ public enum NoiseStyle {
}
public CNG create(RNG seed) {
return f.create(seed).bake();
CNG cng = f.create(seed).bake();
cng.setLeakStyle(this);
return cng;
}
public IrisGeneratorStyle style() {

View File

@@ -50,6 +50,18 @@ public enum ObjectPlaceMode {
FAST_STILT,
@Desc("Stilting is MIN_HEIGHT but it repeats the bottom most block of your object until it hits the surface. This is expensive because it has to first sample every height value for each x,z position of your object. Avoid using this unless its structures for performance reasons.")
MIN_STILT,
@Desc("Just like MIN_STILT but very inaccurate. Useful for stilting a lot of objects without too much care on accuracy (you can use the over-stilt value to force stilts under ground further)")
FAST_MIN_STILT,
@Desc("Stilting is CENTER_HEIGHT but it repeats the bottom most block of your object until it hits the surface. This is expensive because it has to first sample every height value for each x,z position of your object. Avoid using this unless its structures for performance reasons.")
CENTER_STILT,
@Desc("Samples the height of the terrain at every x,z position of your object and pushes it down to the surface. It's pretty much like a melt function over the terrain.")
PAINT

View File

@@ -98,7 +98,7 @@ public class TileBanner implements TileData<Banner> {
@SuppressWarnings("deprecation")
@Override
public void toNBT(CompoundTag tag) {
public CompoundTag toNBT(CompoundTag tag) {
@SuppressWarnings("unchecked") ListTag<CompoundTag> listTag = (ListTag<CompoundTag>) ListTag.createUnchecked(CompoundTag.class);
for(Pattern p : patterns) {
CompoundTag pattern = new CompoundTag();
@@ -107,6 +107,7 @@ public class TileBanner implements TileData<Banner> {
listTag.add(pattern);
}
tag.put("Patterns", listTag);
return tag;
}
public boolean isBanner(Material material) {

View File

@@ -29,11 +29,12 @@ import org.bukkit.block.data.BlockData;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
@SuppressWarnings("ALL")
public interface TileData<T extends TileState> extends Cloneable {
KList<TileData<? extends TileState>> registry = setup();
static final KList<TileData<? extends TileState>> registry = setup();
static KList<TileData<? extends TileState>> setup() {
KList<TileData<? extends TileState>> registry = new KList<>();
@@ -45,17 +46,21 @@ public interface TileData<T extends TileState> extends Cloneable {
return registry;
}
static TileData<? extends TileState> read(DataInputStream s) throws Throwable {
int id = s.readShort();
@SuppressWarnings("unchecked") TileData<? extends TileState> d = registry.get(id).getClass().getConstructor().newInstance();
d.fromBinary(s);
return d;
static TileData<? extends TileState> read(DataInputStream s) throws IOException {
try {
int id = s.readShort();
@SuppressWarnings("unchecked") TileData<? extends TileState> d = registry.get(id).getClass().getConstructor().newInstance();
d.fromBinary(s);
return d;
} catch(InvocationTargetException | InstantiationException | IllegalAccessException | NoSuchMethodException e) {
throw new IOException("Failed to create TileData instance due to missing type registrar!");
}
}
static void setTileState(Block block, TileData<? extends TileState> data) {
if(data.isApplicable(block.getBlockData())) {
data.toBukkitTry(block.getState());
}
static boolean setTileState(Block block, TileData<? extends TileState> data) {
if(block.getState() instanceof TileState && data.isApplicable(block.getBlockData()))
return data.toBukkitTry(block.getState());
return false;
}
static TileData<? extends TileState> getTileState(Block block) {
@@ -89,6 +94,7 @@ public interface TileData<T extends TileState> extends Cloneable {
try {
//noinspection unchecked
toBukkit((T) t);
t.update();
return true;
} catch(Throwable e) {
Iris.reportError(e);
@@ -111,11 +117,11 @@ public interface TileData<T extends TileState> extends Cloneable {
return false;
}
TileData<T> clone();
CompoundTag toNBT(CompoundTag parent);
void toBinary(DataOutputStream out) throws IOException;
void toNBT(CompoundTag tag);
void fromBinary(DataInputStream in) throws IOException;
TileData<T> clone();
}

View File

@@ -98,11 +98,12 @@ public class TileSign implements TileData<Sign> {
}
@Override
public void toNBT(CompoundTag tag) {
public CompoundTag toNBT(CompoundTag tag) {
tag.putString("Text1", line1);
tag.putString("Text2", line2);
tag.putString("Text3", line3);
tag.putString("Text4", line4);
tag.putString("Color", dyeColor.name().toLowerCase());
return tag;
}
}

View File

@@ -32,12 +32,13 @@ import java.io.IOException;
@Data
public class TileSpawner implements TileData<CreatureSpawner> {
public static final int id = 1;
private EntityType entityType;
public static final int id = 1;
private EntityType entityType;
@Override
public String getTileId() {
return "minecraft:spawner";
return "minecraft:mob_spawner";
}
@Override
@@ -75,7 +76,7 @@ public class TileSpawner implements TileData<CreatureSpawner> {
}
@Override
public void toNBT(CompoundTag tag) {
public CompoundTag toNBT(CompoundTag parent) {
@SuppressWarnings("unchecked") ListTag<CompoundTag> potentials = (ListTag<CompoundTag>) ListTag.createUnchecked(CompoundTag.class);
CompoundTag t = new CompoundTag();
CompoundTag ent = new CompoundTag();
@@ -83,6 +84,7 @@ public class TileSpawner implements TileData<CreatureSpawner> {
t.put("Entity", ent);
t.putInt("Weight", 1);
potentials.add(t);
tag.put("SpawnPotentials", potentials);
parent.put("SpawnPotentials", potentials);
return parent;
}
}

View File

@@ -0,0 +1,12 @@
package com.volmit.iris.engine.object.annotations;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
@Retention(RUNTIME)
@Target({PARAMETER, TYPE, FIELD})
public @interface RegistryListEnchantment {
}

View File

@@ -0,0 +1,58 @@
package com.volmit.iris.engine.object.matter;
import com.volmit.iris.core.loader.IrisRegistrant;
import com.volmit.iris.engine.object.IrisObject;
import com.volmit.iris.util.json.JSONObject;
import com.volmit.iris.util.matter.IrisMatter;
import com.volmit.iris.util.matter.Matter;
import com.volmit.iris.util.plugin.VolmitSender;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.File;
import java.io.IOException;
@Data
@EqualsAndHashCode(callSuper = false)
public class IrisMatterObject extends IrisRegistrant {
private final Matter matter;
public IrisMatterObject()
{
this(1,1,1);
}
public IrisMatterObject(int w, int h, int d)
{
this(new IrisMatter(w,h,d));
}
public IrisMatterObject(Matter matter)
{
this.matter = matter;
}
public static IrisMatterObject from(IrisObject object)
{
return new IrisMatterObject(Matter.from(object));
}
public static IrisMatterObject from(File j) throws IOException, ClassNotFoundException {
return new IrisMatterObject(Matter.read(j));
}
@Override
public String getFolderName() {
return "matter";
}
@Override
public String getTypeName() {
return "Matter";
}
@Override
public void scanForErrors(JSONObject p, VolmitSender sender) {
}
}

View File

@@ -0,0 +1,93 @@
/*
* Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2022 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.volmit.iris.engine.object.matter;
import com.volmit.iris.core.loader.IrisData;
import com.volmit.iris.engine.IrisEngine;
import com.volmit.iris.engine.object.IRare;
import com.volmit.iris.engine.object.IrisStyledRange;
import com.volmit.iris.engine.object.annotations.*;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.mantle.Mantle;
import com.volmit.iris.util.math.RNG;
import com.volmit.iris.util.matter.MatterSlice;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
@Snippet("matter-placer")
@EqualsAndHashCode()
@Accessors(chain = true)
@NoArgsConstructor
@Desc("Represents an iris object placer. It places matter objects.")
@Data
public class IrisMatterPlacement implements IRare {
@RegistryListResource(IrisMatterObject.class)
@Required
@ArrayType(min = 1, type = String.class)
@Desc("List of objects to place")
private KList<String> place = new KList<>();
@MinNumber(0)
@Desc("The rarity of this object placing")
private int rarity = 0;
@MinNumber(0)
@Desc("The styled density of this object")
private IrisStyledRange densityRange;
@Desc("The absolute density for this object")
private double density = 1;
@Desc("Translate this matter object before placement")
private IrisMatterTranslate translate;
@Desc("Place this object on the surface height, bedrock or the sky, then use translate if need be.")
private IrisMatterPlacementLocation location = IrisMatterPlacementLocation.SURFACE;
public void place(IrisEngine engine, IrisData data, RNG rng, int ax, int az)
{
IrisMatterObject object = data.getMatterLoader().load(place.getRandom(rng));
int x = ax;
int z = az;
int yoff = 0;
if(translate != null)
{
x += translate.xOffset(data, rng, x, z);
yoff += translate.yOffset(data, rng, x, z);
z += translate.zOffset(data, rng, x, z);
}
int y = yoff + location.at(engine, x, z);
Mantle mantle = engine.getMantle().getMantle();
int xx = x;
int yy = y;
int zz = z;
for(MatterSlice<?> slice : object.getMatter().getSliceMap().values())
{
slice.iterate((mx, my, mz, v) -> {
mantle.set(xx + mx, yy + my, zz + mz, v);
});
}
}
}

View File

@@ -0,0 +1,25 @@
package com.volmit.iris.engine.object.matter;
import com.volmit.iris.engine.IrisEngine;
import com.volmit.iris.engine.object.annotations.Desc;
import com.volmit.iris.util.function.Function3;
import java.util.function.Function;
@Desc("WHERE THINGS PLACE")
public enum IrisMatterPlacementLocation {
SURFACE((e, x, z) -> e.getHeight(x, z, true)),
SURFACE_ON_FLUID((e, x, z) -> e.getHeight(x, z, false)),
BEDROCK((e, x, z) -> 0),
SKY((e, x, z) -> e.getHeight());
private final Function3<IrisEngine, Integer, Integer, Integer> computer;
private IrisMatterPlacementLocation(Function3<IrisEngine, Integer, Integer, Integer> computer)
{
this.computer = computer;
}
public int at(IrisEngine engine, int x, int z) {
return computer.apply(engine, x, z);
}
}

View File

@@ -0,0 +1,63 @@
package com.volmit.iris.engine.object.matter;
import com.volmit.iris.core.loader.IrisData;
import com.volmit.iris.engine.IrisEngine;
import com.volmit.iris.engine.object.IrisStyledRange;
import com.volmit.iris.engine.object.annotations.Desc;
import com.volmit.iris.util.math.RNG;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode()
@Accessors(chain = true)
@Desc("Represents a matter translator")
public class IrisMatterTranslate {
@Desc("For varied coordinate shifts use ranges not the literal coordinate")
private IrisStyledRange rangeX = null;
@Desc("For varied coordinate shifts use ranges not the literal coordinate")
private IrisStyledRange rangeY = null;
@Desc("For varied coordinate shifts use ranges not the literal coordinate")
private IrisStyledRange rangeZ = null;
@Desc("Define an absolute shift instead of varied.")
private int x = 0;
@Desc("Define an absolute shift instead of varied.")
private int y = 0;
@Desc("Define an absolute shift instead of varied.")
private int z = 0;
public int xOffset(IrisData data, RNG rng, int rx, int rz)
{
if(rangeX != null)
{
return (int) Math.round(rangeX.get(rng, rx, rz, data));
}
return x;
}
public int yOffset(IrisData data, RNG rng, int rx, int rz)
{
if(rangeY != null)
{
return (int) Math.round(rangeY.get(rng, rx, rz, data));
}
return y;
}
public int zOffset(IrisData data, RNG rng, int rx, int rz)
{
if(rangeZ != null)
{
return (int) Math.round(rangeZ.get(rng, rx, rz, data));
}
return z;
}
}

View File

@@ -31,11 +31,15 @@ import com.volmit.iris.engine.object.StudioMode;
import com.volmit.iris.engine.platform.studio.StudioGenerator;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.data.IrisBiomeStorage;
import com.volmit.iris.util.format.Form;
import com.volmit.iris.util.hunk.Hunk;
import com.volmit.iris.util.hunk.view.BiomeGridHunkHolder;
import com.volmit.iris.util.hunk.view.ChunkDataHunkHolder;
import com.volmit.iris.util.io.ReactiveFolder;
import com.volmit.iris.util.scheduling.ChronoLatch;
import com.volmit.iris.util.scheduling.J;
import com.volmit.iris.util.scheduling.Looper;
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Setter;
@@ -64,7 +68,7 @@ import java.util.function.Consumer;
@EqualsAndHashCode(callSuper = true)
@Data
public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChunkGenerator {
private static final int LOAD_LOCKS = 1_000_000;
private static final int LOAD_LOCKS = Runtime.getRuntime().availableProcessors() * 4;
private final Semaphore loadLock;
private final IrisWorld world;
private final File dataLocation;
@@ -77,12 +81,14 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
private Engine engine;
private Looper hotloader;
private StudioMode lastMode;
private DummyBiomeProvider dummyBiomeProvider;
@Setter
private StudioGenerator studioGenerator;
public BukkitChunkGenerator(IrisWorld world, boolean studio, File dataLocation, String dimensionKey) {
setup = new AtomicBoolean(false);
studioGenerator = null;
dummyBiomeProvider = new DummyBiomeProvider();
populators = new KList<>();
loadLock = new Semaphore(LOAD_LOCKS);
this.world = world;
@@ -164,7 +170,6 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
if(yy + (finalI << 4) >= engine.getHeight() || yy + (finalI << 4) < 0) {
continue;
}
c.getBlock(xx, yy + (finalI << 4) + world.getMinHeight(), zz)
.setBlockData(tc.getBlockData(xx, yy + (finalI << 4) + world.getMinHeight(), zz), false);
}
@@ -279,9 +284,11 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
if(studioGenerator != null) {
studioGenerator.generateChunk(getEngine(), tc, x, z);
} else {
Hunk<BlockData> blocks = Hunk.view(tc);
Hunk<Biome> biomes = Hunk.view(tc, tc.getMinHeight(), tc.getMaxHeight());
ChunkDataHunkHolder blocks = new ChunkDataHunkHolder(tc);
BiomeGridHunkHolder biomes = new BiomeGridHunkHolder(tc, tc.getMinHeight(), tc.getMaxHeight());
getEngine().generate(x << 4, z << 4, blocks, biomes, true);
blocks.apply();
biomes.apply();
}
ChunkData c = tc.getRaw();
@@ -363,6 +370,6 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
@Nullable
@Override
public BiomeProvider getDefaultBiomeProvider(@NotNull WorldInfo worldInfo) {
return null;
return dummyBiomeProvider;
}
}

View File

@@ -0,0 +1,25 @@
package com.volmit.iris.engine.platform;
import com.volmit.iris.util.collection.KList;
import org.bukkit.block.Biome;
import org.bukkit.generator.BiomeProvider;
import org.bukkit.generator.WorldInfo;
import org.jetbrains.annotations.NotNull;
import java.util.List;
public class DummyBiomeProvider extends BiomeProvider {
private final List<Biome> ALL = new KList<>(Biome.values()).qdel(Biome.CUSTOM);
@NotNull
@Override
public Biome getBiome(@NotNull WorldInfo worldInfo, int x, int y, int z) {
return Biome.PLAINS;
}
@NotNull
@Override
public List<Biome> getBiomes(@NotNull WorldInfo worldInfo) {
return ALL;
}
}

View File

@@ -0,0 +1,82 @@
/*
* Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2022 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.volmit.iris.util.cache;
import com.volmit.iris.engine.data.cache.Cache;
import com.volmit.iris.util.hunk.bits.Writable;
import java.io.DataInput;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public interface ArrayCache<T> extends Writable<T> {
T get(int i);
void set(int i, T t);
void iset(int i, int v);
int getWidth();
int getHeight();
void writeCache(DataOutputStream dos) throws IOException;
static int zigZag(int coord, int size)
{
if(coord < 0)
{
coord = Math.abs(coord);
}
if(coord % (size * 2) >= size)
{
return (size) - (coord % size) - 1;
}
else {
return coord % size;
}
}
default void set(int x, int y, T v)
{
set((zigZag(y, getHeight()) * getWidth()) + zigZag(x, getWidth()), v);
}
default T get(int x, int y)
{
try
{
return get((zigZag(y, getHeight()) * getWidth()) + zigZag(x, getWidth()));
}
catch(Throwable e)
{
e.printStackTrace();
throw e;
}
}
default void iset(int x, int y, int v)
{
iset((zigZag(y, getHeight()) * getWidth()) + zigZag(x, getWidth()), v);
}
}

View File

@@ -0,0 +1,44 @@
/*
* Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2022 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.volmit.iris.util.cache;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class ByteBitCache extends DataBitCache<Integer> {
public ByteBitCache(int width, int height) {
super(width, height);
}
@Override
public Integer readNodeData(DataInputStream din) throws IOException {
return (int) din.readByte();
}
@Override
public void writeNodeData(DataOutputStream dos, Integer integer) throws IOException {
dos.writeByte(integer);
}
@Override
public void iset(int i, int v) {
set(i, v);
}
}

View File

@@ -0,0 +1,76 @@
/*
* Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2022 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.volmit.iris.util.cache;
import lombok.Getter;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class ByteCache implements ArrayCache<Integer> {
@Getter
private final int width;
@Getter
private final int height;
private final byte[] cache;
public ByteCache(int width, int height)
{
this.width = width;
this.height = height;
cache = new byte[width * height];
}
public void set(int i, Integer v)
{
cache[i] = v.byteValue();
}
public Integer get(int i)
{
return (int)cache[i];
}
@Override
public void writeCache(DataOutputStream dos) throws IOException {
dos.writeInt(width);
dos.writeInt(height);
for(int i = 0; i < width * height; i++)
{
dos.writeByte(get(i));
}
}
@Override
public Integer readNodeData(DataInputStream din) throws IOException {
return (int) din.readByte();
}
@Override
public void writeNodeData(DataOutputStream dos, Integer integer) throws IOException {
dos.writeByte(integer);
}
@Override
public void iset(int i, int v) {
set(i, v);
}
}

View File

@@ -0,0 +1,58 @@
/*
* Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2022 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.volmit.iris.util.cache;
import com.volmit.iris.util.hunk.bits.DataContainer;
import lombok.Getter;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public abstract class DataBitCache<T> implements ArrayCache<T> {
@Getter
private final int width;
@Getter
private final int height;
private final DataContainer<T> cache;
public DataBitCache(int width, int height)
{
this.width = width;
this.height = height;
cache = new DataContainer<>(this, width * height);
}
public void set(int i, T v)
{
cache.set(i, v);
}
public T get(int i)
{
return cache.get(i);
}
@Override
public void writeCache(DataOutputStream dos) throws IOException {
dos.writeInt(width);
dos.writeInt(height);
cache.writeDos(dos);
}
}

View File

@@ -0,0 +1,44 @@
/*
* Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2022 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.volmit.iris.util.cache;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class FloatBitCache extends DataBitCache<Float> {
public FloatBitCache(int width, int height) {
super(width, height);
}
@Override
public Float readNodeData(DataInputStream din) throws IOException {
return din.readFloat();
}
@Override
public void writeNodeData(DataOutputStream dos, Float integer) throws IOException {
dos.writeFloat(integer);
}
@Override
public void iset(int i, int v) {
set(i, (float)v);
}
}

View File

@@ -0,0 +1,93 @@
/*
* Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2022 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.volmit.iris.util.cache;
import lombok.Getter;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
public class FloatCache implements ArrayCache<Float> {
@Getter
private final int width;
@Getter
private final int height;
private final float[] cache;
public FloatCache(File file) throws IOException {
this(new DataInputStream(new FileInputStream(file)));
}
public FloatCache(DataInputStream din) throws IOException {
this(din.readInt(), din.readInt());
for(int i = 0; i < width * height; i++)
{
cache[i] = din.readFloat();
}
din.close();
}
public FloatCache(int width, int height)
{
this.width = width;
this.height = height;
cache = new float[width * height];
}
public void set(int i, Float v)
{
cache[i] = v;
}
public Float get(int i)
{
return cache[i];
}
@Override
public void writeCache(DataOutputStream dos) throws IOException {
dos.writeInt(width);
dos.writeInt(height);
for(int i = 0; i < width * height; i++)
{
dos.writeFloat(get(i));
}
}
@Override
public Float readNodeData(DataInputStream din) throws IOException {
return din.readFloat();
}
@Override
public void writeNodeData(DataOutputStream dos, Float integer) throws IOException {
dos.writeFloat(integer);
}
@Override
public void iset(int i, int v) {
set(i, (float) v);
}
}

View File

@@ -0,0 +1,44 @@
/*
* Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2022 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.volmit.iris.util.cache;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class IntBitCache extends DataBitCache<Integer> {
public IntBitCache(int width, int height) {
super(width, height);
}
@Override
public Integer readNodeData(DataInputStream din) throws IOException {
return din.readInt();
}
@Override
public void writeNodeData(DataOutputStream dos, Integer integer) throws IOException {
dos.writeInt(integer);
}
@Override
public void iset(int i, int v) {
set(i, v);
}
}

View File

@@ -0,0 +1,78 @@
/*
* Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2022 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.volmit.iris.util.cache;
import com.volmit.iris.util.hunk.bits.DataContainer;
import com.volmit.iris.util.hunk.bits.Writable;
import lombok.Getter;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class IntCache implements ArrayCache<Integer> {
@Getter
private final int width;
@Getter
private final int height;
private final int[] cache;
public IntCache(int width, int height)
{
this.width = width;
this.height = height;
cache = new int[width * height];
}
public void set(int i, Integer v)
{
cache[i] = v;
}
public Integer get(int i)
{
return cache[i];
}
@Override
public void writeCache(DataOutputStream dos) throws IOException {
dos.writeInt(width);
dos.writeInt(height);
for(int i = 0; i < width * height; i++)
{
dos.writeInt(get(i));
}
}
@Override
public Integer readNodeData(DataInputStream din) throws IOException {
return din.readInt();
}
@Override
public void writeNodeData(DataOutputStream dos, Integer integer) throws IOException {
dos.writeInt(integer);
}
@Override
public void iset(int i, int v) {
set(i, v);
}
}

View File

@@ -0,0 +1,44 @@
/*
* Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2022 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.volmit.iris.util.cache;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class ShortBitCache extends DataBitCache<Short> {
public ShortBitCache(int width, int height) {
super(width, height);
}
@Override
public Short readNodeData(DataInputStream din) throws IOException {
return din.readShort();
}
@Override
public void writeNodeData(DataOutputStream dos, Short integer) throws IOException {
dos.writeShort(integer);
}
@Override
public void iset(int i, int v) {
set(i, (short) v);
}
}

View File

@@ -0,0 +1,76 @@
/*
* Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2022 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.volmit.iris.util.cache;
import lombok.Getter;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class ShortCache implements ArrayCache<Short> {
@Getter
private final int width;
@Getter
private final int height;
private final short[] cache;
public ShortCache(int width, int height)
{
this.width = width;
this.height = height;
cache = new short[width * height];
}
public void set(int i, Short v)
{
cache[i] = v;
}
public Short get(int i)
{
return cache[i];
}
@Override
public void writeCache(DataOutputStream dos) throws IOException {
dos.writeInt(width);
dos.writeInt(height);
for(int i = 0; i < width * height; i++)
{
dos.writeShort(get(i));
}
}
@Override
public Short readNodeData(DataInputStream din) throws IOException {
return din.readShort();
}
@Override
public void writeNodeData(DataOutputStream dos, Short integer) throws IOException {
dos.writeShort(integer);
}
@Override
public void iset(int i, int v) {
set(i, (short) v);
}
}

View File

@@ -16,26 +16,25 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.volmit.iris.core.service;
package com.volmit.iris.util.cache;
import com.volmit.iris.util.plugin.IrisService;
import com.volmit.iris.util.plugin.PluginRegistryGroup;
import lombok.Data;
import org.bukkit.block.data.BlockData;
import java.util.function.Supplier;
@Data
public class RegistrySVC implements IrisService {
private PluginRegistryGroup<Supplier<BlockData>> customBlockRegistry;
@Override
public void onEnable() {
customBlockRegistry = new PluginRegistryGroup<>();
public class UByteBitCache extends ByteBitCache {
public UByteBitCache(int width, int height) {
super(width, height);
}
@Override
public void onDisable() {
public void set(int i, Integer v) {
super.set(i, v + Byte.MIN_VALUE);
}
@Override
public Integer get(int i) {
return super.get(i) - Byte.MIN_VALUE;
}
@Override
public void iset(int i, int v) {
set(i, v);
}
}

View File

@@ -16,21 +16,25 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.volmit.iris.engine.object;
package com.volmit.iris.util.cache;
import com.volmit.iris.engine.object.annotations.Desc;
import com.volmit.iris.engine.object.annotations.Snippet;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
public class UByteCache extends ByteCache {
public UByteCache(int width, int height) {
super(width, height);
}
@Snippet("matter-placer")
@EqualsAndHashCode()
@Accessors(chain = true)
@NoArgsConstructor
@Desc("Represents an iris object placer. It places objects.")
@Data
public class IrisMatterPlacement {
@Override
public void set(int i, Integer v) {
super.set(i, v + Byte.MIN_VALUE);
}
@Override
public Integer get(int i) {
return super.get(i) - Byte.MIN_VALUE;
}
@Override
public void iset(int i, int v) {
set(i, v);
}
}

View File

@@ -20,8 +20,9 @@ package com.volmit.iris.util.data;
import com.volmit.iris.Iris;
import com.volmit.iris.core.IrisSettings;
import com.volmit.iris.core.service.RegistrySVC;
import com.volmit.iris.core.service.ExternalDataSVC;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.collection.KMap;
import com.volmit.iris.util.scheduling.ChronoLatch;
import it.unimi.dsi.fastutil.ints.Int2IntMap;
import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap;
@@ -30,6 +31,7 @@ import it.unimi.dsi.fastutil.ints.IntSet;
import it.unimi.dsi.fastutil.ints.IntSets;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.Waterlogged;
import org.bukkit.block.data.type.Leaves;
@@ -38,12 +40,14 @@ import org.bukkit.block.data.type.PointedDripstone;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.function.Supplier;
import java.util.Optional;
import java.util.stream.Collectors;
import static org.bukkit.Material.*;
public class B {
private static final KMap<String, BlockData> custom = new KMap<>();
private static final Material AIR_MATERIAL = Material.AIR;
private static final BlockData AIR = AIR_MATERIAL.createBlockData();
private static final IntSet foliageCache = buildFoliageCache();
@@ -195,7 +199,10 @@ public class B {
STONE_BUTTON,
WARPED_BUTTON,
TORCH,
SOUL_TORCH
SOUL_TORCH,
GLOW_LICHEN,
VINE,
SCULK_VEIN
}).forEach((i) -> b.add(i.ordinal()));
b.addAll(foliageCache);
@@ -398,6 +405,8 @@ public class B {
}
public static boolean isSolid(BlockData mat) {
if(mat == null)
return false;
return mat.getMaterial().isSolid();
}
@@ -405,6 +414,11 @@ public class B {
try {
String bd = bdxf.trim();
if(!custom.isEmpty() && custom.containsKey(bd))
{
return custom.get(bd);
}
if(bd.startsWith("minecraft:cauldron[level=")) {
bd = bd.replaceAll("\\Q:cauldron[\\E", ":water_cauldron[");
}
@@ -461,25 +475,11 @@ public class B {
try {
BlockData bx = null;
if(!ix.startsWith("minecraft:")) {
if(ix.startsWith("oraxen:") && Iris.linkOraxen.supported()) {
bx = Iris.linkOraxen.getBlockDataFor(ix.split("\\Q:\\E")[1]);
}
if(bx == null) {
try {
if(ix.contains(":")) {
String[] v = ix.toLowerCase().split("\\Q:\\E");
Supplier<BlockData> b = Iris.service(RegistrySVC.class).getCustomBlockRegistry().resolve(v[0], v[1]);
if(b != null) {
bx = b.get();
}
}
} catch(Throwable e) {
e.printStackTrace();// TODO: REMOVE
}
}
if(!ix.startsWith("minecraft:") && ix.contains(":")) {
NamespacedKey key = NamespacedKey.fromString(ix);
Optional<BlockData> bd = Iris.service(ExternalDataSVC.class).getBlockData(key);
if(bd.isPresent())
bx = bd.get();
}
if(bx == null) {
@@ -652,19 +652,9 @@ public class B {
}
}
try {
for(String i : Iris.linkOraxen.getItemTypes()) {
bt.add("oraxen:" + i);
}
} catch(Throwable e) {
e.printStackTrace();
}
try {
bt.addAll(Iris.service(RegistrySVC.class).getCustomBlockRegistry().compile());
} catch(Throwable e) {
e.printStackTrace();
}
for(NamespacedKey id : Iris.service(ExternalDataSVC.class).getAllIdentifiers())
bt.add(id.toString());
bt.addAll(custom.k());
return bt.toArray(new String[0]);
}
@@ -683,4 +673,15 @@ public class B {
public static boolean isWaterLogged(BlockData b) {
return (b instanceof Waterlogged) && ((Waterlogged) b).isWaterlogged();
}
public static void registerCustomBlockData(String namespace, String key, BlockData blockData) {
custom.put(namespace + ":" + key, blockData);
}
public static boolean isVineBlock(BlockData data) {
return switch(data.getMaterial()) {
case VINE, SCULK_VEIN, GLOW_LICHEN -> true;
default -> false;
};
}
}

View File

@@ -21,18 +21,18 @@ package com.volmit.iris.util.data;
import java.util.Arrays;
public class HeightMap {
private final byte[] height;
private final int[] height;
public HeightMap() {
height = new byte[256];
Arrays.fill(height, Byte.MIN_VALUE);
height = new int[256];
Arrays.fill(height, 0);
}
public void setHeight(int x, int z, int h) {
height[x * 16 + z] = (byte) (h + Byte.MIN_VALUE);
height[x * 16 + z] = (h);
}
public int getHeight(int x, int z) {
return height[x * 16 + z] - Byte.MIN_VALUE;
return height[x * 16 + z];
}
}

View File

@@ -18,6 +18,7 @@
package com.volmit.iris.util.hunk;
import com.volmit.iris.Iris;
import com.volmit.iris.engine.object.IrisPosition;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.function.Consumer2;
@@ -1254,6 +1255,12 @@ public interface Hunk<T> {
* the value
*/
default void set(int x, int y, int z, T t) {
if(!contains(x, y, z))
{
Iris.warn("OUT OF BOUNDS " + x + " " + y + " "+ z + " in bounds " + getWidth() + " " + getHeight() + " " + getDepth() );
return;
}
setRaw(x, y, z, t);
}
@@ -1561,4 +1568,9 @@ public interface Hunk<T> {
default boolean contains(int x, int y, int z) {
return x < getWidth() && x >= 0 && y < getHeight() && y >= 0 && z < getDepth() && z >= 0;
}
default int volume()
{
return getWidth() * getDepth() * getHeight();
}
}

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