Unicopia/src/main/java/com/minelittlepony/unicopia/UEntities.java

41 lines
2.1 KiB
Java
Raw Normal View History

package com.minelittlepony.unicopia;
2021-08-19 19:52:35 +02:00
import com.minelittlepony.unicopia.entity.ButterflyEntity;
import com.minelittlepony.unicopia.entity.CastSpellEntity;
import com.minelittlepony.unicopia.entity.FloatingArtefactEntity;
import com.minelittlepony.unicopia.projectile.MagicProjectileEntity;
2021-08-19 19:52:35 +02:00
import net.fabricmc.fabric.api.object.builder.v1.entity.FabricDefaultAttributeRegistry;
import net.fabricmc.fabric.api.object.builder.v1.entity.FabricEntityTypeBuilder;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityDimensions;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.SpawnGroup;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
public interface UEntities {
2021-08-19 19:52:35 +02:00
EntityType<ButterflyEntity> BUTTERFLY = register("butterfly", FabricEntityTypeBuilder.create(SpawnGroup.AMBIENT, ButterflyEntity::new)
.dimensions(EntityDimensions.fixed(0.25F, 0.25F)));
EntityType<MagicProjectileEntity> THROWN_ITEM = register("thrown_item", FabricEntityTypeBuilder.<MagicProjectileEntity>create(SpawnGroup.MISC, MagicProjectileEntity::new)
2020-12-17 19:17:47 +01:00
.trackRangeBlocks(100)
.trackedUpdateRate(2)
.dimensions(EntityDimensions.fixed(0.25F, 0.25F)));
EntityType<FloatingArtefactEntity> FLOATING_ARTEFACT = register("floating_artefact", FabricEntityTypeBuilder.create(SpawnGroup.MISC, FloatingArtefactEntity::new)
.trackRangeBlocks(200)
.dimensions(EntityDimensions.fixed(1, 1)));
EntityType<CastSpellEntity> CAST_SPELL = register("cast_spell", FabricEntityTypeBuilder.create(SpawnGroup.MISC, CastSpellEntity::new)
.trackRangeBlocks(200)
.dimensions(EntityDimensions.fixed(1, 1)));
static <T extends Entity> EntityType<T> register(String name, FabricEntityTypeBuilder<T> builder) {
EntityType<T> type = builder.build();
return Registry.register(Registry.ENTITY_TYPE, new Identifier("unicopia", name), type);
}
2021-08-19 19:52:35 +02:00
static void bootstrap() {
FabricDefaultAttributeRegistry.register(BUTTERFLY, ButterflyEntity.createButterflyAttributes());
}
}