Compare commits

...

58 Commits

Author SHA1 Message Date
Alpha
bd642eb8d6 publish api
Signed-off-by: Alpha <dev@alpha93.kr>
2024-12-15 16:07:13 +09:00
AlphaKR93
22bcf63585 publish 2024-12-14 20:10:05 +09:00
AlphaKR93
86b9aa41cc minor fix 2024-12-14 18:29:01 +09:00
AlphaKR93
e55f818ab2 Fix build 2024-12-14 12:25:54 +09:00
AlphaKR93
e54f3fcf11 Add tick toggle command 2024-12-14 12:22:39 +09:00
AlphaKR93
3f15d7a684 Updated Upstream (Paper, Pufferfish, Purpur)
Upstream has released updates that appear to apply and compile correctly.

[Purpur Changes]
PurpurMC/Purpur@e86a1b6: Updated Upstream (Paper)
PurpurMC/Purpur@962ee30: Updated Upstream (Paper)
PurpurMC/Purpur@74d1b4c: Updated Upstream (Paper)
PurpurMC/Purpur@e2e8c61: Updated Upstream (Paper)
PurpurMC/Purpur@7a01fd8: Updated Upstream (Paper)
PurpurMC/Purpur@34c18f0: Updated Upstream (Paper)
PurpurMC/Purpur@ca668ab: Updated Upstream (Paper)
PurpurMC/Purpur@200178d: Updated Upstream (Paper)
PurpurMC/Purpur@9968cbb: Updated Upstream (Paper)
PurpurMC/Purpur@db09358: Fix clamp-levels option not being true by default (#1609)
PurpurMC/Purpur@f289b6a: Updated Upstream (Paper)
PurpurMC/Purpur@959c29d: Fix Tridents giving errors without having an Elytra equipped (#1612)
PurpurMC/Purpur@68c1612: Fix villagers not spawning when the `follow-emerald-blocks` option is enabled (#1611)
PurpurMC/Purpur@5b75c68: fix `bypass-mob-griefing` not being the inverse of mobgriefing gamerule, closes #1603
PurpurMC/Purpur@55d4309: Updated Upstream (Paper)
PurpurMC/Purpur@0601f87: Updated Upstream (Paper)
PurpurMC/Purpur@06dde9d: Add Ridable and Attribute options for Creaking mob (#1613)
PurpurMC/Purpur@420a1ce: Set the bee's `takes-damage-from-water` option to true by default (#1614)
PurpurMC/Purpur@2b6f273: Updated Upstream (Paper)
PurpurMC/Purpur@504f311: Updated Upstream (Paper)
PurpurMC/Purpur@2b694c9: Updated Upstream (Paper)
PurpurMC/Purpur@96d7ef7: Updated Upstream (Paper)
PurpurMC/Purpur@e141f68: Updated Upstream (Paper)
PurpurMC/Purpur@7f6f667: Updated Upstream (Pufferfish)
PurpurMC/Purpur@de20ba9: ignore `minecart.max-speed` config value if using minecart experiment, closes #1618
PurpurMC/Purpur@03062a8: fix ridable mobs not being controllable, closes #1620
PurpurMC/Purpur@0493ac3: Updated Upstream (Paper)
PurpurMC/Purpur@16ce24a: fix(ridables/creaking): override tick method in look/move control
2024-12-14 01:59:42 +09:00
AlphaKR93
851cab54e0 Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly.

[Paper Changes]
PaperMC/Paper@00ef8bd: Fix Entity#isTicking and update Paper entity command (#11590)
PaperMC/Paper@6483ecb: Updated Upstream (Bukkit/CraftBukkit)
PaperMC/Paper@17dbf74: Improve CraftEntity and CraftPlayer equals
PaperMC/Paper@0af4e84: [ci skip] Add identifying line to some larger/optimization patches
PaperMC/Paper@bcbd108: Call CraftPlayer#onEntityRemove for all online players (#11598)
PaperMC/Paper@e47f79a: Configure mockito agent (#11560)
PaperMC/Paper@94ea770: Re-add exact choice shapeless support (#11546)
PaperMC/Paper@2e6eafb: Improve Minecart#getMinecartMaterial (#11544)
PaperMC/Paper@9d1c91d: [ci skip] Fix UseCooldownComponent jd (#11565)
PaperMC/Paper@59b79c8: Fix NPE with enchantable (#11557)
PaperMC/Paper@6da7b9e: Update Eigencraft patch to 1.21.3 (#11553)
PaperMC/Paper@1ef4c0e: Improve performance of RecipeMap#removeRecipe (#11547)
PaperMC/Paper@52fb265: Optimize custom map rendering (#11000)
PaperMC/Paper@661839e: Fix and optimize getChunkCount (#11610)
PaperMC/Paper@c60af44: Fix experimental minecart collisions on sloped rails
PaperMC/Paper@13f48d8: [ci skip] Rebuild patches
PaperMC/Paper@be886cf: Fix Naming issue inside Add PlayerArmorChangeEvent (#11614)
2024-11-15 23:41:52 +09:00
AlphaKR93
f63645c2fb fix build 2024-11-09 16:24:26 +09:00
AlphaKR93
8062ccb4ed Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly.

[Purpur Changes]
PurpurMC/Purpur@e86a1b6: Updated Upstream (Paper)

[Paper Changes]
PaperMC/Paper@a6df4c8: Handle corrupt light data gracefully
PaperMC/Paper@ce0a041: [ci skip] Rebuild patches

[Paper Changes]
PaperMC/Paper@c6aa61e: Updated Upstream (Bukkit/CraftBukkit/Spigot) (#11561)
PaperMC/Paper@93b435d: [ci skip] better instructions for patch apply conflict (#11568)
PaperMC/Paper@42a1901: Correctly adopt upstream item EAR fix (#11582)
PaperMC/Paper@fcb6c72: Correctly pass velocity native compressor (#11509)
PaperMC/Paper@99f4bb2: Fix infinite fireworks (#11592) (#11594)
2024-11-08 23:01:41 +09:00
AlphaKR93
c0d36db38d Hashed RCON password 2024-11-05 18:33:34 +09:00
Alpha
62f90e3fba Update build.gradle.kts
Signed-off-by: Alpha <dev@alpha93.kr>
2024-11-05 09:42:00 +09:00
Alpha
2986abeee1 Update release.yaml
Signed-off-by: Alpha <dev@alpha93.kr>
2024-11-04 16:22:38 +09:00
Alpha
fc38239b61 Update release.yaml
Signed-off-by: Alpha <dev@alpha93.kr>
2024-11-04 16:22:03 +09:00
AlphaKR93
cfe2db6181 Updated Upstream (Paper, Purpur)
Upstream has released updates that appear to apply and compile correctly.

[Purpur Changes]
PurpurMC/Purpur@e86a1b6: Updated Upstream (Paper)

[Paper Changes]
PaperMC/Paper@a6df4c8: Handle corrupt light data gracefully
PaperMC/Paper@ce0a041: [ci skip] Rebuild patches
2024-11-04 16:21:00 +09:00
AlphaKR93
8975d5676b add back more patches 2024-11-04 16:18:16 +09:00
Alpha
3e1399c421 more readme fixes
Signed-off-by: Alpha <dev@alpha93.kr>
2024-11-03 23:50:49 +09:00
Alpha
d110f25a23 PlazmaBukkit, not Plazmaclip
Signed-off-by: Alpha <dev@alpha93.kr>
2024-11-03 23:47:35 +09:00
Alpha
7543f3adbd Update README.md
Signed-off-by: Alpha <dev@alpha93.kr>
2024-11-03 23:41:44 +09:00
Alpha
6a16940e2b Fix build
Signed-off-by: Alpha <dev@alpha93.kr>
2024-11-03 23:33:52 +09:00
Alpha
5596d998c1 Rename release.yml to release.yaml
Signed-off-by: Alpha <dev@alpha93.kr>
2024-11-03 23:19:04 +09:00
Alpha
75fad4cd35 first try
Signed-off-by: Alpha <dev@alpha93.kr>
2024-11-03 23:18:20 +09:00
Alpha
f476809251 Update release.yml
Signed-off-by: Alpha <dev@alpha93.kr>
2024-11-03 00:43:47 +09:00
Alpha
269cbb507b Update release.yml
Signed-off-by: Alpha <dev@alpha93.kr>
2024-11-03 00:04:58 +09:00
Alpha
54dfd7163a Update release.yml
Signed-off-by: Alpha <dev@alpha93.kr>
2024-11-02 22:22:58 +09:00
Alpha
d975acec6b more buildscript fix
Signed-off-by: Alpha <dev@alpha93.kr>
2024-11-02 22:08:25 +09:00
Alpha
72565bec8e protip: be sure to check the docs when you make something
Signed-off-by: Alpha <dev@alpha93.kr>
2024-11-02 18:58:05 +09:00
Alpha
05215498c3 Update release.yml
Signed-off-by: Alpha <dev@alpha93.kr>
2024-11-02 18:44:27 +09:00
Alpha
ae94d43098 Update release.yml
Signed-off-by: Alpha <dev@alpha93.kr>
2024-11-02 18:34:13 +09:00
Alpha
8889a877d6 💀
Signed-off-by: Alpha <dev@alpha93.kr>
2024-11-02 18:18:54 +09:00
AlphaKR93
e915eadfad fix 2024-11-02 18:06:37 +09:00
AlphaKR93
28ce30ec48 fix 2024-11-02 17:43:18 +09:00
AlphaKR93
dd8042f88a Updated Upstream (Paper & Purpur)
Upstream has released updates that appear to apply and compile correctly.

[Purpur Changes]
PurpurMC/Purpur@3fc255d: Updated Upstream (Paper)
PurpurMC/Purpur@93f3948: bump Gradle wrapper version to 8.10.2
PurpurMC/Purpur@1a67c42: drop the patch that removes the mojang profiler for now
PurpurMC/Purpur@803bf62: Final 1.21.1 Upstream (Paper)
PurpurMC/Purpur@af96590: Merge branch 'ver/1.21.1' into ver/1.21.3
PurpurMC/Purpur@c6802b0: Updated Upstream (Paper)

[Paper Changes]
PaperMC/Paper@99b1bf9: Use new ClientboundPlayerRotationPacket for setting player rotation
PaperMC/Paper@40211a0: Update Gradle wrapper to 8.10.2
PaperMC/Paper@49eae0d: remove some leftovers
PaperMC/Paper@d576cfc: cleanup bugfix patch
PaperMC/Paper@1196ab5: Avoid issues with certain tasks not processing during sleep (#11526)
PaperMC/Paper@fe2f3d4: Fix portal exit resulting in bad teleport transition
PaperMC/Paper@9f1fa0b: Fix item gravity on inactive items, remove dumb active skipping
PaperMC/Paper@1a1d0cf: Use target pitch in teleport (generally the same thing)
PaperMC/Paper@8ba3073: fix "is_freezing" damage type tag
PaperMC/Paper@1523212: don't resend effects when PlayerItemConsumeEvent is cancelled
PaperMC/Paper@1330880: Add Friction API to minecarts
PaperMC/Paper@580a610: Allow using old ender pearl behavior & apply ender pearl exploit patch (#11524)
PaperMC/Paper@40a960d: Rebuild patches
PaperMC/Paper@dfedf79: Correctly cancel consumption of consumable
PaperMC/Paper@147b796: get previous redstone level from the right state for experimental wires
PaperMC/Paper@ad9c58e: Only expose velocity relative tp flags to API (#11532)
PaperMC/Paper@f273e6e: Set updatingMinecraft to false
PaperMC/Paper@c5c1250: [ci skip] Remove leftover todo file (#11540)
PaperMC/Paper@7ee4835: Correctly clear  explosion density cache(#11541)
PaperMC/Paper@52a0590: Updated Upstream (Bukkit/CraftBukkit) (#11543)
PaperMC/Paper@5c0930d: Fix fix recipe iterator patch
PaperMC/Paper@1de0130: re-add a dispense fix patch
PaperMC/Paper@16d7d73: bunch more general fixes
PaperMC/Paper@a5d7426: Correctly support RecipeChoice.empty (#11550)
PaperMC/Paper@85c870e: Correct update cursor (#11554)
PaperMC/Paper@d19be64: Fix NPE with spark when CraftServer is not init yet (#11558)
PaperMC/Paper@92131ad: Decrease dead entity teleport warning (#11559)
2024-11-02 16:54:55 +09:00
AlphaKR93
54bc879a9e fix build 2024-11-02 16:40:43 +09:00
AlphaKR93
33701c1eca more work 2024-11-02 16:39:08 +09:00
AlphaKR93
2028e19bf8 work 2024-11-01 18:12:14 +09:00
AlphaKR93
7a7a88a7bb fix build 2024-10-31 22:54:03 +09:00
AlphaKR93
8860cedaf7 work 2024-10-31 15:33:54 +09:00
AlphaKR93
527b6c7eaf more work 2024-10-31 14:31:42 +09:00
AlphaKR93
e37f05bd87 work 2024-10-31 13:18:20 +09:00
AlphaKR93
dfb64f50db [ci-skip] Bump Gradle Wrapper 2024-10-31 12:50:27 +09:00
AlphaKR93
69d4f4bf86 compile 2024-10-31 09:40:04 +09:00
AlphaKR93
64802e7e50 1.21.3 2024-10-30 15:03:07 +09:00
AlphaKR93
a313424212 [ci-skip] license 2024-10-27 16:03:28 +09:00
AlphaKR93
fa3c15b4f3 more optimizations 2024-10-27 16:01:43 +09:00
AlphaKR93
393e079743 minor optimization 2024-10-27 00:18:44 +09:00
AlphaKR93
90d412bbf3 random things 2024-10-26 22:07:15 +09:00
AlphaKR93
98cf5b2d13 Updated SparklyPaper port to latest 2024-10-25 19:30:16 +09:00
AlphaKR93
32243963f5 some works 2024-10-25 19:00:52 +09:00
AlphaKR93
72183c64b9 runnable 2024-10-25 18:42:48 +09:00
AlphaKR93
f7998d1955 fix build 2024-10-25 14:22:07 +09:00
AlphaKR93
58ddbf4dd6 generated api 2024-10-25 14:11:46 +09:00
AlphaKR93
3484117415 patches done 2024-10-25 07:50:20 +09:00
AlphaKR93
bff96101bb workworkworkwork 2024-10-25 07:28:41 +09:00
AlphaKR93
6b54d11f9c more work 2024-10-25 07:22:54 +09:00
AlphaKR93
08a067e974 prepare for 1.21.3 2024-10-24 10:51:28 +09:00
AlphaKR93
46433f7303 6 2024-10-22 13:29:21 +09:00
AlphaKR93
72415ee5f2 API patches 2024-10-22 07:47:40 +09:00
AlphaKR93
6d7683503c Updated Upstream (Paper, Purpur)
Upstream has released updates that appear to apply and compile correctly.

[Purpur Changes]
PurpurMC/Purpur@a52426c: Updated Upstream (Paper)
PurpurMC/Purpur@86ad0b3: Updated Upstream (Paper)
PurpurMC/Purpur@79d199c: Updated Upstream (Paper)
PurpurMC/Purpur@7708a4c: don't send keepalive packet early, closes #1520
PurpurMC/Purpur@4873495: add config to reverse bubble column flow for soulsand and magma blocks
PurpurMC/Purpur@eac4198: Updated Upstream (Paper)
PurpurMC/Purpur@7219263: [ci skip] inline fqn imports
PurpurMC/Purpur@cc56332: Final 1.20.6 Paper Upstream \o/
PurpurMC/Purpur@f1c87e4: add missing armadillo & bogged options, closes #1527
PurpurMC/Purpur@d259ed5: prepare for update
PurpurMC/Purpur@1544081: Updated Upstream (Paper)
PurpurMC/Purpur@e2b5e14: apply API patches
PurpurMC/Purpur@7c38d97: first 5 patches!
PurpurMC/Purpur@0ab7756: ridables patch \o/
PurpurMC/Purpur@085de5a: first 50 patches \o/
PurpurMC/Purpur@b191556: 100 patches \o/
PurpurMC/Purpur@2a4d2e5: 150 patches \o/
PurpurMC/Purpur@c716c80: 200 patches \o/
PurpurMC/Purpur@699969f: 250 patches \o/
PurpurMC/Purpur@cfc96e0: all patches apply \o/
PurpurMC/Purpur@59c536c: Updated Upstream (Paper)
PurpurMC/Purpur@20e182a: Updated Upstream (Paper)
PurpurMC/Purpur@973bcd4: drop damage-with-frost-walker option - can be done with a datapack
PurpurMC/Purpur@331c216: re-add timings/mojang profiler removal patches
PurpurMC/Purpur@b27c8b2: add back leashable villagers option
PurpurMC/Purpur@6b2acdc: infinity on crossbows can be done with datapacks now
PurpurMC/Purpur@c3829f2: add back portal permission bypass patch
PurpurMC/Purpur@0510294: add back fix-stuck-in-portal patch
PurpurMC/Purpur@dedcdd0: re-add generated api patches
PurpurMC/Purpur@00126e8: re-add removing curse of binding with weakness patch
PurpurMC/Purpur@09ec31b: infinity bow settings can be done through a datapack
PurpurMC/Purpur@cdb192f: mending muliplier is better done through a datapack
PurpurMC/Purpur@bf6dbdd: fix timings/profiler compilation issues
PurpurMC/Purpur@6e1147f: Updated Upstream (Paper)
PurpurMC/Purpur@c991735: Fix compilation issues (#1530)
PurpurMC/Purpur@25ecbc4: rename enchantment convenience patch
PurpurMC/Purpur@ea406a0: use matchingSlot helper method
PurpurMC/Purpur@4dca11b: elytra.ignore-unbreaking option can probably be done through datapacks now
PurpurMC/Purpur@fa88174: clear out TODOs
PurpurMC/Purpur@04a9fec: reuse extrainfo in crash report
PurpurMC/Purpur@45774b4: apply the rest of the unapplied patches
PurpurMC/Purpur@dd826a3: Updated Upstream (Paper)
PurpurMC/Purpur@778995d: Updated Upstream (Paper)
PurpurMC/Purpur@9ff84cb: Updated Upstream (Paper)
PurpurMC/Purpur@bd49055: [ci skip] replace paper with purpur in log message
PurpurMC/Purpur@a122fd7: Updated Upstream (Paper)
PurpurMC/Purpur@783acfe: Updated Upstream (Paper)
PurpurMC/Purpur@b5f1c48: Updated Upstream (Paper)
PurpurMC/Purpur@c0f5e78: add default silverfish movement speed & attack damage attributes
PurpurMC/Purpur@b82f693: configurable mob size attribute (#1538)
PurpurMC/Purpur@e05f91b: [ci skip] move import to config patch
PurpurMC/Purpur@2ba7bee: Updated Upstream (Paper)
PurpurMC/Purpur@19da21c: Updated Upstream (Paper)
PurpurMC/Purpur@21ec259: fix kickForOutOfOrderChat being applied in the incorrect spot
PurpurMC/Purpur@9efd5fc: Updated Upstream (Paper)
PurpurMC/Purpur@ad910f8: Updated Upstream (Paper)
PurpurMC/Purpur@39617d5: entities with passengers can go through portals now, closes #1540
PurpurMC/Purpur@7d59f25: fix blast resistence config not accepting namespaced values
PurpurMC/Purpur@1615793: set burp delay in the correct spot
PurpurMC/Purpur@797ce6b: Updated Upstream (Paper)
PurpurMC/Purpur@ac6c312: Updated Upstream (Paper)
PurpurMC/Purpur@d5c06b4: fix summon_entity effect attempting to add incorrect entity, closes #1545
PurpurMC/Purpur@faa1f93: add PlayerSetTrialSpawnerTypeWithEggEvent, fixes #1546 (#1547)
PurpurMC/Purpur@1ab7990: Updated Upstream (Paper)
PurpurMC/Purpur@8b987b1: fix infinityWorksWithoutArrows not working
PurpurMC/Purpur@de2e7a7: Updated Upstream (Paper)
PurpurMC/Purpur@cb0f04b: Updated Upstream (Paper)
PurpurMC/Purpur@ff19bcc: Updated Upstream (Paper)
PurpurMC/Purpur@b3709b1: Updated Upstream (Paper)
PurpurMC/Purpur@5e70800: Updated Upstream (Paper)
PurpurMC/Purpur@14136b8: Updated Upstream (Paper)
PurpurMC/Purpur@458dc18: Updated Upstream (Paper), closes #1556
PurpurMC/Purpur@87cf9f1: Updated Upstream (Paper)
PurpurMC/Purpur@bf63cfa: Updated Upstream (Paper)
PurpurMC/Purpur@8f0f20d: Updated Upstream (Paper)
PurpurMC/Purpur@86a6543: Updated Upstream (Paper)
PurpurMC/Purpur@2e39567: Re-add missing chunk api calls, fixes #1560
PurpurMC/Purpur@eadfff7: Updated Upstream (Paper)
PurpurMC/Purpur@65d3665: Updated Upstream (Paper)
PurpurMC/Purpur@936c29a: Updated Upstream (Paper)
PurpurMC/Purpur@032697e: Updated Upstream (Paper)
PurpurMC/Purpur@b2d1fea: always output bukkit/paper plugin header in plugin command
PurpurMC/Purpur@61b63b1: Updated Upstream (Paper)
PurpurMC/Purpur@c3849be: Fire EntityTeleportHinderedEvent when attempting to teleport a player with passengers (#1563)
PurpurMC/Purpur@7e0ca92: [ci skip] missed rebranding
PurpurMC/Purpur@82ccc76: Updated Upstream (Paper)
PurpurMC/Purpur@72ccfbd: Updated Upstream (Paper)
PurpurMC/Purpur@0bd5579: Updated Upstream (Paper)
PurpurMC/Purpur@b3623fa: Updated Upstream (Paper)
PurpurMC/Purpur@9e444c5: Add Entities can use portals patch back (#1571)
PurpurMC/Purpur@930003b: Updated Upstream (Paper)
PurpurMC/Purpur@7950960: Updated Upstream (Paper)
PurpurMC/Purpur@02e4e76: Updated Upstream (Paper)
PurpurMC/Purpur@afabbc9: missed these
PurpurMC/Purpur@73a90e8: Updated Upstream (Paper)
PurpurMC/Purpur@75e81d8: deprecate old anvil api methods
PurpurMC/Purpur@699448c: Merge branch 'ver/1.21' into ver/1.21.1
PurpurMC/Purpur@4e55e26: final 1.21 Paper upstream
PurpurMC/Purpur@edd9be7: Merge branch 'ver/1.21' into ver/1.21.1
PurpurMC/Purpur@abf2f21: Updated Upstream (Paper)
PurpurMC/Purpur@366af80: Updated Upstream (Paper)
PurpurMC/Purpur@07979c3: Updated Upstream (Paper)
PurpurMC/Purpur@3f790ac: Updated Upstream (Paper)
PurpurMC/Purpur@201e928: Updated Upstream (Pufferfish) (#1575)
PurpurMC/Purpur@f2307b8: Updated Upstream (Paper)
PurpurMC/Purpur@bba87bf: Updated Upstream (Paper)
PurpurMC/Purpur@f530395: Fix no exp drops from spawners using silk touch pickaxe without option enabled  (#1582)
PurpurMC/Purpur@3510a9e: Updated Upstream (Paper)
PurpurMC/Purpur@1d3cef7: Updated Upstream (Paper)
PurpurMC/Purpur@c4a6f63: Updated Upstream (Paper)
PurpurMC/Purpur@568a028: Updated Upstream (Paper)
PurpurMC/Purpur@ef12ede: Updated Upstream (Paper)
PurpurMC/Purpur@a61db94: Updated Upstream (Paper)
PurpurMC/Purpur@5c0d2f7: Updated Upstream (Paper)
PurpurMC/Purpur@49db849: Updated Upstream (Paper)
PurpurMC/Purpur@a43711d: Updated Upstream (Paper)
PurpurMC/Purpur@0a9941e: Updated Upstream (Paper)
PurpurMC/Purpur@88352c3: Updated Upstream (Paper)
PurpurMC/Purpur@dee41bc: Updated Upstream (Paper)
PurpurMC/Purpur@fdfc12e: Updated Upstream (Paper)
PurpurMC/Purpur@bc7bcbb: Fix elytra durability setting not working properly (#1589)
PurpurMC/Purpur@8af4ea6: Updated Upstream (Paper)
PurpurMC/Purpur@8332fa4: Updated Upstream (Paper)
PurpurMC/Purpur@be61a07: Updated Upstream (Paper)
PurpurMC/Purpur@f154903: Updated Upstream (Paper)
PurpurMC/Purpur@0fa9a50: Updated Upstream (Paper)
PurpurMC/Purpur@d7a7c91: Updated Upstream (Paper)
PurpurMC/Purpur@20fa61e: Updated Upstream (Paper)
PurpurMC/Purpur@501e7c5: Updated Upstream (Paper)
PurpurMC/Purpur@2a50638: Updated Upstream (Paper)
PurpurMC/Purpur@639bcbd: Updated Upstream (Paper)
PurpurMC/Purpur@bcf8103: remove obsolete allowUnsafeEnchants config option
PurpurMC/Purpur@51f15ee: fully remove obsolete allowUnsafeEnchants config option
PurpurMC/Purpur@3d0716d: Fix colored shulker box contents not dropping when destroyed, supercedes #1594
PurpurMC/Purpur@12e2926: [ci skip] drop old migration patch
PurpurMC/Purpur@212c942: delegate itemstack convenience methods
PurpurMC/Purpur@2eaea6a: switch to JSpecify annotations
PurpurMC/Purpur@4565f41: these options should be off by default
PurpurMC/Purpur@4671e1e: show a message stating the removal of mojang profiler when running perf comamnd, closes #1591
PurpurMC/Purpur@e12a4de: Updated Upstream (Paper)
PurpurMC/Purpur@7f490a6: Updated Upstream (Paper)
PurpurMC/Purpur@4f2fe31: Updated Upstream (Paper)
PurpurMC/Purpur@4b57bed: Updated Upstream (Paper)
2024-10-22 07:36:03 +09:00
141 changed files with 36952 additions and 17034 deletions

View File

@@ -9,7 +9,7 @@ ij_any_block_comment_at_first_column = false
ij_any_line_comment_at_first_column = false
ij_any_line_comment_add_space = true
max_line_length = 120
ij_visual_guides = 80
ij_visual_guides = 16, 80
[*.tiny]
indent_style=tab
@@ -19,6 +19,7 @@ end_of_line=crlf
[*.yml]
indent_size=2
ij_visual_guides = 8, 80
[*.patch]
trim_trailing_whitespace=false

View File

@@ -23,13 +23,13 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Checkout action
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
uses: gradle/actions/wrapper-validation@v4
- name: Set up JDK ${{ matrix.java }} ${{ matrix.jdk }}
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: ${{ matrix.java }}
java-version: ${{ matrix.jdk }}

12
.github/workflows/release.yaml vendored Normal file
View File

@@ -0,0 +1,12 @@
name: Release Plazma
on:
push:
branches: [ "ver/*", "dev/*", "feat/**/*" ]
workflow_dispatch:
jobs:
release:
name: Release Plazma (${{ github.ref_name }})
uses: PlazmaMC/PlazmaBukkit/.github/workflows/global.yaml@main
secrets: inherit

View File

@@ -1,146 +0,0 @@
name: Release Plazma (1.20.6)
on:
push:
branches: [ "ver/*", "dev/*", "feat/**/*" ]
paths:
- "patches/server/**.patch"
- "patches/api/**.patch"
- "gradle.properties"
- "release.yml"
workflow_dispatch:
env:
ORG_NAME: PlazmaMC
jobs:
release:
name: Release Plazma
strategy:
matrix:
base_jdk: [21]
os: [ubuntu-22.04]
if: "!startsWith(github.event.commits[0].message, '[CI-Skip]')"
runs-on: ${{ matrix.os }}
steps:
- name: Setup Variables
id: setup
env:
BRANCH: ${{ github.ref_name }}
run: echo "VERSION=${BRANCH##*/}" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@v4
- name: Checkout javadocs
uses: actions/checkout@v4
continue-on-error: true
if: startsWith(github.ref_name, 'ver/') || startsWith(github.ref_name, 'dev/')
with:
repository: PlazmaMC/Javadocs
ref: ${{ env.VERSION }}
token: ${{ secrets.GH_PAT }}
path: javadoc
- name: Checkout javadocs
uses: actions/checkout@v4
if: startsWith(github.ref_name, 'ver/') || startsWith(github.ref_name, 'dev/')
with:
repository: PlazmaMC/Javadocs
token: ${{ secrets.GH_PAT }}
path: jdmain
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
- name: Set up GraalVM ${{ matrix.base_jdk }}
uses: graalvm/setup-graalvm@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
java-version: ${{ matrix.base_jdk }}
version: latest
cache: 'gradle'
- name: Configure Git
run: git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" && git config --global user.name "github-actions[bot]"
- name: Get Release Number
if: startsWith(github.ref_name, 'ver/')
run: echo "BUILD_NUMBER=$(git ls-remote --tags origin | grep "build/${{ env.VERSION }}" | wc -l)" >> $GITHUB_ENV
- name: Apply Patches
run: ./gradlew applyPatches --stacktrace
- name: Build
run: ./gradlew build --stacktrace
- name: Create Reobf Jar
run: ./gradlew createReobfPaperclipJar --stacktrace
- name: Create Mojmap Jar
run: ./gradlew createMojmapPaperclipJar --stacktrace
- name: Update Javadoc
if: startsWith(github.ref_name, 'ver/') || startsWith(github.ref_name, 'dev/')
continue-on-error: true
run: |
if [ ! -d "javadoc" ]; then
SUBMODULE_ADD=true
mkdir javadoc && cd javadoc
git init && git branch -m ${{ env.VERSION }}
git remote add origin https://github.com/PlazmaMC/Javadocs
fi
cp -rf Plazma-API/build/docs/javadoc/* javadoc/
cd javadoc
git add . && git commit -m "Update Javadocs"
git push -f origin ${{ env.VERSION }}
cd ../jdmain
if [ $SUBMODULE_ADD = true ]; then
git submodule add -b ${{ env.VERSION }} https://github.com/PlazmaMC/Javadocs ${{ env.VERSION }}
fi
git submodule update
git add . && git commit -m "Update Javadocs"
git push
- name: Publish Packages
if: startsWith(github.ref_name, 'ver/') || startsWith(github.ref_name, 'dev/')
run: |
export GITHUB_USERNAME=${{ env.ORG_NAME }}
export GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
./gradlew publish --stacktrace
- name: Release Artifacts
if: startsWith(github.ref_name, 'ver/')
uses: softprops/action-gh-release@v0.1.15
with:
name: "Build #${{ env.BUILD_NUMBER }} for ${{ env.VERSION }}"
tag_name: "build/${{ env.VERSION }}/${{ env.BUILD_NUMBER }}"
target_commitish: ${{ github.ref_name }}
generate_release_notes: true
fail_on_unmatched_files: true
files: build/libs/*.jar
- name: Release Artifacts (Latest/Stable)
if: startsWith(github.ref_name, 'ver/')
uses: softprops/action-gh-release@v0.1.15
with:
name: "Build #${{ env.BUILD_NUMBER }} for ${{ env.VERSION }}"
tag_name: "build/${{ github.ref_name }}/latest"
target_commitish: ${{ github.ref_name }}
generate_release_notes: true
fail_on_unmatched_files: true
files: build/libs/*.jar
- name: Release Artifacts (Latest/Development)
if: startsWith(github.ref_name, 'dev/')
uses: softprops/action-gh-release@v0.1.15
with:
name: "Development Build for ${{ env.VERSION }}"
tag_name: build/${{ env.VERSION }}/latest
target_commitish: ${{ github.ref_name }}
generate_release_notes: true
fail_on_unmatched_files: true
files: build/libs/*.jar

4
.gitignore vendored
View File

@@ -18,6 +18,9 @@ out/
nbproject/
nbactions.xml
# vscode
.vscode/
# Gradle
!gradle-wrapper.jar
.gradle/
@@ -58,3 +61,4 @@ paper-api-generator
compare.txt
*.patch
!patches/**/*
upstream

View File

@@ -6,10 +6,10 @@
[![Discord](https://api.plazmamc.org/internal/cdn/discord)](https://plazmamc.org/discord)
[![License](https://api.plazmamc.org/internal/cdn/license)](LICENSE.md)
[![Version](https://badge.plazmamc.org/1/MC/1.20.6/Webpack)](https://plazmamc.org/downloads)
[![Version](https://badge.plazmamc.org/1/MC/1.21.3/Webpack)](https://plazmamc.org/downloads)
[![Downloads](https://api.plazmamc.org/internal/cdn/downloads-mini)](https://plazmamc.org/downloads)
[![Stargazers](https://api.plazmamc.org/internal/cdn/stars-mini)](https://github.com/PlazmaMC/Plazma/stargazers)
[![Downloads](https://api.plazmamc.org/internal/cdn/dlcountmini)](https://plazmamc.org/downloads)
[![Stargazers](https://api.plazmamc.org/internal/cdn/starsmini)](https://github.com/PlazmaMC/Plazma/stargazers)
[![Forks](https://api.plazmamc.org/internal/cdn/forks)](https://github.com/PlazmaMC/Plazma/forks)
[![Watchers](https://api.plazmamc.org/internal/cdn/watches)](https://github.com/PlazmaMC/Plazma/watchers)
@@ -17,8 +17,8 @@
</div>
[main]: https://github.com/PlazmaMC/Plazma
[main]: https://github.com/PlazmaMC/PlazmaBukkit/blob/main/README.md
> [!IMPORTANT]
This is the branch for Plazma 1.20.6. If you want to know more about Plazma, please check the **[main branch][main]**.<br>
이곳은 플라즈마의 1.20.6용 분기입니다. 플라즈마에 대해 자세히 알고 싶다면 **[main 분기][main]** 를 확인해주세요.
This is the branch for Plazma 1.21.2/3. If you want to know more about Plazma, please check the **[main branch][main]**.<br>
이곳은 플라즈마의 1.21.2/3용 분기입니다. 플라즈마에 대해 자세히 알고 싶다면 **[main 분기][main]** 를 확인해주세요.

View File

@@ -3,32 +3,88 @@ import org.gradle.api.tasks.testing.logging.TestLogEvent
plugins {
java
`maven-publish`
`kotlin-dsl`
`maven-publish`
`always-up-to-date`
alias(libs.plugins.shadow) apply false
alias(libs.plugins.paperweight)
}
val jdkVersion = property("jdkVersion").toString().toInt()
val providerRepo = property("providerRepo").toString()
val brandName = property("brandName").toString()
kotlin.jvmToolchain(jdkVersion)
repositories {
mavenCentral()
maven("https://repo.papermc.io/repository/maven-public/") {
maven("https://repo.papermc.io/repository/maven-public/") { name = "papermc"
content { onlyForConfigurations(configurations.paperclip.name) }
}
maven("https://repo.codemc.io/repository/maven-public/") { name = "codemc" }
maven("https://jitpack.io") { name = "jitpack" }
}
dependencies {
remapper(libs.remapper)
decompiler(libs.decompiler)
paperclip(libs.paperclip)
decompiler(libs.decompiler)
}
val brandName: String by project
val providerRepo: String by project
paperweight {
serverProject = project(":${brandName.lowercase()}-server")
remapRepo = "https://repo.papermc.io/repository/maven-public/"
decompileRepo = "https://repo.papermc.io/repository/maven-public/"
useStandardUpstream("paper") {
url = github("PaperMC", "Paper-archive")
ref = providers.gradleProperty("paperCommit")
withStandardPatcher {
baseName("Paper")
apiPatchDir.set(projectDir.resolve("patches/api"))
apiOutputDir.set(projectDir.resolve("$brandName-API"))
serverPatchDir.set(projectDir.resolve("patches/server"))
serverOutputDir.set(projectDir.resolve("$brandName-Server"))
}
patchTasks.register("generatedApi") {
isBareDirectory = true
upstreamDirPath = "paper-api-generator/generated"
patchDir = projectDir.resolve("patches/generated-api")
outputDir = projectDir.resolve("paper-api-generator/generated")
}
}
}
tasks {
applyPatches {
dependsOn("applyGeneratedApiPatches")
}
rebuildPatches {
dependsOn("rebuildGeneratedApiPatches")
}
generateDevelopmentBundle {
apiCoordinates.set("${project.group}:${brandName.lowercase()}-api")
libraryRepositories.addAll(
"https://repo1.maven.org/maven2/",
"https://papermc.io/repo/repository/maven-public/",
"https://repo.codemc.io/repository/maven-public/",
"https://jitpack.io",
)
}
}
publishing.publications.create<MavenPublication>("devBundle") {
artifact(tasks.generateDevelopmentBundle) { artifactId = "dev-bundle" }
}
val mavenUsername: String? by project
val mavenPassword: String? by project
allprojects {
apply(plugin = "java")
apply(plugin = "maven-publish")
@@ -36,25 +92,36 @@ allprojects {
java.toolchain.languageVersion.set(JavaLanguageVersion.of(jdkVersion))
publishing.repositories.maven("https://maven.pkg.github.com/$providerRepo") {
name = "githubPackage"
url = uri("https://maven.pkg.github.com/$providerRepo")
name = "github"
credentials {
username = System.getenv("GITHUB_USERNAME")
password = System.getenv("GITHUB_TOKEN")
username = mavenUsername ?: System.getenv("GRADLE_PROPERTY_MAVEN_USERNAME") ?: System.getenv("MAVEN_USERNAME")
password = mavenPassword ?: System.getenv("GRADLE_PROPERTY_MAVEN_PASSWORD") ?: System.getenv("MAVEN_PASSWORD")
}
}
publishing.repositories.maven("https://repo.codemc.io/repository/maven-snapshots/") {
name = "codemc"
credentials {
username = mavenUsername ?: System.getenv("GRADLE_PROPERTY_MAVEN_USERNAME") ?: System.getenv("MAVEN_USERNAME")
password = mavenPassword ?: System.getenv("GRADLE_PROPERTY_MAVEN_PASSWORD") ?: System.getenv("MAVEN_PASSWORD")
}
}
}
subprojects {
repositories {
mavenCentral()
maven("https://repo.papermc.io/repository/maven-public/") { name = "papermc" }
maven("https://repo.codemc.io/repository/maven-public/") { name = "codeme" }
maven("https://jitpack.io") { name = "jitpack" }
}
tasks {
withType<JavaCompile>().configureEach {
options.encoding = Charsets.UTF_8.name()
options.release = jdkVersion
options.compilerArgs.addAll(listOf(
"--add-modules=jdk.incubator.vector",
"-Xmaxwarns", "1"
))
}
withType<Javadoc> {
@@ -73,93 +140,27 @@ subprojects {
}
}
}
repositories {
mavenCentral()
maven("https://jitpack.io")
maven("https://papermc.io/repo/repository/maven-public/")
}
}
paperweight {
serverProject = project(":${brandName.lowercase()}-server")
remapRepo = "https://repo.papermc.io/repository/maven-public/"
decompileRepo = "https://repo.papermc.io/repository/maven-public/"
usePaperUpstream(providers.gradleProperty("paperCommit")) {
withPaperPatcher {
apiPatchDir.set(projectDir.resolve("patches/api"))
apiOutputDir.set(projectDir.resolve("$brandName-API"))
serverPatchDir.set(projectDir.resolve("patches/server"))
serverOutputDir.set(projectDir.resolve("$brandName-Server"))
}
patchTasks.register("generatedApi") {
isBareDirectory = true
upstreamDirPath = "paper-api-generator/generated"
patchDir = projectDir.resolve("patches/generated-api")
outputDir = projectDir.resolve("paper-api-generator/generated")
}
}
}
val paperRepoVal = property("paperRepo").toString()
val paperBranch = property("paperBranch").toString()
val purpurRepoVal = property("purpurRepo").toString()
val purpurBranch = property("purpurBranch").toString()
val pufferfishRepoVal = property("pufferfishRepo").toString()
val pufferfishBranch = property("pufferfishBranch").toString()
val isUsePufferfish = property("usePufferfish").toString().toBoolean()
alwaysUpToDate {
paperRepo.set("https://github.com/PaperMC/Paper")
paperRef.set("master")
paperRepo.set(paperRepoVal)
paperRef.set(paperBranch)
paperCommitName.set("paperCommit")
purpurRepo.set("https://github.com/PlazmaMC/Purpur")
purpurRef.set("ver/1.20.6")
purpurRepo.set(purpurRepoVal)
purpurRef.set(purpurBranch)
purpurCommitName.set("purpurCommit")
pufferfishRepo.set("https://github.com/PlazmaMC/Pufferfish")
pufferfishRef.set("ver/1.20")
usePufferfish.set(true)
pufferfishRepo.set(pufferfishRepoVal)
pufferfishRef.set(pufferfishBranch)
usePufferfish.set(isUsePufferfish)
}
tasks {
applyPatches {
dependsOn("applyGeneratedApiPatches")
}
rebuildPatches {
dependsOn("rebuildGeneratedApiPatches")
}
generateDevelopmentBundle {
apiCoordinates.set("${project.group}:${brandName.lowercase()}-api")
libraryRepositories.addAll(
"https://repo.maven.apache.org/maven2/",
"https://maven.pkg.github.com/$providerRepo",
"https://papermc.io/repo/repository/maven-public/"
)
}
clean {
doLast {
listOf(
".gradle/caches",
"$brandName-API",
"$brandName-Server",
"paper-api-generator",
"run",
// remove dev environment files
"0001-fixup.patch",
"compare.txt"
).forEach {
projectDir.resolve(it).deleteRecursively()
}
}
}
}
publishing {
publications.create<MavenPublication>("devBundle") {
artifact(tasks.generateDevelopmentBundle) { artifactId = "dev-bundle" }
}
}

View File

@@ -1,18 +1,16 @@
plugins {
java
`kotlin-dsl`
id("com.github.johnrengelman.shadow") version "8.1.1"
id("com.gradleup.shadow") version "8.3.5"
}
kotlin.jvmToolchain(21)
repositories {
mavenCentral()
maven("https://papermc.io/repo/repository/maven-public/")
}
kotlin.jvmToolchain {
languageVersion = JavaLanguageVersion.of(17)
}
dependencies {
shadow("io.papermc.paperweight:paperweight-patcher:1.6.2-SNAPSHOT")
}

View File

@@ -97,7 +97,7 @@ abstract class PurpurUpdateTask : Task() {
fun checkout(
name: String, repo: Provider<String>, ref: Provider<String>, regex: String, block: CheckoutRepo.() -> Unit
): Pair<TaskProvider<out Task>, Directory> {
): Pair<TaskProvider<CheckoutRepo>, Directory> {
val updatePaper = configureTask<SimpleUpstreamUpdateTask>("update${name}Paper", "Update $name's Paper") {
this.repo.convention(extension.paperRepo)
this.ref.convention(extension.paperRef)
@@ -113,10 +113,10 @@ abstract class PurpurUpdateTask : Task() {
this.workDir.set(wd)
this.block()
this.finalizedBy(updatePaper)
// this.finalizedBy(updatePaper)
}
return updatePaper to checkout.flatMap { it.outputDir }.get()
return checkout to checkout.flatMap { it.outputDir }.get()
}
val (checkoutPufferfish, pufferfish) =
@@ -124,9 +124,7 @@ abstract class PurpurUpdateTask : Task() {
onlyIf { extension { usePufferfish } }
}
val (checkoutPurpur, purpur) =
checkout("Purpur", extension.purpurRepo, extension.purpurRef, "paperCommit = ") {
dependsOn(checkoutPufferfish)
}
checkout("Purpur", extension.purpurRepo, extension.purpurRef, "paperCommit = ") {}
pufferfishDir.set(pufferfish)
purpurDir.set(purpur)
@@ -245,7 +243,7 @@ abstract class PurpurUpdateTask : Task() {
@OptIn(ExperimentalPathApi::class)
private fun Path.copyPatch(to: Path, vararg name: String) = walk().sorted()
.filter { entry -> name.any { entry.name.endsWith("$it.patch") } }.map(Path::toFile)
.filter { entry -> name.filter { it != "" }.any { entry.name.endsWith("$it.patch") } }.map(Path::toFile)
.forEachIndexed { count, patch ->
patch.copyTo(
to.resolve("${count + 1}".padStart(4, '0') + "-" + name.first { patch.name.substring(5) == "$it.patch" } + ".patch").toFile(),

View File

@@ -13,17 +13,17 @@ brandName = Plazma
providerName = PlazmaMC
providerRepo = PlazmaMC/PlazmaBukkit
version = 1.20.6-R0.1-SNAPSHOT
mcVersion = 1.20.6
version = 1.21.3-R0.1-SNAPSHOT
mcVersion = 1.21.3
jdkVersion = 21
paperRepo = https://github.com/PaperMC/Paper
paperBranch = master
purpurRepo = https://github.com/PlazmaMC/Purpur
purpurBranch = ver/1.20.6
pufferfishRepo = https://github.com/PlazmaMC/Pufferfish
pufferfishBranch = ver/1.20
usePufferfish = true
paperRepo = https://github.com/PaperMC/Paper-archive
paperBranch = ver/1.21.3
purpurRepo = https://github.com/PurpurMC/Purpur
purpurBranch = ver/1.21.3
pufferfishRepo = https://github.com/pufferfish-gg/Pufferfish
pufferfishBranch = ver/1.21
usePufferfish = false
paperCommit = bd5867a96f792f0eb32c1d249bb4bbc1d8338d14
purpurCommit = 0cbff64ea99f0878244431477d21d9faa14b768f
paperCommit = da7138233f6392e791d790d1c3407414c855f9c2
purpurCommit = 16ce24aa7eb08232030e4570e027f7baefa5f3f9

View File

@@ -1,15 +1,15 @@
[versions]
shadow = "8.1.1"
paperweight = "1.7.1"
shadow = "8.3.5"
remapper = "0.10.3"
paperclip = "3.0.3"
paperweight = "1.7.4"
decompiler = "1.10.1"
remapper = "0.10.1"
[libraries]
paperclip = { group = "io.papermc", name = "paperclip", version.ref = "paperclip" }
remapper = { group = "net.fabricmc", name = "tiny-remapper", version.ref="remapper" }
decompiler = { group = "org.vineflower", name = "vineflower", version.ref = "decompiler" }
paperclip = { group = "io.papermc", name = "paperclip", version.ref = "paperclip" }
[plugins]
shadow = { id = "com.github.johnrengelman.shadow", version.ref = "shadow" }
shadow = { id = "com.gradleup.shadow", version.ref = "shadow" }
paperweight = { id = "io.papermc.paperweight.patcher", version.ref = "paperweight" }

View File

@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME

2
gradlew vendored
View File

@@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.

151
initDev Normal file → Executable file
View File

@@ -3,57 +3,134 @@
# run below command in your terminal:
# source ./initDev
export PROJECT_DIR=$(pwd)
PROJECT_DIR=$(pwd)
alias api="cd $PROJECT_DIR/*-API"
alias srv="cd $PROJECT_DIR/*-Server"
alias cl="clear;"
alias ap="./gradlew --no-rebuild applyPatches"
alias aap="./gradlew --no-rebuild applyAPIPatches"
alias agp="./gradlew --no-rebuild applyGeneratedAPIPatches"
alias asp="./gradlew --no-rebuild applyServerPatches"
alias src="cd $PROJECT_DIR;"
alias ca="cd $PROJECT_DIR/*-API || exit 1; vs;"
alias cg="cd $PROJECT_DIR/paper-api-generator/generated || exit 1; vs;"
alias cs="cd $PROJECT_DIR/*-Server || exit 1; vs;"
alias rp="./gradlew --no-rebuild rebuildPatches"
alias rap="./gradlew --no-rebuild rebuildAPIPatches"
alias rgp="./gradlew --no-rebuild rebuildGeneratedAPIPatches"
alias rsp="./gradlew --no-rebuild rebuildServerPatches"
alias fa="ca __generate_fixup_patch"
alias fg="cg __generate_fixup_patch"
alias fs="cs __generate_fixup_patch"
alias lg="git log --oneline base..HEAD"
alias rc="git rebase --autosquash -i base"
alias rcc="git rebase --continue"
alias gradle="./gradlew" # TODO: Paperweight will not work with Gradle 8.10.2
alias gr="cd $PROJECT_DIR; gradle"
alias grc="gr --no-rebuild"
# generate Fixup patches for Server
function fs() {
cd ./*-Server || exit 1
alias ap="grc applyPatches"
alias aap="grc applyAPIPatches"
alias agp="grc applyGeneratedAPIPatches"
alias asp="grc applyServerPatches"
alias aap!="rm -rf $PROJECT_DIR/*-API; aap"
alias agp!="rm -rf $PROJECT_DIR/paper-api-generator/generated; agp"
alias asp!="rm -rf $PROJECT_DIR/*-Server; asp"
alias aapa="ca vpa"
alias aapc="ca vpc"
alias aapc="ca vps"
alias agpa="cg vpa"
alias agpc="cg vpc"
alias agpc="cg vps"
alias aspa="cs vpa"
alias aspc="cs vpc"
alias aspc="cs vps"
alias rp="grc rebuildPatches"
alias rap="grc rebuildAPIPatches"
alias rgp="grc rebuildGeneratedAPIPatches"
alias rsp="grc rebuildServerPatches"
alias mk="gr build"
alias mko="gr createReobfPaperclipJar"
alias mkm="gr createMojmapPaperclipJar"
alias va="git add"
alias va.="git add ."
alias vl="git log --oneline base..HEAD"
alias vr="git rebase --autosquash base"
alias vra="git rebase --abort"
alias vrc="va.; git rebase --continue"
alias vrs="git rebase --skip"
alias vp="git am --show-current-patch"
alias vpa="git am --abort"
alias vpc="git am --continue"
alias vps="git am --skip"
alias vm="git commit --fixup"
alias vs="git status"
alias vc="git commit --verbose --no-interactive"
alias vcn="vc --no-message"
alias vcm="vc --message"
alias vca="git commit --verbose --no-interactive --all"
alias vcan="git commit --verbose --no-interactive --all --no-message"
alias vcam="git commit --verbose --no-interactive --all --message"
alias ve="git commit --verbose --no-interactive --amend"
alias ven="ve --no-message"
alias vem="ve --message"
alias vea="git commit --verbose --no-interactive --all --amend"
alias vean="vea --no-message"
alias veam="vea --message"
alias as="ca src"
alias al="ca vl"
alias ac="ca va.; vcm"
alias am="ca vm"
alias ae="ca ve"
alias aea="ca vea"
alias aean="ca vean"
alias aeam="ca veam"
alias gs="cg src"
alias gl="cg vl"
alias gc="cg va.; vcm"
alias gm="cg vm"
alias ge="cg ve"
alias gea="cg vea"
alias gean="cg vean"
alias geam="cg veam"
alias ss="cs src"
alias sl="cs vl"
alias sc="cs va.; vcm"
alias sm="cs vm"
alias se="cs ve"
alias sea="cs vea"
alias sean="cs vean"
alias seam="cs veam"
function __generate_fixup_patch() {
garg="."
[[ "$1" == "-x" ]] && garg="--amend"
git add .
git commit -m "fixup"
git commit "$garg" -m "fixup"
git format-patch -1
mv 0001-fixup.patch ../
mv 0001-fixup.patch ../ -f
cd ../
}
# generate Fixup patches for API
function fa() {
cd ./*-API || exit 1
git add .
git commit -m "fixup"
git format-patch -1
mv 0001-fixup.patch ../
cd ../
}
# ReApply Server Patches
function rasp() {
rm -rf ./*-Server
./gradlew applyServerPatches
}
# Commit Updated Upstream
function cuu() {
# shellcheck disable=SC2059
printf "Updated Upstream ($1)$(/bin/cat compare.txt)" | git commit -F -
}
git update-index --assume-unchanged ./build-data/dev-imports.txt
if [ ! -L "$PROJECT_DIR/upstream" ]; then
grc applyPatches
ln -dsf "$PROJECT_DIR/.gradle/caches/paperweight/upstreams/paper" "$PROJECT_DIR/upstream"
fi

View File

@@ -1,31 +1,47 @@
[versions]
gson = "2.10.1"
joml = "1.10.5"
guava = "32.1.2-jre"
sentry = "5.4.0"
fastutil = "8.5.6"
findbugs = "1.3.9"
slf4j-api = "2.0.9"
brigadier = "1.2.9"
bungeechat = "1.20-R0.2"
guava = "33.3.1-jre"
gson = "2.11.0"
bungeechat = "1.20-R0.2-deprecated+build.19"
# snakeyaml
joml = "1.10.8"
json-simple = "1.1.1"
annotations = "24.0.1"
fastutil = "8.5.6"
# adventure
# log4j
slf4j-api = "2.0.9"
sentry = "5.4.0"
# asm
# mvn
annotations = "24.1.0"
checkerqual = "3.21.0"
jspecify = "1.0.0"
[libraries]
joml = { group = "org.joml", name = "joml", version.ref = "joml" }
gson = { group = "com.google.code.gson", name = "gson", version.ref = "gson" }
guava = { group = "com.google.guava", name = "guava", version.ref = "guava" }
sentry = { group = "io.sentry", name = "sentry", version.ref = "sentry" }
fastutil = { group = "it.unimi.dsi", name = "fastutil", version.ref = "fastutil" }
findbugs = { group = "com.google.code.findbugs", name = "jsr305", version.ref = "findbugs" }
brigadier = { group = "com.mojang", name = "brigadier", version.ref = "brigadier" }
slf4j-api = { group = "org.slf4j", name = "slf4j-api", version.ref = "slf4j-api" }
guava = { group = "com.google.guava", name = "guava", version.ref = "guava" }
gson = { group = "com.google.code.gson", name = "gson", version.ref = "gson" }
bungeechat = { group = "net.md-5", name = "bungeecord-chat", version.ref = "bungeechat" }
joml = { group = "org.joml", name = "joml", version.ref = "joml" }
jsonsimple = { group = "com.googlecode.json-simple", name = "json-simple", version.ref = "json-simple" }
fastutil = { group = "it.unimi.dsi", name = "fastutil", version.ref = "fastutil" }
slf4j = { group = "org.slf4j", name = "slf4j-api", version.ref = "slf4j-api" }
sentry = { group = "io.sentry", name = "sentry", version.ref = "sentry" }
annotations = { group = "org.jetbrains", name = "annotations", version.ref = "annotations" }
checkerqual = { group = "org.checkerframework", name = "checker-qual", version.ref = "checkerqual" }
jspecify = { group = "org.jspecify", name = "jspecify", version.ref = "jspecify" }
[bundles]
api = [ "guava", "gson", "joml", "fastutil", "slf4j-api", "sentry", "brigadier" ]
api = [ "brigadier", "guava", "gson", "joml", "fastutil", "slf4j", "sentry", "jspecify" ]
annotations = [ "annotations", "checkerqual" ]

View File

@@ -1,45 +1,73 @@
[versions]
asm = "9.6"
log4j = "2.19.0"
mockito = "5.5.0"
jupiter = "5.10.0"
hamcrest = "2.2"
snakeyaml = "2.2"
adventure = "4.17.0"
log4j = "2.19.0"
asm = "9.7.1"
mvn = "3.9.6"
mvn-resolver = "1.9.18"
commons-lang2 = "2.6"
commons-lang3 = "3.12.0"
maven-provider = "3.9.6"
maven-resolver = "1.9.18"
snakeyaml = "2.2"
junit = "1.10.0"
junit-jupiter = "5.10.0"
junit-pioneer = "2.2.0"
hamcrest = "2.2"
mockito = "5.14.1"
[libraries]
mockito = { group = "org.mockito", name = "mockito-core", version.ref = "mockito" }
jupiter = { group = "org.junit.jupiter", name = "junit-jupiter", version.ref = "jupiter" }
hamcrest = { group = "org.hamcrest", name = "hamcrest", version.ref = "hamcrest" }
snakeyaml = { group = "org.yaml", name = "snakeyaml", version.ref = "snakeyaml" }
asm-head = { group = "org.ow2.asm", name = "asm", version.ref = "asm" }
asm-tree = { group = "org.ow2.asm", name = "asm-tree", version.ref = "asm" }
asm-commons = { group = "org.ow2.asm", name = "asm-commons", version.ref = "asm" }
log4j-api = { group = "org.apache.logging.log4j", name = "log4j-api", version.ref = "log4j" }
log4j-core = { group = "org.apache.logging.log4j", name = "log4j-core", version.ref = "log4j" }
log4j-iostreams = { group = "org.apache.logging.log4j", name = "log4j-iostreams", version.ref = "log4j" }
maven-provider = { group = "org.apache.maven", name = "maven-resolver-provider", version.ref = "maven-provider" }
maven-connector = { group = "org.apache.maven.resolver", name = "maven-resolver-connector-basic", version.ref = "maven-resolver" }
maven-transport = { group = "org.apache.maven.resolver", name = "maven-resolver-transport-http", version.ref = "maven-resolver" }
commons-lang2 = { group = "commons-lang", name = "commons-lang", version.ref = "commons-lang2" }
commons-lang3 = { group = "org.apache.commons", name = "commons-lang3", version.ref = "commons-lang3" }
adventure-bom = { group = "net.kyori", name = "adventure-bom", version.ref = "adventure" }
adventure-api = { group = "net.kyori", name = "adventure-api", version.ref = "adventure" }
adventure-slf4j = { group = "net.kyori", name = "adventure-text-logger-slf4j", version.ref = "adventure" }
adventure-minimessage = { group = "net.kyori", name = "adventure-text-minimessage", version.ref = "adventure" }
adventure-logger-slf4j = { group = "net.kyori", name = "adventure-text-logger-slf4j", version.ref = "adventure" }
adventure-serializer-gson = { group = "net.kyori", name = "adventure-text-serializer-gson", version.ref = "adventure" }
adventure-serializer-ansi = { group = "net.kyori", name = "adventure-text-serializer-ansi", version.ref = "adventure" }
adventure-serializer-plain = { group = "net.kyori", name = "adventure-text-serializer-plain", version.ref = "adventure" }
adventure-serializer-legacy = { group = "net.kyori", name = "adventure-text-serializer-legacy", version.ref = "adventure" }
log4j = { group = "org.apache.logging.log4j", name = "log4j-core", version.ref = "log4j" }
log4j-api = { group = "org.apache.logging.log4j", name = "log4j-api", version.ref = "log4j" }
log4j-stream = { group = "org.apache.logging.log4j", name = "log4j-iostreams", version.ref = "log4j" }
asm = { group = "org.ow2.asm", name = "asm", version.ref = "asm" }
asm-tree = { group = "org.ow2.asm", name = "asm-tree", version.ref = "asm" }
asm-commons = { group = "org.ow2.asm", name = "asm-commons", version.ref = "asm" }
mvn = { group = "org.apache.maven", name = "maven-resolver-provider", version.ref = "mvn" }
mvn-connector = { group = "org.apache.maven.resolver", name = "maven-resolver-connector-basic", version.ref = "mvn-resolver" }
mvn-transport = { group = "org.apache.maven.resolver", name = "maven-resolver-transport-http", version.ref = "mvn-resolver" }
commons-lang2 = { group = "commons-lang", name = "commons-lang", version.ref = "commons-lang2" }
commons-lang3 = { group = "org.apache.commons", name = "commons-lang3", version.ref = "commons-lang3" }
snakeyaml = { group = "org.yaml", name = "snakeyaml", version.ref = "snakeyaml" }
junit = { group = "org.junit.platform", name = "junit-platform-suite-engine", version.ref = "junit" }
junit-jupiter = { group = "org.junit.jupiter", name = "junit-jupiter", version.ref = "junit-jupiter" }
junit-pioneer = { group = "org.junit-pioneer", name = "junit-pioneer", version.ref = "junit-pioneer" }
hamcrest = { group = "org.hamcrest", name = "hamcrest", version.ref = "hamcrest" }
mockito = { group = "org.mockito", name = "mockito-core", version.ref = "mockito" }
[bundles]
asm = [ "asm-head", "asm-commons" ]
test = [ "jupiter", "hamcrest", "mockito", "asm-tree" ]
maven = [ "maven-connector", "maven-transport" ]
adventure = [ "adventure-api", "adventure-slf4j", "adventure-minimessage", "adventure-serializer-gson", "adventure-serializer-plain", "adventure-serializer-legacy" ]
asm = [ "asm", "asm-commons" ]
mvn = [ "mvn-connector", "mvn-transport" ]
test = [
"junit-jupiter",
"hamcrest",
"mockito",
"asm-tree"
]
adventure = [
"adventure-api",
"adventure-minimessage",
"adventure-logger-slf4j",
"adventure-serializer-gson",
"adventure-serializer-plain",
"adventure-serializer-legacy"
]

View File

@@ -1,51 +1,89 @@
[versions]
art = "2.0.3"
jline = "3.27.1"
tca = "1.3.0"
upnp = "1.0"
ansi = "1.0.3"
jansi = "3.21.0"
rhino = "1.7.14"
mysql = "8.2.0"
flare = "34637f3f87"
sqlite = "3.42.0.1"
pioneer = "2.2.0"
haproxy = "4.1.97.Final"
rewriter = "0.0.1"
srgutils = "1.0.9"
velocity = "3.1.2-SNAPSHOT"
disruptor = "3.4.4"
simpleyaml = "1.8.4"
classgraph = "4.8.47"
mapping-io = "0.5.0"
# adventure
# log4j
netty = "4.1.97.Final"
# asm
configurate = "4.2.0-SNAPSHOT"
# commons2
sqlite = "3.46.1.3"
mysql = "9.1.0"
disruptor = "3.4.4"
velocity = "3.3.0-SNAPSHOT"
# mvn
# snakeyaml
simpleyaml = "1.8.4"
rhino = "1.7.14"
upnp = "1.0"
classgraph = "4.8.47"
# test (junit, hamcrest, mockito, asm-tree)
srgutils = "1.0.9"
art = "2.0.3"
rewriter = "0.0.3"
spark-api = "0.1-20240720.200737-2"
spark = "1.10.119-SNAPSHOT"
[libraries]
art = { group = "net.neoforged", name = "AutoRenamingTool", version.ref = "art" }
jline-ffm = { group = "org.jline", name = "jline-terminal-ffm", version.ref = "jline" }
jline-jni = { group = "org.jline", name = "jline-terminal-jni", version.ref = "jline" }
tca = { group = "net.minecrell", name = "terminalconsoleappender", version.ref="tca" }
ansi = { group = "net.kyori", name = "ansi", version.ref = "ansi" }
upnp = { group = "dev.omega24", name = "upnp4j", version.ref = "upnp" }
mysql = { group = "com.mysql", name = "mysql-connector-j", version.ref = "mysql" }
jansi = { group = "org.jline", name = "jline-terminal-jansi", version.ref = "jansi" }
flare = { group = "com.github.technove", name = "flare", version.ref = "flare" }
# adventure
# log4j
netty-haproxy = { group = "io.netty", name = "netty-codec-haproxy", version.ref = "netty" }
# asm
configurate-yaml = { group = "org.spongepowered", name = "configurate-yaml", version.ref = "configurate" }
# commons2
sqlite = { group = "org.xerial", name = "sqlite-jdbc", version.ref = "sqlite" }
pioneer = { group = "org.junit-pioneer", name = "junit-pioneer", version.ref = "pioneer" }
haproxy = { group = "io.netty", name = "netty-codec-haproxy", version.ref = "haproxy" }
srgutils = { group = "net.neoforged", name = "srgutils", version.ref = "srgutils" }
velocity = { group = "com.velocitypowered", name = "velocity-native", version.ref = "velocity" }
mysql = { group = "com.mysql", name = "mysql-connector-j", version.ref = "mysql" }
disruptor = { group = "com.lmax", name = "disruptor", version.ref = "disruptor" }
mappingio = { group = "net.fabricmc", name = "mapping-io", version.ref = "mapping-io" }
classgraph = { group = "io.github.classgraph", name = "classgraph", version.ref = "classgraph" }
simpleyaml = { group = "com.github.carleslc.Simple-YAML", name = "Simple-Yaml", version.ref = "simpleyaml" }
configurate = { group = "org.spongepowered", name = "configurate-yaml", version.ref = "configurate" }
velocity-native = { group = "com.velocitypowered", name = "velocity-native", version.ref = "velocity" }
# snakeyaml
simpleyaml = { group = "com.github.carleslc.Simple-YAML", name = "Simple-Yaml", version.ref = "simpleyaml" }
rhino-engine = { group = "org.mozilla", name = "rhino-engine", version.ref = "rhino" }
rhino-runtime = { group = "org.mozilla", name = "rhino-runtime", version.ref = "rhino" }
rhino-engine = { group = "org.mozilla", name = "rhino-engine", version.ref = "rhino" }
upnp = { group = "dev.omega24", name = "upnp4j", version.ref = "upnp" }
classgraph = { group = "io.github.classgraph", name = "classgraph", version.ref = "classgraph" }
# test (junit, hamcrest, mockito, asm-tree)
srgutils = { group = "net.neoforged", name = "srgutils", version.ref = "srgutils" }
art = { group = "net.neoforged", name = "AutoRenamingTool", version.ref = "art" }
rewriter = { group = "io.papermc", name = "reflection-rewriter", version.ref = "rewriter" }
rewriter-runtime = { group = "io.papermc", name = "reflection-rewriter-runtime", version.ref = "rewriter" }
rewriter-generator = { group = "io.papermc", name = "reflection-rewriter-proxy-generator", version.ref = "rewriter" }
rewriter-proxy = { group = "io.papermc", name = "reflection-rewriter-proxy-generator", version.ref = "rewriter" }
spark-api = { group = "me.lucko", name = "spark-api", version.ref = "spark-api" }
spark = { group = "me.lucko", name = "spark-paper", version.ref = "spark" }
[bundles]
runtime = [ "sqlite", "mysql", "disruptor" ]
implementation = [ "jansi", "tca", "ansi", "upnp", "haproxy", "configurate", "mappingio", "rhino-engine", "rhino-runtime", "srgutils", "art", "rewriter", "rewriter-runtime", "rewriter-generator", "flare" ]
test = [ "classgraph", "pioneer" ]
test = [ "classgraph" ]
implementation = [
"jline-ffm",
"jline-jni",
"tca",
"netty-haproxy",
"configurate-yaml",
"velocity-native",
"rhino-runtime",
"rhino-engine",
"upnp",
"srgutils",
"art",
"rewriter",
"rewriter-runtime",
"rewriter-proxy",
"spark-api",
"spark"
]

View File

@@ -1,545 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Kevin Raneri <kevin.raneri@gmail.com>
Date: Sun, 2 Jun 2024 23:04:51 +0000
Subject: [PATCH] Pufferfish API Changes
Pufferfish
Copyright (C) 2024 Pufferfish Studios LLC
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 <http://www.gnu.org/licenses/>.
diff --git a/build.gradle.kts b/build.gradle.kts
index fd39ed209b20c927054b8482c400beeeeab460a3..1336685fde70c4a88a1fb591cdfcd781a8f06d0b 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -52,6 +52,7 @@ dependencies {
apiAndDocs("net.kyori:adventure-text-logger-slf4j")
api("org.apache.logging.log4j:log4j-api:$log4jVersion")
api("org.slf4j:slf4j-api:$slf4jVersion")
+ api("io.sentry:sentry:5.4.0") // Pufferfish
implementation("org.ow2.asm:asm:9.7")
implementation("org.ow2.asm:asm-commons:9.7")
@@ -130,6 +131,13 @@ val generateApiVersioningFile by tasks.registering {
}
}
+// Pufferfish Start
+tasks.withType<JavaCompile> {
+ val compilerArgs = options.compilerArgs
+ compilerArgs.add("--add-modules=jdk.incubator.vector")
+}
+// Pufferfish End
+
tasks.jar {
from(generateApiVersioningFile.map { it.outputs.files.singleFile }) {
into("META-INF/maven/${project.group}/${project.name}")
diff --git a/src/main/java/gg/pufferfish/pufferfish/sentry/SentryContext.java b/src/main/java/gg/pufferfish/pufferfish/sentry/SentryContext.java
new file mode 100644
index 0000000000000000000000000000000000000000..10310fdd53de28efb8a8250f6d3b0c8eb08fb68a
--- /dev/null
+++ b/src/main/java/gg/pufferfish/pufferfish/sentry/SentryContext.java
@@ -0,0 +1,161 @@
+package gg.pufferfish.pufferfish.sentry;
+
+import com.google.gson.Gson;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.util.Map;
+import java.util.TreeMap;
+import org.apache.logging.log4j.ThreadContext;
+import org.bukkit.command.Command;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+import org.bukkit.event.Event;
+import org.bukkit.event.player.PlayerEvent;
+import org.bukkit.plugin.Plugin;
+import org.bukkit.plugin.RegisteredListener;
+import org.jetbrains.annotations.Nullable;
+
+public class SentryContext {
+
+ private static final Gson GSON = new Gson();
+
+ public static void setPluginContext(@Nullable Plugin plugin) {
+ if (plugin != null) {
+ ThreadContext.put("pufferfishsentry_pluginname", plugin.getName());
+ ThreadContext.put("pufferfishsentry_pluginversion", plugin.getDescription().getVersion());
+ }
+ }
+
+ public static void removePluginContext() {
+ ThreadContext.remove("pufferfishsentry_pluginname");
+ ThreadContext.remove("pufferfishsentry_pluginversion");
+ }
+
+ public static void setSenderContext(@Nullable CommandSender sender) {
+ if (sender != null) {
+ ThreadContext.put("pufferfishsentry_playername", sender.getName());
+ if (sender instanceof Player player) {
+ ThreadContext.put("pufferfishsentry_playerid", player.getUniqueId().toString());
+ }
+ }
+ }
+
+ public static void removeSenderContext() {
+ ThreadContext.remove("pufferfishsentry_playername");
+ ThreadContext.remove("pufferfishsentry_playerid");
+ }
+
+ public static void setEventContext(Event event, RegisteredListener registration) {
+ setPluginContext(registration.getPlugin());
+
+ try {
+ // Find the player that was involved with this event
+ Player player = null;
+ if (event instanceof PlayerEvent) {
+ player = ((PlayerEvent) event).getPlayer();
+ } else {
+ Class<? extends Event> eventClass = event.getClass();
+
+ Field playerField = null;
+
+ for (Field field : eventClass.getDeclaredFields()) {
+ if (field.getType().equals(Player.class)) {
+ playerField = field;
+ break;
+ }
+ }
+
+ if (playerField != null) {
+ playerField.setAccessible(true);
+ player = (Player) playerField.get(event);
+ }
+ }
+
+ if (player != null) {
+ setSenderContext(player);
+ }
+ } catch (Exception e) {} // We can't really safely log exceptions.
+
+ ThreadContext.put("pufferfishsentry_eventdata", GSON.toJson(serializeFields(event)));
+ }
+
+ public static void removeEventContext() {
+ removePluginContext();
+ removeSenderContext();
+ ThreadContext.remove("pufferfishsentry_eventdata");
+ }
+
+ private static Map<String, String> serializeFields(Object object) {
+ Map<String, String> fields = new TreeMap<>();
+ fields.put("_class", object.getClass().getName());
+ for (Field declaredField : object.getClass().getDeclaredFields()) {
+ try {
+ if (Modifier.isStatic(declaredField.getModifiers())) {
+ continue;
+ }
+
+ String fieldName = declaredField.getName();
+ if (fieldName.equals("handlers")) {
+ continue;
+ }
+ declaredField.setAccessible(true);
+ Object value = declaredField.get(object);
+ if (value != null) {
+ fields.put(fieldName, value.toString());
+ } else {
+ fields.put(fieldName, "<null>");
+ }
+ } catch (Exception e) {} // We can't really safely log exceptions.
+ }
+ return fields;
+ }
+
+ public static class State {
+
+ private Plugin plugin;
+ private Command command;
+ private String commandLine;
+ private Event event;
+ private RegisteredListener registeredListener;
+
+ public Plugin getPlugin() {
+ return plugin;
+ }
+
+ public void setPlugin(Plugin plugin) {
+ this.plugin = plugin;
+ }
+
+ public Command getCommand() {
+ return command;
+ }
+
+ public void setCommand(Command command) {
+ this.command = command;
+ }
+
+ public String getCommandLine() {
+ return commandLine;
+ }
+
+ public void setCommandLine(String commandLine) {
+ this.commandLine = commandLine;
+ }
+
+ public Event getEvent() {
+ return event;
+ }
+
+ public void setEvent(Event event) {
+ this.event = event;
+ }
+
+ public RegisteredListener getRegisteredListener() {
+ return registeredListener;
+ }
+
+ public void setRegisteredListener(RegisteredListener registeredListener) {
+ this.registeredListener = registeredListener;
+ }
+ }
+}
diff --git a/src/main/java/gg/pufferfish/pufferfish/simd/SIMDChecker.java b/src/main/java/gg/pufferfish/pufferfish/simd/SIMDChecker.java
new file mode 100644
index 0000000000000000000000000000000000000000..ab5fea0b03224bf249352ce340e94704ff713345
--- /dev/null
+++ b/src/main/java/gg/pufferfish/pufferfish/simd/SIMDChecker.java
@@ -0,0 +1,40 @@
+package gg.pufferfish.pufferfish.simd;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import jdk.incubator.vector.FloatVector;
+import jdk.incubator.vector.IntVector;
+import jdk.incubator.vector.VectorSpecies;
+
+/**
+ * Basically, java is annoying and we have to push this out to its own class.
+ */
+@Deprecated
+public class SIMDChecker {
+
+ @Deprecated
+ public static boolean canEnable(Logger logger) {
+ try {
+ if (SIMDDetection.getJavaVersion() != 17 && SIMDDetection.getJavaVersion() != 18 && SIMDDetection.getJavaVersion() != 19) {
+ return false;
+ } else {
+ SIMDDetection.testRun = true;
+
+ VectorSpecies<Integer> ISPEC = IntVector.SPECIES_PREFERRED;
+ VectorSpecies<Float> FSPEC = FloatVector.SPECIES_PREFERRED;
+
+ logger.log(Level.INFO, "Max SIMD vector size on this system is " + ISPEC.vectorBitSize() + " bits (int)");
+ logger.log(Level.INFO, "Max SIMD vector size on this system is " + FSPEC.vectorBitSize() + " bits (float)");
+
+ if (ISPEC.elementSize() < 2 || FSPEC.elementSize() < 2) {
+ logger.log(Level.WARNING, "SIMD is not properly supported on this system!");
+ return false;
+ }
+
+ return true;
+ }
+ } catch (NoClassDefFoundError | Exception ignored) {} // Basically, we don't do anything. This lets us detect if it's not functional and disable it.
+ return false;
+ }
+
+}
diff --git a/src/main/java/gg/pufferfish/pufferfish/simd/SIMDDetection.java b/src/main/java/gg/pufferfish/pufferfish/simd/SIMDDetection.java
new file mode 100644
index 0000000000000000000000000000000000000000..a84889d3e9cfc4d7ab5f867820a6484c6070711b
--- /dev/null
+++ b/src/main/java/gg/pufferfish/pufferfish/simd/SIMDDetection.java
@@ -0,0 +1,35 @@
+package gg.pufferfish.pufferfish.simd;
+
+import java.util.logging.Logger;
+
+@Deprecated
+public class SIMDDetection {
+
+ public static boolean isEnabled = false;
+ public static boolean versionLimited = false;
+ public static boolean testRun = false;
+
+ @Deprecated
+ public static boolean canEnable(Logger logger) {
+ try {
+ return SIMDChecker.canEnable(logger);
+ } catch (NoClassDefFoundError | Exception ignored) {
+ return false;
+ }
+ }
+
+ @Deprecated
+ public static int getJavaVersion() {
+ // https://stackoverflow.com/a/2591122
+ String version = System.getProperty("java.version");
+ if(version.startsWith("1.")) {
+ version = version.substring(2, 3);
+ } else {
+ int dot = version.indexOf(".");
+ if(dot != -1) { version = version.substring(0, dot); }
+ }
+ version = version.split("-")[0]; // Azul is stupid
+ return Integer.parseInt(version);
+ }
+
+}
diff --git a/src/main/java/gg/pufferfish/pufferfish/simd/VectorMapPalette.java b/src/main/java/gg/pufferfish/pufferfish/simd/VectorMapPalette.java
new file mode 100644
index 0000000000000000000000000000000000000000..ae2464920c9412ac90b819a540ee58be0741465f
--- /dev/null
+++ b/src/main/java/gg/pufferfish/pufferfish/simd/VectorMapPalette.java
@@ -0,0 +1,83 @@
+package gg.pufferfish.pufferfish.simd;
+
+import java.awt.Color;
+import jdk.incubator.vector.FloatVector;
+import jdk.incubator.vector.IntVector;
+import jdk.incubator.vector.VectorMask;
+import jdk.incubator.vector.VectorSpecies;
+import org.bukkit.map.MapPalette;
+
+@Deprecated
+public class VectorMapPalette {
+
+ private static final VectorSpecies<Integer> I_SPEC = IntVector.SPECIES_PREFERRED;
+ private static final VectorSpecies<Float> F_SPEC = FloatVector.SPECIES_PREFERRED;
+
+ @Deprecated
+ public static void matchColorVectorized(int[] in, byte[] out) {
+ int speciesLength = I_SPEC.length();
+ int i;
+ for (i = 0; i < in.length - speciesLength; i += speciesLength) {
+ float[] redsArr = new float[speciesLength];
+ float[] bluesArr = new float[speciesLength];
+ float[] greensArr = new float[speciesLength];
+ int[] alphasArr = new int[speciesLength];
+
+ for (int j = 0; j < speciesLength; j++) {
+ alphasArr[j] = (in[i + j] >> 24) & 0xFF;
+ redsArr[j] = (in[i + j] >> 16) & 0xFF;
+ greensArr[j] = (in[i + j] >> 8) & 0xFF;
+ bluesArr[j] = (in[i + j] >> 0) & 0xFF;
+ }
+
+ IntVector alphas = IntVector.fromArray(I_SPEC, alphasArr, 0);
+ FloatVector reds = FloatVector.fromArray(F_SPEC, redsArr, 0);
+ FloatVector greens = FloatVector.fromArray(F_SPEC, greensArr, 0);
+ FloatVector blues = FloatVector.fromArray(F_SPEC, bluesArr, 0);
+ IntVector resultIndex = IntVector.zero(I_SPEC);
+ VectorMask<Integer> modificationMask = VectorMask.fromLong(I_SPEC, 0xffffffff);
+
+ modificationMask = modificationMask.and(alphas.lt(128).not());
+ FloatVector bestDistances = FloatVector.broadcast(F_SPEC, Float.MAX_VALUE);
+
+ for (int c = 4; c < MapPalette.colors.length; c++) {
+ // We're using 32-bit floats here because it's 2x faster and nobody will know the difference.
+ // For correctness, the original algorithm uses 64-bit floats instead. Completely unnecessary.
+ FloatVector compReds = FloatVector.broadcast(F_SPEC, MapPalette.colors[c].getRed());
+ FloatVector compGreens = FloatVector.broadcast(F_SPEC, MapPalette.colors[c].getGreen());
+ FloatVector compBlues = FloatVector.broadcast(F_SPEC, MapPalette.colors[c].getBlue());
+
+ FloatVector rMean = reds.add(compReds).div(2.0f);
+ FloatVector rDiff = reds.sub(compReds);
+ FloatVector gDiff = greens.sub(compGreens);
+ FloatVector bDiff = blues.sub(compBlues);
+
+ FloatVector weightR = rMean.div(256.0f).add(2);
+ FloatVector weightG = FloatVector.broadcast(F_SPEC, 4.0f);
+ FloatVector weightB = FloatVector.broadcast(F_SPEC, 255.0f).sub(rMean).div(256.0f).add(2.0f);
+
+ FloatVector distance = weightR.mul(rDiff).mul(rDiff).add(weightG.mul(gDiff).mul(gDiff)).add(weightB.mul(bDiff).mul(bDiff));
+
+ // Now we compare to the best distance we've found.
+ // This mask contains a "1" if better, and a "0" otherwise.
+ VectorMask<Float> bestDistanceMask = distance.lt(bestDistances);
+ bestDistances = bestDistances.blend(distance, bestDistanceMask); // Update the best distances
+
+ // Update the result array
+ // We also AND with the modification mask because we don't want to interfere if the alpha value isn't large enough.
+ resultIndex = resultIndex.blend(c, bestDistanceMask.cast(I_SPEC).and(modificationMask)); // Update the results
+ }
+
+ for (int j = 0; j < speciesLength; j++) {
+ int index = resultIndex.lane(j);
+ out[i + j] = (byte) (index < 128 ? index : -129 + (index - 127));
+ }
+ }
+
+ // For the final ones, fall back to the regular method
+ for (; i < in.length; i++) {
+ out[i] = MapPalette.matchColor(new Color(in[i], true));
+ }
+ }
+
+}
diff --git a/src/main/java/io/papermc/paper/ServerBuildInfo.java b/src/main/java/io/papermc/paper/ServerBuildInfo.java
index 9df9d09aa477d4cd3c496ba0933c816df1ef0964..ad81341bdd1eb73554cd24f27ac5d655d89db791 100644
--- a/src/main/java/io/papermc/paper/ServerBuildInfo.java
+++ b/src/main/java/io/papermc/paper/ServerBuildInfo.java
@@ -17,6 +17,13 @@ public interface ServerBuildInfo {
* The brand id for Paper.
*/
Key BRAND_PAPER_ID = Key.key("papermc", "paper");
+
+ // Pufferfish start
+ /**
+ * The brand id for Paper.
+ */
+ Key BRAND_PUFFERFISH_ID = Key.key("pufferfishgg", "pufferfish");
+ // Pufferfish end
/**
* Gets the {@code ServerBuildInfo}.
diff --git a/src/main/java/org/bukkit/map/MapPalette.java b/src/main/java/org/bukkit/map/MapPalette.java
index c80faa079eca1564847070f0338fc98024639829..e632d51d3487eb4807243b6705999ad124466bf5 100644
--- a/src/main/java/org/bukkit/map/MapPalette.java
+++ b/src/main/java/org/bukkit/map/MapPalette.java
@@ -1,6 +1,7 @@
package org.bukkit.map;
import com.google.common.base.Preconditions;
+import gg.pufferfish.pufferfish.simd.SIMDDetection; // Pufferfish
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Image;
@@ -40,7 +41,7 @@ public final class MapPalette {
}
@NotNull
- static final Color[] colors = {
+ public static final Color[] colors = { // Pufferfish - public access
c(0, 0, 0, 0), c(0, 0, 0, 0), c(0, 0, 0, 0), c(0, 0, 0, 0),
c(89, 125, 39), c(109, 153, 48), c(127, 178, 56), c(67, 94, 29),
c(174, 164, 115), c(213, 201, 140), c(247, 233, 163), c(130, 123, 86),
@@ -211,9 +212,15 @@ public final class MapPalette {
temp.getRGB(0, 0, temp.getWidth(), temp.getHeight(), pixels, 0, temp.getWidth());
byte[] result = new byte[temp.getWidth() * temp.getHeight()];
+ // Pufferfish start
+ if (!SIMDDetection.isEnabled) {
for (int i = 0; i < pixels.length; i++) {
result[i] = matchColor(new Color(pixels[i], true));
}
+ } else {
+ gg.pufferfish.pufferfish.simd.VectorMapPalette.matchColorVectorized(pixels, result);
+ }
+ // Pufferfish end
return result;
}
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
index 07a9c9e254188c251165ca84c8e961fccda01175..5dc64d8c9aeae612fd31af0673f3530a9e777dfc 100644
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
@@ -596,7 +596,9 @@ public final class SimplePluginManager implements PluginManager {
// Paper start
private void handlePluginException(String msg, Throwable ex, Plugin plugin) {
+ gg.pufferfish.pufferfish.sentry.SentryContext.setPluginContext(plugin); // Pufferfish
server.getLogger().log(Level.SEVERE, msg, ex);
+ gg.pufferfish.pufferfish.sentry.SentryContext.removePluginContext(); // Pufferfish
callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerPluginEnableDisableException(msg, ex, plugin)));
}
// Paper end
@@ -666,9 +668,11 @@ public final class SimplePluginManager implements PluginManager {
));
}
} catch (Throwable ex) {
+ gg.pufferfish.pufferfish.sentry.SentryContext.setEventContext(event, registration); // Pufferfish
// Paper start - error reporting
String msg = "Could not pass event " + event.getEventName() + " to " + registration.getPlugin().getDescription().getFullName();
server.getLogger().log(Level.SEVERE, msg, ex);
+ gg.pufferfish.pufferfish.sentry.SentryContext.removeEventContext(); // Pufferfish
if (!(event instanceof com.destroystokyo.paper.event.server.ServerExceptionEvent)) { // We don't want to cause an endless event loop
callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerEventException(msg, ex, registration.getPlugin(), registration.getListener(), event)));
}
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
index eaefbb00e9993d54906cc8cf35cf753c0d6c7707..301e82369603f3dd6e6c1bd380da4bacacd7ef6c 100644
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
@@ -336,7 +336,13 @@ public final class JavaPluginLoader implements PluginLoader {
try {
jPlugin.setEnabled(true);
} catch (Throwable ex) {
+ gg.pufferfish.pufferfish.sentry.SentryContext.setPluginContext(plugin); // Pufferfish
server.getLogger().log(Level.SEVERE, "Error occurred while enabling " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
+ gg.pufferfish.pufferfish.sentry.SentryContext.removePluginContext(); // Pufferfish
+ // Paper start - Disable plugins that fail to load
+ this.server.getPluginManager().disablePlugin(jPlugin);
+ return;
+ // Paper end
}
// Perhaps abort here, rather than continue going, but as it stands,
@@ -361,7 +367,9 @@ public final class JavaPluginLoader implements PluginLoader {
try {
jPlugin.setEnabled(false);
} catch (Throwable ex) {
+ gg.pufferfish.pufferfish.sentry.SentryContext.setPluginContext(plugin); // Pufferfish
server.getLogger().log(Level.SEVERE, "Error occurred while disabling " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
+ gg.pufferfish.pufferfish.sentry.SentryContext.removePluginContext(); // Pufferfish
}
if (cloader instanceof PluginClassLoader) {
diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
index 7e4f7cb2afbc145e532285c793573ad107bc3033..12449e18180d604e9cbbc744da74a8b222a18e1f 100644
--- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
+++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
@@ -50,6 +50,8 @@ public final class PluginClassLoader extends URLClassLoader implements io.paperm
private io.papermc.paper.plugin.provider.classloader.PluginClassLoaderGroup classLoaderGroup; // Paper
public io.papermc.paper.plugin.provider.entrypoint.DependencyContext dependencyContext; // Paper
+ private boolean closed = false; // Pufferfish
+
static {
ClassLoader.registerAsParallelCapable();
}
@@ -197,6 +199,7 @@ public final class PluginClassLoader extends URLClassLoader implements io.paperm
throw new ClassNotFoundException(name);
}
+ public boolean _airplane_hasClass(@NotNull String name) { return this.classes.containsKey(name); } // Pufferfish
@Override
protected Class<?> findClass(String name) throws ClassNotFoundException {
if (name.startsWith("org.bukkit.") || name.startsWith("net.minecraft.")) {
@@ -204,7 +207,7 @@ public final class PluginClassLoader extends URLClassLoader implements io.paperm
}
Class<?> result = classes.get(name);
- if (result == null) {
+ if (result == null && !this.closed) { // Pufferfish
String path = name.replace('.', '/').concat(".class");
JarEntry entry = jar.getJarEntry(path);
@@ -251,6 +254,7 @@ public final class PluginClassLoader extends URLClassLoader implements io.paperm
this.setClass(name, result); // Paper
}
+ if (result == null) throw new ClassNotFoundException(name); // Pufferfish
return result;
}
@@ -265,6 +269,7 @@ public final class PluginClassLoader extends URLClassLoader implements io.paperm
// Paper end
super.close();
} finally {
+ this.closed = true; // Pufferfish
jar.close();
}
}

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Use Gradle Version Catalogs
diff --git a/build.gradle.kts b/build.gradle.kts
index 7aa138f7123dcfb7d1d9ae9efcf2359522f5d2fd..67324689a65e8ed65c9d27c9b50073488c235c51 100644
index b0fd6c1804844f09428051952e3ac4e58f8c859c..2b668f8a5c245d024e03c94b7d8872448f1929cf 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -9,11 +9,13 @@ java {
@@ -22,8 +22,8 @@ index 7aa138f7123dcfb7d1d9ae9efcf2359522f5d2fd..67324689a65e8ed65c9d27c9b5007348
val apiAndDocs: Configuration by configurations.creating {
attributes {
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.DOCUMENTATION))
@@ -27,56 +29,31 @@ configurations.api {
}
@@ -39,58 +41,30 @@ abstract class MockitoAgentProvider : CommandLineArgumentProvider {
// Paper end - configure mockito agent that is needed in newer java versions
dependencies {
- api("com.mojang:brigadier:1.2.9") // Paper - Brigadier command api
@@ -53,8 +53,8 @@ index 7aa138f7123dcfb7d1d9ae9efcf2359522f5d2fd..67324689a65e8ed65c9d27c9b5007348
- api("org.slf4j:slf4j-api:$slf4jVersion")
- api("io.sentry:sentry:5.4.0") // Pufferfish
-
- implementation("org.ow2.asm:asm:9.7")
- implementation("org.ow2.asm:asm-commons:9.7")
- implementation("org.ow2.asm:asm:9.7.1")
- implementation("org.ow2.asm:asm-commons:9.7.1")
- // Paper end
-
- api("org.apache.maven:maven-resolver-provider:3.9.6") // Paper - make API dependency for Paper Plugins
@@ -70,41 +70,42 @@ index 7aa138f7123dcfb7d1d9ae9efcf2359522f5d2fd..67324689a65e8ed65c9d27c9b5007348
- compileOnlyApi(checkerQual)
- testCompileOnly(checkerQual)
- // Paper end
- api("org.jspecify:jspecify:1.0.0") // Paper - add jspecify
-
- testImplementation("org.apache.commons:commons-lang3:3.12.0")
- testImplementation("org.junit.jupiter:junit-jupiter:5.10.2")
- testImplementation("org.hamcrest:hamcrest:2.2")
- testImplementation("org.mockito:mockito-core:5.11.0")
- testImplementation("org.ow2.asm:asm-tree:9.7")
+
- testImplementation("org.mockito:mockito-core:5.14.1")
- testImplementation("org.ow2.asm:asm-tree:9.7.1")
- mockitoAgent("org.mockito:mockito-core:5.14.1") { isTransitive = false } // Paper - configure mockito agent that is needed in newer java versions
+ // Plazma start - Use Gradle Version Catalogs
+ implementation(common.bundles.asm)
+
+ api(api.bundles.api)
+ api(common.snakeyaml)
+ api(common.log4j.api)
+ api(common.maven.provider)
+ api(api.jsonsimple) { isTransitive = false }
+ api(api.bungeechat) { exclude("com.google.guava", "guava") }
+ api(common.snakeyaml)
+ api(api.jsonsimple) { isTransitive = false }
+ apiAndDocs(platform(common.adventure.bom))
+ apiAndDocs(common.bundles.adventure)
+ api(common.log4j.api)
+
+ implementation(common.bundles.asm)
+
+ api(common.mvn)
+ compileOnly(common.bundles.mvn)
+
+ compileOnly(common.bundles.maven)
+ compileOnly(api.annotations)
+ compileOnlyApi(api.checkerqual)
+ testCompileOnly(api.annotations)
+
+ compileOnlyApi(api.checkerqual)
+ testCompileOnly(api.checkerqual)
+
+ testImplementation(common.asm.tree)
+ testImplementation(common.commons.lang3)
+ testImplementation(common.bundles.test)
+
+ testCompileOnly(api.annotations)
+ testCompileOnly(api.checkerqual)
+ mockitoAgent(common.mockito) { isTransitive = false }
+ // Plazma end
+
}
// Paper start
@@ -157,25 +134,16 @@ tasks.withType<Javadoc> {
@@ -175,27 +149,25 @@ tasks.withType<Javadoc> {
options.use()
options.isDocFilesSubDirs = true
options.links(
@@ -115,9 +116,11 @@ index 7aa138f7123dcfb7d1d9ae9efcf2359522f5d2fd..67324689a65e8ed65c9d27c9b5007348
- // Paper start - add missing javadoc links
- "https://javadoc.io/doc/org.joml/joml/1.10.5/index.html",
- "https://www.javadoc.io/doc/com.google.code.gson/gson/2.10.1",
- "https://jspecify.dev/docs/api/",
- // Paper end
- // Paper start
- "https://jd.advntr.dev/api/$adventureVersion/",
- "https://jd.advntr.dev/key/$adventureVersion/",
- "https://jd.advntr.dev/text-minimessage/$adventureVersion/",
- "https://jd.advntr.dev/text-serializer-gson/$adventureVersion/",
- "https://jd.advntr.dev/text-serializer-legacy/$adventureVersion/",
@@ -133,9 +136,18 @@ index 7aa138f7123dcfb7d1d9ae9efcf2359522f5d2fd..67324689a65e8ed65c9d27c9b5007348
+ "https://javadoc.io/doc/org.jetbrains/annotations/${api.annotations.orNull?.version}/",
+ "https://javadoc.io/doc/org.joml/joml/${api.joml.orNull?.version}/index.html",
+ "https://www.javadoc.io/doc/com.google.code.gson/gson/${api.gson.orNull?.version}",
+ "https://javadoc.io/doc/org.slf4j/slf4j-api/${api.slf4j.api.orNull?.version}/",
+ "https://jspecify.dev/docs/api/", //diff on change
+ "https://jd.advntr.dev/api/${common.adventure.api.orNull?.version}/",
+ "https://jd.advntr.dev/key/${common.adventure.api.orNull?.version}/",
+ "https://jd.advntr.dev/text-minimessage/${common.adventure.api.orNull?.version}/",
+ "https://jd.advntr.dev/text-serializer-gson/${common.adventure.api.orNull?.version}/",
+ "https://jd.advntr.dev/text-serializer-legacy/${common.adventure.api.orNull?.version}/",
+ "https://jd.advntr.dev/text-serializer-plain/${common.adventure.api.orNull?.version}/",
+ "https://jd.advntr.dev/text-logger-slf4j/${common.adventure.api.orNull?.version}/",
+ "https://javadoc.io/doc/org.yaml/snakeyaml/${common.snakeyaml.orNull?.version}/",
+ "https://javadoc.io/doc/org.slf4j/slf4j-api/${api.slf4j.orNull?.version}/",
+ "https://javadoc.io/doc/org.apache.logging.log4j/log4j-api/${common.log4j.api.orNull?.version}/",
+ "https://javadoc.io/doc/org.apache.maven.resolver/maven-resolver-api/${common.maven.connector.orNull?.version}",
+ "https://javadoc.io/doc/org.apache.maven.resolver/maven-resolver-api/${common.mvn.connector.orNull?.version}",
+ // Plazma end
)
options.tags("apiNote:a:API Note:")

View File

@@ -1,38 +1,11 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Tue, 14 May 2024 18:36:30 +0900
Subject: [PATCH] Rebrand
Subject: [PATCH] Fork-friendly Rebranding
diff --git a/MIT.txt b/MIT.txt
new file mode 100644
index 0000000000000000000000000000000000000000..67d405764ed68083d0164b1af0eabc0af7f6efea
--- /dev/null
+++ b/MIT.txt
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2024 Paper Contributors
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom
+the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
+AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/src/main/java/co/aikar/timings/TimingHandler.java b/src/main/java/co/aikar/timings/TimingHandler.java
index 199789d56d22fcb1b77ebd56805cc28aa5a5ab0a..3b3bcfa6fa2dbcc7fef899cc7570da097437ab3a 100644
index 199789d56d22fcb1b77ebd56805cc28aa5a5ab0a..41d10421e1e79711e2e90ff2dc225bfd9cac9284 100644
--- a/src/main/java/co/aikar/timings/TimingHandler.java
+++ b/src/main/java/co/aikar/timings/TimingHandler.java
@@ -127,7 +127,7 @@ class TimingHandler implements Timing {
@@ -40,19 +13,19 @@ index 199789d56d22fcb1b77ebd56805cc28aa5a5ab0a..3b3bcfa6fa2dbcc7fef899cc7570da09
last.timingDepth = 0;
if ("Minecraft".equalsIgnoreCase(last.identifier.group)) {
- Logger.getGlobal().log(Level.SEVERE, "TIMING_STACK_CORRUPTION - Look above this for any errors and report this to Paper unless it has a plugin in the stack trace (" + last.identifier + " did not stopTiming)");
+ Logger.getGlobal().log(Level.SEVERE, "TIMING_STACK_CORRUPTION - Look above this for any errors and report this to " + io.papermc.paper.ServerBuildInfo.buildInfo().brandName() + " unless it has a plugin in the stack trace (" + last.identifier + " did not stopTiming)");
+ Logger.getGlobal().log(Level.SEVERE, "TIMING_STACK_CORRUPTION - Look above this for any errors and report this to " + io.papermc.paper.ServerBuildInfo.buildInfo().brandName() + " unless it has a plugin in the stack trace (" + last.identifier + " did not stopTiming)"); // Plazma - Fork-friendly Rebranding
} else {
Logger.getGlobal().log(Level.SEVERE, "TIMING_STACK_CORRUPTION - Report this to the plugin " + last.identifier.group + " (Look for errors above this in the logs) (" + last.identifier + " did not stopTiming)", new Throwable());
}
diff --git a/src/main/java/io/papermc/paper/ServerBuildInfo.java b/src/main/java/io/papermc/paper/ServerBuildInfo.java
index fe23268c418cccbd45caf2870f7931cfed978d28..bcf09f735e98f8bbce7c7dfab802ad20e2f17548 100644
index 7196594e07af19a14c320d77df893978525fe386..6ac3376f12df2ee3e0519ab8b5a0c8211350e550 100644
--- a/src/main/java/io/papermc/paper/ServerBuildInfo.java
+++ b/src/main/java/io/papermc/paper/ServerBuildInfo.java
@@ -32,6 +32,29 @@ public interface ServerBuildInfo {
@@ -33,6 +33,29 @@ public interface ServerBuildInfo {
Key BRAND_PURPUR_ID = Key.key("purpurmc", "purpur");
// Purpur end
+ // Plazma start - Rebranding
+ // Plazma start - Fork-friendly Rebranding
+ /**
+ * The brand id for Plazma.
+ */
@@ -73,25 +46,25 @@ index fe23268c418cccbd45caf2870f7931cfed978d28..bcf09f735e98f8bbce7c7dfab802ad20
+ BRAND_PURPUR_ID,
+ BRAND_PLAZMA_ID
+ );
+ // Plazma end - Rebranding
+ // Plazma end - Fork-friendly Rebranding
+
/**
* Gets the {@code ServerBuildInfo}.
*
diff --git a/src/main/java/org/bukkit/command/defaults/VersionCommand.java b/src/main/java/org/bukkit/command/defaults/VersionCommand.java
index 3d29c47ac0620af82d990faf5dfc266c6f0235f1..0dd22efb7f318867d0f099e336505d2830883745 100644
index c880d0010849ab733ad13bbd18fab3c864d0cf61..316317222a137c2781b9b0c38948912e9dd08c76 100644
--- a/src/main/java/org/bukkit/command/defaults/VersionCommand.java
+++ b/src/main/java/org/bukkit/command/defaults/VersionCommand.java
@@ -258,7 +258,7 @@ public class VersionCommand extends BukkitCommand {
@@ -259,7 +259,7 @@ public class VersionCommand extends BukkitCommand {
// Purpur start
int distance = getVersionFetcher().distance();
final Component message = Component.join(net.kyori.adventure.text.JoinConfiguration.separator(Component.newline()),
- ChatColor.parseMM("<grey>Current Purpur Version: %s%s*", distance == 0 ? "<green>" : distance > 0 ? "<yellow>" : "<red>", Bukkit.getVersion()),
+ ChatColor.parseMM("<grey>Current " + io.papermc.paper.ServerBuildInfo.buildInfo().brandName() + " Version: %s%s*", distance == 0 ? "<green>" : distance > 0 ? "<yellow>" : "<red>", Bukkit.getVersion()),
+ ChatColor.parseMM("<grey>Current " + io.papermc.paper.ServerBuildInfo.buildInfo().brandName() + " Version: %s%s*", distance == 0 ? "<green>" : distance > 0 ? "<yellow>" : "<red>", Bukkit.getVersion()), // Plazma - Fork-friendly Rebranding
// Purpur end
msg
);
@@ -281,6 +281,7 @@ public class VersionCommand extends BukkitCommand {
@@ -282,6 +282,7 @@ public class VersionCommand extends BukkitCommand {
}
}
@@ -99,7 +72,7 @@ index 3d29c47ac0620af82d990faf5dfc266c6f0235f1..0dd22efb7f318867d0f099e336505d28
private static int getDistance(@NotNull String repo, @NotNull String hash) {
try {
BufferedReader reader = Resources.asCharSource(
@@ -301,4 +302,5 @@ public class VersionCommand extends BukkitCommand {
@@ -302,4 +303,5 @@ public class VersionCommand extends BukkitCommand {
return -1;
}
}

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Plazma Configurations
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index ec8b9b2cbe65838a194281f7d76d0e17defc5211..0062b2d4dc7a64d1e4da240bf8dc5b428eb242ee 100644
index ddb1ff894910761a78b91a343f32e129f03a03c4..bebe4116e50f0b0f64f6bdbd3f05f0b998225435 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -2269,6 +2269,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -2295,6 +2295,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
}
// Purpur end

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Various API Tweaks
diff --git a/src/main/java/com/destroystokyo/paper/MaterialTags.java b/src/main/java/com/destroystokyo/paper/MaterialTags.java
index be212b4fbeabab32a4dab6ae554768c368efaa88..2c08e2000fc1c2cfaae9b82c57c0f2a5079311f1 100644
index 41eaa8159f8c028faa118300e95f6a0fb9cfe989..76a5381a959ae4e153dba291a362f3d58aeceac9 100644
--- a/src/main/java/com/destroystokyo/paper/MaterialTags.java
+++ b/src/main/java/com/destroystokyo/paper/MaterialTags.java
@@ -584,6 +584,15 @@ public class MaterialTags {

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,342 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Mon, 4 Nov 2024 16:04:55 +0900
Subject: [PATCH] Reduce allocations
diff --git a/src/main/java/io/papermc/paper/command/brigadier/BasicCommand.java b/src/main/java/io/papermc/paper/command/brigadier/BasicCommand.java
index c89d6c4c38e2390cb11ffba182f8741d3726cfd1..2451f466ae6f953b01ad2cbaeac7d163f09f1c5c 100644
--- a/src/main/java/io/papermc/paper/command/brigadier/BasicCommand.java
+++ b/src/main/java/io/papermc/paper/command/brigadier/BasicCommand.java
@@ -16,6 +16,17 @@ import org.jspecify.annotations.Nullable;
@FunctionalInterface
public interface BasicCommand {
+ // Plazma start - Reduce allocations
+ /**
+ * Executes the command with the given {@link CommandSourceStack} and arguments.
+ *
+ * @param commandSourceStack the commandSourceStack of the command
+ */
+ default void execute(CommandSourceStack commandSourceStack) {
+ this.execute(commandSourceStack, org.plazmamc.plazma.constants.Null.STRING);
+ }
+ // Plazma end - Reduce allocations
+
/**
* Executes the command with the given {@link CommandSourceStack} and arguments.
*
diff --git a/src/main/java/org/bukkit/Fluid.java b/src/main/java/org/bukkit/Fluid.java
index a3ff4fefaf50f3e99a69ba68cbe8e30c95dac5df..5bbecd907e222f9adcf726bccab63c9ef59f5c14 100644
--- a/src/main/java/org/bukkit/Fluid.java
+++ b/src/main/java/org/bukkit/Fluid.java
@@ -10,6 +10,7 @@ import org.jetbrains.annotations.NotNull;
* Represents a fluid type.
*/
public interface Fluid extends OldEnum<Fluid>, Keyed {
+ Fluid[] EMPTY_ARRAY = new Fluid[0]; // Plazma - Reduce allocations
/**
* No fluid.
@@ -57,6 +58,6 @@ public interface Fluid extends OldEnum<Fluid>, Keyed {
@NotNull
@Deprecated(since = "1.21.3", forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils
static Fluid[] values() {
- return Lists.newArrayList(Registry.FLUID).toArray(new Fluid[0]);
+ return Lists.newArrayList(Registry.FLUID).toArray(EMPTY_ARRAY); // Plazma - Reduce allocations
}
}
diff --git a/src/main/java/org/bukkit/attribute/Attribute.java b/src/main/java/org/bukkit/attribute/Attribute.java
index 521f035409ee61a9ad73d39bec938f2938892570..6e53135579426cb677bf34a0813db8268d550428 100644
--- a/src/main/java/org/bukkit/attribute/Attribute.java
+++ b/src/main/java/org/bukkit/attribute/Attribute.java
@@ -15,6 +15,7 @@ import org.jetbrains.annotations.NotNull;
* Types of attributes which may be present on an {@link Attributable}.
*/
public interface Attribute extends OldEnum<Attribute>, Keyed, Translatable, net.kyori.adventure.translation.Translatable { // Paper - Adventure translations
+ Attribute[] EMPTY_ARRAY = new Attribute[0]; // Plazma - Reduce allocations
/**
* Maximum health of an Entity.
@@ -170,6 +171,6 @@ public interface Attribute extends OldEnum<Attribute>, Keyed, Translatable, net.
@NotNull
@Deprecated(since = "1.21.3", forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils
static Attribute[] values() {
- return Lists.newArrayList(Registry.ATTRIBUTE).toArray(new Attribute[0]);
+ return Lists.newArrayList(Registry.ATTRIBUTE).toArray(EMPTY_ARRAY); // Plazma - Reduce allocations
}
}
diff --git a/src/main/java/org/bukkit/block/Biome.java b/src/main/java/org/bukkit/block/Biome.java
index 464f8f81ba907a61588e4ab869e4f8269830195a..6d50664e76e6e7ed98ca7b311fdb368886ab65a8 100644
--- a/src/main/java/org/bukkit/block/Biome.java
+++ b/src/main/java/org/bukkit/block/Biome.java
@@ -23,6 +23,7 @@ import org.jetbrains.annotations.NotNull;
* which can be accessed via {@link Registry#BIOME}.
*/
public interface Biome extends OldEnum<Biome>, Keyed, net.kyori.adventure.translation.Translatable { // Paper - Adventure translations
+ Biome[] EMPTY_ARRAY = new Biome[0]; // Plazma - Reduce allocations
Biome OCEAN = getBiome("ocean");
Biome PLAINS = getBiome("plains");
@@ -129,7 +130,7 @@ public interface Biome extends OldEnum<Biome>, Keyed, net.kyori.adventure.transl
@NotNull
@Deprecated(since = "1.21.3", forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils
static Biome[] values() {
- return Lists.newArrayList(Registry.BIOME).toArray(new Biome[0]);
+ return Lists.newArrayList(Registry.BIOME).toArray(EMPTY_ARRAY); // Plazma - Reduce allocations
}
// Paper start
diff --git a/src/main/java/org/bukkit/block/banner/PatternType.java b/src/main/java/org/bukkit/block/banner/PatternType.java
index 24b58ed80f3dd7c6b35bb18071000af845d18ba4..13ad0ba6320acd054a665d1749871a14cfd1a520 100644
--- a/src/main/java/org/bukkit/block/banner/PatternType.java
+++ b/src/main/java/org/bukkit/block/banner/PatternType.java
@@ -12,6 +12,8 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public interface PatternType extends OldEnum<PatternType>, Keyed {
+ PatternType[] EMPTY_ARRAY = new PatternType[0]; // Plazma - Reduce allocations
+
PatternType BASE = getType("base");
PatternType SQUARE_BOTTOM_LEFT = getType("square_bottom_left");
PatternType SQUARE_BOTTOM_RIGHT = getType("square_bottom_right");
@@ -140,6 +142,6 @@ public interface PatternType extends OldEnum<PatternType>, Keyed {
@NotNull
@Deprecated(since = "1.21", forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils
static PatternType[] values() {
- return Lists.newArrayList(Registry.BANNER_PATTERN).toArray(new PatternType[0]);
+ return Lists.newArrayList(Registry.BANNER_PATTERN).toArray(EMPTY_ARRAY); // Plazma - Reduce allocations
}
}
diff --git a/src/main/java/org/bukkit/command/Command.java b/src/main/java/org/bukkit/command/Command.java
index 74384a56eebbce41d431db2507c55eddbcf50a41..ef3afe91312de1d0fb38d985e0421ceae59d7e57 100644
--- a/src/main/java/org/bukkit/command/Command.java
+++ b/src/main/java/org/bukkit/command/Command.java
@@ -58,6 +58,19 @@ public abstract class Command {
this.activeAliases = new ArrayList<String>(aliases);
}
+ // Plazma start - Reduce allocations
+ /**
+ * Executes the command, returning its success
+ *
+ * @param sender Source object which is executing this command
+ * @param commandLabel The alias of the command used
+ * @return true if the command was successful, otherwise false
+ */
+ public boolean execute(@NotNull CommandSender sender, @NotNull String commandLabel) {
+ return this.execute(sender, commandLabel, org.plazmamc.plazma.constants.Null.STRING);
+ }
+ // Plazma end - Reduce allocations
+
/**
* Executes the command, returning its success
*
diff --git a/src/main/java/org/bukkit/enchantments/Enchantment.java b/src/main/java/org/bukkit/enchantments/Enchantment.java
index a824ac90e78d3d7f90b01397270e54422d88e8b9..95df10ad8a53942de435cec7db57c1bb496097dc 100644
--- a/src/main/java/org/bukkit/enchantments/Enchantment.java
+++ b/src/main/java/org/bukkit/enchantments/Enchantment.java
@@ -15,6 +15,8 @@ import org.jetbrains.annotations.Nullable;
* The various type of enchantments that may be added to armour or weapons
*/
public abstract class Enchantment implements Keyed, Translatable, net.kyori.adventure.translation.Translatable { // Paper - Adventure translations
+ private static final Enchantment[] EMPTY_ARRAY = new Enchantment[0]; // Plazma - Reduce allocations
+
/**
* Provides protection against environmental damage
*/
@@ -536,6 +538,6 @@ public abstract class Enchantment implements Keyed, Translatable, net.kyori.adve
@NotNull
@Deprecated(since = "1.20.3")
public static Enchantment[] values() {
- return Lists.newArrayList(Registry.ENCHANTMENT).toArray(new Enchantment[0]);
+ return Lists.newArrayList(Registry.ENCHANTMENT).toArray(EMPTY_ARRAY); // Plazma - Reduce allocations
}
}
diff --git a/src/main/java/org/bukkit/entity/Cat.java b/src/main/java/org/bukkit/entity/Cat.java
index fca4671c6976aee9e981ef344244f9322651d0c9..7dc1744fba576683155e7970832794c05ceff768 100644
--- a/src/main/java/org/bukkit/entity/Cat.java
+++ b/src/main/java/org/bukkit/entity/Cat.java
@@ -51,6 +51,7 @@ public interface Cat extends Tameable, Sittable, io.papermc.paper.entity.CollarC
* Represents the various different cat types there are.
*/
interface Type extends OldEnum<Type>, Keyed {
+ Type[] EMPTY_ARRAY = new Type[0]; // Plazma - Reduce allocations
Type TABBY = getType("tabby");
Type BLACK = getType("black");
@@ -89,7 +90,7 @@ public interface Cat extends Tameable, Sittable, io.papermc.paper.entity.CollarC
@NotNull
@Deprecated(since = "1.21", forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils
static Type[] values() {
- return Lists.newArrayList(Registry.CAT_VARIANT).toArray(new Type[0]);
+ return Lists.newArrayList(Registry.CAT_VARIANT).toArray(EMPTY_ARRAY); // Plazma - Reduce allocations
}
}
diff --git a/src/main/java/org/bukkit/entity/Frog.java b/src/main/java/org/bukkit/entity/Frog.java
index f661a6b4797dd814a197e9245bcb2ddf2fca773f..58bf414cd753299abc54c45b3036d3fdbf9170dc 100644
--- a/src/main/java/org/bukkit/entity/Frog.java
+++ b/src/main/java/org/bukkit/entity/Frog.java
@@ -49,6 +49,7 @@ public interface Frog extends Animals {
* Represents the variant of a frog - ie its color.
*/
interface Variant extends OldEnum<Variant>, Keyed {
+ Variant[] EMPTY_ARRAY = new Variant[0]; // Plazma - Reduce allocations
/**
* Temperate (brown-orange) frog.
@@ -88,7 +89,7 @@ public interface Frog extends Animals {
@NotNull
@Deprecated(since = "1.21", forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils
static Variant[] values() {
- return Lists.newArrayList(Registry.FROG_VARIANT).toArray(new Variant[0]);
+ return Lists.newArrayList(Registry.FROG_VARIANT).toArray(EMPTY_ARRAY); // Plazma - Reduce allocations
}
}
}
diff --git a/src/main/java/org/bukkit/entity/Villager.java b/src/main/java/org/bukkit/entity/Villager.java
index 9c722a762c88a88bb5ef18c3b9eab8b371360dac..127bc2aab7fb36df206d53f3e6042bb6c920878e 100644
--- a/src/main/java/org/bukkit/entity/Villager.java
+++ b/src/main/java/org/bukkit/entity/Villager.java
@@ -170,6 +170,7 @@ public interface Villager extends AbstractVillager {
* in.
*/
interface Type extends OldEnum<Type>, Keyed {
+ Type[] EMPTY_ARRAY = new Type[0]; // Plazma - Reduce allocations
Type DESERT = getType("desert");
Type JUNGLE = getType("jungle");
@@ -204,7 +205,7 @@ public interface Villager extends AbstractVillager {
@NotNull
@Deprecated(since = "1.21", forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils
static Type[] values() {
- return Lists.newArrayList(Registry.VILLAGER_TYPE).toArray(new Type[0]);
+ return Lists.newArrayList(Registry.VILLAGER_TYPE).toArray(EMPTY_ARRAY); // Plazma - Reduce allocations
}
}
@@ -213,6 +214,7 @@ public interface Villager extends AbstractVillager {
* Villagers have different trading options depending on their profession,
*/
interface Profession extends OldEnum<Profession>, Keyed, net.kyori.adventure.translation.Translatable {
+ Profession[] EMPTY_ARRAY = new Profession[0]; // Plazma - Reduce allocations
Profession NONE = getProfession("none");
/**
@@ -311,7 +313,7 @@ public interface Villager extends AbstractVillager {
@NotNull
@Deprecated(since = "1.21", forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils
static Profession[] values() {
- return Lists.newArrayList(Registry.VILLAGER_PROFESSION).toArray(new Profession[0]);
+ return Lists.newArrayList(Registry.VILLAGER_PROFESSION).toArray(EMPTY_ARRAY); // Plazma - Reduce allocations
}
// Paper start
diff --git a/src/main/java/org/bukkit/map/MapCursor.java b/src/main/java/org/bukkit/map/MapCursor.java
index 7f5682c80ff25142e7c8fa14e03b4a62fc5c01d3..5fbcdf637b1e0162276e668d9ebe4a8648a29b8a 100644
--- a/src/main/java/org/bukkit/map/MapCursor.java
+++ b/src/main/java/org/bukkit/map/MapCursor.java
@@ -286,6 +286,7 @@ public final class MapCursor {
* resource pack.
*/
public interface Type extends OldEnum<Type>, Keyed {
+ Type[] EMPTY_ARRAY = new Type[0]; // Plazma - Reduce allocations
Type PLAYER = getType("player");
Type FRAME = getType("frame");
@@ -387,7 +388,7 @@ public final class MapCursor {
@NotNull
@Deprecated(since = "1.21", forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils
static Type[] values() {
- return Lists.newArrayList(Registry.MAP_DECORATION_TYPE).toArray(new Type[0]);
+ return Lists.newArrayList(Registry.MAP_DECORATION_TYPE).toArray(EMPTY_ARRAY); // Plazma - Reduce allocations
}
}
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
index 2f8d3b7a5b25e323f892d2ec5eb7c3412a816ea4..22e358f7a83d84745c32ff9f04d79d51d8d92131 100644
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
@@ -47,6 +47,7 @@ import org.jetbrains.annotations.Nullable;
@Deprecated(forRemoval = true) // Paper - This implementation may be replaced in a future version of Paper.
// Plugins may still reflect into this class to modify permission logic for the time being.
public final class SimplePluginManager implements PluginManager {
+ public static final Plugin[] EMPTY_PLUGIN = new Plugin[0]; // Plazma - Reduce allocations
private final Server server;
private final Map<Pattern, PluginLoader> fileAssociations = new HashMap<Pattern, PluginLoader>();
private final List<Plugin> plugins = new ArrayList<Plugin>();
@@ -133,7 +134,7 @@ public final class SimplePluginManager implements PluginManager {
this.server.getLogger().log(Level.SEVERE, "Plugin loading error!", e);
}
}
- return pluginList.toArray(new Plugin[0]);
+ return pluginList.toArray(EMPTY_PLUGIN); // Plazma - Reduce allocations
}
Preconditions.checkArgument(directory != null, "Directory cannot be null");
Preconditions.checkArgument(directory.isDirectory(), "Directory must be a directory");
diff --git a/src/main/java/org/bukkit/potion/PotionEffectType.java b/src/main/java/org/bukkit/potion/PotionEffectType.java
index e4cfdc80c9e49fc7992183022bdf2f36aae0d95a..0cd7987e935e2b7ede759af3db9af04366930e19 100644
--- a/src/main/java/org/bukkit/potion/PotionEffectType.java
+++ b/src/main/java/org/bukkit/potion/PotionEffectType.java
@@ -19,6 +19,7 @@ import org.jetbrains.annotations.Nullable;
*/
public abstract class PotionEffectType implements Keyed, Translatable, net.kyori.adventure.translation.Translatable, io.papermc.paper.world.flag.FeatureDependant { // Paper - implement Translatable & feature flag API
private static final BiMap<Integer, PotionEffectType> ID_MAP = HashBiMap.create();
+ private static final PotionEffectType[] EMPTY_ARRAY = new PotionEffectType[0]; // Plazma - Reduce allocations
/**
* Increases movement speed.
@@ -358,7 +359,7 @@ public abstract class PotionEffectType implements Keyed, Translatable, net.kyori
@NotNull
@Deprecated(since = "1.20.3")
public static PotionEffectType[] values() {
- return Lists.newArrayList(Registry.EFFECT).toArray(new PotionEffectType[0]);
+ return Lists.newArrayList(Registry.EFFECT).toArray(EMPTY_ARRAY); // Plazma - Reduce allocations
}
// Paper start
diff --git a/src/main/java/org/plazmamc/plazma/Constants.java b/src/main/java/org/plazmamc/plazma/Constants.java
new file mode 100644
index 0000000000000000000000000000000000000000..137f4f511998828476c2ac408a9a76289a44d071
--- /dev/null
+++ b/src/main/java/org/plazmamc/plazma/Constants.java
@@ -0,0 +1,7 @@
+package org.plazmamc.plazma;
+
+public interface Constants {
+
+ int[] ZERO_INT_ARRAY = new int[]{0};
+
+}
diff --git a/src/main/java/org/plazmamc/plazma/constants/Null.java b/src/main/java/org/plazmamc/plazma/constants/Null.java
new file mode 100644
index 0000000000000000000000000000000000000000..6018a9230d0d92e23f09cc5b5cc042446bed9962
--- /dev/null
+++ b/src/main/java/org/plazmamc/plazma/constants/Null.java
@@ -0,0 +1,25 @@
+package org.plazmamc.plazma.constants;
+
+import net.md_5.bungee.api.chat.BaseComponent;
+import java.net.URL;
+import java.util.concurrent.CompletableFuture;
+import java.util.regex.Pattern;
+
+public interface Null {
+
+ byte[] BYTE = new byte[0];
+ short[] SHORT = new short[0];
+ int[] INT = new int[0];
+ long[] LONG = new long[0];
+
+ Object[] OBJECT = new Object[0];
+ String[] STRING = new String[0];
+ URL[] URL = new URL[0];
+ Pattern[] REGEX = new Pattern[0];
+
+ BaseComponent[] COMPONENT = new BaseComponent[0];
+
+ @SuppressWarnings("rawtypes")
+ CompletableFuture[] FUTURE = new CompletableFuture[0];
+
+}

View File

@@ -0,0 +1,24 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Sat, 14 Dec 2024 12:25:43 +0900
Subject: [PATCH] Add option to shoot fireball
diff --git a/src/main/java/org/bukkit/event/entity/CreatureSpawnEvent.java b/src/main/java/org/bukkit/event/entity/CreatureSpawnEvent.java
index 361db256296d776c27e601c923b2cdc61967122b..8a740bdd99b683255fdd7ebf81f28ceca8b030f8 100644
--- a/src/main/java/org/bukkit/event/entity/CreatureSpawnEvent.java
+++ b/src/main/java/org/bukkit/event/entity/CreatureSpawnEvent.java
@@ -224,6 +224,12 @@ public class CreatureSpawnEvent extends EntitySpawnEvent {
/**
* When an entity is missing a SpawnReason
*/
- DEFAULT
+ DEFAULT,
+ // Plazma start - Option to shoot fireballs
+ /*
+ * When a player shoots a fire charge
+ */
+ FIRE_CHARGE,
+ // Plazma end - Option to shoot fireballs
}
}

View File

@@ -25,10 +25,10 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
diff --git a/com/destroystokyo/paper/entity/ai/VanillaGoal.java b/com/destroystokyo/paper/entity/ai/VanillaGoal.java
index 069f2668f5229b0368b796e65eef1648fba0a097..9b991201a2f6cc9feccccf7f4e7bcded64117764 100644
index 35dfd25f21ca67b7f4d69326500980f4a021ef49..a9816fbfa466b3fe3f82c19aeeeb564c660e4b6a 100644
--- a/com/destroystokyo/paper/entity/ai/VanillaGoal.java
+++ b/com/destroystokyo/paper/entity/ai/VanillaGoal.java
@@ -442,6 +442,18 @@ public interface VanillaGoal<T extends Mob> extends Goal<T> {
@@ -441,6 +441,18 @@ public interface VanillaGoal<T extends Mob> extends Goal<T> {
GoalKey<Zombie> ZOMBIE_ATTACK_TURTLE_EGG = create("zombie_attack_turtle_egg", Zombie.class);
@@ -44,6 +44,6 @@ index 069f2668f5229b0368b796e65eef1648fba0a097..9b991201a2f6cc9feccccf7f4e7bcded
+ GoalKey<IronGolem> RECEIVE_FLOWER = GoalKey.of(IronGolem.class, NamespacedKey.minecraft("receive_flower"));
+ // Purpur end
+
/**
* Removed in 1.20.2
*/
private static <T extends Mob> GoalKey<T> create(final String key, final Class<T> type) {
return GoalKey.of(type, NamespacedKey.minecraft(key));
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,71 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Sat, 2 Nov 2024 15:26:27 +0900
Subject: [PATCH] mc dev fixes
diff --git a/src/main/java/net/minecraft/server/commands/DebugCommand.java b/src/main/java/net/minecraft/server/commands/DebugCommand.java
index 06568cc308e06b16f43ec7facd5e2c4e36f3fee9..f8cdd6911fe9d6402455b7368d0e98c25e9511ca 100644
--- a/src/main/java/net/minecraft/server/commands/DebugCommand.java
+++ b/src/main/java/net/minecraft/server/commands/DebugCommand.java
@@ -271,5 +271,12 @@ public class DebugCommand {
public void close() {
IOUtils.closeQuietly((Writer)this.output);
}
+
+ // Plazma start - Decompile fixes
+ @Override
+ public CommandSender getBukkitSender(final CommandSourceStack wrapper) {
+ return wrapper.getBukkitSender();
+ }
+ // Plazma end - Decompile fixes
}
}
diff --git a/src/main/java/net/minecraft/server/commands/ReturnCommand.java b/src/main/java/net/minecraft/server/commands/ReturnCommand.java
index 9f82ca1fee2a319d52a4106c3581f5e9a9554a9e..f5c7748117342dedd9d600881143c206e429fe5b 100644
--- a/src/main/java/net/minecraft/server/commands/ReturnCommand.java
+++ b/src/main/java/net/minecraft/server/commands/ReturnCommand.java
@@ -16,18 +16,18 @@ import net.minecraft.commands.execution.tasks.BuildContexts;
import net.minecraft.commands.execution.tasks.FallthroughTask;
public class ReturnCommand {
- public static <T extends ExecutionCommandSource<T>> void register(CommandDispatcher<T> dispatcher) {
- dispatcher.register(
- (LiteralArgumentBuilder<T>)LiteralArgumentBuilder.<ExecutionCommandSource>literal("return")
- .requires(source -> source.hasPermission(2))
- .then(
- RequiredArgumentBuilder.<T, Integer>argument("value", IntegerArgumentType.integer())
- .executes(new ReturnCommand.ReturnValueCustomExecutor<>())
- )
- .then(LiteralArgumentBuilder.<T>literal("fail").executes(new ReturnCommand.ReturnFailCustomExecutor<>()))
- .then(LiteralArgumentBuilder.<T>literal("run").forward(dispatcher.getRoot(), new ReturnCommand.ReturnFromCommandCustomModifier<>(), false))
+
+ // Plazma start - Decompile fixes
+ public static void register(CommandDispatcher<net.minecraft.commands.CommandSourceStack> dispatcher) {
+ dispatcher.register(net.minecraft.commands.Commands.literal("return")
+ .requires(source -> source.hasPermission(2))
+ .then(net.minecraft.commands.Commands.argument("value", IntegerArgumentType.integer())
+ .executes(new ReturnCommand.ReturnValueCustomExecutor<>()))
+ .then(net.minecraft.commands.Commands.literal("fail").executes(new ReturnCommand.ReturnFailCustomExecutor<>()))
+ .then(net.minecraft.commands.Commands.literal("run").forward(dispatcher.getRoot(), new ReturnCommand.ReturnFromCommandCustomModifier<>(), false))
);
}
+ // Plazma end - Decompile fixes
static class ReturnFailCustomExecutor<T extends ExecutionCommandSource<T>> implements CustomCommandExecutor.CommandAdapter<T> {
@Override
diff --git a/src/main/java/net/minecraft/world/entity/animal/allay/AllayAi.java b/src/main/java/net/minecraft/world/entity/animal/allay/AllayAi.java
index 3fc1ec01e1a77a169ec762a23f15b97f040ce5f8..b5464708c1fa949e7df8aed71126ccad72d66ee3 100644
--- a/src/main/java/net/minecraft/world/entity/animal/allay/AllayAi.java
+++ b/src/main/java/net/minecraft/world/entity/animal/allay/AllayAi.java
@@ -62,8 +62,8 @@ public class AllayAi {
Activity.CORE,
0,
ImmutableList.of(
- new Swim<>(0.8F),
- new AnimalPanic(2.5F),
+ new Swim<Allay>(0.8F), // Plazma - mc dev fixes
+ new AnimalPanic<Allay>(2.5F), // Plazma - mc dev fixes
new LookAtTargetSink(45, 90),
new MoveToTargetSink(),
new CountDownCooldownTicks(MemoryModuleType.LIKED_NOTEBLOCK_COOLDOWN_TICKS),

View File

@@ -0,0 +1,19 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Fri, 13 Dec 2024 13:54:22 +0900
Subject: [PATCH] Minor code optimizations
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 34e8eb828be517d9ee3973597c74c5cac3d75c99..f8575f94a389d87d8043ae838720dbe2247235c4 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -1697,7 +1697,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
@Override
public List<Entity> getEntities(@Nullable Entity except, AABB box, Predicate<? super Entity> predicate) {
Profiler.get().incrementCounter("getEntities");
- List<Entity> list = Lists.newArrayList();
+ //List<Entity> list = Lists.newArrayList(); // Plazma - minor optimizations
// Paper start - rewrite chunk system
final List<Entity> ret = new java.util.ArrayList<>();

View File

@@ -1,19 +1,20 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Sun, 14 Jan 2024 19:51:19 +0900
Subject: [PATCH] Use Gradle Version Catalogs
Subject: [PATCH] Build System Changes
diff --git a/build.gradle.kts b/build.gradle.kts
index 4c4d242475c5229e9cdae69fcc328d52af6df4b8..c2a0dd63fe700484ac9473733b10615375d7c2b4 100644
index 77602e4445b1b45a17e5552ac6a769e0ed46ebc7..f021047331c7eb3dac7f0d56af73a9056ffe826b 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -14,65 +14,29 @@ val alsoShade: Configuration by configurations.creating
@@ -26,71 +26,34 @@ abstract class MockitoAgentProvider : CommandLineArgumentProvider {
dependencies {
implementation(project(":purpur-api")) // Pufferfish // Purpur
implementation(project(":purpur-api")) // Pufferfish // Paper // Purpur
- // Paper start
- implementation("org.jline:jline-terminal-jansi:3.21.0")
- implementation("org.jline:jline-terminal-ffm:3.27.1") // use ffm on java 22+
- implementation("org.jline:jline-terminal-jni:3.27.1") // fall back to jni on java 21
- implementation("net.minecrell:terminalconsoleappender:1.3.0")
- implementation("net.kyori:adventure-text-serializer-ansi:4.17.0") // Keep in sync with adventureVersion from Paper-API build file
- /*
@@ -29,14 +30,14 @@ index 4c4d242475c5229e9cdae69fcc328d52af6df4b8..c2a0dd63fe700484ac9473733b106153
- implementation("io.netty:netty-codec-haproxy:4.1.97.Final") // Paper - Add support for proxy protocol
- // Paper end
- implementation("org.apache.logging.log4j:log4j-iostreams:2.22.1") // Paper - remove exclusion
- implementation("org.ow2.asm:asm-commons:9.7")
- implementation("org.ow2.asm:asm-commons:9.7.1")
- implementation("org.spongepowered:configurate-yaml:4.2.0-SNAPSHOT") // Paper - config files
- implementation("commons-lang:commons-lang:2.6")
- runtimeOnly("org.xerial:sqlite-jdbc:3.45.3.0")
- runtimeOnly("com.mysql:mysql-connector-j:8.3.0")
- runtimeOnly("org.xerial:sqlite-jdbc:3.46.1.3")
- runtimeOnly("com.mysql:mysql-connector-j:9.1.0")
- runtimeOnly("com.lmax:disruptor:3.4.4") // Paper
- // Paper start - Use Velocity cipher
- implementation("com.velocitypowered:velocity-native:3.1.2-SNAPSHOT") {
- implementation("com.velocitypowered:velocity-native:3.3.0-SNAPSHOT") {
- isTransitive = false
- }
- // Paper end - Use Velocity cipher
@@ -44,14 +45,13 @@ index 4c4d242475c5229e9cdae69fcc328d52af6df4b8..c2a0dd63fe700484ac9473733b106153
- runtimeOnly("org.apache.maven:maven-resolver-provider:3.9.6")
- runtimeOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.9.18")
- runtimeOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.9.18")
-
- // Pufferfish start
- implementation("org.yaml:snakeyaml:1.32")
- implementation ("me.carleslc.Simple-YAML:Simple-Yaml:1.8.4") {
- implementation ("com.github.carleslc.Simple-YAML:Simple-Yaml:1.8.4") { // Purpur
- exclude(group="org.yaml", module="snakeyaml")
- }
- // Pufferfish end
- implementation("com.github.technove:Flare:34637f3f87") // Pufferfish - flare
-
- implementation("org.mozilla:rhino-runtime:1.7.14") // Purpur
- implementation("org.mozilla:rhino-engine:1.7.14") // Purpur
@@ -59,40 +59,72 @@ index 4c4d242475c5229e9cdae69fcc328d52af6df4b8..c2a0dd63fe700484ac9473733b106153
-
- testImplementation("io.github.classgraph:classgraph:4.8.47") // Paper - mob goal test
- testImplementation("org.junit.jupiter:junit-jupiter:5.10.2")
- testImplementation("org.junit.platform:junit-platform-suite-engine:1.10.0")
- testImplementation("org.hamcrest:hamcrest:2.2")
- testImplementation("org.mockito:mockito-core:5.11.0")
- testImplementation("org.ow2.asm:asm-tree:9.7")
- testImplementation("org.mockito:mockito-core:5.14.1")
- mockitoAgent("org.mockito:mockito-core:5.14.1") { isTransitive = false } // Paper - configure mockito agent that is needed in newer java versions
- testImplementation("org.ow2.asm:asm-tree:9.7.1")
- testImplementation("org.junit-pioneer:junit-pioneer:2.2.0") // Paper - CartesianTest
- implementation("net.neoforged:srgutils:1.0.9") // Paper - mappings handling
- implementation("net.neoforged:AutoRenamingTool:2.0.3") // Paper - remap plugins
- // Paper start - Remap reflection
- val reflectionRewriterVersion = "0.0.1"
- val reflectionRewriterVersion = "0.0.3"
- implementation("io.papermc:reflection-rewriter:$reflectionRewriterVersion")
- implementation("io.papermc:reflection-rewriter-runtime:$reflectionRewriterVersion")
- implementation("io.papermc:reflection-rewriter-proxy-generator:$reflectionRewriterVersion")
- // Paper end - Remap reflection
- // Paper start - spark
- implementation("me.lucko:spark-api:0.1-20240720.200737-2")
- implementation("me.lucko:spark-paper:1.10.119-SNAPSHOT")
- // Paper end - spark
+ // Plazma start - Use Gradle Version Catalogs
+ implementation(common.snakeyaml)
+ implementation(common.asm.commons)
+ implementation(common.log4j.core)
+ implementation(common.log4j.iostreams)
+ implementation(common.commons.lang2)
+ implementation(common.adventure.serializer.ansi)
+ implementation(server.velocity) { isTransitive = false }
+ implementation(server.simpleyaml) { exclude(group="org.yaml", module="snakeyaml") }
+ implementation(server.bundles.implementation)
+ implementation(common.adventure.serializer.ansi)
+ implementation(common.log4j.stream)
+
+ log4jPlugins.annotationProcessorConfigurationName(common.log4j.core)
+ alsoShade(log4jPlugins.output) // Plazma - Diff on patch
+ runtimeOnly(log4jPlugins.output) // Plazma - Diff on patch
+ implementation(common.log4j)
+ log4jPlugins.annotationProcessorConfigurationName(common.log4j)
+ runtimeOnly(log4jPlugins.output) // diff on change
+ alsoShade(log4jPlugins.output) // diff on change
+
+ runtimeOnly(common.maven.provider)
+ runtimeOnly(common.bundles.maven)
+ runtimeOnly(server.bundles.runtime)
+
+ implementation(common.bundles.asm)
+ implementation(common.commons.lang2)
+ implementation(server.velocity.native) { isTransitive = false }
+
+ runtimeOnly(common.mvn)
+ runtimeOnly(common.bundles.mvn)
+
+ implementation(common.snakeyaml)
+ implementation(server.simpleyaml) { exclude(group="org.yaml", module="snakeyaml") }
+
+ testImplementation(server.classgraph)
+ testImplementation(common.bundles.test)
+ testImplementation(server.bundles.test)
+ testImplementation(common.junit)
+ mockitoAgent(common.mockito) { isTransitive = false }
+ testImplementation(common.junit.pioneer)
+ // Plazma end - Use Gradle Version Catalogs
}
paperweight {
@@ -118,14 +81,14 @@ tasks.jar {
val gitBranch = git("rev-parse", "--abbrev-ref", "HEAD").getText().trim() // Paper
attributes(
"Main-Class" to "org.bukkit.craftbukkit.Main",
- "Implementation-Title" to "Purpur", // Pufferfish // Purpur
+ "Implementation-Title" to rootProject.providers.gradleProperty("brandName").get(), // Pufferfish // Purpur // Plazma - Fork-friendly Rebranding
"Implementation-Version" to implementationVersion,
"Implementation-Vendor" to date, // Paper
- "Specification-Title" to "Purpur", // Pufferfish // Purpur
+ "Specification-Title" to rootProject.providers.gradleProperty("brandName").get(), // Pufferfish // Purpur // Plazma - Fork-friendly Rebranding
"Specification-Version" to project.version,
- "Specification-Vendor" to "Purpur Team", // Pufferfish // Purpur
- "Brand-Id" to "purpurmc:purpur", // Pufferfish // Purpur
- "Brand-Name" to "Purpur", // Pufferfish // Purpur
+ "Specification-Vendor" to rootProject.providers.gradleProperty("providerName").get(), // Purpur // Plazma - Fork-friendly Rebranding
+ "Brand-Id" to rootProject.providers.gradleProperty("brandKey").get(), // Purpur // Plazma - Fork-friendly Rebranding
+ "Brand-Name" to rootProject.providers.gradleProperty("brandName").get(), // Pufferfish // Purpur // Plazma - Fork-friendly Rebranding
"Build-Number" to (build ?: ""),
"Build-Time" to Instant.now().toString(),
"Git-Branch" to gitBranch, // Paper

View File

@@ -5,40 +5,20 @@ Subject: [PATCH] Fork-friendly Rebranding
diff --git a/build.gradle.kts b/build.gradle.kts
index 732670587ecf0877be2493f67baade9c27b88f2b..54a30184392815a01f20b8fc841690e4ae5b3cc6 100644
index f021047331c7eb3dac7f0d56af73a9056ffe826b..41005f58fdd526907972185e728bbe1fa97171e9 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -13,7 +13,7 @@ configurations.named(log4jPlugins.compileClasspathConfigurationName) {
val alsoShade: Configuration by configurations.creating
@@ -25,7 +25,7 @@ abstract class MockitoAgentProvider : CommandLineArgumentProvider {
// Paper end - configure mockito agent that is needed in newer java versions
dependencies {
- implementation(project(":purpur-api")) // Pufferfish // Purpur
+ implementation(project(":${rootProject.providers.gradleProperty("brandName").get().lowercase()}-api")) // Pufferfish // Purpur // Plazma - Fork-friendly Rebranding
- implementation(project(":purpur-api")) // Pufferfish // Paper // Purpur
+ implementation(project(":plazma-api")) // Pufferfish // Paper // Purpur // Plazma
// Plazma start - Use Gradle Version Catalogs
implementation(common.snakeyaml)
@@ -63,14 +63,14 @@ tasks.jar {
val gitBranch = git("rev-parse", "--abbrev-ref", "HEAD").getText().trim() // Paper
attributes(
"Main-Class" to "org.bukkit.craftbukkit.Main",
- "Implementation-Title" to "Purpur", // Purpur
+ "Implementation-Title" to rootProject.providers.gradleProperty("brandName").get(), // Purpur // Plazma - Rebrand // Plazma - Fork-friendly Rebranding
"Implementation-Version" to implementationVersion,
"Implementation-Vendor" to date, // Paper
- "Specification-Title" to "Purpur", // Purpur
+ "Specification-Title" to rootProject.providers.gradleProperty("brandName").get(), // Purpur // Plazma - Fork-friendly Rebranding
"Specification-Version" to project.version,
- "Specification-Vendor" to "Purpur Team", // Purpur
- "Brand-Id" to "purpurmc:purpur", // Purpur
- "Brand-Name" to "Purpur", // Purpur
+ "Specification-Vendor" to rootProject.providers.gradleProperty("providerName").get(), // Purpur // Plazma - Fork-friendly Rebranding
+ "Brand-Id" to rootProject.providers.gradleProperty("brandKey").get(), // Purpur // Plazma - Fork-friendly Rebranding
+ "Brand-Name" to rootProject.providers.gradleProperty("brandName").get(), // Purpur // Plazma - Fork-friendly Rebranding
"Build-Number" to (build ?: ""),
"Build-Time" to Instant.now().toString(),
"Git-Branch" to gitBranch, // Paper
implementation(server.bundles.implementation)
implementation(common.adventure.serializer.ansi)
diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java
index 8cde30544e14f8fc2dac32966ae3c21f8cf3a551..81b204c03b3c9a997f00fd423daa963757cb0daf 100644
index 8cde30544e14f8fc2dac32966ae3c21f8cf3a551..8d5a52c5762c3d9b44dcdf00ae312e0bdc01fa1f 100644
--- a/src/main/java/com/destroystokyo/paper/Metrics.java
+++ b/src/main/java/com/destroystokyo/paper/Metrics.java
@@ -593,7 +593,7 @@ public class Metrics {
@@ -46,7 +26,7 @@ index 8cde30544e14f8fc2dac32966ae3c21f8cf3a551..81b204c03b3c9a997f00fd423daa9637
// Only start Metrics, if it's enabled in the config
if (config.getBoolean("enabled", true)) {
- Metrics metrics = new Metrics("Purpur", serverUUID, logFailedRequests, Bukkit.getLogger()); // Pufferfish // Purpur
+ Metrics metrics = new Metrics(io.papermc.paper.ServerBuildInfo.buildInfo().brandName(), serverUUID, logFailedRequests, Bukkit.getLogger()); // Pufferfish // Purpur // Plazma - Fork-friendly Rebranding
+ Metrics metrics = new Metrics(io.papermc.paper.ServerBrandConstants.BRAND_NAME, serverUUID, logFailedRequests, Bukkit.getLogger()); // Pufferfish // Purpur // Plazma - Fork-friendly Rebranding
metrics.addCustomChart(new Metrics.SimplePie("minecraft_version", () -> {
String minecraftVersion = Bukkit.getVersion();
@@ -112,36 +92,36 @@ index 6d36fc6d8e22d9b68dea3830f6ecc8763184c343..6995627310de4911d87a2f93a723d6b9
// Contributed by Techcable <Techcable@outlook.com> in GH-65
private static int fetchDistanceFromGitHub(final String repo, final String branch, final String hash) {
diff --git a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
index 3cb56595822799926a8141e60a42f5d1edfc6de5..70d6e514870b5cdf529eb067137a5c1579d3de1e 100644
index 90b3526479320064378f2cde6c2f2b8e48a59ba6..21658c61ad091647d5421d1dbf892d03ca175c74 100644
--- a/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
+++ b/src/main/java/com/destroystokyo/paper/console/PaperConsole.java
@@ -17,7 +17,7 @@ public final class PaperConsole extends SimpleTerminalConsole {
@@ -20,7 +20,7 @@ public final class PaperConsole extends SimpleTerminalConsole {
@Override
protected LineReader buildReader(LineReaderBuilder builder) {
builder
- .appName("Purpur") // Purpur
+ .appName(io.papermc.paper.ServerBuildInfo.buildInfo().brandName()) // Purpur // Plazma - Fork-friendly Rebranding
+ .appName(io.papermc.paper.ServerBrandConstants.BRAND_NAME) // Purpur // Plazma - Fork-friendly Rebranding
.variable(LineReader.HISTORY_FILE, java.nio.file.Paths.get(".console_history"))
.completer(new ConsoleCommandCompleter(this.server))
.option(LineReader.Option.COMPLETE_IN_WORD, true);
diff --git a/src/main/java/io/papermc/paper/ServerBrandConstants.java b/src/main/java/io/papermc/paper/ServerBrandConstants.java
new file mode 100644
index 0000000000000000000000000000000000000000..af534fb15be2be3e5b4258c522e0e6c967c2bb1c
index 0000000000000000000000000000000000000000..3af005ce2bbd30601917987d8c831db23c733ab8
--- /dev/null
+++ b/src/main/java/io/papermc/paper/ServerBrandConstants.java
@@ -0,0 +1,33 @@
@@ -0,0 +1,29 @@
+package io.papermc.paper;
+
+import org.jetbrains.annotations.Nullable;
+
+public enum ServerBrandConstants {;
+public interface ServerBrandConstants {
+
+ // Basic brand informations
+ public static final String BRAND_NAME = "Plazma";
+ public static final String RESOURCE_PATH = "META-INF/maven/org.plazmamc.plazma/plazma-api/pom.properties";
+ String BRAND_NAME = "Plazma";
+ String RESOURCE_PATH = "META-INF/maven/org.plazmamc.plazma/plazma-api/pom.properties";
+
+ @Nullable
+ public static final String ASCII_LOGO = """
+ String ASCII_LOGO = """
+
+ \033[38;2;215;23;133m█\033[38;2;212;24;134m█\033[38;2;209;26;134m█\033[38;2;205;27;135m█\033[38;2;202;28;136m█\033[38;2;199;30;136m█\033[38;2;196;31;137m╗\033[38;2;193;33;138m \033[38;2;190;34;138m█\033[38;2;186;35;139m█\033[38;2;183;37;140m╗\033[38;2;180;38;140m \033[38;2;177;39;141m \033[38;2;174;41;142m \033[38;2;170;42;142m \033[38;2;167;43;143m \033[38;2;164;45;144m \033[38;2;161;46;144m█\033[38;2;158;47;145m█\033[38;2;155;49;146m█\033[38;2;151;50;146m█\033[38;2;148;52;147m█\033[38;2;145;53;148m╗\033[38;2;142;54;148m \033[38;2;139;56;149m█\033[38;2;135;57;149m█\033[38;2;132;58;150m█\033[38;2;129;60;151m█\033[38;2;126;61;151m█\033[38;2;123;62;152m█\033[38;2;120;64;153m█\033[38;2;116;65;153m╗ \033[38;2;113;67;154m█\033[38;2;110;68;155m█\033[38;2;107;69;155m█\033[38;2;104;71;156m╗\033[38;2;101;72;157m \033[38;2;97;73;157m \033[38;2;94;75;158m \033[38;2;91;76;159m█\033[38;2;88;77;159m█\033[38;2;85;79;160m█\033[38;2;81;80;161m╗ \033[38;2;78;81;161m \033[38;2;75;83;162m█\033[38;2;72;84;163m█\033[38;2;69;86;163m█\033[38;2;66;87;164m█\033[38;2;62;88;165m█\033[38;2;59;90;165m╗\033[38;2;56;91;166m\s
+ \033[38;2;215;23;133m█\033[38;2;212;24;134m█\033[38;2;209;26;134m╔\033[38;2;205;27;135m═\033[38;2;202;28;136m═\033[38;2;199;30;136m█\033[38;2;196;31;137m█\033[38;2;193;33;138m╗ \033[38;2;190;34;138m█\033[38;2;186;35;139m█\033[38;2;183;37;140m║\033[38;2;180;38;140m \033[38;2;177;39;141m \033[38;2;174;41;142m \033[38;2;170;42;142m \033[38;2;167;43;143m \033[38;2;164;45;144m█\033[38;2;161;46;144m█\033[38;2;158;47;145m╔\033[38;2;155;49;146m═\033[38;2;151;50;146m═\033[38;2;148;52;147m█\033[38;2;145;53;148m█\033[38;2;142;54;148m╗ \033[38;2;139;56;149m╚\033[38;2;135;57;149m═\033[38;2;132;58;150m═\033[38;2;129;60;151m█\033[38;2;126;61;151m█\033[38;2;123;62;152m█\033[38;2;120;64;153m╔\033[38;2;116;65;153m╝ \033[38;2;113;67;154m█\033[38;2;110;68;155m█\033[38;2;107;69;155m█\033[38;2;104;71;156m█\033[38;2;101;72;157m╗\033[38;2;97;73;157m \033[38;2;94;75;158m█\033[38;2;91;76;159m█\033[38;2;88;77;159m█\033[38;2;85;79;160m█\033[38;2;81;80;161m║ \033[38;2;78;81;161m█\033[38;2;75;83;162m█\033[38;2;72;84;163m╔\033[38;2;69;86;163m═\033[38;2;66;87;164m═\033[38;2;62;88;165m█\033[38;2;59;90;165m█\033[38;2;56;91;166m╗
@@ -152,19 +132,15 @@ index 0000000000000000000000000000000000000000..af534fb15be2be3e5b4258c522e0e6c9
+ """;
+
+ // Support URLs
+ public static final String DOWNLOAD_PAGE = "https://plazmamc.org/downloads";
+ public static final String CONFIG_REFERENCE = "https://docs.plazmamc.org/plazma/administration/reference/configurations";
+ public static final String START_GUIDE = "https://docs.plazmamc.org/plazma/administration/getting-started";
+ public static final String USAGE_GUIDE = "https://docs.plazmamc.org/plazma/administration/getting-started/next-step";
+ public static final String SUPPORT_PAGE = "https://github.com/PlazmaMC/Plazma/issues";
+
+ // DO NOT MODIFY BELOW
+ public static final String BRAND_LCASE = BRAND_NAME.toLowerCase();
+ public static final String BRAND_UCASE = BRAND_NAME.toUpperCase();
+ String DOWNLOAD_PAGE = "https://plazmamc.org/downloads";
+ String CONFIG_REFERENCE = "https://docs.plazmamc.org/plazma/administration/reference/configurations";
+ String START_GUIDE = "https://docs.plazmamc.org/plazma/administration/getting-started";
+ String USAGE_GUIDE = "https://docs.plazmamc.org/plazma/administration/getting-started/next-step";
+ String SUPPORT_PAGE = "https://github.com/PlazmaMC/Plazma/issues";
+
+}
diff --git a/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java b/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java
index a27797afd0dc262a72dbd7906c6f00641619c7eb..a337e2c9576fb70a8ee9082e9b69719c804b286e 100644
index 3099c21ee589acf6edff5903a23673adf489024f..a337e2c9576fb70a8ee9082e9b69719c804b286e 100644
--- a/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java
+++ b/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java
@@ -30,10 +30,6 @@ public record ServerBuildInfoImpl(
@@ -172,7 +148,7 @@ index a27797afd0dc262a72dbd7906c6f00641619c7eb..a337e2c9576fb70a8ee9082e9b69719c
private static final String ATTRIBUTE_GIT_COMMIT = "Git-Commit";
- private static final String BRAND_PAPER_NAME = "Paper";
- private static final String BRAND_PUFFERFISH_NAME = "Pufferfish"; // Pufferfish
- private static final String BRAND_PUFFERFISH_NAME = "Pufferfish"; // Purpur
- private static final String BRAND_PURPUR_NAME = "Purpur"; // Purpur
-
private static final String BUILD_DEV = "DEV";
@@ -194,56 +170,49 @@ index a27797afd0dc262a72dbd7906c6f00641619c7eb..a337e2c9576fb70a8ee9082e9b69719c
@Override
public boolean isBrandCompatible(final @NotNull Key brandId) {
- return brandId.equals(this.brandId) || brandId.equals(BRAND_PAPER_ID); // Purpur
- return brandId.equals(this.brandId) || brandId.equals(BRAND_PAPER_ID) || brandId.equals(BRAND_PUFFERFISH_ID); // Purpur
+ return brandId.equals(this.brandId) || SUPPORTED_BRANDS.contains(brandId); // Purpur // Plazma - Fork-friendly Rebranding
}
@Override
diff --git a/src/main/java/io/papermc/paper/configuration/Configurations.java b/src/main/java/io/papermc/paper/configuration/Configurations.java
index 96142deb42700f888ea08689ab62c27ef2b881fd..62b602450a53cfebf08f839b505d0e965aff6e20 100644
index 8cf720f08514e8e4f62f4ad196f1277bd761c6b2..cda2ca940e30506807a5d12b84dbf69529051e26 100644
--- a/src/main/java/io/papermc/paper/configuration/Configurations.java
+++ b/src/main/java/io/papermc/paper/configuration/Configurations.java
@@ -114,7 +114,12 @@ public abstract class Configurations<G, W> {
@@ -112,7 +112,7 @@ public abstract class Configurations<G, W> {
loader.save(node);
} catch (ConfigurateException ex) {
if (ex.getCause() instanceof AccessDeniedException) {
- LOGGER.warn("Could not save {}: Paper could not persist the full set of configuration settings in the configuration file. Any setting missing from the configuration file will be set with its default value in memory. Admins should make sure to review the configuration documentation at https://docs.papermc.io/paper/configuration for more details.", filename, ex);
+ // Plazma start - Fork-friendly Rebranding
+ LOGGER.warn("Could not save {}: {} could not persist the full set of configuration settings in the configuration file."
+ + "Any setting missing from the configuration file will be set with its default value in memory."
+ + "Admins should make sure to review the configuration documentation at {} for more details.",
+ filename, io.papermc.paper.ServerBuildInfo.buildInfo().brandName(), io.papermc.paper.ServerBrandConstants.CONFIG_REFERENCE, ex);
+ // Plazma end - Fork-friendly Rebranding
+ LOGGER.warn("Could not save {}: {} could not persist the full set of configuration settings in the configuration file. Any setting missing from the configuration file will be set with its default value in memory. Admins should make sure to review the configuration documentation at {} for more details.", filename, io.papermc.paper.ServerBrandConstants.BRAND_NAME, io.papermc.paper.ServerBrandConstants.CONFIG_REFERENCE, ex); // Plazma - Fork-friendly Rebranding
} else throw ex;
}
}
diff --git a/src/main/java/net/minecraft/CrashReport.java b/src/main/java/net/minecraft/CrashReport.java
index c366d84518979e842a6f10f969a5951539ecac93..4a885298859a0dff663d12075c82b42b48cce2ef 100644
index 710477ae27ebc5afdf0012ef0867d05efd293c24..3a5e7546c5cc1fcec880cece3f0d0b04ec23cc18 100644
--- a/src/main/java/net/minecraft/CrashReport.java
+++ b/src/main/java/net/minecraft/CrashReport.java
@@ -37,7 +37,7 @@ public class CrashReport {
@@ -32,13 +32,13 @@ public class CrashReport {
private boolean trackingStackTrace = true;
private StackTraceElement[] uncategorizedStackTrace = new StackTraceElement[0];
private final SystemReport systemReport = new SystemReport();
- private List<String> extraInfo = List.of("", "DO NOT REPORT THIS TO PAPER! REPORT TO PURPUR INSTEAD!", ""); // Purpur - Rebrand
+ private List<String> extraInfo = List.of("", "DO NOT REPORT THIS TO PAPER OR PURPUR! REPORT TO " + io.papermc.paper.ServerBrandConstants.BRAND_NAME.toUpperCase() + " INSTEAD!", ""); // Purpur - Rebrand // Plazma - Fork-friendly Rebranding
public CrashReport(String message, Throwable cause) {
io.papermc.paper.util.StacktraceDeobfuscator.INSTANCE.deobfuscateThrowable(cause); // Paper
this.title = message;
this.exception = cause;
- this.systemReport.setDetail("CraftBukkit Information", new org.bukkit.craftbukkit.CraftCrashReport()); // CraftBukkit
+ this.systemReport.setDetail(io.papermc.paper.ServerBuildInfo.buildInfo().brandName() + " Information", new org.bukkit.craftbukkit.CraftCrashReport()); // CraftBukkit // Plazma - Fork-friendly Rebranding
+ this.systemReport.setDetail(io.papermc.paper.ServerBrandConstants.BRAND_NAME + " CraftBukkit Information", new org.bukkit.craftbukkit.CraftCrashReport()); // CraftBukkit // Plazma - Fork-friendly Rebranding
}
public String getTitle() {
@@ -127,7 +127,7 @@ public class CrashReport {
stringbuilder.append("---- Minecraft Crash Report ----\n");
// Purpur start
stringbuilder.append("// ");
- stringbuilder.append("// DO NOT REPORT THIS TO PAPER! REPORT TO PURPUR INSTEAD!");
+ stringbuilder.append("// DO NOT REPORT THIS TO PAPER OR PURPUR! REPORT TO %s INSTEAD!".formatted(io.papermc.paper.ServerBrandConstants.BRAND_UCASE)); // Plazma - Fork-friendly Rebranding
// Purpur end
stringbuilder.append("// ");
stringbuilder.append(CrashReport.getErrorComment());
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index 0f7d6da8685716604f0749d4f5b60730a44cde73..4911a6d25d12eb9d2b263aeb9b7f521ff828397a 100644
index ecaec3c7b5768771b00c4c33d48a76ba22653a79..8f77566bef4b992013e3b65068cabe7ee1921951 100644
--- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java
@@ -107,6 +107,11 @@ public class Main {
@@ -108,6 +108,11 @@ public class Main {
*/ // CraftBukkit end
try {
@@ -255,29 +224,11 @@ index 0f7d6da8685716604f0749d4f5b60730a44cde73..4911a6d25d12eb9d2b263aeb9b7f521f
Path path = (Path) optionset.valueOf("pidFile"); // CraftBukkit
@@ -178,7 +183,7 @@ public class Main {
if (awtException != null) {
Main.LOGGER.error("You are using a headless JRE distribution.");
Main.LOGGER.error("This distribution is missing certain graphic libraries that the Minecraft server needs to function.");
- Main.LOGGER.error("For instructions on how to install the non-headless JRE, see https://docs.papermc.io/misc/java-install");
+ Main.LOGGER.error("For instructions on how to install the non-headless JRE, see {}", io.papermc.paper.ServerBrandConstants.START_GUIDE); // Plazma - Fork-friendly Rebranding
Main.LOGGER.error("");
Main.LOGGER.error(awtException);
return;
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 4c192b138810650ca0ab5e5d4f2407c0dc3d9fd0..468cb5034f7648e6ef39b1961298f592535aad88 100644
index 23505b0f80d643d9ef569b49192f44e0373dfb5f..20f79bcd7613e426b6b1020f586773819f1ac9d0 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -960,7 +960,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
shutdownThread = Thread.currentThread();
org.spigotmc.WatchdogThread.doStop(); // Paper
if (!isSameThread()) {
- MinecraftServer.LOGGER.info("Stopping main thread (Ignore any thread death message you see! - DO NOT REPORT THREAD DEATH TO PURPUR)"); // Purpur
+ MinecraftServer.LOGGER.info("Stopping main thread (Ignore any thread death message you see! - DO NOT REPORT THREAD DEATH TO {})", io.papermc.paper.ServerBrandConstants.BRAND_UCASE); // Purpur // Plazma - Fork-friendly Rebranding
while (this.getRunningThread().isAlive()) {
this.getRunningThread().stop();
try {
@@ -1181,7 +1181,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1280,7 +1280,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
LOGGER.info("*************************************************************************************");
LOGGER.info("This is the first time you're starting this server.");
LOGGER.info("It's recommended you read our 'Getting Started' documentation for guidance.");
@@ -287,39 +238,37 @@ index 4c192b138810650ca0ab5e5d4f2407c0dc3d9fd0..468cb5034f7648e6ef39b1961298f592
}
// Paper end - Add onboarding message for initial server start
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index fd88dfafcec517a29e3320ce147516ce2ccb2dc9..6d3f61a05c4d4ad20e62175eb0331bc31b5d6807 100644
index 7a442fb4cf78bcb1268359ee41a6de138edb76b6..193c62ed303d25558d78f1e8dfb655919335fdf6 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -796,7 +796,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@@ -779,7 +779,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
org.bukkit.plugin.Plugin[] plugins = this.server.getPluginManager().getPlugins();
result.append(this.server.getName());
- result.append(" on Bukkit ");
+ result.append(" on ").append(io.papermc.paper.ServerBuildInfo.buildInfo().brandName()).append(" "); // Plazma - Fork-friendly Rebranding
+ result.append(" on ").append(io.papermc.paper.ServerBrandConstants.BRAND_NAME).append(" "); // Plazma - Fork-friendly Rebranding
result.append(this.server.getBukkitVersion());
if (plugins.length > 0 && this.server.getQueryPlugins()) {
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
index 842f382de43df5d5c321422372ec30ccdd7859d7..09aa0c9ec7d66ff82167c035481e5fcccf8618de 100644
index 05e16103af3fd276f0196ddf1a2e5b729b025c34..8f7e922ceca286b1a590181c301fbe9bff55c024 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
@@ -56,12 +56,12 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie
@@ -56,10 +56,10 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie
public final boolean onlineMode = this.get("online-mode", true);
public final boolean preventProxyConnections = this.get("prevent-proxy-connections", false);
public final String serverIp = this.get("server-ip", "");
- public final String serverName = this.get("server-name", "Unknown Server"); // Purpur
+ public final String serverName = this.get("server-name", "A " + io.papermc.paper.ServerBuildInfo.buildInfo().brandName() + " Server"); // Purpur // Plazma - Fork-friendly Rebranding
public final boolean spawnAnimals = this.get("spawn-animals", true);
public final boolean spawnNpcs = this.get("spawn-npcs", true);
+ public final String serverName = this.get("server-name", "A " + io.papermc.paper.ServerBrandConstants.BRAND_NAME + " Server"); // Purpur // Plazma - Fork-friendly Rebranding
public final boolean pvp = this.get("pvp", true);
public final boolean allowFlight = this.get("allow-flight", false);
- public final String motd = this.get("motd", "A Minecraft Server");
+ public final String motd = this.get("motd", "A " + io.papermc.paper.ServerBuildInfo.buildInfo().brandName() + " Server"); // Plazma - Fork-friendly Rebranding
+ public final String motd = this.get("motd", "A " + io.papermc.paper.ServerBrandConstants.BRAND_NAME + " Server"); // Plazma - Fork-friendly Rebranding
public final String bugReportLink = this.get("bug-report-link", "");
public final boolean forceGameMode = this.get("force-gamemode", false);
public final boolean enforceWhitelist = this.get("enforce-whitelist", false);
public final Difficulty difficulty;
diff --git a/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java b/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java
index 8f74c2ec5252b6265549589310d742337c91cb2c..f8e8966fe8909f209969637e7ed708e689c41f1d 100644
index 8f74c2ec5252b6265549589310d742337c91cb2c..ecb5a046514e3cd448cbf633c728831b1eb5d30b 100644
--- a/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java
+++ b/src/main/java/net/minecraft/server/gui/MinecraftServerGui.java
@@ -56,7 +56,7 @@ public class MinecraftServerGui extends JComponent {
@@ -327,7 +276,7 @@ index 8f74c2ec5252b6265549589310d742337c91cb2c..f8e8966fe8909f209969637e7ed708e6
}
- final JFrame jframe = new JFrame("Purpur Minecraft server"); // Purpur
+ final JFrame jframe = new JFrame(io.papermc.paper.ServerBuildInfo.buildInfo().brandName() + " Minecraft server"); // Purpur // Plazma - Fork-friendly Rebranding
+ final JFrame jframe = new JFrame(io.papermc.paper.ServerBrandConstants.BRAND_NAME + " Minecraft server"); // Purpur // Plazma - Fork-friendly Rebranding
final MinecraftServerGui servergui = new MinecraftServerGui(server);
jframe.setDefaultCloseOperation(2);
@@ -336,7 +285,7 @@ index 8f74c2ec5252b6265549589310d742337c91cb2c..f8e8966fe8909f209969637e7ed708e6
jframe.setLocationRelativeTo((Component) null);
jframe.setVisible(true);
- jframe.setName("Purpur Minecraft server"); // Paper - Improve ServerGUI // Purpur
+ jframe.setName(io.papermc.paper.ServerBuildInfo.buildInfo().brandName() + " Minecraft server"); // Paper - Improve ServerGUI // Purpur // Plazma - Fork-friendly Rebranding
+ jframe.setName(io.papermc.paper.ServerBrandConstants.BRAND_NAME + " Minecraft server"); // Paper - Improve ServerGUI // Purpur // Plazma - Fork-friendly Rebranding
// Paper start - Improve ServerGUI
try {
@@ -345,7 +294,7 @@ index 8f74c2ec5252b6265549589310d742337c91cb2c..f8e8966fe8909f209969637e7ed708e6
public void windowClosing(WindowEvent windowevent) {
if (!servergui.isClosing.getAndSet(true)) {
- jframe.setTitle("Purpur Minecraft server - shutting down!"); // Purpur
+ jframe.setTitle(io.papermc.paper.ServerBuildInfo.buildInfo().brandName() + " Minecraft server - shutting down!"); // Purpur // Plazma - Fork-friendly Rebranding
+ jframe.setTitle(io.papermc.paper.ServerBrandConstants.BRAND_NAME + " Minecraft server - shutting down!"); // Purpur // Plazma - Fork-friendly Rebranding
server.halt(true);
servergui.runFinalizers();
}
@@ -359,7 +308,7 @@ index 8f74c2ec5252b6265549589310d742337c91cb2c..f8e8966fe8909f209969637e7ed708e6
javax.swing.JLabel jLabel = new javax.swing.JLabel("If you need help setting up your server you can visit:");
diff --git a/src/main/java/net/minecraft/world/damagesource/DamageSource.java b/src/main/java/net/minecraft/world/damagesource/DamageSource.java
index 1ce1235cbbf23fe975c85a0f713280b433459951..24934c84a6ca3a74784b63ebeadb9457aebd39c0 100644
index 4a96d914f8aa6f0c5f13fc85369a311f25835ac2..5b4285d6b37346bcea3bf072c6f00bd50c62e703 100644
--- a/src/main/java/net/minecraft/world/damagesource/DamageSource.java
+++ b/src/main/java/net/minecraft/world/damagesource/DamageSource.java
@@ -89,7 +89,7 @@ public class DamageSource {
@@ -367,25 +316,25 @@ index 1ce1235cbbf23fe975c85a0f713280b433459951..24934c84a6ca3a74784b63ebeadb9457
public DamageSource customEventDamager(Entity entity) {
if (this.directEntity != null) {
- throw new IllegalStateException("Cannot set custom event damager when direct entity is already set (report a bug to Paper)");
+ throw new IllegalStateException("Cannot set custom event damager when direct entity is already set (report a bug to " + io.papermc.paper.ServerBuildInfo.buildInfo().brandName() + ")"); // Plazma - Fork-friendly Rebranding
+ throw new IllegalStateException("Cannot set custom event damager when direct entity is already set (report a bug to " + io.papermc.paper.ServerBrandConstants.BRAND_NAME + ")"); // Plazma - Fork-friendly Rebranding
}
DamageSource damageSource = this.cloneInstance();
damageSource.customEventDamager = entity;
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
index 1090b7e36e3c1c105bc36135b82751c651f237d4..a5b3f9309393fd54c0aec2918410b331b306684d 100644
index cf0f3a14584b9280211f88808cb1ddfb10105ec5..fffe0091008339d438961f0d9f6f62ad6d31859f 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
@@ -157,7 +157,7 @@ public class RegionFileStorage implements AutoCloseable {
@@ -289,7 +289,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
// Paper start
private static void printOversizedLog(String msg, Path file, int x, int z) {
- org.apache.logging.log4j.LogManager.getLogger().fatal(msg + " (" + file.toString().replaceAll(".+[\\\\/]", "") + " - " + x + "," + z + ") Go clean it up to remove this message. /minecraft:tp " + (x<<4)+" 128 "+(z<<4) + " - DO NOT REPORT THIS TO PAPER - You may ask for help on Discord, but do not file an issue. These error messages can not be removed.");
+ org.apache.logging.log4j.LogManager.getLogger().fatal(msg + " (" + file.toString().replaceAll(".+[\\\\/]", "") + " - " + x + "," + z + ") Go clean it up to remove this message. /minecraft:tp " + (x<<4)+" 128 "+(z<<4) + " - DO NOT REPORT THIS TO {} - You may ask for help on Discord, but do not file an issue. These error messages can not be removed.", io.papermc.paper.ServerBuildInfo.buildInfo().brandName()); // Plazma - Fork-friendly Rebranding
- org.apache.logging.log4j.LogManager.getLogger().fatal(msg + " (" + file.toString().replaceAll(".+[\\\\/]", "") + " - " + x + "," + z + ") Go clean it up to remove this message. /minecraft:tp " + (x<<4)+" 128 "+(z<<4) + " - DO NOT REPORT THIS TO PURPUR - You may ask for help on Discord, but do not file an issue. These error messages can not be removed."); // Purpur
+ org.apache.logging.log4j.LogManager.getLogger().fatal(msg + " (" + file.toString().replaceAll(".+[\\\\/]", "") + " - " + x + "," + z + ") Go clean it up to remove this message. /minecraft:tp " + (x<<4)+" 128 "+(z<<4) + " - DO NOT REPORT THIS TO " + io.papermc.paper.ServerBrandConstants.BRAND_NAME + " - You may ask for help on Discord, but do not file an issue. These error messages can not be removed."); // Purpur // Plazma - Fork-friendly Rebranding
}
private static CompoundTag readOversizedChunk(RegionFile regionfile, ChunkPos chunkCoordinate) throws IOException {
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index 549d01337e9a89b356287567db101de383d45c9c..90d6650aa37247f3907f6bcf2fe5201cac4e05ea 100644
index 430407b0cf06ba337c59cd576c7e40a8e5fe8229..75a062e1105c2f7cc631a6b8b201b0e08621e3c5 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -143,7 +143,7 @@ public class Main {
@@ -406,30 +355,21 @@ index 549d01337e9a89b356287567db101de383d45c9c..90d6650aa37247f3907f6bcf2fe5201c
.describedAs("Name");
// Paper end
}
@@ -259,7 +259,7 @@ public class Main {
float javaVersion = Float.parseFloat(System.getProperty("java.class.version"));
boolean isOldVersion = javaVersion < 61.0;
if (!skip && isOldVersion) {
- System.err.println("Unsupported Java detected (" + javaVersion + "). This version of Minecraft requires at least Java 21. Check your Java version with the command 'java -version'. For more info see https://docs.papermc.io/misc/java-install");
+ System.err.println("Unsupported Java detected (" + javaVersion + "). This version of Minecraft requires at least Java 21. Check your Java version with the command 'java -version'. For more info see " + io.papermc.paper.ServerBrandConstants.START_GUIDE); // Plazma - Fork-friendly Rebranding
return;
}
String javaVersionName = System.getProperty("java.version");
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
index ca8ae8e1c51b937dac916e0b0dc94b5e2e61efeb..e3af3ba8f34626e54cdd931601fd3ec40618a061 100644
index 5e7b833fc9f37bc370c76e5c43e6c9919d6d20af..ddbda1491e5873be1b54f0a555cc5c675f4597d4 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -503,7 +503,7 @@ public class CraftScheduler implements BukkitScheduler {
@@ -491,7 +491,7 @@ public class CraftScheduler implements BukkitScheduler {
this.parsePending();
} else {
// this.debugTail = this.debugTail.setNext(new CraftAsyncDebugger(currentTick + CraftScheduler.RECENT_TICKS, task.getOwner(), task.getTaskClass())); // Paper
// this.debugTail = this.debugTail.setNext(new CraftAsyncDebugger(this.currentTick + CraftScheduler.RECENT_TICKS, task.getOwner(), task.getTaskClass())); // Paper
- task.getOwner().getLogger().log(Level.SEVERE, "Unexpected Async Task in the Sync Scheduler. Report this to Purpur"); // Paper // Purpur
+ task.getOwner().getLogger().log(Level.SEVERE, "Unexpected Async Task in the Sync Scheduler. Report this to {}" + io.papermc.paper.ServerBuildInfo.buildInfo().brandName()); // Paper // Purpur
+ task.getOwner().getLogger().log(Level.SEVERE, "Unexpected Async Task in the Sync Scheduler. Report this to " + io.papermc.paper.ServerBrandConstants.BRAND_NAME); // Paper // Purpur // Plazma - Fork-friendly Rebranding
// We don't need to parse pending
// (async tasks must live with race-conditions if they attempt to cancel between these few lines of code)
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
index 99597258e8e88cd9e2c901c4ac3ff7faeeabee2b..e8f7250f366bf9407ffd6d2ce53fd68a3753f97c 100644
index 99597258e8e88cd9e2c901c4ac3ff7faeeabee2b..e0414f59b7c5ef149d8e52ebf76dc3e46d9de4d3 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
@@ -11,7 +11,7 @@ public final class Versioning {
@@ -446,53 +386,53 @@ index 99597258e8e88cd9e2c901c4ac3ff7faeeabee2b..e8f7250f366bf9407ffd6d2ce53fd68a
result = properties.getProperty("version");
} catch (IOException ex) {
- Logger.getLogger(Versioning.class.getName()).log(Level.SEVERE, "Could not get Bukkit version!", ex);
+ Logger.getLogger(Versioning.class.getName()).log(Level.SEVERE, "Could not get " + io.papermc.paper.ServerBuildInfo.buildInfo().brandName() + " version!", ex); // Plazma - Fork-friendly Rebranding
+ Logger.getLogger(Versioning.class.getName()).log(Level.SEVERE, "Could not get " + io.papermc.paper.ServerBrandConstants.BRAND_NAME + " version!", ex); // Plazma - Fork-friendly Rebranding
}
}
diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java
index a353eb9f45af7b7f9bfd92a4a89403335b841840..e221edfd8837f82642de584ecadf47bafc598b38 100644
index f51cc3de3ca935ef90f7f0e9dd0506b856fc55f3..d889d964067058762fcffab9945fe586ce8d2a07 100644
--- a/src/main/java/org/spigotmc/WatchdogThread.java
+++ b/src/main/java/org/spigotmc/WatchdogThread.java
@@ -155,14 +155,14 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa
@@ -155,14 +155,14 @@ public class WatchdogThread extends ca.spottedleaf.moonrise.common.util.TickThre
if (isLongTimeout) {
// Paper end
log.log( Level.SEVERE, "------------------------------" );
- log.log( Level.SEVERE, "The server has stopped responding! This is (probably) not a Purpur bug." ); // Paper // Purpur
+ log.log( Level.SEVERE, "The server has stopped responding! This is (probably) not a " + io.papermc.paper.ServerBuildInfo.buildInfo().brandName() + " bug." ); // Paper // Purpur // Plazma - Fork-friendly Rebranding
+ log.log( Level.SEVERE, "The server has stopped responding! This is (probably) not a " + io.papermc.paper.ServerBrandConstants.BRAND_NAME + " bug." ); // Paper // Purpur // Plazma - Fork-friendly Rebranding
log.log( Level.SEVERE, "If you see a plugin in the Server thread dump below, then please report it to that author" );
log.log( Level.SEVERE, "\t *Especially* if it looks like HTTP or MySQL operations are occurring" );
log.log( Level.SEVERE, "If you see a world save or edit, then it means you did far more than your server can handle at once" );
log.log( Level.SEVERE, "\t If this is the case, consider increasing timeout-time in spigot.yml but note that this will replace the crash with LARGE lag spikes" );
- log.log( Level.SEVERE, "If you are unsure or still think this is a Purpur bug, please report this to https://github.com/PurpurMC/Purpur/issues" ); // Purpur
+ log.log( Level.SEVERE, "If you are unsure or still think this is a " + io.papermc.paper.ServerBuildInfo.buildInfo().brandName() + " bug, please report this to " + io.papermc.paper.ServerBrandConstants.SUPPORT_PAGE ); // Purpur // Plazma - Fork-friendly Rebranding
+ log.log( Level.SEVERE, "If you are unsure or still think this is a " + io.papermc.paper.ServerBrandConstants.BRAND_NAME + " bug, please report this to " + io.papermc.paper.ServerBrandConstants.SUPPORT_PAGE ); // Purpur // Plazma - Fork-friendly Rebranding
log.log( Level.SEVERE, "Be sure to include ALL relevant console errors and Minecraft crash reports" );
- log.log( Level.SEVERE, "Purpur version: " + Bukkit.getServer().getVersion() ); // Purpur
+ log.log( Level.SEVERE, io.papermc.paper.ServerBuildInfo.buildInfo().brandName() + " version: " + Bukkit.getServer().getVersion() ); // Purpur // Plazma - Fork-friendly Rebranding
+ log.log( Level.SEVERE, io.papermc.paper.ServerBrandConstants.BRAND_NAME + " version: " + Bukkit.getServer().getVersion() ); // Purpur // Plazma - Fork-friendly Rebranding
//
if ( net.minecraft.world.level.Level.lastPhysicsProblem != null )
{
@@ -184,12 +184,12 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa
@@ -184,12 +184,12 @@ public class WatchdogThread extends ca.spottedleaf.moonrise.common.util.TickThre
// Paper end
} else
{
- log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO PURPUR - THIS IS NOT A BUG OR A CRASH - " + Bukkit.getServer().getVersion() + " ---"); // Purpur
+ log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO " + io.papermc.paper.ServerBrandConstants.BRAND_UCASE + " - THIS IS NOT A BUG OR A CRASH - " + Bukkit.getServer().getVersion() + " ---"); // Purpur // Plazma - Fork-friendly Rebranding
+ log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO " + io.papermc.paper.ServerBrandConstants.BRAND_NAME.toUpperCase() + " - THIS IS NOT A BUG OR A CRASH - " + Bukkit.getServer().getVersion() + " ---"); // Purpur // Plazma - Fork-friendly Rebranding
log.log(Level.SEVERE, "The server has not responded for " + (currentTime - lastTick) / 1000 + " seconds! Creating thread dump");
}
// Paper end - Different message for short timeout
log.log( Level.SEVERE, "------------------------------" );
- log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Purpur!):" ); // Paper // Purpur
+ log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to " + io.papermc.paper.ServerBuildInfo.buildInfo().brandName() + "!):" ); // Paper // Purpur // Plazma - Fork-friendly Rebranding
io.papermc.paper.chunk.system.scheduling.ChunkTaskScheduler.dumpAllChunkLoadInfo(isLongTimeout); // Paper - rewrite chunk system
+ log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to " + io.papermc.paper.ServerBrandConstants.BRAND_NAME + "!):" ); // Paper // Purpur // Plazma - Fork-friendly Rebranding
ca.spottedleaf.moonrise.patches.chunk_system.scheduling.ChunkTaskScheduler.dumpAllChunkLoadInfo(MinecraftServer.getServer(), isLongTimeout); // Paper - rewrite chunk system
this.dumpTickingInfo(); // Paper - log detailed tick information
WatchdogThread.dumpThread( ManagementFactory.getThreadMXBean().getThreadInfo( MinecraftServer.getServer().serverThread.getId(), Integer.MAX_VALUE ), log );
@@ -205,7 +205,7 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa
@@ -205,7 +205,7 @@ public class WatchdogThread extends ca.spottedleaf.moonrise.common.util.TickThre
WatchdogThread.dumpThread( thread, log );
}
} else {
- log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO PURPUR - THIS IS NOT A BUG OR A CRASH ---"); // Purpur
+ log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO " + io.papermc.paper.ServerBuildInfo.buildInfo().brandName() + " - THIS IS NOT A BUG OR A CRASH ---"); // Purpur // Plazma - Fork-friendly Rebranding
+ log.log(Level.SEVERE, "--- DO NOT REPORT THIS TO " + io.papermc.paper.ServerBrandConstants.BRAND_NAME + " - THIS IS NOT A BUG OR A CRASH ---"); // Purpur // Plazma - Fork-friendly Rebranding
}
log.log( Level.SEVERE, "------------------------------" );

View File

@@ -1,465 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Fri, 10 Mar 2023 22:08:56 +0900
Subject: [PATCH] Rebrand Logo
diff --git a/src/main/resources/logo.png b/src/main/resources/logo.png
index 8b924977b7886df9ab8790b1e4ff9b1c04a2af45..efa53bcb692650396b2e71b62243a15dd95aa096 100644
GIT binary patch
literal 7439
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
literal 16900
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
XXyugpZ1#qMfq}u()z4*}Q$iB}^Bg|U

File diff suppressed because it is too large Load Diff

View File

@@ -5,12 +5,12 @@ Subject: [PATCH] Plazma Configurations
diff --git a/src/main/java/io/papermc/paper/configuration/Configurations.java b/src/main/java/io/papermc/paper/configuration/Configurations.java
index 62b602450a53cfebf08f839b505d0e965aff6e20..cda3636a1ff914c7177e95a8f813e9f4dd27a2c5 100644
index cda2ca940e30506807a5d12b84dbf69529051e26..150556ba594eae2214e4d1f0243ee97a7beb1e99 100644
--- a/src/main/java/io/papermc/paper/configuration/Configurations.java
+++ b/src/main/java/io/papermc/paper/configuration/Configurations.java
@@ -39,28 +39,95 @@ public abstract class Configurations<G, W> {
@@ -37,27 +37,94 @@ public abstract class Configurations<G, W> {
public static final String WORLD_DEFAULTS = "__world_defaults__";
public static final ResourceLocation WORLD_DEFAULTS_KEY = new ResourceLocation("configurations", WORLD_DEFAULTS);
public static final ResourceLocation WORLD_DEFAULTS_KEY = ResourceLocation.fromNamespaceAndPath("configurations", WORLD_DEFAULTS);
protected final Path globalFolder;
- protected final Class<G> globalConfigClass;
- protected final Class<W> worldConfigClass;
@@ -26,6 +26,12 @@ index 62b602450a53cfebf08f839b505d0e965aff6e20..cda3636a1ff914c7177e95a8f813e9f4
- final String defaultWorldConfigFileName,
- final String worldConfigFileName
- ) {
- this.globalFolder = globalFolder;
- this.globalConfigClass = globalConfigType;
- this.worldConfigClass = worldConfigClass;
- this.globalConfigFileName = globalConfigFileName;
- this.defaultWorldConfigFileName = defaultWorldConfigFileName;
- this.worldConfigFileName = worldConfigFileName;
+
+ // Plazma start - Configurable Plazma
+ @org.jetbrains.annotations.VisibleForTesting
@@ -43,14 +49,9 @@ index 62b602450a53cfebf08f839b505d0e965aff6e20..cda3636a1ff914c7177e95a8f813e9f4
+ } catch (IOException e) {
+ throw new RuntimeException("Could not setup configurations", e);
+ }
this.globalFolder = globalFolder;
- this.globalConfigClass = globalConfigType;
- this.worldConfigClass = worldConfigClass;
- this.globalConfigFileName = globalConfigFileName;
- this.defaultWorldConfigFileName = defaultWorldConfigFileName;
- this.worldConfigFileName = worldConfigFileName;
}
+ this.globalFolder = globalFolder; // Plazma - diff on changes
+ } // Plazma - diff on changes
+
+ protected abstract Class<G> globalConfigClass();
+ protected abstract String globalConfigFileName();
+ protected abstract org.spongepowered.configurate.NodePath[] removedGlobalPaths();
@@ -117,13 +118,12 @@ index 62b602450a53cfebf08f839b505d0e965aff6e20..cda3636a1ff914c7177e95a8f813e9f4
+ } catch (Exception e) {
+ throw new RuntimeException("Could not reload configuration files", e);
+ }
+ }
}
+ // Plazma end - Configurable Plazma
+
protected ObjectMapper.Factory.Builder createObjectMapper() {
return ObjectMapper.factoryBuilder()
.addConstraint(Constraint.class, new Constraint.Factory())
@@ -68,17 +135,21 @@ public abstract class Configurations<G, W> {
@@ -66,17 +133,21 @@ public abstract class Configurations<G, W> {
}
protected YamlConfigurationLoader.Builder createLoaderBuilder() {
@@ -148,16 +148,16 @@ index 62b602450a53cfebf08f839b505d0e965aff6e20..cda3636a1ff914c7177e95a8f813e9f4
}
@MustBeInvokedByOverriders
@@ -96,7 +167,7 @@ public abstract class Configurations<G, W> {
@@ -94,7 +165,7 @@ public abstract class Configurations<G, W> {
};
}
- static <T> CheckedFunction<ConfigurationNode, T, SerializationException> reloader(Class<T> type, T instance) {
+ protected static <T> CheckedFunction<ConfigurationNode, T, SerializationException> reloader(Class<T> type, T instance) { // Plazma - AT (package -> public)
+ protected static <T> CheckedFunction<ConfigurationNode, T, SerializationException> reloader(Class<T> type, T instance) { // Plazma - package -> protected
return node -> {
ObjectMapper.Factory factory = (ObjectMapper.Factory) Objects.requireNonNull(node.options().serializers().get(type));
ObjectMapper.Mutable<T> mutable = (ObjectMapper.Mutable<T>) factory.get(type);
@@ -106,7 +177,7 @@ public abstract class Configurations<G, W> {
@@ -104,7 +175,7 @@ public abstract class Configurations<G, W> {
}
public G initializeGlobalConfiguration(final RegistryAccess registryAccess) throws ConfigurateException {
@@ -166,7 +166,7 @@ index 62b602450a53cfebf08f839b505d0e965aff6e20..cda3636a1ff914c7177e95a8f813e9f4
}
private void trySaveFileNode(YamlConfigurationLoader loader, ConfigurationNode node, String filename) throws ConfigurateException {
@@ -125,7 +196,7 @@ public abstract class Configurations<G, W> {
@@ -118,7 +189,7 @@ public abstract class Configurations<G, W> {
}
protected G initializeGlobalConfiguration(final CheckedFunction<ConfigurationNode, G, SerializationException> creator) throws ConfigurateException {
@@ -175,7 +175,7 @@ index 62b602450a53cfebf08f839b505d0e965aff6e20..cda3636a1ff914c7177e95a8f813e9f4
final YamlConfigurationLoader loader = this.createGlobalLoaderBuilder()
.defaultOptions(this.applyObjectMapperFactory(this.createGlobalObjectMapperFactoryBuilder().build()))
.path(configFile)
@@ -156,6 +227,13 @@ public abstract class Configurations<G, W> {
@@ -149,6 +220,13 @@ public abstract class Configurations<G, W> {
}
protected void applyGlobalConfigTransformations(final ConfigurationNode node) throws ConfigurateException {
@@ -189,7 +189,7 @@ index 62b602450a53cfebf08f839b505d0e965aff6e20..cda3636a1ff914c7177e95a8f813e9f4
}
@MustBeInvokedByOverriders
@@ -163,6 +241,7 @@ public abstract class Configurations<G, W> {
@@ -156,6 +234,7 @@ public abstract class Configurations<G, W> {
return ContextMap.builder()
.put(WORLD_NAME, WORLD_DEFAULTS)
.put(WORLD_KEY, WORLD_DEFAULTS_KEY)
@@ -197,7 +197,7 @@ index 62b602450a53cfebf08f839b505d0e965aff6e20..cda3636a1ff914c7177e95a8f813e9f4
.put(REGISTRY_ACCESS, registryAccess);
}
@@ -170,7 +249,7 @@ public abstract class Configurations<G, W> {
@@ -163,7 +242,7 @@ public abstract class Configurations<G, W> {
final ContextMap contextMap = this.createDefaultContextMap(registryAccess)
.put(FIRST_DEFAULT)
.build();
@@ -206,7 +206,7 @@ index 62b602450a53cfebf08f839b505d0e965aff6e20..cda3636a1ff914c7177e95a8f813e9f4
final DefaultWorldLoader result = this.createDefaultWorldLoader(false, contextMap, configFile);
final YamlConfigurationLoader loader = result.loader();
final ConfigurationNode node = loader.load();
@@ -180,8 +259,8 @@ public abstract class Configurations<G, W> {
@@ -173,8 +252,8 @@ public abstract class Configurations<G, W> {
this.verifyWorldConfigVersion(contextMap, node);
}
this.applyWorldConfigTransformations(contextMap, node, null);
@@ -217,29 +217,33 @@ index 62b602450a53cfebf08f839b505d0e965aff6e20..cda3636a1ff914c7177e95a8f813e9f4
this.trySaveFileNode(loader, node, configFile.toString());
}
@@ -202,31 +281,42 @@ public abstract class Configurations<G, W> {
private record DefaultWorldLoader(YamlConfigurationLoader loader, boolean isNewFile) {
@@ -196,30 +275,45 @@ public abstract class Configurations<G, W> {
}
+ // Plazma start - Configurable Plazma
protected ObjectMapper.Factory.Builder createWorldObjectMapperFactoryBuilder(final ContextMap contextMap) {
- return this.createObjectMapper();
+ // Plazma start - Configurable Plazma
+ return this.createObjectMapper()
+ .addNodeResolver(new io.papermc.paper.configuration.legacy.RequiresSpigotInitialization.Factory(contextMap.require(SPIGOT_WORLD_CONFIG_CONTEXT_KEY).get()))
+ .addNodeResolver(new NestedSetting.Factory())
+ .addDiscoverer(new io.papermc.paper.configuration.mapping.InnerClassFieldDiscoverer(Map.of(this.worldConfigClass(), createWorldConfigInstance(contextMap))));
+ // Plazma end - Configurable Plazma
}
@MustBeInvokedByOverriders
protected YamlConfigurationLoader.Builder createWorldConfigLoaderBuilder(final ContextMap contextMap) {
- return this.createLoaderBuilder();
+ // Plazma start - Configurable Plazma
+ return this.createLoaderBuilder().defaultOptions(options -> options
+ .header(contextMap.require(WORLD_NAME).equals(WORLD_DEFAULTS) ? this.worldDefaultHeader() : this.buildWorldHeader(contextMap)));
+ // Plazma end - Configurable Plazma
}
+ // Plazma start - Configurable Plazma
// Make sure to run version transforms on the default world config first via #setupWorldDefaultsConfig
- public W createWorldConfig(final ContextMap contextMap) throws IOException {
- return this.createWorldConfig(contextMap, creator(this.worldConfigClass, false));
- }
+ public W createWorldConfig(final ContextMap contextMap) {
+ final String levelName = contextMap.require(WORLD_NAME);
+ try {
@@ -247,7 +251,7 @@ index 62b602450a53cfebf08f839b505d0e965aff6e20..cda3636a1ff914c7177e95a8f813e9f4
+ } catch (IOException exception) {
+ throw new RuntimeException("Could not create world config for " + levelName, exception);
+ }
}
+ } // diff on change
+ // Plazma end - Configurable Plazma
protected W createWorldConfig(final ContextMap contextMap, final CheckedFunction<ConfigurationNode, W, SerializationException> creator) throws IOException {
@@ -267,7 +271,7 @@ index 62b602450a53cfebf08f839b505d0e965aff6e20..cda3636a1ff914c7177e95a8f813e9f4
Files.createFile(worldConfigFile); // create empty file as template
newFile = true;
}
@@ -270,6 +360,13 @@ public abstract class Configurations<G, W> {
@@ -263,6 +357,13 @@ public abstract class Configurations<G, W> {
}
protected void applyWorldConfigTransformations(final ContextMap contextMap, final ConfigurationNode node, final @Nullable ConfigurationNode defaultsNode) throws ConfigurateException {
@@ -281,7 +285,7 @@ index 62b602450a53cfebf08f839b505d0e965aff6e20..cda3636a1ff914c7177e95a8f813e9f4
}
protected void applyDefaultsAwareWorldConfigTransformations(final ContextMap contextMap, final ConfigurationNode worldNode, final ConfigurationNode defaultsNode) throws ConfigurateException {
@@ -282,7 +379,7 @@ public abstract class Configurations<G, W> {
@@ -275,7 +376,7 @@ public abstract class Configurations<G, W> {
}
public Path getWorldConfigFile(ServerLevel level) {
@@ -291,10 +295,10 @@ index 62b602450a53cfebf08f839b505d0e965aff6e20..cda3636a1ff914c7177e95a8f813e9f4
public static class ContextMap {
diff --git a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
index 83a726bcf8b7dce73a361b0d79dbd63a0afc7a12..3c893e5da90f7fcf519f190e34e2b15ea16ea262 100644
index 47a2cba0db36b11548d06ec21f7c7d7c9a962d6e..3f99ca451099d2c7baf12b7b603d8b30f520734c 100644
--- a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
+++ b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
@@ -134,6 +134,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
@@ -137,6 +137,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
See https://docs.papermc.io/paper/configuration for more information.
""";
@@ -302,16 +306,14 @@ index 83a726bcf8b7dce73a361b0d79dbd63a0afc7a12..3c893e5da90f7fcf519f190e34e2b15e
@VisibleForTesting
public static final Supplier<SpigotWorldConfig> SPIGOT_WORLD_DEFAULTS = Suppliers.memoize(() -> new SpigotWorldConfig(RandomStringUtils.randomAlphabetic(255)) {
@Override // override to ensure "verbose" is false
@@ -142,12 +143,69 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
@@ -145,11 +146,68 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
}
});
public static final ContextKey<Supplier<SpigotWorldConfig>> SPIGOT_WORLD_CONFIG_CONTEXT_KEY = new ContextKey<>(new TypeToken<Supplier<SpigotWorldConfig>>() {}, "spigot world config");
-
+ // Plazma start - Configurable Plazma
+ */
+ */ // Plazma - Configurable Plazma
public PaperConfigurations(final Path globalFolder) {
- super(globalFolder, GlobalConfiguration.class, WorldConfiguration.class, GLOBAL_CONFIG_FILE_NAME, WORLD_DEFAULTS_CONFIG_FILE_NAME, WORLD_CONFIG_FILE_NAME);
+ // Plazma start - Configurable Plazma
+ public PaperConfigurations(final Path globalFolder) { // diff on change
+ super(globalFolder);
+ }
+
@@ -359,30 +361,48 @@ index 83a726bcf8b7dce73a361b0d79dbd63a0afc7a12..3c893e5da90f7fcf519f190e34e2b15e
+ protected String worldDefaultHeader() {
+ return WORLD_DEFAULTS_HEADER;
+ }
+
- public PaperConfigurations(final Path globalFolder) {
- super(globalFolder, GlobalConfiguration.class, WorldConfiguration.class, GLOBAL_CONFIG_FILE_NAME, WORLD_DEFAULTS_CONFIG_FILE_NAME, WORLD_CONFIG_FILE_NAME);
+ @Override
+ protected String buildWorldHeader(final ContextMap contextMap) {
+ return WORLD_HEADER.apply(contextMap);
}
+ }
+
+ @Override
+ protected WorldConfiguration getWorldConfiguration(final ServerLevel level) {
+ return level.paperConfig();
+ }
}
+ // Plazma end - Configurable Plazma
+
@Override
protected int globalConfigVersion() {
return GlobalConfiguration.CURRENT_VERSION;
@@ -158,6 +216,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
return WorldConfiguration.CURRENT_VERSION;
@@ -164,14 +222,11 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
@Override
protected YamlConfigurationLoader.Builder createLoaderBuilder() {
return super.createLoaderBuilder()
- .defaultOptions(PaperConfigurations::defaultOptions);
+ .defaultOptions(PaperConfigurations::defaultOptions0); // Plazma - Configurable Plazma
}
- private static ConfigurationOptions defaultOptions(ConfigurationOptions options) {
+ private static ConfigurationOptions defaultOptions0(ConfigurationOptions options) { // Plazma - Configurable Plazma
return options.serializers(builder -> builder
- .register(MapSerializer.TYPE, new MapSerializer(false))
- .register(new EnumValueSerializer())
- .register(new ComponentSerializer())
.register(IntOr.Default.SERIALIZER)
.register(IntOr.Disabled.SERIALIZER)
.register(DoubleOr.Default.SERIALIZER)
@@ -183,6 +238,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
);
}
+ /* // Plazma - Configurable Plazma
@Override
protected YamlConfigurationLoader.Builder createLoaderBuilder() {
return super.createLoaderBuilder()
@@ -180,6 +239,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
protected ObjectMapper.Factory.Builder createGlobalObjectMapperFactoryBuilder() {
return defaultGlobalFactoryBuilder(super.createGlobalObjectMapperFactoryBuilder());
@@ -191,6 +247,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
private static ObjectMapper.Factory.Builder defaultGlobalFactoryBuilder(ObjectMapper.Factory.Builder builder) {
return builder.addDiscoverer(InnerClassFieldDiscoverer.globalConfig());
}
@@ -390,7 +410,7 @@ index 83a726bcf8b7dce73a361b0d79dbd63a0afc7a12..3c893e5da90f7fcf519f190e34e2b15e
@Override
protected YamlConfigurationLoader.Builder createGlobalLoaderBuilder() {
@@ -203,6 +263,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
@@ -213,6 +270,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
return configuration;
}
@@ -398,7 +418,7 @@ index 83a726bcf8b7dce73a361b0d79dbd63a0afc7a12..3c893e5da90f7fcf519f190e34e2b15e
@Override
protected ContextMap.Builder createDefaultContextMap(final RegistryAccess registryAccess) {
return super.createDefaultContextMap(registryAccess)
@@ -216,8 +277,9 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
@@ -226,8 +284,9 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
.addNodeResolver(new NestedSetting.Factory())
.addDiscoverer(InnerClassFieldDiscoverer.worldConfig(createWorldConfigInstance(contextMap)));
}
@@ -409,7 +429,7 @@ index 83a726bcf8b7dce73a361b0d79dbd63a0afc7a12..3c893e5da90f7fcf519f190e34e2b15e
return new WorldConfiguration(
contextMap.require(PaperConfigurations.SPIGOT_WORLD_CONFIG_CONTEXT_KEY).get(),
contextMap.require(Configurations.WORLD_KEY)
@@ -229,7 +291,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
@@ -239,7 +298,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
final RegistryAccess access = contextMap.require(REGISTRY_ACCESS);
return super.createWorldConfigLoaderBuilder(contextMap)
.defaultOptions(options -> options
@@ -418,7 +438,7 @@ index 83a726bcf8b7dce73a361b0d79dbd63a0afc7a12..3c893e5da90f7fcf519f190e34e2b15e
.serializers(serializers -> serializers
.register(new TypeToken<Reference2IntMap<?>>() {}, new FastutilMapSerializer.SomethingToPrimitive<Reference2IntMap<?>>(Reference2IntOpenHashMap::new, Integer.TYPE))
.register(new TypeToken<Reference2LongMap<?>>() {}, new FastutilMapSerializer.SomethingToPrimitive<Reference2LongMap<?>>(Reference2LongOpenHashMap::new, Long.TYPE))
@@ -254,11 +316,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
@@ -259,12 +318,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
@Override
protected void applyWorldConfigTransformations(final ContextMap contextMap, final ConfigurationNode node, final @Nullable ConfigurationNode defaultsNode) throws ConfigurateException {
@@ -426,12 +446,13 @@ index 83a726bcf8b7dce73a361b0d79dbd63a0afc7a12..3c893e5da90f7fcf519f190e34e2b15e
- for (final NodePath path : RemovedConfigurations.REMOVED_WORLD_PATHS) {
- builder.addAction(path, TransformAction.remove());
- }
- org.purpurmc.purpur.configuration.transformation.VoidDamageHeightMigration.apply(builder, contextMap); // Purpur
- builder.build().apply(node);
+ super.applyWorldConfigTransformations(contextMap, node, defaultsNode); // Plazma - Configurable Plazma // Plazma - Configurable Plazma
+ super.applyWorldConfigTransformations(contextMap, node, defaultsNode); // Plazma - Configurable Plazma
final ConfigurationTransformation.VersionedBuilder versionedBuilder = Transformations.versionedBuilder();
V29_ZeroWorldHeight.apply(versionedBuilder);
@@ -270,11 +328,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
@@ -276,11 +330,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
@Override
protected void applyGlobalConfigTransformations(ConfigurationNode node) throws ConfigurateException {
@@ -444,7 +465,7 @@ index 83a726bcf8b7dce73a361b0d79dbd63a0afc7a12..3c893e5da90f7fcf519f190e34e2b15e
final ConfigurationTransformation.VersionedBuilder versionedBuilder = Transformations.versionedBuilder();
V29_LogIPs.apply(versionedBuilder);
@@ -294,6 +348,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
@@ -300,6 +350,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
builder.build().apply(worldNode);
}
@@ -452,7 +473,7 @@ index 83a726bcf8b7dce73a361b0d79dbd63a0afc7a12..3c893e5da90f7fcf519f190e34e2b15e
@Override
public WorldConfiguration createWorldConfig(final ContextMap contextMap) {
final String levelName = contextMap.require(WORLD_NAME);
@@ -335,6 +390,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
@@ -341,6 +392,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
.put(GAME_RULES, gameRules)
.build();
}
@@ -460,7 +481,7 @@ index 83a726bcf8b7dce73a361b0d79dbd63a0afc7a12..3c893e5da90f7fcf519f190e34e2b15e
public static PaperConfigurations setup(final Path legacyConfig, final Path configDir, final Path worldFolder, final File spigotConfig) throws Exception {
final Path legacy = Files.isSymbolicLink(legacyConfig) ? Files.readSymbolicLink(legacyConfig) : legacyConfig;
@@ -368,12 +424,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
@@ -374,12 +426,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
throw new RuntimeException("Could not convert '" + legacyFileName + "' to the new configuration format", ex);
}
}
@@ -474,7 +495,7 @@ index 83a726bcf8b7dce73a361b0d79dbd63a0afc7a12..3c893e5da90f7fcf519f190e34e2b15e
}
private static void convert(final Path legacyConfig, final Path configDir, final Path worldFolder, final File spigotConfig) throws Exception {
@@ -424,6 +475,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
@@ -430,6 +477,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
return Files.exists(legacyConfig) && Files.isRegularFile(legacyConfig);
}
@@ -482,7 +503,7 @@ index 83a726bcf8b7dce73a361b0d79dbd63a0afc7a12..3c893e5da90f7fcf519f190e34e2b15e
@Deprecated
public YamlConfiguration createLegacyObject(final MinecraftServer server) {
YamlConfiguration global = YamlConfiguration.loadConfiguration(this.globalFolder.resolve(this.globalConfigFileName).toFile());
@@ -434,6 +486,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
@@ -440,6 +488,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
}
return global;
}
@@ -490,7 +511,7 @@ index 83a726bcf8b7dce73a361b0d79dbd63a0afc7a12..3c893e5da90f7fcf519f190e34e2b15e
@Deprecated
public static YamlConfiguration loadLegacyConfigFile(File configFile) throws Exception {
@@ -456,10 +509,13 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
@@ -462,10 +511,13 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
return BasicConfigurationNode.root(options);
}
@@ -505,18 +526,18 @@ index 83a726bcf8b7dce73a361b0d79dbd63a0afc7a12..3c893e5da90f7fcf519f190e34e2b15e
+
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 468cb5034f7648e6ef39b1961298f592535aad88..79ee153cd3c7bd3b2f34e7d30f70be5080cfa3c6 100644
index 20f79bcd7613e426b6b1020f586773819f1ac9d0..20266ef8f0974f47581e71175de4b01ea1a27bf0 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -311,6 +311,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -328,6 +328,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public final double[] recentTps = new double[ 4 ]; // Purpur
// Spigot end
public final io.papermc.paper.configuration.PaperConfigurations paperConfigurations; // Paper - add paper configuration files
+ public final org.plazmamc.plazma.configurations.PlazmaConfigurations plazmaConfigurations; // Plazma - Configurable Plazma
public static long currentTickLong = 0L; // Paper - track current tick as a long
public boolean isIteratingOverLevels = false; // Paper - Throw exception on world create while being ticked
public boolean lagging = false; // Purpur
@@ -422,6 +423,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
protected boolean upnp = false; // Purpur
@@ -515,6 +516,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
Runtime.getRuntime().addShutdownHook(new org.bukkit.craftbukkit.util.ServerShutdownThread(this));
// CraftBukkit end
this.paperConfigurations = services.paperConfigurations(); // Paper - add paper configuration files
@@ -584,42 +605,41 @@ index 33e3815a0c979609d4c7ab83ad91e87ac07a556d..4f1071c48fec78036d6759cdff179df3
}
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 6d3f61a05c4d4ad20e62175eb0331bc31b5d6807..6cbbe9c692068edee7e66f85081ec95b8dd12101 100644
index 193c62ed303d25558d78f1e8dfb655919335fdf6..d4a9b187b01c63342d9b05b5c29bb1d199deed6c 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -222,6 +222,8 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@@ -232,6 +232,8 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
// Paper start - initialize global and world-defaults configuration
this.paperConfigurations.initializeGlobalConfiguration(this.registryAccess());
this.paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess());
+ this.plazmaConfigurations.initializeGlobalConfiguration(this.registryAccess()); // Plazma - Configurable Plazma
+ this.plazmaConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess()); // Plazma - Configurable Plazma
// Paper end - initialize global and world-defaults configuration
this.server.spark.enableEarlyIfRequested(); // Paper - spark
// Paper start - fix converting txt to json file; convert old users earlier after PlayerList creation but before file load/save
if (this.convertOldUsers()) {
@@ -232,6 +234,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@@ -243,6 +245,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
org.spigotmc.WatchdogThread.doStart(org.spigotmc.SpigotConfig.timeoutTime, org.spigotmc.SpigotConfig.restartOnCrash); // Paper - start watchdog thread
thread.start(); // Paper - Enhance console tab completions for brigadier commands; start console thread after MinecraftServer.console & PaperConfig are initialized
io.papermc.paper.command.PaperCommands.registerCommands(this); // Paper - setup /paper command
+ org.plazmamc.plazma.commands.Commands.register(this); // Plazma - Configurable Plazma
this.server.spark.registerCommandBeforePlugins(this.server); // Paper - spark
com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics(); // Paper - start metrics
// Purpur start
try {
com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // Paper - load version history now
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index b3d47d16fb9733ca5cc4f90051ee8694ff3545c5..5456d2ded6f6e75c48868147e5a2dde5eb23bec8 100644
index 6a359f1ed07aa7b9c78e470fb00661ea03eaec03..a4421517b8136bb974e197eaa6dd0d83c2fdd0de 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -700,15 +700,33 @@ public class ServerLevel extends Level implements WorldGenLevel {
// Holder holder = worlddimension.type(); // CraftBukkit - decompile error
@@ -600,7 +600,24 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
// Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error
- super(iworlddataserver, resourcekey, minecraftserver.registryAccess(), worlddimension.type(), minecraftserver::getProfiler, false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env, spigotConfig -> minecraftserver.paperConfigurations.createWorldConfig(io.papermc.paper.configuration.PaperConfigurations.createWorldContextMap(convertable_conversionsession.levelDirectory.path(), iworlddataserver.getLevelName(), resourcekey.location(), spigotConfig, minecraftserver.registryAccess(), iworlddataserver.getGameRules())), executor); // Paper - create paper world configs; Async-Anti-Xray: Pass executor
// Add env and gen to constructor, IWorldDataServer -> WorldDataServer
public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey<Level> resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List<CustomSpawner> list, boolean flag1, @Nullable RandomSequences randomsequences, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) {
- super(iworlddataserver, resourcekey, minecraftserver.registryAccess(), worlddimension.type(), false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env, spigotConfig -> minecraftserver.paperConfigurations.createWorldConfig(io.papermc.paper.configuration.PaperConfigurations.createWorldContextMap(convertable_conversionsession.levelDirectory.path(), iworlddataserver.getLevelName(), resourcekey.location(), spigotConfig, minecraftserver.registryAccess(), iworlddataserver.getGameRules())), executor); // Paper - create paper world configs; Async-Anti-Xray: Pass executor
+ // Plazma start - Configurable Plazma
+ super(
+ iworlddataserver,
+ resourcekey,
+ minecraftserver.registryAccess(),
+ worlddimension.type(),
+ minecraftserver::getProfiler,
+ false,
+ flag,
+ i,
@@ -635,45 +655,35 @@ index b3d47d16fb9733ca5cc4f90051ee8694ff3545c5..5456d2ded6f6e75c48868147e5a2dde5
this.pvpMode = minecraftserver.isPvpAllowed();
this.convertable = convertable_conversionsession;
this.uuid = WorldUUID.getUUID(convertable_conversionsession.levelDirectory.path().toFile());
// CraftBukkit end
this.players = Lists.newArrayList();
this.entityTickList = new EntityTickList();
- this.blockTicks = new LevelTicks<>(this::isPositionTickingWithEntitiesLoaded, this.getProfilerSupplier());
- this.fluidTicks = new LevelTicks<>(this::isPositionTickingWithEntitiesLoaded, this.getProfilerSupplier());
+ this.blockTicks = new LevelTicks<>(this::isPositionTickingWithEntitiesLoaded/*, this.getProfilerSupplier()*/); // Plazma - Completely remove Mojang's Profiler
+ this.fluidTicks = new LevelTicks<>(this::isPositionTickingWithEntitiesLoaded/*, this.getProfilerSupplier()*/); // Plazma - Completely remove Mojang's Profiler
this.pathTypesByPosCache = new PathTypeCache();
this.navigatingMobs = new ObjectOpenHashSet();
this.blockEvents = new ObjectLinkedOpenHashSet();
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 6fab30d186d64d51f7dd9af00fccded4c388844c..df73867ee5682fb966b69dd85da61a6928d8dab3 100644
index f8575f94a389d87d8043ae838720dbe2247235c4..0da2014933fe441c4d3dc27c5fe10afa92ca1ec7 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -169,6 +169,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -172,7 +172,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
return this.paperConfig;
}
// Paper end - add paper world config
-
+ // Plazma start - Configurable Plazma
+ private final org.plazmamc.plazma.configurations.WorldConfigurations plazmaConfig;
+ public org.plazmamc.plazma.configurations.WorldConfigurations plazmaConfig() {
+ return this.plazmaConfig;
+ }
+ // Plazma end - Configurable Plazma
public final com.destroystokyo.paper.antixray.ChunkPacketBlockController chunkPacketBlockController; // Paper - Anti-Xray
public final org.purpurmc.purpur.PurpurWorldConfig purpurConfig; // Purpur
@@ -251,9 +257,28 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public static BlockPos lastPhysicsProblem; // Spigot
@@ -874,7 +879,24 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
}
// Paper end - optimise random ticking
//protected final io.papermc.paper.util.math.ThreadUnsafeRandom randomTickRandom = new io.papermc.paper.util.math.ThreadUnsafeRandom(java.util.concurrent.ThreadLocalRandom.current().nextLong()); public net.minecraft.util.RandomSource getThreadUnsafeRandom() { return this.randomTickRandom; } // Pufferfish - move thread unsafe random initialization // Pufferfish - getter // Purpur - dont break ABI
- protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator, java.util.concurrent.Executor executor) { // Paper - create paper world config; Async-Anti-Xray: Pass executor
- protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator, java.util.concurrent.Executor executor) { // Paper - create paper world config & Anti-Xray
+ // Plazma start - Configurable Plazma
+ protected Level(
+ WritableLevelData worlddatamutable,
+ ResourceKey<Level> resourcekey,
+ RegistryAccess iregistrycustom,
+ Holder<DimensionType> holder,
+ Supplier<ProfilerFiller> supplier,
+ boolean flag,
+ boolean flag1,
+ long i,
@@ -686,6 +696,11 @@ index 6fab30d186d64d51f7dd9af00fccded4c388844c..df73867ee5682fb966b69dd85da61a69
+ java.util.concurrent.Executor executor
+ ) {
+ // Plazma end - Configurable Plazma
// Paper start - getblock optimisations - cache world height/sections
final DimensionType dimType = holder.value();
this.minY = dimType.minY();
@@ -886,6 +908,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
// Paper end - getblock optimisations - cache world height/sections
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper - create paper world config
+ this.plazmaConfig = plazmaWorldConfigurationCreator.apply(this.spigotConfig); // Plazma - Configurable Plazma
@@ -693,10 +708,10 @@ index 6fab30d186d64d51f7dd9af00fccded4c388844c..df73867ee5682fb966b69dd85da61a69
this.playerBreedingCooldowns = this.getNewBreedingCooldownCache(); // Purpur
this.generator = gen;
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 3c505f631f15fe97e380c96ac719b1f61ed22690..02037da80f2f3cada359bbe0f58160fd15761b77 100644
index 81922bf93f8a96e6cf05944ca98a82cc5945a6c6..655463a7d588ed88778d137b6fe5ac18951ff172 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1047,6 +1047,7 @@ public final class CraftServer implements Server {
@@ -1100,6 +1100,7 @@ public final class CraftServer implements Server {
org.spigotmc.SpigotConfig.init((File) this.console.options.valueOf("spigot-settings")); // Spigot
this.console.paperConfigurations.reloadConfigs(this.console);
@@ -704,7 +719,7 @@ index 3c505f631f15fe97e380c96ac719b1f61ed22690..02037da80f2f3cada359bbe0f58160fd
org.purpurmc.purpur.PurpurConfig.init((File) console.options.valueOf("purpur-settings")); // Purpur
for (ServerLevel world : this.console.getAllLevels()) {
// world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty
@@ -3113,6 +3114,13 @@ public final class CraftServer implements Server {
@@ -3112,6 +3113,13 @@ public final class CraftServer implements Server {
}
// Purpur end
@@ -719,7 +734,7 @@ index 3c505f631f15fe97e380c96ac719b1f61ed22690..02037da80f2f3cada359bbe0f58160fd
public void restart() {
org.spigotmc.RestartCommand.restart();
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index 90d6650aa37247f3907f6bcf2fe5201cac4e05ea..24c3914ba4f144a2e43c17e98373b7a4ce1f6217 100644
index 75a062e1105c2f7cc631a6b8b201b0e08621e3c5..b75e2a9273e9562a3d07f68af927ad085c428589 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -197,6 +197,14 @@ public class Main {
@@ -739,13 +754,14 @@ index 90d6650aa37247f3907f6bcf2fe5201cac4e05ea..24c3914ba4f144a2e43c17e98373b7a4
diff --git a/src/main/java/org/plazmamc/plazma/Options.java b/src/main/java/org/plazmamc/plazma/Options.java
new file mode 100644
index 0000000000000000000000000000000000000000..5942d0997f07bd51d934dac32cd349792a10643e
index 0000000000000000000000000000000000000000..ca11bd22a65c8b9f4fffb1832ada8c519ab75b98
--- /dev/null
+++ b/src/main/java/org/plazmamc/plazma/Options.java
@@ -0,0 +1,9 @@
@@ -0,0 +1,10 @@
+package org.plazmamc.plazma;
+
+import static java.lang.Boolean.getBoolean;
+import static java.lang.System.getProperty;
+
+public interface Options {
+
@@ -1001,16 +1017,20 @@ index 0000000000000000000000000000000000000000..b6664ba0fce55f5cfa0c8d3051dc8c2b
+}
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
new file mode 100644
index 0000000000000000000000000000000000000000..d8006ae086c18a4ef43906d516eba0d5fd397f5f
index 0000000000000000000000000000000000000000..b638690d5cd2360444e6c525f97f634d8e1dc60e
--- /dev/null
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
@@ -0,0 +1,26 @@
@@ -0,0 +1,30 @@
+package org.plazmamc.plazma.configurations;
+
+import io.papermc.paper.configuration.Configuration;
+import io.papermc.paper.configuration.ConfigurationPart;
+import it.unimi.dsi.fastutil.objects.Reference2ObjectMap;
+import it.unimi.dsi.fastutil.objects.Reference2ObjectOpenHashMap;
+import net.minecraft.Util;
+import org.jetbrains.annotations.NotNull;
+import org.spongepowered.configurate.objectmapping.meta.Setting;
+import java.util.List;
+
+@SuppressWarnings({"CanBeFinal", "FieldCanBeLocal", "FieldMayBeFinal", "InnerClassMayBeStatic"})
+public class GlobalConfiguration extends ConfigurationPart {
@@ -1303,18 +1323,45 @@ index 0000000000000000000000000000000000000000..f2d3d51cb4b8fc7a5fd6db1a63289fff
+ int version = VERSION;
+
+}
diff --git a/src/test/java/org/bukkit/support/AbstractTestingBase.java b/src/test/java/org/bukkit/support/AbstractTestingBase.java
index 1b1d51a68c0abe7d8f0aa1172064192c71ae645e..74af3501397bfd89d637ad5ce72bb8f2c2bbdc8a 100644
--- a/src/test/java/org/bukkit/support/AbstractTestingBase.java
+++ b/src/test/java/org/bukkit/support/AbstractTestingBase.java
@@ -64,6 +64,7 @@ public abstract class AbstractTestingBase {
diff --git a/src/main/java/plazma/Config.java b/src/main/java/plazma/Config.java
new file mode 100644
index 0000000000000000000000000000000000000000..dbba467f668600ef3dcc653d9bfe1f712c69e245
--- /dev/null
+++ b/src/main/java/plazma/Config.java
@@ -0,0 +1,21 @@
+package plazma;
+
+import org.jetbrains.annotations.Contract;
+import org.jspecify.annotations.NonNull;
+import org.plazmamc.plazma.configurations.GlobalConfiguration;
+import org.plazmamc.plazma.configurations.PlazmaConfigurations;
+import java.util.List;
+
+public interface Config {
+
+ @Contract(pure = true)
+ static boolean optimize() {
+ return PlazmaConfigurations.optimize();
+ }
+
+ @Contract(pure = true)
+ static @NonNull GlobalConfiguration get() {
+ return GlobalConfiguration.get();
+ }
+
+}
diff --git a/src/test/java/org/bukkit/support/DummyServerHelper.java b/src/test/java/org/bukkit/support/DummyServerHelper.java
index 309d371247adcddf0a1b370cc5faff3e6e01cb0f..285a90ff5cdc8cb28fafd4ea3dae306ae5b899c9 100644
--- a/src/test/java/org/bukkit/support/DummyServerHelper.java
+++ b/src/test/java/org/bukkit/support/DummyServerHelper.java
@@ -92,6 +92,7 @@ public final class DummyServerHelper {
// Paper end - testing additions
DummyServer.setup();
io.papermc.paper.configuration.GlobalConfigTestingBase.setupGlobalConfigForTest(); // Paper
io.papermc.paper.configuration.GlobalConfigTestingBase.setupGlobalConfigForTest(); // Paper - configuration files - setup global configuration test base
+ org.plazmamc.plazma.configurations.GlobalConfigurationTestingBase.setupGlobalConfigForTest(); // Plazma - Configurable Plazma
CraftRegistry.setMinecraftRegistry(REGISTRY_CUSTOM);
// Paper start - add test for recipe conversion
when(instance.recipeIterator()).thenAnswer(ignored ->
diff --git a/src/test/java/org/plazmamc/plazma/configurations/GlobalConfigurationTestingBase.java b/src/test/java/org/plazmamc/plazma/configurations/GlobalConfigurationTestingBase.java
new file mode 100644
index 0000000000000000000000000000000000000000..c63942e2dc00ed6d6b4119f418bdaa5a64b4c0fe

View File

@@ -1,937 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Thu, 25 Jan 2024 17:13:09 +0900
Subject: [PATCH] Port SparklyPaper patches
SparklyPower
Copyright (C) 2024 SparklyPower
Based on commit: 29212936a832106c4d68e2a2017acbea2fdd3cc4
diff --git a/src/main/java/io/papermc/paper/command/MSPTCommand.java b/src/main/java/io/papermc/paper/command/MSPTCommand.java
index 8b5293b0c696ef21d0101493ffa41b60bf0bc86b..03be23690a94a14d7343526acad67ccf53b85c70 100644
--- a/src/main/java/io/papermc/paper/command/MSPTCommand.java
+++ b/src/main/java/io/papermc/paper/command/MSPTCommand.java
@@ -78,6 +78,47 @@ public final class MSPTCommand extends Command {
)
)
);
+
+ // Plazma start - Port SparklyPaper patches; Track World specific MSPT
+ sender.sendMessage(text());
+ sender.sendMessage(text().content("World tick times ").color(GOLD)
+ .append(text().color(YELLOW)
+ .append(
+ text("("),
+ text("avg", GRAY),
+ text("/"),
+ text("min", GRAY),
+ text("/"),
+ text("max", GRAY),
+ text(")")
+ )
+ ).append(
+ text(" from last 5s"),
+ text(",", GRAY),
+ text(" 10s"),
+ text(",", GRAY),
+ text(" 1m"),
+ text(":", YELLOW)
+ )
+ );
+ for (net.minecraft.server.level.ServerLevel level: server.getAllLevels()) {
+ List<Component> worldTimes = new ArrayList<>();
+ worldTimes.addAll(eval(level.tickTimes5s.getTimes()));
+ worldTimes.addAll(eval(level.tickTimes10s.getTimes()));
+ worldTimes.addAll(eval(level.tickTimes60s.getTimes()));
+
+ sender.sendMessage(text().content("◴ " + level.getWorld().getName() + ": ").color(GOLD)
+ .append(text().color(GRAY)
+ .append(
+ worldTimes.get(0), SLASH, worldTimes.get(1), SLASH, worldTimes.get(2), text(", ", YELLOW),
+ worldTimes.get(3), SLASH, worldTimes.get(4), SLASH, worldTimes.get(5), text(", ", YELLOW),
+ worldTimes.get(6), SLASH, worldTimes.get(7), SLASH, worldTimes.get(8)
+ )
+ )
+ );
+ }
+ // Plazma end - Port SparklyPaper patches; Track World specific MSPT
+
return true;
}
diff --git a/src/main/java/io/papermc/paper/threadedregions/EntityScheduler.java b/src/main/java/io/papermc/paper/threadedregions/EntityScheduler.java
index 62484ebf4550b05182f693a3180bbac5d5fd906d..8b39c463b90db2d4faa33471ddce65f775908f2f 100644
--- a/src/main/java/io/papermc/paper/threadedregions/EntityScheduler.java
+++ b/src/main/java/io/papermc/paper/threadedregions/EntityScheduler.java
@@ -41,6 +41,7 @@ public final class EntityScheduler {
private long tickCount = 0L;
private static final long RETIRED_TICK_COUNT = -1L;
+ private static final net.minecraft.server.MinecraftServer SERVER = net.minecraft.server.MinecraftServer.getServer();
private final Object stateLock = new Object();
private final Long2ObjectOpenHashMap<List<ScheduledTask>> oneTimeDelayed = new Long2ObjectOpenHashMap<>();
@@ -61,14 +62,15 @@ public final class EntityScheduler {
* @throws IllegalStateException If the scheduler is already retired.
*/
public void retire() {
+ final Entity thisEntity = this.entity.getHandleRaw(); // Plazma - Port SparklyPaper patches; Skip EntityScheduler's executeTick checks if there isn't any tasks to be run
synchronized (this.stateLock) {
if (this.tickCount == RETIRED_TICK_COUNT) {
throw new IllegalStateException("Already retired");
}
this.tickCount = RETIRED_TICK_COUNT;
+ SERVER.entitiesWithScheduledTasks.remove(thisEntity); // Plazma - Port SparklyPaper patches; Skip EntityScheduler's executeTick checks if there isn't any tasks to be run
}
- final Entity thisEntity = this.entity.getHandleRaw();
// correctly handle and order retiring while running executeTick
for (int i = 0, len = this.currentlyExecuting.size(); i < len; ++i) {
@@ -124,9 +126,12 @@ public final class EntityScheduler {
if (this.tickCount == RETIRED_TICK_COUNT) {
return false;
}
- this.oneTimeDelayed.computeIfAbsent(this.tickCount + Math.max(1L, delay), (final long keyInMap) -> {
- return new ArrayList<>();
- }).add(task);
+ // Plazma start - Port SparklyPaper patches; Skip EntityScheduler's executeTick checks if there isn't any tasks to be run
+ SERVER.entitiesWithScheduledTasks.add(this.entity.getHandleRaw());
+ this.oneTimeDelayed.computeIfAbsent(
+ this.tickCount + Math.max(1L, delay), (final long keyInMap) -> new ArrayList<>()
+ ).add(task);
+ // Plazma end - Port SparklyPaper patches; Skip EntityScheduler's executeTick checks if there isn't any tasks to be run
}
return true;
@@ -143,6 +148,12 @@ public final class EntityScheduler {
TickThread.ensureTickThread(thisEntity, "May not tick entity scheduler asynchronously");
final List<ScheduledTask> toRun;
synchronized (this.stateLock) {
+ // Plazma start - Port SparklyPaper patches; Skip EntityScheduler's executeTick checks if there isn't any tasks to be run
+ if (this.currentlyExecuting.isEmpty() && this.oneTimeDelayed.isEmpty()) {
+ SERVER.entitiesWithScheduledTasks.remove(thisEntity);
+ return;
+ }
+ // Plazma end - Port SparklyPaper patches; Skip EntityScheduler's executeTick checks if there isn't any tasks to be run
if (this.tickCount == RETIRED_TICK_COUNT) {
throw new IllegalStateException("Ticking retired scheduler");
}
diff --git a/src/main/java/io/papermc/paper/util/player/NearbyPlayers.java b/src/main/java/io/papermc/paper/util/player/NearbyPlayers.java
index f164256d59b761264876ca0c85f812d101bfd5de..deaeb134c47da8710afa747bf980bd00aab846d6 100644
--- a/src/main/java/io/papermc/paper/util/player/NearbyPlayers.java
+++ b/src/main/java/io/papermc/paper/util/player/NearbyPlayers.java
@@ -106,6 +106,13 @@ public final class NearbyPlayers {
return chunk == null ? null : chunk.players[type.ordinal()];
}
+ // Plazma start - Port SparklyPaper patches; Cache coordinate key used for nearby players when ticking chunks
+ public ReferenceList<ServerPlayer> getPlayers(final long nearbyCoordKey, final NearbyMapType type) {
+ final TrackedChunk chunk = this.byChunk.get(nearbyCoordKey);
+ return chunk == null ? null : chunk.players[type.ordinal()];
+ }
+ // Plazma end - Port SparklyPaper patches; Cache coordinate key used for nearby players when ticking chunks
+
public ReferenceList<ServerPlayer> getPlayersByChunk(final int chunkX, final int chunkZ, final NearbyMapType type) {
final TrackedChunk chunk = this.byChunk.get(CoordinateUtils.getChunkKey(chunkX, chunkZ));
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 79ee153cd3c7bd3b2f34e7d30f70be5080cfa3c6..2452dae1e55165bd8c49c4670e3f2adb523de5da 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -321,6 +321,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public volatile boolean abnormalExit = false; // Paper
public static final long SERVER_INIT = System.nanoTime(); // Paper - Lag compensation
public gg.pufferfish.pufferfish.util.AsyncExecutor mobSpawnExecutor = new gg.pufferfish.pufferfish.util.AsyncExecutor("MobSpawning"); // Pufferfish - optimize mob spawning
+ public final Set<Entity> entitiesWithScheduledTasks = java.util.concurrent.ConcurrentHashMap.newKeySet(); // Plazma - Port SparklyPaper patches; Skip EntityScheduler's executeTick checks if there isn't any tasks to be run
public static <S extends MinecraftServer> S spin(Function<Thread, S> serverFactory) {
AtomicReference<S> atomicreference = new AtomicReference();
@@ -1739,17 +1740,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
//MinecraftTimings.bukkitSchedulerTimer.stopTiming(); // Spigot // Paper // Purpur
// Paper start - Folia scheduler API
((io.papermc.paper.threadedregions.scheduler.FoliaGlobalRegionScheduler) Bukkit.getGlobalRegionScheduler()).tick();
- getAllLevels().forEach(level -> {
- for (final Entity entity : level.getEntityLookup().getAllCopy()) { // Paper - rewrite chunk system
- if (entity.isRemoved()) {
- continue;
- }
- final org.bukkit.craftbukkit.entity.CraftEntity bukkit = entity.getBukkitEntityRaw();
- if (bukkit != null) {
- bukkit.taskScheduler.executeTick();
- }
- }
- });
+ // Plazma start - Port SparklyPaper patches; Skip EntityScheduler's executeTick checks if there isn't any tasks to be run
+ for (final Entity entity: entitiesWithScheduledTasks) {
+ if (entity.isRemoved()) continue;
+
+ final org.bukkit.craftbukkit.entity.CraftEntity bukkit = entity.getBukkitEntityRaw();
+ //noinspection ConstantValue
+ if (bukkit != null) bukkit.taskScheduler.executeTick();
+ }
+ // Plazma end - Port SparklyPaper patches; Skip EntityScheduler's executeTick checks if there isn't any tasks to be run
// Paper end - Folia scheduler API
io.papermc.paper.adventure.providers.ClickCallbackProviderImpl.CALLBACK_MANAGER.handleQueue(this.tickCount); // Paper
//this.profiler.push("commandFunctions"); // Purpur
@@ -1816,7 +1815,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
try {
//worldserver.timings.doTick.startTiming(); // Spigot // Purpur
+ // Plazma start - Port SparklyPaper patches; Track World specific MSPT
+ long before = Util.getNanos();
worldserver.tick(shouldKeepTicking);
+ long after = Util.getNanos() - before;
+
+ worldserver.tickTimes5s.add(this.tickCount, after);
+ worldserver.tickTimes10s.add(this.tickCount, after);
+ worldserver.tickTimes60s.add(this.tickCount, after);
+ // Plazma end - Port SparklyPaper patches; Track World specific MSPT
// Paper start
for (final io.papermc.paper.chunk.SingleThreadChunkRegionManager regionManager : worldserver.getChunkSource().chunkMap.regionManagers) {
regionManager.recalculateRegions();
@@ -2595,7 +2602,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
public ProfilerFiller getProfiler() {
- //if (gg.pufferfish.pufferfish.PufferfishConfig.disableMethodProfiler) return net.minecraft.util.profiling.InactiveProfiler.INSTANCE; // Pufferfish // Purpur
+ //if (true || gg.pufferfish.pufferfish.PufferfishConfig.disableMethodProfiler) return net.minecraft.util.profiling.InactiveProfiler.INSTANCE; // Pufferfish // Purpur
return this.profiler;
}
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 6cbbe9c692068edee7e66f85081ec95b8dd12101..3a2acbdcfb64dff5ecb686ba7ea405b488e6eca9 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -224,6 +224,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
this.paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess());
this.plazmaConfigurations.initializeGlobalConfiguration(this.registryAccess()); // Plazma - Configurable Plazma
this.plazmaConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess()); // Plazma - Configurable Plazma
+ net.sparklypower.sparklypaper.HalloweenManager.startSyncEpochTask(); // Plazma - Port SparklyPaper patches; Optimize Spooky Season
// Paper end - initialize global and world-defaults configuration
// Paper start - fix converting txt to json file; convert old users earlier after PlayerList creation but before file load/save
if (this.convertOldUsers()) {
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 4b8776e760cca21e558c8fcb1e0e8d07c3589490..dd1a38488802080f961f87b73dfbb8229fb69e99 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1439,7 +1439,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
// Paper end - Configurable entity tracking range by Y
// CraftBukkit start - respect vanish API
- if (flag && !player.getBukkitEntity().canSee(this.entity.getBukkitEntity())) { // Paper - only consider hits
+ if (flag && !player.getBukkitEntity().chunkMapCanSee(this.entity.getBukkitEntity())) { // Paper - only consider hits // Plazma - Port SparklyPaper patches; Optimize canSee check
flag = false;
}
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 5eb7bcf492ee354ef775cd8d09c7ca2bdfeb7ce2..697cb18bce2f2470a0a2347ba6709e1449b360fd 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -615,7 +615,7 @@ public class ServerChunkCache extends ChunkSource {
// Paper start - optimise chunk tick iteration
com.destroystokyo.paper.util.maplist.ReferenceList<ServerPlayer> playersNearby
- = nearbyPlayers.getPlayers(chunkcoordintpair, io.papermc.paper.util.player.NearbyPlayers.NearbyMapType.SPAWN_RANGE);
+ = nearbyPlayers.getPlayers(chunk1.nearbyPlayersCoordinateKey, io.papermc.paper.util.player.NearbyPlayers.NearbyMapType.SPAWN_RANGE);
if (playersNearby == null) {
continue;
}
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
index e16dcb7f60bc3cf2cbef4674b23f12e1e5bd59d3..c3a4fcf600e72f9e95e9df673619ce37d0480cca 100644
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
@@ -78,6 +78,7 @@ public class ServerEntity {
private List<SynchedEntityData.DataValue<?>> trackedDataValues;
// CraftBukkit start
public final Set<ServerPlayerConnection> trackedPlayers; // Purpur - private -> public
+ public static boolean skipSqrWhenNoDeltaChanges = false; // Plazma - SparklyPaper port; Skip distanceToSqr if the delta movement hasn't changed
public ServerEntity(ServerLevel worldserver, Entity entity, int i, boolean flag, Consumer<Packet<?>> consumer, Set<ServerPlayerConnection> trackedPlayers) {
this.trackedPlayers = trackedPlayers;
@@ -217,12 +218,15 @@ public class ServerEntity {
if ((this.trackDelta || this.entity.hasImpulse || this.entity instanceof LivingEntity && ((LivingEntity) this.entity).isFallFlying()) && this.tickCount > 0) {
Vec3 vec3d1 = this.entity.getDeltaMovement();
- double d0 = vec3d1.distanceToSqr(this.ap);
-
- if (d0 > 1.0E-7D || d0 > 0.0D && vec3d1.lengthSqr() == 0.0D) {
- this.ap = vec3d1;
- this.broadcast.accept(new ClientboundSetEntityMotionPacket(this.entity.getId(), this.ap));
+ // Plazma start - SparklyPaper port; Skip distanceToSqr if the delta movement hasn't changed
+ if (!skipSqrWhenNoDeltaChanges && vec3d1 != this.ap) {
+ double d0 = vec3d1.distanceToSqr(this.ap);
+ if (d0 > 1.0E-7D || d0 > 0.0D && vec3d1.lengthSqr() == 0.0D) {
+ this.ap = vec3d1;
+ this.broadcast.accept(new ClientboundSetEntityMotionPacket(this.entity.getId(), this.ap));
+ }
}
+ // Plazma end - SparklyPaper port; Skip distanceToSqr if the delta movement hasn't changed
}
if (packet1 != null) {
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 5456d2ded6f6e75c48868147e5a2dde5eb23bec8..e2de0c343098d65d830f27b4f80c3f8a9f18a7ae 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -233,6 +233,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
private final alternate.current.wire.WireHandler wireHandler = new alternate.current.wire.WireHandler(this); // Paper - optimize redstone (Alternate Current)
public boolean hasRidableMoveEvent = false; // Purpur
+ // Plazma start - Port SparklyPaper patches; Track World specific MSPT
+ public final MinecraftServer.TickTimes tickTimes5s = new MinecraftServer.TickTimes(100);
+ public final MinecraftServer.TickTimes tickTimes10s = new MinecraftServer.TickTimes(200);
+ public final MinecraftServer.TickTimes tickTimes60s = new MinecraftServer.TickTimes(1200);
+ // Plazma end - Port SparklyPaper patches; Track World specific MSPT
+
public LevelChunk getChunkIfLoaded(int x, int z) {
return this.chunkSource.getChunkAtIfLoadedImmediately(x, z); // Paper - Use getChunkIfLoadedImmediately
}
diff --git a/src/main/java/net/minecraft/stats/ServerStatsCounter.java b/src/main/java/net/minecraft/stats/ServerStatsCounter.java
index f890738d3bb9fb5e70a9d323c6cec97f9948f9cf..eb3fc1af68768383d524cf0f50c4f4b304b9d5ca 100644
--- a/src/main/java/net/minecraft/stats/ServerStatsCounter.java
+++ b/src/main/java/net/minecraft/stats/ServerStatsCounter.java
@@ -90,12 +90,14 @@ public class ServerStatsCounter extends StatsCounter {
this.dirty.add(stat);
}
+ /* // Plazma - Port SparklyPaper patches; Skip dirty stats copy when requesting player stats
private Set<Stat<?>> getDirty() {
Set<Stat<?>> set = Sets.newHashSet(this.dirty);
this.dirty.clear();
return set;
}
+ */ // Plazma - Port SparklyPaper patches; Skip dirty stats copy when requesting player stats
public void parseLocal(DataFixer dataFixer, String json) {
try {
@@ -243,7 +245,7 @@ public class ServerStatsCounter extends StatsCounter {
public void sendStats(ServerPlayer player) {
Object2IntMap<Stat<?>> object2intmap = new Object2IntOpenHashMap();
- Iterator iterator = this.getDirty().iterator();
+ Iterator<Stat<?>> iterator = this.dirty.iterator(); // Plazma - SparklyPaper port; Skip dirty stats copy when requesting player stats
while (iterator.hasNext()) {
Stat<?> statistic = (Stat) iterator.next();
@@ -251,6 +253,7 @@ public class ServerStatsCounter extends StatsCounter {
object2intmap.put(statistic, this.getValue(statistic));
}
+ this.dirty.clear(); // Plazma - SparklyPaper port; Skip dirty stats copy when requesting player stats
player.connection.send(new ClientboundAwardStatsPacket(object2intmap));
}
}
diff --git a/src/main/java/net/minecraft/world/entity/ambient/Bat.java b/src/main/java/net/minecraft/world/entity/ambient/Bat.java
index a70255995f380a9b0f7057cb5cb820f7655b93fc..2bffc790496fd9b09516d0d908b5319c9dbb1c63 100644
--- a/src/main/java/net/minecraft/world/entity/ambient/Bat.java
+++ b/src/main/java/net/minecraft/world/entity/ambient/Bat.java
@@ -306,7 +306,7 @@ public class Bat extends AmbientCreature {
int i = world.getMaxLocalRawBrightness(pos);
byte b0 = 4;
- if (Bat.isHalloweenSeason(world.getMinecraftWorld())) { // Purpur
+ if (isSpookySeason(world.getMinecraftWorld())) { // Purpur // Plazma - Port SparklyPaper patches; Optimize Spooky Season
b0 = 7;
} else if (random.nextBoolean()) {
return false;
@@ -320,7 +320,25 @@ public class Bat extends AmbientCreature {
private static boolean isSpookySeason = false;
private static final int ONE_HOUR = 20 * 60 * 60;
private static int lastSpookyCheck = -ONE_HOUR;
- public static boolean isHalloweenSeason(Level level) { return level.purpurConfig.forceHalloweenSeason || isHalloween(); } // Purpur
+
+ // Plazma start - Port SparklyPaper patches; Optimize Spooky Season
+ private static boolean isSpookySeason(Level level) {
+ if (level.purpurConfig.forceHalloweenSeason) return true;
+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().entity.spookyOptimize)
+ return net.sparklypower.sparklypaper.HalloweenManager.isSpookySeason()
+ || net.sparklypower.sparklypaper.HalloweenManager.isHalloween();
+ return isHalloween();
+ }
+
+ public static boolean isHalloweenSeason(Level level) {
+ if (level.purpurConfig.forceHalloweenSeason) return true;
+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().entity.spookyOptimize)
+ return net.sparklypower.sparklypaper.HalloweenManager.isHalloween();
+ return isHalloween();
+ }
+
+ @SuppressWarnings("RedundantExplicitChronoField")
+ // Plazma end - Port SparklyPaper patches; Optimize Spooky Season
private static boolean isHalloween() {
if (net.minecraft.server.MinecraftServer.currentTick - lastSpookyCheck > ONE_HOUR) {
LocalDate localdate = LocalDate.now();
diff --git a/src/main/java/net/minecraft/world/item/MapItem.java b/src/main/java/net/minecraft/world/item/MapItem.java
index 608390ed36710a419de1542b80340dd3fcc7299c..043f068345ca3c50209c1c3cc1feb6277a3da61a 100644
--- a/src/main/java/net/minecraft/world/item/MapItem.java
+++ b/src/main/java/net/minecraft/world/item/MapItem.java
@@ -268,11 +268,13 @@ public class MapItem extends ComplexItem {
}
}
+ public static boolean skipTickWhenCraftNotPresent = false; // Plazma - SparklyPaper port; Skip map item ticking if the craft map renderer is not present
@Override
public void inventoryTick(ItemStack stack, Level world, Entity entity, int slot, boolean selected) {
if (!world.isClientSide) {
MapItemSavedData mapItemSavedData = getSavedData(stack, world);
if (mapItemSavedData != null) {
+ if (skipTickWhenCraftNotPresent && mapItemSavedData.mapView.getRenderers().stream().noneMatch(mapRenderer -> mapRenderer.getClass() == org.bukkit.craftbukkit.map.CraftMapRenderer.class)) return; // Plazma - SparklyPaper port; Skip map item ticking if the craft map renderer is not present
if (entity instanceof Player player) {
mapItemSavedData.tickCarriedBy(player, stack);
}
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index df73867ee5682fb966b69dd85da61a6928d8dab3..5712ab081e9534f60248caaceea44445ff855e30 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -1339,6 +1339,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
boolean flag = this.tickRateManager().runsNormally();
int tilesThisCycle = 0;
+ int shouldTickBlocksAtLastResult = -1; // Plazma - Port SparklyPaper patches; Optimize tickingBlockEntities
+ long shouldTickBlocksAtChunkPos = 0; // Plazma - Port SparklyPaper patches; Optimize tickingBlockEntities
var toRemove = new it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet<TickingBlockEntity>(); // Paper - Fix MC-117075; use removeAll
toRemove.add(null); // Paper - Fix MC-117075
for (tileTickPosition = 0; tileTickPosition < this.blockEntityTickers.size(); tileTickPosition++) { // Paper - Disable tick limiters
@@ -1351,14 +1353,28 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
tilesThisCycle--;
toRemove.add(tickingblockentity); // Paper - Fix MC-117075; use removeAll
// Spigot end
- } else if (flag && this.shouldTickBlocksAt(tickingblockentity.getPos())) {
- tickingblockentity.tick();
- // Paper start - execute chunk tasks during tick
- if ((this.tileTickPosition & 7) == 0) {
- MinecraftServer.getServer().executeMidTickTasks();
+ // Plazma start - Port SparklyPaper patches; Optimize tickingBlockEntities
+ } else if (flag) {
+ long chunkPos = tickingblockentity.getChunkCoordinateKey();
+ boolean shouldTick;
+ if (shouldTickBlocksAtChunkPos == chunkPos && shouldTickBlocksAtLastResult != -1)
+ shouldTick = shouldTickBlocksAtLastResult == 1;
+ else {
+ shouldTick = this.shouldTickBlocksAt(chunkPos);
+ shouldTickBlocksAtLastResult = shouldTick ? 1 : 0;
+ shouldTickBlocksAtChunkPos = chunkPos;
+ }
+
+ if (shouldTick) {
+ tickingblockentity.tick();
+ // Paper start - execute chunk tasks during tick
+ if ((this.tileTickPosition & 7) == 0) {
+ MinecraftServer.getServer().executeMidTickTasks();
+ }
+ // Paper end - execute chunk tasks during tick
}
- // Paper end - execute chunk tasks during tick
}
+ // Plazma end - Port SparklyPaper patches; Optimize tickingBlockEntities
}
this.blockEntityTickers.removeAll(toRemove); // Paper - Fix MC-117075
diff --git a/src/main/java/net/minecraft/world/level/block/CropBlock.java b/src/main/java/net/minecraft/world/level/block/CropBlock.java
index 5a190834baef60c7b61074393f8856a933902d81..366ae05a060b5b12b85521a4b8aed1907f3f044a 100644
--- a/src/main/java/net/minecraft/world/level/block/CropBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/CropBlock.java
@@ -77,35 +77,57 @@ public class CropBlock extends BushBlock implements BonemealableBlock {
@Override
protected void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
- if (world.getRawBrightness(pos, 0) >= 9) {
- int i = this.getAge(state);
-
- if (i < this.getMaxAge()) {
- float f = CropBlock.getGrowthSpeed(this, world, pos);
-
- // Spigot start
- int modifier;
- if (this == Blocks.BEETROOTS) {
- modifier = world.spigotConfig.beetrootModifier;
- } else if (this == Blocks.CARROTS) {
- modifier = world.spigotConfig.carrotModifier;
- } else if (this == Blocks.POTATOES) {
- modifier = world.spigotConfig.potatoModifier;
- // Paper start - Fix Spigot growth modifiers
- } else if (this == Blocks.TORCHFLOWER_CROP) {
- modifier = world.spigotConfig.torchFlowerModifier;
- // Paper end - Fix Spigot growth modifiers
- } else {
- modifier = world.spigotConfig.wheatModifier;
- }
+ // Plazma start - Port SparklyPaper patches; Optimize Farm checks
+ if (world.getRawBrightness(pos, 0) < 9) return;
+
+ int age = this.getAge(state);
+ if (age >= this.getMaxAge()) return;
+
+ final int modifier;
+ if (this == Blocks.BEETROOTS) {
+ modifier = world.spigotConfig.beetrootModifier;
+ } else if (this == Blocks.CARROTS) {
+ modifier = world.spigotConfig.carrotModifier;
+ } else if (this == Blocks.POTATOES) {
+ modifier = world.spigotConfig.potatoModifier;
+ } else if (this == Blocks.TORCHFLOWER_CROP) {
+ modifier = world.spigotConfig.torchFlowerModifier;
+ } else {
+ modifier = world.spigotConfig.wheatModifier;
+ }
- if (random.nextFloat() < (modifier / (100.0f * (Math.floor((25.0F / f) + 1))))) { // Spigot - SPIGOT-7159: Better modifier resolution
- // Spigot end
- CraftEventFactory.handleBlockGrowEvent(world, pos, this.getStateForAge(i + 1), 2); // CraftBukkit
- }
+ if (world.plazmaConfig().block.optimizeFarmCheck.enabled) {
+ BlockPos current = pos.below();
+ BlockState currentState = world.getBlockState(current);
+
+ boolean moist;
+ float growthSpeed;
+ if (currentState.is(Blocks.FARMLAND) && currentState.getValue(FarmBlock.MOISTURE) > 0) {
+ moist = true;
+ growthSpeed = world.plazmaConfig().block.optimizeFarmCheck.growthSpeed.moist;
+ } else {
+ moist = false;
+ growthSpeed = world.plazmaConfig().block.optimizeFarmCheck.growthSpeed.normal;
}
+
+ if (world.plazmaConfig().block.optimizeFarmCheck.skipMiddleAgingStageForCrops) {
+ growthSpeed = growthSpeed / getMaxAge();
+ age = getMaxAge() - 1;
+ }
+
+ if (random.nextFloat() >= (modifier / (100.0f * Math.floor((25.0F / growthSpeed) + 1)))) return;
+ if (!CraftEventFactory.handleBlockGrowEvent(world, pos, this.getStateForAge(age + 1), 2)) return;
+ if (!moist || age + 1 != this.getMaxAge() || FarmBlock.isNearWater(world, current)) return;
+
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleMoistureChangeEvent(world, current, currentState.setValue(FarmBlock.MOISTURE, 0), 2);
+ return;
}
+ float growthSpeed = CropBlock.getGrowthSpeed(this, world, pos);
+
+ if (random.nextFloat() < (modifier / (100.0f * Math.floor((25.0F / growthSpeed) + 1))))
+ CraftEventFactory.handleBlockGrowEvent(world, pos, this.getStateForAge(age + 1), 2);
+ // Plazma end - Port SparklyPaper patches; Optimize Farm checks
}
public void growCrops(Level world, BlockPos pos, BlockState state) {
diff --git a/src/main/java/net/minecraft/world/level/block/FarmBlock.java b/src/main/java/net/minecraft/world/level/block/FarmBlock.java
index d0ec0722496ed931b48c4e7076fddbb1ed36e111..b91afbc90c138ebb7f8722934f59f953642196c9 100644
--- a/src/main/java/net/minecraft/world/level/block/FarmBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/FarmBlock.java
@@ -92,7 +92,19 @@ public class FarmBlock extends Block {
@Override
protected void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
- int i = (Integer) state.getValue(FarmBlock.MOISTURE);
+ // Plazma start - Port SparklyPaper patches; Optimize Farm checks
+ int i = state.getValue(FarmBlock.MOISTURE);
+ if (world.plazmaConfig().block.optimizeFarmCheck.enabled) {
+ if (i != 0) return;
+
+ if (isNearWater(world, pos))
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleMoistureChangeEvent(world, pos, state.setValue(MOISTURE, 7), 2);
+ else
+ turnToDirt(null, state, world, pos);
+
+ return;
+ }
+ // Plazma end - Port SparklyPaper patches; Optimize Farm checks
if (i > 0 && world.paperConfig().tickRates.wetFarmland != 1 && (world.paperConfig().tickRates.wetFarmland < 1 || (net.minecraft.server.MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig().tickRates.wetFarmland != 0)) { return; } // Paper - Configurable random tick rates for blocks
if (i == 0 && world.paperConfig().tickRates.dryFarmland != 1 && (world.paperConfig().tickRates.dryFarmland < 1 || (net.minecraft.server.MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig().tickRates.dryFarmland != 0)) { return; } // Paper - Configurable random tick rates for blocks
@@ -167,7 +179,7 @@ public class FarmBlock extends Block {
return world.getBlockState(pos.above()).is(BlockTags.MAINTAINS_FARMLAND);
}
- private static boolean isNearWater(LevelReader world, BlockPos pos) {
+ static boolean isNearWater(LevelReader world, BlockPos pos) { // Plazma - AT (private -> package)
// Paper start - Perf: remove abstract block iteration
int xOff = pos.getX();
int yOff = pos.getY();
diff --git a/src/main/java/net/minecraft/world/level/block/StemBlock.java b/src/main/java/net/minecraft/world/level/block/StemBlock.java
index 924d80eb41d9a71d1e521c40742557251cf51832..4a30e1e6eac4b0e3dc2147a74e73e05fa76f5db2 100644
--- a/src/main/java/net/minecraft/world/level/block/StemBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/StemBlock.java
@@ -72,38 +72,82 @@ public class StemBlock extends BushBlock implements BonemealableBlock {
@Override
protected void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
- if (world.getRawBrightness(pos, 0) >= 9) {
- float f = CropBlock.getGrowthSpeed(this, world, pos);
-
- if (random.nextFloat() < ((this == Blocks.PUMPKIN_STEM ? world.spigotConfig.pumpkinModifier : world.spigotConfig.melonModifier) / (100.0f * (Math.floor((25.0F / f) + 1))))) { // Spigot - SPIGOT-7159: Better modifier resolution
- int i = (Integer) state.getValue(StemBlock.AGE);
-
- if (i < 7) {
- state = (BlockState) state.setValue(StemBlock.AGE, i + 1);
- CraftEventFactory.handleBlockGrowEvent(world, pos, state, 2); // CraftBukkit
- } else {
- Direction enumdirection = Direction.Plane.HORIZONTAL.getRandomDirection(random);
- BlockPos blockposition1 = pos.relative(enumdirection);
- BlockState iblockdata1 = world.getBlockState(blockposition1.below());
-
- if (world.getBlockState(blockposition1).isAir() && (iblockdata1.is(Blocks.FARMLAND) || iblockdata1.is(BlockTags.DIRT))) {
- Registry<Block> iregistry = world.registryAccess().registryOrThrow(Registries.BLOCK);
- Optional<Block> optional = iregistry.getOptional(this.fruit);
- Optional<Block> optional1 = iregistry.getOptional(this.attachedStem);
-
- if (optional.isPresent() && optional1.isPresent()) {
- // CraftBukkit start
- if (!CraftEventFactory.handleBlockGrowEvent(world, blockposition1, ((Block) optional.get()).defaultBlockState())) {
- return;
- }
- // CraftBukkit end
- world.setBlockAndUpdate(pos, (BlockState) ((Block) optional1.get()).defaultBlockState().setValue(HorizontalDirectionalBlock.FACING, enumdirection));
- }
- }
- }
+ // Plazma start - Port SparklyPaper patches; Optimize Farm checks
+ if (world.getRawBrightness(pos, 0) < 9) return;
+
+ int modifier = this == Blocks.PUMPKIN_STEM ? world.spigotConfig.pumpkinModifier : world.spigotConfig.melonModifier;
+
+ if (world.plazmaConfig().block.optimizeFarmCheck.enabled) {
+ final BlockPos current = pos.below();
+ final BlockState currentState = world.getBlockState(current);
+
+ final boolean moist;
+ final float growthSpeed;
+ if (currentState.is(Blocks.FARMLAND) && currentState.getValue(FarmBlock.MOISTURE) > 0) {
+ moist = true;
+ growthSpeed = world.plazmaConfig().block.optimizeFarmCheck.growthSpeed.moist;
+ } else {
+ moist = false;
+ growthSpeed = world.plazmaConfig().block.optimizeFarmCheck.growthSpeed.normal;
}
+ if (random.nextFloat() >= (modifier / (100.0f * Math.floor((25.0F / growthSpeed) + 1)))) return;
+
+ int age = state.getValue(AGE);
+
+ if (age < 7) {
+ CraftEventFactory.handleMoistureChangeEvent(world, pos, state.setValue(AGE, age + 1), 2);
+ return;
+ }
+
+ Direction direction = Direction.Plane.HORIZONTAL.getRandomDirection(random);
+ BlockPos pos1 = pos.relative(direction);
+ BlockState state1 = world.getBlockState(pos1.below());
+
+ if (!world.getBlockState(pos1).isAir() || (!state1.is(Blocks.FARMLAND) && !state1.is(BlockTags.DIRT)))
+ return;
+
+ Registry<Block> registry = world.registryAccess().registryOrThrow(Registries.BLOCK);
+ Optional<Block> fruit = registry.getOptional(this.fruit);
+ Optional<Block> stem = registry.getOptional(this.attachedStem);
+
+ if (fruit.isEmpty() || stem.isEmpty()) return;
+ if (!CraftEventFactory.handleBlockGrowEvent(world, pos1, fruit.get().defaultBlockState())) return;
+ if (moist && !FarmBlock.isNearWater(world, current))
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleMoistureChangeEvent(world, current, currentState.setValue(FarmBlock.MOISTURE, 0), 2);
+
+ world.setBlockAndUpdate(pos, stem.get().defaultBlockState().setValue(HorizontalDirectionalBlock.FACING, direction));
+ return;
}
+
+ float f = CropBlock.getGrowthSpeed(this, world, pos);
+
+ if (random.nextFloat() >= (modifier / (100.0f * Math.floor((25.0F / f) + 1)))) return;
+
+ int age = state.getValue(StemBlock.AGE);
+
+ if (age < 7) {
+ CraftEventFactory.handleBlockGrowEvent(world, pos, state.setValue(StemBlock.AGE, age + 1), 2);
+ return;
+ }
+
+ Direction direction = Direction.Plane.HORIZONTAL.getRandomDirection(random);
+ BlockPos pos1 = pos.relative(direction);
+ BlockState state1 = world.getBlockState(pos1.below());
+
+ if (!world.getBlockState(pos1).isAir() || (!state1.is(Blocks.FARMLAND) && !state1.is(BlockTags.DIRT))) return;
+
+ Registry<Block> registry = world.registryAccess().registryOrThrow(Registries.BLOCK);
+ Optional<Block> fruit = registry.getOptional(this.fruit);
+ Optional<Block> stem = registry.getOptional(this.attachedStem);
+
+ if (fruit.isEmpty() || stem.isEmpty()) return;
+
+ if (!CraftEventFactory.handleBlockGrowEvent(world, pos1, fruit.get().defaultBlockState()))
+ return;
+
+ world.setBlockAndUpdate(pos, stem.get().defaultBlockState().setValue(HorizontalDirectionalBlock.FACING, direction));
+ // Plazma end - Port SparklyPaper patches; Optimize Farm checks
}
@Override
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TickingBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TickingBlockEntity.java
index 28e3b73507b988f7234cbf29c4024c88180d0aef..6239c171ca996f3f5c23060f728a62236bc8b6d5 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/TickingBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/TickingBlockEntity.java
@@ -10,4 +10,6 @@ public interface TickingBlockEntity {
BlockPos getPos();
String getType();
+
+ long getChunkCoordinateKey(); // Plazma - Port SparklyPaper patches; Optimize tickingBlockEntities
}
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
index 1aac95b03a9e2e37c24f2a30bcb259c1424e1c78..e7c0c36fd3455c0536e98259b46dbcc952d90e01 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
@@ -66,6 +66,7 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom
protected volatile boolean unsaved;
private volatile boolean isLightCorrect;
protected final ChunkPos chunkPos; public final long coordinateKey; public final int locX; public final int locZ; // Paper - cache coordinate key
+ public final long nearbyPlayersCoordinateKey; // Plazma - Port SparklyPaper patches; Cache coordinate key used for nearby players when ticking chunks
private long inhabitedTime;
/** @deprecated */
@Nullable
@@ -140,6 +141,7 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom
// Paper end - rewrite light engine
this.locX = pos.x; this.locZ = pos.z; // Paper - reduce need for field lookups
this.chunkPos = pos; this.coordinateKey = ChunkPos.asLong(locX, locZ); // Paper - cache long key
+ this.nearbyPlayersCoordinateKey = io.papermc.paper.util.CoordinateUtils.getChunkKey(locX, locZ); // Plazma - Port SparklyPaper patches; Cache coordinate key used for nearby players when ticking chunks
this.upgradeData = upgradeData;
this.levelHeightAccessor = heightLimitView;
this.sections = new LevelChunkSection[heightLimitView.getSectionsCount()];
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index ab4dd0c8b4b17ff1b54c06b72dc8b3caba430fe2..e026dc9ed15284f55cdd4bc99c0718aba6d2e8c6 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -75,6 +75,8 @@ public class LevelChunk extends ChunkAccess {
public String getType() {
return "<null>";
}
+
+ @Override public long getChunkCoordinateKey() { return 0; } // Plazma - Port SparklyPaper patches; Optimize tickingBlockEntities
};
private final Map<BlockPos, LevelChunk.RebindableTickingBlockEntityWrapper> tickersInLevel;
public boolean loaded;
@@ -1101,7 +1103,7 @@ public class LevelChunk extends ChunkAccess {
}
private <T extends BlockEntity> TickingBlockEntity createTicker(T blockEntity, BlockEntityTicker<T> blockEntityTicker) {
- return new LevelChunk.BoundTickingBlockEntity<>(blockEntity, blockEntityTicker);
+ return new LevelChunk.BoundTickingBlockEntity<>(blockEntity, blockEntityTicker, this.coordinateKey); // Plazma - Port SparklyPaper patches; Optimize TickingBlockEntity
}
@FunctionalInterface
@@ -1152,17 +1154,21 @@ public class LevelChunk extends ChunkAccess {
public String toString() {
return String.valueOf(this.ticker) + " <wrapped>";
}
+
+ @Override public long getChunkCoordinateKey() { return this.ticker.getChunkCoordinateKey(); } // Plazma - Port SparklyPaper patches; Optimize TickingBlockEntity
}
private class BoundTickingBlockEntity<T extends BlockEntity> implements TickingBlockEntity {
+ private final long chunkCoordinateKey; // Plazma - Port SparklyPaper patches; Optimize TickingBlockEntity
private final T blockEntity;
private final BlockEntityTicker<T> ticker;
private boolean loggedInvalidBlockState;
- BoundTickingBlockEntity(final BlockEntity tileentity, final BlockEntityTicker blockentityticker) {
+ BoundTickingBlockEntity(final BlockEntity tileentity, final BlockEntityTicker blockentityticker, long chunkCoordinateKey) {
this.blockEntity = (T) tileentity; // CraftBukkit - decompile error
this.ticker = blockentityticker;
+ this.chunkCoordinateKey = chunkCoordinateKey;
}
@Override
@@ -1230,5 +1236,7 @@ public class LevelChunk extends ChunkAccess {
return "Level ticker for " + s + "@" + String.valueOf(this.getPos());
}
+
+ @Override public long getChunkCoordinateKey() { return this.chunkCoordinateKey; } // Plazma - Port SparklyPaper patches; Optimize TickingBlockEntity
}
}
diff --git a/src/main/java/net/sparklypower/sparklypaper/HalloweenManager.java b/src/main/java/net/sparklypower/sparklypaper/HalloweenManager.java
new file mode 100644
index 0000000000000000000000000000000000000000..f8c26e26025d7a7b5489ed5b3274ba734db27a1d
--- /dev/null
+++ b/src/main/java/net/sparklypower/sparklypaper/HalloweenManager.java
@@ -0,0 +1,78 @@
+package net.sparklypower.sparklypaper;
+
+import com.mojang.logging.LogUtils;
+import it.unimi.dsi.fastutil.Pair;
+import net.minecraft.world.level.Level;
+import org.slf4j.Logger;
+import java.time.LocalDateTime;
+import java.time.Month;
+import java.time.ZoneOffset;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ScheduledFuture;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import static org.plazmamc.plazma.configurations.GlobalConfiguration.get;
+
+public class HalloweenManager {
+
+ private static final Logger LOGGER = LogUtils.getClassLogger();
+ private static final ScheduledExecutorService EXECUTOR = Executors.newSingleThreadScheduledExecutor(factory -> {
+ Thread thread = new Thread(factory);
+ thread.setName("halloween-timer-updater");
+ thread.setPriority(1);
+ return thread;
+ });
+
+ private static ScheduledFuture<?> future;
+ private static Pair<Long, Long> spookyEpoch;
+ private static Pair<Long, Long> halloweenEpoch;
+
+ private static long getEpochMillisAtDate(Month month, int day, boolean start) {
+ LocalDateTime now = LocalDateTime.now();
+ LocalDateTime target = LocalDateTime.of(
+ now.getYear(), month, day, start ? 0 : 23, start ? 0 : 59, start ? 0 : 59, start ? 0 : 999_999_999
+ );
+
+ if (now.isAfter(target)) target = target.plusYears(1);
+ return target.atZone(ZoneOffset.systemDefault()).toInstant().toEpochMilli();
+ }
+
+ private static void syncEpoch() {
+ LOGGER.info("Updating Spooky Season and Halloween epoch...");
+ spookyEpoch = Pair.of(
+ getEpochMillisAtDate(Month.OCTOBER, 20, true),
+ getEpochMillisAtDate(Month.NOVEMBER, 3, false)
+ );
+ halloweenEpoch = Pair.of(
+ getEpochMillisAtDate(Month.OCTOBER, 31, true),
+ getEpochMillisAtDate(Month.OCTOBER, 31, false)
+ );
+ LOGGER.info("Successfully updated Spooky Season and Halloween epoch");
+ }
+
+ public static void syncConfiguration() {
+ if (get().entity.spookyOptimize && future == null) {
+ startSyncEpochTask();
+ } else if (!get().entity.spookyOptimize && future != null) {
+ future.cancel(true);
+ future = null;
+ }
+ }
+
+ public static void startSyncEpochTask() {
+ if (!get().entity.spookyOptimize) return;
+ future = EXECUTOR.scheduleAtFixedRate(HalloweenManager::syncEpoch, 0, 90, TimeUnit.DAYS);
+ }
+
+ public static boolean isSpookySeason() {
+ return spookyEpoch.first() <= System.currentTimeMillis() && System.currentTimeMillis() <= spookyEpoch.second();
+ }
+
+ public static boolean isHalloween() {
+ return halloweenEpoch.first() <= System.currentTimeMillis() && System.currentTimeMillis() <= halloweenEpoch.second();
+ }
+
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 241340a6d66f17f2a31fb03ff0dfab121b856368..a6cf73d104e66971a61ac979d4a6d58a97478613 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -976,7 +976,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
public void sendMultiBlockChange(final Map<? extends io.papermc.paper.math.Position, BlockData> blockChanges) {
if (this.getHandle().connection == null) return;
- Map<SectionPos, it.unimi.dsi.fastutil.shorts.Short2ObjectMap<net.minecraft.world.level.block.state.BlockState>> sectionMap = new HashMap<>();
+ Map<SectionPos, it.unimi.dsi.fastutil.shorts.Short2ObjectMap<net.minecraft.world.level.block.state.BlockState>> sectionMap = new it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap<>(); // Plazma - Port SparklyPaper patches; Optimize canSee checks
for (Map.Entry<? extends io.papermc.paper.math.Position, BlockData> entry : blockChanges.entrySet()) {
BlockData blockData = entry.getValue();
@@ -2237,9 +2237,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public boolean canSee(org.bukkit.entity.Entity entity) {
- return this.equals(entity) || entity.isVisibleByDefault() ^ this.invertedVisibilityEntities.containsKey(entity.getUniqueId()); // SPIGOT-7312: Can always see self
+ return this.equals(entity) || this.chunkMapCanSee(entity); // SPIGOT-7312: Can always see self // Plazma - Port SparklyPaper patches; Optimize canSee check
}
+ // Plazma start - Port SparklyPaper patches; Optimize canSee check (The check in ChunkMap#updatePlayer already rejects if it is the same entity, so we don't need to check it twice, especially because CraftPlayer's equals check is a bit expensive)
+ public boolean chunkMapCanSee(org.bukkit.entity.Entity entity) {
+ return entity.isVisibleByDefault() ^ (!invertedVisibilityEntities.isEmpty() && this.invertedVisibilityEntities.containsKey(entity.getUniqueId()));
+ }
+ // Plazma end - Port SparklyPaper patches; Optimize canSee check
+
public boolean canSeePlayer(UUID uuid) {
org.bukkit.entity.Entity entity = this.getServer().getPlayer(uuid);
diff --git a/src/main/java/org/bukkit/craftbukkit/map/CraftMapColorCache.java b/src/main/java/org/bukkit/craftbukkit/map/CraftMapColorCache.java
index 8149b9c51b78eb5c689b7218a2ca3aab60e73bcf..b9a303f6280a2f6ad3616da152922a4f4a504281 100644
--- a/src/main/java/org/bukkit/craftbukkit/map/CraftMapColorCache.java
+++ b/src/main/java/org/bukkit/craftbukkit/map/CraftMapColorCache.java
@@ -145,7 +145,7 @@ public class CraftMapColorCache implements MapPalette.MapColorCache {
}
@Override
- public boolean isCached() {
+ public synchronized boolean isCached() { // Plazma - Fix concurrency issues when using "imageToBytes" in multiple threads
return this.cached || (!this.running.get() && this.initCache().isDone());
}
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
index 57d29f8f3bc89529db9ee8f6dc3fffdbd4a03ceb..73dd69941a004b4a2ec244f28d8683e9bdb0a445 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
@@ -40,9 +40,12 @@ public class GlobalConfiguration extends ConfigurationPart {
public Entity entity;
public class Entity extends ConfigurationPart {
+ boolean skipSqrWhenNoDeltaChanges = OPTIMIZE;
+ public boolean spookyOptimize = OPTIMIZE;
@PostProcess
public void post() {
+ net.minecraft.server.level.ServerEntity.skipSqrWhenNoDeltaChanges = this.skipSqrWhenNoDeltaChanges;
}
}
@@ -50,9 +53,11 @@ public class GlobalConfiguration extends ConfigurationPart {
public World world;
public class World extends ConfigurationPart {
+ boolean skipTickWhenCraftNotPresent = OPTIMIZE;
@PostProcess
public void post() {
+ net.minecraft.world.item.MapItem.skipTickWhenCraftNotPresent = this.skipTickWhenCraftNotPresent;
}
}
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
index 8dce68cf7769fcd5ea03be32621ccb6bab174697..069a9f8504c74d939b1df569f082cc7bd33d9cfc 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
@@ -49,7 +49,22 @@ public class WorldConfigurations extends ConfigurationPart {
public Block block;
public class Block extends ConfigurationPart {
-
+
+ public OptimizeFarmCheck optimizeFarmCheck;
+ public class OptimizeFarmCheck extends ConfigurationPart {
+
+ public boolean enabled = OPTIMIZE;
+ public boolean skipMiddleAgingStageForCrops = true;
+
+ public GrowthSpeed growthSpeed;
+ public class GrowthSpeed extends ConfigurationPart {
+
+ public int normal = 1;
+ public int moist = 4;
+
+ }
+
+ }
}

View File

@@ -5,21 +5,27 @@ Subject: [PATCH] Setup basic configuration sections
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
index d8006ae086c18a4ef43906d516eba0d5fd397f5f..57d29f8f3bc89529db9ee8f6dc3fffdbd4a03ceb 100644
index b638690d5cd2360444e6c525f97f634d8e1dc60e..35d5bd2f7dba1aa74547b6ae994bc84a56911bf2 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
@@ -3,6 +3,7 @@ package org.plazmamc.plazma.configurations;
import io.papermc.paper.configuration.Configuration;
import io.papermc.paper.configuration.ConfigurationPart;
@@ -6,6 +6,7 @@ import it.unimi.dsi.fastutil.objects.Reference2ObjectMap;
import it.unimi.dsi.fastutil.objects.Reference2ObjectOpenHashMap;
import net.minecraft.Util;
import org.jetbrains.annotations.NotNull;
+import org.spongepowered.configurate.objectmapping.meta.PostProcess;
import org.spongepowered.configurate.objectmapping.meta.Setting;
import java.util.List;
@SuppressWarnings({"CanBeFinal", "FieldCanBeLocal", "FieldMayBeFinal", "InnerClassMayBeStatic"})
@@ -23,4 +24,43 @@ public class GlobalConfiguration extends ConfigurationPart {
@@ -27,4 +28,55 @@ public class GlobalConfiguration extends ConfigurationPart {
@Setting(Configuration.VERSION_FIELD)
int version = VERSION;
+ public Command command;
+ public class Command extends ConfigurationPart {
+
+
+ }
+
+ public Player player;
+ public class Player extends ConfigurationPart {
+
@@ -53,6 +59,12 @@ index d8006ae086c18a4ef43906d516eba0d5fd397f5f..57d29f8f3bc89529db9ee8f6dc3fffdb
+
+ }
+
+ public Structure structure;
+ public class Structure extends ConfigurationPart {
+
+
+ }
+
+ public Miscellaneous misc;
+ public class Miscellaneous extends ConfigurationPart {
+
@@ -60,11 +72,28 @@ index d8006ae086c18a4ef43906d516eba0d5fd397f5f..57d29f8f3bc89529db9ee8f6dc3fffdb
+ }
+
}
diff --git a/src/main/java/org/plazmamc/plazma/configurations/RemovedConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/RemovedConfigurations.java
index 25c0f5d28107b45677aa7b19bc0d5238512d9826..ac0f038de0ce5cf6df0b730af69d3229c3119eff 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/RemovedConfigurations.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/RemovedConfigurations.java
@@ -2,9 +2,12 @@ package org.plazmamc.plazma.configurations;
import org.spongepowered.configurate.NodePath;
+import static org.spongepowered.configurate.NodePath.path;
+
interface RemovedConfigurations {
NodePath[] WORLD_PATHS = {
+ path("structure", "nether-portal")
};
NodePath[] GLOBAL_PATHS = {
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
index f2d3d51cb4b8fc7a5fd6db1a63289fff6d32a1ea..8dce68cf7769fcd5ea03be32621ccb6bab174697 100644
index f2d3d51cb4b8fc7a5fd6db1a63289fff6d32a1ea..c222d58520b655b54b8975ec226a4ba948691cd4 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
@@ -19,4 +19,38 @@ public class WorldConfigurations extends ConfigurationPart {
@@ -19,4 +19,44 @@ public class WorldConfigurations extends ConfigurationPart {
@Setting(Configuration.VERSION_FIELD)
int version = VERSION;
@@ -101,5 +130,11 @@ index f2d3d51cb4b8fc7a5fd6db1a63289fff6d32a1ea..8dce68cf7769fcd5ea03be32621ccb6b
+
+
+ }
+
+ public Item item;
+ public class Item extends ConfigurationPart {
+
+
+ }
+
}

View File

@@ -1,18 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Sun, 5 Nov 2023 10:13:14 +0900
Subject: [PATCH] Always agree EULA on development mode
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index 4911a6d25d12eb9d2b263aeb9b7f521ff828397a..29eef278940cab33a1f5f168f66ab2b80f0d60ce 100644
--- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java
@@ -166,6 +166,7 @@ public class Main {
// Spigot Start
boolean eulaAgreed = Boolean.getBoolean( "com.mojang.eula.agree" );
+ eulaAgreed = eulaAgreed || Boolean.getBoolean("Paper.pushPaperAssetsRoot"); // Plazma - Always agree EULA on development mode
if ( eulaAgreed )
{
System.err.println( "You have used the Spigot command line EULA agreement flag." );

View File

@@ -5,19 +5,19 @@ Subject: [PATCH] Warn on startup
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index 4911a6d25d12eb9d2b263aeb9b7f521ff828397a..57deffa2f3d2f0074512440e668c71afb38510d4 100644
index 8f77566bef4b992013e3b65068cabe7ee1921951..65fd553887ed9eb9c26e036c8009179a7baf5380 100644
--- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java
@@ -112,6 +112,18 @@ public class Main {
@@ -113,6 +113,18 @@ public class Main {
if (io.papermc.paper.ServerBrandConstants.ASCII_LOGO != null)
System.out.println(io.papermc.paper.ServerBrandConstants.ASCII_LOGO);
// Plazma end - Fork-friendly Rebranding
+ // Plazma start - Warn on startup
+ if (!org.plazmamc.plazma.Options.NO_WARN) {
+ LOGGER.warn("Warning! " + io.papermc.paper.ServerBuildInfo.buildInfo().brandName() + " may cause unexpected problems, so be sure to test it thoroughly before using it on a public server.");
+ LOGGER.warn("Warning! " + io.papermc.paper.ServerBrandConstants.BRAND_NAME + " may cause unexpected problems, so be sure to test it thoroughly before using it on a public server.");
+ if (io.papermc.paper.ServerBuildInfo.buildInfo().asString(io.papermc.paper.ServerBuildInfo.StringRepresentation.VERSION_FULL).contains("DEV")) {
+ LOGGER.error("*********************** CAUTION ***********************");
+ LOGGER.error("This version is a development version of {}.", io.papermc.paper.ServerBuildInfo.buildInfo().brandName());
+ LOGGER.error("This version is a development version of {}.", io.papermc.paper.ServerBrandConstants.BRAND_NAME);
+ LOGGER.error("Nobody knows what kind of problem you're going to have, and there's always the possibility of unexpected problems.");
+ LOGGER.error("Never use this version on a public server, and after you've tested it enough before using it!");
+ LOGGER.error("*******************************************************");
@@ -28,10 +28,10 @@ index 4911a6d25d12eb9d2b263aeb9b7f521ff828397a..57deffa2f3d2f0074512440e668c71af
Path path = (Path) optionset.valueOf("pidFile"); // CraftBukkit
diff --git a/src/main/java/org/plazmamc/plazma/Options.java b/src/main/java/org/plazmamc/plazma/Options.java
index 5942d0997f07bd51d934dac32cd349792a10643e..b02a0dddd99df1691c125660828a61cc4a5a4d02 100644
index ca11bd22a65c8b9f4fffb1832ada8c519ab75b98..5d41bd4d4b86ca0c7c03d3ac6e75b3f1f1abe73b 100644
--- a/src/main/java/org/plazmamc/plazma/Options.java
+++ b/src/main/java/org/plazmamc/plazma/Options.java
@@ -5,5 +5,6 @@ import static java.lang.Boolean.getBoolean;
@@ -6,5 +6,6 @@ import static java.lang.System.getProperty;
public interface Options {
boolean NO_OPTIMIZE = getBoolean("Plazma.disableConfigOptimization");

View File

@@ -0,0 +1,31 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Sun, 5 Nov 2023 10:13:14 +0900
Subject: [PATCH] Always agree EULA on development mode
diff --git a/build.gradle.kts b/build.gradle.kts
index 41005f58fdd526907972185e728bbe1fa97171e9..746ad8087192931400256c8a1ef71e966eaf6b1a 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -164,7 +164,7 @@ fun TaskContainer.registerRunTask(
languageVersion.set(JavaLanguageVersion.of(21))
vendor.set(JvmVendorSpec.JETBRAINS)
})
- jvmArgs("-XX:+AllowEnhancedClassRedefinition", "-XX:+AllowRedefinitionToAddDeleteMethods")
+ jvmArgs("-DPlazma.DevelopmentEnvironment", "-XX:+AllowEnhancedClassRedefinition", "-XX:+AllowRedefinitionToAddDeleteMethods") // Plazma - Always agree EULA on development mode
if (rootProject.childProjects["test-plugin"] != null) {
val testPluginJar = rootProject.project(":test-plugin").tasks.jar.flatMap { it.archiveFile }
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index 65fd553887ed9eb9c26e036c8009179a7baf5380..694b126df2c3d1d6fa40ee9731c28886caf1a4fc 100644
--- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java
@@ -179,6 +179,7 @@ public class Main {
// Spigot Start
boolean eulaAgreed = Boolean.getBoolean( "com.mojang.eula.agree" );
+ eulaAgreed = eulaAgreed || Boolean.getBoolean("Paper.pushPaperAssetsRoot"); // Plazma - Always agree EULA on development mode
if ( eulaAgreed )
{
System.err.println( "You have used the Spigot command line EULA agreement flag." );

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Add more metrics
diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java
index 81b204c03b3c9a997f00fd423daa963757cb0daf..67e299893b7e1a64ab2962d79c2434dad189eed5 100644
index 8d5a52c5762c3d9b44dcdf00ae312e0bdc01fa1f..48d33d4131af90eee35c9553898a2ac7ec5e2b7e 100644
--- a/src/main/java/com/destroystokyo/paper/Metrics.java
+++ b/src/main/java/com/destroystokyo/paper/Metrics.java
@@ -636,38 +636,59 @@ public class Metrics {

View File

@@ -9,10 +9,10 @@ Subject: [PATCH] Optimize default configurations
- YouHaveTrouble/minecraft-exploits-and-how-to-fix-them
diff --git a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
index cba3d725245223c5d9e8e59dcceec61f0acc1b85..63af4c9e2bc662e08ebf858d84933b3e4e3b92cb 100644
index 411c81a88b8a008b2aaf0ca62fb7ffa1dd9e32a4..53dc2e3c22c5cb038b9a283112f265d362f187e3 100644
--- a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
+++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
@@ -72,7 +72,7 @@ public class PufferfishConfig {
@@ -61,7 +61,7 @@ public class PufferfishConfig {
getString("info.version", "1.0");
setComment("info",
"Pufferfish Configuration",
@@ -21,56 +21,35 @@ index cba3d725245223c5d9e8e59dcceec61f0acc1b85..63af4c9e2bc662e08ebf858d84933b3e
"Join our Discord for support: https://discord.gg/reZw4vQV9H",
"Download new builds at https://ci.pufferfish.host/job/Pufferfish");
@@ -227,7 +227,7 @@ public class PufferfishConfig {
@@ -216,7 +216,7 @@ public class PufferfishConfig {
public static int maxProjectileLoadsPerTick;
public static int maxProjectileLoadsPerProjectile;
private static void projectileLoading() {
- maxProjectileLoadsPerTick = getInt("projectile.max-loads-per-tick", 10, "Controls how many chunks are allowed", "to be sync loaded by projectiles in a tick.");
+ maxProjectileLoadsPerTick = getInt("projectile.max-loads-per-tick", org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 8 : 10, "Controls how many chunks are allowed", "to be sync loaded by projectiles in a tick.");
+ maxProjectileLoadsPerTick = getInt("projectile.max-loads-per-tick", plazma.Config.optimize() ? 8 : 10, "Controls how many chunks are allowed", "to be sync loaded by projectiles in a tick."); // Plazma - Optimize default configurations
maxProjectileLoadsPerProjectile = getInt("projectile.max-loads-per-projectile", 10, "Controls how many chunks a projectile", "can load in its lifetime before it gets", "automatically removed.");
setComment("projectile", "Optimizes projectile settings");
@@ -241,12 +241,12 @@ public class PufferfishConfig {
@@ -230,12 +230,12 @@ public class PufferfishConfig {
public static int activationDistanceMod;
private static void dynamicActivationOfBrains() throws IOException {
- dearEnabled = getBoolean("dab.enabled", "activation-range.enabled", false); // Purpur
+ dearEnabled = getBoolean("dab.enabled", "activation-range.enabled", org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize()); // Purpur
+ dearEnabled = getBoolean("dab.enabled", "activation-range.enabled", plazma.Config.optimize()); // Purpur // Plazma - Optimize default configurations
startDistance = getInt("dab.start-distance", "activation-range.start-distance", 12,
"This value determines how far away an entity has to be",
"from the player to start being effected by DEAR.");
startDistanceSquared = startDistance * startDistance;
- maximumActivationPrio = getInt("dab.max-tick-freq", "activation-range.max-tick-freq", 20,
+ maximumActivationPrio = getInt("dab.max-tick-freq", "activation-range.max-tick-freq", org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 7 : 8,
+ maximumActivationPrio = getInt("dab.max-tick-freq", "activation-range.max-tick-freq", plazma.Config.optimize() ? 7 : 8, // Plazma - Optimize default configurations
"This value defines how often in ticks, the furthest entity",
"will get their pathfinders and behaviors ticked. 20 = 1s");
activationDistanceMod = getInt("dab.activation-dist-mod", "activation-range.activation-dist-mod", 8,
@@ -269,8 +269,18 @@ public class PufferfishConfig {
public static Map<String, Integer> projectileTimeouts;
private static void projectileTimeouts() {
// Set some defaults
- getInt("entity_timeouts.SNOWBALL", -1);
- getInt("entity_timeouts.LLAMA_SPIT", -1);
+ // Plazma start - Optimize default configurations
+ if (org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize()) {
+ getInt("entity_timeouts.ARROW", 200);
+ getInt("entity_timeouts.EGG", 200);
+ getInt("entity_timeouts.ENDER_PEARL", 200);
+ getInt("entity_timeouts.SNOWBALL", 200);
+ getInt("entity_timeouts.LLAMA_SPIT", 200);
+ } else {
+ getInt("entity_timeouts.SNOWBALL", -1);
+ getInt("entity_timeouts.LLAMA_SPIT", -1);
+ }
+ // Plazma end - Optimize default configurations
setComment("entity_timeouts",
"These values define a entity's maximum lifespan. If an",
"entity is in this list and it has survived for longer than",
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
index 32035e37b39ba42232fea948166e7c1d4d06190c..8445a0b25d647b2c1f9a44f849084cdec0842e18 100644
index 17e23ca4dd2bbfba49ea00aa2b719a95feb931be..a8e75eaadfcc6c8b2503776d7de197f756712819 100644
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
@@ -167,7 +167,7 @@ public class GlobalConfiguration extends ConfigurationPart {
@@ -147,7 +147,7 @@ public class GlobalConfiguration extends ConfigurationPart {
public class Watchdog extends ConfigurationPart {
public int earlyWarningEvery = 5000;
@@ -79,7 +58,7 @@ index 32035e37b39ba42232fea948166e7c1d4d06190c..8445a0b25d647b2c1f9a44f849084cde
}
public SpamLimiter spamLimiter;
@@ -207,7 +207,7 @@ public class GlobalConfiguration extends ConfigurationPart {
@@ -187,7 +187,7 @@ public class GlobalConfiguration extends ConfigurationPart {
public Commands commands;
public class Commands extends ConfigurationPart {
@@ -88,16 +67,16 @@ index 32035e37b39ba42232fea948166e7c1d4d06190c..8445a0b25d647b2c1f9a44f849084cde
public boolean fixTargetSelectorTagCompletion = true;
public boolean timeCommandAffectsAllWorlds = false;
}
@@ -256,7 +256,7 @@ public class GlobalConfiguration extends ConfigurationPart {
@@ -253,7 +253,7 @@ public class GlobalConfiguration extends ConfigurationPart {
public BookSize bookSize;
public class BookSize extends ConfigurationPart {
- public int pageMax = 2560; // TODO this appears to be a duplicate setting with one above
+ public int pageMax = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 1024 : 2560; // TODO this appears to be a duplicate setting with one above // Plazma - Optimize default configurations
- public IntOr.Disabled pageMax = new IntOr.Disabled(OptionalInt.of(2560)); // TODO this appears to be a duplicate setting with one above
+ public IntOr.Disabled pageMax = new IntOr.Disabled(OptionalInt.of(org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 1024 : 2560)); // TODO this appears to be a duplicate setting with one above // Plazma - Optimize default configurations
public double totalMultiplier = 0.98D; // TODO this should probably be merged into the above inner class
}
public boolean resolveSelectorsInBooks = false;
@@ -267,7 +267,15 @@ public class GlobalConfiguration extends ConfigurationPart {
@@ -264,7 +264,15 @@ public class GlobalConfiguration extends ConfigurationPart {
public class PacketLimiter extends ConfigurationPart {
public Component kickMessage = Component.translatable("disconnect.exceeded_packet_rate", NamedTextColor.RED);
public PacketLimit allPackets = new PacketLimit(7.0, 500.0, PacketLimit.ViolateAction.KICK);
@@ -114,7 +93,7 @@ index 32035e37b39ba42232fea948166e7c1d4d06190c..8445a0b25d647b2c1f9a44f849084cde
@ConfigSerializable
public record PacketLimit(@Required double interval, @Required double maxPacketRate, ViolateAction action) {
@@ -335,7 +343,7 @@ public class GlobalConfiguration extends ConfigurationPart {
@@ -332,7 +340,7 @@ public class GlobalConfiguration extends ConfigurationPart {
executor.setMaximumPoolSize(_chatExecutorMaxSize);
}
}
@@ -124,10 +103,10 @@ index 32035e37b39ba42232fea948166e7c1d4d06190c..8445a0b25d647b2c1f9a44f849084cde
public boolean loadPermissionsYmlBeforePlugins = true;
@Constraints.Min(4)
diff --git a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
index efc91ff91827872c62b8bd060282549ccdcf67dd..1d926378887b9e42f1827e958f506be3e27d5ab5 100644
index 82210667376fd466d5d4cdcb56b62f6165bd5cde..3c6e9ec236bfd851700ce7fae2599b725ec899eb 100644
--- a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
+++ b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
@@ -96,12 +96,32 @@ public class WorldConfiguration extends ConfigurationPart {
@@ -103,12 +103,32 @@ public class WorldConfiguration extends ConfigurationPart {
public class AntiXray extends ConfigurationPart {
public boolean enabled = false;
@@ -163,7 +142,7 @@ index efc91ff91827872c62b8bd060282549ccdcf67dd..1d926378887b9e42f1827e958f506be3
//<editor-fold desc="Anti-Xray Hidden Blocks" defaultstate="collapsed">
Blocks.COPPER_ORE,
Blocks.DEEPSLATE_COPPER_ORE,
@@ -128,7 +148,28 @@ public class WorldConfiguration extends ConfigurationPart {
@@ -135,7 +155,28 @@ public class WorldConfiguration extends ConfigurationPart {
Blocks.ENDER_CHEST
//</editor-fold>
);
@@ -193,7 +172,7 @@ index efc91ff91827872c62b8bd060282549ccdcf67dd..1d926378887b9e42f1827e958f506be3
}
}
@@ -151,14 +192,14 @@ public class WorldConfiguration extends ConfigurationPart {
@@ -157,14 +198,14 @@ public class WorldConfiguration extends ConfigurationPart {
public ArmorStands armorStands;
public class ArmorStands extends ConfigurationPart {
@@ -211,16 +190,7 @@ index efc91ff91827872c62b8bd060282549ccdcf67dd..1d926378887b9e42f1827e958f506be3
}
public Sniffer sniffer;
@@ -181,7 +222,7 @@ public class WorldConfiguration extends ConfigurationPart {
@MergeMap
public Reference2IntMap<MobCategory> spawnLimits = Util.make(new Reference2IntOpenHashMap<>(NaturalSpawner.SPAWNING_CATEGORIES.length), map -> Arrays.stream(NaturalSpawner.SPAWNING_CATEGORIES).forEach(mobCategory -> map.put(mobCategory, -1)));
@MergeMap
- public Map<MobCategory, DespawnRange> despawnRanges = Arrays.stream(MobCategory.values()).collect(Collectors.toMap(Function.identity(), category -> new DespawnRange(category.getNoDespawnDistance(), category.getDespawnDistance())));
+ public Map<MobCategory, DespawnRange> despawnRanges = Arrays.stream(MobCategory.values()).collect(Collectors.toMap(Function.identity(), category -> new DespawnRange(category.getNoDespawnDistance(), org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? (net.minecraft.server.MinecraftServer.getServer().server.getSimulationDistance() * 16) + 8 : category.getDespawnDistance()))); // Plazma - Optimize default configurations
@MergeMap
public Reference2IntMap<MobCategory> ticksPerSpawn = Util.make(new Reference2IntOpenHashMap<>(NaturalSpawner.SPAWNING_CATEGORIES.length), map -> Arrays.stream(NaturalSpawner.SPAWNING_CATEGORIES).forEach(mobCategory -> map.put(mobCategory, -1)));
@@ -382,7 +423,7 @@ public class WorldConfiguration extends ConfigurationPart {
@@ -415,7 +456,7 @@ public class WorldConfiguration extends ConfigurationPart {
public class Environment extends ConfigurationPart {
public boolean disableThunder = false;
public boolean disableIceAndSnow = false;
@@ -229,16 +199,16 @@ index efc91ff91827872c62b8bd060282549ccdcf67dd..1d926378887b9e42f1827e958f506be3
public boolean disableExplosionKnockback = false;
public boolean generateFlatBedrock = false;
public FrostedIce frostedIce;
@@ -434,7 +475,7 @@ public class WorldConfiguration extends ConfigurationPart {
@@ -471,7 +512,7 @@ public class WorldConfiguration extends ConfigurationPart {
public Fixes fixes;
public class Fixes extends ConfigurationPart {
- public boolean fixItemsMergingThroughWalls = false;
+ public boolean fixItemsMergingThroughWalls = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize(); // Plazma - Optimize default configurations
public boolean disableUnloadedChunkEnderpearlExploit = true;
public boolean disableUnloadedChunkEnderpearlExploit = false;
public boolean preventTntFromMovingInWater = false;
public boolean splitOverstackedLoot = true;
@@ -462,9 +503,9 @@ public class WorldConfiguration extends ConfigurationPart {
@@ -499,9 +540,9 @@ public class WorldConfiguration extends ConfigurationPart {
public class Collisions extends ConfigurationPart {
public boolean onlyPlayersCollide = false;
public boolean allowVehicleCollisions = true;
@@ -250,7 +220,7 @@ index efc91ff91827872c62b8bd060282549ccdcf67dd..1d926378887b9e42f1827e958f506be3
public boolean allowPlayerCrammingDamage = false;
}
@@ -472,18 +513,41 @@ public class WorldConfiguration extends ConfigurationPart {
@@ -509,18 +550,41 @@ public class WorldConfiguration extends ConfigurationPart {
public class Chunks extends ConfigurationPart {
public AutosavePeriod autoSaveInterval = AutosavePeriod.def();
@@ -300,7 +270,7 @@ index efc91ff91827872c62b8bd060282549ccdcf67dd..1d926378887b9e42f1827e958f506be3
});
public boolean flushRegionsOnSave = false;
}
@@ -498,9 +562,9 @@ public class WorldConfiguration extends ConfigurationPart {
@@ -535,9 +599,9 @@ public class WorldConfiguration extends ConfigurationPart {
public TickRates tickRates;
public class TickRates extends ConfigurationPart {
@@ -312,7 +282,7 @@ index efc91ff91827872c62b8bd060282549ccdcf67dd..1d926378887b9e42f1827e958f506be3
public int wetFarmland = 1;
public int dryFarmland = 1;
public Table<EntityType<?>, String, Integer> sensor = Util.make(HashBasedTable.create(), table -> table.put(EntityType.VILLAGER, "secondarypoisensor", 40));
@@ -534,9 +598,9 @@ public class WorldConfiguration extends ConfigurationPart {
@@ -571,9 +635,9 @@ public class WorldConfiguration extends ConfigurationPart {
public class Misc extends ConfigurationPart {
public int lightQueueSize = 20;
@@ -321,9 +291,9 @@ index efc91ff91827872c62b8bd060282549ccdcf67dd..1d926378887b9e42f1827e958f506be3
public boolean showSignClickCommandFailureMsgsToPlayer = false;
- public RedstoneImplementation redstoneImplementation = RedstoneImplementation.VANILLA;
+ public RedstoneImplementation redstoneImplementation = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? RedstoneImplementation.ALTERNATE_CURRENT : RedstoneImplementation.VANILLA; // Plazma - Optimize default configurations
public AlternateCurrentUpdateOrder alternateCurrentUpdateOrder = AlternateCurrentUpdateOrder.HORIZONTAL_FIRST_OUTWARD;
public boolean disableEndCredits = false;
public float maxLeashDistance = 10f;
public boolean disableSprintInterruptionOnAttack = false;
public DoubleOr.Default maxLeashDistance = DoubleOr.Default.USE_DEFAULT;
diff --git a/src/main/java/io/papermc/paper/configuration/type/fallback/ArrowDespawnRate.java b/src/main/java/io/papermc/paper/configuration/type/fallback/ArrowDespawnRate.java
index 24763d3d270c29c95e0b3e85111145234f660a62..80ddc627e02e3c749e6b074afa93d357d9c7d62a 100644
--- a/src/main/java/io/papermc/paper/configuration/type/fallback/ArrowDespawnRate.java
@@ -337,10 +307,10 @@ index 24763d3d270c29c95e0b3e85111145234f660a62..80ddc627e02e3c749e6b074afa93d357
}
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index 29eef278940cab33a1f5f168f66ab2b80f0d60ce..b4d47c53bb2a5c75e9f69506dbd69a8817f368dc 100644
index 694b126df2c3d1d6fa40ee9731c28886caf1a4fc..822ecda5f4dc6cc8cd0cc4da577f27cdcc5c4967 100644
--- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java
@@ -151,7 +151,7 @@ public class Main {
@@ -164,7 +164,7 @@ public class Main {
File configFile = (File) optionset.valueOf("bukkit-settings");
YamlConfiguration configuration = YamlConfiguration.loadConfiguration(configFile);
configuration.options().copyDefaults(true);
@@ -350,10 +320,10 @@ index 29eef278940cab33a1f5f168f66ab2b80f0d60ce..b4d47c53bb2a5c75e9f69506dbd69a88
File commandFile = (File) optionset.valueOf("commands-settings");
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
index 09aa0c9ec7d66ff82167c035481e5fcccf8618de..3ed078e33a99e4cc7b536ab6590ef939ac2966db 100644
index 8f7e922ceca286b1a590181c301fbe9bff55c024..3dd5c7441bb300ca17d717af37edbefb89db4b2f 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
@@ -131,14 +131,14 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie
@@ -132,14 +132,14 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie
this.spawnMonsters = this.get("spawn-monsters", true);
this.useNativeTransport = this.get("use-native-transport", true);
this.enableCommandBlock = this.get("enable-command-block", false);
@@ -372,7 +342,7 @@ index 09aa0c9ec7d66ff82167c035481e5fcccf8618de..3ed078e33a99e4cc7b536ab6590ef939
this.maxPlayers = this.get("max-players", 20);
this.networkCompressionThreshold = this.get("network-compression-threshold", 256);
this.broadcastRconToOps = this.get("broadcast-rcon-to-ops", true);
@@ -146,7 +146,7 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie
@@ -147,7 +147,7 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie
this.maxWorldSize = this.get("max-world-size", (integer) -> {
return Mth.clamp(integer, 1, 29999984);
}, 29999984);
@@ -382,10 +352,10 @@ index 09aa0c9ec7d66ff82167c035481e5fcccf8618de..3ed078e33a99e4cc7b536ab6590ef939
this.enableJmxMonitoring = this.get("enable-jmx-monitoring", false);
this.enableStatus = this.get("enable-status", true);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 02037da80f2f3cada359bbe0f58160fd15761b77..8de087636686b78c12bc1c293258713ff7dddff0 100644
index 655463a7d588ed88778d137b6fe5ac18951ff172..cc4762c13e21600b4c5e287a6fae9e6e472080b3 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -428,7 +428,7 @@ public final class CraftServer implements Server {
@@ -449,7 +449,7 @@ public final class CraftServer implements Server {
this.configuration = YamlConfiguration.loadConfiguration(this.getConfigFile());
this.configuration.options().copyDefaults(true);
@@ -395,14 +365,14 @@ index 02037da80f2f3cada359bbe0f58160fd15761b77..8de087636686b78c12bc1c293258713f
if (!this.configuration.isString("aliases")) {
legacyAlias = this.configuration.getConfigurationSection("aliases");
diff --git a/src/main/java/org/plazmamc/plazma/Options.java b/src/main/java/org/plazmamc/plazma/Options.java
index 5942d0997f07bd51d934dac32cd349792a10643e..40a6ef72b4d495140c486c0880fdc5fc1a32931c 100644
index 5d41bd4d4b86ca0c7c03d3ac6e75b3f1f1abe73b..c608770ea0df26859a09b794e93292f4aa6881b4 100644
--- a/src/main/java/org/plazmamc/plazma/Options.java
+++ b/src/main/java/org/plazmamc/plazma/Options.java
@@ -5,5 +5,6 @@ import static java.lang.Boolean.getBoolean;
public interface Options {
@@ -7,5 +7,6 @@ public interface Options {
boolean NO_OPTIMIZE = getBoolean("Plazma.disableConfigOptimization");
+ boolean AGGRESSIVE = Boolean.getBoolean("Plazma.aggressiveOptimize") && !NO_OPTIMIZE;
boolean NO_WARN = getBoolean("Plazma.iKnowWhatIAmDoing");
+ boolean AGGRESSIVE = getBoolean("Plazma.aggressiveOptimize") && !NO_OPTIMIZE;
}
diff --git a/src/main/java/org/plazmamc/plazma/configurations/PlazmaConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/PlazmaConfigurations.java
@@ -426,18 +396,10 @@ index 09053b4ccf268fd204c81dbb8d4f10fa9edcad5f..93f67f125b3674e645cfdae27e579e12
#### ENGLISH ####
This is the %s configuration file for Plazma.
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
index cdb4d9a76640fbf0fa202d7b70f5c2bc7005a84b..0a8d1f2b33257a371abb97a3a88af1f89ee46e24 100644
index 95cd1156766895546ef5574b33a60806bff08fa2..097f3c34d244b89e7dd9f8b6f2a3d8fdc67b36dc 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
@@ -49,6 +49,7 @@ public class PurpurConfig {
+ "join us in our Discord guild.\n"
+ "\n"
+ "Website: https://purpurmc.org \n"
+ + "Vanilla Food Properties: https://gist.github.com/BillyGalbreath/4fdfba991bd020e814eabf5143e3b225 \n" // Plazma
+ "Docs: https://purpurmc.org/docs \n";
private static File CONFIG_FILE;
public static YamlConfiguration config;
@@ -241,7 +242,7 @@ public class PurpurConfig {
@@ -244,7 +244,7 @@ public class PurpurConfig {
laggingThreshold = getDouble("settings.lagging-threshold", laggingThreshold);
}
@@ -446,7 +408,7 @@ index cdb4d9a76640fbf0fa202d7b70f5c2bc7005a84b..0a8d1f2b33257a371abb97a3a88af1f8
private static void useAlternateKeepAlive() {
useAlternateKeepAlive = getBoolean("settings.use-alternate-keepalive", useAlternateKeepAlive);
}
@@ -481,7 +482,7 @@ public class PurpurConfig {
@@ -491,7 +491,7 @@ public class PurpurConfig {
}
public static boolean useUPnP = false;
@@ -456,10 +418,10 @@ index cdb4d9a76640fbf0fa202d7b70f5c2bc7005a84b..0a8d1f2b33257a371abb97a3a88af1f8
private static void networkSettings() {
useUPnP = getBoolean("settings.network.upnp-port-forwarding", useUPnP);
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index 6717941d18dbd6871b4613106b9787063e11722f..b6a6a74dfd00a4536258c8693048c9d1ac4df435 100644
index 57ddb4e6a464567cc67e09ce06218cc25af4ddf9..e55993e318b7f7292e22c4539bc2fd1447f67fa8 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -433,7 +433,7 @@ public class PurpurWorldConfig {
@@ -424,7 +424,7 @@ public class PurpurWorldConfig {
public boolean idleTimeoutTargetPlayer = true;
public String playerDeathExpDropEquation = "expLevel * 7";
public int playerDeathExpDropMax = 100;
@@ -468,7 +430,7 @@ index 6717941d18dbd6871b4613106b9787063e11722f..b6a6a74dfd00a4536258c8693048c9d1
public boolean teleportOnNetherCeilingDamage = false;
public boolean totemOfUndyingWorksInInventory = false;
public boolean playerFixStuckPortal = false;
@@ -3135,7 +3135,7 @@ public class PurpurWorldConfig {
@@ -3262,7 +3262,7 @@ public class PurpurWorldConfig {
public boolean zombieJockeyOnlyBaby = true;
public double zombieJockeyChance = 0.05D;
public boolean zombieJockeyTryExistingChickens = true;
@@ -478,23 +440,23 @@ index 6717941d18dbd6871b4613106b9787063e11722f..b6a6a74dfd00a4536258c8693048c9d1
public boolean zombieTakeDamageFromWater = false;
public boolean zombieAlwaysDropExp = false;
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
index 1cf6d4f854d89c515e48e1fb365eb95ff9340765..7d1ae99e83dc6511838092c3ab6e0fd5f39faabc 100644
index 2c408fa4abcbe1171c58aee8799c8cf7867d0f0a..aadad0a1e3c7e20b0ab97095ee6e6fb7dbfbd234 100644
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
@@ -150,14 +150,14 @@ public class SpigotWorldConfig
public double itemMerge;
private void itemMerge()
{
- this.itemMerge = this.getDouble("merge-radius.item", 2.5 );
+ this.itemMerge = this.getDouble("merge-radius.item", org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 3.5 : 2.5 ); // Plazma - Optimize default configurations
- this.itemMerge = this.getDouble("merge-radius.item", 0.5 );
+ this.itemMerge = this.getDouble("merge-radius.item", org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 3.5 : 0.5); // Plazma - Optimize default configurations
this.log( "Item Merge Radius: " + this.itemMerge );
}
public double expMerge;
private void expMerge()
{
- this.expMerge = this.getDouble("merge-radius.exp", 3.0 );
+ this.expMerge = this.getDouble("merge-radius.exp", org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 4.0 : 3.0 ); // Plazma - Optimize default configurations
- this.expMerge = this.getDouble("merge-radius.exp", -1 );
+ this.expMerge = this.getDouble("merge-radius.exp", org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 4.0 : -1); // Plazma - Optimize default configurations
this.log( "Experience Merge Radius: " + this.expMerge );
}
@@ -507,47 +469,58 @@ index 1cf6d4f854d89c515e48e1fb365eb95ff9340765..7d1ae99e83dc6511838092c3ab6e0fd5
this.log( "Mob Spawn Range: " + this.mobSpawnRange );
}
@@ -207,26 +207,26 @@ public class SpigotWorldConfig
@@ -207,27 +207,29 @@ public class SpigotWorldConfig
this.log( "Item Despawn Rate: " + this.itemDespawnRate );
}
- public int animalActivationRange = 32;
- public int monsterActivationRange = 32;
+ public int animalActivationRange = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 16 : 32; // Plazma - Optimize default configurations
+ public int monsterActivationRange = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 24 : 32; // Plazma - Optimize default configurations
public int raiderActivationRange = 48;
- public int raiderActivationRange = 64;
- public int miscActivationRange = 16;
+ public int miscActivationRange = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 8 : 16; // Plazma - Optimize default configurations
// Paper start
- // Paper start
- public int flyingMonsterActivationRange = 32;
- public int waterActivationRange = 16;
- public int villagerActivationRange = 32;
+ public int flyingMonsterActivationRange = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 48 : 32; // Plazma - Optimize default configurations
+ public int waterActivationRange = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 8 : 16; // Plazma - Optimize default configurations
+ public int villagerActivationRange = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 16 : 32; // Plazma - Optimize default configurations
public int wakeUpInactiveAnimals = 4;
public int wakeUpInactiveAnimalsEvery = 60*20;
- public int wakeUpInactiveAnimals = 4;
- public int wakeUpInactiveAnimalsEvery = 60*20;
- public int wakeUpInactiveAnimalsFor = 5*20;
- public int wakeUpInactiveMonsters = 8;
+ public int wakeUpInactiveAnimalsFor = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 40 : 100; // Plazma - Optimize default configurations
+ public int wakeUpInactiveMonsters = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 4 : 8; // Plazma - Optimize default configurations
public int wakeUpInactiveMonstersEvery = 20*20;
- public int wakeUpInactiveMonstersEvery = 20*20;
- public int wakeUpInactiveMonstersFor = 5*20;
- public int wakeUpInactiveVillagers = 4;
+ public int wakeUpInactiveMonstersFor = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 60 : 100; // Plazma - Optimize default configurations
+ public int wakeUpInactiveVillagers = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 1 : 4; // Plazma - Optimize default configurations
public int wakeUpInactiveVillagersEvery = 30*20;
- public int wakeUpInactiveVillagersEvery = 30*20;
- public int wakeUpInactiveVillagersFor = 5*20;
- public int wakeUpInactiveFlying = 8;
+ public int wakeUpInactiveVillagersFor = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 20 : 100; // Plazma - Optimize default configurations
+ public int wakeUpInactiveFlying = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 1 : 8; // Plazma - Optimize default configurations
public int wakeUpInactiveFlyingEvery = 10*20;
- public int wakeUpInactiveFlyingEvery = 10*20;
- public int wakeUpInactiveFlyingFor = 5*20;
+ public int wakeUpInactiveFlyingFor = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 60 : 100; // Plazma - Optimize default configurations
public int villagersWorkImmunityAfter = 5*20;
- public int villagersWorkImmunityAfter = 5*20;
+ // Plazma start - Optimize default configurations
+ public int animalActivationRange = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 16 : 32;
+ public int monsterActivationRange = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 24 : 32;
+ public int raiderActivationRange = 64; // diff on changes
+ public int miscActivationRange = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 8 : 16;
+ // Paper start // diff on changes
+ public int flyingMonsterActivationRange = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 48 : 32;
+ public int waterActivationRange = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 8 : 16;
+ public int villagerActivationRange = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 16 : 32;
+ public int wakeUpInactiveAnimals = 4; // diff on changes
+ public int wakeUpInactiveAnimalsEvery = 1200;
+ public int wakeUpInactiveAnimalsFor = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 40 : 100;
+ public int wakeUpInactiveMonsters = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 4 : 8;
+ public int wakeUpInactiveMonstersEvery = 400;
+ public int wakeUpInactiveMonstersFor = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 60 : 100;
+ public int wakeUpInactiveVillagers = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 1 : 4;
+ public int wakeUpInactiveVillagersEvery = 600;
+ public int wakeUpInactiveVillagersFor = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 20 : 100;
+ public int wakeUpInactiveFlying = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 1 : 8;
+ public int wakeUpInactiveFlyingEvery = 200;
+ public int wakeUpInactiveFlyingFor = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 60 : 100;
+ public int villagersWorkImmunityAfter = 100;
+ // Plazma end - Optimize default configurations
public int villagersWorkImmunityFor = 20;
public boolean villagersActiveForPanic = true;
@@ -299,7 +299,7 @@ public class SpigotWorldConfig
// Paper end
@@ -299,7 +301,7 @@ public class SpigotWorldConfig
{
this.set( "ticks-per.hopper-check", 1 );
}
@@ -556,7 +529,7 @@ index 1cf6d4f854d89c515e48e1fb365eb95ff9340765..7d1ae99e83dc6511838092c3ab6e0fd5
this.hopperAmount = this.getInt( "hopper-amount", 1 );
this.hopperCanLoadChunks = this.getBoolean( "hopper-can-load-chunks", false );
this.log( "Hopper Transfer: " + this.hopperTransfer + " Hopper Check: " + this.hopperCheck + " Hopper Amount: " + this.hopperAmount + " Hopper Can Load Chunks: " + this.hopperCanLoadChunks );
@@ -309,7 +309,7 @@ public class SpigotWorldConfig
@@ -309,7 +311,7 @@ public class SpigotWorldConfig
public int tridentDespawnRate;
private void arrowDespawnRate()
{

View File

@@ -6,10 +6,10 @@ Subject: [PATCH] Add an option to apply the configuration to the vanilla
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
index 8445a0b25d647b2c1f9a44f849084cdec0842e18..86822868e47b269891a71fdc04371b1e28a2752e 100644
index a8e75eaadfcc6c8b2503776d7de197f756712819..99cf08bc17eec05463b300c0c9fd108cbfba1b8f 100644
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
@@ -89,7 +89,7 @@ public class GlobalConfiguration extends ConfigurationPart {
@@ -87,7 +87,7 @@ public class GlobalConfiguration extends ConfigurationPart {
public Component flyingVehicle = Component.translatable("multiplayer.disconnect.flying");
}
@@ -19,10 +19,10 @@ index 8445a0b25d647b2c1f9a44f849084cdec0842e18..86822868e47b269891a71fdc04371b1e
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 8de087636686b78c12bc1c293258713ff7dddff0..60da66fea37f8b9f68a543ff6cdb844a32d654ad 100644
index cc4762c13e21600b4c5e287a6fae9e6e472080b3..76f255d12189ffe83426cc7aa85771d5c7cfb111 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -428,7 +428,19 @@ public final class CraftServer implements Server {
@@ -449,7 +449,19 @@ public final class CraftServer implements Server {
this.configuration = YamlConfiguration.loadConfiguration(this.getConfigFile());
this.configuration.options().copyDefaults(true);
@@ -44,22 +44,22 @@ index 8de087636686b78c12bc1c293258713ff7dddff0..60da66fea37f8b9f68a543ff6cdb844a
if (!this.configuration.isString("aliases")) {
legacyAlias = this.configuration.getConfigurationSection("aliases");
diff --git a/src/main/java/org/plazmamc/plazma/Options.java b/src/main/java/org/plazmamc/plazma/Options.java
index 40a6ef72b4d495140c486c0880fdc5fc1a32931c..3e0e67c089e269d0bccd4a0d2de5ac1ac515997e 100644
index c608770ea0df26859a09b794e93292f4aa6881b4..063b71b3043a69a90130a81686b6a5f1e5f22fd1 100644
--- a/src/main/java/org/plazmamc/plazma/Options.java
+++ b/src/main/java/org/plazmamc/plazma/Options.java
@@ -6,5 +6,7 @@ public interface Options {
@@ -8,5 +8,7 @@ public interface Options {
boolean NO_OPTIMIZE = getBoolean("Plazma.disableConfigOptimization");
boolean AGGRESSIVE = Boolean.getBoolean("Plazma.aggressiveOptimize") && !NO_OPTIMIZE;
+ boolean VANILLAIZE = Boolean.getBoolean("Plazma.vanillaize") && !AGGRESSIVE;
+ boolean USE_VANILLA = Boolean.getBoolean("Plazma.useVanillaConfiguration") && !AGGRESSIVE && NO_OPTIMIZE;
boolean NO_WARN = getBoolean("Plazma.iKnowWhatIAmDoing");
boolean AGGRESSIVE = getBoolean("Plazma.aggressiveOptimize") && !NO_OPTIMIZE;
+ boolean VANILLAIZE = getBoolean("Plazma.vanillaize") && !AGGRESSIVE;
+ boolean USE_VANILLA = getBoolean("Plazma.useVanillaConfiguration") && !AGGRESSIVE && NO_OPTIMIZE;
}
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index 6c2a3813e7d63d57f07a8fa2edbb9d231221d818..15f05cd16a9867da95dd1fcdaeeb134553f651d1 100644
index 4dbb109d0526afee99b9190fc256585121aac9b5..3835a7aa3e3c60a6f50f1d6e781f280ea8a83fb3 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -197,8 +197,8 @@ public class SpigotConfig
@@ -193,8 +193,8 @@ public class SpigotConfig
public static String whitelistMessage;
public static String unknownCommandMessage;
public static String serverFullMessage;
@@ -70,7 +70,7 @@ index 6c2a3813e7d63d57f07a8fa2edbb9d231221d818..15f05cd16a9867da95dd1fcdaeeb1345
private static String transform(String s)
{
return ChatColor.translateAlternateColorCodes( '&', s ).replaceAll( "\\\\n", "\n" );
@@ -211,9 +211,9 @@ public class SpigotConfig
@@ -207,9 +207,9 @@ public class SpigotConfig
SpigotConfig.set( "messages.outdated-server", SpigotConfig.outdatedServerMessage );
}
@@ -83,7 +83,7 @@ index 6c2a3813e7d63d57f07a8fa2edbb9d231221d818..15f05cd16a9867da95dd1fcdaeeb1345
SpigotConfig.outdatedClientMessage = SpigotConfig.transform( SpigotConfig.getString( "messages.outdated-client", SpigotConfig.outdatedClientMessage ) );
SpigotConfig.outdatedServerMessage = SpigotConfig.transform( SpigotConfig.getString( "messages.outdated-server", SpigotConfig.outdatedServerMessage ) );
}
@@ -227,7 +227,7 @@ public class SpigotConfig
@@ -223,7 +223,7 @@ public class SpigotConfig
SpigotConfig.timeoutTime = SpigotConfig.getInt( "settings.timeout-time", SpigotConfig.timeoutTime );
SpigotConfig.restartOnCrash = SpigotConfig.getBoolean( "settings.restart-on-crash", SpigotConfig.restartOnCrash );
SpigotConfig.restartScript = SpigotConfig.getString( "settings.restart-script", SpigotConfig.restartScript );

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Tweak console logging
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 3a2acbdcfb64dff5ecb686ba7ea405b488e6eca9..c48f42815314e2fb106b0dff5f38a9e5c3498632 100644
index d4a9b187b01c63342d9b05b5c29bb1d199deed6c..38752c9ba1726e3c38dd758287a920bc476ef88a 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -193,16 +193,6 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@@ -194,16 +194,6 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
DedicatedServer.LOGGER.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\"");
}
@@ -25,13 +25,12 @@ index 3a2acbdcfb64dff5ecb686ba7ea405b488e6eca9..c48f42815314e2fb106b0dff5f38a9e5
DedicatedServer.LOGGER.info("Loading properties");
DedicatedServerProperties dedicatedserverproperties = this.settings.getProperties();
@@ -226,6 +216,17 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@@ -235,6 +225,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
this.plazmaConfigurations.initializeGlobalConfiguration(this.registryAccess()); // Plazma - Configurable Plazma
this.plazmaConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess()); // Plazma - Configurable Plazma
net.sparklypower.sparklypaper.HalloweenManager.startSyncEpochTask(); // Plazma - Port SparklyPaper patches; Optimize Spooky Season
// Paper end - initialize global and world-defaults configuration
+ // Plazma - Tweak console logging; Moved down
+ // Paper start - detect running as root
+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().consoleLogs.rootUserWarnings && io.papermc.paper.util.ServerEnvironment.userIsRootOrAdmin()) {
+ // Paper start - detect running as root // Plazma - Tweak console logging (moved down)
+ if (io.papermc.paper.util.ServerEnvironment.userIsRootOrAdmin()) {
+ DedicatedServer.LOGGER.warn("****************************");
+ DedicatedServer.LOGGER.warn("YOU ARE RUNNING THIS SERVER AS AN ADMINISTRATIVE OR ROOT USER. THIS IS NOT ADVISED.");
+ DedicatedServer.LOGGER.warn("YOU ARE OPENING YOURSELF UP TO POTENTIAL RISKS WHEN DOING THIS.");
@@ -39,11 +38,10 @@ index 3a2acbdcfb64dff5ecb686ba7ea405b488e6eca9..c48f42815314e2fb106b0dff5f38a9e5
+ DedicatedServer.LOGGER.warn("****************************");
+ }
+ // Paper end - detect running as root
+ // Plazma end - Tweak console logging
this.server.spark.enableEarlyIfRequested(); // Paper - spark
// Paper start - fix converting txt to json file; convert old users earlier after PlayerList creation but before file load/save
if (this.convertOldUsers()) {
this.getProfileCache().save(false); // Paper
@@ -333,6 +334,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@@ -335,6 +334,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
String proxyFlavor = (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) ? "Velocity" : "BungeeCord";
String proxyLink = (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) ? "https://docs.papermc.io/velocity/security" : "http://www.spigotmc.org/wiki/firewall-guide/";
// Paper end - Add Velocity IP Forwarding Support
@@ -51,7 +49,7 @@ index 3a2acbdcfb64dff5ecb686ba7ea405b488e6eca9..c48f42815314e2fb106b0dff5f38a9e5
if (!this.usesAuthentication()) {
DedicatedServer.LOGGER.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!");
DedicatedServer.LOGGER.warn("The server will make no attempt to authenticate usernames. Beware.");
@@ -346,7 +348,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@@ -348,7 +348,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
DedicatedServer.LOGGER.warn("While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.");
}
// Spigot end
@@ -61,10 +59,10 @@ index 3a2acbdcfb64dff5ecb686ba7ea405b488e6eca9..c48f42815314e2fb106b0dff5f38a9e5
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index b863f6fe65c796a1d3102cc3eddb5d6c5becd3ac..c36ebab552c480d34e7fd48a45f0a320a97b9677 100644
index 16999fa20c3621e016d1b0fadfb76f2fe03a2a69..8d7d050f12df83931bbb32f1832d7fcbc06317da 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -1497,6 +1497,7 @@ public abstract class PlayerList {
@@ -1426,6 +1426,7 @@ public abstract class PlayerList {
}
public boolean verifyChatTrusted(PlayerChatMessage message) { // Paper - private -> public
@@ -73,13 +71,14 @@ index b863f6fe65c796a1d3102cc3eddb5d6c5becd3ac..c36ebab552c480d34e7fd48a45f0a320
}
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
index 73dd69941a004b4a2ec244f28d8683e9bdb0a445..e725f6e8205976a7b137aefb98b874cf4ae14893 100644
index 35d5bd2f7dba1aa74547b6ae994bc84a56911bf2..e153370e617e63a8e497036c93ea55dfe851bc6e 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
@@ -68,4 +68,13 @@ public class GlobalConfiguration extends ConfigurationPart {
@@ -79,4 +79,14 @@ public class GlobalConfiguration extends ConfigurationPart {
}
+
+ public ConsoleLogs consoleLogs;
+ public class ConsoleLogs extends ConfigurationPart {
+

View File

@@ -0,0 +1,62 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Fri, 13 Dec 2024 13:08:37 +0900
Subject: [PATCH] Add missing Pufferfish configurations
diff --git a/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java b/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java
index 9ef53608f1608e88de7a7b3e96b43d8d2b4230ae..8500ac473581b90036578d66243c5313e2ce3ddf 100644
--- a/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java
+++ b/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java
@@ -161,11 +161,13 @@ public class Armadillo extends Animal {
return ArmadilloAi.makeBrain(this.brainProvider().makeBrain(dynamic));
}
+ private int behaviorTick; // Plazma - Add missing pufferfish configurations
@Override
protected void customServerAiStep(ServerLevel world) {
ProfilerFiller gameprofilerfiller = Profiler.get();
gameprofilerfiller.push("armadilloBrain");
+ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Plazma - Add missing pufferfish configurations
((Brain<Armadillo>) this.brain).tick(world, this); // CraftBukkit - decompile error
gameprofilerfiller.pop();
gameprofilerfiller.push("armadilloActivityUpdate");
diff --git a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
index dbce71f45c008da883b6d244a06343d83ae25e7e..d2f0b14a0014802605b601e62d0eebddf06d3737 100644
--- a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
+++ b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
@@ -152,6 +152,7 @@ public class Camel extends AbstractHorse {
return pose == Pose.SITTING ? Camel.SITTING_DIMENSIONS.scale(this.getAgeScale()) : super.getDefaultDimensions(pose);
}
+ private int behaviorTick = 0; // Plazma - Add missing pufferfish configurations
@Override
protected void customServerAiStep(ServerLevel world) {
ProfilerFiller gameprofilerfiller = Profiler.get();
@@ -159,6 +160,7 @@ public class Camel extends AbstractHorse {
gameprofilerfiller.push("camelBrain");
Brain<Camel> behaviorcontroller = (Brain<Camel>) this.getBrain(); // CraftBukkit - decompile error
+ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Plazma - Add missing pufferfish configurations
behaviorcontroller.tick(world, this);
gameprofilerfiller.pop();
gameprofilerfiller.push("camelActivityUpdate");
diff --git a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
index 464a16df15d8759d66f94ad080d1ea28b3f6474c..6061cd4fc38fef0895571ab767e495d5755f9fc8 100644
--- a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
+++ b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
@@ -493,11 +493,13 @@ public class Sniffer extends Animal {
return Brain.provider(SnifferAi.MEMORY_TYPES, SnifferAi.SENSOR_TYPES);
}
+ private int behaviorTick; // Plazma - Add missing pufferfish configurations
@Override
protected void customServerAiStep(ServerLevel world) {
ProfilerFiller gameprofilerfiller = Profiler.get();
gameprofilerfiller.push("snifferBrain");
+ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Plazma - Add missing pufferfish configurations
this.getBrain().tick(world, this);
gameprofilerfiller.popPush("snifferActivityUpdate");
SnifferAi.updateActivity(this);

View File

@@ -1,16 +1,16 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Sat, 25 Mar 2023 00:52:11 +0900
Subject: [PATCH] Add missing purpur configuration options
Subject: [PATCH] Add missing Purpur configuration options
diff --git a/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java b/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java
index 569f42645a7730451944fbbd6b96910493feeca5..a14d2ec3b8c89045916b95da5ce2a18d1e866bcf 100644
index 0a173040c56fea6d8f83998b7c66aa8daaf648f2..16b98cad477d7af2d9534cc189aae43a5adc8d58 100644
--- a/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java
+++ b/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java
@@ -150,6 +150,23 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS
protected void registerGoals() {
this.goalSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur
@@ -160,6 +160,18 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS
this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level().purpurConfig.allayMaxHealth);
this.getAttribute(Attributes.SCALE).setBaseValue(this.level().purpurConfig.allayScale);
}
+
+ // Plazma start - Add missing purpur configuration options
@@ -23,20 +23,15 @@ index 569f42645a7730451944fbbd6b96910493feeca5..a14d2ec3b8c89045916b95da5ce2a18d
+ public boolean isAlwaysExperienceDropper() {
+ return level().purpurConfig.allayAlwaysDropExp;
+ }
+
+ @Override
+ public void initAttributes() {
+ this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(level().purpurConfig.allayMaxHealth);
+ }
+ // Plazma end - Add missing purpur configuration options
// Purpur end
@Override
diff --git a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
index 24a1663cf1cd3f888981a13907811b55bdbf6133..fdc3aa9672077787e841d240fe1e690dcd9ca321 100644
index d2f0b14a0014802605b601e62d0eebddf06d3737..459a45f82c42b346a66bb1954e155a0970dcc30f 100644
--- a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
+++ b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
@@ -93,6 +93,18 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Saddl
@@ -96,6 +96,18 @@ public class Camel extends AbstractHorse {
public int getPurpurBreedTime() {
return this.level().purpurConfig.camelBreedingTicks;
}
@@ -51,15 +46,15 @@ index 24a1663cf1cd3f888981a13907811b55bdbf6133..fdc3aa9672077787e841d240fe1e690d
+ public boolean isAlwaysExperienceDropper() {
+ return level().purpurConfig.camelAlwaysDropExp;
+ }
+ // Plazma end - Add missing purpur configuration optionsurpur end
+ // Plazma end - Add missing purpur configuration options
// Purpur end
@Override
diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java
index 4c861b18fbfbae3cb2f1e3563393cfcf4005591c..651f30b4fb02dc03fabad34b62d7d86fa0889754 100644
index 02581f47d1ca58c2b8abffc478adf48343585c8b..bd04af6311ca64d81c8829e731ac39a6486ee789 100644
--- a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java
+++ b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java
@@ -160,6 +160,23 @@ public class Frog extends Animal implements VariantHolder<Holder<FrogVariant>> {
@@ -163,6 +163,23 @@ public class Frog extends Animal implements VariantHolder<Holder<FrogVariant>> {
public float getJumpPower() {
return (getRider() != null && isControllable()) ? level().purpurConfig.frogRidableJumpHeight * this.getBlockJumpFactor() : super.getJumpPower();
}
@@ -84,7 +79,7 @@ index 4c861b18fbfbae3cb2f1e3563393cfcf4005591c..651f30b4fb02dc03fabad34b62d7d86f
public int getPurpurBreedTime() {
diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java
index 64d0e2edf0e47bfe3bc5fbdbabac26c494110467..e077a0bffedd0bb11c9ab5eb507451a0cf6317ea 100644
index 7e92e8c4fec36c8838604f17cf366cc80e82b19b..1b0e80ae62b5c5d4e1fcac71b90f83f12fe4878a 100644
--- a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java
+++ b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java
@@ -93,6 +93,23 @@ public class Tadpole extends AbstractFish {
@@ -112,10 +107,10 @@ index 64d0e2edf0e47bfe3bc5fbdbabac26c494110467..e077a0bffedd0bb11c9ab5eb507451a0
@Override
diff --git a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
index 21bdcbd51d9f440e0734750b40cefa4c08cdaf5f..a2cc1efaa621861828b007759536ac49d7e3646e 100644
index 6061cd4fc38fef0895571ab767e495d5755f9fc8..0bc7856065fdc599890f18f5a4e2f6c2b3d94ba7 100644
--- a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
+++ b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
@@ -119,6 +119,18 @@ public class Sniffer extends Animal {
@@ -116,6 +116,18 @@ public class Sniffer extends Animal {
public int getPurpurBreedTime() {
return this.level().purpurConfig.snifferBreedingTicks;
}
@@ -135,10 +130,10 @@ index 21bdcbd51d9f440e0734750b40cefa4c08cdaf5f..a2cc1efaa621861828b007759536ac49
@Override
diff --git a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
index 722e1fed4b333958e95a847b27cfc67d04f13263..16891921341f8967c9115f415f91ec379fcd5b0c 100644
index 5a62fe9c4f0cee9e8b4a48564f76afec609335b1..79b090030b716029cc4cfc8bf9d81af0b2202313 100644
--- a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
+++ b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
@@ -147,6 +147,23 @@ public class Warden extends Monster implements VibrationSystem {
@@ -151,6 +151,23 @@ public class Warden extends Monster implements VibrationSystem {
this.goalSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur
this.targetSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur
}
@@ -162,26 +157,29 @@ index 722e1fed4b333958e95a847b27cfc67d04f13263..16891921341f8967c9115f415f91ec37
// Purpur end
@Override
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/ChestBoat.java b/src/main/java/net/minecraft/world/entity/vehicle/ChestBoat.java
index e0aec3b3e04d603dc208029554f981c6b9e6b43e..337702c8042d44d4be6be1341023d0779cfaa580 100644
--- a/src/main/java/net/minecraft/world/entity/vehicle/ChestBoat.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/ChestBoat.java
@@ -45,12 +45,12 @@ public class ChestBoat extends Boat implements HasCustomInventoryScreen, Contain
@@ -305,7 +322,7 @@ public class Warden extends Monster implements VibrationSystem {
ProfilerFiller gameprofilerfiller = Profiler.get();
public ChestBoat(EntityType<? extends Boat> type, Level world) {
super(type, world);
gameprofilerfiller.push("wardenBrain");
- if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish
+ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Plazma - Add missing Purpur configurations
this.getBrain().tick(world, this);
gameprofilerfiller.pop();
super.customServerAiStep(world);
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractChestBoat.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractChestBoat.java
index 1f4cc08e84a23213bb9786ea09ad77caeec2d336..f888f1dd2e3c228b0a370fe920b63d547bbba571 100644
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractChestBoat.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractChestBoat.java
@@ -46,7 +46,7 @@ public abstract class AbstractChestBoat extends AbstractBoat implements HasCusto
public AbstractChestBoat(EntityType<? extends AbstractChestBoat> type, Level world, Supplier<Item> itemSupplier) {
super(type, world, itemSupplier);
- this.itemStacks = NonNullList.withSize(27, ItemStack.EMPTY);
+ this.itemStacks = NonNullList.withSize(org.purpurmc.purpur.PurpurConfig.chestBoatRows * 9, ItemStack.EMPTY); // Plazma - Add missing purpur configuration options
}
public ChestBoat(Level world, double d0, double d1, double d2) {
super(EntityType.CHEST_BOAT, world);
- this.itemStacks = NonNullList.withSize(27, ItemStack.EMPTY);
+ this.itemStacks = NonNullList.withSize(org.purpurmc.purpur.PurpurConfig.chestBoatRows * 9, ItemStack.EMPTY); // Plazma - Add missing purpur configuration options
this.setPos(d0, d1, d2);
this.xo = d0;
this.yo = d1;
@@ -170,7 +170,7 @@ public class ChestBoat extends Boat implements HasCustomInventoryScreen, Contain
@Override
@@ -142,7 +142,7 @@ public abstract class AbstractChestBoat extends AbstractBoat implements HasCusto
@Override
public int getContainerSize() {
@@ -191,10 +189,10 @@ index e0aec3b3e04d603dc208029554f981c6b9e6b43e..337702c8042d44d4be6be1341023d077
@Override
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
index 0a8d1f2b33257a371abb97a3a88af1f89ee46e24..dace438eac55b33b9318dfd9f8706883bab64971 100644
index 097f3c34d244b89e7dd9f8b6f2a3d8fdc67b36dc..3f4c94aada930e55dfe6a2dd6f3bfb51b2276b0d 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
@@ -329,6 +329,7 @@ public class PurpurConfig {
@@ -331,6 +331,7 @@ public class PurpurConfig {
}
public static int barrelRows = 3;
@@ -202,7 +200,7 @@ index 0a8d1f2b33257a371abb97a3a88af1f89ee46e24..dace438eac55b33b9318dfd9f8706883
public static boolean enderChestSixRows = false;
public static boolean enderChestPermissionRows = false;
public static boolean cryingObsidianValidForPortalFrame = false;
@@ -369,6 +370,7 @@ public class PurpurConfig {
@@ -373,6 +374,7 @@ public class PurpurConfig {
case 1 -> 9;
default -> 27;
});
@@ -211,26 +209,24 @@ index 0a8d1f2b33257a371abb97a3a88af1f89ee46e24..dace438eac55b33b9318dfd9f8706883
org.bukkit.event.inventory.InventoryType.ENDER_CHEST.setDefaultSize(enderChestSixRows ? 54 : 27);
enderChestPermissionRows = getBoolean("settings.blocks.ender_chest.use-permissions-for-rows", enderChestPermissionRows);
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index b6a6a74dfd00a4536258c8693048c9d1ac4df435..182e8c3f9a631a98576b2efb63371d57f9f5f25f 100644
index e55993e318b7f7292e22c4539bc2fd1447f67fa8..b67b6147e9175041539b01357dd8b1e94cfd6841 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -1178,7 +1178,15 @@ public class PurpurWorldConfig {
public boolean allayRidable = false;
public boolean allayRidableInWater = true;
@@ -1135,7 +1135,13 @@ public class PurpurWorldConfig {
public boolean allayControllable = true;
public double allayMaxHealth = 20.0D;
public double allayScale = 1.0D;
+ // Plazma start - Add missing purpur config options
+ public double allayMaxHealth = 20.0D;
+ public boolean allayTakeDamageFromWater = false;
+ public boolean allayAlwaysDropExp = false;
private void allaySettings() {
+ allayMaxHealth = getDouble("mobs.allay.max-health", allayMaxHealth);
+ allayTakeDamageFromWater = getBoolean("mobs.allay.take-damage-from-water", allayTakeDamageFromWater);
+ allayAlwaysDropExp = getBoolean("mobs.allay.always-drop-exp", allayAlwaysDropExp);
+ // Plazma end - Add missing purpur configuration options
allayRidable = getBoolean("mobs.allay.ridable", allayRidable);
allayRidableInWater = getBoolean("mobs.allay.ridable-in-water", allayRidableInWater);
allayControllable = getBoolean("mobs.allay.controllable", allayControllable);
@@ -1295,7 +1303,13 @@ public class PurpurWorldConfig {
@@ -1290,7 +1296,13 @@ public class PurpurWorldConfig {
public double camelMovementSpeedMin = 0.09D;
public double camelMovementSpeedMax = 0.09D;
public int camelBreedingTicks = 6000;
@@ -244,7 +240,7 @@ index b6a6a74dfd00a4536258c8693048c9d1ac4df435..182e8c3f9a631a98576b2efb63371d57
camelRidableInWater = getBoolean("mobs.camel.ridable-in-water", camelRidableInWater);
camelMaxHealthMin = getDouble("mobs.camel.attributes.max_health.min", camelMaxHealthMin);
camelMaxHealthMax = getDouble("mobs.camel.attributes.max_health.max", camelMaxHealthMax);
@@ -1723,7 +1737,15 @@ public class PurpurWorldConfig {
@@ -1755,7 +1767,15 @@ public class PurpurWorldConfig {
public boolean frogControllable = true;
public float frogRidableJumpHeight = 0.65F;
public int frogBreedingTicks = 6000;
@@ -260,9 +256,9 @@ index b6a6a74dfd00a4536258c8693048c9d1ac4df435..182e8c3f9a631a98576b2efb63371d57
frogRidable = getBoolean("mobs.frog.ridable", frogRidable);
frogRidableInWater = getBoolean("mobs.frog.ridable-in-water", frogRidableInWater);
frogControllable = getBoolean("mobs.frog.controllable", frogControllable);
@@ -2676,7 +2698,13 @@ public class PurpurWorldConfig {
public boolean snifferControllable = true;
@@ -2767,7 +2787,13 @@ public class PurpurWorldConfig {
public double snifferMaxHealth = 14.0D;
public double snifferScale = 1.0D;
public int snifferBreedingTicks = 6000;
+ // Plazma start - Add missing purpur config options
+ public boolean snifferTakeDamageFromWater = false;
@@ -274,7 +270,7 @@ index b6a6a74dfd00a4536258c8693048c9d1ac4df435..182e8c3f9a631a98576b2efb63371d57
snifferRidable = getBoolean("mobs.sniffer.ridable", snifferRidable);
snifferRidableInWater = getBoolean("mobs.sniffer.ridable-in-water", snifferRidableInWater);
snifferControllable = getBoolean("mobs.sniffer.controllable", snifferControllable);
@@ -2775,7 +2803,15 @@ public class PurpurWorldConfig {
@@ -2875,7 +2901,15 @@ public class PurpurWorldConfig {
public boolean tadpoleRidable = false;
public boolean tadpoleRidableInWater = true;
public boolean tadpoleControllable = true;
@@ -290,7 +286,7 @@ index b6a6a74dfd00a4536258c8693048c9d1ac4df435..182e8c3f9a631a98576b2efb63371d57
tadpoleRidable = getBoolean("mobs.tadpole.ridable", tadpoleRidable);
tadpoleRidableInWater = getBoolean("mobs.tadpole.ridable-in-water", tadpoleRidableInWater);
tadpoleControllable = getBoolean("mobs.tadpole.controllable", tadpoleControllable);
@@ -2991,7 +3027,15 @@ public class PurpurWorldConfig {
@@ -3107,7 +3141,15 @@ public class PurpurWorldConfig {
public boolean wardenRidable = false;
public boolean wardenRidableInWater = true;
public boolean wardenControllable = true;

View File

@@ -1,63 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Sun, 5 Nov 2023 11:27:51 +0900
Subject: [PATCH] Add option to change nether portal size
diff --git a/src/main/java/net/minecraft/world/level/portal/PortalShape.java b/src/main/java/net/minecraft/world/level/portal/PortalShape.java
index afe6b2170846273b41b694aa53dca4c31bf78b3f..52043e451ca0641c93205aac62aba5427625b81f 100644
--- a/src/main/java/net/minecraft/world/level/portal/PortalShape.java
+++ b/src/main/java/net/minecraft/world/level/portal/PortalShape.java
@@ -99,7 +99,7 @@ public class PortalShape {
private int calculateWidth() {
int i = this.getDistanceUntilEdgeAboveFrame(this.bottomLeft, this.rightDir);
- return i >= 2 && i <= 21 ? i : 0;
+ return i >= this.level.getMinecraftWorld().plazmaConfig().structure.netherPortal.width.min() && i <= this.level.getMinecraftWorld().plazmaConfig().structure.netherPortal.width.max() ? i : 0; // Plazma - Configurable nether portal size
}
private int getDistanceUntilEdgeAboveFrame(BlockPos pos, Direction direction) {
@@ -132,7 +132,7 @@ public class PortalShape {
BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
int i = this.getDistanceUntilTop(blockposition_mutableblockposition);
- return i >= 3 && i <= 21 && this.hasTopFrame(blockposition_mutableblockposition, i) ? i : 0;
+ return i >= this.level.getMinecraftWorld().plazmaConfig().structure.netherPortal.height.min() && i <= this.level.getMinecraftWorld().plazmaConfig().structure.netherPortal.height.max() && this.hasTopFrame(blockposition_mutableblockposition, i) ? i : 0; // Plazma - Configurable nether portal size
}
private boolean hasTopFrame(BlockPos.MutableBlockPos pos, int height) {
@@ -186,7 +186,7 @@ public class PortalShape {
}
public boolean isValid() {
- return this.bottomLeft != null && this.width >= 2 && this.width <= 21 && this.height >= 3 && this.height <= 21;
+ return this.bottomLeft != null && this.width >= this.level.getMinecraftWorld().plazmaConfig().structure.netherPortal.width.min() && this.width <= this.level.getMinecraftWorld().plazmaConfig().structure.netherPortal.width.max() && this.height >= this.level.getMinecraftWorld().plazmaConfig().structure.netherPortal.height.min() && this.height <= this.level.getMinecraftWorld().plazmaConfig().structure.netherPortal.height.max(); // Plazma - Configurable nether portal size
}
// CraftBukkit start - return boolean
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
index 069a9f8504c74d939b1df569f082cc7bd33d9cfc..b5b4229ccdecd63bd3e689e8247e44341d7c30cc 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
@@ -42,6 +42,21 @@ public class WorldConfigurations extends ConfigurationPart {
public NetherPortal netherPortal;
public class NetherPortal extends ConfigurationPart {
+ public Width width;
+ public class Width extends ConfigurationPart {
+
+ int min = 2; public int min() { return Math.max(this.min, 1); }
+ int max = 21; public int max() { return Math.max(this.min, this.max); }
+
+ }
+
+ public Height height;
+ public class Height extends ConfigurationPart {
+
+ int min = 3; public int min() { return Math.max(this.min, 2); }
+ int max = 21; public int max() { return Math.max(this.min, this.max); }
+
+ }
}

View File

@@ -0,0 +1,90 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Sun, 5 Nov 2023 11:27:51 +0900
Subject: [PATCH] Add option to change nether portal size
diff --git a/src/main/java/net/minecraft/world/level/portal/PortalShape.java b/src/main/java/net/minecraft/world/level/portal/PortalShape.java
index acdff7b4a00d563739fd301c3633a266875296fa..1266aaf4bfcf53aa16d7b9bd697a0c483d3218a9 100644
--- a/src/main/java/net/minecraft/world/level/portal/PortalShape.java
+++ b/src/main/java/net/minecraft/world/level/portal/PortalShape.java
@@ -113,7 +113,7 @@ public class PortalShape {
private static int calculateWidth(BlockGetter iblockaccess, BlockPos blockposition, Direction enumdirection, BlockStateListPopulator blocks) { // CraftBukkit
int i = PortalShape.getDistanceUntilEdgeAboveFrame(iblockaccess, blockposition, enumdirection, blocks); // CraftBukkit
- return i >= 2 && i <= 21 ? i : 0;
+ return i >= org.plazmamc.plazma.configurations.GlobalConfiguration.get().structure.netherPortal.width.min() && i <= org.plazmamc.plazma.configurations.GlobalConfiguration.get().structure.netherPortal.width.max() ? i : 0; // Plazma - Configurable nether portal size
}
private static int getDistanceUntilEdgeAboveFrame(BlockGetter iblockaccess, BlockPos blockposition, Direction enumdirection, BlockStateListPopulator blocks) { // CraftBukkit
@@ -146,7 +146,7 @@ public class PortalShape {
BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
int j = PortalShape.getDistanceUntilTop(iblockaccess, blockposition, enumdirection, blockposition_mutableblockposition, i, mutableint, blocks); // CraftBukkit
- return j >= 3 && j <= 21 && PortalShape.hasTopFrame(iblockaccess, blockposition, enumdirection, blockposition_mutableblockposition, i, j, blocks) ? j : 0; // CraftBukkit
+ return j >= org.plazmamc.plazma.configurations.GlobalConfiguration.get().structure.netherPortal.height.min() && j <= org.plazmamc.plazma.configurations.GlobalConfiguration.get().structure.netherPortal.height.max() && PortalShape.hasTopFrame(iblockaccess, blockposition, enumdirection, blockposition_mutableblockposition, i, j, blocks) ? j : 0; // Craftbukkit // Plazma - Configurable nether portal size
}
private static boolean hasTopFrame(BlockGetter iblockaccess, BlockPos blockposition, Direction enumdirection, BlockPos.MutableBlockPos blockposition_mutableblockposition, int i, int j, BlockStateListPopulator blocks) { // CraftBukkit
@@ -200,7 +200,7 @@ public class PortalShape {
}
public boolean isValid() {
- return this.width >= 2 && this.width <= 21 && this.height >= 3 && this.height <= 21;
+ return this.width >= org.plazmamc.plazma.configurations.GlobalConfiguration.get().structure.netherPortal.width.min() && this.width <= org.plazmamc.plazma.configurations.GlobalConfiguration.get().structure.netherPortal.width.max() && this.height >= org.plazmamc.plazma.configurations.GlobalConfiguration.get().structure.netherPortal.height.min() && this.height <= org.plazmamc.plazma.configurations.GlobalConfiguration.get().structure.netherPortal.height.max(); // Plazma - Configurable nether portal size
}
// CraftBukkit start - return boolean, add entity
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
index e153370e617e63a8e497036c93ea55dfe851bc6e..11d386d3e134b1994302c4e026b6a11c46336522 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
@@ -70,6 +70,26 @@ public class GlobalConfiguration extends ConfigurationPart {
public Structure structure;
public class Structure extends ConfigurationPart {
+ public NetherPortal netherPortal;
+ public class NetherPortal extends ConfigurationPart {
+
+ public Width width;
+ public class Width extends ConfigurationPart {
+
+ int min = 2; public int min() { return Math.max(this.min, 1); }
+ int max = 21; public int max() { return Math.max(this.min, this.max); }
+
+ }
+
+ public Height height;
+ public class Height extends ConfigurationPart {
+
+ int min = 3; public int min() { return Math.max(this.min, 2); }
+ int max = 21; public int max() { return Math.max(this.min, this.max); }
+
+ }
+
+ }
}
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
index c222d58520b655b54b8975ec226a4ba948691cd4..c703237d46b114227cf0d5cdff2e033839bc5f57 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
@@ -36,17 +36,6 @@ public class WorldConfigurations extends ConfigurationPart {
}
- public Structure structure;
- public class Structure extends ConfigurationPart {
-
- public NetherPortal netherPortal;
- public class NetherPortal extends ConfigurationPart {
-
-
- }
-
- }
-
public Block block;
public class Block extends ConfigurationPart {

View File

@@ -1,319 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Wed, 27 Sep 2023 21:18:22 +0900
Subject: [PATCH] Reduce create random instance
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 703e3720cf28c669000b663cba56b070ac4ed96a..4782f19409d300fbcaa952ae0dd6a0577ade5f7b 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -232,6 +232,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@Nullable
private ServerStatus.Favicon statusIcon;
private final RandomSource random;
+ public static RandomSource random() { return getServer().random; } // Plazma - Expose random
public final DataFixer fixerUpper;
private String localIp;
private int port;
diff --git a/src/main/java/net/minecraft/server/commands/SpreadPlayersCommand.java b/src/main/java/net/minecraft/server/commands/SpreadPlayersCommand.java
index b47a8a082170bcb630c4354be7c77a4cac71d105..7fe6b99e146e7374cd29534f1e89046edd340a82 100644
--- a/src/main/java/net/minecraft/server/commands/SpreadPlayersCommand.java
+++ b/src/main/java/net/minecraft/server/commands/SpreadPlayersCommand.java
@@ -66,7 +66,7 @@ public class SpreadPlayersCommand {
if (maxY < j) {
throw SpreadPlayersCommand.ERROR_INVALID_MAX_HEIGHT.create(maxY, j);
} else {
- RandomSource randomsource = RandomSource.create();
+ RandomSource randomsource = worldserver.plazmaConfig().misc.reduceRandom ? worldserver.getRandom() : RandomSource.create(); // Plazma - Reduce create random instance
double d0 = (double) (center.x - maxRange);
double d1 = (double) (center.y - maxRange);
double d2 = (double) (center.x + maxRange);
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 4a29e90ff2a0fe9c5be094400d79ab89e61c437d..582cdbb7e2f25cdc533721e45a89ae15a8b05b8a 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -483,7 +483,7 @@ public class ServerPlayer extends Player {
long l = k * k;
int i1 = l > 2147483647L ? Integer.MAX_VALUE : (int) l;
int j1 = this.getCoprime(i1);
- int k1 = RandomSource.create().nextInt(i1);
+ int k1 = (worldserver.plazmaConfig().misc.reduceRandom ? worldserver.getRandom() : RandomSource.create()).nextInt(i1); // Plazma - Reduce create random instance
for (int l1 = 0; l1 < i1; ++l1) {
int i2 = (k1 + j1 * l1) % i1;
@@ -520,7 +520,7 @@ public class ServerPlayer extends Player {
long l = k * k;
int i1 = l > 2147483647L ? Integer.MAX_VALUE : (int) l;
int j1 = this.getCoprime(i1);
- int k1 = RandomSource.create().nextInt(i1);
+ int k1 = (world.plazmaConfig().misc.reduceRandom ? world.getRandom() : RandomSource.create()).nextInt(i1); // Plazma - Reduce create random instance
for (int l1 = 0; l1 < i1; ++l1) {
int i2 = (k1 + j1 * l1) % i1;
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index 3b4fadb37eafb2f7b0ce4d6b276d2fdaa8287521..ba041288f9619870ab08c2956262d35eed85b44b 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -91,7 +91,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
this.serverId = "";
this.server = server;
this.connection = connection;
- this.challenge = Ints.toByteArray(RandomSource.create().nextInt());
+ this.challenge = Ints.toByteArray((org.plazmamc.plazma.configurations.GlobalConfiguration.get().misc.reduceRandom ? MinecraftServer.random() : RandomSource.create()).nextInt()); // Plazma - Reduce create random instance
this.transferred = transferred;
}
diff --git a/src/main/java/net/minecraft/server/rcon/thread/QueryThreadGs4.java b/src/main/java/net/minecraft/server/rcon/thread/QueryThreadGs4.java
index 0e0867d7add9a024bbe9471f8ff92bbb25996a3d..c0fad810538ede0f248898db2e68625b96e56c16 100644
--- a/src/main/java/net/minecraft/server/rcon/thread/QueryThreadGs4.java
+++ b/src/main/java/net/minecraft/server/rcon/thread/QueryThreadGs4.java
@@ -341,7 +341,7 @@ public class QueryThreadGs4 extends GenericThread {
this.identBytes[2] = bs[5];
this.identBytes[3] = bs[6];
this.ident = new String(this.identBytes, StandardCharsets.UTF_8);
- this.challenge = RandomSource.create().nextInt(16777216);
+ this.challenge = (org.plazmamc.plazma.configurations.GlobalConfiguration.get().misc.reduceRandom ? net.minecraft.server.MinecraftServer.random() : RandomSource.create()).nextInt(16777216); // Plazma - Reduce create random instance
this.challengeBytes = String.format(Locale.ROOT, "\t%s%d\u0000", this.ident, this.challenge).getBytes(StandardCharsets.UTF_8);
}
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/ShufflingList.java b/src/main/java/net/minecraft/world/entity/ai/behavior/ShufflingList.java
index 3fac11bf02652b5f51f30f99bdf516504467d0d2..9d939624756e8a7a07a787f9807f095c5033b234 100644
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/ShufflingList.java
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/ShufflingList.java
@@ -15,7 +15,7 @@ import net.minecraft.util.RandomSource;
public class ShufflingList<U> implements Iterable<U> {
protected final List<ShufflingList.WeightedEntry<U>> entries;
- private final RandomSource random = RandomSource.create();
+ private final RandomSource random = org.plazmamc.plazma.configurations.GlobalConfiguration.get().misc.reduceRandom ? net.minecraft.server.MinecraftServer.random() : RandomSource.create(); // Plazma - Reduce create random instance
private final boolean isUnsafe; // Paper - Fix Concurrency issue in ShufflingList during worldgen
public ShufflingList() {
diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java
index 09a7b418ddf564c0be13297f7c216db2e7ae1578..703006eb5df8099c4f51cdb4e41f95cacfbe43a6 100644
--- a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java
+++ b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java
@@ -8,7 +8,7 @@ import net.minecraft.world.entity.ai.memory.MemoryModuleType;
import net.minecraft.world.entity.ai.targeting.TargetingConditions;
public abstract class Sensor<E extends LivingEntity> {
- private static final RandomSource RANDOM = RandomSource.createThreadSafe();
+ private static final RandomSource RANDOM = org.plazmamc.plazma.configurations.GlobalConfiguration.get().misc.reduceRandom && org.plazmamc.plazma.configurations.GlobalConfiguration.get().misc.ignoreThreadSafeRandom ? net.minecraft.server.MinecraftServer.random() : RandomSource.createThreadSafe(); // Plazma - Reduce create random instance
private static final int DEFAULT_SCAN_RATE = 20;
protected static final int TARGETING_RANGE = 16;
private static final TargetingConditions TARGET_CONDITIONS = TargetingConditions.forNonCombat().range(16.0);
diff --git a/src/main/java/net/minecraft/world/entity/monster/warden/AngerManagement.java b/src/main/java/net/minecraft/world/entity/monster/warden/AngerManagement.java
index 3d792957f27fd4bdfad8d76262a8e2a2012bf35f..71539b5910692489cad6f78ac90f3aabc4e58236 100644
--- a/src/main/java/net/minecraft/world/entity/monster/warden/AngerManagement.java
+++ b/src/main/java/net/minecraft/world/entity/monster/warden/AngerManagement.java
@@ -33,7 +33,7 @@ public class AngerManagement {
@VisibleForTesting
protected static final int MAX_ANGER = 150;
private static final int DEFAULT_ANGER_DECREASE = 1;
- private int conversionDelay = Mth.randomBetweenInclusive(RandomSource.create(), 0, 2);
+ private int conversionDelay = Mth.randomBetweenInclusive((org.plazmamc.plazma.configurations.GlobalConfiguration.get().misc.reduceRandom ? net.minecraft.server.MinecraftServer.random() : RandomSource.create()), 0, 2); // Plazma - Reduce create random instance
int highestAnger;
private static final Codec<Pair<UUID, Integer>> SUSPECT_ANGER_PAIR = RecordCodecBuilder.create(
instance -> instance.group(
diff --git a/src/main/java/net/minecraft/world/entity/npc/WanderingTraderSpawner.java b/src/main/java/net/minecraft/world/entity/npc/WanderingTraderSpawner.java
index 96e9fce5f9084737d2fcf4deb83305733b480179..43da8ea227b2b01d6975a3f4f209099d350386f6 100644
--- a/src/main/java/net/minecraft/world/entity/npc/WanderingTraderSpawner.java
+++ b/src/main/java/net/minecraft/world/entity/npc/WanderingTraderSpawner.java
@@ -32,7 +32,7 @@ public class WanderingTraderSpawner implements CustomSpawner {
private static final int SPAWN_CHANCE_INCREASE = 25;
private static final int SPAWN_ONE_IN_X_CHANCE = 10;
private static final int NUMBER_OF_SPAWN_ATTEMPTS = 10;
- private final RandomSource random = RandomSource.create();
+ private final RandomSource random = org.plazmamc.plazma.configurations.GlobalConfiguration.get().misc.reduceRandom ? net.minecraft.server.MinecraftServer.random() : RandomSource.create(); // Plazma - reduce create random instace
private final ServerLevelData serverLevelData;
private int tickDelay;
private int spawnDelay;
diff --git a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
index 7dd5e0b935d98d552c916f8412569ff4aa0e9b04..4d0f209df602f017500c1d56423fa482423f9702 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
@@ -87,7 +87,7 @@ public class FishingHook extends Projectile {
private FishingHook(EntityType<? extends FishingHook> type, Level world, int luckOfTheSeaLevel, int lureLevel) {
super(type, world);
- this.syncronizedRandom = RandomSource.create();
+ this.syncronizedRandom = world.plazmaConfig().misc.reduceRandom ? world.getRandom() : RandomSource.create(); // Plazma - Reduce create random instance
this.openWater = true;
this.currentState = FishingHook.FishHookState.FLYING;
this.noCulling = true;
diff --git a/src/main/java/net/minecraft/world/entity/raid/Raid.java b/src/main/java/net/minecraft/world/entity/raid/Raid.java
index fdff9788eaf663be79214b2ca491f0f0444f6136..de50b06f13df481fa59e1abe16d5181b8124b427 100644
--- a/src/main/java/net/minecraft/world/entity/raid/Raid.java
+++ b/src/main/java/net/minecraft/world/entity/raid/Raid.java
@@ -118,7 +118,7 @@ public class Raid {
public Raid(int id, ServerLevel world, BlockPos pos) {
this.raidEvent = new ServerBossEvent(Raid.RAID_NAME_COMPONENT, BossEvent.BossBarColor.RED, BossEvent.BossBarOverlay.NOTCHED_10);
- this.random = RandomSource.create();
+ this.random = world.plazmaConfig().misc.reduceRandom ? world.getRandom() : RandomSource.create(); // Plazma - Reduce create random instace
this.waveSpawnPos = Optional.empty();
this.id = id;
this.level = world;
@@ -132,7 +132,7 @@ public class Raid {
public Raid(ServerLevel world, CompoundTag nbt) {
this.raidEvent = new ServerBossEvent(Raid.RAID_NAME_COMPONENT, BossEvent.BossBarColor.RED, BossEvent.BossBarOverlay.NOTCHED_10);
- this.random = RandomSource.create();
+ this.random = world.plazmaConfig().misc.reduceRandom ? world.getRandom() : RandomSource.create(); // Plazma - Reduce create random instace
this.waveSpawnPos = Optional.empty();
this.level = world;
this.id = nbt.getInt("Id");
diff --git a/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java b/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java
index 6d28f1097caa3e37c2917eb401018ebf48c13a39..9397f1fa3b53423deabbedc6f7bb0f98d68c89a2 100644
--- a/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java
@@ -96,7 +96,7 @@ public class EnchantmentMenu extends AbstractContainerMenu {
}
// Purpur end
};
- this.random = RandomSource.create();
+ this.random = playerInventory.player.level().plazmaConfig().misc.reduceRandom ? playerInventory.player.level().random : RandomSource.create(); // Plazma - Reduce create random instace
this.enchantmentSeed = DataSlot.standalone();
this.costs = new int[3];
this.enchantClue = new int[]{-1, -1, -1};
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
index 0022263a41b74fc339c5a5629aee3cd2cd05c5ae..0b553c9e90b53cdf84b14a5d5d20dc3cf1ffb44f 100644
--- a/src/main/java/net/minecraft/world/level/Explosion.java
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
@@ -93,7 +93,7 @@ public class Explosion {
}
public Explosion(Level world, @Nullable Entity entity, @Nullable DamageSource damageSource, @Nullable ExplosionDamageCalculator behavior, double x, double y, double z, float power, boolean createFire, Explosion.BlockInteraction destructionType, ParticleOptions particle, ParticleOptions emitterParticle, Holder<SoundEvent> soundEvent) {
- this.random = RandomSource.create();
+ this.random = world.plazmaConfig().misc.reduceRandom ? world.getRandom() : RandomSource.create(); // Plazma - Reduce create random instace
this.toBlow = new ObjectArrayList();
this.hitPlayers = Maps.newHashMap();
this.level = world;
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 0a0ab76144aa7d0970638924878f1eb130b2e3e3..a2ffd16c9351c484f0163f19f9352cd643f9b437 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -121,16 +121,16 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public final Thread thread;
private final boolean isDebug;
private int skyDarken;
- protected int randValue = RandomSource.create().nextInt();
protected final int addend = 1013904223;
protected float oRainLevel;
public float rainLevel;
protected float oThunderLevel;
public float thunderLevel;
public final RandomSource random = RandomSource.create();
+ protected int randValue = org.plazmamc.plazma.configurations.GlobalConfiguration.get().misc.reduceRandom ? random.nextInt() : RandomSource.create().nextInt(); // Plazma - Reduce create random instace
/** @deprecated */
@Deprecated
- private final RandomSource threadSafeRandom = RandomSource.createThreadSafe();
+ private final RandomSource threadSafeRandom = org.plazmamc.plazma.configurations.GlobalConfiguration.get().misc.ignoreThreadSafeRandom ? random : RandomSource.createThreadSafe(); // Plazma - Reduce create random instace
private final Holder<DimensionType> dimensionTypeRegistration;
public final WritableLevelData levelData;
// private final Supplier<ProfilerFiller> profiler; // Plazma - Completely remove Mojang's Profiler
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
index fb9611866671880fc7a1a969da928b8f2ad15269..44962ecedf724e941e59913188afe4cfad252fc8 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
@@ -357,7 +357,7 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity {
}
private static void spawnGatewayPortal(ServerLevel world, BlockPos pos, EndGatewayConfiguration config) {
- Feature.END_GATEWAY.place(config, world, world.getChunkSource().getGenerator(), RandomSource.create(), pos);
+ Feature.END_GATEWAY.place(config, world, world.getChunkSource().getGenerator(), (world.plazmaConfig().misc.reduceRandom ? world.getRandom() : RandomSource.create()), pos); // Plazma - Reduce create random instance
}
@Override
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGeneratorStructureState.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGeneratorStructureState.java
index a6b6e5ea191c0e2cd7a2e4f01b89d8af40a83c1b..19769ac9fa688969fd2db7c9a5e92eaadac124c4 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGeneratorStructureState.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGeneratorStructureState.java
@@ -224,7 +224,7 @@ public class ChunkGeneratorStructureState {
List<CompletableFuture<ChunkPos>> list = new ArrayList(j);
int k = placement.spread();
HolderSet<Biome> holderset = placement.preferredBiomes();
- RandomSource randomsource = RandomSource.create();
+ RandomSource randomsource = org.plazmamc.plazma.configurations.GlobalConfiguration.get().misc.reduceRandom ? net.minecraft.server.MinecraftServer.random() : RandomSource.create(); // Plazma - Reduce create random instace
// Paper start - Add missing structure set seed configs
if (this.conf.strongholdSeed != null && structureSetEntry.is(net.minecraft.world.level.levelgen.structure.BuiltinStructureSets.STRONGHOLDS)) {
diff --git a/src/main/java/net/minecraft/world/level/dimension/end/DragonRespawnAnimation.java b/src/main/java/net/minecraft/world/level/dimension/end/DragonRespawnAnimation.java
index 7bbe93966fa00b7001da53bf2f22f4d942b7cc22..6c5eececc83571b0f60e7f672ed185e1d262e99c 100644
--- a/src/main/java/net/minecraft/world/level/dimension/end/DragonRespawnAnimation.java
+++ b/src/main/java/net/minecraft/world/level/dimension/end/DragonRespawnAnimation.java
@@ -81,7 +81,7 @@ public enum DragonRespawnAnimation {
world.explode((Entity) null, (double) ((float) worldgenender_spike.getCenterX() + 0.5F), (double) worldgenender_spike.getHeight(), (double) ((float) worldgenender_spike.getCenterZ() + 0.5F), 5.0F, Level.ExplosionInteraction.BLOCK);
SpikeConfiguration worldgenfeatureendspikeconfiguration = new SpikeConfiguration(true, ImmutableList.of(worldgenender_spike), new BlockPos(0, 128, 0));
- Feature.END_SPIKE.place(worldgenfeatureendspikeconfiguration, world, world.getChunkSource().getGenerator(), RandomSource.create(), new BlockPos(worldgenender_spike.getCenterX(), 45, worldgenender_spike.getCenterZ()));
+ Feature.END_SPIKE.place(worldgenfeatureendspikeconfiguration, world, world.getChunkSource().getGenerator(), (world.plazmaConfig().misc.reduceRandom ? world.getRandom() : RandomSource.create()), new BlockPos(worldgenender_spike.getCenterX(), 45, worldgenender_spike.getCenterZ())); // Plazma - Reduce create random instance
}
} else if (flag1) {
fight.setRespawnStage(SUMMONING_DRAGON); // CraftBukkit - decompile error
diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
index 18a1b4325cac81b040596071dab99ef9bf6f3142..ab492b184a4ecdefc423823fc72abd800b71f016 100644
--- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
+++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
@@ -472,7 +472,7 @@ public class EndDragonFight {
this.level.registryAccess().registry(Registries.CONFIGURED_FEATURE).flatMap((iregistry) -> {
return iregistry.getHolder(EndFeatures.END_GATEWAY_DELAYED);
}).ifPresent((holder_c) -> {
- ((ConfiguredFeature) holder_c.value()).place(this.level, this.level.getChunkSource().getGenerator(), RandomSource.create(), pos);
+ holder_c.value().place(this.level, this.level.getChunkSource().getGenerator(), (this.level.plazmaConfig().misc.reduceRandom ? this.level.getRandom() : RandomSource.create()), pos); // Plazma - Reduce create random instace
});
}
@@ -490,7 +490,7 @@ public class EndDragonFight {
this.portalLocation = this.portalLocation.atY(this.level.getMinBuildHeight() + 1);
}
// Paper end - Prevent "softlocked" exit portal generation
- if (worldgenendtrophy.place(FeatureConfiguration.NONE, this.level, this.level.getChunkSource().getGenerator(), RandomSource.create(), this.portalLocation)) {
+ if (worldgenendtrophy.place(FeatureConfiguration.NONE, this.level, this.level.getChunkSource().getGenerator(), (this.level.plazmaConfig().misc.reduceRandom ? this.level.getRandom() : RandomSource.create()), this.portalLocation)) { // Plazma - Reduce create random instace
int i = Mth.positiveCeilDiv(4, 16);
this.level.getChunkSource().chunkMap.waitForLightBeforeSending(new ChunkPos(this.portalLocation), i);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
index 95e35c223f2ad9b6de6749544abd68de71e4f1ab..492e0c1d00e8098d9a974f46c087a404ec67764e 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
@@ -14,11 +14,12 @@ import org.bukkit.inventory.meta.FireworkMeta;
public class CraftFirework extends CraftProjectile implements Firework {
- private final Random random = new Random();
+ private final net.minecraft.util.RandomSource random; // Plazma - Reduce create random instance
//private CraftItemStack item; // Paper - Remove usage, not accurate representation of current item.
public CraftFirework(CraftServer server, FireworkRocketEntity entity) {
super(server, entity);
+ this.random = this.getHandle().level().plazmaConfig().misc.reduceRandom ? this.getHandle().level().getRandom() : net.minecraft.util.RandomSource.create(); // Plazma - Reduce create random instance
// Paper start - Expose firework item directly
// ItemStack item = this.getHandle().getEntityData().get(FireworkRocketEntity.DATA_ID_FIREWORKS_ITEM);
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
index e725f6e8205976a7b137aefb98b874cf4ae14893..dad5379066140b1eadab0a283cc7d8c019d8f4b6 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
@@ -65,6 +65,8 @@ public class GlobalConfiguration extends ConfigurationPart {
public Miscellaneous misc;
public class Miscellaneous extends ConfigurationPart {
+ public boolean reduceRandom = OPTIMIZE;
+ public boolean ignoreThreadSafeRandom = false;
}
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
index b5b4229ccdecd63bd3e689e8247e44341d7c30cc..33544c734798d9fa1954c7806420f1e0b3653898 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
@@ -22,6 +22,7 @@ public class WorldConfigurations extends ConfigurationPart {
public Miscellaneous misc;
public class Miscellaneous extends ConfigurationPart {
+ public boolean reduceRandom = OPTIMIZE;
}

View File

@@ -7,10 +7,10 @@ Subject: [PATCH] Apply various optimizations
Akarin - Swaps the predicate order of collision
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index f7201a74f66892c9d93616e9afb99d9499f0cdbc..3a9d8e64d0a02a40a89cd82e014ed1bebcd6b8b3 100644
index aa171a1afb9800e6ec84f6b4f1b28e44177752f7..eaf53f5f4c33ca7a7a988e7bd04b7033e16f9529 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2209,8 +2209,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -2309,8 +2309,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
public void playerTouch(Player player) {}
public void push(Entity entity) {
@@ -21,7 +21,7 @@ index f7201a74f66892c9d93616e9afb99d9499f0cdbc..3a9d8e64d0a02a40a89cd82e014ed1be
if (this.level.paperConfig().collisions.onlyPlayersCollide && !(entity instanceof ServerPlayer || this instanceof ServerPlayer)) return; // Paper - Collision option for requiring a player participant
double d0 = entity.getX() - this.getX();
double d1 = entity.getZ() - this.getZ();
@@ -2238,8 +2239,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -2338,8 +2339,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
entity.push(d0, 0.0D, d1);
}
}

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Do not load chunks to spawn phantom
diff --git a/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java b/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java
index 04f67f7b43d2f461c776c76614dc3e5f060aea63..b3fe0dd152b3e2e1b83b4ec2270d387e6117ec1c 100644
index 27eb9a365006884c85603dc6d9dd8eee009c98b3..958a48d05aba8e500c7b19a466dcca6fea8a8bcc 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java
@@ -70,6 +70,7 @@ public class PhantomSpawner implements CustomSpawner {
@@ -17,10 +17,10 @@ index 04f67f7b43d2f461c776c76614dc3e5f060aea63..b3fe0dd152b3e2e1b83b4ec2270d387e
FluidState fluid = world.getFluidState(blockposition1);
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
index 33544c734798d9fa1954c7806420f1e0b3653898..b83a1058484e3d4d46f91d659f795f59d7087b72 100644
index c703237d46b114227cf0d5cdff2e033839bc5f57..a976e2b960a5f3b7ecf6e42afcb1dd3bd140b8bd 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
@@ -32,6 +32,7 @@ public class WorldConfigurations extends ConfigurationPart {
@@ -31,6 +31,7 @@ public class WorldConfigurations extends ConfigurationPart {
public Phantom phantom;
public class Phantom extends ConfigurationPart {

View File

@@ -6,22 +6,28 @@ Subject: [PATCH] Add option to disable moved to quickly check for specific
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 176e54f1c5f4feb98bee8876c304f6e248909e9c..2133251cc2ee2e50f0b830c9f5123d3d9e7a6430 100644
index 9ae16e24013ea5664d4ea6d52ed7dd188404890f..91f161d27a45174b6f3c31440eea46ff81185203 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1469,6 +1469,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1695,7 +1695,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
}
}
// Paper end - Prevent moving into unloaded chunks
+ if (!this.player.getBukkitEntity().hasPermission("plazma.bypass-moved-to-quickly-check") || !(org.plazmamc.plazma.configurations.GlobalConfiguration.get().player.checkSpectatorMovedToQuickly && this.player.isSpectator())) // Plazma - Options to bypass moved to quickly check
if (!this.player.isChangingDimension() && (!this.player.level().getGameRules().getBoolean(GameRules.RULE_DISABLE_ELYTRA_MOVEMENT_CHECK) || !flag)) {
float f2 = flag ? 300.0F : 100.0F;
+ // Plazma start - Add option to bypass moved to quickly check
private boolean shouldCheckPlayerMovement(boolean elytra) {
+ return (!this.player.getBukkitEntity().hasPermission("plazma.bypass-moved-to-quickly-check") || !(org.plazmamc.plazma.configurations.GlobalConfiguration.get().player.checkSpectatorMovedToQuickly && this.player.isSpectator())) && shouldCheckPlayerMovement0(elytra);
+ }
+
+ private boolean shouldCheckPlayerMovement0(boolean elytra) {
+ // Plazma end - Add option to bypass moved to quickly check
if (this.isSingleplayerOwner()) {
return false;
} else if (this.player.isChangingDimension()) {
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
index dad5379066140b1eadab0a283cc7d8c019d8f4b6..b6c5fc90654a9d89d4c70948124be6ae66c86cdf 100644
index 11d386d3e134b1994302c4e026b6a11c46336522..93d746b0e7f263b36a66864834445cb41e5e2cee 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
@@ -27,6 +27,7 @@ public class GlobalConfiguration extends ConfigurationPart {
@@ -37,6 +37,7 @@ public class GlobalConfiguration extends ConfigurationPart {
public Player player;
public class Player extends ConfigurationPart {

View File

@@ -6,10 +6,10 @@ Subject: [PATCH] Configurable cave lava sea level
This patch also fix MC-237017.
diff --git a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
index 8ce870a5341a61fbbaf42021ef7f7f615a6a3e09..6650f74b01285c1dba8243ca11dbde06419a90e7 100644
index 3f39d6c786d9dfdd9ad591e08ff05fcbb41a1df6..0346fd4ab7095d66c0eef5a440afbc7a8ba52466 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
@@ -72,14 +72,14 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator {
@@ -71,14 +71,14 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator {
}
private static Aquifer.FluidPicker createFluidPicker(NoiseGeneratorSettings settings) {
@@ -33,10 +33,10 @@ index 8ce870a5341a61fbbaf42021ef7f7f615a6a3e09..6650f74b01285c1dba8243ca11dbde06
@Override
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
index b6c5fc90654a9d89d4c70948124be6ae66c86cdf..ae6b4ee0add2de0b7568424abeab1bd441653bcb 100644
index 93d746b0e7f263b36a66864834445cb41e5e2cee..0b59a3a36c86948877cb8cb875dc114e9f9d284a 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
@@ -35,6 +35,24 @@ public class GlobalConfiguration extends ConfigurationPart {
@@ -45,6 +45,24 @@ public class GlobalConfiguration extends ConfigurationPart {
public WorldGeneration worldgen;
public class WorldGeneration extends ConfigurationPart {
@@ -49,7 +49,7 @@ index b6c5fc90654a9d89d4c70948124be6ae66c86cdf..ae6b4ee0add2de0b7568424abeab1bd4
+ public net.minecraft.world.level.block.state.BlockState seaBlock() {
+ if (this.seaBlock.equalsIgnoreCase("default")) return net.minecraft.world.level.block.Blocks.LAVA.defaultBlockState();
+ return net.minecraft.core.registries.BuiltInRegistries.BLOCK
+ .getOptional(new net.minecraft.resources.ResourceLocation(this.seaBlock))
+ .getOptional(net.minecraft.resources.ResourceLocation.tryParse(this.seaBlock))
+ .orElseGet(() -> {
+ PlazmaConfigurations.LOGGER.warn("Invalid custom sea level block: {}, defaulting to lava", this.seaBlock);
+ return net.minecraft.world.level.block.Blocks.LAVA;

View File

@@ -5,31 +5,32 @@ Subject: [PATCH] Configurable entity sensor tick
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 05c41e1c2f4a1c714dc842dc019acda46fc41e7b..ba6295ce11236c7eadaeaa042482d6cec0945bd1 100644
index 7ca12a1128661ea36e2e33cda204c7d2df55a21c..331a75fee26e3fe2532e8661db282a0c207ddf9b 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -997,10 +997,11 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Targeti
//ProfilerFiller gameprofilerfiller = this.level().getProfiler(); // Purpur
@@ -951,10 +951,11 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
ProfilerFiller gameprofilerfiller = Profiler.get();
//gameprofilerfiller.push("sensing"); // Purpur
gameprofilerfiller.push("sensing");
- this.sensing.tick();
+ //this.sensing.tick(); // Plazma - Moved down
//gameprofilerfiller.pop(); // Purpur
+ //this.sensing.tick(); // Plazma - moved down
gameprofilerfiller.pop();
int i = this.tickCount + this.getId();
+ if (i % this.level().plazmaConfig().entity.sensorTick == 0) this.sensing.tick(); // Plazma - Configurable entity sensor tick
if (i % 2 != 0 && this.tickCount > 1) {
//gameprofilerfiller.push("targetSelector"); // Purpur
gameprofilerfiller.push("targetSelector");
if (this.targetSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
index 9debf554deb5b7aa021502ff7d600905f56fa25c..dceb5b2cec5f0c20be74d892e8cab98823d2f59a 100644
index a976e2b960a5f3b7ecf6e42afcb1dd3bd140b8bd..9e408d6c1826d36a935b3e382e8eb0283f3d1580 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
@@ -30,6 +30,7 @@ public class WorldConfigurations extends ConfigurationPart {
@@ -28,6 +28,8 @@ public class WorldConfigurations extends ConfigurationPart {
public Entity entity;
public class Entity extends ConfigurationPart {
public boolean ignoreUselessPackets = OPTIMIZE;
+ public int sensorTick = 1;
+
public Phantom phantom;
public class Phantom extends ConfigurationPart {

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Variable entity wakeup duration
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
index dceb5b2cec5f0c20be74d892e8cab98823d2f59a..bc35244533621436e3c0fb871edf7834ad937f81 100644
index 9e408d6c1826d36a935b3e382e8eb0283f3d1580..a371893777a2c2d1de22e7d52f2fd3f55b82d74d 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
@@ -39,6 +39,20 @@ public class WorldConfigurations extends ConfigurationPart {
@@ -37,6 +37,20 @@ public class WorldConfigurations extends ConfigurationPart {
}
@@ -28,21 +28,22 @@ index dceb5b2cec5f0c20be74d892e8cab98823d2f59a..bc35244533621436e3c0fb871edf7834
+
}
public Structure structure;
public Block block;
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
index 56e52b16b419c882440a15947f037ae1a902bc70..583647f6c9ca0fb092f30c97693bd548f692dfd3 100644
index 9b1a16747aa23b18e4cff986efaac6ce64b6ddb9..6a45bafaa1d7ddc0f80c0945e15c3d6c67f9f2b3 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -68,29 +68,36 @@ public class ActivationRange
Activity.PANIC
@@ -66,29 +66,37 @@ public class ActivationRange
net.minecraft.world.entity.schedule.Activity.PANIC
};
+ // Plazma start - Variable entity wakeup duration
+ private static int getWakeupDuration(net.minecraft.util.RandomSource random, int duration, double deviation) {
+ private static int getWakeUpDuration(net.minecraft.util.RandomSource random, int duration, double deviation) {
+ if (deviation == 0) return duration;
+ return (int) Math.min(Integer.MAX_VALUE, Math.max(1, Math.round(duration * (1 + deviation * random.nextGaussian()))));
+ }
+ // Plazma end - Variable entity wakeup duration
+
private static int checkInactiveWakeup(Entity entity) {
Level world = entity.level();
SpigotWorldConfig config = world.spigotConfig;
@@ -52,25 +53,25 @@ index 56e52b16b419c882440a15947f037ae1a902bc70..583647f6c9ca0fb092f30c97693bd548
if (inactiveFor > config.wakeUpInactiveVillagersEvery && world.wakeupInactiveRemainingVillagers > 0) {
world.wakeupInactiveRemainingVillagers--;
- return config.wakeUpInactiveVillagersFor;
+ return getWakeupDuration(world.getRandom(), config.wakeUpInactiveVillagersFor, plazmaConfig.entity.wakeUpDurationVariance.villager()); // Plazma - Variable entity wakeup duration
+ return getWakeUpDuration(world.getRandom(), config.wakeUpInactiveVillagersFor, plazmaConfig.entity.wakeUpDurationVariance.villager()); // Plazma - Variable entity wakeup duration
}
} else if (entity.activationType == ActivationType.ANIMAL) {
if (inactiveFor > config.wakeUpInactiveAnimalsEvery && world.wakeupInactiveRemainingAnimals > 0) {
world.wakeupInactiveRemainingAnimals--;
- return config.wakeUpInactiveAnimalsFor;
+ return getWakeupDuration(world.getRandom(), config.wakeUpInactiveAnimalsFor, plazmaConfig.entity.wakeUpDurationVariance.animal()); // Plazma - Variable entity wakeup duration
+ return getWakeUpDuration(world.getRandom(), config.wakeUpInactiveAnimalsFor, plazmaConfig.entity.wakeUpDurationVariance.animal()); // Plazma - Variable entity wakeup duration
}
} else if (entity.activationType == ActivationType.FLYING_MONSTER) {
if (inactiveFor > config.wakeUpInactiveFlyingEvery && world.wakeupInactiveRemainingFlying > 0) {
world.wakeupInactiveRemainingFlying--;
- return config.wakeUpInactiveFlyingFor;
+ return getWakeupDuration(world.getRandom(), config.wakeUpInactiveFlyingFor, plazmaConfig.entity.wakeUpDurationVariance.flying()); // Plazma - Variable entity wakeup duration
+ return getWakeUpDuration(world.getRandom(), config.wakeUpInactiveFlyingFor, plazmaConfig.entity.wakeUpDurationVariance.flying()); // Plazma - Variable entity wakeup duration
}
} else if (entity.activationType == ActivationType.MONSTER || entity.activationType == ActivationType.RAIDER) {
if (inactiveFor > config.wakeUpInactiveMonstersEvery && world.wakeupInactiveRemainingMonsters > 0) {
world.wakeupInactiveRemainingMonsters--;
- return config.wakeUpInactiveMonstersFor;
+ return getWakeupDuration(world.getRandom(), config.wakeUpInactiveMonstersFor, plazmaConfig.entity.wakeUpDurationVariance.monster()); // Plazma - Variable entity wakeup duration
+ return getWakeUpDuration(world.getRandom(), config.wakeUpInactiveMonstersFor, plazmaConfig.entity.wakeUpDurationVariance.monster()); // Plazma - Variable entity wakeup duration
}
}
return -1;

View File

@@ -7,7 +7,7 @@ Subject: [PATCH] Add entity spawn deadlock timer
- AbsolemJackdaw/FixMySpawnR
diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java
index 967af8771ff8564c715d89f4b4b69b16c25add59..2ac5fb585636523787e05edaa58a4fa34a39ef28 100644
index bb4411cfdf1bc7adc12c2f918d2eec830299f38b..357d484029fe338bea4f5770d13ccfc0dce4432e 100644
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
@@ -50,6 +50,8 @@ public abstract class BaseSpawner {
@@ -61,10 +61,10 @@ index 967af8771ff8564c715d89f4b4b69b16c25add59..2ac5fb585636523787e05edaa58a4fa3
return nbt;
}
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
index a9c8a5918184a2ea364261e279edf7169ae270c7..ffbe18cd212fda0a67d13cb5ccf32068670988aa 100644
index a371893777a2c2d1de22e7d52f2fd3f55b82d74d..d366e8755ba91c329164c16659f6b07245577fba 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
@@ -54,6 +54,14 @@ public class WorldConfigurations extends ConfigurationPart {
@@ -51,6 +51,14 @@ public class WorldConfigurations extends ConfigurationPart {
}
@@ -78,4 +78,4 @@ index a9c8a5918184a2ea364261e279edf7169ae270c7..ffbe18cd212fda0a67d13cb5ccf32068
+
}
public Structure structure;
public Block block;

View File

@@ -1,57 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Mon, 4 Dec 2023 23:12:47 +0900
Subject: [PATCH] Optimise state lookup more
diff --git a/src/main/java/io/papermc/paper/util/table/ZeroCollidingReferenceStateTable.java b/src/main/java/io/papermc/paper/util/table/ZeroCollidingReferenceStateTable.java
index 57d0cd3ad6f972e986c72a57f1a6e36003f190c2..50d97c5ab33f33b81dbafd7cf42da5afd9856eeb 100644
--- a/src/main/java/io/papermc/paper/util/table/ZeroCollidingReferenceStateTable.java
+++ b/src/main/java/io/papermc/paper/util/table/ZeroCollidingReferenceStateTable.java
@@ -17,6 +17,7 @@ public final class ZeroCollidingReferenceStateTable {
protected final StateHolder<?, ?> this_state;
protected long[] index_table;
+ public long[] index_table() { return this.index_table; } // Plazma - Getter
protected StateHolder<?, ?>[][] value_table;
public ZeroCollidingReferenceStateTable(final StateHolder<?, ?> state, final Map<Property<?>, Comparable<?>> this_map) {
diff --git a/src/main/java/net/minecraft/world/level/block/state/StateHolder.java b/src/main/java/net/minecraft/world/level/block/state/StateHolder.java
index 45744d86e9582a93a0cec26009deea091080fbbe..5dd9473c55a08a775aa406901a0e54ef6f63837a 100644
--- a/src/main/java/net/minecraft/world/level/block/state/StateHolder.java
+++ b/src/main/java/net/minecraft/world/level/block/state/StateHolder.java
@@ -114,6 +114,12 @@ public abstract class StateHolder<O, S> {
}
public <T extends Comparable<T>, V extends T> S trySetValue(Property<T> property, V value) {
+ // Plazma start - Optimise state lookup more
+ final S ret = (S) this.optimisedTable.get(property, value);
+ if (ret == null) throw new IllegalArgumentException("Cannot set property " + property + " to " + value + " on " + this.owner + ", it is not an allowed value");
+ return ret;
+ /*
+ // Plazma end - Optimise state lookup more
Comparable<?> comparable = this.values.get(property);
if (comparable != null && !comparable.equals(value)) {
S object = this.neighbours.get(property, value);
@@ -125,10 +131,11 @@ public abstract class StateHolder<O, S> {
} else {
return (S)this;
}
+ */ // Plazma - Optimise state lookup more
}
public void populateNeighbours(Map<Map<Property<?>, Comparable<?>>, S> states) {
- if (this.neighbours != null) {
+ if (this.optimisedTable.index_table() != null) { // Plazma - optimise state lookup
throw new IllegalStateException();
} else {
Table<Property<?>, Comparable<?>, S> table = HashBasedTable.create();
@@ -143,7 +150,7 @@ public abstract class StateHolder<O, S> {
}
}
- this.neighbours = (Table<Property<?>, Comparable<?>, S>)(table.isEmpty() ? table : ArrayTable.create(table)); this.optimisedTable.loadInTable((Table)this.neighbours, this.values); // Paper - optimise state lookup
+ this.optimisedTable.loadInTable((Table) (table.isEmpty() ? table : ArrayTable.create(table)), this.values); // Plazma - Optimize state lookup more
}
}

View File

@@ -1,41 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Mon, 4 Dec 2023 23:15:43 +0900
Subject: [PATCH] Suppress errors from dirty attributes
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
index 2b4d3db901784a82e1ed91520a5e3d1fb8ca6b3e..b66a56ea65cb323953278f80d210473f9f571722 100644
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
@@ -415,7 +415,8 @@ public class ServerEntity {
}
if (this.entity instanceof LivingEntity) {
- Set<AttributeInstance> set = ((LivingEntity) this.entity).getAttributes().getDirtyAttributes();
+ Set<AttributeInstance> attributes = ((LivingEntity) this.entity).getAttributes().getDirtyAttributes(); // Plazma - Suppress errors from dirty attributes
+ final Set<AttributeInstance> set = this.level.plazmaConfig().entity.suppressErrorsFromDirtyAttributes ? Collections.synchronizedSet(attributes) : attributes; // Plazma - Suppress errors from dirty attributes
if (!set.isEmpty()) {
// CraftBukkit start - Send scaled max health
@@ -426,7 +427,7 @@ public class ServerEntity {
this.broadcastAndSend(new ClientboundUpdateAttributesPacket(this.entity.getId(), set));
}
- set.clear();
+ attributes.clear(); // Plazma - Suppress errors from dirty attributes
}
}
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
index bc35244533621436e3c0fb871edf7834ad937f81..a9c8a5918184a2ea364261e279edf7169ae270c7 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
@@ -31,6 +31,7 @@ public class WorldConfigurations extends ConfigurationPart {
public boolean ignoreUselessPackets = OPTIMIZE;
public int sensorTick = 1;
+ public boolean suppressErrorsFromDirtyAttributes = OPTIMIZE;
public Phantom phantom;
public class Phantom extends ConfigurationPart {

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Improve SwingTime ticking
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index f0d611f370966c12e076252ffd020a05c40f3588..8da257e5d305e4ec978f4933d5011f84976e6bb9 100644
index f4604e543a980d6aeb485252da5a4e755aa12bfa..f2753cf51634479e501c1a3e7931d6d9882bc801 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -2670,6 +2670,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -2821,6 +2821,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
protected void updateSwingTime() {

View File

@@ -0,0 +1,19 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Mon, 6 May 2024 12:25:59 +0900
Subject: [PATCH] Use Akair's flag when running the test server with gradle
diff --git a/build.gradle.kts b/build.gradle.kts
index 746ad8087192931400256c8a1ef71e966eaf6b1a..14695f421c3751a1e75567aecf3685d901790011 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -164,7 +164,7 @@ fun TaskContainer.registerRunTask(
languageVersion.set(JavaLanguageVersion.of(21))
vendor.set(JvmVendorSpec.JETBRAINS)
})
- jvmArgs("-DPlazma.DevelopmentEnvironment", "-XX:+AllowEnhancedClassRedefinition", "-XX:+AllowRedefinitionToAddDeleteMethods") // Plazma - Always agree EULA on development mode
+ jvmArgs("-DPlazma.DevelopmentEnvironment", "--add-modules=jdk.incubator.vector", "-XX:+AllowEnhancedClassRedefinition", "-XX:+AllowRedefinitionToAddDeleteMethods", "-XX:+UseG1GC", "-XX:+ParallelRefProcEnabled", "-XX:MaxGCPauseMillis=200", "-XX:+UnlockExperimentalVMOptions", "-XX:+DisableExplicitGC", "-XX:+AlwaysPreTouch", "-XX:G1HeapWastePercent=5", "-XX:G1MixedGCCountTarget=4", "-XX:InitiatingHeapOccupancyPercent=15", "-XX:G1MixedGCLiveThresholdPercent=90", "-XX:G1RSetUpdatingPauseTimePercent=5", "-XX:SurvivorRatio=32", "-XX:+PerfDisableSharedMem", "-XX:MaxTenuringThreshold=1", "-Dusing.aikars.flags=https://mcflags.emc.gs", "-Daikars.new.flags=true", "-XX:G1NewSizePercent=40", "-XX:G1MaxNewSizePercent=50", "-XX:G1HeapRegionSize=16M", "-XX:G1ReservePercent=15") // Plazma - Always agree EULA on development mode; Use Akair's flag when running the test server with gradle
if (rootProject.childProjects["test-plugin"] != null) {
val testPluginJar = rootProject.project(":test-plugin").tasks.jar.flatMap { it.archiveFile }

View File

@@ -5,14 +5,14 @@ Subject: [PATCH] Use Plazma logo instead if server favicon doesn't exist
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index f926376ee95b28a9c09a1ad87223f89f1c28f50e..cf13166d1fdd663f1f99fd6d00a5296631276511 100644
index 20266ef8f0974f47581e71175de4b01ea1a27bf0..54ef910938efb537a689dd5dbda119455bbf2a0e 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1555,29 +1555,36 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1627,29 +1627,32 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
private Optional<ServerStatus.Favicon> loadStatusIcon() {
- Optional<Path> optional = Optional.of(this.getFile("server-icon.png").toPath()).filter((path) -> {
- Optional<Path> optional = Optional.of(this.getFile("server-icon.png")).filter((path) -> {
- return Files.isRegularFile(path, new LinkOption[0]);
- }).or(() -> {
- return this.storageSource.getIconFile().filter((path) -> {
@@ -36,9 +36,8 @@ index f926376ee95b28a9c09a1ad87223f89f1c28f50e..cf13166d1fdd663f1f99fd6d00a52966
- }
- });
+ // Plazma start - Use Plazma logo instead if server favicon doesn't exist
+ @Nullable File file = Optional.of(this.getFile("server-icon.png").toPath()).filter(Files::isRegularFile)
+ @Nullable File file = Optional.of(this.getFile("server-icon.png").toAbsolutePath()).filter(Files::isRegularFile)
+ .or(() -> this.storageSource.getIconFile().filter(Files::isRegularFile)).map(Path::toFile).orElse(null);
+
+ try (
+ java.io.InputStream stream = (file != null)
+ ? new java.io.FileInputStream(file)
@@ -51,13 +50,10 @@ index f926376ee95b28a9c09a1ad87223f89f1c28f50e..cf13166d1fdd663f1f99fd6d00a52966
+ if (stream == null) return Optional.empty();
+ if (file == null && !org.plazmamc.plazma.Options.VANILLA_ICO)
+ LOGGER.info("No server icon found, using the logo instead.");
+
+ BufferedImage bufferedimage = ImageIO.read(stream);
+
+ Preconditions.checkState(bufferedimage.getWidth() == 64, "Must be 64 pixels wide");
+ Preconditions.checkState(bufferedimage.getHeight() == 64, "Must be 64 pixels high");
+ ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream();
+
+ ImageIO.write(bufferedimage, "PNG", bytearrayoutputstream);
+ return Optional.of(new ServerStatus.Favicon(bytearrayoutputstream.toByteArray()));
+ } catch (Exception exception) {
@@ -69,13 +65,13 @@ index f926376ee95b28a9c09a1ad87223f89f1c28f50e..cf13166d1fdd663f1f99fd6d00a52966
public Optional<Path> getWorldScreenshotFile() {
diff --git a/src/main/java/org/plazmamc/plazma/Options.java b/src/main/java/org/plazmamc/plazma/Options.java
index 3e0e67c089e269d0bccd4a0d2de5ac1ac515997e..2e75ca5d2b7d8f35814fe9a0814b19a9135d80cb 100644
index 063b71b3043a69a90130a81686b6a5f1e5f22fd1..e7092aeb5abce5aa5f9bd434adc6acd4e43dec13 100644
--- a/src/main/java/org/plazmamc/plazma/Options.java
+++ b/src/main/java/org/plazmamc/plazma/Options.java
@@ -8,5 +8,6 @@ public interface Options {
boolean AGGRESSIVE = Boolean.getBoolean("Plazma.aggressiveOptimize") && !NO_OPTIMIZE;
boolean VANILLAIZE = Boolean.getBoolean("Plazma.vanillaize") && !AGGRESSIVE;
boolean USE_VANILLA = Boolean.getBoolean("Plazma.useVanillaConfiguration") && !AGGRESSIVE && NO_OPTIMIZE;
+ boolean VANILLA_ICO = Boolean.getBoolean("Plazma.useVanillaFavicon");
@@ -10,5 +10,6 @@ public interface Options {
boolean AGGRESSIVE = getBoolean("Plazma.aggressiveOptimize") && !NO_OPTIMIZE;
boolean VANILLAIZE = getBoolean("Plazma.vanillaize") && !AGGRESSIVE;
boolean USE_VANILLA = getBoolean("Plazma.useVanillaConfiguration") && !AGGRESSIVE && NO_OPTIMIZE;
+ boolean VANILLA_ICO = getBoolean("Plazma.useVanillaFavicon");
}

View File

@@ -20,10 +20,10 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 95105a7ffaa71f8eaa00c617fc112872aa2e2e78..dc24e0d9d7811de89ff94c49365c537d7211aa7d 100644
index 38752c9ba1726e3c38dd758287a920bc476ef88a..45fa867a22481bbba86e587767cfdb96d9691c49 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -708,6 +708,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@@ -688,6 +688,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
// Paper start - Add setting for proxy online mode status
return dedicatedserverproperties.enforceSecureProfile
&& io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode()
@@ -32,7 +32,7 @@ index 95105a7ffaa71f8eaa00c617fc112872aa2e2e78..dc24e0d9d7811de89ff94c49365c537d
// Paper end - Add setting for proxy online mode status
}
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index c36ebab552c480d34e7fd48a45f0a320a97b9677..fdfe8f5bc5ad0e5f5ded41d87756a5866d041df1 100644
index 8d7d050f12df83931bbb32f1832d7fcbc06317da..be4a5407fe9b692b72eb2b85e2dea160a0555bca 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -135,6 +135,7 @@ public abstract class PlayerList {
@@ -52,10 +52,10 @@ index c36ebab552c480d34e7fd48a45f0a320a97b9677..fdfe8f5bc5ad0e5f5ded41d87756a586
player.loadGameTypes((CompoundTag) optional.orElse(null)); // CraftBukkit - decompile error
ServerGamePacketListenerImpl playerconnection = new ServerGamePacketListenerImpl(this.server, connection, player, clientData);
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
index d0a1b97bacf9978b4955b1c2c4502c2c1312f1d4..c2caf205fa65382016b8340ff536c583b8234621 100644
index 0b59a3a36c86948877cb8cb875dc114e9f9d284a..6e14f6a03c7bcd820f3d787178a62844ad022332 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
@@ -29,6 +29,15 @@ public class GlobalConfiguration extends ConfigurationPart {
@@ -39,6 +39,15 @@ public class GlobalConfiguration extends ConfigurationPart {
public boolean checkSpectatorMovedToQuickly = !OPTIMIZE;
@@ -73,7 +73,7 @@ index d0a1b97bacf9978b4955b1c2c4502c2c1312f1d4..c2caf205fa65382016b8340ff536c583
@Setting("world-generation")
diff --git a/src/main/java/ru/bk/oharass/freedomchat/FreedomChat.java b/src/main/java/ru/bk/oharass/freedomchat/FreedomChat.java
new file mode 100644
index 0000000000000000000000000000000000000000..24ba82e13f6eeedd3a3658ebc29c9c4744f5f1b0
index 0000000000000000000000000000000000000000..49290983ef6b63bbacdef30f774ce683228e5755
--- /dev/null
+++ b/src/main/java/ru/bk/oharass/freedomchat/FreedomChat.java
@@ -0,0 +1,103 @@
@@ -108,7 +108,7 @@ index 0000000000000000000000000000000000000000..24ba82e13f6eeedd3a3658ebc29c9c47
+@ChannelHandler.Sharable
+public class FreedomChat extends MessageToByteEncoder<Packet<?>> {
+
+ private static final StreamCodec<ByteBuf, Packet<? super ClientGamePacketListener>> CODEC = GameProtocols.CLIENTBOUND
+ private static final StreamCodec<ByteBuf, Packet<? super ClientGamePacketListener>> CODEC = GameProtocols.CLIENTBOUND_TEMPLATE
+ .bind(RegistryFriendlyByteBuf.decorator(MinecraftServer.getServer().registryAccess())).codec();
+
+ @Override

View File

@@ -1,136 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Sun, 5 May 2024 00:01:03 +0900
Subject: [PATCH] Add more MSPT
diff --git a/src/main/java/io/papermc/paper/command/MSPTCommand.java b/src/main/java/io/papermc/paper/command/MSPTCommand.java
index 03be23690a94a14d7343526acad67ccf53b85c70..416c0a736edf47f76a37be0bc5fe8678cf89cdb3 100644
--- a/src/main/java/io/papermc/paper/command/MSPTCommand.java
+++ b/src/main/java/io/papermc/paper/command/MSPTCommand.java
@@ -45,8 +45,10 @@ public final class MSPTCommand extends Command {
MinecraftServer server = MinecraftServer.getServer();
List<Component> times = new ArrayList<>();
+ times.addAll(eval(server.tickTimes1s.getTimes())); // Plazma - Add more MSPT
times.addAll(eval(server.tickTimes5s.getTimes()));
times.addAll(eval(server.tickTimes10s.getTimes()));
+ times.addAll(eval(server.tickTimes30s.getTimes())); // Plazma - Add more MSPT
times.addAll(eval(server.tickTimes60s.getTimes()));
sender.sendMessage(text().content("Server tick times ").color(GOLD)
@@ -61,12 +63,18 @@ public final class MSPTCommand extends Command {
text(")")
)
).append(
- text(" from last 5s"),
+ // Plazma start - Add more MSPT
+ text(" from last 1s"),
+ text(",", GRAY),
+ text(" 5s"),
text(",", GRAY),
text(" 10s"),
text(",", GRAY),
+ text(" 30s"),
+ text(",", GRAY),
text(" 1m"),
text(":", YELLOW)
+ // Plazma end - Add more MSPT
)
);
sender.sendMessage(text().content("◴ ").color(GOLD)
@@ -74,7 +82,11 @@ public final class MSPTCommand extends Command {
.append(
times.get(0), SLASH, times.get(1), SLASH, times.get(2), text(", ", YELLOW),
times.get(3), SLASH, times.get(4), SLASH, times.get(5), text(", ", YELLOW),
- times.get(6), SLASH, times.get(7), SLASH, times.get(8)
+ // Plazma start - Add more MSPT
+ times.get(6), SLASH, times.get(7), SLASH, times.get(8), text(", ", YELLOW),
+ times.get(9), SLASH, times.get(10), SLASH, times.get(11), text(", ", YELLOW),
+ times.get(12), SLASH, times.get(13), SLASH, times.get(14), text(", ", YELLOW)
+ // Plazma end - Add more MSPT
)
)
);
@@ -93,18 +105,26 @@ public final class MSPTCommand extends Command {
text(")")
)
).append(
- text(" from last 5s"),
+ // Plazma start - Add more MSPT
+ text(" from last 1s"),
+ text(",", GRAY),
+ text(" 5s"),
text(",", GRAY),
text(" 10s"),
text(",", GRAY),
+ text(" 30s"),
+ text(",", GRAY),
text(" 1m"),
text(":", YELLOW)
+ // Plazma end - Add more MSPT
)
);
for (net.minecraft.server.level.ServerLevel level: server.getAllLevels()) {
List<Component> worldTimes = new ArrayList<>();
+ worldTimes.addAll(eval(level.tickTimes1s.getTimes())); // Plazma - Add more MSPT
worldTimes.addAll(eval(level.tickTimes5s.getTimes()));
worldTimes.addAll(eval(level.tickTimes10s.getTimes()));
+ worldTimes.addAll(eval(level.tickTimes30s.getTimes())); // Plazma - Add more MSPT
worldTimes.addAll(eval(level.tickTimes60s.getTimes()));
sender.sendMessage(text().content("◴ " + level.getWorld().getName() + ": ").color(GOLD)
@@ -112,7 +132,11 @@ public final class MSPTCommand extends Command {
.append(
worldTimes.get(0), SLASH, worldTimes.get(1), SLASH, worldTimes.get(2), text(", ", YELLOW),
worldTimes.get(3), SLASH, worldTimes.get(4), SLASH, worldTimes.get(5), text(", ", YELLOW),
- worldTimes.get(6), SLASH, worldTimes.get(7), SLASH, worldTimes.get(8)
+ // Plazma start - Add more MSPT
+ worldTimes.get(6), SLASH, worldTimes.get(7), SLASH, worldTimes.get(8), text(", ", YELLOW),
+ worldTimes.get(9), SLASH, worldTimes.get(10), SLASH, worldTimes.get(11), text(", ", YELLOW),
+ worldTimes.get(12), SLASH, worldTimes.get(13), SLASH, worldTimes.get(14), text(", ", YELLOW)
+ // Plazma end - Add more MSPT
)
)
);
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 4782f19409d300fbcaa952ae0dd6a0577ade5f7b..f926376ee95b28a9c09a1ad87223f89f1c28f50e 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -254,8 +254,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
private final long[] tickTimesNanos;
private long aggregatedTickTimesNanos;
// Paper start - Add tick times API and /mspt command
+ public final TickTimes tickTimes1s = new TickTimes(20); // Plazma - Add more MSPT
public final TickTimes tickTimes5s = new TickTimes(100);
public final TickTimes tickTimes10s = new TickTimes(200);
+ public final TickTimes tickTimes30s = new TickTimes(600); // Plazma - Add more MSPT
public final TickTimes tickTimes60s = new TickTimes(1200);
// Paper end - Add tick times API and /mspt command
@Nullable
@@ -1821,8 +1823,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
worldserver.tick(shouldKeepTicking);
long after = Util.getNanos() - before;
+ worldserver.tickTimes1s.add(this.tickCount, after); // Plazma - Add more MSPT
worldserver.tickTimes5s.add(this.tickCount, after);
worldserver.tickTimes10s.add(this.tickCount, after);
+ worldserver.tickTimes30s.add(this.tickCount, after); // Plazma - Add more MSPT
worldserver.tickTimes60s.add(this.tickCount, after);
// Plazma end - Port SparklyPaper patches; Track World specific MSPT
// Paper start
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 508e01e9ef41f006e6d9be71969c0d82dc646628..15548aac320ae6d707cab4a61dfc99eaebb06634 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -234,8 +234,10 @@ public class ServerLevel extends Level implements WorldGenLevel {
public boolean hasRidableMoveEvent = false; // Purpur
// Plazma start - Port SparklyPaper patches; Track World specific MSPT
+ public final MinecraftServer.TickTimes tickTimes1s = new MinecraftServer.TickTimes(20); // Plazma - Add more MSPT
public final MinecraftServer.TickTimes tickTimes5s = new MinecraftServer.TickTimes(100);
public final MinecraftServer.TickTimes tickTimes10s = new MinecraftServer.TickTimes(200);
+ public final MinecraftServer.TickTimes tickTimes30s = new MinecraftServer.TickTimes(600); // Plazma - Add more MSPT
public final MinecraftServer.TickTimes tickTimes60s = new MinecraftServer.TickTimes(1200);
// Plazma end - Port SparklyPaper patches; Track World specific MSPT

View File

@@ -0,0 +1,32 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Fri, 25 Oct 2024 19:11:40 +0900
Subject: [PATCH] Reset dirty flag when loading maps from the disk
Based on SparklyPaper, Copyright (C) 2024 SparklyPower
commit: c023b928439b9c71277f27cc9b5bd36ca32624ea
diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
index 26da9e7c25ef6a89482838010d8ed6bcf8c87511..71aa3b9c5604f832e764e0d7a93da467ffe7dee1 100644
--- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
+++ b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
@@ -209,6 +209,7 @@ public class MapItemSavedData extends SavedData {
}
}
+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().misc.resetDirtyWhenLoadingMapsFromDisk) worldmap.setDirty(false); // Plazma - Reset dirty flag when loading maps from the disk
return worldmap;
}
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
index 6e14f6a03c7bcd820f3d787178a62844ad022332..193e565b6d62caf278223db033351d03ff417637 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
@@ -124,6 +124,7 @@ public class GlobalConfiguration extends ConfigurationPart {
public Miscellaneous misc;
public class Miscellaneous extends ConfigurationPart {
+ public boolean resetDirtyWhenLoadingMapsFromDisk = false;
}

View File

@@ -0,0 +1,38 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Fri, 25 Oct 2024 19:13:21 +0900
Subject: [PATCH] Allow throttling hopper checks if the target container is
full
Based on SparklyPaper, Copyright (C) 2024 SparklyPower.
commit: c023b928439b9c71277f27cc9b5bd36ca32624ea
diff --git a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
index 5ebbdb94d9b91c442ff60eb6872f740ebd790fa0..aeeb8af68ea43ae6c93952610918d77b1593ed54 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
@@ -441,6 +441,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
Direction enumdirection = blockEntity.facing.getOpposite();
if (HopperBlockEntity.isFullContainer(iinventory, enumdirection)) {
+ if (world.plazmaConfig().block.hopper.fullCooldown != 0) blockEntity.setCooldown(world.plazmaConfig().block.hopper.fullCooldown); // Plazma - Allow throttling hopper checks if the target container is full
return false;
} else {
// Paper start - Perf: Optimize Hoppers
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
index d366e8755ba91c329164c16659f6b07245577fba..f21ed3431fd8472c78c15578bbd12214c499ceea 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
@@ -64,6 +64,12 @@ public class WorldConfigurations extends ConfigurationPart {
public Block block;
public class Block extends ConfigurationPart {
+ public Hopper hopper;
+ public class Hopper extends ConfigurationPart {
+
+ public int fullCooldown = 0;
+
+ }
}

View File

@@ -0,0 +1,41 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Fri, 25 Oct 2024 19:26:15 +0900
Subject: [PATCH] Suppress errors from dirty attributes
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index f2753cf51634479e501c1a3e7931d6d9882bc801..02288d8f3521756770351c02f623f9db02efd40c 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -1390,7 +1390,8 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
private void refreshDirtyAttributes() {
- Set<AttributeInstance> set = this.getAttributes().getAttributesToUpdate();
+ Set<AttributeInstance> attr = this.getAttributes().getAttributesToUpdate(); // Plazma - Suppress errors from dirty attributes
+ final Set<AttributeInstance> set = level().plazmaConfig().entity.suppressErrorsFromDirtyAttributes ? java.util.Collections.synchronizedSet(attr) : attr; // Plazma - Suppress errors from dirty attributes
Iterator iterator = set.iterator();
while (iterator.hasNext()) {
@@ -1399,7 +1400,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.onAttributeUpdated(attributemodifiable.getAttribute());
}
- set.clear();
+ attr.clear(); // Plazma - Suppress errors from dirty attributes
}
protected void onAttributeUpdated(Holder<Attribute> attribute) {
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
index f21ed3431fd8472c78c15578bbd12214c499ceea..9cfab16b9cdf40ccb709c0af66c406954560c0ef 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
@@ -29,6 +29,7 @@ public class WorldConfigurations extends ConfigurationPart {
public class Entity extends ConfigurationPart {
public int sensorTick = 1;
+ public boolean suppressErrorsFromDirtyAttributes = OPTIMIZE;
public Phantom phantom;
public class Phantom extends ConfigurationPart {

View File

@@ -1,19 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Mon, 6 May 2024 12:25:59 +0900
Subject: [PATCH] Use Akair's flag when running the test server with gradle
diff --git a/build.gradle.kts b/build.gradle.kts
index 54a30184392815a01f20b8fc841690e4ae5b3cc6..10bff15cd8b52fd6973aa3565ae75aabdf7dff53 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -137,7 +137,7 @@ fun TaskContainer.registerRunTask(
languageVersion.set(JavaLanguageVersion.of(21))
vendor.set(JvmVendorSpec.JETBRAINS)
})
- jvmArgs("-XX:+AllowEnhancedClassRedefinition", "-XX:+AllowRedefinitionToAddDeleteMethods")
+ jvmArgs("-XX:+AllowEnhancedClassRedefinition", "-XX:+AllowRedefinitionToAddDeleteMethods", "-XX:+UseG1GC", "-XX:+ParallelRefProcEnabled", "-XX:MaxGCPauseMillis=200", "-XX:+UnlockExperimentalVMOptions", "-XX:+DisableExplicitGC", "-XX:+AlwaysPreTouch", "-XX:G1HeapWastePercent=5", "-XX:G1MixedGCCountTarget=4", "-XX:InitiatingHeapOccupancyPercent=15", "-XX:G1MixedGCLiveThresholdPercent=90", "-XX:G1RSetUpdatingPauseTimePercent=5", "-XX:SurvivorRatio=32", "-XX:+PerfDisableSharedMem", "-XX:MaxTenuringThreshold=1", "-Dusing.aikars.flags=https://mcflags.emc.gs", "-Daikars.new.flags=true", "-XX:G1NewSizePercent=40", "-XX:G1MaxNewSizePercent=50", "-XX:G1HeapRegionSize=16M", "-XX:G1ReservePercent=15")
if (rootProject.childProjects["test-plugin"] != null) {
val testPluginJar = rootProject.project(":test-plugin").tasks.jar.flatMap { it.archiveFile }

View File

@@ -0,0 +1,373 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Sat, 26 Oct 2024 12:33:57 +0900
Subject: [PATCH] Implement Rail Optimazition
Based on EasterGhost/RailOptimization, Original by FxMorin.
Copyright (C) 2024 EasterGhost, Licensed under GPL v3.
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 <http://www.gnu.org/licenses/>.
diff --git a/src/main/java/ca/fxco/railoptimization/RailLogic.java b/src/main/java/ca/fxco/railoptimization/RailLogic.java
new file mode 100644
index 0000000000000000000000000000000000000000..6c0a70c8902623991977c19a1c649488c9ad4afa
--- /dev/null
+++ b/src/main/java/ca/fxco/railoptimization/RailLogic.java
@@ -0,0 +1,302 @@
+package ca.fxco.railoptimization;
+
+import net.minecraft.core.BlockPos;
+import net.minecraft.core.Direction;
+import net.minecraft.world.level.Level;
+import net.minecraft.world.level.block.Block;
+import net.minecraft.world.level.block.PoweredRailBlock;
+import net.minecraft.world.level.block.state.BlockState;
+import net.minecraft.world.level.block.state.properties.RailShape;
+
+import java.util.HashMap;
+
+import static net.minecraft.world.level.block.PoweredRailBlock.POWERED;
+import static net.minecraft.world.level.block.PoweredRailBlock.SHAPE;
+import static net.minecraft.world.level.redstone.ExperimentalRedstoneUtils.initialOrientation;
+
+public class RailLogic {
+
+ private static final Direction[] EAST_WEST_DIR = new Direction[]{Direction.WEST, Direction.EAST};
+ private static final Direction[] NORTH_SOUTH_DIR = new Direction[]{Direction.SOUTH, Direction.NORTH};
+
+ private static final int UPDATE_FORCE_PLACE = Block.UPDATE_MOVE_BY_PISTON | Block.UPDATE_KNOWN_SHAPE | Block.UPDATE_CLIENTS;
+
+ public static void customUpdateState(PoweredRailBlock self, BlockState state, Level level, BlockPos pos) {
+ boolean shouldBePowered = level.hasNeighborSignal(pos) ||
+ self.findPoweredRailSignal(level, pos, state, true, 0) ||
+ self.findPoweredRailSignal(level, pos, state, false, 0);
+ if (shouldBePowered == state.getValue(POWERED)) return;
+
+ RailShape railShape = state.getValue(SHAPE);
+ if (railShape.isSlope()) {
+ level.setBlock(pos, state.setValue(POWERED, shouldBePowered), 3);
+ level.updateNeighborsAtExceptFromFacing(pos.below(), self, Direction.UP, initialOrientation(level, Direction.DOWN, Direction.UP));
+ level.updateNeighborsAtExceptFromFacing(pos.above(), self, Direction.DOWN, initialOrientation(level, Direction.UP, Direction.DOWN)); //isAscending
+ return;
+ }
+
+ if (shouldBePowered) powerLane(self, level, pos, state, railShape);
+ else dePowerLane(self, level, pos, state, railShape);
+ }
+
+ private static void giveShapeUpdate(Level level, BlockState state, BlockPos pos, BlockPos fromPos, Direction direction) {
+ BlockState oldState = level.getBlockState(pos);
+ Block.updateOrDestroy(
+ oldState,
+ oldState.updateShape(level, level, pos, direction.getOpposite(), fromPos, state, level.getRandom()),
+ level,
+ pos,
+ Block.UPDATE_CLIENTS & -34,
+ 0
+ );
+ }
+
+ private static boolean findPoweredRailSignalFaster(PoweredRailBlock self, Level level, BlockPos pos, boolean bl, int distance, RailShape shape, HashMap<BlockPos,Boolean> checkedPos) {
+ BlockState blockState = level.getBlockState(pos);
+ if (checkedPos.containsKey(pos) && checkedPos.get(pos))
+ return level.hasNeighborSignal(pos) || findPoweredRailSignalFaster(self, level, pos, blockState, bl, distance + 1, checkedPos);
+
+ if (!blockState.is(self)) return false;
+
+ RailShape railShape = blockState.getValue(SHAPE);
+ if (shape == RailShape.EAST_WEST && (railShape == RailShape.NORTH_SOUTH || railShape == RailShape.ASCENDING_NORTH || railShape == RailShape.ASCENDING_SOUTH) ||
+ shape == RailShape.NORTH_SOUTH && (railShape == RailShape.EAST_WEST || railShape == RailShape.ASCENDING_EAST || railShape == RailShape.ASCENDING_WEST)) {
+ return false;
+ }
+
+ if (!blockState.getValue(POWERED)) return false;
+
+ return level.hasNeighborSignal(pos) ||
+ findPoweredRailSignalFaster(self, level, pos, blockState, bl, distance + 1, checkedPos);
+ }
+
+ private static boolean findPoweredRailSignalFaster(PoweredRailBlock self, Level level, BlockPos pos, BlockState state, boolean bl, int distance, HashMap<BlockPos, Boolean> checkedPos) {
+ if (distance >= level.purpurConfig.railActivationRange) return false;
+
+ int x = pos.getX();
+ int y = pos.getY();
+ int z = pos.getZ();
+ boolean bl2 = true;
+ RailShape railShape = state.getValue(SHAPE);
+
+ switch (railShape.ordinal()) {
+ case 0 -> {
+ if (bl) ++z;
+ else --z;
+ }
+ case 1 -> {
+ if (bl) --x;
+ else ++x;
+ }
+ case 2 -> {
+ if (bl) {
+ --x;
+ } else {
+ ++x;
+ ++y;
+ bl2 = false;
+ }
+ railShape = RailShape.EAST_WEST;
+ }
+ case 3 -> {
+ if (bl) {
+ --x;
+ ++y;
+ bl2 = false;
+ } else {
+ ++x;
+ }
+ railShape = RailShape.EAST_WEST;
+ }
+ case 4 -> {
+ if (bl) {
+ ++z;
+ } else {
+ --z;
+ ++y;
+ bl2 = false;
+ }
+ railShape = RailShape.NORTH_SOUTH;
+ }
+ case 5 -> {
+ if (bl) {
+ ++z;
+ ++y;
+ bl2 = false;
+ } else {
+ --z;
+ }
+ railShape = RailShape.NORTH_SOUTH;
+ }
+ }
+ return findPoweredRailSignalFaster(self, level, new BlockPos(x, y, z), bl, distance, railShape, checkedPos) ||
+ (bl2 && findPoweredRailSignalFaster(self, level, new BlockPos(x, y - 1, z), bl, distance, railShape, checkedPos));
+ }
+
+ private static void powerLane(PoweredRailBlock self, Level level, BlockPos pos, BlockState state, RailShape shape) {
+ level.setBlock(pos, state.setValue(POWERED, true), UPDATE_FORCE_PLACE);
+ HashMap<BlockPos,Boolean> checkedPos = new HashMap<>();
+ checkedPos.put(pos, true);
+ int[] count = new int[2];
+ if (shape == RailShape.NORTH_SOUTH) { //Order: +z, -z
+ for (int i = 0; i < NORTH_SOUTH_DIR.length; ++i) {
+ setRailPositionsPower(self, level, pos, checkedPos, count, i, NORTH_SOUTH_DIR[i]);
+ }
+ updateRailsNS(self, level, pos, state, count);
+ } else if (shape == RailShape.EAST_WEST) { //Order: -x, +x
+ for (int i = 0; i < EAST_WEST_DIR.length; ++i) {
+ setRailPositionsPower(self, level, pos, checkedPos, count, i, EAST_WEST_DIR[i]);
+ }
+ updateRailsEW(self, level, pos, state, count);
+ }
+ }
+
+ private static void dePowerLane(PoweredRailBlock self, Level level, BlockPos pos, BlockState state, RailShape shape) {
+ level.setBlock(pos, state.setValue(POWERED, false), UPDATE_FORCE_PLACE);
+ int[] count = new int[2];
+ if (shape == RailShape.NORTH_SOUTH) { //Order: +z, -z
+ for (int i = 0; i < NORTH_SOUTH_DIR.length; ++i) {
+ setRailPositionsDePower(self, level, pos, count, i, NORTH_SOUTH_DIR[i]);
+ }
+ updateRailsNS(self, level, pos, state, count);
+ } else if (shape == RailShape.EAST_WEST) { //Order: -x, +x
+ for (int i = 0; i < EAST_WEST_DIR.length; ++i) {
+ setRailPositionsDePower(self, level, pos, count, i, EAST_WEST_DIR[i]);
+ }
+ updateRailsEW(self, level, pos, state, count);
+ }
+ }
+
+ private static void setRailPositionsPower(PoweredRailBlock self, Level level, BlockPos pos, HashMap<BlockPos, Boolean> checkedPos, int[] count, int i, Direction dir) {
+ for (int z = 1; z < level.purpurConfig.railActivationRange; z++) {
+ BlockPos newPos = pos.relative(dir, z);
+ BlockState state = level.getBlockState(newPos);
+
+ if (checkedPos.containsKey(newPos)) {
+ if (!checkedPos.get(newPos)) break;
+ count[i]++;
+ continue;
+ }
+
+ if (!state.is(self) || state.getValue(POWERED) || !(
+ level.hasNeighborSignal(newPos) ||
+ findPoweredRailSignalFaster(self, level, newPos, state, true, 0, checkedPos) ||
+ findPoweredRailSignalFaster(self, level, newPos, state, false, 0, checkedPos)
+ )) {
+ checkedPos.put(newPos,false);
+ break;
+ }
+
+ checkedPos.put(newPos,true);
+ level.setBlock(newPos, state.setValue(POWERED, true), UPDATE_FORCE_PLACE);
+ count[i]++;
+ }
+ }
+
+ private static void setRailPositionsDePower(PoweredRailBlock self, Level level, BlockPos pos, int[] count, int i, Direction dir) {
+ for (int z = 1; z < level.purpurConfig.railActivationRange; z++) {
+ BlockPos newPos = pos.relative(dir, z);
+ BlockState state = level.getBlockState(newPos);
+ if (!state.is(self) || !state.getValue(POWERED) || level.hasNeighborSignal(newPos) ||
+ self.findPoweredRailSignal(level, newPos, state, true, 0) ||
+ self.findPoweredRailSignal(level, newPos, state, false, 0)) break;
+ level.setBlock(newPos, state.setValue(POWERED, false), UPDATE_FORCE_PLACE);
+ count[i]++;
+ }
+ }
+
+ private static void shapeUpdateEnd(PoweredRailBlock self, Level level, BlockPos pos, BlockState state, int endPos, Direction direction, int currentPos, BlockPos blockPos) {
+ if (currentPos != endPos) return;
+
+ BlockPos newPos = pos.relative(direction, currentPos+1);
+ giveShapeUpdate(level, state, newPos, pos, direction);
+
+ BlockState blockState = level.getBlockState(blockPos);
+ if (blockState.is(self) && blockState.getValue(SHAPE).isSlope()) giveShapeUpdate(level, state, newPos.above(), pos, direction);
+ }
+
+ private static void neighborUpdateEnd(PoweredRailBlock self, Level level, BlockPos pos, int endPos, Direction dir, Block block, int currentPos, BlockPos blockPos) {
+ if (currentPos != endPos) return;
+
+ BlockPos newPos = pos.relative(dir, currentPos+1);
+ level.neighborChanged(newPos, block, null); // TODO: Orientation
+
+ BlockState blockState = level.getBlockState(blockPos);
+ if (blockState.is(self) && blockState.getValue(SHAPE).isSlope()) level.neighborChanged(newPos.above(), block, null); // TODO: Orientation
+ }
+
+ private static void updateRailsNeighborEW(PoweredRailBlock self, Level level, BlockPos pos, int c, Block block, Direction dir, int[] count, int countAmt) {
+ BlockPos pos1 = pos.relative(dir, c);
+ if (c == 0 && count[1] == 0) level.neighborChanged(pos1.relative(dir.getOpposite()), block, null); // TODO: Orientation
+ neighborUpdateEnd(self, level, pos, countAmt, dir, block, c, pos1);
+ level.neighborChanged(pos1.below(), block, null); // TODO: Orientation
+ level.neighborChanged(pos1.above(), block, null); // TODO: Orientation
+ level.neighborChanged(pos1.north(), block, null); // TODO: Orientation
+ level.neighborChanged(pos1.south(), block, null); // TODO: Orientation
+ BlockPos pos2 = pos.relative(dir, c).below();
+ level.neighborChanged(pos2.below(), block, null); // TODO: Orientation
+ level.neighborChanged(pos2.north(), block, null); // TODO: Orientation
+ level.neighborChanged(pos2.south(), block, null); // TODO: Orientation
+ if (c == countAmt) level.neighborChanged(pos.relative(dir, c + 1).below(), block, null); // TODO: Orientation
+ if (c == 0 && count[1] == 0) level.neighborChanged(pos1.relative(dir.getOpposite()).below(), block, null); // TODO: Orientation
+ }
+
+ private static void updateRailsSectionEW(PoweredRailBlock self, Level level, BlockPos pos, int c, BlockState mainState, Direction dir, int[] count, int countAmt) {
+ BlockPos blockPos = pos.relative(dir, c);
+ if (c == 0 && count[1] == 0) giveShapeUpdate(level, mainState, blockPos.relative(dir.getOpposite()), pos, dir.getOpposite());
+ shapeUpdateEnd(self, level, pos, mainState, countAmt, dir, c, blockPos);
+ giveShapeUpdate(level, mainState, blockPos.below(), pos, Direction.DOWN);
+ giveShapeUpdate(level, mainState, blockPos.above(), pos, Direction.UP);
+ giveShapeUpdate(level, mainState, blockPos.north(), pos, Direction.NORTH);
+ giveShapeUpdate(level, mainState, blockPos.south(), pos, Direction.SOUTH);
+ }
+
+ private static void updateRailsNeighborNS(PoweredRailBlock self, Level level, BlockPos pos, int c, Block block, Direction dir, int[] count, int countAmt) {
+ BlockPos pos1 = pos.relative(dir,c);
+ level.neighborChanged(pos1.west(), block, null); // TODO: Orientation
+ level.neighborChanged(pos1.east(), block, null); // TODO: Orientation
+ level.neighborChanged(pos1.below(), block, null); // TODO: Orientation
+ level.neighborChanged(pos1.above(), block, null); // TODO: Orientation
+ neighborUpdateEnd(self, level, pos, countAmt, dir, block, c, pos1);
+ if (c == 0 && count[1] == 0) level.neighborChanged(pos1.relative(dir.getOpposite()), block, null); // TODO: Orientation
+ BlockPos pos2 = pos.relative(dir,c).below();
+ level.neighborChanged(pos2.west(), block, null); // TODO: Orientation
+ level.neighborChanged(pos2.east(), block, null); // TODO: Orientation
+ level.neighborChanged(pos2.below(), block, null); // TODO: Orientation
+ if (c == countAmt) level.neighborChanged(pos.relative(dir,c + 1).below(), block, null); // TODO: Orientation
+ if (c == 0 && count[1] == 0) level.neighborChanged(pos1.relative(dir.getOpposite()).below(), block, null); // TODO: Orientation
+ }
+
+ private static void updateRailsSectionNS(PoweredRailBlock self, Level level, BlockPos pos, int c, BlockState state, Direction dir, int[] count, int countAmt) {
+ BlockPos blockPos = pos.relative(dir, c);
+ giveShapeUpdate(level, state, blockPos.west(), pos, Direction.WEST);
+ giveShapeUpdate(level, state, blockPos.east(), pos, Direction.EAST);
+ giveShapeUpdate(level, state, blockPos.below(), pos, Direction.DOWN);
+ giveShapeUpdate(level, state, blockPos.above(), pos, Direction.UP);
+ shapeUpdateEnd(self, level, pos, state, countAmt, dir, c, blockPos);
+ if (c == 0 && count[1] == 0) giveShapeUpdate(level, state, blockPos.relative(dir.getOpposite()), pos, dir.getOpposite());
+ }
+
+ private static void updateRailsEW(PoweredRailBlock self, Level level, BlockPos pos, BlockState state, int[] count) {
+ for (int i = 0; i < EAST_WEST_DIR.length; ++i) {
+ int countAmt = count[i];
+ if (i == 1 && countAmt == 0) continue;
+ Direction dir = EAST_WEST_DIR[i];
+ Block block = state.getBlock();
+ for (int c = countAmt; c >= i; c--) updateRailsNeighborEW(self, level, pos, c, block, dir, count, countAmt);
+ for (int c = countAmt; c >= i; c--) updateRailsSectionEW(self, level, pos, c, state, dir, count, countAmt);
+ }
+ }
+
+ private static void updateRailsNS(PoweredRailBlock self, Level level, BlockPos pos, BlockState state, int[] count) {
+ for (int i = 0; i < NORTH_SOUTH_DIR.length; ++i) {
+ int countAmt = count[i];
+ if (i == 1 && countAmt == 0) continue;
+ Direction dir = NORTH_SOUTH_DIR[i];
+ Block block = state.getBlock();
+ for (int c = countAmt; c >= i; c--) updateRailsNeighborNS(self, level, pos, c, block, dir, count, countAmt);
+ for (int c = countAmt; c >= i; c--) updateRailsSectionNS(self, level, pos, c, state, dir, count, countAmt);
+ }
+ }
+
+}
diff --git a/src/main/java/net/minecraft/world/level/block/PoweredRailBlock.java b/src/main/java/net/minecraft/world/level/block/PoweredRailBlock.java
index bd14c08defe8afc5ceca59d16a5b1dbad178f594..99dc44c569b6003b271ce2ea3f80cb194173ff95 100644
--- a/src/main/java/net/minecraft/world/level/block/PoweredRailBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/PoweredRailBlock.java
@@ -29,7 +29,7 @@ public class PoweredRailBlock extends BaseRailBlock {
this.registerDefaultState((BlockState) ((BlockState) ((BlockState) ((BlockState) this.stateDefinition.any()).setValue(PoweredRailBlock.SHAPE, RailShape.NORTH_SOUTH)).setValue(PoweredRailBlock.POWERED, false)).setValue(PoweredRailBlock.WATERLOGGED, false));
}
- protected boolean findPoweredRailSignal(Level world, BlockPos pos, BlockState state, boolean flag, int distance) {
+ public boolean findPoweredRailSignal(Level world, BlockPos pos, BlockState state, boolean flag, int distance) { // Plazma - protected -> public
if (distance >= world.purpurConfig.railActivationRange) { // Purpur
return false;
} else {
@@ -117,6 +117,12 @@ public class PoweredRailBlock extends BaseRailBlock {
@Override
protected void updateState(BlockState state, Level world, BlockPos pos, Block neighbor) {
+ // Plazma start - Optimize powered rail processing
+ if (world.plazmaConfig().block.rail.useFasterSignalSearch) {
+ ca.fxco.railoptimization.RailLogic.customUpdateState(this, state, world, pos);
+ return;
+ }
+ // Plazma end - Optimize powered rail processing
boolean flag = (Boolean) state.getValue(PoweredRailBlock.POWERED);
boolean flag1 = world.hasNeighborSignal(pos) || this.findPoweredRailSignal(world, pos, state, true, 0) || this.findPoweredRailSignal(world, pos, state, false, 0);
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
index 9cfab16b9cdf40ccb709c0af66c406954560c0ef..0e27e4a1f767842d1dcd2ed235a6a45f120bf32e 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
@@ -72,6 +72,13 @@ public class WorldConfigurations extends ConfigurationPart {
}
+ public Rail rail;
+ public class Rail extends ConfigurationPart {
+
+ public boolean useFasterSignalSearch = OPTIMIZE;
+
+ }
+
}
public Item item;

View File

@@ -0,0 +1,69 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Sat, 26 Oct 2024 18:09:08 +0900
Subject: [PATCH] Load player data asynchronously
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index 16069b9cbf6c7679c28a2e9a54e77d23cd10e541..bb10892f33ba0d7fc3959debef1045073868f8b8 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -76,7 +76,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
// CraftBukkit end
private static final AtomicInteger UNIQUE_THREAD_ID = new AtomicInteger(0);
static final Logger LOGGER = LogUtils.getLogger();
- private static final java.util.concurrent.ExecutorService authenticatorPool = java.util.concurrent.Executors.newCachedThreadPool(new com.google.common.util.concurrent.ThreadFactoryBuilder().setNameFormat("User Authenticator #%d").setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(LOGGER)).build()); // Paper - Cache authenticator threads
+ public static final java.util.concurrent.ExecutorService authenticatorPool = java.util.concurrent.Executors.newCachedThreadPool(new com.google.common.util.concurrent.ThreadFactoryBuilder().setNameFormat("User Authenticator #%d").setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(LOGGER)).build()); // Paper - Cache authenticator threads // Plazma - private -> public
private static final int MAX_TICKS_BEFORE_LOGIN = 600;
private final byte[] challenge;
final MinecraftServer server;
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index be4a5407fe9b692b72eb2b85e2dea160a0555bca..579f81ed04eeb6373b25e6794d3bf0c403891011 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -183,6 +183,16 @@ public abstract class PlayerList {
abstract public void loadAndSaveFiles(); // Paper - fix converting txt to json file; moved from DedicatedPlayerList constructor
public void placeNewPlayer(Connection connection, ServerPlayer player, CommonListenerCookie clientData) {
+ // Plazma start - load player information asynchronously
+ if (!org.plazmamc.plazma.configurations.GlobalConfiguration.get().player.loadAsynchronously)
+ this.placeNewPlayer(connection, player, clientData, this.load(player));
+ else java.util.concurrent.CompletableFuture
+ .supplyAsync(() -> this.load(player), net.minecraft.server.network.ServerLoginPacketListenerImpl.authenticatorPool)
+ .thenAcceptAsync(nbt -> this.placeNewPlayer(connection, player, clientData, nbt), this.server);
+ }
+
+ private void placeNewPlayer(Connection connection, ServerPlayer player, CommonListenerCookie clientData, Optional<CompoundTag> optional) {
+ // Plazma end - load player information asynchronously
player.isRealPlayer = true; // Paper
player.loginTime = System.currentTimeMillis(); // Paper - Replace OfflinePlayer#getLastPlayed
GameProfile gameprofile = player.getGameProfile();
@@ -191,14 +201,13 @@ public abstract class PlayerList {
String s;
if (usercache != null) {
- Optional<GameProfile> optional = usercache.get(gameprofile.getId()); // CraftBukkit - decompile error
- s = (String) optional.map(GameProfile::getName).orElse(gameprofile.getName());
+ s = usercache.get(gameprofile.getId()).map(GameProfile::getName).orElse(gameprofile.getName()); // CraftBukkit - decompile error // Plazma - varname conflict
usercache.add(gameprofile);
} else {
s = gameprofile.getName();
}
- Optional<CompoundTag> optional = this.load(player); // CraftBukkit - decompile error
+ // Optional<CompoundTag> optional = this.load(player); // CraftBukkit - decompile error // Plazma - extract
ResourceKey<Level> resourcekey = null; // Paper
// CraftBukkit start - Better rename detection
if (optional.isPresent()) {
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
index 193e565b6d62caf278223db033351d03ff417637..7f30fa1928e1a7e59ee5acfdfd2334f810c30243 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
@@ -38,6 +38,7 @@ public class GlobalConfiguration extends ConfigurationPart {
public class Player extends ConfigurationPart {
public boolean checkSpectatorMovedToQuickly = !OPTIMIZE;
+ public boolean loadAsynchronously = OPTIMIZE;
public FreedomChat freedomChat;
public class FreedomChat extends ConfigurationPart {

View File

@@ -1,69 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Wed, 15 May 2024 14:30:55 +0900
Subject: [PATCH] Add some missing Pufferfish configurations
diff --git a/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java b/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java
index f8790ab5b7c1279719271ee57c00f4f2d6ce9714..9a9d6c05ceb5b62c4c0c72f64b047f783ae4aeb6 100644
--- a/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java
+++ b/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java
@@ -128,9 +128,11 @@ public class Armadillo extends Animal {
return ArmadilloAi.makeBrain(this.brainProvider().makeBrain(dynamic));
}
+ private int behaviorTick; // Plazma - Add missing pufferfish configurations
@Override
protected void customServerAiStep() {
//this.level().getProfiler().push("armadilloBrain"); // Purpur
+ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Plazma - Add missing pufferfish configurations
((Brain<Armadillo>) this.brain).tick((ServerLevel) this.level(), this); // CraftBukkit - decompile error
//this.level().getProfiler().pop(); // Purpur
//this.level().getProfiler().push("armadilloActivityUpdate"); // Purpur
diff --git a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
index fdc3aa9672077787e841d240fe1e690dcd9ca321..47d5db93adbb740c7b29dd9059bd31be91097a17 100644
--- a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
+++ b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
@@ -161,11 +161,13 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Saddl
return pose == Pose.SITTING ? Camel.SITTING_DIMENSIONS.scale(this.getAgeScale()) : super.getDefaultDimensions(pose);
}
+ private int behaviorTick = 0; // Plazma - Add missing pufferfish configurations
@Override
protected void customServerAiStep() {
//this.level().getProfiler().push("camelBrain"); // Purpur
Brain<Camel> behaviorcontroller = (Brain<Camel>) this.getBrain(); // CraftBukkit - decompile error
+ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Plazma - Add missing pufferfish configurations
behaviorcontroller.tick((ServerLevel) this.level(), this);
//this.level().getProfiler().pop(); // Purpur
//this.level().getProfiler().push("camelActivityUpdate"); // Purpur
diff --git a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
index a2cc1efaa621861828b007759536ac49d7e3646e..6637bdb953428473edd3429740c75b67b634059a 100644
--- a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
+++ b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
@@ -514,9 +514,11 @@ public class Sniffer extends Animal {
return Brain.provider(SnifferAi.MEMORY_TYPES, SnifferAi.SENSOR_TYPES);
}
+ private int behaviorTick; // Plazma - Add missing pufferfish configurations
@Override
protected void customServerAiStep() {
//this.level().getProfiler().push("snifferBrain"); // Purpur
+ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Plazma - Add missing pufferfish configurations
this.getBrain().tick((ServerLevel) this.level(), this);
//this.level().getProfiler().popPush("snifferActivityUpdate"); // Purpur
SnifferAi.updateActivity(this);
diff --git a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
index 524d2304a1dbc873a47c95c55ad70c4120f07ad4..c9a8cbcaae0693c63ccdd05d271a524524c36754 100644
--- a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
+++ b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
@@ -318,7 +318,7 @@ public class Warden extends Monster implements VibrationSystem {
ServerLevel worldserver = (ServerLevel) this.level();
//worldserver.getProfiler().push("wardenBrain"); // Purpur
- if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish
+ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Plazma - Add missing pufferfish configurations
this.getBrain().tick(worldserver, this);
//this.level().getProfiler().pop(); // Purpur
super.customServerAiStep();

View File

@@ -0,0 +1,847 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Sat, 26 Oct 2024 18:30:26 +0900
Subject: [PATCH] Configurable RandomSource factory/provider
Xorshift Random: https://gist.github.com/Xyene/4637619
Based on AnOpenSauceDev/FastRandom
Copyright (C) 2024 AnOpenSauceDev
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java
index 861bff267cb397e13e8e1c79bd0776b130c6e5da..266e56f2c2e6d8b760209b5d58c58333af5bd0c1 100644
--- a/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java
+++ b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java
@@ -21,7 +21,7 @@ import org.checkerframework.framework.qual.DefaultQualifier;
@DefaultQualifier(NonNull.class)
public class PaperLootableInventoryData {
- private static final Random RANDOM = new Random();
+ private static final Random RANDOM = java.util.concurrent.ThreadLocalRandom.current(); // Plazma - reduce creating random instance
private long lastFill = -1;
private long nextRefill = -1;
diff --git a/src/main/java/com/github/anopensaucedev/fasterrandom/util/math/random/RandomGeneratorRandom.java b/src/main/java/com/github/anopensaucedev/fasterrandom/util/math/random/RandomGeneratorRandom.java
new file mode 100644
index 0000000000000000000000000000000000000000..a060fdbdc4daaffd9aafc707dc567cb56067d1e2
--- /dev/null
+++ b/src/main/java/com/github/anopensaucedev/fasterrandom/util/math/random/RandomGeneratorRandom.java
@@ -0,0 +1,115 @@
+package com.github.anopensaucedev.fasterrandom.util.math.random;
+
+import com.google.common.annotations.VisibleForTesting;
+import net.minecraft.core.BlockPos;
+import net.minecraft.util.Mth;
+import net.minecraft.world.level.levelgen.BitRandomSource;
+import net.minecraft.world.level.levelgen.PositionalRandomFactory;
+import net.minecraft.util.RandomSource;
+import org.jspecify.annotations.NonNull;
+
+import java.util.random.RandomGenerator;
+import java.util.random.RandomGeneratorFactory;
+
+public class RandomGeneratorRandom implements BitRandomSource {
+ private static final @NonNull RandomGeneratorFactory<RandomGenerator.SplittableGenerator> FACTORY = RandomGeneratorFactory.of(org.plazmamc.plazma.Options.RANDOM_ALGOL);
+ private static final int INT_BITS = 48;
+ private static final long SEED_MASK = 0xFFFFFFFFFFFFL;
+ private static final long MULTIPLIER = 25214903917L;
+ private static final long INCREMENT = 11L;
+
+ private long seed;
+ private RandomGenerator.SplittableGenerator randomGenerator;
+
+ public RandomGeneratorRandom(long seed) {
+ this.seed = seed;
+ this.randomGenerator = FACTORY.create(seed);
+ }
+
+ @Override
+ public @NonNull RandomSource fork() {
+ return new RandomGeneratorRandom(this.nextLong());
+ }
+
+ @Override
+ public @NonNull PositionalRandomFactory forkPositional() {
+ return new RandomGeneratorRandomFactory(this.nextLong());
+ }
+
+ @Override
+ public void setSeed(long seed) {
+ this.seed = seed;
+ this.randomGenerator = FACTORY.create(seed);
+ }
+
+ @Override
+ public int next(int bits) {
+ // >>> instead of Mojang's >> fixes MC-239059
+ return (int) ((seed * MULTIPLIER + INCREMENT & SEED_MASK) >>> INT_BITS - bits);
+ }
+
+ @Override
+ public int nextInt() {
+ return randomGenerator.nextInt();
+ }
+
+ @Override
+ public int nextInt(int bound) {
+ return randomGenerator.nextInt(bound);
+ }
+
+ @Override
+ public long nextLong() {
+ return randomGenerator.nextLong();
+ }
+
+ @Override
+ public boolean nextBoolean() {
+ return randomGenerator.nextBoolean();
+ }
+
+ @Override
+ public float nextFloat() {
+ return randomGenerator.nextFloat();
+ }
+
+ @Override
+ public double nextDouble() {
+ return randomGenerator.nextDouble();
+ }
+
+ @Override
+ public double nextGaussian() {
+ return randomGenerator.nextGaussian();
+ }
+
+ private record RandomGeneratorRandomFactory(long seed) implements PositionalRandomFactory {
+ @SuppressWarnings("deprecation")
+ @Override
+ public @NonNull RandomSource at(int x, int y, int z) {
+ return new RandomGeneratorRandom(Mth.getSeed(x, y, z) ^ this.seed);
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public @NonNull RandomSource at(final @NonNull BlockPos pos) {
+ return new RandomGeneratorRandom(Mth.getSeed(pos.getX(), pos.getY(), pos.getZ()) ^ this.seed);
+ }
+
+ @Override
+ public @NonNull RandomSource fromHashOf(@NonNull String seed) {
+ return new RandomGeneratorRandom((long) seed.hashCode() ^ this.seed);
+ }
+
+ @Override
+ public @NonNull RandomSource fromSeed(final long seed) {
+ return new RandomGeneratorRandom(seed);
+ }
+
+ @Override
+ @VisibleForTesting
+ public void parityConfigString(@NonNull StringBuilder info) {
+ info.append("RandomGeneratorRandom$RandomGeneratorRandomFactory{").append(this.seed).append("}");
+ }
+ }
+}
diff --git a/src/main/java/net/minecraft/util/RandomSource.java b/src/main/java/net/minecraft/util/RandomSource.java
index 252aef3ffe0fecd47ebea1ed7df48e14fa873eb9..f73f8faac05f90c646a23fadf3da565938a4f788 100644
--- a/src/main/java/net/minecraft/util/RandomSource.java
+++ b/src/main/java/net/minecraft/util/RandomSource.java
@@ -10,18 +10,39 @@ import net.minecraft.world.level.levelgen.ThreadSafeLegacyRandomSource;
public interface RandomSource {
@Deprecated
double GAUSSIAN_SPREAD_FACTOR = 2.297;
+ // Plazma start - Implement RandomGenerator support
+ java.util.function.LongFunction<RandomSource> FACTORY = switch (org.plazmamc.plazma.Options.RANDOM_FACTORY) {
+ case "legacy" -> LegacyRandomSource::new;
+ case "xoroshiro" -> net.minecraft.world.level.levelgen.XoroshiroRandomSource::new;
+ case "xorshift" -> org.plazmamc.plazma.util.random.XorshiftRandomSource::new;
+ case "secure" -> org.plazmamc.plazma.util.random.SecureRandomSource::new;
+ case "generator" -> {
+ try {
+ java.util.random.RandomGeneratorFactory.of(org.plazmamc.plazma.Options.RANDOM_ALGOL).create();
+ yield com.github.anopensaucedev.fasterrandom.util.math.random.RandomGeneratorRandom::new;
+ } catch (IllegalArgumentException ignored) {
+ net.minecraft.server.MinecraftServer.LOGGER.error("Your JDK does not support RandomGenerator! Update JDK or remove \"-DPlazma.randomSourceFactory\" from the startup flag");
+ net.minecraft.server.MinecraftServer.LOGGER.warn("Falling back to legacy random");
+ yield LegacyRandomSource::new;
+ }
+ }
+ default -> throw new IllegalArgumentException("Invalid RandomSource: " + org.plazmamc.plazma.Options.RANDOM_FACTORY + ". Valid RandomSources are: legacy, xoroshiro, xorshift, generator");
+ };
+ @org.jspecify.annotations.Nullable RandomSource SHARED = org.plazmamc.plazma.Options.SHARED_RANDOM ? create() : null;
+ // Plazma end - Implement RandomGenerator support
static RandomSource create() {
- return create(RandomSupport.generateUniqueSeed());
+ return SHARED == null ? create(RandomSupport.generateUniqueSeed()) : SHARED; // Plazma - Configurable RandomSource
}
@Deprecated
static RandomSource createThreadSafe() {
+ if (org.plazmamc.plazma.Options.NO_THREAD_SAFE) return create(); // Plazma - Configurable RandomSource
return new ThreadSafeLegacyRandomSource(RandomSupport.generateUniqueSeed());
}
static RandomSource create(long seed) {
- return new LegacyRandomSource(seed);
+ return org.plazmamc.plazma.Options.IGNORE_SEED ? create() : FACTORY.apply(seed); // Plazma - Configurable RandomSource
}
static RandomSource createNewThreadLocalInstance() {
diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java
index 27a6de70530c2a1cbe2f77a7fb493038121710ea..bbe093f7d5e0dc8e875f237058aa74c739967dd9 100644
--- a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java
+++ b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java
@@ -395,7 +395,7 @@ public class PiglinAi {
}
private static boolean wantsToDance(LivingEntity piglin, LivingEntity target) {
- return target.getType() != EntityType.HOGLIN ? false : RandomSource.create(piglin.level().getGameTime()).nextFloat() < 0.1F;
+ return target.getType() != EntityType.HOGLIN ? false : (org.plazmamc.plazma.Options.SHARED_RANDOM ? piglin.random.nextFloat() : RandomSource.create(piglin.level().getGameTime()).nextFloat()) < 0.1F; // Plazma - reduce creating random instance
}
protected static boolean wantsToPickup(Piglin piglin, ItemStack stack) {
diff --git a/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java
index 0e4c17c7246093d7fdb64a8f98536a84a8cfd978..0147a7be5fd147ffa9bd42a90e85a324bc317a81 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java
@@ -343,7 +343,7 @@ public class StructureBlockEntity extends BlockEntity {
}
public static RandomSource createRandom(long seed) {
- return seed == 0L ? RandomSource.create(Util.getMillis()) : RandomSource.create(seed);
+ return seed == 0L ? RandomSource.create() : RandomSource.create(seed); // Plazma - reduce creating random instance
}
public boolean placeStructureIfSameSize(ServerLevel world) {
diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructurePlaceSettings.java b/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructurePlaceSettings.java
index f1e0d3d7b1f458fcce83cf67762a16309123cdcb..6a8d5948f127ea87a0b4554ece4ad2c4c49a47c6 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructurePlaceSettings.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructurePlaceSettings.java
@@ -120,7 +120,7 @@ public class StructurePlaceSettings {
}
public RandomSource getRandom(@Nullable BlockPos pos) {
- return this.random != null ? this.random : (pos == null ? RandomSource.create(Util.getMillis()) : RandomSource.create(Mth.getSeed(pos)));
+ return this.random != null ? this.random : (pos == null ? RandomSource.create() : RandomSource.create(Mth.getSeed(pos))); // Plazma - reduce creating random instance
}
public boolean isIgnoreEntities() {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 907fe00ab752ad124020755f211567af771b9d70..e041752bbcba5cefce0dde8db917510129d29987 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -288,7 +288,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
}
// Paper end
- private static final Random rand = new Random();
+ private static final Random rand = java.util.concurrent.ThreadLocalRandom.current(); // Plazma - reduce creating random instance
public CraftWorld(ServerLevel world, ChunkGenerator gen, BiomeProvider biomeProvider, Environment env) {
this.world = world;
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
index 759b6e54db93792c9862b1f1625118ac6fa49d7a..e81fa9aefc76af906ed1b6903f416f4d123689f5 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java
@@ -14,7 +14,7 @@ import org.bukkit.inventory.meta.FireworkMeta;
public class CraftFirework extends CraftProjectile implements Firework {
- private final Random random = new Random();
+ private final net.minecraft.util.RandomSource random = net.minecraft.util.RandomSource.create(); // Plazma - Configurable RandomSource
//private CraftItemStack item; // Paper - Remove usage, not accurate representation of current item.
public CraftFirework(CraftServer server, FireworkRocketEntity entity) {
diff --git a/src/main/java/org/plazmamc/plazma/Options.java b/src/main/java/org/plazmamc/plazma/Options.java
index e7092aeb5abce5aa5f9bd434adc6acd4e43dec13..5673e587247d0cd644e694ca68bdbb340676a73d 100644
--- a/src/main/java/org/plazmamc/plazma/Options.java
+++ b/src/main/java/org/plazmamc/plazma/Options.java
@@ -11,5 +11,10 @@ public interface Options {
boolean VANILLAIZE = getBoolean("Plazma.vanillaize") && !AGGRESSIVE;
boolean USE_VANILLA = getBoolean("Plazma.useVanillaConfiguration") && !AGGRESSIVE && NO_OPTIMIZE;
boolean VANILLA_ICO = getBoolean("Plazma.useVanillaFavicon");
+ String RANDOM_FACTORY = getProperty("Plazma.randomSourceFactory", "legacy");
+ String RANDOM_ALGOL = getProperty("Plazma.randomSourceAlgorithm", "L64X128MixRandom");
+ boolean SHARED_RANDOM = getBoolean("Plazma.sharedRandomSource");
+ boolean IGNORE_SEED = getBoolean("Plazma.ignoreSeed") && SHARED_RANDOM;
+ boolean NO_THREAD_SAFE = getBoolean("Plazma.overrideThreadSafeRandom");
}
diff --git a/src/main/java/org/plazmamc/plazma/util/random/SecureRandomSource.java b/src/main/java/org/plazmamc/plazma/util/random/SecureRandomSource.java
new file mode 100644
index 0000000000000000000000000000000000000000..5d08f040a05df5d24f4bf9747177c1720fe246fe
--- /dev/null
+++ b/src/main/java/org/plazmamc/plazma/util/random/SecureRandomSource.java
@@ -0,0 +1,100 @@
+package org.plazmamc.plazma.util.random;
+
+import com.google.common.annotations.VisibleForTesting;
+import net.minecraft.core.BlockPos;
+import net.minecraft.util.Mth;
+import net.minecraft.util.RandomSource;
+import net.minecraft.world.level.levelgen.PositionalRandomFactory;
+import org.jetbrains.annotations.NotNull;
+import org.jspecify.annotations.NonNull;
+import java.security.SecureRandom;
+
+public class SecureRandomSource implements RandomSource {
+
+ private final SecureRandom random = new SecureRandom();
+
+ public SecureRandomSource(long seed) {
+ this.setSeed(seed);
+ }
+
+ @Override
+ public @NotNull RandomSource fork() {
+ return new SecureRandomSource(this.nextLong());
+ }
+
+ @Override
+ public @NotNull PositionalRandomFactory forkPositional() {
+ return new SecureRandomSourceFactory(this.nextLong());
+ }
+
+ @Override
+ public void setSeed(final long seed) {
+ this.random.setSeed(seed);
+ }
+
+ @Override
+ public int nextInt() {
+ return this.random.nextInt();
+ }
+
+ @Override
+ public int nextInt(final int bound) {
+ return this.random.nextInt(bound);
+ }
+
+ @Override
+ public long nextLong() {
+ return this.random.nextLong();
+ }
+
+ @Override
+ public boolean nextBoolean() {
+ return this.random.nextBoolean();
+ }
+
+ @Override
+ public float nextFloat() {
+ return this.random.nextFloat();
+ }
+
+ @Override
+ public double nextDouble() {
+ return this.random.nextDouble();
+ }
+
+ @Override
+ public double nextGaussian() {
+ return this.random.nextGaussian();
+ }
+
+ private record SecureRandomSourceFactory(long seed) implements PositionalRandomFactory {
+ @SuppressWarnings("deprecation")
+ @Override
+ public @NonNull RandomSource at(int x, int y, int z) {
+ return new SecureRandomSource(Mth.getSeed(x, y, z) ^ this.seed);
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public @NonNull RandomSource at(final @NonNull BlockPos pos) {
+ return new SecureRandomSource(Mth.getSeed(pos.getX(), pos.getY(), pos.getZ()) ^ this.seed);
+ }
+
+ @Override
+ public @NonNull RandomSource fromHashOf(@NonNull String seed) {
+ return new SecureRandomSource((long) seed.hashCode() ^ this.seed);
+ }
+
+ @Override
+ public @NonNull RandomSource fromSeed(final long seed) {
+ return new SecureRandomSource(seed);
+ }
+
+ @Override
+ @VisibleForTesting
+ public void parityConfigString(@NonNull StringBuilder info) {
+ info.append("SecureRandomSource$SecureRandomSourceFactory{").append(this.seed).append("}");
+ }
+ }
+
+}
diff --git a/src/main/java/org/plazmamc/plazma/util/random/XorshiftRandom.java b/src/main/java/org/plazmamc/plazma/util/random/XorshiftRandom.java
new file mode 100644
index 0000000000000000000000000000000000000000..d9f08546997adb7e4f9b70ce913a4e92eced3a95
--- /dev/null
+++ b/src/main/java/org/plazmamc/plazma/util/random/XorshiftRandom.java
@@ -0,0 +1,391 @@
+package org.plazmamc.plazma.util.random;
+
+import java.util.Random;
+
+/**
+ * A random number generator based on the simple and fast xor-shift pseudo
+ * random number generator (RNG) specified in:
+ * Marsaglia, George. (2003). <a href="https://web.archive.org/web/20070211044403/http://www.jstatsoft.org/v08/i14/xorshift.pdf">Xorshift RNGs.</a>
+ * Translated from: <a href="https://web.archive.org/web/20230919193645/https://www.codeproject.com/Articles/9187/A-fast-equivalent-for-System-Random">A fast equivalent for System.Random</a>.
+ * Original Code from: <a href="https://gist.github.com/Xyene/4637619">Xyene/Random.java</a>
+ */
+@SuppressWarnings("SuspiciousNameCombination")
+public class XorshiftRandom extends Random {
+ final double REAL_UNIT_INT = 1.0 / (0x7FFFFFFFL);
+ final double REAL_UNIT_UINT = 1.0 / (0xFFFFFFFFL);
+ final long Y = 842502087L, Z = 3579807591L, W = 273326509L;
+ long x, y, z, w;
+
+ public XorshiftRandom() {
+ seed((int) System.currentTimeMillis());
+ }
+
+ @Override
+ public void setSeed(long seed) {
+ seed((int) seed);
+ }
+
+ public void seed(int seed) {
+ // The only stipulation stated for the xorshift RNG is that at least one of
+ // the seeds x,y,z,w is non-zero. We fulfill that requirement by only allowing
+ // resetting of the x seed
+ x = seed;
+ y = Y;
+ z = Z;
+ w = W;
+ }
+
+ long boolBuffer;
+ int boolBufferBits = 0;
+
+ @Override
+ public boolean nextBoolean() {
+ if (boolBufferBits == 0) {
+ boolBuffer = nextUInt();
+ boolBufferBits = 32;
+ }
+ boolBuffer >>= 1;
+ boolean bit = (boolBuffer & 1) == 0;
+ --boolBufferBits;
+ return bit;
+ }
+
+ @Override
+ public void nextBytes(byte[] buffer) {
+ // Fill up the bulk of the buffer in chunks of 4 bytes at a time.
+ long x = this.x, y = this.y, z = this.z, w = this.w;
+ int i = 0;
+ long t;
+ for (int bound = buffer.length - 3; i < bound; ) {
+ // Generate 4 bytes.
+ // Increased performance is achieved by generating 4 random bytes per loop.
+ // Also note that no mask needs to be applied to zero out the higher order bytes before
+ // casting because the cast ignores thos bytes. Thanks to Stefan Trosch黷z for pointing this out.
+ t = (x ^ (x << 11));
+ x = y;
+ y = z;
+ z = w;
+ w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));
+
+ buffer[i++] = (byte) w;
+ buffer[i++] = (byte) (w >> 8);
+ buffer[i++] = (byte) (w >> 16);
+ buffer[i++] = (byte) (w >> 24);
+ }
+
+ // Fill up any remaining bytes in the buffer.
+ if (i < buffer.length) {
+ // Generate 4 bytes.
+ t = (x ^ (x << 11));
+ x = y;
+ y = z;
+ z = w;
+ w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));
+
+ buffer[i++] = (byte) w;
+ if (i < buffer.length) {
+ buffer[i++] = (byte) (w >> 8);
+ if (i < buffer.length) {
+ buffer[i++] = (byte) (w >> 16);
+ if (i < buffer.length) {
+ buffer[i] = (byte) (w >> 24);
+ }
+ }
+ }
+ }
+ this.x = x;
+ this.y = y;
+ this.z = z;
+ this.w = w;
+ }
+
+ @Override
+ public double nextDouble() {
+ long t = (x ^ (x << 11));
+ x = y;
+ y = z;
+ z = w;
+
+ // Here we can gain a 2x speed improvement by generating a value that can be cast to
+ // an int instead of the more easily available uint. If we then explicitly cast to an
+ // int the compiler will then cast the int to a double to perform the multiplication,
+ // this final cast is a lot faster than casting from a uint to a double. The extra cast
+ // to an int is very fast (the allocated bits remain the same) and so the overall effect
+ // of the extra cast is a significant performance improvement.
+ //
+ // Also note that the loss of one bit of precision is equivalent to what occurs within
+ // System.Random.
+ return (REAL_UNIT_INT * (int) (0x7FFFFFFF & (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)))));
+ }
+
+ public double random() {
+ return nextDouble();
+ }
+
+ @Override
+ public float nextFloat() {
+ return (float) nextDouble();
+ }
+
+ @Override
+ public int nextInt() {
+ long t = (x ^ (x << 11));
+ x = y;
+ y = z;
+ z = w;
+ return (int) (0x7FFFFFFF & (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8))));
+ }
+
+ @Override
+ public int nextInt(int upperBound) {
+ if (upperBound < 0)
+ throw new IllegalArgumentException("upperBound must be >=0");
+
+ long t = (x ^ (x << 11));
+ x = y;
+ y = z;
+ z = w;
+
+ return (int) ((REAL_UNIT_INT * (int) (0x7FFFFFFF & (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8))))) * upperBound);
+ }
+
+ public int nextInt(int lowerBound, int upperBound) {
+ if (lowerBound > upperBound)
+ throw new IllegalArgumentException("upperBound must be >=lowerBound");
+
+ long t = (x ^ (x << 11));
+ x = y;
+ y = z;
+ z = w;
+
+ // The explicit int cast before the first multiplication gives better performance.
+ // See comments in NextDouble.
+ int range = upperBound - lowerBound;
+ if (range < 0) {
+ // If range is <0 then an overflow has occured and must resort to using long integer arithmetic instead (slower).
+ // We also must use all 32 bits of precision, instead of the normal 31, which again is slower.
+ return lowerBound + (int) ((REAL_UNIT_UINT * (double) (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)))) * (double) ((long) upperBound - (long) lowerBound));
+ }
+ // 31 bits of precision will suffice if range<=int.MaxValue. This allows us to cast to an int and gain
+ // a little more performance.
+ return lowerBound + (int) ((REAL_UNIT_INT * (double) (int) (0x7FFFFFFF & (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8))))) * (double) range);
+ }
+
+ public long nextUInt() {
+ long t = (x ^ (x << 11));
+ x = y;
+ y = z;
+ z = w;
+ return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8))) & (0xFFFFFFFFL);
+ }
+
+ @Override
+ public long nextLong() {
+ return nextUInt() << 32 + nextUInt();
+ }
+
+ double gaussNext;
+ boolean hasGaussNext;
+ final double TWOPI = Math.PI * 2;
+
+ /**
+ * Get a random number in the range [min, max) or [min, max] depending on rounding.
+ *
+ * @param min Low bound
+ * @param max High bound
+ * @return A uniformly distributed double
+ */
+ public double uniform(double min, double max) {
+ return min + (max - min) * nextDouble();
+ }
+
+ /**
+ * Triangular distribution.
+ * <p/>
+ * Continuous distribution bounded by given lower and upper limits,
+ * and having a given mode value in-between.
+ * See: <a href="http://en.wikipedia.org/wiki/Triangular_distribution">Triangular distribution</a>
+ *
+ * @param low Low bound
+ * @param high High bound
+ * @param mode Mode
+ * @return A number from the triangular distribution specified
+ */
+ public double triangular(int low, int high, int mode) {
+ double u = nextDouble();
+ double c = (double) (mode - low) / (high - low);
+ if (u > c) {
+ u = 1.0 - u;
+ c = 1.0 - c;
+ int k = low;
+ low = high;
+ high = k;
+ }
+ return low + (high - low) * Math.sqrt(u * c);
+ }
+
+ /**
+ * Gaussian distribution, mean is 0 and standard deviation is 1.
+ * <p/>
+ * mu is the mean, and sigma is the standard deviation.
+ *
+ * @return A double in Gaussian distribution
+ */
+ public double gauss() {
+ return nextGaussian();
+ }
+
+ /**
+ * Gaussian distribution, with user-specified mean and standard deviation.
+ * <p/>
+ * mu is the mean, and sigma is the standard deviation.
+ *
+ * @return A double in Gaussian distribution
+ */
+ public double gauss(double mu, double sigma) {
+ return mu + sigma * nextGaussian();
+ }
+
+ public double gaussUnsigned(double mu, double sigma) {
+ double out = gauss(mu, sigma);
+ return out > 1 ? out : 1;
+ }
+
+ /**
+ * Log normal distribution.
+ * <p/>
+ * If you take the natural logarithm of this distribution, you'll get a
+ * normal distribution with mean mu and standard deviation sigma.
+ * mu can have any value, and sigma must be greater than zero.
+ *
+ * @param mu Mean
+ * @param sigma Standard deviation
+ * @return A number from the log normal distribution specified
+ */
+ public double logNormal(double mu, double sigma) {
+ return Math.exp(gauss(mu, sigma));
+ }
+
+ /**
+ * Exponential distribution.
+ * <p/>
+ * lambda is 1.0 divided by the desired mean. It should be
+ * nonzero. Returned values range from 0 to positive infinity
+ * if lambda is positive, and from negative infinity to 0
+ * if lambda is negative.
+ *
+ * @param lambda A non-zero value
+ */
+ public double exponential(double lambda) {
+ return -Math.log(1.0 - random()) / lambda;
+ }
+
+ /**
+ * Circular data distribution.
+ * <p/>
+ * If kappa is equal to zero, this distribution reduces
+ * to a uniform random angle over the range 0 to 2*pi.
+ *
+ * @param mu the mean angle, expressed in radians between 0 and 2*pi.
+ * @param kappa the concentration parameter, which must be greater than or
+ * equal to zero.
+ * @return A number from the circular data distribution specified
+ */
+ public double circularData(double mu, double kappa) {
+ if (kappa <= 1e-6)
+ return TWOPI * nextDouble();
+
+ double a = 1.0 + Math.sqrt(1.0 + 4.0 * kappa * kappa);
+ double b = (a - Math.sqrt(2.0 * a)) / (2.0 * kappa);
+ double r = (1.0 + b * b) / (2.0 * b);
+ double u1, u2, u3, f, c, z, theta = 0;
+
+ while (true) {
+ u1 = nextDouble();
+
+ z = Math.cos(Math.PI * u1);
+ f = (1.0 + r * z) / (r + z);
+ c = kappa * (r - f);
+
+ u2 = nextDouble();
+
+ if (u2 < c * (2.0 - c) || u2 <= c * Math.exp(1.0 - c))
+ break;
+
+ u3 = nextDouble();
+ if (u3 > 0.5)
+ theta = (mu % TWOPI) + Math.acos(f);
+ else
+ theta = (mu % TWOPI) - Math.acos(f);
+ }
+ return theta;
+ }
+
+
+ final double LOG4 = Math.log(4);
+ final double SG_MAGICCONST = 1.0 + Math.log(4.5);
+
+ /**
+ * Gamma distribution. Not the gamma function!
+ * Conditions on the parameters are alpha > 0 and beta > 0.
+ * <p/>
+ * The probability distribution function is:
+ * pdf(x) = (x ** (alpha - 1) * math.exp(-x / beta)) / (math.gamma(alpha) * beta ** alpha)
+ *
+ * @param alpha Alpha
+ * @param beta Beta
+ * @return A number from the gamma distribution specified
+ */
+ public double gamma(double alpha, double beta) {
+ if (alpha <= 0.0 || beta <= 0.0)
+ throw new IllegalArgumentException("alpha and beta must be > 0.0");
+
+ if (alpha > 1.0) {
+ double ainv = Math.sqrt(2.0 * alpha - 1.0);
+ double bbb = alpha - LOG4;
+ double ccc = alpha + ainv;
+ double u1, u2, v, x, z, r;
+
+ while (true) {
+ u1 = random();
+ if (!(1e-7 < u1 && u1 < .9999999))
+ continue;
+ u2 = 1.0 - random();
+ v = Math.log(u1 / (1.0 - u1)) / ainv;
+ x = alpha * Math.exp(v);
+ z = u1 * u1 * u2;
+ r = bbb + ccc * v - x;
+ if (r + SG_MAGICCONST - 4.5 * z >= 0.0 || r >= Math.log(z))
+ return x * beta;
+ }
+ } else if (alpha == 1.0) {
+ // exponential(1)
+ double u;
+ u = random();
+ while (u <= 1e-7)
+ u = random();
+ return -Math.log(u) * beta;
+ } else {
+ // alpha is between 0 and 1 (exclusive)
+ // Uses ALGORITHM GS of Statistical Computing -Kennedy & Gentle
+
+ double u, b, p, x, u1;
+ while (true) {
+ u = random();
+ b = (Math.E + alpha) / Math.E;
+ p = b * u;
+ if (p <= 1.0)
+ x = Math.pow(p, (1.0 / alpha));
+ else
+ x = -Math.log((b - p) / alpha);
+ u1 = random();
+ if (p > 1.0) {
+ if (u1 <= Math.pow(x, (alpha - 1.0)))
+ break;
+ } else if (u1 <= Math.exp(-x))
+ break;
+ }
+ return x * beta;
+ }
+ }
+}
diff --git a/src/main/java/org/plazmamc/plazma/util/random/XorshiftRandomSource.java b/src/main/java/org/plazmamc/plazma/util/random/XorshiftRandomSource.java
new file mode 100644
index 0000000000000000000000000000000000000000..646e9689f17211112f8d253099fb075666d942e9
--- /dev/null
+++ b/src/main/java/org/plazmamc/plazma/util/random/XorshiftRandomSource.java
@@ -0,0 +1,56 @@
+package org.plazmamc.plazma.util.random;
+
+import com.google.common.annotations.VisibleForTesting;
+import net.minecraft.core.BlockPos;
+import net.minecraft.util.Mth;
+import net.minecraft.util.RandomSource;
+import net.minecraft.world.level.levelgen.PositionalRandomFactory;
+import org.jspecify.annotations.NonNull;
+
+public class XorshiftRandomSource extends XorshiftRandom implements RandomSource {
+
+ public XorshiftRandomSource(long seed) {
+ this.setSeed(seed);
+ }
+
+ @Override
+ public @NonNull RandomSource fork() {
+ return new XorshiftRandomSource(this.nextLong());
+ }
+
+ @Override
+ public @NonNull PositionalRandomFactory forkPositional() {
+ return new XorshiftRandomSourceFactory(this.nextLong());
+ }
+
+ private record XorshiftRandomSourceFactory(long seed) implements PositionalRandomFactory {
+ @SuppressWarnings("deprecation")
+ @Override
+ public @NonNull RandomSource at(int x, int y, int z) {
+ return new XorshiftRandomSource(Mth.getSeed(x, y, z) ^ this.seed);
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public @NonNull RandomSource at(final @NonNull BlockPos pos) {
+ return new XorshiftRandomSource(Mth.getSeed(pos.getX(), pos.getY(), pos.getZ()) ^ this.seed);
+ }
+
+ @Override
+ public @NonNull RandomSource fromHashOf(@NonNull String seed) {
+ return new XorshiftRandomSource((long) seed.hashCode() ^ this.seed);
+ }
+
+ @Override
+ public @NonNull RandomSource fromSeed(final long seed) {
+ return new XorshiftRandomSource(seed);
+ }
+
+ @Override
+ @VisibleForTesting
+ public void parityConfigString(@NonNull StringBuilder info) {
+ info.append("XorshiftRandomSource$XorshiftRandomSourceFactory{").append(this.seed).append("}");
+ }
+ }
+
+}

View File

@@ -1,19 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Wed, 15 May 2024 14:31:47 +0900
Subject: [PATCH] Improve biome temperature cache
diff --git a/src/main/java/net/minecraft/world/level/biome/Biome.java b/src/main/java/net/minecraft/world/level/biome/Biome.java
index f9fbfb63f19decb3b15284306d7edda072e609af..81b996679f396f18a8f5948311f1069be0806756 100644
--- a/src/main/java/net/minecraft/world/level/biome/Biome.java
+++ b/src/main/java/net/minecraft/world/level/biome/Biome.java
@@ -118,7 +118,7 @@ public final class Biome {
public float getTemperature(BlockPos blockPos) {
long l = blockPos.asLong();
// Pufferfish start
- gg.airplane.structs.Long2FloatAgingCache cache = this.temperatureCache.get();
+ gg.airplane.structs.Long2FloatAgingCache cache = temperatureCache.get(); // Plazma - Improve biome temperature cache
float f = cache.getValue(l);
if (!Float.isNaN(f)) {
return f;

View File

@@ -0,0 +1,73 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Sun, 27 Oct 2024 00:16:25 +0900
Subject: [PATCH] Optimize advancement criteria triggering
Based on bigenergy/achievements-optimizer
Copyright (C) 2024 bigenergy, Licensed under MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
diff --git a/src/main/java/net/minecraft/advancements/critereon/InventoryChangeTrigger.java b/src/main/java/net/minecraft/advancements/critereon/InventoryChangeTrigger.java
index ebbad97920df3d1645637e646a98e16cb04d361e..a149c949a042e1d1e504d9f5ce0bfa6df92db2fc 100644
--- a/src/main/java/net/minecraft/advancements/critereon/InventoryChangeTrigger.java
+++ b/src/main/java/net/minecraft/advancements/critereon/InventoryChangeTrigger.java
@@ -22,7 +22,21 @@ public class InventoryChangeTrigger extends SimpleCriterionTrigger<InventoryChan
return InventoryChangeTrigger.TriggerInstance.CODEC;
}
+ // Plazma start - Optimize advancement criteria triggering
+ public static int idleTick;
+ private int ticksSkipped;
+
+ private boolean shouldTick() {
+ if (++this.ticksSkipped <= idleTick) return false;
+
+ this.ticksSkipped = 0;
+ return true;
+ }
+ // Plazma end - Optimize advancement criteria triggering
+
public void trigger(ServerPlayer player, Inventory inventory, ItemStack stack) {
+ if (idleTick > 0 && !this.shouldTick()) return; // Plazma - Optimize advancement criteria triggering
+
int i = 0;
int j = 0;
int k = 0;
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
index 7f30fa1928e1a7e59ee5acfdfd2334f810c30243..ba2c7b679f68d49add77731383bf68292fe9614a 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
@@ -139,4 +139,16 @@ public class GlobalConfiguration extends ConfigurationPart {
}
+ public Advancements advancements;
+ public class Advancements extends ConfigurationPart {
+
+ int criteriaTriggerIdleTick = OPTIMIZE ? 5 : 0;
+
+ @PostProcess
+ void post() {
+ net.minecraft.advancements.critereon.InventoryChangeTrigger.idleTick = this.criteriaTriggerIdleTick;
+ }
+
+ }
+
}

View File

@@ -0,0 +1,34 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Sun, 27 Oct 2024 13:48:01 +0900
Subject: [PATCH] Configurable water flowing speed
diff --git a/src/main/java/net/minecraft/world/level/material/WaterFluid.java b/src/main/java/net/minecraft/world/level/material/WaterFluid.java
index 1e741f36b79585f33abe413beafe00cf5205d54f..028aea6640356ba80f5d682e3cc03b7f82f5b9c7 100644
--- a/src/main/java/net/minecraft/world/level/material/WaterFluid.java
+++ b/src/main/java/net/minecraft/world/level/material/WaterFluid.java
@@ -123,7 +123,7 @@ public abstract class WaterFluid extends FlowingFluid {
@Override
public int getTickDelay(LevelReader world) {
- return 5;
+ return world.getWorldBorder().world.plazmaConfig().block.waterFlowingTick; // Plazma - Configurable water flowing speed
}
@Override
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
index 0e27e4a1f767842d1dcd2ed235a6a45f120bf32e..c1d4a96cf5be77f4460c54ed19622f527d42ca06 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
@@ -64,7 +64,9 @@ public class WorldConfigurations extends ConfigurationPart {
public Block block;
public class Block extends ConfigurationPart {
-
+
+ public int waterFlowingTick = 5;
+
public Hopper hopper;
public class Hopper extends ConfigurationPart {

View File

@@ -0,0 +1,37 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Thu, 31 Oct 2024 22:53:16 +0900
Subject: [PATCH] cleanup logs
diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml
index a056aa167887abef9e6d531a9edd2cda433567d2..dbd822604471e7405e350586ea0e294e0234cf06 100644
--- a/src/main/resources/log4j2.xml
+++ b/src/main/resources/log4j2.xml
@@ -7,7 +7,7 @@
<LoggerNamePatternSelector defaultPattern="%highlightGUIError{[%d{HH:mm:ss} %level]: [%logger] %stripAnsi{%msg}%n%xEx{full}}">
<!-- Log root, Minecraft, Mojang and Bukkit loggers without prefix -->
<!-- Disable prefix for various plugins that bypass the plugin logger -->
- <PatternMatch key=",net.minecraft.,Minecraft,com.mojang.,com.sk89q.,ru.tehkode.,Minecraft.AWE"
+ <PatternMatch key=",net.minecraft.,Minecraft,com.mojang.,com.sk89q.,ru.tehkode.,Minecraft.AWE,ca.spottedleaf."
pattern="%highlightGUIError{[%d{HH:mm:ss} %level]: %stripAnsi{%msg}%n%xEx{full}}" />
</LoggerNamePatternSelector>
</PatternLayout>
@@ -18,7 +18,7 @@
<LoggerNamePatternSelector defaultPattern="%highlightError{[%d{HH:mm:ss} %level]: [%logger] %msg%n%xEx{full}}">
<!-- Log root, Minecraft, Mojang and Bukkit loggers without prefix -->
<!-- Disable prefix for various plugins that bypass the plugin logger -->
- <PatternMatch key=",net.minecraft.,Minecraft,com.mojang.,com.sk89q.,ru.tehkode.,Minecraft.AWE"
+ <PatternMatch key=",net.minecraft.,Minecraft,com.mojang.,com.sk89q.,ru.tehkode.,Minecraft.AWE,ca.spottedleaf."
pattern="%highlightError{[%d{HH:mm:ss} %level]: %msg%n%xEx{full}}" />
</LoggerNamePatternSelector>
</PatternLayout>
@@ -28,7 +28,7 @@
<LoggerNamePatternSelector defaultPattern="[%d{HH:mm:ss}] [%t/%level]: [%logger] %stripAnsi{%msg}%n%xEx{full}">
<!-- Log root, Minecraft, Mojang and Bukkit loggers without prefix -->
<!-- Disable prefix for various plugins that bypass the plugin logger -->
- <PatternMatch key=",net.minecraft.,Minecraft,com.mojang.,com.sk89q.,ru.tehkode.,Minecraft.AWE"
+ <PatternMatch key=",net.minecraft.,Minecraft,com.mojang.,com.sk89q.,ru.tehkode.,Minecraft.AWE,ca.spottedleaf."
pattern="[%d{HH:mm:ss}] [%t/%level]: %stripAnsi{%msg}%n%xEx{full}" />
</LoggerNamePatternSelector>
</PatternLayout>

View File

@@ -0,0 +1,62 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Wed, 15 May 2024 14:12:50 +0900
Subject: [PATCH] Completely remove timings implementation
diff --git a/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java b/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java
index 23594fb7eb4b2f33146592866608c2858ef23937..8acdea0f086129854cb44bc5ce8bbbc4e810b9ad 100644
--- a/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java
+++ b/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java
@@ -1,6 +1,6 @@
package io.papermc.paper.plugin.manager;
-import co.aikar.timings.TimedEventExecutor;
+//import co.aikar.timings.TimedEventExecutor; // Plazma - Completely remove timings implementation
import com.destroystokyo.paper.event.server.ServerExceptionEvent;
import com.destroystokyo.paper.exception.ServerEventException;
import com.google.common.collect.Sets;
@@ -96,7 +96,7 @@ class PaperEventManager {
throw new IllegalPluginAccessException("Plugin attempted to register " + event + " while not enabled");
}
- executor = new TimedEventExecutor(executor, plugin, null, event);
+ //executor = new TimedEventExecutor(executor, plugin, null, event); // Plazma - Completely remove timings implementation
this.getEventListeners(event).register(new RegisteredListener(listener, executor, priority, plugin, ignoreCancelled));
}
@@ -183,7 +183,7 @@ class PaperEventManager {
}
}
- EventExecutor executor = new TimedEventExecutor(EventExecutor.create(method, eventClass), plugin, method, eventClass);
+ EventExecutor executor = EventExecutor.create(method, eventClass); // Plazma - Completely remove timings implementation
eventSet.add(new RegisteredListener(listener, executor, eh.priority(), plugin, eh.ignoreCancelled()));
}
return ret;
diff --git a/src/main/java/io/papermc/paper/plugin/manager/PaperPluginManagerImpl.java b/src/main/java/io/papermc/paper/plugin/manager/PaperPluginManagerImpl.java
index 097500a59336db1bbfffcd1aa4cff7a8586e46ec..844e340c331c6dd12eaaac247f871b042ceb6c25 100644
--- a/src/main/java/io/papermc/paper/plugin/manager/PaperPluginManagerImpl.java
+++ b/src/main/java/io/papermc/paper/plugin/manager/PaperPluginManagerImpl.java
@@ -232,7 +232,7 @@ public class PaperPluginManagerImpl implements PluginManager, DependencyContext
@Override
public boolean useTimings() {
- return co.aikar.timings.Timings.isTimingsEnabled();
+ return false; // Thunderbolt - Remove remaining timings implementations
}
@Override
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 54ef910938efb537a689dd5dbda119455bbf2a0e..6e9766aff9a9f2b578f5b8a6b42e206fb7ad1bc6 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -3,7 +3,7 @@ package net.minecraft.server;
import com.google.common.base.Preconditions;
import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableList;
-import co.aikar.timings.Timings;
+//import co.aikar.timings.Timings; // Plazma - Completely remove timings implementation
import com.destroystokyo.paper.event.server.PaperServerListPingEvent;
import com.google.common.base.Stopwatch;
import com.google.common.collect.Lists;

File diff suppressed because it is too large Load Diff

View File

@@ -464,11 +464,11 @@ index 0000000000000000000000000000000000000000..3456f38d381643b0461669b0b5fec6bf
+
+}
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java b/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java
index 6499e3fe49e453db11e51eaf717ca8b3b682056b..09aca895b56cc564f2b2c5da0256ae27b6b433f6 100644
index 3d7578605812021bc84b99d4db1672a682d897ad..58feaaed5e301eb402dab24e6f155beb865fa5ee 100644
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java
@@ -76,6 +76,35 @@ public class AcquirePoi {
io.papermc.paper.util.PoiAccess.findNearestPoiPositions(poiManager, poiPredicate, predicate2, entity.blockPosition(), world.purpurConfig.villagerAcquirePoiSearchRadius, world.purpurConfig.villagerAcquirePoiSearchRadius*world.purpurConfig.villagerAcquirePoiSearchRadius, PoiManager.Occupancy.HAS_SPACE, false, 5, poiposes); // Purpur
io.papermc.paper.util.PoiAccess.findNearestPoiPositions(poiManager, poiPredicate, predicate2, entity.blockPosition(), world.purpurConfig.villagerAcquirePoiSearchRadius, world.purpurConfig.villagerAcquirePoiSearchRadius*world.purpurConfig.villagerAcquirePoiSearchRadius, PoiManager.Occupancy.HAS_SPACE, false, 5, poiposes);
Set<Pair<Holder<PoiType>, BlockPos>> set = new java.util.HashSet<>(poiposes);
// Paper end - optimise POI access
+ // Plazma start - Process Pathfinding Asynchronously
@@ -478,7 +478,7 @@ index 6499e3fe49e453db11e51eaf717ca8b3b682056b..09aca895b56cc564f2b2c5da0256ae27
+ if (path == null || !path.canReach()) {
+ for (Pair<Holder<PoiType>, BlockPos> pair : set) long2ObjectMap.computeIfAbsent(
+ pair.getSecond().asLong(),
+ ignored -> new JitteredLinearRetry(entity.level().random, time)
+ ignored -> new net.minecraft.world.entity.ai.behavior.AcquirePoi.JitteredLinearRetry(entity.level().random, time)
+ );
+ return;
+ }
@@ -736,10 +736,10 @@ index a3e0c5af4cc9323c02e88e768cbda9e46854aea1..d68e97084ba6bc97312fc5b62ffcb6e6
if (this.canUpdatePath()) {
this.followThePath();
diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java
index 62634bedd97c5be9ecce24ab0cff205715a68da8..d7bbb9ddb97b336a2198b07cb2395f1b8b8e9d30 100644
index f73b559b8e60859020f762dab88b67b8c912bf8f..d218604447afbde96dc4af33ba90a87617a13ed4 100644
--- a/src/main/java/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java
+++ b/src/main/java/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java
@@ -23,12 +23,26 @@ public class GroundPathNavigation extends PathNavigation {
@@ -24,10 +24,23 @@ public class GroundPathNavigation extends PathNavigation {
super(entity, world);
}
@@ -753,24 +753,21 @@ index 62634bedd97c5be9ecce24ab0cff205715a68da8..d7bbb9ddb97b336a2198b07cb2395f1b
+ evaluator.setCanWalkOverFences(features.canWalkOverFences());
+ return evaluator;
+ };
+ // Plazma end - Process pathfinding asynchronously
+
@Override
protected PathFinder createPathFinder(int range) {
this.nodeEvaluator = new WalkNodeEvaluator();
this.nodeEvaluator.setCanPassDoors(true);
+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().entity.asyncPathProcess.enabled)
+ return new PathFinder(this.nodeEvaluator, range, GENERATOR);
+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().entity.asyncPathProcess.enabled) return new PathFinder(this.nodeEvaluator, range, GENERATOR); // Plazma - Process pathfinding asynchronously
return new PathFinder(this.nodeEvaluator, range);
}
+ // Plazma end - Process pathfinding asynchronously
@Override
protected boolean canUpdatePath() {
diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
index 544920a31b649985333f82beafa94a3392f5853e..05715fa17caf8d8eece85b7ad752f57890b04716 100644
index 48c0de870a5bbf647309e69361dfb10ab56c65ab..99e31c8e8488ce7138c5385575cbbabe0bd7394e 100644
--- a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
+++ b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
@@ -152,6 +152,7 @@ public abstract class PathNavigation {
@@ -168,6 +168,7 @@ public abstract class PathNavigation {
return null;
} else if (!this.canUpdatePath()) {
return null;
@@ -778,11 +775,10 @@ index 544920a31b649985333f82beafa94a3392f5853e..05715fa17caf8d8eece85b7ad752f578
} else if (this.path != null && !this.path.isDone() && positions.contains(this.targetPos)) {
return this.path;
} else {
@@ -177,7 +178,23 @@ public abstract class PathNavigation {
int i = (int)(followRange + (float)range);
@@ -195,6 +196,23 @@ public abstract class PathNavigation {
PathNavigationRegion pathNavigationRegion = new PathNavigationRegion(this.level, blockPos.offset(-i, -i, -i), blockPos.offset(i, i, i));
Path path = this.pathFinder.findPath(pathNavigationRegion, this.mob, positions, followRange, distance, this.maxVisitedNodesMultiplier);
- //this.level.getProfiler().pop(); // Purpur
profilerFiller.pop();
+ // Plazma start - Process pathfinding asynchronously
+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().entity.asyncPathProcess.enabled) {
+ if (!positions.isEmpty()) this.targetPos = positions.iterator().next();
@@ -799,11 +795,11 @@ index 544920a31b649985333f82beafa94a3392f5853e..05715fa17caf8d8eece85b7ad752f578
+
+ return path;
+ }
+ // Plazma end
+ // Plazma end - Process pathfinding asynchronously
if (path != null && path.getTarget() != null) {
this.targetPos = path.getTarget();
this.reachRange = distance;
@@ -233,8 +250,8 @@ public abstract class PathNavigation {
@@ -250,8 +268,8 @@ public abstract class PathNavigation {
if (this.isDone()) {
return false;
} else {
@@ -814,7 +810,7 @@ index 544920a31b649985333f82beafa94a3392f5853e..05715fa17caf8d8eece85b7ad752f578
return false;
} else {
this.speedModifier = speed;
@@ -257,6 +274,7 @@ public abstract class PathNavigation {
@@ -274,6 +292,7 @@ public abstract class PathNavigation {
if (this.hasDelayedRecomputation) {
this.recomputePath();
}
@@ -822,17 +818,15 @@ index 544920a31b649985333f82beafa94a3392f5853e..05715fa17caf8d8eece85b7ad752f578
if (!this.isDone()) {
if (this.canUpdatePath()) {
@@ -282,7 +300,9 @@ public abstract class PathNavigation {
return this.level.getBlockState(blockPos.below()).isAir() ? pos.y : WalkNodeEvaluator.getFloorLevel(this.level, blockPos);
@@ -300,6 +319,7 @@ public abstract class PathNavigation {
}
+ @SuppressWarnings("DataFlowIssue") // Plazma - Process pathfinding asynchronously
protected void followThePath() {
+ if (!this.path.isProcessed()) return; // Plazma - Process pathfinding asynchronously
Vec3 vec3 = this.getTempMobPos();
this.maxDistanceToWaypoint = this.mob.getBbWidth() > 0.75F ? this.mob.getBbWidth() / 2.0F : 0.75F - this.mob.getBbWidth() / 2.0F;
Vec3i vec3i = this.path.getNextNodePos();
@@ -439,7 +459,7 @@ public abstract class PathNavigation {
@@ -456,7 +476,7 @@ public abstract class PathNavigation {
public boolean shouldRecomputePath(BlockPos pos) {
if (this.hasDelayedRecomputation) {
return false;
@@ -842,10 +836,10 @@ index 544920a31b649985333f82beafa94a3392f5853e..05715fa17caf8d8eece85b7ad752f578
Vec3 vec3 = new Vec3(((double)node.x + this.mob.getX()) / 2.0, ((double)node.y + this.mob.getY()) / 2.0, ((double)node.z + this.mob.getZ()) / 2.0);
return pos.closerToCenterThan(vec3, (double)(this.path.getNodeCount() - this.path.getNextNodeIndex()));
diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/WaterBoundPathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/WaterBoundPathNavigation.java
index ce7398a617abe6e800c1e014b3ac5c970eb15c8a..8e9a00ee90f97d2684f72eca5006568aa2a858da 100644
index 0446ac540d8509a653abe1a8bc10f52fb43d6ae1..77c10a3e9570f53ce73dacb39cb86a00202e6ce6 100644
--- a/src/main/java/net/minecraft/world/entity/ai/navigation/WaterBoundPathNavigation.java
+++ b/src/main/java/net/minecraft/world/entity/ai/navigation/WaterBoundPathNavigation.java
@@ -15,12 +15,26 @@ public class WaterBoundPathNavigation extends PathNavigation {
@@ -15,10 +15,23 @@ public class WaterBoundPathNavigation extends PathNavigation {
super(entity, world);
}
@@ -859,19 +853,16 @@ index ce7398a617abe6e800c1e014b3ac5c970eb15c8a..8e9a00ee90f97d2684f72eca5006568a
+ evaluator.setCanWalkOverFences(features.canWalkOverFences());
+ return evaluator;
+ };
+ // Plazma end - Process pathfinding asynchronously
+
@Override
protected PathFinder createPathFinder(int range) {
this.allowBreaching = this.mob.getType() == EntityType.DOLPHIN;
this.nodeEvaluator = new SwimNodeEvaluator(this.allowBreaching);
+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().entity.asyncPathProcess.enabled)
+ return new PathFinder(this.nodeEvaluator, range, GENERATOR);
+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().entity.asyncPathProcess.enabled) return new PathFinder(this.nodeEvaluator, range, GENERATOR); // Plazma - Process pathfinding asynchronously
return new PathFinder(this.nodeEvaluator, range);
}
+ // Plazma end - Process pathfinding asynchronously
@Override
protected boolean canUpdatePath() {
diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java
index 9104d7010bda6f9f73b478c11490ef9c53f76da2..a53950a6e4cb2e672b6f130461fa630643e3535f 100644
--- a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java
@@ -903,10 +894,10 @@ index 9104d7010bda6f9f73b478c11490ef9c53f76da2..a53950a6e4cb2e672b6f130461fa6306
// Paper end - optimise POI access
if (path != null && path.canReach()) {
diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java
index 539170813921de2dfcd7ef84dd7512d73cd27e68..4722e95397fbec585a0ce5240bdfd08d9d5e7a07 100644
index 6dec1720aea724baab541e26e14c9fa0646abdbf..bf4a3bc730709f41a5089dfe4c6342b08057ef02 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Bee.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java
@@ -1135,7 +1135,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
@@ -1206,7 +1206,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
} else {
Bee.this.pathfindRandomlyTowards(Bee.this.hivePos);
}
@@ -915,7 +906,7 @@ index 539170813921de2dfcd7ef84dd7512d73cd27e68..4722e95397fbec585a0ce5240bdfd08d
boolean flag = this.pathfindDirectlyTowards(Bee.this.hivePos);
if (!flag) {
@@ -1197,7 +1197,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
@@ -1265,7 +1265,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
} else {
Path pathentity = Bee.this.navigation.getPath();
@@ -925,10 +916,10 @@ index 539170813921de2dfcd7ef84dd7512d73cd27e68..4722e95397fbec585a0ce5240bdfd08d
}
}
diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java
index 651f30b4fb02dc03fabad34b62d7d86fa0889754..2fb5e4fc7422c81c67a026143c92f5e787d864fb 100644
index 17ba0c6060ab56ab97b133565ebf86320ab52e1b..305fe2c13ae2d81b99ff36f8ef18e24c23255eae 100644
--- a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java
+++ b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java
@@ -491,11 +491,25 @@ public class Frog extends Animal implements VariantHolder<Holder<FrogVariant>> {
@@ -506,10 +506,23 @@ public class Frog extends Animal implements VariantHolder<Holder<FrogVariant>> {
return nodeType != PathType.WATER_BORDER && super.canCutCorner(nodeType);
}
@@ -942,36 +933,34 @@ index 651f30b4fb02dc03fabad34b62d7d86fa0889754..2fb5e4fc7422c81c67a026143c92f5e7
+ evaluator.setCanFloat(features.canFloat());
+ return evaluator;
+ };
+ // Plazma end - Process pathfinding asynchronously
+
@Override
protected PathFinder createPathFinder(int range) {
this.nodeEvaluator = new Frog.FrogNodeEvaluator(true);
this.nodeEvaluator.setCanPassDoors(true);
+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().entity.asyncPathProcess.enabled)
+ return new PathFinder(this.nodeEvaluator, range, GENERATOR);
+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().entity.asyncPathProcess.enabled) return new PathFinder(this.nodeEvaluator, range, GENERATOR); // Plazma - Process pathfinding asynchronously
return new PathFinder(this.nodeEvaluator, range);
}
+ // Plazma end - Process pathfinding asynchronously
}
}
diff --git a/src/main/java/net/minecraft/world/entity/monster/Drowned.java b/src/main/java/net/minecraft/world/entity/monster/Drowned.java
index 15afee3c4f6307557321424560d2340e23cd472b..8b52add9080dd664c4e34393f535145d37ea9a78 100644
index 19bc362ff8e28cd0e26ba357dda425bac24c5a56..e4784d37c4b93c34325eb72cfbaa640c63d0c3c1 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Drowned.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Drowned.java
@@ -296,7 +296,7 @@ public class Drowned extends Zombie implements RangedAttackMob {
@@ -308,7 +308,7 @@ public class Drowned extends Zombie implements RangedAttackMob {
protected boolean closeToNextPos() {
Path pathentity = this.getNavigation().getPath();
- if (pathentity != null) {
+ if (pathentity != null && pathentity.isProcessed()) { // Plazma - Process pathfinding asynchronously
BlockPos blockposition = pathentity.getTarget();
if (blockposition != null) {
Path path = this.getNavigation().getPath();
- if (path != null) {
+ if (path != null && path.isProcessed()) { // Plazma - Process pathfinding asynchronously
BlockPos blockPos = path.getTarget();
if (blockPos != null) {
double d = this.distanceToSqr((double)blockPos.getX(), (double)blockPos.getY(), (double)blockPos.getZ());
diff --git a/src/main/java/net/minecraft/world/entity/monster/Strider.java b/src/main/java/net/minecraft/world/entity/monster/Strider.java
index 5ea5bf9c0e11b0e1f9fe50093899c6e35ee6cf4f..310d942dca115d2048812e7d7e6e7fab8086f993 100644
index c09e49f928e32a3dc6c557f01d92c455d9bfc8c6..bf507bcb8746298ca96e50686cdf1bd91c91e4c1 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Strider.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Strider.java
@@ -609,12 +609,26 @@ public class Strider extends Animal implements ItemSteerable, Saddleable {
@@ -610,10 +610,23 @@ public class Strider extends Animal implements ItemSteerable, Saddleable {
super(entity, world);
}
@@ -985,24 +974,21 @@ index 5ea5bf9c0e11b0e1f9fe50093899c6e35ee6cf4f..310d942dca115d2048812e7d7e6e7fab
+ evaluator.setCanFloat(features.canFloat());
+ return evaluator;
+ };
+ // Plazma end - Process pathfinding asynchronously
+
@Override
protected PathFinder createPathFinder(int range) {
this.nodeEvaluator = new WalkNodeEvaluator();
this.nodeEvaluator.setCanPassDoors(true);
+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().entity.asyncPathProcess.enabled)
+ return new PathFinder(this.nodeEvaluator, range, GENERATOR);
+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().entity.asyncPathProcess.enabled) return new PathFinder(this.nodeEvaluator, range, GENERATOR); // Plazma - Process pathfinding asynchronously
return new PathFinder(this.nodeEvaluator, range);
}
+ // Plazma end - Process pathfinding asynchronously
@Override
protected boolean hasValidPathType(PathType pathType) {
diff --git a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
index 16891921341f8967c9115f415f91ec379fcd5b0c..524d2304a1dbc873a47c95c55ad70c4120f07ad4 100644
index 6cce132f43ce7aad6f5ee2b351855c9b57b8f0c1..4102dc4c8b63a1d00a8417aa303521590202f9a6 100644
--- a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
+++ b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
@@ -636,6 +636,15 @@ public class Warden extends Monster implements VibrationSystem {
@@ -638,6 +638,15 @@ public class Warden extends Monster implements VibrationSystem {
protected PathFinder createPathFinder(int range) {
this.nodeEvaluator = new WalkNodeEvaluator();
this.nodeEvaluator.setCanPassDoors(true);
@@ -1040,60 +1026,47 @@ index d9d0fff9962131808d54cca20f209df50b8e4af1..420dd323790e72aa12c942d31a94bcb8
public void write(FriendlyByteBuf buf) {
buf.writeCollection(this.targetNodes, (bufx, node) -> node.writeToStream(bufx));
diff --git a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java
index 97a81d749d9fece6283fdd1b0ed89ce04be32c78..d9b4cd6777b4f19dd85f0c912e70b7c087e61c8e 100644
index cc7d94144e39f7dace7b569b4567def98396e8f9..95e71c471904fc54003180632dc85398ae06d241 100644
--- a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java
+++ b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java
@@ -16,6 +16,7 @@ import net.minecraft.core.BlockPos;
// import net.minecraft.util.profiling.metrics.MetricCategory; // Plazma - Completely remove Mojang's Profiler
@@ -17,6 +17,7 @@ import net.minecraft.util.profiling.ProfilerFiller;
import net.minecraft.util.profiling.metrics.MetricCategory;
import net.minecraft.world.entity.Mob;
import net.minecraft.world.level.PathNavigationRegion;
+import dev.kaiijumc.kaiiju.path.*; // Plazma - Process pathfinding asynchronously
public class PathFinder {
private static final float FUDGING = 1.5F;
@@ -24,91 +25,138 @@ public class PathFinder {
@@ -25,8 +26,20 @@ public class PathFinder {
public final NodeEvaluator nodeEvaluator;
private static final boolean DEBUG = false;
private final BinaryHeap openSet = new BinaryHeap();
+ // Plazma start - Process pathfinding asynchronously
+ public static boolean ASYNC = false;
+ private static final org.slf4j.Logger LOGGER = com.mojang.logging.LogUtils.getLogger();
+ private final @Nullable NodeEvaluatorGenerator evaluatorGenerator;
+ // Plazma end - Process pathfinding asynchronously
public PathFinder(NodeEvaluator pathNodeMaker, int range) {
+ // Plazma start - Process pathfinding asynchronously
+ this(pathNodeMaker, range, null);
+ }
+
+ public PathFinder(NodeEvaluator pathNodeMaker, int range, @Nullable NodeEvaluatorGenerator evaluatorGenerator) {
+ this.evaluatorGenerator = evaluatorGenerator;
+ // Plazma end - Process pathfinding asynchronously
this.nodeEvaluator = pathNodeMaker;
this.maxVisitedNodes = range;
+ this.evaluatorGenerator = evaluatorGenerator;
}
@@ -37,100 +50,48 @@ public class PathFinder {
+ @SuppressWarnings("ConstantValue")
@Nullable
- public Path findPath(PathNavigationRegion world, Mob mob, Set<BlockPos> positions, float followRange, int distance, float rangeMultiplier) {
public Path findPath(PathNavigationRegion world, Mob mob, Set<BlockPos> positions, float followRange, int distance, float rangeMultiplier) {
- this.openSet.clear();
- this.nodeEvaluator.prepare(world, mob);
- Node node = this.nodeEvaluator.getStart();
+ public Path findPath(
+ PathNavigationRegion world,
+ Mob mob,
+ Set<BlockPos> positions,
+ float followRange,
+ int distance,
+ float rangeMultiplier
+ ) {
+ if (!org.plazmamc.plazma.configurations.GlobalConfiguration.get().entity.asyncPathProcess.enabled) this.openSet.clear();
+ NodeEvaluator evaluator = this.evaluatorGenerator == null
+ ? this.nodeEvaluator
+ : NodeEvaluatorCache.take(this.evaluatorGenerator, this.nodeEvaluator);
+
+ evaluator.prepare(world, mob);
+ Node node = evaluator.getStart();
+
if (node == null) {
+ NodeEvaluatorCache.remove(evaluator);
return null;
- if (node == null) {
- return null;
- } else {
- // Paper start - Perf: remove streams and optimize collection
- List<Map.Entry<Target, BlockPos>> map = Lists.newArrayList();
@@ -1101,112 +1074,66 @@ index 97a81d749d9fece6283fdd1b0ed89ce04be32c78..d9b4cd6777b4f19dd85f0c912e70b7c0
- map.add(new java.util.AbstractMap.SimpleEntry<>(this.nodeEvaluator.getTarget(pos.getX(), pos.getY(), pos.getZ()), pos));
- }
- // Paper end - Perf: remove streams and optimize collection
- Path path = this.findPath(/*world.getProfiler(), */node, map, followRange, distance, rangeMultiplier); // Plazma - Completely remove Mojang's Profiler
- Path path = this.findPath(node, map, followRange, distance, rangeMultiplier);
- this.nodeEvaluator.done();
- return path;
}
+
+ List<Map.Entry<Target, BlockPos>> map = Lists.newArrayList();
+ for (final BlockPos pos : positions)
+ map.add(new java.util.AbstractMap.SimpleEntry<>(evaluator.getTarget(pos.getX(), pos.getY(), pos.getZ()), pos));
+
+ if (this.evaluatorGenerator == null) {
+ NodeEvaluatorCache.remove(evaluator);
+ return this.findPath(node, map, followRange, distance, rangeMultiplier);
+ }
+
+ return new AsyncPath(
+ Lists.newArrayList(),
+ positions,
+ () -> this.processPath(evaluator, node, map, followRange, distance, rangeMultiplier),
+ () -> {
+ evaluator.done();
+ NodeEvaluatorCache.returnEvaluator(evaluator);
+ }
+ );
}
@Nullable
// Paper start - Perf: remove streams and optimize collection
- private Path findPath(/*ProfilerFiller profiler, */Node startNode, List<Map.Entry<Target, BlockPos>> positions, float followRange, int distance, float rangeMultiplier) { // Plazma - Completely remove Mojang's Profiler
- //profiler.push("find_path"); // Purpur
- //profiler.markForCharting(MetricCategory.PATH_FINDING); // Purpur
- }
- }
-
- @Nullable
- // Paper start - Perf: remove streams and optimize collection
- private Path findPath(Node startNode, List<Map.Entry<Target, BlockPos>> positions, float followRange, int distance, float rangeMultiplier) {
- ProfilerFiller profilerFiller = Profiler.get();
- profilerFiller.push("find_path");
- profilerFiller.markForCharting(MetricCategory.PATH_FINDING);
- // Set<Target> set = positions.keySet();
+ private Path findPath(
+ Node startNode,
+ List<Map.Entry<Target, BlockPos>> positions,
+ float followRange,
+ int distance,
+ float rangeMultiplier
+ ) {
+ try {
+ return this.processPath(this.nodeEvaluator, startNode, positions, followRange, distance, rangeMultiplier);
+ } catch (Exception e) {
+ LOGGER.error("Failed to process path", e);
+ return null;
+ } finally {
+ this.nodeEvaluator.done();
+ }
+ }
+
+ @SuppressWarnings("DataFlowIssue")
+ @org.jetbrains.annotations.NotNull
+ private synchronized Path processPath(
+ NodeEvaluator nodeEvaluator,
+ Node startNode,
+ List<Map.Entry<Target, BlockPos>> positions,
+ float followRange,
+ int distance,
+ float rangeMultiplier
+ ) {
+ org.apache.commons.lang3.Validate.isTrue(!positions.isEmpty());
startNode.g = 0.0F;
startNode.h = this.getBestH(startNode, positions); // Paper - optimize collection
startNode.f = startNode.h;
this.openSet.clear();
this.openSet.insert(startNode);
- startNode.g = 0.0F;
- startNode.h = this.getBestH(startNode, positions); // Paper - optimize collection
- startNode.f = startNode.h;
- this.openSet.clear();
- this.openSet.insert(startNode);
- // Set<Node> set2 = ImmutableSet.of(); // Paper - unused - diff on change
+
int i = 0;
List<Map.Entry<Target, BlockPos>> entryList = Lists.newArrayListWithExpectedSize(positions.size()); // Paper - optimize collection
int j = (int)((float)this.maxVisitedNodes * rangeMultiplier);
- int i = 0;
- List<Map.Entry<Target, BlockPos>> entryList = Lists.newArrayListWithExpectedSize(positions.size()); // Paper - optimize collection
- int j = (int)((float)this.maxVisitedNodes * rangeMultiplier);
+ if (ASYNC) this.openSet.clear();
while (!this.openSet.isEmpty()) {
- while (!this.openSet.isEmpty()) {
- if (++i >= j) {
- break;
- }
+ if (++i >= j) break;
+ NodeEvaluator evaluator = this.evaluatorGenerator == null ? this.nodeEvaluator : NodeEvaluatorCache.take(this.evaluatorGenerator, this.nodeEvaluator);
+ evaluator.prepare(world, mob);
Node node = this.openSet.pop();
node.closed = true;
- Node node = this.openSet.pop();
- node.closed = true;
+ Node node = evaluator.getStart();
+ if ( node == null ) {
+ NodeEvaluatorCache.remove(evaluator);
+ return null; // diff on change
+ }
- // Paper start - optimize collection
- for (int i1 = 0; i1 < positions.size(); i1++) {
- final Map.Entry<Target, BlockPos> entry = positions.get(i1);
+ for (final Map.Entry<Target, BlockPos> entry : positions) {
Target target = entry.getKey();
- Target target = entry.getKey();
- if (node.distanceManhattan(target) <= (float)distance) {
+ if (node.distanceManhattan(target) <= (float) distance) {
target.setReached();
entryList.add(entry);
- target.setReached();
- entryList.add(entry);
- // Paper end - Perf: remove streams and optimize collection
}
}
- }
- }
+ List<Map.Entry<Target, BlockPos>> map = Lists.newArrayList();
+ for (final BlockPos pos : positions)
+ map.add(new java.util.AbstractMap.SimpleEntry<>(evaluator.getTarget(pos.getX(), pos.getY(), pos.getZ()), pos));
- if (!entryList.isEmpty()) { // Paper - Perf: remove streams and optimize collection; rename
- break;
- }
+ if (!entryList.isEmpty()) break;
+ if (node.distanceTo(startNode) >= followRange) continue;
+
+ int k = nodeEvaluator.getNeighbors(this.neighbors, node);
+
+ for (int l = 0; l < k; l++) {
+ Node node2 = this.neighbors[l];
+ float f = this.distance(node, node2);
+ node2.walkedDistance = node.walkedDistance + f;
+ float g = node.g + f + node2.costMalus;
+ if (node2.walkedDistance >= followRange || (node2.inOpenSet() && g >= node2.g)) continue;
+ if (this.evaluatorGenerator == null) {
+ NodeEvaluatorCache.remove(evaluator);
+ return this.findPath(node, map, followRange, distance, rangeMultiplier);
+ }
- if (!(node.distanceTo(startNode) >= followRange)) {
- int k = this.nodeEvaluator.getNeighbors(this.neighbors, node);
@@ -1227,38 +1154,124 @@ index 97a81d749d9fece6283fdd1b0ed89ce04be32c78..d9b4cd6777b4f19dd85f0c912e70b7c0
- this.openSet.insert(node2);
- }
- }
- }
+ return new AsyncPath(
+ Lists.newArrayList(),
+ positions,
+ () -> this.processPath(evaluator, node, map, followRange, distance, rangeMultiplier),
+ () -> {
+ evaluator.done();
+ NodeEvaluatorCache.returnEvaluator(evaluator);
}
- }
+ );
+ }
- // Paper start - Perf: remove streams and optimize collection
- Path best = null;
- boolean entryListIsEmpty = entryList.isEmpty();
- Comparator<Path> comparator = entryListIsEmpty ? Comparator.comparingInt(Path::getNodeCount)
- : Comparator.comparingDouble(Path::getDistToTarget).thenComparingInt(Path::getNodeCount);
- for (Map.Entry<Target, BlockPos> entry : entryListIsEmpty ? positions : entryList) {
- Path path = this.reconstructPath(entry.getKey().getBestNode(), entry.getValue(), !entryListIsEmpty);
- if (best == null || comparator.compare(path, best) < 0)
- best = path;
+ @Nullable
+ // Paper start - Perf: remove streams and optimize collection
+ private Path findPath(Node startNode, List<Map.Entry<Target, BlockPos>> positions, float followRange, int distance, float rangeMultiplier) {
+ try {
+ return this.processPath(this.nodeEvaluator, startNode, positions, followRange, distance, rangeMultiplier);
+ } catch (Exception e) {
+ LOGGER.error("Failed to process path", e);
+ return null;
+ } finally {
+ this.nodeEvaluator.done();
}
- profilerFiller.pop();
- return best;
- // Paper end - Perf: remove streams and optimize collection
}
protected float distance(Node a, Node b) {
@@ -164,4 +125,78 @@ public class PathFinder {
return new Path(list, target, reachesTarget);
}
+
+ @Nullable
+ private Path processPath(NodeEvaluator evaluator, Node startNode, List<Map.Entry<Target, BlockPos>> positions, float followRange, int distance, float rangeMultiplier) {
+ org.apache.commons.lang3.Validate.isTrue(!positions.isEmpty());
+
+ startNode.g = 0.0F;
+ startNode.h = this.getBestH(startNode, positions);
+ startNode.f = startNode.h;
+
+ this.openSet.clear();
+ this.openSet.insert(startNode);
+
+ int i = 0;
+ int j = (int) (this.maxVisitedNodes * rangeMultiplier);
+ List<Map.Entry<Target, BlockPos>> entryList = Lists.newArrayListWithExpectedSize(positions.size());
+
+ while (!this.openSet.isEmpty()) {
+ if (++i >= j) break;
+
+ Node node = this.openSet.pop();
+ node.closed = true;
+
+ for (final Map.Entry<Target, BlockPos> entry : positions) {
+ Target target = entry.getKey();
+ if (node.distanceManhattan(target) > distance) continue;
+
+ target.setReached();
+ entryList.add(entry);
+ }
+
+ if (!entryList.isEmpty()) break;
+ if (node.distanceTo(startNode) >= followRange) continue;
+
+ int k = evaluator.getNeighbors(this.neighbors, node);
+ for (int l = 0; l < k; l++) {
+ Node node2 = this.neighbors[l];
+
+ float f = this.distance(node, node2);
+ float g = node.g + f + node2.costMalus;
+
+ node2.walkedDistance = node.walkedDistance + f;
+ if (node2.walkedDistance >= followRange && !(!node2.inOpenSet() || g < node2.g)) continue;
+
+ node2.cameFrom = node;
+ node2.g = g;
+ node2.h = this.getBestH(node2, positions) * 1.5F; // Paper - Perf: remove streams and optimize collection
+ node2.h = this.getBestH(node2, positions) * 1.5F;
+
+ if (node2.inOpenSet()) {
+ this.openSet.changeCost(node2, node2.g + node2.h);
+ continue;
}
+ }
+
+ node2.f = node2.g + node2.h;
+ this.openSet.insert(node2);
}
}
@@ -117,15 +165,18 @@ public class PathFinder {
boolean entryListIsEmpty = entryList.isEmpty();
Comparator<Path> comparator = entryListIsEmpty ? Comparator.comparingInt(Path::getNodeCount)
: Comparator.comparingDouble(Path::getDistToTarget).thenComparingInt(Path::getNodeCount);
+ }
+ }
+
for (Map.Entry<Target, BlockPos> entry : entryListIsEmpty ? positions : entryList) {
Path path = this.reconstructPath(entry.getKey().getBestNode(), entry.getValue(), !entryListIsEmpty);
+ Path best = null;
+ boolean isEmpty = entryList.isEmpty();
+
if (best == null || comparator.compare(path, best) < 0)
best = path;
}
- //profiler.pop(); // Purpur
+ Comparator<Path> comparator = isEmpty
+ ? Comparator.comparingInt(Path::getNodeCount)
+ : Comparator.comparingDouble(Path::getDistToTarget).thenComparingInt(Path::getNodeCount);
+
+ for (final Map.Entry<Target, BlockPos> entry : isEmpty ? positions : entryList) {
+ Path path = this.reconstructPath(entry.getKey().getBestNode(), entry.getValue(), !isEmpty);
+ if (best != null && comparator.compare(path, best) >= 0) continue;
+
+ best = path;
+ }
+
+ return best;
+ }
+
return best;
// Paper end - Perf: remove streams and optimize collection
}
+ // Plazma end - Process pathfinding asynchronously
protected float distance(Node a, Node b) {
return a.distanceTo(b);
diff --git a/src/main/java/net/minecraft/world/level/pathfinder/SwimNodeEvaluator.java b/src/main/java/net/minecraft/world/level/pathfinder/SwimNodeEvaluator.java
index 6308822f819d7cb84c8070c8a7eec1a3f822114b..370540e48a5fd5693bf956ffbddccca58a1482f8 100644
--- a/src/main/java/net/minecraft/world/level/pathfinder/SwimNodeEvaluator.java
@@ -1285,12 +1298,12 @@ index 1c83926923f50fb4da1a83dc91614c20a831555f..aec2d0f9a957be65d031957dbff874d8
Command.broadcastCommandMessage(sender, text("Successfully reloaded Plazma configuration files.", NamedTextColor.GREEN));
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
index ae6b4ee0add2de0b7568424abeab1bd441653bcb..d0a1b97bacf9978b4955b1c2c4502c2c1312f1d4 100644
index ba2c7b679f68d49add77731383bf68292fe9614a..81f7ac9753058aa72dea5704fc9859ba3b909fb1 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
@@ -62,6 +62,26 @@ public class GlobalConfiguration extends ConfigurationPart {
boolean skipSqrWhenNoDeltaChanges = OPTIMIZE;
public boolean spookyOptimize = OPTIMIZE;
@@ -80,6 +80,26 @@ public class GlobalConfiguration extends ConfigurationPart {
public class Entity extends ConfigurationPart {
+ public AsyncPathProcess asyncPathProcess;
+ public class AsyncPathProcess extends ConfigurationPart {
@@ -1314,4 +1327,4 @@ index ae6b4ee0add2de0b7568424abeab1bd441653bcb..d0a1b97bacf9978b4955b1c2c4502c2c
+
@PostProcess
public void post() {
net.minecraft.server.level.ServerEntity.skipSqrWhenNoDeltaChanges = this.skipSqrWhenNoDeltaChanges;
}

View File

@@ -0,0 +1,244 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Sat, 26 Oct 2024 13:42:26 +0900
Subject: [PATCH] Implement alternative noise chunk generator
Based on Steveplays28/noisium.
Copyright (C) 2024 Darion Spaargaren, Licensed under GPL v3.
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 <http://www.gnu.org/licenses/>.
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
index e4ae25c83ab9dd1aaa530a5456275ef63cdb8511..03a5effa6f0ef4d5c46a03a39cf336493873cfea 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
@@ -19,9 +19,9 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
public static final int SECTION_HEIGHT = 16;
public static final int SECTION_SIZE = 4096;
public static final int BIOME_CONTAINER_BITS = 2;
- short nonEmptyBlockCount; // Paper - package private
- private short tickingBlockCount;
- private short tickingFluidCount;
+ public short nonEmptyBlockCount; // Paper - package private // Plazma -> public
+ public short tickingBlockCount; // Plazma - private -> public
+ public short tickingFluidCount; // Plazma - private -> public
public final PalettedContainer<BlockState> states;
private PalettedContainer<Holder<Biome>> biomes; // CraftBukkit - read/write
@@ -35,8 +35,8 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
private boolean isClient;
private static final short CLIENT_FORCED_SPECIAL_COLLIDING_BLOCKS = (short)9999;
- private short specialCollidingBlocks;
- private final ca.spottedleaf.moonrise.common.list.ShortList tickingBlocks = new ca.spottedleaf.moonrise.common.list.ShortList();
+ public short specialCollidingBlocks; // Plazma - private -> public
+ public final ca.spottedleaf.moonrise.common.list.ShortList tickingBlocks = new ca.spottedleaf.moonrise.common.list.ShortList(); // Plazma - private -> public
@Override
public final boolean moonrise$hasSpecialCollidingBlocks() {
@@ -309,18 +309,14 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
// CraftBukkit end
public void fillBiomesFromNoise(BiomeResolver biomeSupplier, Climate.Sampler sampler, int x, int y, int z) {
- PalettedContainer<Holder<Biome>> datapaletteblock = this.biomes.recreate();
- boolean flag = true;
+ // Plazma start - Optimize noise
+ PalettedContainer<Holder<Biome>> block = this.biomes.recreate();
- for (int l = 0; l < 4; ++l) {
- for (int i1 = 0; i1 < 4; ++i1) {
- for (int j1 = 0; j1 < 4; ++j1) {
- datapaletteblock.getAndSetUnchecked(l, i1, j1, biomeSupplier.getNoiseBiome(x + l, y + i1, z + j1, sampler));
- }
- }
- }
+ for (int dY = 0; dY < 4; ++dY) for (int dZ = 0; dZ < 4; ++dZ) for (int dX = 0; dX < 4; ++dX)
+ block.getAndSetUnchecked(dX, dY, dZ, biomeSupplier.getNoiseBiome(x + dX, y + dY, z + dZ, sampler));
- this.biomes = datapaletteblock;
+ this.biomes = block;
+ // Plazma end - Optimize noise
}
public LevelChunkSection copy() {
diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
index 8b84bf2272556ac3321cbf16361d7f48a1cc6873..84047336fbd8833cc95bf5afa721f983aee97d4d 100644
--- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
+++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
@@ -30,7 +30,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
public final IdMap<T> registry;
private final T @org.jetbrains.annotations.Nullable [] presetValues; // Paper - Anti-Xray - Add preset values
public volatile PalettedContainer.Data<T> data; // Paper - optimise collisions - public
- private final PalettedContainer.Strategy strategy;
+ public final PalettedContainer.Strategy strategy; // Plazma - private -> public
// private final ThreadingDetector threadingDetector = new ThreadingDetector("PalettedContainer"); // Paper - unused
public void acquire() {
diff --git a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
index 0346fd4ab7095d66c0eef5a440afbc7a8ba52466..35b589fa6d53cce957365e1cfcb5cf1978390546 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
@@ -51,6 +51,7 @@ import org.apache.commons.lang3.mutable.MutableObject;
public final class NoiseBasedChunkGenerator extends ChunkGenerator {
+ public static boolean PLAZMA_USE_NOISIUM = false; // Plazma - Optimize noise chunk generation
public static final MapCodec<NoiseBasedChunkGenerator> CODEC = RecordCodecBuilder.mapCodec((instance) -> {
return instance.group(BiomeSource.CODEC.fieldOf("biome_source").forGetter((chunkgeneratorabstract) -> {
return chunkgeneratorabstract.biomeSource;
@@ -270,6 +271,24 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator {
int k = Mth.floorDiv(noisesettings.height(), noisesettings.getCellHeight());
return k <= 0 ? CompletableFuture.completedFuture(chunk) : CompletableFuture.supplyAsync(() -> {
+ // Plazma start - Optimize noise chunk generation
+ if (PLAZMA_USE_NOISIUM) {
+ int l = chunk.getSectionIndex(k * noisesettings.getCellHeight() - 1 + i);
+ int i1 = chunk.getSectionIndex(i);
+
+ var set = chunk.getSections();
+ for (int j1 = l; j1 >= i1; --j1) set[j1].acquire();
+
+ ChunkAccess ichunkaccess1;
+ try {
+ ichunkaccess1 = this.doFill(blender, structureAccessor, noiseConfig, chunk, j, k);
+ } finally {
+ for (int j1 = l; j1 >= i1; --j1) set[j1].release();
+ }
+
+ return ichunkaccess1;
+ }
+ // Plazma end - Optimize noise chunk generation
int l = chunk.getSectionIndex(k * noisesettings.getCellHeight() - 1 + i);
int i1 = chunk.getSectionIndex(i);
Set<LevelChunkSection> set = Sets.newHashSet();
@@ -377,6 +396,18 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator {
iblockdata = this.debugPreliminarySurfaceLevel(noisechunk, j4, j3, i5, iblockdata);
if (iblockdata != NoiseBasedChunkGenerator.AIR && !SharedConstants.debugVoidTerrain(chunk.getPos())) {
+ // Plazma start - Optimize noise
+ if (PLAZMA_USE_NOISIUM) {
+ var id = chunksection.states.data.palette().idFor(iblockdata);
+ chunksection.states.data.storage().getAndSet(chunksection.states.strategy.getIndex(k4, k3, j5), id);
+
+ ++chunksection.nonEmptyBlockCount;
+ if (iblockdata.isRandomlyTicking()) ++chunksection.tickingBlockCount;
+ if (iblockdata.getFluidState().isRandomlyTicking()) ++chunksection.tickingFluidCount;
+ if (ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.isSpecialCollidingBlock(iblockdata)) ++chunksection.specialCollidingBlocks;
+ if (chunksection.isRandomlyTicking()) chunksection.tickingBlocks.add((short) (k4 | (k3 << 4) | (j5 << (4+4))));
+ } else
+ // Plazma end - Optimize noise
chunksection.setBlockState(k4, k3, j5, iblockdata, false);
heightmap.update(k4, j3, j5, iblockdata);
heightmap1.update(k4, j3, j5, iblockdata);
diff --git a/src/main/java/net/minecraft/world/level/levelgen/NoiseSettings.java b/src/main/java/net/minecraft/world/level/levelgen/NoiseSettings.java
index 932d1d9bd717b1176f8c82b0cf65d2eb6403ad40..a54a279cbaa30c58df572242ad5cf9786c715b66 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/NoiseSettings.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/NoiseSettings.java
@@ -8,7 +8,7 @@ import net.minecraft.core.QuartPos;
import net.minecraft.world.level.LevelHeightAccessor;
import net.minecraft.world.level.dimension.DimensionType;
-public record NoiseSettings(int minY, int height, int noiseSizeHorizontal, int noiseSizeVertical) {
+public record NoiseSettings(int minY, int height, int noiseSizeHorizontal, int noiseSizeVertical, int horizontalCellBlockCount, int verticalCellBlockCount) { // Plazma - Optimize noise
public static final Codec<NoiseSettings> CODEC = RecordCodecBuilder.<NoiseSettings>create(
instance -> instance.group(
Codec.intRange(DimensionType.MIN_Y, DimensionType.MAX_Y).fieldOf("min_y").forGetter(NoiseSettings::minY),
@@ -16,7 +16,7 @@ public record NoiseSettings(int minY, int height, int noiseSizeHorizontal, int n
Codec.intRange(1, 4).fieldOf("size_horizontal").forGetter(NoiseSettings::noiseSizeHorizontal),
Codec.intRange(1, 4).fieldOf("size_vertical").forGetter(NoiseSettings::noiseSizeVertical)
)
- .apply(instance, NoiseSettings::new)
+ .apply(instance, NoiseSettings::create) // Plazma - Optimize noise
)
.comapFlatMap(NoiseSettings::guardY, Function.identity());
protected static final NoiseSettings OVERWORLD_NOISE_SETTINGS = create(-64, 384, 1, 2);
@@ -36,7 +36,7 @@ public record NoiseSettings(int minY, int height, int noiseSizeHorizontal, int n
}
public static NoiseSettings create(int minimumY, int height, int horizontalSize, int verticalSize) {
- NoiseSettings noiseSettings = new NoiseSettings(minimumY, height, horizontalSize, verticalSize);
+ NoiseSettings noiseSettings = new NoiseSettings(minimumY, height, horizontalSize, verticalSize, QuartPos.toBlock(horizontalSize), QuartPos.toBlock(verticalSize)); // Plazma - Optimize noise
guardY(noiseSettings).error().ifPresent(error -> {
throw new IllegalStateException(error.message());
});
@@ -44,16 +44,16 @@ public record NoiseSettings(int minY, int height, int noiseSizeHorizontal, int n
}
public int getCellHeight() {
- return QuartPos.toBlock(this.noiseSizeVertical());
+ return this.horizontalCellBlockCount; // Plazma - Optimize noise
}
public int getCellWidth() {
- return QuartPos.toBlock(this.noiseSizeHorizontal());
+ return this.verticalCellBlockCount; // Plazma - Optimize noise
}
public NoiseSettings clampToHeightAccessor(LevelHeightAccessor world) {
int i = Math.max(this.minY, world.getMinY());
int j = Math.min(this.minY + this.height, world.getMaxY() + 1) - i;
- return new NoiseSettings(i, j, this.noiseSizeHorizontal, this.noiseSizeVertical);
+ return new NoiseSettings(i, j, this.noiseSizeHorizontal, this.noiseSizeVertical, QuartPos.toBlock(this.noiseSizeHorizontal), QuartPos.toBlock(this.noiseSizeVertical)); // Plazma - Optimize noise
}
}
diff --git a/src/main/java/net/minecraft/world/level/levelgen/material/MaterialRuleList.java b/src/main/java/net/minecraft/world/level/levelgen/material/MaterialRuleList.java
index 0e6dfe2635ea5f5e410049b05f94f5083b2f18a4..584311a00c5037a6d5bc05b1261969aad1c38a4c 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/material/MaterialRuleList.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/material/MaterialRuleList.java
@@ -9,12 +9,15 @@ public record MaterialRuleList(NoiseChunk.BlockStateFiller[] materialRuleList) i
@Nullable
@Override
public BlockState calculate(DensityFunction.FunctionContext pos) {
- for (NoiseChunk.BlockStateFiller blockStateFiller : this.materialRuleList) {
- BlockState blockState = blockStateFiller.calculate(pos);
- if (blockState != null) {
- return blockState;
- }
+ // Plazma start - Optimize noise
+ //noinspection ForLoopReplaceableByForEach
+ for (int i = 0; i < this.materialRuleList.length; i++) {
+ BlockState state = this.materialRuleList[i].calculate(pos);
+ if (state == null) continue;
+
+ return state;
}
+ // Plazma end - Optimize noise
return null;
}
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
index 81f7ac9753058aa72dea5704fc9859ba3b909fb1..dc632fe50e777c019705796602debc3a7f33152d 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
@@ -55,6 +55,8 @@ public class GlobalConfiguration extends ConfigurationPart {
public WorldGeneration worldgen;
public class WorldGeneration extends ConfigurationPart {
+ boolean useAlternativeNoiseGenerator = OPTIMIZE;
+
public LavaSea lavaSea;
public class LavaSea extends ConfigurationPart {
@@ -74,6 +76,11 @@ public class GlobalConfiguration extends ConfigurationPart {
}
+ @PostProcess
+ void post() {
+ net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator.PLAZMA_USE_NOISIUM = this.useAlternativeNoiseGenerator;
+ }
+
}
public Entity entity;

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,236 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Tue, 5 Nov 2024 18:31:09 +0900
Subject: [PATCH] Hashed rcon password
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
index 3dd5c7441bb300ca17d717af37edbefb89db4b2f..df367fbb8c582614aaf2087aa37d5e47247af810 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
@@ -73,7 +73,6 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie
public final int queryPort;
public final boolean enableRcon;
public final int rconPort;
- public final String rconPassword;
public final boolean hardcore;
public final boolean allowNether;
public final boolean spawnMonsters;
@@ -113,6 +112,25 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie
public final String rconIp; // Paper - Configurable rcon ip
+ // Plazma start - hashed rcon password
+ private final boolean rconHash;
+ private final int rconHashIterationCount;
+ private final byte[] rconSalt;
+ private final String rconPassword;
+
+ private static final @Nullable javax.crypto.SecretKeyFactory HASH_INSTANCE;
+ static {
+ @Nullable javax.crypto.SecretKeyFactory factory;
+ try {
+ factory = javax.crypto.SecretKeyFactory.getInstance("PBKDF2WithHmacSHA512/256");
+ } catch (Exception e) {
+ LOGGER.error("Failed to initialize rcon hash instance", e);
+ factory = null;
+ }
+ HASH_INSTANCE = factory;
+ }
+ // Plazma end - hashed rcon password
+
// CraftBukkit start
public DedicatedServerProperties(Properties properties, OptionSet optionset) {
super(properties, optionset);
@@ -126,7 +144,7 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie
this.queryPort = this.get("query.port", 25565);
this.enableRcon = this.get("enable-rcon", false);
this.rconPort = this.get("rcon.port", 25575);
- this.rconPassword = this.get("rcon.password", "");
+ // this.rconPassword = this.get("rcon.password", ""); // Plazma - hashed rcon password
this.hardcore = this.get("hardcore", false);
this.allowNether = this.get("allow-nether", true);
this.spawnMonsters = this.get("spawn-monsters", true);
@@ -179,7 +197,82 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie
final String rconIp = this.getStringRaw("rcon.ip");
this.rconIp = rconIp == null ? this.serverIp : rconIp;
// Paper end - Configurable rcon ip
+
+ // Plazma start - hashed rcon password
+ this.rconHash = this.get("rcon.hash", false);
+ this.rconHashIterationCount = this.get("rcon.hash.iteration-count", Character.MAX_VALUE);
+ this.rconSalt = this.rconSalt();
+ this.rconPassword = this.rconPassword();
+ // Plazma end - hashed rcon password
+ }
+
+ // Plazma start - hashed rcon password
+ private byte[] rconSalt() {
+ if (!this.rconHash) return org.plazmamc.plazma.constants.Null.BYTE;
+
+ String salt = this.get("rcon.hash.salt", "");
+ if (!salt.isBlank()) {
+ try {
+ return java.util.HexFormat.of().parseHex(salt);
+ } catch (Exception e) {
+ LOGGER.error("Invalid RCON salt detected! RCON will be disabled");
+ return org.plazmamc.plazma.constants.Null.BYTE;
+ }
+ }
+
+ byte[] newSalt = new byte[16];
+ (new java.security.SecureRandom()).nextBytes(newSalt);
+ salt = java.util.HexFormat.of().formatHex(newSalt);
+ this.set("rcon.hash.salt", salt);
+ return newSalt;
+ }
+
+ private String rconPassword() {
+ String hashed = this.get("rcon.hash.password", "");
+ if (!hashed.isBlank()) {
+ try {
+ java.util.HexFormat.of().parseHex(hashed);
+ } catch (Exception e) {
+ LOGGER.error("Invalid hashed RCON password detected! RCON will be disabled");
+ return "";
+ }
+ return hashed;
+ }
+
+ String decoded = this.get("rcon.password", "");
+ if (decoded.isBlank() || HASH_INSTANCE == null || this.rconSalt.length == 0) return decoded;
+
+ try {
+ final java.security.spec.KeySpec spec = new javax.crypto.spec.PBEKeySpec(decoded.toCharArray(), this.rconSalt, this.rconHashIterationCount, 256);
+ byte[] hashedByte = HASH_INSTANCE.generateSecret(spec).getEncoded();
+ hashed = java.util.HexFormat.of().formatHex(hashedByte);
+ this.set("rcon.hash.password", hashed);
+ this.remove("rcon.password");
+ return hashed;
+ } catch (Exception e) {
+ LOGGER.error("Failed to encode rcon password", e);
+ return "";
+ }
+ }
+
+ public Boolean shouldStartRCON() {
+ return this.enableRcon && !this.rconPassword.isBlank();
+ }
+
+ public Boolean matchRconPassword(String value) {
+ if (this.rconSalt.length == 0 || HASH_INSTANCE == null) return this.rconPassword.equals(value);
+
+ try {
+ final java.security.spec.KeySpec spec = new javax.crypto.spec.PBEKeySpec(value.toCharArray(), this.rconSalt, this.rconHashIterationCount, 256);
+ byte[] hashedByte = HASH_INSTANCE.generateSecret(spec).getEncoded();
+ String hashed = java.util.HexFormat.of().formatHex(hashedByte);
+ return this.rconPassword.equals(hashed);
+ } catch (Exception e) {
+ LOGGER.error("Failed to validate rcon password", e);
+ return false;
+ }
}
+ // Plazma end - hashed rcon password
// CraftBukkit start
public static DedicatedServerProperties fromFile(Path path, OptionSet optionset) {
diff --git a/src/main/java/net/minecraft/server/dedicated/Settings.java b/src/main/java/net/minecraft/server/dedicated/Settings.java
index d7bd235ef2815890e038091dd625177049d253a5..afced52731868d5726b85a03011111adeffeb074 100644
--- a/src/main/java/net/minecraft/server/dedicated/Settings.java
+++ b/src/main/java/net/minecraft/server/dedicated/Settings.java
@@ -243,6 +243,11 @@ public abstract class Settings<T extends Settings<T>> {
return v1;
}
+ // Plazma start - Settings helper
+ protected <V> void set(String key, V value) { this.properties.put(key, value); }
+ protected void remove(String key) { this.properties.remove(key); }
+ // Plazma end - Settings helper
+
protected <V> Settings<T>.MutableValue<V> getMutable(String key, Function<String, V> parser, Function<V, String> stringifier, V fallback) {
String s1 = this.getStringRaw(key);
V v1 = MoreObjects.firstNonNull(s1 != null ? parser.apply(s1) : null, fallback);
diff --git a/src/main/java/net/minecraft/server/rcon/thread/RconClient.java b/src/main/java/net/minecraft/server/rcon/thread/RconClient.java
index 1c3775c6d29a85803c87948c64ec81cbeb87aef4..4f6f46398ac0814a95d8253cc5f575b8f09f7209 100644
--- a/src/main/java/net/minecraft/server/rcon/thread/RconClient.java
+++ b/src/main/java/net/minecraft/server/rcon/thread/RconClient.java
@@ -26,13 +26,12 @@ public class RconClient extends GenericThread {
private boolean authed;
private final Socket client;
private final byte[] buf = new byte[1460];
- private final String rconPassword;
// CraftBukkit start
private final DedicatedServer serverInterface;
private final RconConsoleSource rconConsoleSource;
// CraftBukkit end
- RconClient(ServerInterface server, String password, Socket socket) {
+ RconClient(ServerInterface server, Socket socket) {// Plazma - hashed rcon password
super("RCON Client " + String.valueOf(socket.getInetAddress()));
this.serverInterface = (DedicatedServer) server; // CraftBukkit
this.client = socket;
@@ -43,7 +42,6 @@ public class RconClient extends GenericThread {
this.running = false;
}
- this.rconPassword = password;
this.rconConsoleSource = new net.minecraft.server.rcon.RconConsoleSource(this.serverInterface, socket.getRemoteSocketAddress()); // CraftBukkit
}
@@ -93,7 +91,7 @@ public class RconClient extends GenericThread {
String s1 = PktUtils.stringFromByteArray(this.buf, j, i);
int j1 = j + s1.length();
- if (!s1.isEmpty() && s1.equals(this.rconPassword)) {
+ if (!s1.isEmpty() && serverInterface.getProperties().matchRconPassword(s1)) {
this.authed = true;
this.send(l, 2, "");
continue;
diff --git a/src/main/java/net/minecraft/server/rcon/thread/RconThread.java b/src/main/java/net/minecraft/server/rcon/thread/RconThread.java
index c12d7db2b048a327c0e8f398848cd3a9bce0ebce..150cecc44a7f49740fa400e02de09671ff8b392a 100644
--- a/src/main/java/net/minecraft/server/rcon/thread/RconThread.java
+++ b/src/main/java/net/minecraft/server/rcon/thread/RconThread.java
@@ -16,15 +16,13 @@ import org.slf4j.Logger;
public class RconThread extends GenericThread {
private static final Logger LOGGER = LogUtils.getLogger();
private final ServerSocket socket;
- private final String rconPassword;
private final List<RconClient> clients = Lists.newArrayList();
private final ServerInterface serverInterface;
- private RconThread(ServerInterface server, ServerSocket listener, String password) {
+ private RconThread(ServerInterface server, ServerSocket listener) {// Plazma - hashed rcon password
super("RCON Listener");
this.serverInterface = server;
this.socket = listener;
- this.rconPassword = password;
}
private void clearClients() {
@@ -37,7 +35,7 @@ public class RconThread extends GenericThread {
while (this.running) {
try {
Socket socket = this.socket.accept();
- RconClient rconClient = new RconClient(this.serverInterface, this.rconPassword, socket);
+ RconClient rconClient = new RconClient(this.serverInterface, socket); // Plazma - hashed rcon password
rconClient.start();
this.clients.add(rconClient);
this.clearClients();
@@ -64,15 +62,14 @@ public class RconThread extends GenericThread {
int i = dedicatedServerProperties.rconPort;
if (0 < i && 65535 >= i) {
- String string2 = dedicatedServerProperties.rconPassword;
- if (string2.isEmpty()) {
+ if (!dedicatedServerProperties.shouldStartRCON()) { // Plazma - hashed rcon password
LOGGER.warn("No rcon password set in server.properties, rcon disabled!");
return null;
} else {
try {
ServerSocket serverSocket = new ServerSocket(i, 0, InetAddress.getByName(string));
serverSocket.setSoTimeout(500);
- RconThread rconThread = new RconThread(server, serverSocket, string2);
+ RconThread rconThread = new RconThread(server, serverSocket); // Plazma - hashed rcon password
if (!rconThread.start()) {
return null;
} else {

View File

@@ -0,0 +1,138 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Fri, 13 Dec 2024 11:14:49 +0900
Subject: [PATCH] Add option to allow shoot fireball
diff --git a/src/main/java/net/minecraft/world/item/FireChargeItem.java b/src/main/java/net/minecraft/world/item/FireChargeItem.java
index 641eb27097740219199ce61ed3e6aa5f42a51b1c..f51be1746fc649d636bc9e3ae451d18e35a04026 100644
--- a/src/main/java/net/minecraft/world/item/FireChargeItem.java
+++ b/src/main/java/net/minecraft/world/item/FireChargeItem.java
@@ -30,6 +30,58 @@ public class FireChargeItem extends Item implements ProjectileItem {
super(settings);
}
+ // Plazma start - Option to shoot fireballs
+ @Override
+ public InteractionResult use(Level world, Player user, net.minecraft.world.InteractionHand hand) {
+ if (!(world instanceof net.minecraft.server.level.ServerLevel level) || !world.plazmaConfig().item.shootableFireCharge.enabled) {
+ super.use(world, user, hand);
+ return InteractionResult.PASS;
+ }
+
+ Vec3 vec = user.getDirection().getUnitVec3().multiply(10, 10, 10);
+ net.minecraft.world.entity.projectile.AbstractHurtingProjectile fireball = switch(world.plazmaConfig().item.shootableFireCharge.shootType) {
+ case SMALL_FIREBALL -> new SmallFireball(world, user, vec);
+ case LARGE_FIREBALL -> new net.minecraft.world.entity.projectile.LargeFireball(world, user, vec, world.plazmaConfig().item.shootableFireCharge.explosionPower);
+ case DRAGON_FIREBALL -> new net.minecraft.world.entity.projectile.DragonFireball(world, user, vec);
+ case WITHER_SKULL -> new net.minecraft.world.entity.projectile.WitherSkull(world, user, vec);
+ };
+
+ ItemStack itemStack = user.getItemInHand(hand);
+ net.minecraft.world.entity.projectile.Projectile.Delayed<net.minecraft.world.entity.projectile.AbstractHurtingProjectile> delayed;
+ delayed = net.minecraft.world.entity.projectile.Projectile.spawnProjectileDelayed(
+ fireball,
+ level,
+ itemStack,
+ projectile -> {
+ projectile.setPos(user.getX(), user.getEyeY() - 0.10000000149011612D, user.getZ());
+ projectile.shootFromRotation(user, user.getXRot(), user.getYRot(), world.plazmaConfig().item.shootableFireCharge.shootRoll, world.plazmaConfig().item.shootableFireCharge.shootPower, world.plazmaConfig().item.shootableFireCharge.shootOffset);
+ if (!(projectile instanceof net.minecraft.world.entity.projectile.Fireball ball)) return;
+ ball.setItem(itemStack);
+ }
+ );
+
+ com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent event;
+ event = new com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent(
+ (org.bukkit.entity.Player) user.getBukkitEntity(),
+ org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemStack),
+ (org.bukkit.entity.Projectile) delayed.projectile().getBukkitEntity()
+ );
+
+ if (event.callEvent() && delayed.attemptSpawn(org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.FIRE_CHARGE)) {
+ user.awardStat(net.minecraft.stats.Stats.ITEM_USED.get(this));
+
+ if (event.shouldConsume()) itemStack.consume(1, user);
+ else if (user instanceof net.minecraft.server.level.ServerPlayer) ((net.minecraft.server.level.ServerPlayer) user).getBukkitEntity().updateInventory();
+
+ world.playSound(null, user.getX(), user.getY(), user.getZ(), SoundEvents.FIRECHARGE_USE, SoundSource.NEUTRAL, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F));
+ return InteractionResult.SUCCESS;
+ }
+
+ if (user instanceof net.minecraft.server.level.ServerPlayer) ((net.minecraft.server.level.ServerPlayer) user).getBukkitEntity().updateInventory();
+ return InteractionResult.FAIL;
+ }
+ // Plazma end - Option to shoot fireballs
+
@Override
public InteractionResult useOn(UseOnContext context) {
Level world = context.getLevel();
diff --git a/src/main/java/net/minecraft/world/item/Items.java b/src/main/java/net/minecraft/world/item/Items.java
index 580bd63fdbf9555f867362d3c1f39f41fd750089..bfde7c2d386d94913bde5452b903f2f2ee7ac672 100644
--- a/src/main/java/net/minecraft/world/item/Items.java
+++ b/src/main/java/net/minecraft/world/item/Items.java
@@ -1698,7 +1698,7 @@ public class Items {
ExperienceBottleItem::new,
new Item.Properties().rarity(Rarity.UNCOMMON).component(DataComponents.ENCHANTMENT_GLINT_OVERRIDE, true)
);
- public static final Item FIRE_CHARGE = registerItem("fire_charge", FireChargeItem::new);
+ public static final Item FIRE_CHARGE = registerItem("fire_charge", FireChargeItem::new, new Item.Properties().useCooldown(org.plazmamc.plazma.configurations.GlobalConfiguration.get().item.fireCharge.cooldown()));
public static final Item WIND_CHARGE = registerItem("wind_charge", WindChargeItem::new, new Item.Properties().useCooldown(0.5F));
public static final Item WRITABLE_BOOK = registerItem(
"writable_book", WritableBookItem::new, new Item.Properties().stacksTo(1).component(DataComponents.WRITABLE_BOOK_CONTENT, WritableBookContent.EMPTY)
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
index dc632fe50e777c019705796602debc3a7f33152d..3c917e2a7fe8e5ff1ac91ddba29c717952a15d57 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
@@ -156,7 +156,6 @@ public class GlobalConfiguration extends ConfigurationPart {
}
-
public ConsoleLogs consoleLogs;
public class ConsoleLogs extends ConfigurationPart {
diff --git a/src/main/java/org/plazmamc/plazma/configurations/RemovedConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/RemovedConfigurations.java
index ac0f038de0ce5cf6df0b730af69d3229c3119eff..ba3331a81002304187318ed32fec2dd31e4c23ee 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/RemovedConfigurations.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/RemovedConfigurations.java
@@ -7,7 +7,8 @@ import static org.spongepowered.configurate.NodePath.path;
interface RemovedConfigurations {
NodePath[] WORLD_PATHS = {
- path("structure", "nether-portal")
+ path("structure", "nether-portal"),
+ path("item", "allow-shoot-fireballs")
};
NodePath[] GLOBAL_PATHS = {
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
index c1d4a96cf5be77f4460c54ed19622f527d42ca06..bbb51ccf2016987202811ee893f855da2612dd17 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
@@ -86,6 +86,25 @@ public class WorldConfigurations extends ConfigurationPart {
public Item item;
public class Item extends ConfigurationPart {
+ public ShootableFireCharge shootableFireCharge;
+ public class ShootableFireCharge extends ConfigurationPart {
+
+ public boolean enabled = false;
+ public ShootType shootType = ShootType.SMALL_FIREBALL;
+ public int explosionPower = 1;
+
+ public float shootRoll = 0.0f;
+ public float shootPower = 1.5f;
+ public float shootOffset = 1.0f;
+
+ public enum ShootType {
+ SMALL_FIREBALL,
+ LARGE_FIREBALL,
+ DRAGON_FIREBALL,
+ WITHER_SKULL
+ }
+
+ }
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,117 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Fri, 13 Dec 2024 21:10:27 +0900
Subject: [PATCH] Port minor SparklyPaper patches
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
index c14ce846afb7364e541bfe01b73a06a94e48f55b..3b11cc112e98cea1067ecdfe20d894f8ba753b93 100644
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
@@ -58,6 +58,7 @@ import org.bukkit.event.player.PlayerVelocityEvent;
public class ServerEntity {
+ public static boolean PLAZMA_DISTANCE_SQR = false; // Plazma - Port Minor SparklyPaper patches; Skip distanceToSqr if the delta is the same
private static final Logger LOGGER = LogUtils.getLogger();
private static final int TOLERANCE_LEVEL_ROTATION = 1;
private static final double TOLERANCE_LEVEL_POSITION = 7.62939453125E-6D;
@@ -232,6 +233,7 @@ public class ServerEntity {
if ((this.trackDelta || this.entity.hasImpulse || this.entity instanceof LivingEntity && ((LivingEntity) this.entity).isFallFlying()) && this.tickCount > 0) {
Vec3 vec3d1 = this.entity.getDeltaMovement();
+ if (PLAZMA_DISTANCE_SQR || vec3d1 != this.lastSentMovement) { // Plazma - Port Minor SparklyPaper patches; Skip distanceToSqr if the delta is the same
double d0 = vec3d1.distanceToSqr(this.lastSentMovement);
if (d0 > 1.0E-7D || d0 > 0.0D && vec3d1.lengthSqr() == 0.0D) {
@@ -246,6 +248,7 @@ public class ServerEntity {
this.broadcast.accept(new ClientboundSetEntityMotionPacket(this.entity.getId(), this.lastSentMovement));
}
}
+ } // Plazma - Port Minor SparklyPaper patches; Skip distanceToSqr if the delta is the same
}
if (packet1 != null) {
diff --git a/src/main/java/net/minecraft/stats/ServerStatsCounter.java b/src/main/java/net/minecraft/stats/ServerStatsCounter.java
index da7e1a69ecb4e6b3be2d8544ac406aa519bd196e..ce56fdd0bbe1c95146c88594c68a6a399f01218e 100644
--- a/src/main/java/net/minecraft/stats/ServerStatsCounter.java
+++ b/src/main/java/net/minecraft/stats/ServerStatsCounter.java
@@ -90,12 +90,14 @@ public class ServerStatsCounter extends StatsCounter {
this.dirty.add(stat);
}
+ /* // Plazma - Port Minor SparklyPaper patches; Skip dirty stats copy when requesting player stats
private Set<Stat<?>> getDirty() {
Set<Stat<?>> set = Sets.newHashSet(this.dirty);
this.dirty.clear();
return set;
}
+ */ // Plazma - Port Minor SparklyPaper patches; Skip dirty stats copy when requesting player stats
public void parseLocal(DataFixer dataFixer, String json) {
try {
@@ -242,14 +244,12 @@ public class ServerStatsCounter extends StatsCounter {
}
public void sendStats(ServerPlayer player) {
- Object2IntMap<Stat<?>> object2intmap = new Object2IntOpenHashMap();
- Iterator iterator = this.getDirty().iterator();
+ // Plazma start - Port Minor SparklyPaper patches; Skip dirty stats copy when requesting player stats
+ Object2IntMap<Stat<?>> object2intmap = new Object2IntOpenHashMap<>();
+ for (final Stat<?> stat : this.dirty) object2intmap.put(stat, this.getValue(stat));
- while (iterator.hasNext()) {
- Stat<?> statistic = (Stat) iterator.next();
-
- object2intmap.put(statistic, this.getValue(statistic));
- }
+ this.dirty.clear();
+ // Plazma end - Port Minor SparklyPaper patches; Skip dirty stats copy when requesting player stats
player.connection.send(new ClientboundAwardStatsPacket(object2intmap));
}
diff --git a/src/main/java/net/minecraft/world/item/MapItem.java b/src/main/java/net/minecraft/world/item/MapItem.java
index 8c455ac7dcb126e2b2932eba980454513947fac2..ecf9153b0eadb264d79fe9a809918bb13cd6d4b8 100644
--- a/src/main/java/net/minecraft/world/item/MapItem.java
+++ b/src/main/java/net/minecraft/world/item/MapItem.java
@@ -276,7 +276,12 @@ public class MapItem extends Item {
mapItemSavedData.tickCarriedBy(player, stack);
}
- if (!mapItemSavedData.locked && (selected || entity instanceof Player && ((Player)entity).getOffhandItem() == stack)) {
+ // Plazma start - Port Minor SparklyPaper patches; Skip map update if the craft renderer is null
+ if (!mapItemSavedData.locked
+ && (!world.plazmaConfig().item.skipMapUpdateIfCraftRenderIsNull || mapItemSavedData.mapView.getRenderers().stream().anyMatch(renderer -> renderer instanceof org.bukkit.craftbukkit.map.CraftMapRenderer))
+ && (selected || entity instanceof Player player && player.getOffhandItem() == stack)
+ ) {
+ // Plazma end - Port Minor SparklyPaper patches; Skip map update if the craft renderer is null
this.update(world, entity, mapItemSavedData);
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/map/CraftMapColorCache.java b/src/main/java/org/bukkit/craftbukkit/map/CraftMapColorCache.java
index 8149b9c51b78eb5c689b7218a2ca3aab60e73bcf..125a4f13dbe98976c4cf94bb523463a51bd4f8dd 100644
--- a/src/main/java/org/bukkit/craftbukkit/map/CraftMapColorCache.java
+++ b/src/main/java/org/bukkit/craftbukkit/map/CraftMapColorCache.java
@@ -145,7 +145,7 @@ public class CraftMapColorCache implements MapPalette.MapColorCache {
}
@Override
- public boolean isCached() {
+ public synchronized boolean isCached() { // Plazma - Port Minor SparklyPaper patches; Fix concurrency issues when using "imageToBytes" in multiple threads
return this.cached || (!this.running.get() && this.initCache().isDone());
}
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
index bbb51ccf2016987202811ee893f855da2612dd17..f6f372644bca9111aa3f45bf7ae8e66e53d11505 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
@@ -86,6 +86,8 @@ public class WorldConfigurations extends ConfigurationPart {
public Item item;
public class Item extends ConfigurationPart {
+ public boolean skipMapUpdateIfCraftRenderIsNull = true;
+
public ShootableFireCharge shootableFireCharge;
public class ShootableFireCharge extends ConfigurationPart {

View File

@@ -0,0 +1,317 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Fri, 13 Dec 2024 21:00:07 +0900
Subject: [PATCH] SparklyPaper - Optimize framed map tracker ticking
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
index 3b11cc112e98cea1067ecdfe20d894f8ba753b93..f33e7f7fdee160b7397b1156c179a5c95816307a 100644
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
@@ -129,33 +129,31 @@ public class ServerEntity {
Entity entity = this.entity;
- if (!this.trackedPlayers.isEmpty() && entity instanceof ItemFrame entityitemframe) { // Paper - Perf: Only tick item frames if players can see it
- if (true || this.tickCount % 10 == 0) { // CraftBukkit - Moved below, should always enter this block
- ItemStack itemstack = entityitemframe.getItem();
-
- if (this.level.paperConfig().maps.itemFrameCursorUpdateInterval > 0 && this.tickCount % this.level.paperConfig().maps.itemFrameCursorUpdateInterval == 0 && itemstack.getItem() instanceof MapItem) { // CraftBukkit - Moved this.tickCounter % 10 logic here so item frames do not enter the other blocks // Paper - Make item frame map cursor update interval configurable
- MapId mapid = entityitemframe.cachedMapId; // Paper - Perf: Cache map ids on item frames
- MapItemSavedData worldmap = MapItem.getSavedData(mapid, this.level);
-
- if (worldmap != null) {
- Iterator<ServerPlayerConnection> iterator = this.trackedPlayers.iterator(); // CraftBukkit
-
- while (iterator.hasNext()) {
- ServerPlayer entityplayer = iterator.next().getPlayer(); // CraftBukkit
-
- worldmap.tickCarriedBy(entityplayer, itemstack);
- Packet<?> packet = worldmap.getUpdatePacket(mapid, entityplayer);
+ // Plazma start - Optimize framed map tracker ticking
+ if (!this.trackedPlayers.isEmpty() && entity instanceof ItemFrame frame && frame.cachedMapId != null) { // Paper - Perf: Only tick item frames if players can see it
+ if (this.level.paperConfig().maps.itemFrameCursorUpdateInterval > 0 && this.tickCount % this.level.paperConfig().maps.itemFrameCursorUpdateInterval == 0) { // CraftBukkit - Moved this.tickCounter % 10 logic here so item frames do not enter the other blocks // Paper - Make item frame map cursor update interval configurable
+ MapId id = frame.cachedMapId; // Paper - Perf: Cache map ids on item frames
+ MapItemSavedData data = MapItem.getSavedData(id, this.level);
+
+ if (data != null) for (final ServerPlayerConnection trackedPlayer : this.trackedPlayers) {
+ if (!data.hasContextualRenderer) {
+ // Pass in a "random" player when a non-contextual plugin renderer is added to make sure it is called
+ final Packet<?> updatePacket = data.framedUpdatePacket(id, data.hasPluginRenderer ? com.google.common.collect.Iterables.getFirst(this.trackedPlayers, null).getPlayer() : null);
+
+ if (updatePacket != null)
+ for (ServerPlayerConnection connection : this.trackedPlayers) connection.send(updatePacket);
+ } else {
+ ServerPlayer player = trackedPlayer.getPlayer(); // CraftBukkit
+ Packet<?> packet = data.getUpdatePacket(id, player);
- if (packet != null) {
- entityplayer.connection.send(packet);
- }
- }
+ if (packet != null) player.connection.send(packet);
}
}
-
- this.sendDirtyEntityData();
}
+
+ this.sendDirtyEntityData();
}
+ // Plazma end - Optimize framed map tracker ticking
if (this.forceStateResync || this.tickCount % this.updateInterval == 0 || this.entity.hasImpulse || this.entity.getEntityData().isDirty()) { // Paper - fix desync when a player is added to the tracker
byte b0 = Mth.packDegrees(this.entity.getYRot());
@@ -426,6 +424,16 @@ public class ServerEntity {
}
}
+ // Plazma start - Optimize framed map tracker adding
+ if (this.entity instanceof ItemFrame frame && frame.cachedMapId != null) {
+ MapItemSavedData mapData = MapItem.getSavedData(frame.cachedMapId, this.level);
+ if (mapData == null) return;
+
+ mapData.addFrameDecoration(frame);
+ final Packet<?> mapPacket = mapData.fullUpdatePacket(frame.cachedMapId, mapData.hasPluginRenderer ? player : null);
+ if (mapPacket != null) sender.accept((Packet<ClientGamePacketListener>) mapPacket);
+ }
+ // Plazma end - Optimize framed map tracker adding
}
public Vec3 getPositionBase() {
diff --git a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
index 27f7a0abf77e94f15ff5f42e54e979377c94e63c..d1b8edccf3d7418a4aceba8491491b3a339b645a 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
@@ -175,6 +175,16 @@ public class ItemFrame extends HangingEntity {
this.setItem(ItemStack.fromBukkitCopy(event.getItemStack()), false);
}
// Paper end - Add PlayerItemFrameChangeEvent
+ // Plazma start - Optimize framed map tracker ticking
+ final ItemStack item = this.getItem();
+ if (item.is(Items.FILLED_MAP)) {
+ final MapItemSavedData data = MapItem.getSavedData(item, this.level());
+ if (data != null) {
+ data.addFrameDecoration(this);
+ data.markAllDirty();
+ }
+ }
+ // Plazma end - Optimize framed map tracker ticking
this.dropItem(world, source.getEntity(), false);
this.gameEvent(GameEvent.BLOCK_CHANGE, source.getEntity());
this.playSound(this.getRemoveItemSound(), 1.0F, 1.0F);
diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
index 71aa3b9c5604f832e764e0d7a93da467ffe7dee1..e1440d1fc32229867e1f1543961fdfcec99a36fd 100644
--- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
+++ b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
@@ -80,12 +80,22 @@ public class MapItemSavedData extends SavedData {
public final Map<String, MapDecoration> decorations = Maps.newLinkedHashMap();
private final Map<String, MapFrame> frameMarkers = Maps.newHashMap();
private int trackedDecorationCount;
- private org.bukkit.craftbukkit.map.RenderData vanillaRender = new org.bukkit.craftbukkit.map.RenderData(); // Paper
+ private final org.bukkit.craftbukkit.map.RenderData vanillaRender = new org.bukkit.craftbukkit.map.RenderData(); // Paper // Plazma - Improve code styling
public boolean isExplorerMap; // Purpur
+ // Plazma start - Optimize framed map tracker ticking; Shared between all players tracking this map inside an item frame
+ public boolean dirtyColorData;
+ public int minDirtyX;
+ public int minDirtyY;
+ public int maxDirtyX;
+ public int maxDirtyY;
+ public boolean dirtyFrameDecorations;
+ public boolean hasPluginRenderer;
+ public boolean hasContextualRenderer;
+ // Plazma end - Optimize framed map tracker ticking; Shared between all players tracking this map inside an item frame
// CraftBukkit start
public final CraftMapView mapView;
- private CraftServer server;
+ private final CraftServer server; // Plazma - Improve code styling
public UUID uniqueId = null;
public MapId id;
// CraftBukkit end
@@ -372,7 +382,7 @@ public class MapItemSavedData extends SavedData {
--this.trackedDecorationCount;
}
- if (mapicon != null) this.setDecorationsDirty(); // Paper - only mark dirty if a change occurs
+ if (mapicon != null && mapicon.renderOnFrame()) this.dirtyFrameDecorations = true; // Plazma - Optimize framed map tracker ticking
}
public static void addTargetDecoration(ItemStack stack, BlockPos pos, String id, Holder<MapDecorationType> decorationType) {
@@ -409,6 +419,7 @@ public class MapItemSavedData extends SavedData {
}
this.setDecorationsDirty();
+ if (mapicon.renderOnFrame()) this.dirtyFrameDecorations = true; // Plazma - Optimize framed map tracker ticking
}
}
@@ -480,14 +491,23 @@ public class MapItemSavedData extends SavedData {
public void setColorsDirty(int x, int z) {
this.setDirty();
- Iterator iterator = this.carriedBy.iterator();
-
- while (iterator.hasNext()) {
- MapItemSavedData.HoldingPlayer worldmap_worldmaphumantracker = (MapItemSavedData.HoldingPlayer) iterator.next();
-
- worldmap_worldmaphumantracker.markColorsDirty(x, z);
- }
-
+ // Plazma start - Optimize framed map tracker ticking
+ if (this.dirtyColorData) {
+ this.minDirtyX = Math.min(this.minDirtyX, x);
+ this.minDirtyY = Math.min(this.minDirtyY, z);
+ this.maxDirtyX = Math.max(this.maxDirtyX, x);
+ this.maxDirtyY = Math.max(this.maxDirtyY, z);
+ } else {
+ this.dirtyColorData = true;
+ this.minDirtyX = x;
+ this.minDirtyY = z;
+ this.maxDirtyX = x;
+ this.maxDirtyY = z;
+ } // diff on change
+ for (final HoldingPlayer tracker : this.carriedBy) {
+ tracker.markColorsDirty(x, z);
+ } // diff on change
+ // Plazma end - Optimize framed map tracker ticking
}
public void setDecorationsDirty() {
@@ -563,6 +583,7 @@ public class MapItemSavedData extends SavedData {
this.removeDecoration(MapItemSavedData.getFrameKey(id));
this.frameMarkers.remove(MapFrame.frameId(pos));
this.setDirty();
+ this.dirtyFrameDecorations = true; // Plazma - Optimize framed map tracker ticking
}
public boolean updateColor(int x, int z, byte color) {
@@ -776,4 +797,86 @@ public class MapItemSavedData extends SavedData {
}
}
+
+ // Plazma start - Optimize framed map tracker ticking
+ public final @Nullable Packet<?> framedUpdatePacket(MapId id, @Nullable Player player) {
+ return createUpdatePacket(id, player, false);
+ }
+
+ public final @Nullable Packet<?> fullUpdatePacket(MapId id, @Nullable Player player) {
+ return createUpdatePacket(id, player, true);
+ }
+
+ public final @Nullable Packet<?> createUpdatePacket(MapId id, @Nullable Player player, boolean full) {
+ if (!dirtyColorData && !dirtyFrameDecorations && (player == null || server.getCurrentTick() % 5 != 0) && !full)
+ // Periodically send update packets if a renderer is added
+ return null;
+
+ final org.bukkit.craftbukkit.map.RenderData render = player != null
+ ? this.mapView.render((org.bukkit.craftbukkit.entity.CraftPlayer) player.getBukkitEntity())
+ : this.vanillaRender;
+
+ final MapPatch patch;
+ if (full) {
+ patch = createPatch(render.buffer, 0, 0, 127, 127);
+ } else if (dirtyColorData) {
+ dirtyColorData = false;
+ patch = createPatch(render.buffer, this.minDirtyX, this.minDirtyY, this.maxDirtyX, this.maxDirtyY);
+ } else {
+ patch = null;
+ }
+
+ Collection<MapDecoration> decorations = null;
+ if (dirtyFrameDecorations || full || hasPluginRenderer) { // Always add decorations when a plugin renderer is added
+ dirtyFrameDecorations = false;
+ decorations = new java.util.ArrayList<>();
+
+ if (player == null) {
+ // Using the vanilla renderer, add in vanilla decorations
+ for (MapDecoration decoration : this.decorations.values()) {
+ // Skip sending decorations that are not rendered, i.e., player decorations.
+ // Skipping player decorations also allows sending the same update packet to all tracking players, the only issue
+ // being that it causes a slight flicker of the player decoration for anyone holding and looking at the map.
+ if (decoration.renderOnFrame()) decorations.add(decoration);
+ }
+ }
+
+ for (final org.bukkit.map.MapCursor cursor : render.cursors) {
+ if (cursor.isVisible()) continue;
+ decorations.add(new MapDecoration(CraftMapCursor.CraftType.bukkitToMinecraftHolder(cursor.getType()), cursor.getX(), cursor.getY(), cursor.getDirection(), Optional.ofNullable(PaperAdventure.asVanilla(cursor.caption()))));
+ }
+ }
+
+ return new ClientboundMapItemDataPacket(id, this.scale, this.locked, decorations, patch);
+ }
+
+ private MapPatch createPatch(byte[] buffer, int minDirtyX, int minDirtyY, int maxDirtyX, int maxDirtyY) {
+ int xL = maxDirtyX + 1 - minDirtyX;
+ int yL = maxDirtyY + 1 - minDirtyY;
+ byte[] bytes = new byte[xL * yL];
+
+ for (int i = 0; i < xL; ++i) for (int j = 0; j < yL; ++j)
+ bytes[i + j * xL] = buffer[minDirtyX + i + (minDirtyY + j) * 128];
+
+ return new MapItemSavedData.MapPatch(minDirtyX, minDirtyY, xL, yL, bytes);
+ }
+
+ public void addFrameDecoration(net.minecraft.world.entity.decoration.ItemFrame frame) {
+ if (this.trackedDecorationCount >= frame.level().paperConfig().maps.itemFrameCursorLimit || this.frameMarkers.containsKey(MapFrame.frameId(frame.getPos())))
+ return;
+
+ MapFrame mapFrame = new MapFrame(frame.getPos(), frame.getDirection().get2DDataValue() * 90, frame.getId());
+ this.addDecoration(MapDecorationTypes.FRAME, frame.level(), "frame-" + frame.getId(), frame.getPos().getX(), frame.getPos().getZ(), mapFrame.getRotation(), null);
+ this.frameMarkers.put(mapFrame.getId(), mapFrame);
+ }
+
+ public void markAllDirty() {
+ this.dirtyColorData = true;
+ this.minDirtyX = 0;
+ this.minDirtyY = 0;
+ this.maxDirtyX = 127;
+ this.maxDirtyY = 127;
+ this.dirtyFrameDecorations = true;
+ }
+ // Plazma end - Optimize framed map tracker ticking
}
diff --git a/src/main/java/org/bukkit/craftbukkit/map/CraftMapView.java b/src/main/java/org/bukkit/craftbukkit/map/CraftMapView.java
index a15cdf64575841edfe30f2b2c522f8fdfe2caae3..d8e8faf38a2fc6ae9846a6a0d2868d0a1418afef 100644
--- a/src/main/java/org/bukkit/craftbukkit/map/CraftMapView.java
+++ b/src/main/java/org/bukkit/craftbukkit/map/CraftMapView.java
@@ -97,11 +97,15 @@ public final class CraftMapView implements MapView {
@Override
public void addRenderer(MapRenderer renderer) {
- if (!this.renderers.contains(renderer)) {
- this.renderers.add(renderer);
- this.canvases.put(renderer, new HashMap<CraftPlayer, CraftMapCanvas>());
- renderer.initialize(this);
- }
+ // Plazma start - Optimize framed map tracker ticking
+ if (this.renderers.contains(renderer)) return;
+
+ this.renderers.add(renderer);
+ this.canvases.put(renderer, new HashMap<>());
+ this.worldMap.hasPluginRenderer |= !(renderer instanceof CraftMapRenderer);
+ this.worldMap.hasContextualRenderer |= renderer.isContextual();
+ renderer.initialize(this);
+ // Plazma end - Optimize framed map tracker ticking
}
@Override
@@ -116,6 +120,16 @@ public final class CraftMapView implements MapView {
}
}
this.canvases.remove(renderer);
+ // Plazma start - Optimize framed map tracker ticking
+ this.worldMap.hasPluginRenderer = !(this.renderers.size() == 1 && this.renderers.getFirst() instanceof CraftMapRenderer);
+ if (!renderer.isContextual()) return true;
+
+ // Re-check all renderers
+ boolean contextualFound = false;
+ for (final MapRenderer mapRenderer : this.renderers) contextualFound |= mapRenderer.isContextual();
+
+ this.worldMap.hasContextualRenderer = contextualFound;
+ // Plazma end - Optimize framed map tracker ticking
return true;
} else {
return false;

View File

@@ -0,0 +1,137 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Fri, 13 Dec 2024 21:18:55 +0900
Subject: [PATCH] SparklyPaper - Skip executeTick check if there's no task to
be run
diff --git a/src/main/java/io/papermc/paper/threadedregions/EntityScheduler.java b/src/main/java/io/papermc/paper/threadedregions/EntityScheduler.java
index c03608fec96b51e1867f43d8f42e5aefb1520e46..9bb01accce426fafbddc1965a61257a73af8f152 100644
--- a/src/main/java/io/papermc/paper/threadedregions/EntityScheduler.java
+++ b/src/main/java/io/papermc/paper/threadedregions/EntityScheduler.java
@@ -36,8 +36,9 @@ public final class EntityScheduler {
* The Entity. Note that it is the CraftEntity, since only that class properly tracks world transfers.
*/
public final CraftEntity entity;
+ public final net.minecraft.server.MinecraftServer server; // Plazma - Skip executeTick check if there is no any task to be run
- private static final record ScheduledTask(Consumer<? extends Entity> run, Consumer<? extends Entity> retired) {}
+ private record ScheduledTask(Consumer<? extends Entity> run, Consumer<? extends Entity> retired) {} // Plazma - minor code improvement
private long tickCount = 0L;
private static final long RETIRED_TICK_COUNT = -1L;
@@ -46,7 +47,8 @@ public final class EntityScheduler {
private final ArrayDeque<ScheduledTask> currentlyExecuting = new ArrayDeque<>();
- public EntityScheduler(final CraftEntity entity) {
+ public EntityScheduler(final net.minecraft.server.MinecraftServer server, final CraftEntity entity) { // Plazma - Skip executeTick check if there is no any task to be run
+ this.server = Validate.notNull(server); // Plazma - Skip executeTick check if there is no any task to be run
this.entity = Validate.notNull(entity);
}
@@ -61,15 +63,15 @@ public final class EntityScheduler {
* @throws IllegalStateException If the scheduler is already retired.
*/
public void retire() {
+ final Entity thisEntity = this.entity.getHandleRaw(); // Plazma - Skip executeTick check if there is no any task to be run
synchronized (this.stateLock) {
if (this.tickCount == RETIRED_TICK_COUNT) {
throw new IllegalStateException("Already retired");
}
this.tickCount = RETIRED_TICK_COUNT;
+ this.server.entitiesWithScheduledTasks.remove(thisEntity); // Plazma - Skip executeTick check if there is no any task to be run
}
- final Entity thisEntity = this.entity.getHandleRaw();
-
// correctly handle and order retiring while running executeTick
for (int i = 0, len = this.currentlyExecuting.size(); i < len; ++i) {
final ScheduledTask task = this.currentlyExecuting.pollFirst();
@@ -124,9 +126,8 @@ public final class EntityScheduler {
if (this.tickCount == RETIRED_TICK_COUNT) {
return false;
}
- this.oneTimeDelayed.computeIfAbsent(this.tickCount + Math.max(1L, delay), (final long keyInMap) -> {
- return new ArrayList<>();
- }).add(task);
+ this.server.entitiesWithScheduledTasks.add(this.entity.getHandleRaw()); // Plazma - Skip executeTick check if there is no any task to be run
+ this.oneTimeDelayed.computeIfAbsent(this.tickCount + Math.max(1L, delay), ignored -> new ArrayList<>()).add(task); // Plazma - Skip executeTick check if there is no any task to be run
}
return true;
@@ -143,6 +144,13 @@ public final class EntityScheduler {
TickThread.ensureTickThread(thisEntity, "May not tick entity scheduler asynchronously");
final List<ScheduledTask> toRun;
synchronized (this.stateLock) {
+ // Plazma start - Skip executeTick check if there is no any task to be run
+ if (this.currentlyExecuting.isEmpty() && this.oneTimeDelayed.isEmpty()) {
+ this.server.entitiesWithScheduledTasks.remove(thisEntity);
+ return;
+ }
+ // Plazma end - Skip executeTick check if there is no any task to be run
+
if (this.tickCount == RETIRED_TICK_COUNT) {
throw new IllegalStateException("Ticking retired scheduler");
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index e63e6d885054cd926508f9999c8a4eed712d4891..022c4c01ab015a2a6135baa5dbe442fa7a1b4615 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -337,6 +337,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public volatile boolean abnormalExit = false; // Paper
public static final long SERVER_INIT = System.nanoTime(); // Paper - Lag compensation
private final Set<String> pluginsBlockingSleep = new java.util.HashSet<>(); // Paper - API to allow/disallow tick sleeping
+ public final Set<Entity> entitiesWithScheduledTasks = java.util.concurrent.ConcurrentHashMap.newKeySet(); // Plazma - Skip executeTick check if there is no any task to be run
public gg.pufferfish.pufferfish.util.AsyncExecutor mobSpawnExecutor = new gg.pufferfish.pufferfish.util.AsyncExecutor("MobSpawning"); // Pufferfish - optimize mob spawning
public static <S extends MinecraftServer> S spin(Function<Thread, S> serverFactory) {
@@ -1869,17 +1870,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.server.getScheduler().mainThreadHeartbeat(); // CraftBukkit
// Paper start - Folia scheduler API
((io.papermc.paper.threadedregions.scheduler.FoliaGlobalRegionScheduler) Bukkit.getGlobalRegionScheduler()).tick();
- getAllLevels().forEach(level -> {
- for (final Entity entity : level.getEntities().getAll()) {
- if (entity.isRemoved()) {
- continue;
- }
- final org.bukkit.craftbukkit.entity.CraftEntity bukkit = entity.getBukkitEntityRaw();
- if (bukkit != null) {
- bukkit.taskScheduler.executeTick();
- }
- }
- });
+ // Plazma start - Skip executeTick check if there is no any task to be run
+ for (final Entity entity : entitiesWithScheduledTasks) {
+ if (entity.isRemoved()) continue;
+
+ final org.bukkit.craftbukkit.entity.CraftEntity craftEntity = entity.getBukkitEntityRaw();
+ if (craftEntity == null) return;
+
+ craftEntity.taskScheduler.executeTick();
+ }
+ // Plazma end - Skip executeTick check if there is no any task to be run
// Paper end - Folia scheduler API
io.papermc.paper.adventure.providers.ClickCallbackProviderImpl.CALLBACK_MANAGER.handleQueue(this.tickCount); // Paper
//gameprofilerfiller.push("commandFunctions"); // Plazma - Completely remove Mojang profilers
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 51aee9a468f4ebfa9672fd9ce84883cf080859e3..94bdeaf15a73228ff92b50a22bc3aca41658de8d 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -72,7 +72,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
private final CraftPersistentDataContainer persistentDataContainer = new CraftPersistentDataContainer(CraftEntity.DATA_TYPE_REGISTRY);
protected net.kyori.adventure.pointer.Pointers adventure$pointers; // Paper - implement pointers
// Paper start - Folia shedulers
- public final io.papermc.paper.threadedregions.EntityScheduler taskScheduler = new io.papermc.paper.threadedregions.EntityScheduler(this);
+ public final io.papermc.paper.threadedregions.EntityScheduler taskScheduler; // Plazma - Skip executeTick check if there is no any task to be run
private final io.papermc.paper.threadedregions.scheduler.FoliaEntityScheduler apiScheduler = new io.papermc.paper.threadedregions.scheduler.FoliaEntityScheduler(this);
@Override
@@ -85,6 +85,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
this.server = server;
this.entity = entity;
this.entityType = CraftEntityType.minecraftToBukkit(entity.getType());
+ this.taskScheduler = new io.papermc.paper.threadedregions.EntityScheduler(this.entity.getServer(), this); // Plazma - Skip executeTick check if there is no any task to be run
}
// Purpur start - API for any mob to burn daylight

View File

@@ -0,0 +1,177 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Fri, 13 Dec 2024 23:36:03 +0900
Subject: [PATCH] SparklyPaper - MSPT by World
diff --git a/src/main/java/io/papermc/paper/command/MSPTCommand.java b/src/main/java/io/papermc/paper/command/MSPTCommand.java
index 8b5293b0c696ef21d0101493ffa41b60bf0bc86b..bf3a6e8e35fe9869dfa56a97dd5d820296de9721 100644
--- a/src/main/java/io/papermc/paper/command/MSPTCommand.java
+++ b/src/main/java/io/papermc/paper/command/MSPTCommand.java
@@ -25,6 +25,29 @@ import static net.kyori.adventure.text.format.NamedTextColor.YELLOW;
public final class MSPTCommand extends Command {
private static final DecimalFormat DF = new DecimalFormat("########0.0");
private static final Component SLASH = text("/");
+ // Plazma start - MSPT by world
+ private static final Component COMMA = text(", ", YELLOW);
+ private static final Component HEADER = text().color(YELLOW).append(
+ text("("),
+ text("avg", GRAY),
+ text("/"),
+ text("min", GRAY),
+ text("/"),
+ text("max", GRAY),
+ text(")")
+ ).append(
+ text(" from last 1s"),
+ text(",", GRAY),
+ text(" 5s"),
+ text(",", GRAY),
+ text(" 10s"),
+ text(",", GRAY),
+ text(" 30s"),
+ text(",", GRAY),
+ text(" 1m"),
+ text(":", YELLOW)
+ ).build();
+ // Plazma end - MSPT by world
public MSPTCommand(final String name) {
super(name);
@@ -45,39 +68,44 @@ public final class MSPTCommand extends Command {
MinecraftServer server = MinecraftServer.getServer();
List<Component> times = new ArrayList<>();
+ // Plazma start - MSPT by world
+ times.addAll(eval(server.tickTimes1s.getTimes()));
times.addAll(eval(server.tickTimes5s.getTimes()));
times.addAll(eval(server.tickTimes10s.getTimes()));
+ times.addAll(eval(server.tickTimes30s.getTimes()));
times.addAll(eval(server.tickTimes60s.getTimes()));
- sender.sendMessage(text().content("Server tick times ").color(GOLD)
- .append(text().color(YELLOW)
- .append(
- text("("),
- text("avg", GRAY),
- text("/"),
- text("min", GRAY),
- text("/"),
- text("max", GRAY),
- text(")")
- )
- ).append(
- text(" from last 5s"),
- text(",", GRAY),
- text(" 10s"),
- text(",", GRAY),
- text(" 1m"),
- text(":", YELLOW)
- )
- );
- sender.sendMessage(text().content("◴ ").color(GOLD)
- .append(text().color(GRAY)
- .append(
- times.get(0), SLASH, times.get(1), SLASH, times.get(2), text(", ", YELLOW),
- times.get(3), SLASH, times.get(4), SLASH, times.get(5), text(", ", YELLOW),
- times.get(6), SLASH, times.get(7), SLASH, times.get(8)
- )
- )
- );
+ sender.sendMessage(text().content("Server tick times ").color(GOLD).append(HEADER));
+ sender.sendMessage(text().content("◴ ").color(GOLD).append(text().color(GRAY).append(
+ times.get(0), SLASH, times.get(1), SLASH, times.get(2), COMMA,
+ times.get(3), SLASH, times.get(4), SLASH, times.get(5), COMMA,
+ times.get(6), SLASH, times.get(7), SLASH, times.get(8), COMMA,
+ times.get(9), SLASH, times.get(10), SLASH, times.get(11), COMMA,
+ times.get(12), SLASH, times.get(13), SLASH, times.get(14)
+ )));
+
+ sender.sendMessage(text());
+ sender.sendMessage(text().content("World tick times ").color(GOLD).append(HEADER));
+ for (net.minecraft.server.level.ServerLevel serverLevel : server.getAllLevels()) {
+ List<Component> worldTimes = new ArrayList<>();
+ worldTimes.addAll(eval(serverLevel.tickTimes1s.getTimes()));
+ worldTimes.addAll(eval(serverLevel.tickTimes5s.getTimes()));
+ worldTimes.addAll(eval(serverLevel.tickTimes10s.getTimes()));
+ worldTimes.addAll(eval(serverLevel.tickTimes30s.getTimes()));
+ worldTimes.addAll(eval(serverLevel.tickTimes60s.getTimes()));
+
+ sender.sendMessage(text().content("◴ " + serverLevel.getWorld().getName() + ": ").color(GOLD).append(
+ text().color(GRAY).append(
+ worldTimes.get(0), SLASH, worldTimes.get(1), SLASH, worldTimes.get(2), COMMA,
+ worldTimes.get(3), SLASH, worldTimes.get(4), SLASH, worldTimes.get(5), COMMA,
+ worldTimes.get(6), SLASH, worldTimes.get(7), SLASH, worldTimes.get(8), COMMA,
+ worldTimes.get(9), SLASH, worldTimes.get(10), SLASH, worldTimes.get(11), COMMA,
+ worldTimes.get(12), SLASH, worldTimes.get(13), SLASH, worldTimes.get(14)
+ ))
+ );
+ }
+ // Plazma end - MSPT by world
+
return true;
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 022c4c01ab015a2a6135baa5dbe442fa7a1b4615..26c5cb68b464305fde43e2e0e1a415a2425483ea 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -264,8 +264,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
private final long[] tickTimesNanos;
private long aggregatedTickTimesNanos;
// Paper start - Add tick times API and /mspt command
+ public final TickTimes tickTimes1s = new TickTimes(20); // Plazma - Add more MSPT
public final TickTimes tickTimes5s = new TickTimes(100);
public final TickTimes tickTimes10s = new TickTimes(200);
+ public final TickTimes tickTimes30s = new TickTimes(600); // Plazma - Add more MSPT
public final TickTimes tickTimes60s = new TickTimes(1200);
// Paper end - Add tick times API and /mspt command
@Nullable
@@ -1778,8 +1780,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.tickTimesNanos[l] = k;
this.smoothedTickTimeMillis = this.smoothedTickTimeMillis * 0.8F + (float) k / (float) TimeUtil.NANOSECONDS_PER_MILLISECOND * 0.19999999F;
// Paper start - Add tick times API and /mspt command
+ this.tickTimes1s.add(this.tickCount, k); // Plazma - Add more MSPT
this.tickTimes5s.add(this.tickCount, k);
this.tickTimes10s.add(this.tickCount, k);
+ this.tickTimes30s.add(this.tickCount, k); // Plazma - Add more MSPT
this.tickTimes60s.add(this.tickCount, k);
// Paper end - Add tick times API and /mspt command
this.logTickMethodTime(i);
@@ -1941,7 +1945,17 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
//gameprofilerfiller.push("tick"); // Plazma - Completely remove Mojang profilers
try {
+ // Plazma start - MSPT by world
+ long i = Util.getNanos();
worldserver.tick(shouldKeepTicking);
+ long d = Util.getNanos() - i;
+
+ worldserver.tickTimes1s.add(this.tickCount, d);
+ worldserver.tickTimes5s.add(this.tickCount, d);
+ worldserver.tickTimes10s.add(this.tickCount, d);
+ worldserver.tickTimes30s.add(this.tickCount, d);
+ worldserver.tickTimes60s.add(this.tickCount, d);
+ // Plazma end - MSPT by world
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Exception ticking world");
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 14188b6e317dca2bbf98896951605f2e3742506f..137138aa1e42d4f12ed0bc54bc25918d29120333 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -598,6 +598,14 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
}
// Paper end - lag compensation
+ // Plazma start - MSPT by world
+ public final MinecraftServer.TickTimes tickTimes1s = new MinecraftServer.TickTimes(20);
+ public final MinecraftServer.TickTimes tickTimes5s = new MinecraftServer.TickTimes(100);
+ public final MinecraftServer.TickTimes tickTimes10s = new MinecraftServer.TickTimes(200);
+ public final MinecraftServer.TickTimes tickTimes30s = new MinecraftServer.TickTimes(600);
+ public final MinecraftServer.TickTimes tickTimes60s = new MinecraftServer.TickTimes(1200);
+ // Plazma end - MSPT by world
+
// Add env and gen to constructor, IWorldDataServer -> WorldDataServer
public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey<Level> resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List<CustomSpawner> list, boolean flag1, @Nullable RandomSequences randomsequences, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) {
// Plazma start - Configurable Plazma

View File

@@ -0,0 +1,275 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Fri, 13 Dec 2024 23:36:36 +0900
Subject: [PATCH] SparklyPaper - Optimize farm check
diff --git a/src/main/java/net/minecraft/world/level/block/CropBlock.java b/src/main/java/net/minecraft/world/level/block/CropBlock.java
index 33c27909290ff3ab483226cf65b1a1bc2e983cbc..df4bb6a77775fe7aab3f47c13c9755a7374d0761 100644
--- a/src/main/java/net/minecraft/world/level/block/CropBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/CropBlock.java
@@ -77,35 +77,52 @@ public class CropBlock extends BushBlock implements BonemealableBlock {
@Override
protected void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
- if (world.getRawBrightness(pos, 0) >= 9) {
- int i = this.getAge(state);
-
- if (i < this.getMaxAge()) {
- float f = CropBlock.getGrowthSpeed(this, world, pos);
-
- // Spigot start
- int modifier;
- if (this == Blocks.BEETROOTS) {
- modifier = world.spigotConfig.beetrootModifier;
- } else if (this == Blocks.CARROTS) {
- modifier = world.spigotConfig.carrotModifier;
- } else if (this == Blocks.POTATOES) {
- modifier = world.spigotConfig.potatoModifier;
- // Paper start - Fix Spigot growth modifiers
- } else if (this == Blocks.TORCHFLOWER_CROP) {
- modifier = world.spigotConfig.torchFlowerModifier;
- // Paper end - Fix Spigot growth modifiers
- } else {
- modifier = world.spigotConfig.wheatModifier;
- }
-
- if (random.nextFloat() < (modifier / (100.0f * (Math.floor((25.0F / f) + 1))))) { // Spigot - SPIGOT-7159: Better modifier resolution
- // Spigot end
- CraftEventFactory.handleBlockGrowEvent(world, pos, this.getStateForAge(i + 1), 2); // CraftBukkit
- }
+ // Plazma start - Optimize farm check
+ if (world.getRawBrightness(pos, 0) < 9) return;
+// PLAZMA - REMOVE THIS
+ int age = this.getAge(state);
+ if (age >= this.getMaxAge()) return;
+// PLAZMA - REMOVE THIS
+ // Spigot start
+ int modifier = switch (this) {
+ case BeetrootBlock ignored -> world.spigotConfig.beetrootModifier;
+ case CarrotBlock ignored -> world.spigotConfig.carrotModifier;
+ case PotatoBlock ignored -> world.spigotConfig.potatoModifier;
+ case TorchflowerCropBlock ignored -> world.spigotConfig.torchFlowerModifier;
+ default -> world.spigotConfig.wheatModifier;
+ };
+
+ if (world.plazmaConfig().block.optimizedFarmCheck.enabled) {
+ final BlockPos below = pos.below();
+ final BlockState belowState = world.getBlockState(below);
+
+ boolean isMoist = false;
+ float growthSpeed = world.plazmaConfig().block.optimizedFarmCheck.growthSpeed.base;
+ if (belowState.is(Blocks.FARMLAND) && belowState.getValue(FarmBlock.MOISTURE) > 0) {
+ growthSpeed = world.plazmaConfig().block.optimizedFarmCheck.growthSpeed.moist;
+ isMoist = true;
+ }
+// PLAZMA - REMOVE THIS
+ if (world.plazmaConfig().block.optimizedFarmCheck.skipMiddleAges) {
+ growthSpeed /= getMaxAge();
+ age = getMaxAge() - 1;
+ }
+// PLAZMA - REMOVE THIS
+ if (random.nextFloat() < (modifier / (100.0f * (Math.floor((25.0F / growthSpeed) + 1))))) {
+ if (!CraftEventFactory.handleBlockGrowEvent(world, pos, this.getStateForAge(age + 1), 2)) return;
+ if ((age + 1) != getMaxAge() || !isMoist || FarmBlock.isNearWater(world, below)) return;
+// PLAZMA - REMOVE THIS
+ CraftEventFactory.handleMoistureChangeEvent(world, below, state.setValue(FarmBlock.MOISTURE, 0), 2);
}
}
-
+// PLAZMA - REMOVE THIS
+ float growthSpeed = CropBlock.getGrowthSpeed(this, world, pos); // Plazma - moved down
+// PLAZMA - REMOVE THIS
+ if (random.nextFloat() < (modifier / (100.0f * (Math.floor((25.0F / growthSpeed) + 1))))) { // Spigot - SPIGOT-7159: Better modifier resolution
+ // Spigot end
+ CraftEventFactory.handleBlockGrowEvent(world, pos, this.getStateForAge(age + 1), 2); // CraftBukkit
+ }
+ // Plazma end - Optimize farm check
}
public void growCrops(Level world, BlockPos pos, BlockState state) {
diff --git a/src/main/java/net/minecraft/world/level/block/FarmBlock.java b/src/main/java/net/minecraft/world/level/block/FarmBlock.java
index eaac00e2534aca4eab92c7b9f9248e04b35b47df..14f807b6214529d909fd93cc7ce28eb712975f8c 100644
--- a/src/main/java/net/minecraft/world/level/block/FarmBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/FarmBlock.java
@@ -92,20 +92,29 @@ public class FarmBlock extends Block {
@Override
protected void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
- int i = (Integer) state.getValue(FarmBlock.MOISTURE);
- if (i > 0 && world.paperConfig().tickRates.wetFarmland != 1 && (world.paperConfig().tickRates.wetFarmland < 1 || (net.minecraft.server.MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig().tickRates.wetFarmland != 0)) { return; } // Paper - Configurable random tick rates for blocks
- if (i == 0 && world.paperConfig().tickRates.dryFarmland != 1 && (world.paperConfig().tickRates.dryFarmland < 1 || (net.minecraft.server.MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig().tickRates.dryFarmland != 0)) { return; } // Paper - Configurable random tick rates for blocks
-
- if (!FarmBlock.isNearWater(world, pos) && !world.isRainingAt(pos.above())) {
- if (i > 0) {
- org.bukkit.craftbukkit.event.CraftEventFactory.handleMoistureChangeEvent(world, pos, (BlockState) state.setValue(FarmBlock.MOISTURE, i - 1), 2); // CraftBukkit
- } else if (!FarmBlock.shouldMaintainFarmland(world, pos)) {
- FarmBlock.turnToDirt((Entity) null, state, world, pos);
- }
- } else if (i < 7) {
- org.bukkit.craftbukkit.event.CraftEventFactory.handleMoistureChangeEvent(world, pos, (BlockState) state.setValue(FarmBlock.MOISTURE, 7), 2); // CraftBukkit
- }
-
+ // Plazma start - Optimize farm check
+ int moistLevel = state.getValue(MOISTURE);
+ if (world.plazmaConfig().block.optimizedFarmCheck.enabled) {
+ if (moistLevel != 0) return;
+// PLAZMA - REMOVE THIS
+ if (isNearWater(world, pos))
+ CraftEventFactory.handleMoistureChangeEvent(world, pos, state.setValue(MOISTURE, 7), 2);
+ else
+ turnToDirt(null, state, world, pos);
+ return;
+ } // diff on change
+// PLAZMA - REMOVE THIS
+ if (moistLevel > 0 && world.paperConfig().tickRates.wetFarmland != 1 && (world.paperConfig().tickRates.wetFarmland < 1 || (net.minecraft.server.MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig().tickRates.wetFarmland != 0)) { return; } // Paper - Configurable random tick rates for blocks
+ if (moistLevel == 0 && world.paperConfig().tickRates.dryFarmland != 1 && (world.paperConfig().tickRates.dryFarmland < 1 || (net.minecraft.server.MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig().tickRates.dryFarmland != 0)) { return; } // Paper - Configurable random tick rates for blocks
+// PLAZMA - REMOVE THIS
+ if (!isNearWater(world, pos) && !world.isRainingAt(pos.above())) {
+ if (moistLevel > 0)
+ CraftEventFactory.handleMoistureChangeEvent(world, pos, state.setValue(MOISTURE, moistLevel - 1), 2); // CraftBukkit
+ else if (!shouldMaintainFarmland(world, pos))
+ turnToDirt(null, state, world, pos);
+ } else if (moistLevel < 7)
+ CraftEventFactory.handleMoistureChangeEvent(world, pos, state.setValue(MOISTURE, 7), 2); // CraftBukkit
+ // Plazma end - Optimize farm check
}
@Override
@@ -169,7 +178,7 @@ public class FarmBlock extends Block {
return world.getBlockState(pos.above()).is(BlockTags.MAINTAINS_FARMLAND);
}
- private static boolean isNearWater(LevelReader world, BlockPos pos) {
+ static boolean isNearWater(LevelReader world, BlockPos pos) { // Plazma - AT (private -> package-private)
// Paper start - Perf: remove abstract block iteration
int xOff = pos.getX();
int yOff = pos.getY();
diff --git a/src/main/java/net/minecraft/world/level/block/StemBlock.java b/src/main/java/net/minecraft/world/level/block/StemBlock.java
index 76109aceb24a4719d49c1a55e3621cf2a63bbe16..00b3275305b5f1c2ea2516dcad3c7c62f06db49f 100644
--- a/src/main/java/net/minecraft/world/level/block/StemBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/StemBlock.java
@@ -72,38 +72,66 @@ public class StemBlock extends BushBlock implements BonemealableBlock {
@Override
protected void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
- if (world.getRawBrightness(pos, 0) >= 9) {
- float f = CropBlock.getGrowthSpeed(this, world, pos);
-
- if (random.nextFloat() < ((this == Blocks.PUMPKIN_STEM ? world.spigotConfig.pumpkinModifier : world.spigotConfig.melonModifier) / (100.0f * (Math.floor((25.0F / f) + 1))))) { // Spigot - SPIGOT-7159: Better modifier resolution
- int i = (Integer) state.getValue(StemBlock.AGE);
-
- if (i < 7) {
- state = (BlockState) state.setValue(StemBlock.AGE, i + 1);
- CraftEventFactory.handleBlockGrowEvent(world, pos, state, 2); // CraftBukkit
- } else {
- Direction enumdirection = Direction.Plane.HORIZONTAL.getRandomDirection(random);
- BlockPos blockposition1 = pos.relative(enumdirection);
- BlockState iblockdata1 = world.getBlockState(blockposition1.below());
-
- if (world.getBlockState(blockposition1).isAir() && (iblockdata1.is(Blocks.FARMLAND) || iblockdata1.is(BlockTags.DIRT))) {
- Registry<Block> iregistry = world.registryAccess().lookupOrThrow(Registries.BLOCK);
- Optional<Block> optional = iregistry.getOptional(this.fruit);
- Optional<Block> optional1 = iregistry.getOptional(this.attachedStem);
-
- if (optional.isPresent() && optional1.isPresent()) {
- // CraftBukkit start
- if (!CraftEventFactory.handleBlockGrowEvent(world, blockposition1, ((Block) optional.get()).defaultBlockState())) {
- return;
- }
- // CraftBukkit end
- world.setBlockAndUpdate(pos, (BlockState) ((Block) optional1.get()).defaultBlockState().setValue(HorizontalDirectionalBlock.FACING, enumdirection));
- }
- }
- }
+ if (world.getRawBrightness(pos, 0) < 9) return;
+// PLAZMA - REMOVE THIS
+ if (world.plazmaConfig().block.optimizedFarmCheck.enabled) {
+ final BlockPos below = pos.below();
+ final BlockState belowState = world.getBlockState(below);
+// PLAZMA - REMOVE THIS
+ boolean isMoist = false;
+ float growthSpeed = world.plazmaConfig().block.optimizedFarmCheck.growthSpeed.base;
+ if (belowState.is(Blocks.FARMLAND) && belowState.getValue(BlockStateProperties.MOISTURE) > 0) {
+ growthSpeed = world.plazmaConfig().block.optimizedFarmCheck.growthSpeed.moist;
+ isMoist = true;
}
-
+// PLAZMA - REMOVE THIS
+ if (random.nextFloat() >= ((this == Blocks.PUMPKIN_STEM ? world.spigotConfig.pumpkinModifier : world.spigotConfig.melonModifier) / (100.0f * (Math.floor((25.0F / growthSpeed) + 1))))) return;
+// PLAZMA - REMOVE THIS
+ int age = state.getValue(StemBlock.AGE);
+ if (age < 7) {
+ CraftEventFactory.handleBlockGrowEvent(world, pos, state.setValue(StemBlock.AGE, age + 1), 2);
+ return;
+ }
+// PLAZMA - REMOVE THIS
+ final Direction direction = Direction.Plane.HORIZONTAL.getRandomDirection(random);
+ final BlockPos blockPos = pos.relative(direction);
+ final BlockState belowState1 = world.getBlockState(blockPos.below());
+ if (!world.getBlockState(blockPos).isAir() || (!belowState1.is(Blocks.FARMLAND) && !belowState1.is(BlockTags.DIRT))) return;
+// PLAZMA - REMOVE THIS
+ final Registry<Block> registry = world.registryAccess().lookupOrThrow(Registries.BLOCK);
+ final Optional<Block> fruit = registry.getOptional(this.fruit);
+ final Optional<Block> stem = registry.getOptional(this.attachedStem);
+ if (fruit.isEmpty() || stem.isEmpty()) return;
+// PLAZMA - REMOVE THIS
+ if (!CraftEventFactory.handleBlockGrowEvent(world, blockPos, fruit.get().defaultBlockState())) return; // CraftBukkit
+ if (isMoist && !FarmBlock.isNearWater(world, blockPos))
+ CraftEventFactory.handleMoistureChangeEvent(world, blockPos, belowState1.setValue(BlockStateProperties.MOISTURE, 0), 2);
+// PLAZMA - REMOVE THIS
+ world.setBlockAndUpdate(pos, stem.get().defaultBlockState().setValue(HorizontalDirectionalBlock.FACING, direction));
+ return;
+ }
+// PLAZMA - REMOVE THIS
+ if (random.nextFloat() >= ((this == Blocks.PUMPKIN_STEM ? world.spigotConfig.pumpkinModifier : world.spigotConfig.melonModifier) / (100.0f * (Math.floor((25.0F / CropBlock.getGrowthSpeed(this, world, pos)) + 1))))) return; // Spigot - SPIGOT-7159: Better modifier resolution
+// PLAZMA - REMOVE THIS
+ final int age = state.getValue(StemBlock.AGE);
+ if (age < 7) {
+ state = state.setValue(StemBlock.AGE, age + 1);
+ CraftEventFactory.handleBlockGrowEvent(world, pos, state, 2); // CraftBukkit
+ return;
}
+// PLAZMA - REMOVE THIS
+ final Direction direction = Direction.Plane.HORIZONTAL.getRandomDirection(random);
+ final BlockPos blockPos = pos.relative(direction);
+ final BlockState belowState = world.getBlockState(blockPos.below());
+ if (!world.getBlockState(blockPos).isAir() || (!belowState.is(Blocks.FARMLAND) && !belowState.is(BlockTags.DIRT))) return;
+// PLAZMA - REMOVE THIS
+ final Registry<Block> registry = world.registryAccess().lookupOrThrow(Registries.BLOCK);
+ final Optional<Block> fruit = registry.getOptional(this.fruit);
+ final Optional<Block> stem = registry.getOptional(this.attachedStem);
+ if (fruit.isEmpty() || stem.isEmpty()) return;
+// PLAZMA - REMOVE THIS
+ if (!CraftEventFactory.handleBlockGrowEvent(world, blockPos, fruit.get().defaultBlockState())) return; // CraftBukkit
+ world.setBlockAndUpdate(pos, stem.get().defaultBlockState().setValue(HorizontalDirectionalBlock.FACING, direction));
}
@Override
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
index bab5f682b8aeaa6dfcda7f07499ae297cbcbe23e..f822b544d98602be85bf0c54a6040a5907b1906e 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
@@ -81,6 +81,22 @@ public class WorldConfigurations extends ConfigurationPart {
}
+ public OptimizedFarmCheck optimizedFarmCheck;
+ public class OptimizedFarmCheck extends ConfigurationPart {
+
+ public boolean enabled = OPTIMIZE;
+ public boolean skipMiddleAges = false;
+
+ public GrowthSpeed growthSpeed;
+ public class GrowthSpeed extends ConfigurationPart {
+
+ public float base = 1.0f;
+ public float moist = 5.0f;
+
+ }
+
+ }
+
}
public Item item;

View File

@@ -0,0 +1,146 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Fri, 13 Dec 2024 23:37:17 +0900
Subject: [PATCH] SparklyPaper - Optimize season check
diff --git a/src/main/java/net/minecraft/world/entity/ambient/Bat.java b/src/main/java/net/minecraft/world/entity/ambient/Bat.java
index 0d3f4702c8bf3d66b01b42c5da1761e93e1d6ed2..a749adca6c758c0008ab8b27f307ac4570c82652 100644
--- a/src/main/java/net/minecraft/world/entity/ambient/Bat.java
+++ b/src/main/java/net/minecraft/world/entity/ambient/Bat.java
@@ -324,15 +324,19 @@ public class Bat extends AmbientCreature {
private static boolean isSpookySeason = false;
private static final int ONE_HOUR = 20 * 60 * 60;
private static int lastSpookyCheck = -ONE_HOUR;
- public static boolean isHalloweenSeason(Level level) { return level.purpurConfig.forceHalloweenSeason || isHalloween(); } // Purpur
+
+ public static boolean isHalloweenSeason(Level level) {
+ return level.purpurConfig.forceHalloweenSeason || net.sparklypower.sparklypaper.HalloweenManager.isInSeason() || isHalloween();
+ }
+
private static boolean isHalloween() {
if (net.minecraft.server.MinecraftServer.currentTick - lastSpookyCheck > ONE_HOUR) {
- LocalDate localdate = LocalDate.now();
- int i = localdate.get(ChronoField.DAY_OF_MONTH);
- int j = localdate.get(ChronoField.MONTH_OF_YEAR);
+ LocalDate now = LocalDate.now();
+ int day = now.getDayOfMonth();
+ int month = now.getMonth().getValue();
- isSpookySeason = j == 10 && i >= 20 || j == 11 && i <= 3;
- lastSpookyCheck = net.minecraft.server.MinecraftServer.currentTick;
+ isSpookySeason = month == 10 && day >= 20 || month == 11 && day <= 3;
+ lastSpookyCheck = net.minecraft.server.MinecraftServer.currentTick;
}
return isSpookySeason;
}
diff --git a/src/main/java/net/sparklypower/sparklypaper/HalloweenManager.java b/src/main/java/net/sparklypower/sparklypaper/HalloweenManager.java
new file mode 100644
index 0000000000000000000000000000000000000000..530bac5a415c8597ae76ec603c1d8158535c66d0
--- /dev/null
+++ b/src/main/java/net/sparklypower/sparklypaper/HalloweenManager.java
@@ -0,0 +1,82 @@
+package net.sparklypower.sparklypaper;
+
+import com.mojang.logging.LogUtils;
+import org.jetbrains.annotations.Nullable;
+import org.slf4j.Logger;
+import java.time.LocalDateTime;
+import java.time.Month;
+import java.time.ZoneOffset;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+public final class HalloweenManager {
+
+ private static final Logger LOGGER = LogUtils.getLogger();
+ public static @Nullable net.sparklypower.sparklypaper.HalloweenManager INSTANCE;
+
+ private long seasonStartEpoch = 0L;
+ private long seasonEndEpoch = 0L;
+
+ private final ScheduledExecutorService EXECUTOR = Executors.newSingleThreadScheduledExecutor(runnable -> {
+ final Thread thread = new Thread(runnable);
+ thread.setName("halloween-timer-updater");
+ thread.setPriority(1);
+ return thread;
+ });
+
+ public HalloweenManager() {
+ final AtomicBoolean first = new AtomicBoolean(true);
+ final CountDownLatch LATCH = new CountDownLatch(1);
+
+ try {
+ EXECUTOR.scheduleAtFixedRate(() -> {
+ updateEpoch();
+ if (first.get()) LATCH.countDown();
+ first.set(false);
+ }, 0L, 90L, TimeUnit.DAYS);
+
+ LATCH.await();
+ } catch (InterruptedException e) {
+ LOGGER.error("Interrupted while waiting for HalloweenManager to start", e);
+ }
+ }
+
+ public @Nullable HalloweenManager close() {
+ EXECUTOR.shutdownNow();
+ return null;
+ }
+
+ public static boolean isInSeason() {
+ return INSTANCE != null && INSTANCE.isSeason();
+ }
+
+ private boolean isSeason() {
+ return this.seasonStartEpoch <= System.currentTimeMillis() && System.currentTimeMillis() < this.seasonEndEpoch;
+ }
+
+ private void updateEpoch() {
+ LOGGER.info("Updating Spooky Season and Halloween Time");
+ this.seasonStartEpoch = millisFromDate(20, 10, false);
+ this.seasonEndEpoch = millisFromDate(3, 11, true);
+ LOGGER.info("Updated Spooky Season and Halloween Time!");
+ }
+
+ private static long millisFromDate(int day, int month, boolean endOfMonth) {
+ LocalDateTime target = LocalDateTime.of(
+ LocalDateTime.now().getYear(),
+ Month.of(month),
+ day,
+ endOfMonth ? 23 : 0,
+ endOfMonth ? 59 : 0,
+ endOfMonth ? 59 : 0,
+ endOfMonth ? 999_999_999 : 0
+ );
+
+ return (LocalDateTime.now().isAfter(target) ? target.plusYears(1) : target)
+ .atZone(ZoneOffset.systemDefault()).toInstant().toEpochMilli();
+ }
+
+}
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
index 3c917e2a7fe8e5ff1ac91ddba29c717952a15d57..538c572661bd92666f84e6f9ef3e9760f69f50a9 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
@@ -153,6 +153,17 @@ public class GlobalConfiguration extends ConfigurationPart {
public class Miscellaneous extends ConfigurationPart {
public boolean resetDirtyWhenLoadingMapsFromDisk = false;
+ public boolean optimizeHalloweenCheck = OPTIMIZE;
+
+ @PostProcess
+ void post() {
+ net.sparklypower.sparklypaper.HalloweenManager manager = net.sparklypower.sparklypaper.HalloweenManager.INSTANCE;
+
+ if (manager == null && this.optimizeHalloweenCheck)
+ net.sparklypower.sparklypaper.HalloweenManager.INSTANCE = new net.sparklypower.sparklypaper.HalloweenManager();
+ else if (manager != null && !this.optimizeHalloweenCheck)
+ net.sparklypower.sparklypaper.HalloweenManager.INSTANCE = manager.close();
+ }
}

View File

@@ -0,0 +1,218 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Fri, 13 Dec 2024 23:52:46 +0900
Subject: [PATCH] SparklyPaper - Optimize tickingBlockEntity
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 332c1d890eefb0c705200a61b8bc7369457bc3af..ca7d4efd7b813c58169d251b23cf6a6fa71c9cee 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -1526,28 +1526,42 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
int tickedEntities = 0; // Paper - rewrite chunk system
- int tilesThisCycle = 0;
- var toRemove = new it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet<TickingBlockEntity>(); // Paper - Fix MC-117075; use removeAll
+ // Plazma start - Optimize tickingBlockEntity
+ int shouldTickBlocksAtLastResult = -1;
+ long shouldTickBlocksAtChunkPos = 0L;
+ final it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet<TickingBlockEntity> toRemove =
+ new it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet<>(); // Paper - Fix MC-117075; use removeAll
+
toRemove.add(null); // Paper - Fix MC-117075
for (tileTickPosition = 0; tileTickPosition < this.blockEntityTickers.size(); tileTickPosition++) { // Paper - Disable tick limiters
- this.tileTickPosition = (this.tileTickPosition < this.blockEntityTickers.size()) ? this.tileTickPosition : 0;
- TickingBlockEntity tickingblockentity = (TickingBlockEntity) this.blockEntityTickers.get(this.tileTickPosition);
- // Spigot end
-
- if (tickingblockentity.isRemoved()) {
- // Spigot start
- tilesThisCycle--;
- toRemove.add(tickingblockentity); // Paper - Fix MC-117075; use removeAll
- // Spigot end
- } else if (flag && this.shouldTickBlocksAt(tickingblockentity.getPos())) {
- tickingblockentity.tick();
- // Paper start - rewrite chunk system
- if ((++tickedEntities & 7) == 0) {
- ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)(Level)(Object)this).moonrise$midTickTasks();
+ TickingBlockEntity tickingEntity = this.blockEntityTickers.get(this.tileTickPosition);
+
+ if (tickingEntity.isRemoved()) {
+ toRemove.add(tickingEntity); // Paper - Fix MC-117075; use removeAll
+ continue;
+ }
+
+ if (flag) {
+ long pos = tickingEntity.getChunkCoordinateKey();
+
+ boolean shouldTick;
+ if (shouldTickBlocksAtChunkPos == pos && shouldTickBlocksAtLastResult != -1) {
+ shouldTick = shouldTickBlocksAtLastResult == 1;
+ } else {
+ shouldTick = this.shouldTickBlocksAt(pos);
+ shouldTickBlocksAtLastResult = shouldTick ? 1 : 0;
+ shouldTickBlocksAtChunkPos = pos;
}
- // Paper end - rewrite chunk system
+
+ if (!shouldTick) continue;
+
+ tickingEntity.tick();
+ if ((++tickedEntities & 7) != 0) continue;
+
+ this.moonrise$midTickTasks();
}
}
+ // Plazma end - Optimize tickingBlockEntity
this.blockEntityTickers.removeAll(toRemove); // Paper - Fix MC-117075
this.tickingBlockEntities = false;
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TickingBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TickingBlockEntity.java
index 28e3b73507b988f7234cbf29c4024c88180d0aef..de15cbda0c180e0d071ce7ac41d2fd1aeca60985 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/TickingBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/TickingBlockEntity.java
@@ -10,4 +10,6 @@ public interface TickingBlockEntity {
BlockPos getPos();
String getType();
+
+ long getChunkCoordinateKey(); // Plazma - Optimize tickingBlockEntity
}
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index 3c92e6b52394eed3ac66d44973288e4de2c133cc..2966caede97e01b5ad15a0d56232a0f5526685e2 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -75,6 +75,8 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
public String getType() {
return "<null>";
}
+
+ @Override public long getChunkCoordinateKey() { return 0; } // Plazma - Optimize tickingBlockEntity;
};
private final Map<BlockPos, LevelChunk.RebindableTickingBlockEntityWrapper> tickersInLevel;
public boolean loaded;
@@ -995,7 +997,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
}
private <T extends BlockEntity> TickingBlockEntity createTicker(T blockEntity, BlockEntityTicker<T> blockEntityTicker) {
- return new LevelChunk.BoundTickingBlockEntity<>(blockEntity, blockEntityTicker);
+ return new LevelChunk.BoundTickingBlockEntity<>(blockEntity, blockEntityTicker, this.coordinateKey); // Plazma - Optimize tickingBlockEntity
}
@FunctionalInterface
@@ -1049,8 +1051,15 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
return this.ticker.getType();
}
+ @Override // Plazma - minor code improvement
public String toString() {
- return String.valueOf(this.ticker) + " <wrapped>";
+ return this.ticker + " <wrapped>"; // Plazma - minor code improvement
+ }
+
+ // Plazma start - Optimize tickingBlockEntity
+ @Override
+ public long getChunkCoordinateKey() {
+ return this.ticker.getChunkCoordinateKey();
}
}
@@ -1059,51 +1068,45 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
private final T blockEntity;
private final BlockEntityTicker<T> ticker;
private boolean loggedInvalidBlockState;
+ private final long chunkCoordinateKey;
- BoundTickingBlockEntity(final BlockEntity tileentity, final BlockEntityTicker blockentityticker) {
- this.blockEntity = (T) tileentity; // CraftBukkit - decompile error
- this.ticker = blockentityticker;
+ BoundTickingBlockEntity(final T blockEntity, final BlockEntityTicker<T> ticker, final long chunkCoordinateKey) {
+ this.blockEntity = blockEntity;
+ this.ticker = ticker;
+ this.chunkCoordinateKey = chunkCoordinateKey;
}
@Override
public void tick() {
- if (!this.blockEntity.isRemoved() && this.blockEntity.hasLevel()) {
- BlockPos blockposition = this.blockEntity.getBlockPos();
+ if (this.blockEntity.isRemoved() || !this.blockEntity.hasLevel()) return;
- if (LevelChunk.this.isTicking(blockposition)) {
- try {
- //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler
-
- //gameprofilerfiller.push(this::getType); // Plazma - Completely remove Mojang profiler
- BlockState iblockdata = LevelChunk.this.getBlockState(blockposition);
+ BlockPos pos = this.blockEntity.getBlockPos();
+ if (!LevelChunk.this.isTicking(pos)) return;
- if (this.blockEntity.getType().isValid(iblockdata)) {
- this.ticker.tick(LevelChunk.this.level, this.blockEntity.getBlockPos(), iblockdata, this.blockEntity);
- this.loggedInvalidBlockState = false;
- // Paper start - Remove the Block Entity if it's invalid
- } else {
- LevelChunk.this.removeBlockEntity(this.getPos());
- if (!this.loggedInvalidBlockState) {
- this.loggedInvalidBlockState = true;
- LevelChunk.LOGGER.warn("Block entity {} @ {} state {} invalid for ticking:", new Object[]{LogUtils.defer(this::getType), LogUtils.defer(this::getPos), iblockdata});
- }
- // Paper end - Remove the Block Entity if it's invalid
- }
+ try {
+ BlockState state = LevelChunk.this.getBlockState(pos);
- //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler
- } catch (Throwable throwable) {
- if (throwable instanceof ThreadDeath) throw throwable; // Paper
- // Paper start - Prevent block entity and entity crashes
- final String msg = String.format("BlockEntity threw exception at %s:%s,%s,%s", LevelChunk.this.getLevel().getWorld().getName(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ());
- net.minecraft.server.MinecraftServer.LOGGER.error(msg, throwable);
- net.minecraft.world.level.chunk.LevelChunk.this.level.getCraftServer().getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerInternalException(msg, throwable))); // Paper - ServerExceptionEvent
- LevelChunk.this.removeBlockEntity(this.getPos());
- // Paper end - Prevent block entity and entity crashes
- // Spigot start
+ if (this.blockEntity.getType().isValid(state)) {
+ this.ticker.tick(LevelChunk.this.level, this.blockEntity.getBlockPos(), state, this.blockEntity);
+ this.loggedInvalidBlockState = false;
+ // Paper start - Remove the Block Entity if it's invalid
+ } else {
+ LevelChunk.this.removeBlockEntity(this.getPos());
+ if (!this.loggedInvalidBlockState) {
+ this.loggedInvalidBlockState = true;
+ LevelChunk.LOGGER.warn("Block entity {} @ {} state {} invalid for ticking:", LogUtils.defer(this::getType), LogUtils.defer(this::getPos), state);
}
+ // Paper end - Remove the Block Entity if it's invalid
}
+ } catch (Throwable throwable) {
+ if (throwable instanceof ThreadDeath) throw throwable; // Paper
+ // Paper start - Prevent block entity and entity crashes
+ final String msg = String.format("BlockEntity threw exception at %s:%s,%s,%s", LevelChunk.this.getLevel().getWorld().getName(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ());
+ net.minecraft.server.MinecraftServer.LOGGER.error(msg, throwable);
+ LevelChunk.this.level.getCraftServer().getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerInternalException(msg, throwable))); // Paper - ServerExceptionEvent
+ LevelChunk.this.removeBlockEntity(this.getPos());
+ // Paper end - Prevent block entity and entity crashes
}
-
}
@Override
@@ -1121,10 +1124,15 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
return BlockEntityType.getKey(this.blockEntity.getType()).toString();
}
+ @Override
public String toString() {
- String s = this.getType();
+ return "Level ticker for " + this.getType() + "@" + this.getPos();
+ }
- return "Level ticker for " + s + "@" + String.valueOf(this.getPos());
+ @Override
+ public long getChunkCoordinateKey() {
+ return this.chunkCoordinateKey;
}
+ // Plazma end - Optimize tickingBlockEntity
}
}

View File

@@ -0,0 +1,227 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Sat, 14 Dec 2024 00:29:15 +0900
Subject: [PATCH] Implement CarpetFixes
diff --git a/src/main/java/net/minecraft/world/entity/animal/Sheep.java b/src/main/java/net/minecraft/world/entity/animal/Sheep.java
index 0503f936d0d7194f110069adabff984f51af0a3a..0ca88636cca9b8f93cddf8bc58038e626e171df8 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Sheep.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Sheep.java
@@ -379,19 +379,22 @@ public class Sheep extends Animal implements Shearable {
}
private DyeColor getOffspringColor(ServerLevel world, Sheep firstParent, Sheep secondParent) {
- DyeColor enumcolor = firstParent.getColor();
- DyeColor enumcolor1 = secondParent.getColor();
- CraftingInput craftinginput = Sheep.makeCraftInput(enumcolor, enumcolor1);
- Optional<Item> optional = world.recipeAccess().getRecipeFor(RecipeType.CRAFTING, craftinginput, world).map((recipeholder) -> { // CraftBukkit - decompile error
- return ((CraftingRecipe) recipeholder.value()).assemble(craftinginput, world.registryAccess());
- }).map(ItemStack::getItem);
-
- Objects.requireNonNull(DyeItem.class);
- optional = optional.filter(DyeItem.class::isInstance);
- Objects.requireNonNull(DyeItem.class);
- return (DyeColor) optional.map(DyeItem.class::cast).map(DyeItem::getDyeColor).orElseGet(() -> {
- return world.random.nextBoolean() ? enumcolor : enumcolor1;
- });
+ // Plazma start - Implement CarpetFixes
+ final DyeColor firstColor = firstParent.getColor();
+ final DyeColor secondColor = secondParent.getColor();
+// PLAZMA - REMOVE THIS
+ if (world.plazmaConfig().carpetFixes.preparedSheepChildColor) {
+ final DyeColor color = org.plazmamc.plazma.util.CarpetFixes.properDyeMixin(firstColor, secondColor);
+ if (color != null) return color;
+ return world.random.nextBoolean() ? firstColor : secondColor;
+ }
+// PLAZMA - REMOVE THIS
+ final CraftingInput input = Sheep.makeCraftInput(firstColor, secondColor);
+// PLAZMA - REMOVE THIS
+ Optional<Item> result = world.recipeAccess().getRecipeFor(RecipeType.CRAFTING, input, world).map((recipeholder) -> recipeholder.value().assemble(input, world.registryAccess())).map(ItemStack::getItem);
+ result = result.filter(DyeItem.class::isInstance);
+ return result.map(DyeItem.class::cast).map(DyeItem::getDyeColor).orElseGet(() -> world.random.nextBoolean() ? firstColor : secondColor);
+ // Plazma end - Implement CarpetFixes
}
private static CraftingInput makeCraftInput(DyeColor firstColor, DyeColor secondColor) {
diff --git a/src/main/java/net/minecraft/world/level/biome/BiomeManager.java b/src/main/java/net/minecraft/world/level/biome/BiomeManager.java
index 90f8360f547ce709fd13ee34f8e67d8bfa94b498..4e5fb377696c0a98a56f9ea11d0116b28399c8f6 100644
--- a/src/main/java/net/minecraft/world/level/biome/BiomeManager.java
+++ b/src/main/java/net/minecraft/world/level/biome/BiomeManager.java
@@ -9,6 +9,8 @@ import net.minecraft.util.Mth;
public class BiomeManager {
public static final int CHUNK_CENTER_QUART = QuartPos.fromBlock(8);
+ public static boolean PLAZMA_CARPET_FIXES = false; // Plazma - Implement CarpetFixes
+ private static final double MAX_OFFSET = 0.450_000_000_1; // Plazma - Implement CarpetFixes
private static final int ZOOM_BITS = 2;
private static final int ZOOM = 4;
private static final int ZOOM_MASK = 3;
@@ -29,6 +31,79 @@ public class BiomeManager {
}
public Holder<Biome> getBiome(BlockPos pos) {
+ // Plazma start - Implement CarpetFixes
+ if (PLAZMA_CARPET_FIXES) {
+ final int x2 = pos.getX() - 2;
+ final int y2 = pos.getY() - 2;
+ final int z2 = pos.getZ() - 2;
+
+ final int x = x2 >> 2;
+ final int y = y2 >> 2;
+ final int z = z2 >> 2;
+
+ final double qX = (x2 & 3) / 4.0D;
+ final double qY = (y2 & 3) / 4.0D;
+ final double qZ = (z2 & 3) / 4.0D;
+
+ int minX = 0;
+ double minD = Double.POSITIVE_INFINITY;
+ for (int bX = 0; bX < 8; ++bX) {
+ final boolean x0 = (bX & 4) == 0;
+ final boolean y0 = (bX & 2) == 0;
+ final boolean z0 = (bX & 1) == 0;
+
+ final double x1 = x0 ? qX : qX - 1.0D;
+ final double y1 = y0 ? qY : qY - 1.0D;
+ final double z1 = z0 ? qZ : qZ - 1.0D;
+
+ double maxQY = 0.0D;
+ double maxQZ = 0.0D;
+ if (bX != 0) {
+ final double maxQX = Mth.square(Math.max(x1 + MAX_OFFSET, Math.abs(x1 - MAX_OFFSET)));
+ maxQY = Mth.square(Math.max(y1 + MAX_OFFSET, Math.abs(y1 - MAX_OFFSET)));
+ maxQZ = Mth.square(Math.max(z1 + MAX_OFFSET, Math.abs(z1 - MAX_OFFSET)));
+
+ if (minD < maxQY + maxQZ + maxQX) continue;
+ }
+
+ int pX = x0 ? x : x + 1;
+ int pY = y0 ? y : y + 1;
+ int pZ = z0 ? z : z + 1;
+
+ long seed = this.biomeZoomSeed;
+ seed = LinearCongruentialGenerator.next(seed, pX);
+ seed = LinearCongruentialGenerator.next(seed, pY);
+ seed = LinearCongruentialGenerator.next(seed, pZ);
+ seed = LinearCongruentialGenerator.next(seed, pX);
+ seed = LinearCongruentialGenerator.next(seed, pY);
+ seed = LinearCongruentialGenerator.next(seed, pZ);
+
+ double dX = getFiddle(seed);
+ double sX = Mth.square(x1 + dX);
+ if (bX != 0 && minD < sX + maxQY + maxQZ) continue;
+
+ seed = LinearCongruentialGenerator.next(seed, this.biomeZoomSeed);
+ double dY = getFiddle(seed);
+ double sY = Mth.square(y1 + dY);
+ if (bX != 0 && minD < sX + sY + maxQZ) continue;
+
+ seed = LinearCongruentialGenerator.next(seed, this.biomeZoomSeed);
+ double dZ = getFiddle(seed);
+ double bD = sX + sY + Mth.square(z1 + dZ);
+
+ if (minD <= bD) continue;
+ minX = bX;
+ minD = bD;
+ }
+
+ return this.noiseBiomeSource.getNoiseBiome(
+ (minX & 4) == 0 ? x : x + 1,
+ (minX & 2) == 0 ? y : y + 1,
+ (minX & 1) == 0 ? z : z + 1
+ );
+ }
+ // Plazma end - Implement CarpetFixes
+
int i = pos.getX() - 2;
int j = pos.getY() - 2;
int k = pos.getZ() - 2;
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
index 538c572661bd92666f84e6f9ef3e9760f69f50a9..db31d0c066e92fe308e7e64075e832bec66a5c02 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
@@ -188,4 +188,16 @@ public class GlobalConfiguration extends ConfigurationPart {
}
+ public CarpetFixes carpetFixes;
+ public class CarpetFixes extends ConfigurationPart {
+
+ boolean optimizeBiomeAccess = OPTIMIZE;
+
+ @PostProcess
+ void post() {
+ net.minecraft.world.level.biome.BiomeManager.PLAZMA_CARPET_FIXES = this.optimizeBiomeAccess;
+ }
+
+ }
+
}
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
index 36345efa302413ad4e7d6e611d182572622f76ff..d314be46a02d73e669088d3a37937c8751f7735d 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
@@ -126,4 +126,11 @@ public class WorldConfigurations extends ConfigurationPart {
}
+ public CarpetFixes carpetFixes;
+ public class CarpetFixes extends ConfigurationPart {
+
+ public boolean preparedSheepChildColor = OPTIMIZE;
+
+ }
+
}
diff --git a/src/main/java/org/plazmamc/plazma/util/CarpetFixes.java b/src/main/java/org/plazmamc/plazma/util/CarpetFixes.java
new file mode 100644
index 0000000000000000000000000000000000000000..a5b0ce75a0ffa65e357cde2d55b7a0f116a2afad
--- /dev/null
+++ b/src/main/java/org/plazmamc/plazma/util/CarpetFixes.java
@@ -0,0 +1,45 @@
+package org.plazmamc.plazma.util;
+
+import net.minecraft.world.item.DyeColor;
+
+public interface CarpetFixes {
+
+ static DyeColor properDyeMixin(DyeColor firstColor, DyeColor secondColor) {
+ if (firstColor.equals(secondColor)) return firstColor;
+
+ return switch (firstColor) {
+ case WHITE -> switch (secondColor) {
+ case BLUE -> DyeColor.LIGHT_BLUE;
+ case GRAY -> DyeColor.LIGHT_GRAY;
+ case BLACK -> DyeColor.GRAY;
+ case GREEN -> DyeColor.LIME;
+ case RED -> DyeColor.PINK;
+ default -> null;
+ };
+ case BLUE -> switch (secondColor) {
+ case WHITE -> DyeColor.LIGHT_BLUE;
+ case GREEN -> DyeColor.CYAN;
+ case RED -> DyeColor.PURPLE;
+ default -> null;
+ };
+ case RED -> switch (secondColor) {
+ case YELLOW -> DyeColor.ORANGE;
+ case WHITE -> DyeColor.PINK;
+ case BLUE -> DyeColor.PURPLE;
+ default -> null;
+ };
+ case GREEN -> switch (secondColor) {
+ case BLUE -> DyeColor.CYAN;
+ case WHITE -> DyeColor.LIME;
+ default -> null;
+ };
+ case YELLOW -> secondColor.equals(DyeColor.RED) ? DyeColor.ORANGE : null;
+ case PURPLE -> secondColor.equals(DyeColor.PINK) ? DyeColor.MAGENTA : null;
+ case PINK -> secondColor.equals(DyeColor.PURPLE) ? DyeColor.MAGENTA : null;
+ case GRAY -> secondColor.equals(DyeColor.WHITE) ? DyeColor.LIGHT_GRAY : null;
+ case BLACK -> secondColor.equals(DyeColor.WHITE) ? DyeColor.GRAY : null;
+ default -> null;
+ };
+ }
+
+}

View File

@@ -0,0 +1,333 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Sat, 14 Dec 2024 00:39:05 +0900
Subject: [PATCH] Ticking Controller
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 26c5cb68b464305fde43e2e0e1a415a2425483ea..ef1b47ebb8d79fbe177d4ad08e07bd182657c5d3 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1689,6 +1689,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
public void tickServer(BooleanSupplier shouldKeepTicking) {
+ org.plazmamc.plazma.util.TickingController.tick(); // Plazma - TickControl System
org.spigotmc.WatchdogThread.tick(); // Spigot
long i = Util.getNanos();
int j = this.pauseWhileEmptySeconds() * 20;
diff --git a/src/main/java/net/minecraft/server/dedicated/ServerWatchdog.java b/src/main/java/net/minecraft/server/dedicated/ServerWatchdog.java
index 660a142036c4e608d3d6fed6ec700a3488400bec..d092bef5e6626f000a44a0f424f247a1a69d34af 100644
--- a/src/main/java/net/minecraft/server/dedicated/ServerWatchdog.java
+++ b/src/main/java/net/minecraft/server/dedicated/ServerWatchdog.java
@@ -34,6 +34,7 @@ public class ServerWatchdog implements Runnable {
@Override
public void run() {
while (this.server.isRunning()) {
+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().tickControl.enabled) return; // Plazma - TickControl System
long l = this.server.getNextTickTime();
long m = Util.getNanos();
long n = m - l;
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index e1957ad2a804f1272ccd458560bd7bde4ed0fe53..97e9f64498b9eb4d595e94cc63038363092809ae 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -621,7 +621,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
// this.lastSpawnState = spawnercreature_d; // Pufferfish - this is managed asynchronously
//profiler.popPush("spawnAndTick"); // Plazma - Completely remove Mojang profiler
boolean flag = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit
- int k = this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING);
+ int k = org.plazmamc.plazma.util.TickingController.calc(this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING), it -> it.accelerate.randomTick, false); // Plazma - TickControl system
List list1;
if (flag && (this.spawnEnemies || this.spawnFriendlies)) {
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 137138aa1e42d4f12ed0bc54bc25918d29120333..b1bdd91eb821dee6c20bed9adb019eda2e8395d7 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -908,7 +908,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
this.setDayTime(this.preciseTime);
} else
// Purpur end
- this.setDayTime(this.levelData.getDayTime() + 1L);
+ // Plazma start - TickControl System
+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().tickControl.accelerate.dayTime)
+ this.setDayTime(this.levelData.getDayTime() + org.plazmamc.plazma.util.TickingController.missedTicks() + 1L);
+ else
+ this.setDayTime(this.levelData.getDayTime() + 1L);
+ // Plazma end - TickControl System
}
}
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 9cd39ccca746c96809e3e1862e25240714662fb2..5f8415f510bb13f9ffe16c869cf8b010c5cbb5e8 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -562,6 +562,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
this.tickEffects();
+ if (plazma.Config.get().tickControl.delay.potionEffect) for (int i = 0; i < org.plazmamc.plazma.util.TickingController.missedTicks(); i++) this.tickEffects(); // Plazma - TickControl System
this.animStepO = this.animStep;
this.yBodyRotO = this.yBodyRot;
this.yHeadRotO = this.yHeadRot;
diff --git a/src/main/java/net/minecraft/world/entity/PortalProcessor.java b/src/main/java/net/minecraft/world/entity/PortalProcessor.java
index b4a8249964786d484aa0767d0e73d71d2156f0e8..49505d04c737c41e4229d80a7b96d4ed0b68d083 100644
--- a/src/main/java/net/minecraft/world/entity/PortalProcessor.java
+++ b/src/main/java/net/minecraft/world/entity/PortalProcessor.java
@@ -24,7 +24,7 @@ public class PortalProcessor {
return false;
} else {
this.insidePortalThisTick = false;
- return canUsePortals && this.portalTime++ >= this.portal.getPortalTransitionTime(world, entity);
+ return canUsePortals && this.increaseTick() >= this.portal.getPortalTransitionTime(world, entity); // Plazma - TickControl System
}
}
@@ -33,6 +33,14 @@ public class PortalProcessor {
return this.portal.getPortalDestination(world, entity, this.entryPosition);
}
+ // Plazma start - TickControl System
+ private int increaseTick() {
+ if (!plazma.Config.get().tickControl.delay.portalUse)
+ this.portalTime += org.plazmamc.plazma.util.TickingController.missedTicks();
+ return this.portalTime++;
+ }
+ // Plazma end - TickControl System
+
public Portal.Transition getPortalLocalTransition() {
return this.portal.getLocalTransition();
}
diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
index 8c5dff4e24c1366d583ba9c7c2c15ea166a24933..96f34e3cd6fcb44f503ce25a3479997ed84c7ce7 100644
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
@@ -158,6 +158,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
if (this.getItem().isEmpty()) {
this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
} else {
+ if (this.pickupDelay > 0 && plazma.Config.get().tickControl.delay.itemPickup) this.pickupDelay = Math.max(this.pickupDelay - org.plazmamc.plazma.util.TickingController.missedTicks(), 0); // Plazma - TickControl System
super.tick();
// Paper start - remove anti tick skipping measures / wall time - revert to vanilla
if (this.pickupDelay > 0 && this.pickupDelay != 32767) {
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index f92b72ee0172cd878baef69b9710dbaf7e5c4495..7865f5375ab3938e326a76766517785821efe19a 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -302,6 +302,11 @@ public abstract class Player extends LivingEntity {
if (this.sleepCounter > 100) {
this.sleepCounter = 100;
}
+ // Plazma start - TickControl System
+ else if (this.sleepCounter < 100 && plazma.Config.get().tickControl.delay.sleep && org.plazmamc.plazma.util.TickingController.missedTicks() > 0) {
+ this.sleepCounter += org.plazmamc.plazma.util.TickingController.missedTicks();
+ }
+ // Plazma end - TickControl System
if (/*!this.level().isClientSide &&*/ this.level().isDay()) { // Plazma - Remove persist 'isClientSide' flag
this.stopSleepInBed(false, true);
diff --git a/src/main/java/net/minecraft/world/item/Item.java b/src/main/java/net/minecraft/world/item/Item.java
index 7fc8fcab93be9076391a2981d028831cbd02a3d2..dccc95834b4cf625b7f5ce88916cbf9a865d87a4 100644
--- a/src/main/java/net/minecraft/world/item/Item.java
+++ b/src/main/java/net/minecraft/world/item/Item.java
@@ -260,7 +260,7 @@ public class Item implements FeatureElement, ItemLike {
public int getUseDuration(ItemStack stack, LivingEntity user) {
Consumable consumable = stack.get(DataComponents.CONSUMABLE);
- return consumable != null ? consumable.consumeTicks() : 0;
+ return consumable != null ? org.plazmamc.plazma.util.TickingController.calc(consumable.consumeTicks(), it -> it.delay.itemUse, true) : 0; // Plazma - TickControl System
}
public boolean releaseUsing(ItemStack stack, Level world, LivingEntity user, int remainingUseTicks) {
diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
index dcf2dcece3e995ce4646b931329246be19a4e1c2..b99945c052d62e293bd3e516c7e9e407d358bbb7 100644
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
@@ -336,13 +336,14 @@ public abstract class BlockBehaviour implements FeatureElement {
protected float getDestroyProgress(BlockState state, Player player, BlockGetter world, BlockPos pos) {
float f = state.getDestroySpeed(world, pos);
- if (f == -1.0F) {
- return 0.0F;
- } else {
- int i = player.hasCorrectToolForDrops(state) ? 30 : 100;
-
- return player.getDestroySpeed(state) / f / (float) i;
- }
+ // Plazma start - TickControl system
+ if (f == -1.0F) return 0.0F;
+ return org.plazmamc.plazma.util.TickingController.calc(
+ player.getDestroySpeed(state) / f / (player.hasCorrectToolForDrops(state) ? 30 : 100),
+ it -> it.delay.blockBreak,
+ false
+ );
+ // Plazma end - TickControl system
}
protected void spawnAfterBreak(BlockState state, ServerLevel world, BlockPos pos, ItemStack tool, boolean dropExperience) {}
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index 2966caede97e01b5ad15a0d56232a0f5526685e2..f1baa2a5ba541fb4a99500b2c79326dec1cd0128 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -1076,8 +1076,18 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
this.chunkCoordinateKey = chunkCoordinateKey;
}
+ // Plazma start - TickControl System
+ private void tickTicker(BlockState state) {
+ this.ticker.tick(LevelChunk.this.level, this.blockEntity.getBlockPos(), state, this.blockEntity);
+
+ if (!org.plazmamc.plazma.util.TickingController.shouldTickAgain(state.getBlock())) return;
+ for (int i = 0; i < org.plazmamc.plazma.util.TickingController.missedTicks(); i++)
+ this.ticker.tick(LevelChunk.this.level, this.blockEntity.getBlockPos(), state, this.blockEntity);
+ }
+ // Plazma end - TickControl System
+
@Override
- public void tick() {
+ public final void tick() { // Plazma - TickControl System (make final)
if (this.blockEntity.isRemoved() || !this.blockEntity.hasLevel()) return;
BlockPos pos = this.blockEntity.getBlockPos();
@@ -1087,7 +1097,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
BlockState state = LevelChunk.this.getBlockState(pos);
if (this.blockEntity.getType().isValid(state)) {
- this.ticker.tick(LevelChunk.this.level, this.blockEntity.getBlockPos(), state, this.blockEntity);
+ this.tickTicker(state); // Plazma - TickControl System
this.loggedInvalidBlockState = false;
// Paper start - Remove the Block Entity if it's invalid
} else {
diff --git a/src/main/java/net/minecraft/world/level/material/LavaFluid.java b/src/main/java/net/minecraft/world/level/material/LavaFluid.java
index 6e643c1a7f7e71cfd20603facaf224985ee81716..cbbbcf8a915a4146eb63e29ba5dd91354ac7228b 100644
--- a/src/main/java/net/minecraft/world/level/material/LavaFluid.java
+++ b/src/main/java/net/minecraft/world/level/material/LavaFluid.java
@@ -181,7 +181,7 @@ public abstract class LavaFluid extends FlowingFluid {
@Override
public int getTickDelay(LevelReader world) {
- return world.dimensionType().ultraWarm() ? world.getWorldBorder().world.purpurConfig.lavaSpeedNether : world.getWorldBorder().world.purpurConfig.lavaSpeedNotNether; // Purpur
+ return org.plazmamc.plazma.util.TickingController.calc(world.dimensionType().ultraWarm() ? world.getWorldBorder().world.purpurConfig.lavaSpeedNether : world.getWorldBorder().world.purpurConfig.lavaSpeedNotNether, it -> it.delay.lavaFluid, true); // Purpur // Plazma - TickControl system
}
@Override
diff --git a/src/main/java/net/minecraft/world/level/material/WaterFluid.java b/src/main/java/net/minecraft/world/level/material/WaterFluid.java
index 028aea6640356ba80f5d682e3cc03b7f82f5b9c7..d788849dc5a568d455cd83ca5b6e1b4ba1a9161f 100644
--- a/src/main/java/net/minecraft/world/level/material/WaterFluid.java
+++ b/src/main/java/net/minecraft/world/level/material/WaterFluid.java
@@ -123,7 +123,7 @@ public abstract class WaterFluid extends FlowingFluid {
@Override
public int getTickDelay(LevelReader world) {
- return world.getWorldBorder().world.plazmaConfig().block.waterFlowingTick; // Plazma - Configurable water flowing speed
+ return org.plazmamc.plazma.util.TickingController.calc(world.getWorldBorder().world.plazmaConfig().block.waterFlowingTick, it -> it.delay.waterFluid, true); // Plazma - Configurable water flowing speed // Plazma - TickControl System
}
@Override
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
index db31d0c066e92fe308e7e64075e832bec66a5c02..04a8bb41b27b8c435203991bebddccb27f472cdb 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
@@ -200,4 +200,39 @@ public class GlobalConfiguration extends ConfigurationPart {
}
+ public TickControl tickControl;
+ public class TickControl extends ConfigurationPart {
+
+ public boolean enabled = false;
+
+ public Delay delay;
+ public class Delay extends ConfigurationPart {
+
+ public boolean sleep = true;
+ public boolean itemUse = true;
+ public boolean portalUse = true;
+ public boolean lavaFluid = true;
+ public boolean waterFluid = true;
+ public boolean blockBreak = true;
+ public boolean itemPickup = true;
+ public boolean potionEffect = true;
+
+ }
+
+ public Accelerate accelerate;
+ public class Accelerate extends ConfigurationPart {
+
+ public boolean dayTime = true;
+ public boolean randomTick = true;
+ public boolean blockEntity = true;
+
+ }
+
+ @PostProcess
+ void post() {
+ org.plazmamc.plazma.util.TickingController.post(this);
+ }
+
+ }
+
}
diff --git a/src/main/java/org/plazmamc/plazma/util/TickingController.java b/src/main/java/org/plazmamc/plazma/util/TickingController.java
new file mode 100644
index 0000000000000000000000000000000000000000..0e71a47a639a1a3dd0918c5a403ed827aca67966
--- /dev/null
+++ b/src/main/java/org/plazmamc/plazma/util/TickingController.java
@@ -0,0 +1,56 @@
+package org.plazmamc.plazma.util;
+
+import net.minecraft.world.level.block.Block;
+import org.jspecify.annotations.NonNull;
+import org.jspecify.annotations.Nullable;
+import org.plazmamc.plazma.configurations.GlobalConfiguration;
+import java.util.function.Function;
+
+import static net.minecraft.server.MinecraftServer.getServer;
+
+public final class TickingController {
+
+ private static @Nullable TickingController INSTANCE;
+ private final GlobalConfiguration.TickControl configuration;
+ private int missedTicks = 0;
+
+ private TickingController(GlobalConfiguration.TickControl configuration) {
+ this.configuration = configuration;
+ }
+
+ public static void tick() {
+ if (INSTANCE == null) return;
+ INSTANCE.missedTicks -= INSTANCE.missedTicks;
+ INSTANCE.missedTicks += (int) (getServer().tickTimes5s.getAverage() / 50 - 1);
+ }
+
+ public static void post(GlobalConfiguration.TickControl configuration) {
+ if (!configuration.enabled) {
+ INSTANCE = null;
+ return;
+ }
+
+ INSTANCE = new TickingController(configuration);
+ }
+
+ public static float calc(float original, @NonNull Function<GlobalConfiguration.TickControl, Boolean> isAffected, boolean swap) {
+ if (INSTANCE == null || !isAffected.apply(INSTANCE.configuration) || original == 0) return original;
+ if (swap) return (float) Math.max(original * getServer().tps5s.getAverage() / 20, 1);
+ return (float) (original * 20 / getServer().tps5s.getAverage());
+ }
+
+ public static int calc(int original, @NonNull Function<GlobalConfiguration.TickControl, Boolean> isAccelerated, boolean swap) {
+ return (int) Math.ceil(calc((float) original, isAccelerated, swap));
+ }
+
+ public static int missedTicks() {
+ if (INSTANCE == null) return 0;
+ return INSTANCE.missedTicks;
+ }
+
+ public static boolean shouldTickAgain(Block block) {
+ // TODO: Configurable block masking
+ return INSTANCE != null && !INSTANCE.configuration.accelerate.blockEntity;
+ }
+
+}

View File

@@ -0,0 +1,58 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Sat, 14 Dec 2024 01:03:07 +0900
Subject: [PATCH] Add option to disable beacon effect ambient
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
index 69ef5c805d802575a639027fd40064d92fcfe89d..31d6bf6c1bcca32ce8a8a8810807dec4d5000ab9 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
@@ -368,24 +368,20 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name
}
}
- private static void applyEffect(List list, @Nullable Holder<MobEffect> holder, int j, int b0, boolean isPrimary, BlockPos worldPosition) { // Paper - BeaconEffectEvent
- if (!list.isEmpty()) { // Paper - BeaconEffectEvent
- Iterator iterator = list.iterator();
+ private static void applyEffect(List<Player> list, @Nullable Holder<MobEffect> holder, int j, int b0, boolean isPrimary, BlockPos worldPosition) { // Paper - BeaconEffectEvent
+ if (list.isEmpty()) return;
- Player entityhuman;
+ // Paper start - BeaconEffectEvent
+ org.bukkit.craftbukkit.block.CraftBlock block = org.bukkit.craftbukkit.block.CraftBlock.at(list.getFirst().level(), worldPosition);
+ PotionEffect effect = CraftPotionUtil.toBukkit(new MobEffectInstance(holder, j, b0, true, !(block).getCraftWorld().getHandle().plazmaConfig().entity.disableBeaconEffectAmbient, true));
+ // Paper end - BeaconEffectEvent
+
+ for (final Player player : list) {
// Paper start - BeaconEffectEvent
- org.bukkit.block.Block block = org.bukkit.craftbukkit.block.CraftBlock.at(((Player) list.get(0)).level(), worldPosition);
- PotionEffect effect = CraftPotionUtil.toBukkit(new MobEffectInstance(holder, j, b0, true, true));
+ BeaconEffectEvent event = new BeaconEffectEvent(block, effect, (org.bukkit.entity.Player) player.getBukkitEntity(), isPrimary);
+ if (CraftEventFactory.callEvent(event).isCancelled()) continue;
+ player.addEffect(new MobEffectInstance(CraftPotionUtil.fromBukkit(event.getEffect())), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.BEACON);
// Paper end - BeaconEffectEvent
-
- while (iterator.hasNext()) {
- // Paper start - BeaconEffectEvent
- entityhuman = (ServerPlayer) iterator.next();
- BeaconEffectEvent event = new BeaconEffectEvent(block, effect, (org.bukkit.entity.Player) entityhuman.getBukkitEntity(), isPrimary);
- if (CraftEventFactory.callEvent(event).isCancelled()) continue;
- entityhuman.addEffect(new MobEffectInstance(CraftPotionUtil.fromBukkit(event.getEffect())), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.BEACON);
- // Paper end - BeaconEffectEvent
- }
}
}
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
index ee7655924358642d4fc58c261decd808ff7f8019..943ef13e5a94e225725d2b390ec11bee677a6cf4 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
@@ -30,6 +30,7 @@ public class WorldConfigurations extends ConfigurationPart {
public int sensorTick = 1;
public boolean suppressErrorsFromDirtyAttributes = OPTIMIZE;
+ public boolean disableBeaconEffectAmbient = false;
public Phantom phantom;
public class Phantom extends ConfigurationPart {

View File

@@ -0,0 +1,36 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <dev@alpha93.kr>
Date: Sat, 14 Dec 2024 11:06:41 +0900
Subject: [PATCH] Tick toggle subcommand
diff --git a/src/main/java/net/minecraft/server/commands/TickCommand.java b/src/main/java/net/minecraft/server/commands/TickCommand.java
index 13d96b54f48d60b098b80e04ba6168762c335c75..5aab945085eb4ed2ea44832319c6daad96fe3a71 100644
--- a/src/main/java/net/minecraft/server/commands/TickCommand.java
+++ b/src/main/java/net/minecraft/server/commands/TickCommand.java
@@ -21,6 +21,10 @@ public class TickCommand {
dispatcher.register(
Commands.literal("tick")
.requires(source -> source.hasPermission(3))
+ // Plazma start - Tick toggle subcommand
+ .executes(context -> toggleFreeze(context.getSource()))
+ .then(Commands.literal("toggle").executes(context -> toggleFreeze(context.getSource())))
+ // Plazma end - Tick toggle subcommand
.then(Commands.literal("query").executes(context -> tickQuery(context.getSource())))
.then(
Commands.literal("rate")
@@ -108,6 +112,14 @@ public class TickCommand {
return 1;
}
+ // Plazma start - Tick toggle subcommand
+ private static int toggleFreeze(CommandSourceStack source) {
+ ServerTickRateManager serverTickRateManager = source.getServer().tickRateManager();
+ boolean frozen = !serverTickRateManager.isFrozen();
+ return setFreeze(source, frozen);
+ }
+ // Plazma end - Tick toggle subcommand
+
private static int setFreeze(CommandSourceStack source, boolean frozen) {
ServerTickRateManager serverTickRateManager = source.getServer().tickRateManager();
if (frozen) {

View File

@@ -0,0 +1,35 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Sun, 5 May 2019 12:58:19 -0500
Subject: [PATCH] LivingEntity safeFallDistance
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
index b777e530122549455dcce6fac8d4a151c1c0af42..57a3e330043077f042a284c99e2631e1582cb32c 100644
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
@@ -1447,4 +1447,24 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
*/
void setBodyYaw(float bodyYaw);
// Paper end - body yaw API
+
+ // Purpur start
+ /**
+ * Gets the distance (in blocks) this entity can safely fall without taking damage
+ *
+ * @return Safe fall distance
+ * @deprecated use {@link org.bukkit.attribute.Attribute#GENERIC_SAFE_FALL_DISTANCE} instead
+ */
+ @Deprecated
+ float getSafeFallDistance();
+
+ /**
+ * Set the distance (in blocks) this entity can safely fall without taking damage
+ *
+ * @param safeFallDistance Safe fall distance
+ * @deprecated use {@link org.bukkit.attribute.Attribute#GENERIC_SAFE_FALL_DISTANCE} instead
+ */
+ @Deprecated
+ void setSafeFallDistance(float safeFallDistance);
+ // Purpur end
}

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