Jump to content

[1.16.4] RenderRegistry#registerEntityRenderingHandler not working


Recommended Posts

Hello, I tried making an entity last night. I spent around 2 hours trying to figure out why I was getting an incompatible types error. And I couldn't figure it out.

I tried copying some code snippets off the forums that I found, but even that didn't work, and I'm left here confused.


I want to mention I read a fair bit of the docs (I skipped the parts that I don't need yet, like tile entities and what not). I also started learning forge yesterday, so please bare with me. Thanks in advance.


My Entities Class

package com.turtles.entities;

import com.turtles.Turtles;
import com.turtles.entities.render.CobblestoneTurtleRenderer;
import net.minecraft.entity.EntityClassification;
import net.minecraft.entity.EntityType;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;

public class TEntities {

    public static final DeferredRegister<EntityType<?>> ENTETIES = DeferredRegister.create(ForgeRegistries.ENTITIES, Turtles.MODID);

    public static final RegistryObject<EntityType<CobblestoneTurtleEntity>> COBBLESTONE_TURTLE = ENTETIES.register(
            "cobblestone_turtle", () -> EntityType.Builder.create(CobblestoneTurtleEntity::new, EntityClassification.CREATURE).size(
                    1.2F, 0.4F).build(new ResourceLocation(Turtles.MODID, "cobblestone_turtle").toString()));

    public static void register(){

    public static void registerRender(){
        RenderingRegistry.registerEntityRenderingHandler(COBBLESTONE_TURTLE.get(), CobblestoneTurtleRenderer::new);



Renderer class

package com.turtles.entities.render;

import com.turtles.Turtles;
import com.turtles.entities.CobblestoneTurtleEntity;
import com.turtles.entities.model.TTurtleModel;
import net.minecraft.client.renderer.entity.EntityRendererManager;
import net.minecraft.client.renderer.entity.MobRenderer;
import net.minecraft.util.ResourceLocation;

public class CobblestoneTurtleRenderer extends MobRenderer<CobblestoneTurtleEntity, TTurtleModel<CobblestoneTurtleEntity>> {

    private static final ResourceLocation TEXTURE = new ResourceLocation(Turtles.MODID, "textures/entities/cobblestone_turtle.png");

    public CobblestoneTurtleRenderer(EntityRendererManager renderManagerIn, float shadowSizeIn) {
        super(renderManagerIn, new TTurtleModel<>(0.0f), shadowSizeIn);

    public ResourceLocation getEntityTexture(CobblestoneTurtleEntity entity) {
        return TEXTURE;



Model class WIP (Copied the turtle model and I haven't updated it)

package com.turtles.entities.model;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.vertex.IVertexBuilder;
import com.turtles.entities.TTurtleEntity;
import net.minecraft.client.renderer.entity.model.QuadrupedModel;
import net.minecraft.client.renderer.model.ModelRenderer;
import net.minecraft.util.math.MathHelper;

public class TTurtleModel <T extends TTurtleEntity> extends QuadrupedModel<T> {

    private final ModelRenderer pregnant;

    public TTurtleModel(float p_i48834_1_) {
        super(12, p_i48834_1_, true, 120.0F, 0.0F, 9.0F, 6.0F, 120);
        this.textureWidth = 128;
        this.textureHeight = 64;
        this.headModel = new ModelRenderer(this, 3, 0);
        this.headModel.addBox(-3.0F, -1.0F, -3.0F, 6.0F, 5.0F, 6.0F, 0.0F);
        this.headModel.setRotationPoint(0.0F, 19.0F, -10.0F);
        this.body = new ModelRenderer(this);
        this.body.setTextureOffset(7, 37).addBox(-9.5F, 3.0F, -10.0F, 19.0F, 20.0F, 6.0F, 0.0F);
        this.body.setTextureOffset(31, 1).addBox(-5.5F, 3.0F, -13.0F, 11.0F, 18.0F, 3.0F, 0.0F);
        this.body.setRotationPoint(0.0F, 11.0F, -10.0F);
        this.pregnant = new ModelRenderer(this);
        this.pregnant.setTextureOffset(70, 33).addBox(-4.5F, 3.0F, -14.0F, 9.0F, 18.0F, 1.0F, 0.0F);
        this.pregnant.setRotationPoint(0.0F, 11.0F, -10.0F);
        int i = 1;
        this.legBackRight = new ModelRenderer(this, 1, 23);
        this.legBackRight.addBox(-2.0F, 0.0F, 0.0F, 4.0F, 1.0F, 10.0F, 0.0F);
        this.legBackRight.setRotationPoint(-3.5F, 22.0F, 11.0F);
        this.legBackLeft = new ModelRenderer(this, 1, 12);
        this.legBackLeft.addBox(-2.0F, 0.0F, 0.0F, 4.0F, 1.0F, 10.0F, 0.0F);
        this.legBackLeft.setRotationPoint(3.5F, 22.0F, 11.0F);
        this.legFrontRight = new ModelRenderer(this, 27, 30);
        this.legFrontRight.addBox(-13.0F, 0.0F, -2.0F, 13.0F, 1.0F, 5.0F, 0.0F);
        this.legFrontRight.setRotationPoint(-5.0F, 21.0F, -4.0F);
        this.legFrontLeft = new ModelRenderer(this, 27, 24);
        this.legFrontLeft.addBox(0.0F, 0.0F, -2.0F, 13.0F, 1.0F, 5.0F, 0.0F);
        this.legFrontLeft.setRotationPoint(5.0F, 21.0F, -4.0F);

    protected Iterable<ModelRenderer> getBodyParts() {
        return Iterables.concat(super.getBodyParts(), ImmutableList.of(this.pregnant));

     * Sets this entity's model rotation angles
    public void setRotationAngles(T entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) {
        super.setRotationAngles(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch);
        this.legBackRight.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F * 0.6F) * 0.5F * limbSwingAmount;
        this.legBackLeft.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F * 0.6F + (float)Math.PI) * 0.5F * limbSwingAmount;
        this.legFrontRight.rotateAngleZ = MathHelper.cos(limbSwing * 0.6662F * 0.6F + (float)Math.PI) * 0.5F * limbSwingAmount;
        this.legFrontLeft.rotateAngleZ = MathHelper.cos(limbSwing * 0.6662F * 0.6F) * 0.5F * limbSwingAmount;
        this.legFrontRight.rotateAngleX = 0.0F;
        this.legFrontLeft.rotateAngleX = 0.0F;
        this.legFrontRight.rotateAngleY = 0.0F;
        this.legFrontLeft.rotateAngleY = 0.0F;
        this.legBackRight.rotateAngleY = 0.0F;
        this.legBackLeft.rotateAngleY = 0.0F;
        this.pregnant.rotateAngleX = ((float)Math.PI / 2F);

        this.pregnant.showModel = !this.isChild;

    public void render(MatrixStack matrixStackIn, IVertexBuilder bufferIn, int packedLightIn, int packedOverlayIn, float red, float green, float blue, float alpha) {
        boolean flag = this.pregnant.showModel;
        if (flag) {
            matrixStackIn.translate(0.0D, (double)-0.08F, 0.0D);

        super.render(matrixStackIn, bufferIn, packedLightIn, packedOverlayIn, red, green, blue, alpha);
        if (flag) {




Base Entity Class

package com.turtles.entities;

import net.minecraft.entity.AgeableEntity;
import net.minecraft.entity.CreatureEntity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.ai.attributes.Attributes;
import net.minecraft.entity.ai.goal.*;
import net.minecraft.entity.passive.AnimalEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;

import javax.annotation.Nullable;

public class TTurtleEntity extends AnimalEntity {

    protected TTurtleEntity(EntityType<? extends AnimalEntity> type, World worldIn) {
        super(type, worldIn);

    protected void registerGoals() {
        this.goalSelector.addGoal(0, new SwimGoal(this));
        this.goalSelector.addGoal(1, new PanicGoal(this, 1.25d));
        this.goalSelector.addGoal(2, new LookAtGoal(this, PlayerEntity.class, 6.0f));
        this.goalSelector.addGoal(3, new WaterAvoidingRandomWalkingGoal(this, 1.0d));
        this.goalSelector.addGoal(4, new LookRandomlyGoal(this));

    public AgeableEntity func_241840_a(ServerWorld p_241840_1_, AgeableEntity p_241840_2_) {
        return null;


Cobblestone Turtle Class

package com.turtles.entities;

import net.minecraft.entity.EntityType;
import net.minecraft.entity.passive.AnimalEntity;
import net.minecraft.world.World;

public class CobblestoneTurtleEntity extends TTurtleEntity {

    protected CobblestoneTurtleEntity(EntityType<? extends AnimalEntity> type, World worldIn) {
        super(type, worldIn);



Main class

package com.turtles;

import com.turtles.blocks.TBlocks;
import com.turtles.entities.TEntities;
import com.turtles.entities.render.CobblestoneTurtleRenderer;
import com.turtles.items.TItems;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.InterModComms;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent;
import net.minecraftforge.fml.event.lifecycle.InterModProcessEvent;
import net.minecraftforge.fml.event.server.FMLServerStartingEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.util.stream.Collectors;

public class Turtles {

    private static final Logger LOGGER = LogManager.getLogger();

    public static final String MODID = "turtles";

    public Turtles() {



    private void setup(final FMLCommonSetupEvent event) {
        LOGGER.info("Pre initializing");

    private void doClientStuff(final FMLClientSetupEvent event) {


    private void enqueueIMC(final InterModEnqueueEvent event) {
        InterModComms.sendTo("turtles", "helloworld", () -> { LOGGER.info("Hello world from the MDK"); return "Hello world";});

    private void processIMC(final InterModProcessEvent event) {
        LOGGER.info("Got IMC {}", event.getIMCStream().

    public void onServerStarting(FMLServerStartingEvent event) {




Link to comment
Share on other sites

Oh my bad, I thought I did. I get a syntax error here. From what I've seen this is the right way to do it. So Im not sure what Im doing wrong.


    public static void registerRender(){
        RenderingRegistry.registerEntityRenderingHandler(COBBLESTONE_TURTLE.get(), CobblestoneTurtleRenderer::new);
Edited by Mahdi1224
Link to comment
Share on other sites

I do know Java to a certain extent. I wouldn't call my self an expert but Im not a beginner. I realize it doesn't accept the variable Im assigning it. I just don't know why. Im pretty certain I have written everything correctly, especially since I've confirmed this by looking at other people's examples. I tried changing some stuff up to match the required variable but It still wouldn't work. Also if the solution is an easy one that Im missing, I apologize. I have a habit of missing small details sometimes



Link to comment
Share on other sites

44 minutes ago, Mahdi1224 said:

You know what. Ima just figure it out myself, you seem to not wanna help me anyways, instead telling me to do it myself. Thanks for the help.

the constructor of your Renderer contains two elemetnts a EntityRendererManager and a float

the IRenderFactory needs only the EntityRendererManager

In addition, the Factory cannot do anything with the float and gives you the error

that's exactly what @diesieben07 meant by

57 minutes ago, diesieben07 said:

Look at the two and understand how method references work.


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Hey. I created shield mod like kaupenjoe did on his course but blocking animation doesn't work. Forge 1.20.1. Here's some information: Mod structure image and code: https://ibb.co/z5Y1G26 https://www.online-java.com/crhUHmPoJt
    • i was playing forge modded singleplayer server then i added optifine to mods but it crashed with optifine is there anything to do without deleting optifine  crash report: https://paste.ee/p/Z13LO
    • package com.projectmushroom.lavapotions.item; import java.util.List;   import com.projectmushroom.lavapotions.LavaPotions;   import net.minecraft.core.BlockPos; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.stats.Stats; import net.minecraft.tags.FluidTags; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResultHolder; import net.minecraft.world.entity.AreaEffectCloud; import net.minecraft.world.entity.boss.enderdragon.EnderDragon; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemUtils; import net.minecraft.world.item.Items; import net.minecraft.world.item.alchemy.PotionUtils; import net.minecraft.world.item.alchemy.Potions; import net.minecraft.world.level.ClipContext; import net.minecraft.world.level.Level; import net.minecraft.world.level.gameevent.GameEvent; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.HitResult;   public class ReinforcedBottle extends Item { public ReinforcedBottle(Item.Properties p_40648_) { super(p_40648_); }   public InteractionResultHolder<ItemStack> use(Level p_40656_, Player p_40657_, InteractionHand p_40658_) { List<AreaEffectCloud> list = p_40656_.getEntitiesOfClass(AreaEffectCloud.class, p_40657_.getBoundingBox().inflate(2.0D), (p_40650_) -> { return p_40650_ != null && p_40650_.isAlive() && p_40650_.getOwner() instanceof EnderDragon; }); ItemStack itemstack = p_40657_.getItemInHand(p_40658_); if (!list.isEmpty()) { AreaEffectCloud areaeffectcloud = list.get(0); areaeffectcloud.setRadius(areaeffectcloud.getRadius() - 0.5F); p_40656_.playSound((Player)null, p_40657_.getX(), p_40657_.getY(), p_40657_.getZ(), SoundEvents.BOTTLE_FILL_DRAGONBREATH, SoundSource.NEUTRAL, 1.0F, 1.0F); p_40656_.gameEvent(p_40657_, GameEvent.FLUID_PICKUP, p_40657_.blockPosition()); return InteractionResultHolder.sidedSuccess(this.turnBottleIntoItem(itemstack, p_40657_, new ItemStack(Items.DRAGON_BREATH)), p_40656_.isClientSide()); } else { HitResult hitresult = getPlayerPOVHitResult(p_40656_, p_40657_, ClipContext.Fluid.SOURCE_ONLY); if (hitresult.getType() == HitResult.Type.MISS) { return InteractionResultHolder.pass(itemstack); } else { if (hitresult.getType() == HitResult.Type.BLOCK) { BlockPos blockpos = ((BlockHitResult)hitresult).getBlockPos(); if (!p_40656_.mayInteract(p_40657_, blockpos)) { return InteractionResultHolder.pass(itemstack); }   if (p_40656_.getFluidState(blockpos).is(FluidTags.LAVA)) { p_40656_.playSound(p_40657_, p_40657_.getX(), p_40657_.getY(), p_40657_.getZ(), SoundEvents.BOTTLE_FILL, SoundSource.NEUTRAL, 1.0F, 1.0F); p_40656_.gameEvent(p_40657_, GameEvent.FLUID_PICKUP, blockpos); return InteractionResultHolder.sidedSuccess(this.turnBottleIntoItem(itemstack, p_40657_,(new ItemStack(LavaPotions.REINFORCED_BOTTLE), .LAVA)), p_40656_.isClientSide()); } } return InteractionResultHolder.pass(itemstack); } } }   protected ItemStack turnBottleIntoItem(ItemStack p_40652_, Player p_40653_, ItemStack p_40654_) { p_40653_.awardStat(Stats.ITEM_USED.get(this)); return ItemUtils.createFilledResult(p_40652_, p_40653_, p_40654_); } }   This is what I have so far, it's pretty much just the waterbottle code but I'm just trying to figure out how to get it to pick up lava rather than water
    • I never started my own server manually but I follow every single step i saw in a youtube video.
  • Topics

  • Create New...

Important Information

By using this site, you agree to our Terms of Use.