Skip to content

Commit

Permalink
close #4286
Browse files Browse the repository at this point in the history
  • Loading branch information
yrsegal committed Aug 1, 2023
1 parent 2cb37fc commit 2d44fec
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,15 @@ private void spawnMobs() {
EntityType<?> entitytype = egg.getType(stack.getTag());
e = entitytype.spawn(serverLevel, stack, null, pos, MobSpawnType.SPAWNER, true, true);

double motionMultiplier = 0.4;
e.setPos(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
double mx = (level.random.nextFloat() - 0.5) * motionMultiplier;
double my = (level.random.nextFloat() - 0.5) * motionMultiplier;
double mz = (level.random.nextFloat() - 0.5) * motionMultiplier;
e.setDeltaMovement(mx, my, mz);
e.getPersistentData().putBoolean(MonsterBoxModule.TAG_MONSTER_BOX_SPAWNED, true);
if (e != null) {
double motionMultiplier = 0.4;
e.setPos(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
double mx = (level.random.nextFloat() - 0.5) * motionMultiplier;
double my = (level.random.nextFloat() - 0.5) * motionMultiplier;
double mz = (level.random.nextFloat() - 0.5) * motionMultiplier;
e.setDeltaMovement(mx, my, mz);
e.getPersistentData().putBoolean(MonsterBoxModule.TAG_MONSTER_BOX_SPAWNED, true);
}
}
});
}
Expand Down

0 comments on commit 2d44fec

Please sign in to comment.