diff --git a/src/main/java/carpet/commands/SpawnCommand.java b/src/main/java/carpet/commands/SpawnCommand.java index 6b7e5ed8..28da5638 100644 --- a/src/main/java/carpet/commands/SpawnCommand.java +++ b/src/main/java/carpet/commands/SpawnCommand.java @@ -63,7 +63,7 @@ public class SpawnCommand executes( (c) -> recentSpawnsForType(c.getSource(), getString(c, "type"))))). then(literal("test"). executes( (c)-> runTest(c.getSource(), 72000, null)). - then(argument("ticks", integer(10,720000)). + then(argument("ticks", integer(10)). executes( (c)-> runTest( c.getSource(), getInteger(c, "ticks"), diff --git a/src/main/java/carpet/mixins/LivingEntityMixin.java b/src/main/java/carpet/mixins/LivingEntityMixin.java new file mode 100644 index 00000000..22e6c578 --- /dev/null +++ b/src/main/java/carpet/mixins/LivingEntityMixin.java @@ -0,0 +1,27 @@ +package carpet.mixins; + +import carpet.CarpetSettings; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.LivingEntity; +import net.minecraft.world.GameRules; +import net.minecraft.world.World; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +@Mixin(LivingEntity.class) +public abstract class LivingEntityMixin extends Entity +{ + + public LivingEntityMixin(EntityType type, World world) + { + super(type, world); + } + + @Redirect(method = "onDeath", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;hasCustomName()Z")) + private boolean shouldLogDeaths(LivingEntity livingEntity) + { + return livingEntity.hasCustomName() && CarpetSettings.cleanLogs && world.getGameRules().getBoolean(GameRules.SHOW_DEATH_MESSAGES); + } +} diff --git a/src/main/resources/carpet.mixins.json b/src/main/resources/carpet.mixins.json index ac67391f..adbfc7bb 100644 --- a/src/main/resources/carpet.mixins.json +++ b/src/main/resources/carpet.mixins.json @@ -59,6 +59,8 @@ "ChunkTicketManager_spawnChunksMixin", "ServerWorld_spawnChunksMixin", + "LivingEntityMixin", + "MobEntityMixin", "EntityTrackerEntry_leashFixMixin",