Jump to content

[1.8] [SOLVED] Confused on creating a custom entity


Max Noodles

Recommended Posts

Hello, I've been having a really difficult time correctly creating a custom entity i've aptly named "horror".

I'm new to entity creation so I'm certain i've made mistakes, my problem is that I dont know where the mistakes are and i cant figure out how to fix them.

 

My issue is that I havent been able to summon the monster in-game. Its not there and i dont know why not.

 

Any help would be greatly appreciated!

 

This is my Main class:

http://pastebin.com/jTbtKc9D

 

My EntityHorror class:

http://pastebin.com/uTZqBqYa

 

My EntityRegisterHorror Class:

http://pastebin.com/wS7snCkB

 

My ModelHorror Class:

http://pastebin.com/hzRfQ4Wf

 

My RenderHorror Class:

http://pastebin.com/F0C9ZikY

 

what my Eclipse looks like:

v2Ec9Cc.jpg

Link to comment
Share on other sites

Do not use

EntityRegistry.registerGlobalEntityID

. It's completely unnecessary and will break things if you run out of global IDs (255 is the max and vanilla already uses a lot).

 

If you use the overload of

EntityRegistry.registerModEntity

with the two additional

int

parameters, it will call

EntityRegistry.registerEgg

for you (using the two

int

s as the background and foreground colours of the egg).

 

It looks like you're never actually calling the methods of

EntityRegisterHorror

from your main class. Side note: you don't need a separate registration class for each entity type.

 

Are you sure the entity isn't being summoned or is it just not being rendered? Put a breakpoint in the

EntityHorror

constructor and run Minecraft in debug mode.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

I have a tutorial that covers a lot of the topics related to custom entities here: http://jabelarminecraft.blogspot.com/p/creating-custom-entities.html

 

There is a lot of things that actually have to come together to make a successful entity, so probably worthwhile to go through the points in my tutorial. Registering the entity, registering the renderers, animating the entity, creating a spawn egg, etc. is all described.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

You want that spawn egg so it's easy to spawn your own entity in early testing (rather than waiting for one to show up randomly). However, you should also be able to use a summon command. If the object is "successfully" summoned, but you still can't see it, then you probably have a rendering problem. Start setting break points or sprinkling your code with prints. Also, if you don't see clues in console, then check the log files, which contain more info than console out.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Link to comment
Share on other sites

Do not use

EntityRegistry.registerGlobalEntityID

. It's completely unnecessary and will break things if you run out of global IDs (255 is the max and vanilla already uses a lot).

 

If you use the overload of

EntityRegistry.registerModEntity

with the two additional

int

parameters, it will call

EntityRegistry.registerEgg

for you (using the two

int

s as the background and foreground colours of the egg).

 

It looks like you're never actually calling the methods of

EntityRegisterHorror

from your main class. Side note: you don't need a separate registration class for each entity type.

 

Are you sure the entity isn't being summoned or is it just not being rendered? Put a breakpoint in the

EntityHorror

constructor and run Minecraft in debug mode.

 

Thank you, I was not calling those methods in the correct place. After fixing that I attempted to summon the monster in-game but still no such luck.

I know the monster isnt being summoned because the game text that appears after I enter the command "/summon entity.jm.horror.name"

is "unable to summon object".

 

 

I have a tutorial that covers a lot of the topics related to custom entities here: http://jabelarminecraft.blogspot.com/p/creating-custom-entities.html

 

There is a lot of things that actually have to come together to make a successful entity, so probably worthwhile to go through the points in my tutorial. Registering the entity, registering the renderers, animating the entity, creating a spawn egg, etc. is all described.

 

I actually used your tutorials to get this far Jabelar. Thank you so much for putting them up, they help a great deal. I don't know why I'm messing up so hard on this one.

 

I've edited the classes in the OP so that they accurately reflect what I have on my eclipse now:  I called the register and render methods in the initialization method of the main class.

 

 

Link to comment
Share on other sites

You want that spawn egg so it's easy to spawn your own entity in early testing (rather than waiting for one to show up randomly). However, you should also be able to use a summon command. If the object is "successfully" summoned, but you still can't see it, then you probably have a rendering problem. Start setting break points or sprinkling your code with prints. Also, if you don't see clues in console, then check the log files, which contain more info than console out.

 

For rendering problems it is also really useful to use the F3+B key combo to enable entity bounding boxes to be highlighted. If you see your entity's bounding box, but not the entity, then you know it is a rendering problem. And to find the location of your entity (a lot of people accidentally spawn them at 0, 0, 0) like Choonster says you should use console statements to print out the position of the entity, then you know where to look. If you never get those print statements, then presumably the entity didn't even spawn.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

It looks like you're still calling

EntityRegistry.registerGlobalEntityID

, don't do this.

 

This method registers the entity class with the name you provide (i.e.

horror

), but if you only call

EntityRegistry.registerModEntity

instead it will prefix the name with your mod ID (i.e.

jm.horror

).

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

SOLVED!

 

things I did after help from the people in this thread(original classes in the OP are all updated):

- changed the globalID entity registry to EntityRegistry.registerModEntity,

- moved RenderingRegistry.registerEntityRenderingHandler(EntityHorror.class, new RenderHorror(Minecraft.getMinecraft().getRenderManager(), new ModelHorror(), 1.0F)); from init() to preInit() in the main class.

- removed overridden entityInit() method from the EntityHorror class.

- removed this.getAttributeMap().registerAttribute(reinforcementChance).setBaseValue(this.rand.nextDouble() * net.minecraftforge.common.ForgeModContainer.zombieSummonBaseChance); from applyEntityAttributes method of the EntityHorror class.

 

Thank you all for your help.

 

Link to comment
Share on other sites

You should be registering renderers in your client proxy, not your main class. If you call a client-only method or reference a client-only class in your main class, your mod will crash when run on a dedicated server.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

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.



×
×
  • Create New...

Important Information

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