I'm quite new at modding so bear with me here,
I'm trying to register my Entity using the DeferredRegister but I keep getting the error
"The type DeerEntity does not define DeerEntity(EntityType<T>, World) that is applicable here"
// RegistryHandler.java
public static final DeferredRegister<EntityType<?>> ENTITY_TYPES = DeferredRegister.create(ForgeRegistries.ENTITIES,
HuntingUpdate.MOD_ID);
public static final RegistryObject<EntityType<DeerEntity>> DEER = ENTITY_TYPES.register("deer",
() -> EntityType.Builder.create(DeerEntity::new, EntityClassification.CREATURE)
.size(1.0f, 1.0f)
.build(new ResourceLocation(HuntingUpdate.MOD_ID, "deer").toString()));
// DeerEntity.java
public class DeerEntity extends AnimalEntity {
public static final Ingredient TEMPTATION_ITEMS = Ingredient.fromItems(Items.APPLE, Items.CARROT,
Items.CARROT_ON_A_STICK, Items.BEETROOT);
private EatGrassGoal eatGrassGoal;
private int deerTimer;
protected DeerEntity(EntityType<? extends DeerEntity> type, World worldIn) {
super(type, worldIn);
// TODO Auto-generated constructor stub
}
public static AttributeModifierMap.MutableAttribute setCustomAttributes() {
return AnimalEntity.func_233666_p_().func_233815_a_(Attributes.field_233818_a_, 10.0D) // Max Health
.func_233815_a_(Attributes.field_233821_d_, 0.3D); // Movement Speed
}
@Override
protected void registerGoals() {
super.registerGoals();
this.goalSelector.addGoal(0, new SwimGoal(this));
this.goalSelector.addGoal(1, new PanicGoal(this, 1.5D));
this.goalSelector.addGoal(2, new BreedGoal(this, 1.0D));
this.goalSelector.addGoal(3, new TemptGoal(this, 0.5D, TEMPTATION_ITEMS, true));
this.goalSelector.addGoal(4, new FollowParentGoal(this, 1.1D));
this.goalSelector.addGoal(5, eatGrassGoal);
this.goalSelector.addGoal(6, new AvoidEntityGoal<>(this, PlayerEntity.class, 15.0F, 1.25D, 0.5D));
this.goalSelector.addGoal(7, new WaterAvoidingRandomWalkingGoal(this, 0.7D));
this.goalSelector.addGoal(8, new LookAtGoal(this, PlayerEntity.class, 10.0F));
this.goalSelector.addGoal(9, new LookRandomlyGoal(this));
}
@Override
public AgeableEntity func_241840_a(ServerWorld p_241840_1_, AgeableEntity p_241840_2_) {
return RegistryHandler.DEER.get().create(this.world);
}
@Override
protected int getExperiencePoints(PlayerEntity player) {
return 1 + this.world.rand.nextInt(4);
}
@Override
protected SoundEvent getAmbientSound() {
return SoundEvents.ENTITY_SQUID_AMBIENT;
}
@Override
protected SoundEvent getDeathSound() {
return SoundEvents.ENTITY_SQUID_DEATH;
}
@Override
protected SoundEvent getHurtSound(DamageSource damageSourceIn) {
return SoundEvents.ENTITY_SQUID_HURT;
}
@Override
protected void playStepSound(BlockPos pos, BlockState blockIn) {
this.playSound(SoundEvents.ENTITY_SQUID_SQUIRT, 0.15F, 1.0F);
}
@Override
protected void updateAITasks() {
this.deerTimer = this.eatGrassGoal.getEatingGrassTimer();
super.updateAITasks();
}
@Override
public void livingTick() {
if (this.world.isRemote) {
this.deerTimer = Math.max(0, this.deerTimer - 1);
}
super.livingTick();
}
@OnlyIn(Dist.CLIENT)
public void handleStatusUpdate(byte id) {
if (id == 10) {
this.deerTimer = 40;
} else {
super.handleStatusUpdate(id);
}
}
}
Any help would be greatly appreciated!