New mob spawning API
This commit is contained in:
parent
a55cbe67de
commit
acec6a2213
11 changed files with 40 additions and 128 deletions
|
@ -1,6 +1,5 @@
|
|||
package ru.betterend.entity;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.particles.ParticleTypes;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.syncher.EntityDataAccessor;
|
||||
|
@ -22,14 +21,10 @@ import net.minecraft.world.item.ItemStack;
|
|||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.ServerLevelAccessor;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import ru.bclib.api.BiomeAPI;
|
||||
import ru.betterend.registry.EndBiomes;
|
||||
import ru.betterend.registry.EndItems;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class EndFishEntity extends AbstractSchoolingFish {
|
||||
public static final int VARIANTS_NORMAL = 5;
|
||||
public static final int VARIANTS_SULPHUR = 3;
|
||||
|
@ -152,14 +147,6 @@ public class EndFishEntity extends AbstractSchoolingFish {
|
|||
return getByteScale() / 32F + 0.75F;
|
||||
}
|
||||
|
||||
public static boolean canSpawn(EntityType<EndFishEntity> type, ServerLevelAccessor world, MobSpawnType spawnReason, BlockPos pos, Random random) {
|
||||
AABB box = new AABB(pos).inflate(16);
|
||||
List<EndFishEntity> list = world.getEntitiesOfClass(EndFishEntity.class, box, (entity) -> {
|
||||
return true;
|
||||
});
|
||||
return list.size() < 9;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dropFromLootTable(DamageSource source, boolean causedByPlayer) {
|
||||
ItemEntity drop = new ItemEntity(level, getX(), getY(), getZ(), new ItemStack(EndItems.END_FISH_RAW));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue