diff --git a/src/main/java/com/majruszsdifficulty/undeadarmy/components/MobSpawner.java b/src/main/java/com/majruszsdifficulty/undeadarmy/components/MobSpawner.java index 766deee77..11d715bee 100644 --- a/src/main/java/com/majruszsdifficulty/undeadarmy/components/MobSpawner.java +++ b/src/main/java/com/majruszsdifficulty/undeadarmy/components/MobSpawner.java @@ -67,7 +67,7 @@ private void spawnMob( MobInfo mobInfo ) { mobInfo.uuid = mob.getUUID(); this.updateWaveHealth( mobInfo ); - this.loadEquipment( mob, mobInfo ); + this.tryToLoadEquipment( mob, mobInfo ); this.addGoals( mob ); this.makePersistent( mob ); ExtraLootInfo.addExtraLootTag( mob ); @@ -118,7 +118,11 @@ private Vec3 buildOffset() { return AnyPos.from( direction.x * spawnRadius, 0, direction.z * spawnRadius ).add( Random.getRandomVector( -x, x, -y, y, -z, z ) ).vec3(); } - private void loadEquipment( PathfinderMob mob, MobInfo mobInfo ) { + private void tryToLoadEquipment( PathfinderMob mob, MobInfo mobInfo ) { + if( mobInfo.equipment == null ) { + return; + } + LootHelper.getLootTable( mobInfo.equipment ) .getRandomItems( LootHelper.toGiftContext( mob ) ) .forEach( itemStack->ItemHelper.equip( mob, itemStack ) ); diff --git a/src/main/java/com/majruszsdifficulty/undeadarmy/data/MobDef.java b/src/main/java/com/majruszsdifficulty/undeadarmy/data/MobDef.java index 600da46c8..bd9c97b67 100644 --- a/src/main/java/com/majruszsdifficulty/undeadarmy/data/MobDef.java +++ b/src/main/java/com/majruszsdifficulty/undeadarmy/data/MobDef.java @@ -1,15 +1,13 @@ package com.majruszsdifficulty.undeadarmy.data; - import com.mlib.data.SerializableStructure; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.level.storage.loot.LootTable; public class MobDef extends SerializableStructure { public EntityType< ? > type; public int count = 1; - public ResourceLocation equipment = LootTable.EMPTY.getLootTableId(); + public ResourceLocation equipment; public MobDef() { this.define( "type", ()->this.type, x->this.type = x );