Skip to content

Commit

Permalink
fixed angler fish spawn
Browse files Browse the repository at this point in the history
  • Loading branch information
baguchi committed Nov 26, 2023
1 parent 92360e9 commit 44e7c21
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
import baguchan.better_with_aquatic.item.ModItems;
import net.minecraft.core.entity.Entity;
import net.minecraft.core.entity.player.EntityPlayer;
import net.minecraft.core.enums.LightLayer;
import net.minecraft.core.item.ItemStack;
import net.minecraft.core.util.helper.DamageType;
import net.minecraft.core.util.helper.MathHelper;
import net.minecraft.core.world.World;

public class EntityAnglerFish extends EntityBaseFish {
Expand Down Expand Up @@ -33,6 +35,24 @@ protected float getBlockPathWeight(int x, int y, int z) {
return 0.5f - this.world.getLightBrightness(x, y, z);
}

@Override
public boolean getCanSpawnHere() {
int k;
int j;
int i = MathHelper.floor_double(this.x);
if (this.world.getSavedLightValue(LightLayer.Block, i, j = MathHelper.floor_double(this.bb.minY), k = MathHelper.floor_double(this.z)) > 0) {
return false;
}
if (this.world.getSavedLightValue(LightLayer.Sky, i, j, k) > this.random.nextInt(32)) {
return false;
}
int blockLight = this.world.getBlockLightValue(i, j, k);
if (this.world.currentWeather != null && this.world.currentWeather.doMobsSpawnInDaylight) {
blockLight /= 2;
}
return blockLight <= 4 && super.getCanSpawnHere();
}

@Override
protected Entity findPlayerToAttack() {
EntityPlayer entityplayer = this.world.getClosestPlayerToEntity(this, 16.0);
Expand Down

0 comments on commit 44e7c21

Please sign in to comment.