Skip to content

Commit

Permalink
fix: crash caused by missing null check
Browse files Browse the repository at this point in the history
  • Loading branch information
IThundxr committed Nov 20, 2024
1 parent 57abcfe commit ae9324d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package dev.ithundxr.railwaystweaks.mixin.compat.create;

import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import com.llamalad7.mixinextras.sugar.Local;
import com.simibubi.create.foundation.utility.BlockHelper;
import net.minecraft.world.level.block.entity.BlockEntity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;

@Mixin(BlockHelper.class)
public class BlockHelperMixin {
@ModifyExpressionValue(method = "placeSchematicBlock", at = @At(value = "INVOKE", target = "Ljava/lang/Object;equals(Ljava/lang/Object;)Z"))
private static boolean railwayTweaks$fixSchematicannonCrash(boolean original, @Local(ordinal = 1) BlockEntity loaded) {
return loaded != null && original;
}
}
1 change: 1 addition & 0 deletions src/main/resources/railwaystweaks.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"ServerPlayerMixin",
"ServerStatusPacketListenerImplMixin",
"compat.appleskin.SyncHandlerMixin",
"compat.create.BlockHelperMixin",
"compat.create.Carriage$DimensionalCarriageEntityMixin",
"compat.create.CarriageAccessor",
"compat.create.SchematicannonBlockEntityMixin",
Expand Down

0 comments on commit ae9324d

Please sign in to comment.