Skip to content

Commit

Permalink
Merge pull request #596 from MCTian-mi/skeleton-trap
Browse files Browse the repository at this point in the history
Add config to stop skeleton traps from spawning during thunderstorms
  • Loading branch information
ACGaming authored Dec 2, 2024
2 parents adaf849 + c4a8708 commit c6b2d21
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -916,6 +916,11 @@ public static class UndeadHorsesCategory
@Config.Name("Taming Undead Horses")
@Config.Comment("Allows taming of undead horses")
public boolean utTamingUndeadHorsesToggle = true;

@Config.RequiresMcRestart
@Config.Name("No Skeleton Trap Spawning")
@Config.Comment("Prevents skeleton traps spawning during thunderstorms")
public boolean utSkeletonTrapSpawningToggle = false;
}

public static class WaterFallDamageCategory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +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.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);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package mod.acgaming.universaltweaks.tweaks.entities.spawning.skeletontrap.mixin;

import net.minecraft.entity.Entity;
import net.minecraft.world.WorldServer;

import mod.acgaming.universaltweaks.config.UTConfigTweaks;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

@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)
{
return !UTConfigTweaks.ENTITIES.UNDEAD_HORSES.utSkeletonTrapSpawningToggle && worldIn.spawnEntity(entityIn);
}
}
7 changes: 7 additions & 0 deletions src/main/resources/mixins.tweaks.entities.skeletontrap.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"package": "mod.acgaming.universaltweaks.tweaks.entities.spawning.skeletontrap.mixin",
"refmap": "universaltweaks.refmap.json",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"mixins": ["UTSkeletonTrapSpawningMixin"]
}

0 comments on commit c6b2d21

Please sign in to comment.