Kitteh6660 / DramaticDoors

Minecraft Mod for Forge & Fabric: 3-block high doors, in every vanilla variety! End enderman discrimination!
MIT License
6 stars 7 forks source link

[BUG] Compatibility problems : need check before adding the property WATERLOGGED with Mixin #84

Closed PierreChag closed 1 week ago

PierreChag commented 4 months ago

Hello,

I'm the dev from the mod DawnOfTime. I found a little incompatibility with your mod, that seems quite easy to fix.

Important Information Minecraft Version: 1.20.1 Mod Loader System: Forge DramaticDoors Version: The last one available

Describe the bug In my mod, I create some DoorBlock with a property WATERLOGGED.

In your mod, you use Mixin (here) to add a WATERLOGGED property to every Blocks instance of DoorBlock.

Since my blocks match this description, the property WATERLOGGED is added twice, leading to a crash :

at net.minecraft.world.level.block.DoorBlock.<init>(DoorBlock.java:53) ~[client-1.20.1-20230612.114412-srg.jar%23688!/:?] {re:mixin,pl:accesstransformer:B,pl:connector_pre_launch:A,re:classloading,pl:accesstransformer:B,pl:mixin:APP:forge-dramaticdoors_forge.mixins.json:DoorBlockMixin from mod (unknown),pl:mixin:A,pl:connector_pre_launch:A}

Could you add a check in the following code to avoid adding this property if the builder already has it ?

@Inject(at = @At("TAIL"), method = "createBlockStateDefinition(Lnet/minecraft/world/level/block/state/StateDefinition$Builder;)V")
protected void injectBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder, CallbackInfo callback) {
    builder.add(WATERLOGGED);
}

Have a nice day :)

Kitteh6660 commented 4 months ago

It could be a possibility. Once I do work on updating, I will get around to doing better handling and ensure mod compatibility.

As a workaround, you can turn off waterlogging in Dramatic Doors config file.

PierreChag commented 4 months ago

Ok thanks !

Kitteh6660 commented 3 months ago

Apparently, the crash does happen if you extend a block and then add waterlogged property to the extended door block without applying to the base doors.

Which is weird as while DawnOfTime adds doors, the added doors are rather inconsistent with waterlogging. Waxed Oak Shutter extends doors and adds waterlogging. That is the culprit. In theory, I could do a Mixin to then cancel adding waterlogging and allow inheriting waterlogging.

Alternatively, I can inject into property validation to cancel the crash due to duplicate property.

Better compatibility with DawnOfTime is planned in the next update. :)

PierreChag commented 3 months ago

Great ! Yes, you are absolutly correct. I'm adding some Doors that are not "waterlogged" to respect the behavior of Vanilla doors. But when I add a new Block that has no equivalent in vanilla MC, I try to give it the features that I consider should be standard, such as Waterlog. Thank you for your help :)