From 53a843ae054d5388a6f27aadff3513c58c2653b9 Mon Sep 17 00:00:00 2001 From: ACGaming <4818419+ACGaming@users.noreply.github.com> Date: Mon, 2 Dec 2024 11:29:01 +0100 Subject: [PATCH] Skeleton trap tweak follow-up --- README.md | 1 + .../acgaming/universaltweaks/core/UTLoadingPlugin.java | 2 +- .../mixin/UTSkeletonTrapSpawningMixin.java | 10 +++++----- ... mixins.tweaks.entities.spawning.skeletontrap.json} | 0 4 files changed, 7 insertions(+), 6 deletions(-) rename src/main/resources/{mixins.tweaks.entities.skeletontrap.json => mixins.tweaks.entities.spawning.skeletontrap.json} (100%) diff --git a/README.md b/README.md index 89220e5c..db93a115 100644 --- a/README.md +++ b/README.md @@ -216,6 +216,7 @@ All changes are toggleable via config files. * **No Portal Spawning:** Prevents zombie pigmen spawning from nether portals * **No Redstone Lighting:** Disables lighting of active redstone, repeaters, and comparators to improve performance * **No Saddled Wandering:** Stops horses wandering around when saddled +* **No Skeleton Trap Spawning:** Prevents skeleton traps spawning during thunderstorms * **No Smelting XP:** Disables the experience reward when smelting items in furnaces * **Offhand Improvement:** Prevents placing offhand blocks when blocks or food are held in the mainhand * **Overhaul Beacon:** Change how beacon construct and range apply per level diff --git a/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java b/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java index 085f87e9..8282deb7 100644 --- a/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java +++ b/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java @@ -122,7 +122,7 @@ public class UTLoadingPlugin implements IFMLLoadingPlugin, IEarlyMixinLoader put("mixins.tweaks.entities.speed.cobweb.json", () -> UTConfigTweaks.ENTITIES.COBWEB_SLOWNESS.utCobwebSlownessToggle); put("mixins.tweaks.entities.speed.player.json", () -> UTConfigTweaks.ENTITIES.PLAYER_SPEED.utPlayerSpeedToggle); put("mixins.tweaks.entities.taming.horse.json", () -> UTConfigTweaks.ENTITIES.UNDEAD_HORSES.utTamingUndeadHorsesToggle); - put("mixins.tweaks.entities.skeletontrap.json", () -> UTConfigTweaks.ENTITIES.UNDEAD_HORSES.utSkeletonTrapSpawningToggle); + put("mixins.tweaks.entities.spawning.skeletontrap.json", () -> UTConfigTweaks.ENTITIES.UNDEAD_HORSES.utSkeletonTrapSpawningToggle); put("mixins.tweaks.entities.trading.json", () -> UTConfigTweaks.ENTITIES.utVillagerTradeLevelingToggle || UTConfigTweaks.ENTITIES.utVillagerTradeRestockToggle); put("mixins.tweaks.entities.voidteleport.json", () -> UTConfigTweaks.ENTITIES.VOID_TELEPORT.utVoidTeleportToggle); put("mixins.tweaks.items.attackcooldown.server.json", () -> UTConfigTweaks.ITEMS.ATTACK_COOLDOWN.utAttackCooldownToggle); diff --git a/src/main/java/mod/acgaming/universaltweaks/tweaks/entities/spawning/skeletontrap/mixin/UTSkeletonTrapSpawningMixin.java b/src/main/java/mod/acgaming/universaltweaks/tweaks/entities/spawning/skeletontrap/mixin/UTSkeletonTrapSpawningMixin.java index 2b5aa276..c9c15d1b 100644 --- a/src/main/java/mod/acgaming/universaltweaks/tweaks/entities/spawning/skeletontrap/mixin/UTSkeletonTrapSpawningMixin.java +++ b/src/main/java/mod/acgaming/universaltweaks/tweaks/entities/spawning/skeletontrap/mixin/UTSkeletonTrapSpawningMixin.java @@ -1,6 +1,6 @@ package mod.acgaming.universaltweaks.tweaks.entities.spawning.skeletontrap.mixin; -import net.minecraft.entity.Entity; +import net.minecraft.world.GameRules; import net.minecraft.world.WorldServer; import mod.acgaming.universaltweaks.config.UTConfigTweaks; @@ -11,9 +11,9 @@ @Mixin(WorldServer.class) public class UTSkeletonTrapSpawningMixin { - @Redirect(method = "updateBlocks()V", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/WorldServer;spawnEntity(Lnet/minecraft/entity/Entity;)Z")) - private boolean utSkeletonTrapSpawning(WorldServer worldIn, Entity entityIn) + @Redirect(method = "updateBlocks()V", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/GameRules;getBoolean(Ljava/lang/String;)Z")) + private boolean utSkeletonTrapSpawning(GameRules rules, String name) { - return !UTConfigTweaks.ENTITIES.UNDEAD_HORSES.utSkeletonTrapSpawningToggle && worldIn.spawnEntity(entityIn); + return !UTConfigTweaks.ENTITIES.UNDEAD_HORSES.utSkeletonTrapSpawningToggle && rules.getBoolean(name); } -} +} \ No newline at end of file diff --git a/src/main/resources/mixins.tweaks.entities.skeletontrap.json b/src/main/resources/mixins.tweaks.entities.spawning.skeletontrap.json similarity index 100% rename from src/main/resources/mixins.tweaks.entities.skeletontrap.json rename to src/main/resources/mixins.tweaks.entities.spawning.skeletontrap.json