Advertisement
Vaerys_Dawn

Entity Mutation

Jan 25th, 2021
980
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.13 KB | None | 0 0
  1.  public void applyPollinationEffect() {
  2.         if (getBeeData().getMutationData().hasMutation()) {
  3.             AxisAlignedBB box = this.getMutationBoundingBox();
  4.             List<Entity> entityList = this.world.getEntitiesInAABBexcluding(this, box, (entity) ->
  5.                     getBeeData().getMutationData().iEntityMutations.get(entity.getType()) != null);
  6.  
  7.             if (!entityList.isEmpty()) {
  8.                 MutationData.IEntityMutation mutation = getBeeData().getMutationData().iEntityMutations.get(entityList.get(0).getType());
  9.                 Pair<EntityType, MutationData.MutationOutputData> output = mutation.outputs.next();
  10.                 float nextFloat = world.rand.nextFloat();
  11.                 if (output.getRight().chance >= nextFloat) {
  12.                     output.getKey().spawn((ServerWorld) world, output.getRight().nbt, null, null, entityList.get(0).getBlockPos(), SpawnReason.NATURAL, false, false);
  13.                     entityList.get(0).remove();
  14.                     world.playEvent(2005, this.getBlockPos().down(1), 0);
  15.                 }
  16.                 addCropCounter();
  17.                 return;
  18.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement