IzzelAliz / Arclight

A Bukkit(1.19/1.20) server implementation in modding environment using Mixin. ⚡
GNU General Public License v3.0
1.55k stars 230 forks source link

[1.16.5] Server crash when use block from FramedBlocks mod #746

Closed doarlock closed 2 years ago

doarlock commented 2 years ago

I have confirmed that ...

Arclight version

arclight-1.16.5-1.0.24-SNAPSHOT-ef6b96f2

OS & Java versions

11.0.13 by Oracle Corporation

Plugins and Mods

Plugins (13): SimpleTpa, LuckPerms, Vault, ProtocolLib, WorldEdit, CrazyAuctions, XConomy, CrateReloaded, WorldGuard, LevelledMobs, Duels, MoneyFromMobs, ProtectionStones

Mod List: 
• mods_folder create-stuff-additions1.16.5_v1.1.6.jar : create_stuff_additions (1.1.6) - 1
• mods_folder supermartijn642configlib-1.1.6-forge-mc1.16.jar : supermartijn642configlib (1.1.6) - 1
• mods_folder infernal-expansion-1.16.5-2.5.0.jar : infernalexp (2.5.0) - 1
• mods_folder PGA-1.16.4-1.1.2.1.jar : publicguiannouncement (1.1.0.1) - 1
• mods_folder Architects-Palette-1.16.4-1.1.5.jar : architects_palette (1.1.2) - 1
• mods_folder mcw-windows-2.0.3-mc1.16.5.jar : mcwwindows (2.0.3) - 1
• mods_folder stalwart-dungeons-1.16.5-1.1.7.jar : stalwart_dungeons (1.1.7) - 1
• mods_folder ForgeEndertech-1.16.5-7.2.2.0-build.0202.jar : forgeendertech (7.2.2.0) - 1
• mods_folder CTM-MC1.16.1-1.1.2.6.jar : ctm (MC1.16.1-1.1.2.6) - 1
• mods_folder citadel-1.8.1-1.16.5.jar : citadel (1.8.1) - 1
• mods_folder alexsmobs-1.12.1.jar : alexsmobs (1.12.1) - 1
• mods_folder farmersdelightintegrations-1.16.5-1.2.jar : farmersdelightintegrations (1.16.5-1.2) - 1
• mods_folder mcwbridgesaurora-1.16.5-1.0.jar : mcwbridgesaurora (1.16.5-1.0) - 1
• mods_folder upgradednetherite_items-1.16.5-1.1.0.1-release.jar : upgradednetherite_items (1.16.5-1.1.0.1-release) - 1
• mods_folder macawsbridgesbop-1.16.5-1.4.jar : macawsbridgesbop (1.16.5-1.4) - 1
• mods_folder sophisticatedbackpacks-1.16.5-3.15.18.698.jar : sophisticatedbackpacks (1.16.5-3.15.18.698) - 1
• mods_folder mcw-doors-1.0.7-mc1.16.5.jar : mcwdoors (1.0.7) - 1
• mods_folder Morpheus-1.16.5-4.2.70.jar : morpheus (4.2.70) - 1
• mods_folder macawsroofsbop-1.16.5-1.5.jar : macawsroofsbop (1.16.5-1.5) - 1
• mods_folder twilightforest-1.16.5-4.0.870-universal.jar : twilightforest (NONE) - 1
• mods_folder supplementaries-1.16.5-0.18.4b.jar : supplementaries (0.18.2) - 1
• mods_folder upgradednetherite-1.16.5-2.1.0.0-release.jar : upgradednetherite (1.16.5-2.1.0.0-release) - 1
• mods_folder UndeadExpansion_2.0.4_1.16.5_b.jar : undead_expansion (2.0.4) - 1
• mods_folder mcwbridgesabnormals-1.16.5-1.1.jar : mcwbridgesabnormals (1.16.5-1.1) - 1
• mods_folder mcw-bridges-2.0.3-mc1.16.5.jar : mcwbridges (2.0.3) - 1
• mods_folder FarmersDelight-1.16.5-0.6.0.jar : farmersdelight (1.16.5-0.6.0) - 1
• mods_folder repurposed_structures_forge-3.4.7+1.16.5.jar : repurposed_structures (3.4.7+1.16.5) - 1
• mods_folder morevillagers-FORGE-1.16.5-1.5.5.jar : morevillagers (1.5.5) - 1
• mods_folder BiomesOPlenty-1.16.5-13.1.0.477-universal.jar : biomesoplenty (1.16.5-13.1.0.477) - 1
• mods_folder mcw-trapdoors-1.0.7-mc1.16.5.jar : mcwtrpdoors (1.0.7) - 1
• mods_folder mcw-fences-1.0.6-mc1.16.5.jar : mcwfences (1.0.6) - 1
• mods_folder unearthed-1.3.0.jar : unearthed (1.2.2) - 1
• mods_folder supermartijn642corelib-1.0.19-forge-mc1.16.5.jar : supermartijn642corelib (1.0.19) - 1
• mods_folder fairylights-4.0.5-1.16.5.jar : fairylights (4.0.5) - 1
• mods_folder Goblins_Dungeons_1.0.6-1.16.jar : goblinsanddungeons (1.0.6) - 1
• mods_folder curios-forge-1.16.5-4.0.8.2.jar : curios (1.16.5-4.0.8.2) - 1
• mods_folder collective-1.16.5-4.50.jar : collective (4.50) - 1
• mods_folder FramedBlocks-2.16.1.jar : framedblocks (2.16.1) - 1
• mods_folder villagertools-1.16.5-1.0.2.jar : villagertools (1.16.5-1.0.2) - 1
• mods_folder bettervillage-forge-1.16.5-2.0.0.jar : bettervillage (2.0.0) - 1
• mods_folder dawnoftime_builder_edition-1.16.5-1.2.5.jar : dawnoftimebuilder (1.16.5-1.2.5) - 1
• mods_folder tombstone-6.7.9-1.16.5.jar : tombstone (6.7.9) - 1
• mods_folder CustomNPCs-1.16.5.20220515.jar : customnpcs (1.16.5.20220515) - 1
• mods_folder worldedit-mod-7.2.5-dist.jar : worldedit (7.2.5+57d5ac9) - 1
• mods_folder morevanillaarmor-1.16.4-1.2.6.jar : morevanillaarmor (1.16.4-1.2.6) - 1
• mods_folder mcw-roofs-2.2.0-mc1.16.5-forge.jar : mcwroofs (2.2.0) - 1
• mods_folder cfm-7.0.0pre22-1.16.3.jar : cfm (7.0.0-pre22) - 1
• mods_folder architectury-1.32.66.jar : architectury (1.32.66) - 1
• mods_folder AI-Improvements-1.16.5-0.5.0.jar : aiimprovements (0.4.0) - 1
• mods_folder mcw-furniture-3.0.1-mc1.16.5.jar : mcwfurnitures (3.0.1) - 1
• mods_folder FallingTree-1.16.5-2.11.5.jar : fallingtree (2.11.5) - 1
• mods_folder toms_storage-1.2.19.jar : toms_storage (1.2.19) - 1
• mods_folder infinitetrading_1.16.5-1.9.jar : infinitetrading (1.9) - 1
• mods_folder mcw-lights-1.0.4-mc1.16.5.jar : mcwlights (1.0.4) - 1
• mods_folder mowziesmobs-1.5.25.jar : mowziesmobs (1.5.25) - 1
• mods_folder geckolib-forge-1.16.5-3.0.89.jar : geckolib3 (3.0.89) - 1
• mods_folder TrashSlot_1.16.3-12.2.1.jar : trashslot (12.2.1) - 1
• mods_folder rechiseled-1.0.10-mc1.16.jar : rechiseled (1.0.10) - 1
• mods_folder limitedchunks-2.1.jar : limitedchunks (1.8) - 1
• mods_folder CustomSkinLoader_ForgeLegacy-14.14-SNAPSHOT-346.jar : customskinloader (14.14-SNAPSHOT-346) - 1
• mods_folder locks-1.16.5-3.0.3.jar : locks (3.0.3) - 1
• mods_folder jei-1.16.5-7.7.1.152.jar : jei (7.7.1.152) - 1
• mods_folder VisualWorkbench-v1.1.0-1.16.5.jar : visualworkbench (1.1.0) - 1
• mods_folder AttributeFix-1.16.5-10.1.4.jar : attributefix (10.1.4) - 1
• mods_folder Rechiseled+Compat-1.0.4.jar : rechiseled_compat (1.0.4) - 1
• mods_folder abnormals_core-1.16.5-3.3.1.jar : abnormals_core (3.3.1) - 1
• mods_folder environmental-1.16.5-1.1.1.jar : environmental (1.1.1) - 1
• mods_folder bamboo_blocks-1.16.5-3.0.1.jar : bamboo_blocks (3.0.1) - 1
• mods_folder allurement-1.16.5-1.2.1.jar : allurement (1.2.1) - 1
• mods_folder Compat-O-Plenty-1.16.5-1.0.7.jar : compatoplenty (1.16.5-1.0.7) - 1
• mods_folder buzzier_bees-1.16.5-3.0.3.jar : buzzier_bees (3.0.3) - 1
• mods_folder berry_good-1.16.5-4.1.2.jar : berry_good (4.1.2) - 1
• mods_folder Enhanced-Mushrooms-1.16.5-3.0.9.jar : enhanced_mushrooms (1.16.5-3.0.9) - 1
• mods_folder Bayou-Blues-1.16.5-1.0.5.jar : bayou_blues (1.16.5-1.0.5) - 1
• mods_folder libraryferret-forge-1.16.5-3.0.0.jar : libraryferret (3.0.0) - 1
• mods_folder goblintraders-1.7.3-1.16.5.jar : goblintraders (1.7.3) - 1
• mods_folder Better-Badlands-1.16.5-2.0.3.jar : better_badlands (1.16.5-2.0.3) - 1
• mods_folder extraboats-1.16.5-2.1.1.jar : extraboats (2.1.1) - 1
• mods_folder Waystones_1.16.5-7.6.4.jar : waystones (7.6.4) - 1
• mods_folder Clumps-6.0.0.28.jar : clumps (6.0.0.28) - 1
• mods_folder comforts-forge-1.16.5-4.0.1.5.jar : comforts (1.16.5-4.0.1.5) - 1
• mods_folder Artifacts-1.16.5-2.10.5.jar : artifacts (1.16.5-2.10.5) - 1
• mods_folder configured-1.5.3-1.16.5.jar : configured (1.5.3) - 1
• mods_folder decorative_blocks-1.16.4-1.7.2.jar : decorative_blocks (1.7.2) - 1
• mods_folder decorative_blocks_abnormals-1.2.jar : decorative_blocks_abnormals (1.2) - 1
• mods_folder Orcz+0.67+1.16.5.jar : orcz (0.67) - 1
• maven_libs forge-1.16.5-36.2.39-universal.jar : forge (36.2.39) - 1
• mods_folder endergetic-1.16.5-3.0.2.jar : endergetic (3.0.2) - 1
• mods_folder Fish's+Undead+Rising-2.0.5.jar : mod_lavacow (2.0.3) - 1
• mods_folder neapolitan-1.16.5-2.2.1.jar : neapolitan (2.2.1) - 1
• mods_folder mcw-paths-1.0.1-mc1.16.5.jar : mcwpaths (1.0.1) - 1
• mods_folder selene-1.16.5-1.9.0.jar : selene (1.16.5-1.0) - 1
• minecraft forge-1.16.5-36.2.39-server.jar : minecraft (1.16.5) - 1
• mods_folder mcwfencesbop-1.16.5-1.3.jar : mcwfencesbop (1.16.5-1.3) - 1
• mods_folder upgrade_aquatic-1.16.5-3.1.2.jar : upgrade_aquatic (3.1.2) - 1
• mods_folder Alex's+Delight+1.1.3+-+Forge+1.16.5.jar : amfd (1.1.3) - 1
• mods_folder Abundance-1.16.5-1.0.5.jar : abundance (1.16.5-1.0.5) - 1
• mods_folder AdLods-1.16.5-4.1.9.2-build.0217.jar : adlods (4.1.9.2) - 1
• mods_folder farmersdelightintegration-1.16.5-1.0.3.jar : farmersdelightintegration (1.16.5-1.0.3) - 1
• mods_folder atmospheric-1.16.5-3.1.1.jar : atmospheric (3.1.1) - 1
• mods_folder flywheel-1.16-0.2.5.jar : flywheel (1.16-0.2.5) - 1
• mods_folder create-mc1.16.5_v0.3.2g.jar : create (v0.3.2g) - 1
• mods_folder savageandravage-1.16.5-3.2.0.jar : savageandravage (3.2.0) - 1
• mods_folder autumnity-1.16.5-2.1.2.jar : autumnity (2.1.2) - 1
• mods_folder DramaticDoors-1.16.5-1.5.0.jar : dramaticdoors (1.16.5-1.5.0) - 1
• mods_folder polymorph-forge-1.16.5-0.40.jar : polymorph (1.16.5-0.40) - 1
• mods_folder AutoRegLib-1.6-49.jar : autoreglib (1.6-49) - 1
• mods_folder Quark-r2.4-322.jar : quark (r2.4-322) - 1
• mods_folder charm-forge-1.16.5-2.3.2.jar : charm (2.3.2) - 1
• mods_folder abnormals_delight-1.16.5-1.2.1.jar : abnormals_delight (1.2.1) - 1
• mods_folder earthmobsmod-1.16.4-0.4.2.jar : earthmobsmod (1.16.4-0.4.2) - 1
• mods_folder PiTweaks-1.16.5-1.3.3.jar : pitweaks (1.16.5-1.3.3) - 1
• mods_folder Wesley's+Roguelike+Dungeons+(Version+1.0).jar : wrd (1.0.0) - 1
• mods_folder upgradedcore-1.16.5-1.1.0.0-release.jar : upgradedcore (1.16.5-1.1.0.0-release) - 1
• mods_folder nethers_delight-2.1.jar : nethers_delight (2.1) - 1
• mods_folder appleskin-forge-mc1.16.x-2.4.0.jar : appleskin (2.4.0+mc1.16.4) - 1
• mods_folder [BETA]dannys_expansion1.16.5-1.0.9.1.jar : dannys_expansion (1.0.9) - 1
• mods_folder ferritecore-2.1.0-forge.jar : ferritecore (2.1.0) - 1
• mods_folder connectedglass-1.1.4-forge-mc1.16.jar : connectedglass (1.1.4) - 1
• mods_folder Chisel-MC1.16.5-2.0.1-alpha.4.jar : chisel (MC1.16.5-2.0.1-alpha.4) - 1
• mods_folder upgradednetherite_ultimate-1.16.5-1.1.0.0-release.jar : upgradednetherite_ultimate (1.16.5-1.1.0.0-release) - 1
• arclight server.jar : arclight (1.16.5-1.0.24-SNAPSHOT-ef6b96f2) - 1
• mods_folder PuzzlesLib-v1.0.15-1.16.5-Forge.jar : puzzleslib (1.0.15) - 1
• mods_folder Aquaculture-1.16.5-2.1.22.jar : aquaculture (1.16.5-2.1.22) - 1
• mods_folder expandability-2.0.1-forge.jar : expandability (2.0.1) - 1
• mods_folder CosmeticArmorReworked-1.16.5-v5.jar : cosmeticarmorreworked (1.16.5-v5) - 1
• mods_folder valhelsia_core-16.0.15.jar : valhelsia_core (16.0.15) - 1
• mods_folder valhelsia_structures-1.16.5-0.1.6.jar : valhelsia_structures (1.16.5-0.1.6) - 1
• mods_folder healingcampfire_1.16.5-3.9.jar : healingcampfire (3.9) - 1
• mods_folder createaddition-1.16.5-20220129a.jar : createaddition (1.16.5-20220129a) - 1

Description

The server just crashed when put any block from the FramedBlocks mod by [XFactHD] https://www.curseforge.com/minecraft/mc-mods/framedblocks.

The console prints this crash:

[20Sep2022 18:06:21.045] [Server thread/ERROR] [net.minecraft.server.MinecraftServer/]: Encountered an unexpected exception java.lang.NullPointerException: null at xfacthd.framedblocks.common.tileentity.FramedTileEntity.checkSolidStateOnLoad(FramedTileEntity.java:539) ~[framedblocks:2.16.1] at java.util.ArrayList.forEach(ArrayList.java:1541) ~[?:?] at xfacthd.framedblocks.common.util.EventHandler.onServerTick(EventHandler.java:84) ~[framedblocks:2.16.1] at net.minecraftforge.eventbus.ASMEventHandler_383_EventHandler_onServerTick_ServerTickEvent.invoke(.dynamic) ~[?:?] at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:85) ~[eventbus-4.0.0.jar:?] at net.minecraftforge.eventbus.EventBus.post(EventBus.java:302) ~[eventbus-4.0.0.jar:?] at net.minecraftforge.eventbus.EventBus.post(EventBus.java:283) ~[eventbus-4.0.0.jar:?] at net.minecraftforge.fml.hooks.BasicEventHooks.onPreServerTick(BasicEventHooks.java:101) ~[forge:?] at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServerMixin.java:785) ~[?:?] at net.minecraft.server.MinecraftServer.func_240802v(MinecraftServerMixin.java:1917) ~[?:?] at net.minecraft.server.MinecraftServer.func_240783a(MinecraftServerMixin.java:232) ~[?:?] at java.lang.Thread.run(Thread.java:829) [?:?] [20Sep2022 18:06:21.065] [Server thread/FATAL] [net.minecraftforge.common.ForgeMod/]: Preparing crash report with UUID ad0da6a7-be67-4dd4-884f-e5a35b9fd01b

I test without Arclight and the mod works right.

Step to reproduce

1 - Just install server 2 - Enters the server 3 - Pick up a block from Framedblocks mod using JEI or creative 4 - Put on anywhere 5 - Crashed

Logs

2022-09-20-2.log crash-2022-09-20_18.06.21-server.txt

Server pack link (Optional)

No response

AnCasper commented 2 years ago

Can confirm that this is an issue, even if this gets fixed you will still have the same issue when you break the block as well. Magma and Mohist suffer from this issue as well. Sponge Forge works but they don't have much plugins support at the moment.

Should note that it happens with any version of forge and Java so don't waste your time trying versions. It has something to do with removing or inserting a block into the framed block. State change issue. Good luck!

IzzelAliz commented 2 years ago

This should report to FramedBlocks side with these information:

The level in BlockEntity can be null. For the onLoad implementation, forge actually provide a onLoad callback in IForgeTileEntity.

XFactHD commented 1 year ago

This should report to FramedBlocks side with these information:

The level in BlockEntity can be null. For the onLoad implementation, forge actually provide a onLoad callback in IForgeTileEntity.

I have been informed by the author of this issue about your response, so I might as well add my side to it: I am well aware that the BlockEntity#level can be null. However, on plain Forge I can expect the level to be set one tick after a blockentity has been deserialized from NBT data, which is the only reference point my implementation can rely on to be able to access the level in a way that doesn't cause deadlocks. This assumption is broken by all Bukkit-Forge hybrid implementations and only by those, removing any possible reference point for me to do a "first tick with level access" operation. The IForgeTileEntity#onLoad() hook you suggested as the fix is broken and unusable for this prior to 1.17 as it is called from within the chunk loading future mess, which leads to any level access in that method causing a chunk loading deadlock. In 1.17 this hook has been reimplemented outside of the future hell and can since then be used again for this kind of thing (which I am doing in all versions of FramedBlocks since the first 1.17 version, which is why this has never come up again with anything newer than 1.16).

IzzelAliz commented 1 year ago

This should report to FramedBlocks side with these information:

The level in BlockEntity can be null. For the onLoad implementation, forge actually provide a onLoad callback in IForgeTileEntity.

I am well aware that the BlockEntity#level can be null. However, on plain Forge I can expect the level to be set one tick after a blockentity has been deserialized from NBT data, which is the only reference point my implementation can rely on to be able to access the level in a way that doesn't cause deadlocks.

Arclight(or other implementations maybe?) did not break the "level will be set after 1 tick" rule. Bukkit create a BE copy instance(serialize to nbt and deserialize it) in block breaking and other possible events, and these instances will not be placed into game worlds, therefore can be safely ignored. Forge itself actually uses the same trick in net.minecraftforge.common.util.BlockSnapshot#getTileEntity.

My point is that you can simply ignore these instances with null level, if you are still maintaining 1.16.

XFactHD commented 1 year ago

Arclight(or other implementations maybe?) did not break the "level will be set after 1 tick" rule. Bukkit create a BE copy instance(serialize to nbt and deserialize it) in block breaking and other possible events, and these instances will not be placed into game worlds, therefore can be safely ignored. Forge itself actually uses the same trick in net.minecraftforge.common.util.BlockSnapshot#getTileEntity.

That's good to know. The major difference is that Forge keeps the BE as NBT data and only deserializes it again on demand.

My point is that you can simply ignore these instances with null level, if you are still maintaining 1.16.

I dropped support for 1.16 but I'll think about releasing a small update with this fix anyway since it has a very significant impact.

Thank you for the insights, I'm happy to finally get detailed info on what is actually happening behind the scenes from the Bukkit side.