Skip to content

Commit

Permalink
Fix incompatibility with NeoForge (via connector)
Browse files Browse the repository at this point in the history
  • Loading branch information
Earthcomputer committed Oct 3, 2024
1 parent ff38192 commit d544f93
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.core.BlockPos;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.FluidTags;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.enchantment.EnchantmentHelper;
import net.minecraft.world.item.enchantment.Enchantments;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Blocks;
Expand All @@ -22,7 +22,6 @@
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Slice;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(LivingEntity.class)
Expand All @@ -32,6 +31,8 @@ public abstract class LivingEntityMixin extends Entity {
@Shadow
protected int useItemRemaining;

@Shadow public abstract boolean isAlive();

public LivingEntityMixin(EntityType<?> entityType_1, Level level_1) {
super(entityType_1, level_1);
}
Expand All @@ -57,11 +58,9 @@ public void onEat(ItemStack stack, int particleCount, CallbackInfo ci) {
}
}

@Inject(method = "baseTick",
slice = @Slice(from = @At(value = "FIELD", target = "Lnet/minecraft/tags/FluidTags;WATER:Lnet/minecraft/tags/TagKey;", ordinal = 0)),
at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;getBlockState(Lnet/minecraft/core/BlockPos;)Lnet/minecraft/world/level/block/state/BlockState;", ordinal = 0))
@Inject(method = "baseTick", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/LivingEntity;isAlive()Z", ordinal = 0))
public void onUnderwater(CallbackInfo ci) {
if (isThePlayer()) {
if (isThePlayer() && isAlive() && isEyeInFluid(FluidTags.WATER)) {
PlayerRandCracker.onUnderwater();
}
}
Expand Down

0 comments on commit d544f93

Please sign in to comment.