Additional-Mods / additionaladditions

A Minecraft Fabric mod that that aims to add additional uses for Copper, Amethyst and Glow Ink Sacs as well as other useful additional additions to the game.
GNU Lesser General Public License v3.0
41 stars 23 forks source link

compatibility issue with enchanting infuser, having speed and soul speed on boots crashes your game and prevents you from rejoining the server when stepping on soulsand. #103

Open Cryominous opened 1 year ago

Cryominous commented 1 year ago

Using the Enchaning Infuser mod, you can put speed on boots that have the soul speed enchantment, but if you do that then stepping on soulsand seems to effectively ban you from the server. I crashed and was unable to rejoin. Luckily i was able to join on an alt and break the soulsand which fixed it but i image doing this on singleplayer may just break your world.

Dqu1J commented 1 year ago

that's why you can't combine speed and soul speed in a vanilla anvil. those two are marked incompatible but that mod you're using seems to ignore it

Phoupraw commented 10 months ago

that's why you can't combine speed and soul speed in a vanilla anvil. those two are marked incompatible but that mod you're using seems to ignore it

You can combine the two enchantments by command in vanilla. The game still crashes. The bottom line is that any command can't lead to a permenent crash. You may make the enchantment not to work but you can't crash the game anyway.

I wrote a mixin to fix it:

@Mixin(LivingEntity.class)
abstract class MLivingEntity extends Entity {
    private static final UUID NEW_SOUL_SPEED_UUID = Trifle.uuidOf(new Identifier("additionaladditions", "speed"), 1);//This can be a random UUID.
    @Shadow
    public abstract EntityAttributeInstance getAttributeInstance(EntityAttribute attribute);
    @Redirect(method = {"addSoulSpeedBoostIfNeeded", "removeSoulSpeedBoost"}, at = @At(value = "FIELD", target = "Lnet/minecraft/entity/LivingEntity;SOUL_SPEED_BOOST_ID:Ljava/util/UUID;"))
    private static UUID changeSoulSpeedUUID() {
        return FabricLoader.getInstance().isModLoaded("additionaladditions") ? NEW_SOUL_SPEED_UUID : SOUL_SPEED_BOOST_ID;
    }
}
RYUKxAnime commented 9 months ago

that's why you can't combine speed and soul speed in a vanilla anvil. those two are marked incompatible but that mod you're using seems to ignore it

You can combine the two enchantments by command in vanilla. The game still crashes. The bottom line is that any command can't leat to a permenent crash. You may make the enchantment not to work but you can't crash the game anyway.

I wrote a mixin to fix it:

@Mixin(LivingEntity.class)
abstract class MLivingEntity extends Entity {
    private static final UUID NEW_SOUL_SPEED_UUID = Trifle.uuidOf(new Identifier("additionaladditions", "speed"), 1);//This can be a random UUID.
    @Shadow
    public abstract EntityAttributeInstance getAttributeInstance(EntityAttribute attribute);
    @Redirect(method = {"addSoulSpeedBoostIfNeeded", "removeSoulSpeedBoost"}, at = @At(value = "FIELD", target = "Lnet/minecraft/entity/LivingEntity;SOUL_SPEED_BOOST_ID:Ljava/util/UUID;"))
    private static UUID changeSoulSpeedUUID() {
        return FabricLoader.getInstance().isModLoaded("additionaladditions") ? NEW_SOUL_SPEED_UUID : SOUL_SPEED_BOOST_ID;
    }
}

i dont know anything about coding please tell me how do I use that mixin to fix it do I need to add it to the mod or make a new mod please help

Phoupraw commented 9 months ago

@RYUKxAnime What's your MC version?