Jump to content

Recommended Posts

Posted

Hey, I'm using Forge 11.14.4 with Minecraft 1.8, and I'm making a mod that adds two new EntityThrowables. These are supposed to look exactly like eggs and snowballs with extra effects on impact. I'm using RenderSnowball objects with both of them, passing Items.egg and Items.snowball to the respective constructor calls. Both Entities render in-game as snowballs for some reason. Oddly, when I comment out all code involved in registering the renders for those two entities, they STILL render as snowballs. Here's the original code in my DTEntities classs:

 

package com.avarog.dangerous_things.init;

import com.avarog.dangerous_things.entity.EntityDangerousEgg;
import com.avarog.dangerous_things.entity.EntityDangerousSnowball;
import com.avarog.dangerous_things.entity.EntityDangerousSnowman;
import com.avarog.dangerous_things.renderer.RenderDangerousSnowman;
import com.avarog.dangerous_things.renderer.RenderEgg;

import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.RenderSnowball;
import net.minecraft.init.Items;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
import net.minecraftforge.fml.common.registry.EntityRegistry;

public class DTEntities {

public static void registerRenders() {
	RenderSnowball renderDangerousEgg = new RenderSnowball(Minecraft.getMinecraft().getRenderManager(), Items.egg,  Minecraft.getMinecraft().getRenderItem());
	RenderSnowball renderDangerousSnowball = new RenderSnowball(Minecraft.getMinecraft().getRenderManager(), Items.snowball, Minecraft.getMinecraft().getRenderItem());
	RenderingRegistry.registerEntityRenderingHandler(EntityDangerousEgg.class, renderDangerousEgg);
	RenderingRegistry.registerEntityRenderingHandler(EntityDangerousSnowball.class, renderDangerousSnowball);

	RenderingRegistry.registerEntityRenderingHandler(EntityDangerousSnowman.class, new RenderDangerousSnowman(Minecraft.getMinecraft().getRenderManager()));
}

public static void register(Object mod) {
	EntityRegistry.registerModEntity(EntityDangerousSnowball.class, "Snowball", 0, mod, 64, 10, true);
	EntityRegistry.registerModEntity(EntityDangerousEgg.class, "Egg", 0, mod, 64, 10, true);

	EntityRegistry.registerModEntity(EntityDangerousSnowman.class, "Snowman", 1, mod, 40, 1, true);

}

}

 

And here's the commented version:

 

package com.avarog.dangerous_things.init;

import com.avarog.dangerous_things.entity.EntityDangerousEgg;
import com.avarog.dangerous_things.entity.EntityDangerousSnowball;
import com.avarog.dangerous_things.entity.EntityDangerousSnowman;
import com.avarog.dangerous_things.renderer.RenderDangerousSnowman;
import com.avarog.dangerous_things.renderer.RenderEgg;

import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.RenderSnowball;
import net.minecraft.init.Items;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
import net.minecraftforge.fml.common.registry.EntityRegistry;

public class DTEntities {

public static void registerRenders() {
	//RenderSnowball renderDangerousEgg = new RenderSnowball(Minecraft.getMinecraft().getRenderManager(), Items.egg,  Minecraft.getMinecraft().getRenderItem());
	//RenderSnowball renderDangerousSnowball = new RenderSnowball(Minecraft.getMinecraft().getRenderManager(), Items.snowball, Minecraft.getMinecraft().getRenderItem());
	//RenderingRegistry.registerEntityRenderingHandler(EntityDangerousEgg.class, renderDangerousEgg);
	//RenderingRegistry.registerEntityRenderingHandler(EntityDangerousSnowball.class, renderDangerousSnowball);

	RenderingRegistry.registerEntityRenderingHandler(EntityDangerousSnowman.class, new RenderDangerousSnowman(Minecraft.getMinecraft().getRenderManager()));
}

public static void register(Object mod) {
	EntityRegistry.registerModEntity(EntityDangerousSnowball.class, "Snowball", 0, mod, 64, 10, true);
	EntityRegistry.registerModEntity(EntityDangerousEgg.class, "Egg", 0, mod, 64, 10, true);

	EntityRegistry.registerModEntity(EntityDangerousSnowman.class, "Snowman", 1, mod, 40, 1, true);

}

}

 

Why can't I get these to render as anything but snowballs? How can I get my egg to render as an egg?

Posted

The 3rd parameter of #registerModEntity needs to be different for every entity - it is the entity's integer ID, and can start at 0 (which you did) and increment from there. You registered both your projectiles with the same ID of zero.

 

Also, you should choose names that are unique - "Snowball" and "Egg" are already used by vanilla Minecraft (I think - if not, dangerously close). I suggest renaming them to "DangerousSnowball" and "DangerousEgg" or something prepending your modid.

 

Finally, show the code where you spawn the entities into the world. It is possible you simply forgot to use the correct entity and are, in fact, spawning in snowballs :P

Posted

Ah, thanks a lot!

 

I know that the correct entity was spawning because the special effect of my entity (explosions  :) ) was showing up. I hadn't known about the Entity ID, I think I was just using suggested parameters for EntityThrowables from a tutorial. Thank you!

 

Out of curiosity, what are those names used for? I would like to keep them, as my entities are intended to entirely replace vanilla snowballs and eggs. If the names don't show up in game, though, I will definitely change them.

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.