mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-01 03:26:44 +01:00
Fix butterflies spawning in the middle of nowhere
This commit is contained in:
parent
fd03dabdd6
commit
f0c5cdb156
2 changed files with 6 additions and 1 deletions
|
@ -72,6 +72,10 @@ public class ButterflyEntity extends AmbientEntity {
|
|||
return createMobAttributes().add(EntityAttributes.GENERIC_MAX_HEALTH, 2);
|
||||
}
|
||||
|
||||
public static boolean canSpawn(EntityType<? extends ButterflyEntity> type, WorldAccess world, SpawnReason spawnReason, BlockPos pos, Random random) {
|
||||
return world.getBlockState(pos.down()).isIn(BlockTags.ANIMALS_SPAWNABLE_ON);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getSoundPitch() {
|
||||
return super.getSoundPitch() * 0.95F;
|
||||
|
|
|
@ -25,7 +25,8 @@ import net.minecraft.registry.tag.BiomeTags;
|
|||
import net.minecraft.world.Heightmap.Type;
|
||||
|
||||
public interface UEntities {
|
||||
EntityType<ButterflyEntity> BUTTERFLY = register("butterfly", FabricEntityTypeBuilder.create(SpawnGroup.AMBIENT, ButterflyEntity::new)
|
||||
EntityType<ButterflyEntity> BUTTERFLY = register("butterfly", FabricEntityTypeBuilder.createMob().spawnGroup(SpawnGroup.AMBIENT).entityFactory(ButterflyEntity::new)
|
||||
.spawnRestriction(Location.NO_RESTRICTIONS, Type.WORLD_SURFACE_WG, ButterflyEntity::canSpawn)
|
||||
.dimensions(EntityDimensions.fixed(0.25F, 0.25F)));
|
||||
EntityType<MagicProjectileEntity> THROWN_ITEM = register("thrown_item", FabricEntityTypeBuilder.<MagicProjectileEntity>create(SpawnGroup.MISC, MagicProjectileEntity::new)
|
||||
.trackRangeBlocks(100)
|
||||
|
|
Loading…
Reference in a new issue