Jump to content

[1.12.2] Model render() not being called


GooberGunter

Recommended Posts

Hey, so I'm trying out my custom mob, but it's not rendering on screen. I've narrowed it down to the model's render method not being called, but I can't figure out why not. To test that it isn't just my model, I set the model to the ModelPig class and am still getting the same results:

 

RenderTest:

Spoiler

package com.goobergunter.demonology.core.render;

import com.goobergunter.demonology.Demonology;
import com.goobergunter.demonology.client.model.ModelMod;
import com.goobergunter.demonology.client.model.ModelTest;
import com.goobergunter.demonology.core.entities.EntityTest;

import net.minecraft.client.model.ModelPig;
import net.minecraft.client.model.ModelSkeleton;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.util.ResourceLocation;

public class RenderTest extends RenderLiving<EntityTest>{

	public RenderTest(RenderManager rendermanagerIn, float shadowsizeIn) {
		super(rendermanagerIn, new ModelPig(), shadowsizeIn);
	}

	@Override
	protected ResourceLocation getEntityTexture(EntityTest entity) {
		// TODO Auto-generated method stub
		return null;
	}
	
	@Override
	public void doRender(EntityTest entity, double x, double y, double z, float entityYaw, float partialTicks) {
		// TODO Auto-generated method stub
		super.doRender(entity, x, y, z, entityYaw, partialTicks);
	}
	
	@Override
	protected boolean isVisible(EntityTest p_193115_1_) {
		// TODO Auto-generated method stub
		return true;
	}

	

}

 

 

ClientProxy:

Spoiler

package com.goobergunter.demonology.core.proxy;

import com.goobergunter.demonology.Demonology;
import com.goobergunter.demonology.core.block.DemoBlocks;
import com.goobergunter.demonology.core.entities.EntityTest;
import com.goobergunter.demonology.core.item.DemoItems;
import com.goobergunter.demonology.core.render.DemoFactoryRender;

import net.minecraft.block.Block;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.item.Item;
import net.minecraftforge.client.event.ModelRegistryEvent;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

//for rendering
@EventBusSubscriber
public class ClientProxy extends CommonProxy{

	public static KeyBinding[] bindings;
	
	
	@Override
	public void preInit(FMLPreInitializationEvent e) {
		super.preInit(e);
		Demonology.logger.info("CLIENT PREINIT");
		RenderingRegistry.registerEntityRenderingHandler(EntityTest.class, new DemoFactoryRender());
	}
	
	@Override
	public void init(FMLInitializationEvent e) {
		super.init(e);
		
		bindings = new KeyBinding[1];
		bindings[0] = new KeyBinding("key.demo.tess", org.lwjgl.input.Keyboard.KEY_K, "key.demo.category");
		for(KeyBinding bind : bindings) {
			ClientRegistry.registerKeyBinding(bind);
		}
	}
	
	@Override
	public void postInit(FMLPostInitializationEvent e) {
		super.postInit(e);
	}
	
	@SubscribeEvent
	public static void registerRenders(ModelRegistryEvent e) {
		for(int i = 0; i< 16; i++) {
			ModelLoader.setCustomModelResourceLocation(DemoItems.chalk, i, new ModelResourceLocation(""));
		}
		for(Item item : DemoItems.items) {
			ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));
		}
		
		//###BLOCKS###
		for(Block block : DemoBlocks.blocks) {
			ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), 0, new ModelResourceLocation(block.getRegistryName(), "inventory"));
		}
	}
}

 

 

Link to comment
Share on other sites

Are you sure the renderer is registered?

 

i.e. is the white box still being rendered for you?

Edited by Cadiboo

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

41 minutes ago, GooberGunter said:

White box? Don't think so, just the mob's shadow.

So the default white box isn’t being rendered which means that your custom rendered got set. You’ve used breakpoints and found out that your render method isn’t being called. Can you show your demo rendering factory? And in future it will probably be easier to replace that class with a lamda expression like this

https://github.com/Cadiboo/WIPTechAlpha/blob/08fe6f7abfb7a791fc9c922e229fb9bee4749335/src/main/java/cadiboo/wiptech/EventSubscriber.java#L320

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

Yeah, no problem. I didn't even think to use a lambda expression

Spoiler

package com.goobergunter.demonology.core.render;

import com.goobergunter.demonology.Demonology;

import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.Entity;
import net.minecraftforge.fml.client.registry.IRenderFactory;

public class DemoFactoryRender<T extends Entity> implements IRenderFactory{

	@Override
	public Render createRenderFor(RenderManager manager) {
		Demonology.logger.info("Creating Render for Render Test");
		return new RenderTest(manager, 1);
	}

}

 

Edit: I don't know why I didn't think of this before, but the texture was null

Edited by GooberGunter
Link to comment
Share on other sites

15 hours ago, GooberGunter said:

Yeah, no problem. I didn't even think to use a lambda expression

  Hide contents


package com.goobergunter.demonology.core.render;

import com.goobergunter.demonology.Demonology;

import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.Entity;
import net.minecraftforge.fml.client.registry.IRenderFactory;

public class DemoFactoryRender<T extends Entity> implements IRenderFactory{

	@Override
	public Render createRenderFor(RenderManager manager) {
		Demonology.logger.info("Creating Render for Render Test");
		return new RenderTest(manager, 1);
	}

}

 

Edit: I don't know why I didn't think of this before, but the texture was null

Hmm, I your logs should have been the first thing I asked for - also my fault

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

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.

Guest
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.

Announcements



×
×
  • Create New...

Important Information

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