Advertisement
jayhillx

MysticEntities

Jul 25th, 2021
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. package com.jayhill.mysticsbiomes.init;
  2.  
  3. import com.jayhill.mysticsbiomes.MysticsBiomes;
  4. import com.jayhill.mysticsbiomes.client.StrawberryCowEntity;
  5. import com.jayhill.mysticsbiomes.client.render.StrawberryCowRenderer;
  6. import net.minecraft.entity.EntityClassification;
  7. import net.minecraft.entity.EntitySpawnPlacementRegistry;
  8. import net.minecraft.entity.EntityType;
  9. import net.minecraft.entity.ai.attributes.GlobalEntityTypeAttributes;
  10. import net.minecraft.entity.passive.AnimalEntity;
  11. import net.minecraft.util.ResourceLocation;
  12. import net.minecraft.world.gen.Heightmap;
  13. import net.minecraftforge.fml.RegistryObject;
  14. import net.minecraftforge.fml.client.registry.RenderingRegistry;
  15. import net.minecraftforge.fml.common.Mod;
  16. import net.minecraftforge.registries.DeferredRegister;
  17. import net.minecraftforge.registries.ForgeRegistries;
  18.  
  19. @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
  20. public class MysticEntities {
  21. public static final DeferredRegister<EntityType<?>> ENTITIES = DeferredRegister.create(ForgeRegistries.ENTITIES, MysticsBiomes.MOD_ID);
  22.  
  23. /** Strawberry Cow */
  24. public static final RegistryObject<EntityType<StrawberryCowEntity>> STRAWBERRY_COW = ENTITIES.register("strawberry_cow", () -> EntityType.Builder.create(StrawberryCowEntity::new, EntityClassification.CREATURE).size(0.9F, 1.4F).trackingRange(10).build(new ResourceLocation(MysticsBiomes.MOD_ID, "strawberry_cow").toString()));
  25.  
  26. public static void registerEntities() {
  27. GlobalEntityTypeAttributes.put(STRAWBERRY_COW.get(), StrawberryCowEntity.registerAttributes().create());
  28. }
  29.  
  30. public static void registerEntitySpawns() {
  31. EntitySpawnPlacementRegistry.register(STRAWBERRY_COW.get(), EntitySpawnPlacementRegistry.PlacementType.NO_RESTRICTIONS, Heightmap.Type.MOTION_BLOCKING_NO_LEAVES, AnimalEntity::canAnimalSpawn);
  32. }
  33.  
  34. public static void setupEntitiesClient() {
  35. RenderingRegistry.registerEntityRenderingHandler(STRAWBERRY_COW.get(), StrawberryCowRenderer::new);
  36. }
  37.  
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement