Skip to content

Commit

Permalink
Fixed Undead Army boss crash
Browse files Browse the repository at this point in the history
  • Loading branch information
Majrusz committed Jun 3, 2023
1 parent a06f93c commit 05ef4a1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down Expand Up @@ -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 ) );
Expand Down
Original file line number Diff line number Diff line change
@@ -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 );
Expand Down

0 comments on commit 05ef4a1

Please sign in to comment.