Advertisement
jayhillx

ModEntities-1.16.4

Dec 31st, 2020
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
  2. public class ModEntities {
  3. public static final DeferredRegister<EntityType<?>> ENTITIES = DeferredRegister.create(ForgeRegistries.ENTITIES, MysticsBiomes.MOD_ID);
  4.  
  5. //Entities
  6. public static final RegistryObject<EntityType<StrawberryCowEntity>> STRAWBERRY_COW = ENTITIES.register("strawberry_cow",
  7. () -> EntityType.Builder.create(StrawberryCowEntity::new, EntityClassification.CREATURE).size(0.9F, 1.4F).build(new ResourceLocation(MysticsBiomes.MOD_ID, "strawberry_cow").toString()));
  8.  
  9. //Register Entities Here
  10. public static void registerEntity() {
  11. GlobalEntityTypeAttributes.put(STRAWBERRY_COW.get(), StrawberryCowEntity.createMutableAttribute().create());
  12. }
  13.  
  14. public static void setupEntitySpawns(Biome biome) {
  15. if (biome == ModBiomes.STRAWBERRY_FIELDS.get()) {
  16. addEntitySpawn(biome, EntityClassification.CREATURE, new MobSpawnInfo.Spawners(ModEntities.STRAWBERRY_COW.get(), 12, 2, 4));
  17. }
  18. }
  19.  
  20. private static void addEntitySpawn(Biome biome, EntityClassification entityclassification, MobSpawnInfo.Spawners spawners) {
  21. biome.getMobSpawnInfo().getSpawners(entityclassification).add(spawners);
  22. }
  23.  
  24. @OnlyIn(Dist.CLIENT)
  25. public static void setupEntitiesClient() {
  26. RenderingRegistry.registerEntityRenderingHandler((EntityType<? extends StrawberryCowEntity>)STRAWBERRY_COW.get(), StrawberryCowRenderer::new);
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement