Skip to content

Commit

Permalink
Merge branch '1.21.2' into 1.21.4
Browse files Browse the repository at this point in the history
  • Loading branch information
AViewFromTheTop committed Feb 20, 2025
2 parents b6adecd + 9a951cf commit 03ce598
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class LivingEntityMixin {
Level level = warden.level();
int deathTicks = wilderWarden.wilderWild$getDeathTicks() + 1;
wilderWarden.wilderWild$setDeathTicks(deathTicks);
if (!level.isClientSide()) {
if (!level.isClientSide) {
if (deathTicks == 35) {
warden.deathTime = 35;
} else if (deathTicks == 53) {
Expand All @@ -67,7 +67,13 @@ public class LivingEntityMixin {
}
}

@Inject(method = "die", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;broadcastEntityEvent(Lnet/minecraft/world/entity/Entity;B)V"))
@Inject(
method = "die",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/level/Level;broadcastEntityEvent(Lnet/minecraft/world/entity/Entity;B)V"
)
)
public void wilderWild$die(DamageSource damageSource, CallbackInfo info) {
if (this.wilderWild$isWardenWithDeathAnimation()) {
Warden warden = Warden.class.cast(this);
Expand All @@ -76,9 +82,9 @@ public class LivingEntityMixin {
WilderWarden wilderWarden = (WilderWarden) warden;
if (!wilderWarden.wilderWild$isStella()) {
if (!(warden instanceof SwimmingWardenInterface swimmingWardenInterface) || !swimmingWardenInterface.wilderWild$isSubmergedInWaterOrLava()) {
warden.playSound(WWSounds.ENTITY_WARDEN_DYING, 5.0F, 1.0F);
warden.playSound(WWSounds.ENTITY_WARDEN_DYING, 5F, 1F);
} else {
warden.playSound(WWSounds.ENTITY_WARDEN_UNDERWATER_DYING, 5.0F, warden.getVoicePitch());
warden.playSound(WWSounds.ENTITY_WARDEN_UNDERWATER_DYING, 5F, warden.getVoicePitch());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ public class SonicBoomMixin implements WilderSonicBoom {
@Unique
private boolean wilderWild$particlesEnded = false;

@ModifyVariable(method = "method_43265",
@ModifyVariable(
method = "method_43265",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/server/level/ServerLevel;sendParticles(Lnet/minecraft/core/particles/ParticleOptions;DDDIDDDD)I"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import net.frozenblock.wilderwild.client.animation.definitions.impl.WilderWarden;
import net.frozenblock.wilderwild.config.WWEntityConfig;
import net.frozenblock.wilderwild.entity.Tumbleweed;
Expand All @@ -31,6 +33,7 @@
import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
import net.minecraft.tags.FluidTags;
import net.minecraft.util.Unit;
import net.minecraft.world.DifficultyInstance;
Expand All @@ -57,10 +60,8 @@
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.ModifyArgs;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import org.spongepowered.asm.mixin.injection.invoke.arg.Args;

@Mixin(value = Warden.class, priority = 69420)
public final class WardenMixin extends Monster implements WilderWarden {
Expand Down Expand Up @@ -114,9 +115,11 @@ public boolean isDiggingOrEmerging() {
@Unique
@Override
public boolean wilderWild$isStella() {
Warden warden = Warden.class.cast(this);
String name = ChatFormatting.stripFormatting(warden.getName().getString());
return name != null && (name.equalsIgnoreCase("Stella") || name.equalsIgnoreCase("Osmiooo") || name.equalsIgnoreCase("Mossmio") || name.equalsIgnoreCase("Osmio"));
String name = ChatFormatting.stripFormatting(this.getName().getString());
return name.equalsIgnoreCase("Stella")
|| name.equalsIgnoreCase("Osmiooo")
|| name.equalsIgnoreCase("Mossmio")
|| name.equalsIgnoreCase("Osmio");
}

@ModifyReturnValue(at = @At("RETURN"), method = "getDeathSound")
Expand All @@ -125,7 +128,13 @@ public boolean isDiggingOrEmerging() {
}

@Inject(at = @At("TAIL"), method = "finalizeSpawn")
public void wilderWild$finalizeSpawn(ServerLevelAccessor serverLevelAccess, DifficultyInstance localDifficulty, EntitySpawnReason spawnReason, @Nullable SpawnGroupData entityData, CallbackInfoReturnable<SpawnGroupData> info) {
public void wilderWild$finalizeSpawn(
ServerLevelAccessor serverLevelAccess,
DifficultyInstance localDifficulty,
EntitySpawnReason spawnReason,
@Nullable SpawnGroupData entityData,
CallbackInfoReturnable<SpawnGroupData> info
) {
if ((WWEntityConfig.get().warden.wardenEmergesFromEgg && spawnReason == EntitySpawnReason.SPAWN_ITEM_USE)
|| (WWEntityConfig.get().warden.wardenEmergesFromCommand && spawnReason == EntitySpawnReason.COMMAND)
) {
Expand All @@ -135,7 +144,15 @@ public boolean isDiggingOrEmerging() {
}
}

@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/ai/Brain;setMemoryWithExpiry(Lnet/minecraft/world/entity/ai/memory/MemoryModuleType;Ljava/lang/Object;J)V", shift = At.Shift.BEFORE, ordinal = 0), method = "doPush")
@Inject(
method = "doPush",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/entity/ai/Brain;setMemoryWithExpiry(Lnet/minecraft/world/entity/ai/memory/MemoryModuleType;Ljava/lang/Object;J)V",
shift = At.Shift.BEFORE,
ordinal = 0
)
)
private void wilderWild$doPush(Entity entity, CallbackInfo info) {
Warden warden = Warden.class.cast(this);
if (!warden.getBrain().hasMemoryValue(MemoryModuleType.ATTACK_COOLING_DOWN)
Expand Down Expand Up @@ -172,14 +189,31 @@ public boolean isDiggingOrEmerging() {
}
}

@ModifyArgs(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;playLocalSound(DDDLnet/minecraft/sounds/SoundEvent;Lnet/minecraft/sounds/SoundSource;FFZ)V", ordinal = 0))
private void wilderWild$stellaHeartbeat(Args args) {
@WrapOperation(
method = "tick",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/level/Level;playLocalSound(DDDLnet/minecraft/sounds/SoundEvent;Lnet/minecraft/sounds/SoundSource;FFZ)V",
ordinal = 0
)
)
private void wilderWild$stellaHeartbeat(
Level instance, double d, double e, double f, SoundEvent soundEvent, SoundSource soundSource, float g, float h, boolean bl, Operation<Void> original
) {
if (this.wilderWild$isStella()) {
args.set(3, WWSounds.ENTITY_WARDEN_STELLA_HEARTBEAT);
soundEvent = WWSounds.ENTITY_WARDEN_STELLA_HEARTBEAT;
}
original.call(instance, d, e, f, soundEvent, soundSource, g, h, bl);
}

@ModifyExpressionValue(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/monster/warden/Warden;isSilent()Z", ordinal = 0))
@ModifyExpressionValue(
method = "tick",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/entity/monster/warden/Warden;isSilent()Z",
ordinal = 0
)
)
private boolean wilderWild$preventHeartBeatIfDead(boolean original) {
return original || Warden.class.cast(this).isDeadOrDying();
}
Expand Down Expand Up @@ -249,18 +283,18 @@ public void modifyDyingDimensions(Pose pose, CallbackInfoReturnable<EntityDimens
@Unique
private AnimationState wilderWild$getDeathAnimationForSituation() {
return this.wilderWild$isStella() ? this.wilderWild$getKirbyDeathAnimationState()
: (Warden.class.cast(this) instanceof SwimmingWardenInterface swim && swim.wilderWild$isSubmergedInWaterOrLava()) ? this.wilderWild$getSwimmingDyingAnimationState()
: this.wilderWild$getDyingAnimationState();
: (Warden.class.cast(this) instanceof SwimmingWardenInterface swim && swim.wilderWild$isSubmergedInWaterOrLava()
? this.wilderWild$getSwimmingDyingAnimationState() : this.wilderWild$getDyingAnimationState());
}

@Unique
private void wilderWild$addAdditionalDeathParticles() {
for (int i = 0; i < 20; ++i) {
double d = this.random.nextGaussian() * 0.02;
double e = this.random.nextGaussian() * 0.02;
double f = this.random.nextGaussian() * 0.02;
this.level().addParticle(ParticleTypes.SCULK_CHARGE_POP, this.getRandomX(1.0), this.getY(), this.getRandomZ(1.0), d, e, f);
this.level().addParticle(ParticleTypes.SCULK_SOUL, this.getRandomX(1.0), this.getY(), this.getRandomZ(1.0), d, e, f);
double d = this.random.nextGaussian() * 0.02D;
double e = this.random.nextGaussian() * 0.02D;
double f = this.random.nextGaussian() * 0.02D;
this.level().addParticle(ParticleTypes.SCULK_CHARGE_POP, this.getRandomX(1D), this.getY(), this.getRandomZ(1D), d, e, f);
this.level().addParticle(ParticleTypes.SCULK_SOUL, this.getRandomX(1D), this.getY(), this.getRandomZ(1D), d, e, f);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public boolean isVisuallySwimming() {
return this.wilderWild$newSwimming || super.isVisuallySwimming();
}

@Inject(at = @At("RETURN"), method = "createNavigation", cancellable = true)
@Inject(method = "createNavigation", at = @At("RETURN"), cancellable = true)
public void wilderWild$createNavigation(Level level, CallbackInfoReturnable<PathNavigation> info) {
info.setReturnValue(new WardenNavigation(Warden.class.cast(this), level));
}
Expand Down

0 comments on commit 03ce598

Please sign in to comment.