Skip to content

Commit

Permalink
Minor tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
Sydokiddo committed Apr 5, 2024
1 parent f9a4c82 commit 15f59b6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 34 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
import net.sydokiddo.odyssey.Odyssey;
import net.sydokiddo.odyssey.registry.OdysseyRegistry;
import net.sydokiddo.odyssey.registry.misc.ModSoundEvents;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.*;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
Expand Down Expand Up @@ -206,7 +204,7 @@ private void doEntityConversionEvents(Mob mob) {
@Inject(at = @At("HEAD"), method = "getJumpDelay", cancellable = true)
private void odyssey$preventSlimeJumpingWhileConverting(CallbackInfoReturnable<Integer> cir) {
if ((this.isSlimeConverting() || this.isMagmaConverting()) && Odyssey.getConfig().entities.hostileMobsConfig.slime_and_magma_cube_converting) {
cir.setReturnValue(conversionTime);
cir.setReturnValue(this.conversionTime);
}
}

Expand All @@ -218,5 +216,22 @@ public boolean isInvulnerableTo(DamageSource damageSource) {
return super.isInvulnerableTo(damageSource);
}

@Mixin(targets = "net/minecraft/world/entity/monster/Slime$SlimeFloatGoal", priority = 1500)
public static class SlimeFloatGoalMixin {

@Mutable @Final @Shadow private final Slime slime;

private SlimeFloatGoalMixin(Slime slime) {
this.slime = slime;
}

@Inject(method = "canUse", at = @At(value = "HEAD"), cancellable = true)
private void odyssey$preventMagmaCubesFloatingOnWater(CallbackInfoReturnable<Boolean> cir) {
if (this.slime instanceof MagmaCube magmaCube && magmaCube.isInWater() && Odyssey.getConfig().entities.hostileMobsConfig.slime_and_magma_cube_converting) {
cir.setReturnValue(false);
}
}
}

// endregion
}
2 changes: 1 addition & 1 deletion src/main/resources/odyssey.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"blocks.plants.SugarCaneBlockMixin",
"entities.hostile.CreeperMixin",
"entities.hostile.GuardianMixin",
"entities.hostile.SlimeFloatGoalMixin",
"entities.hostile.SlimeMixin",
"entities.hostile.SlimeMixin$SlimeFloatGoalMixin",
"entities.hostile.VexMixin",
"entities.misc.EntityMixin",
"entities.misc.ItemFrameMixin",
Expand Down

0 comments on commit 15f59b6

Please sign in to comment.