Jump to content

[1.11.2] Coloring EntityArrow tip.


Zgron

Recommended Posts

Hi I've been making an obsidian shard arrow, and as a finishing touch I would like the tip of the arrow to be purple when shoot. There is one occurence of that being done in minecraft and that is the EntitySpectralArrow that has a yellow instead of a white tip. It extends EntityArrow, however there are very fiew changes from its super class the EntityArrow class, the only differense being adding a luminating effect on targets hit and a duration for the effect. But I can't see anything that would change the color of the arrow tip.

 

Does anyone have any idea of were that arrow tip color change might come from? Can it be the registration of another model for the entity somewhere else? I've looked for that and I imagine that I might be able to change the appearance of the arrow entity however I see fit. But I for example still only find one entity arrow texture and I have no experience with entity models and textures so I feel a bit lost here.

 

Any suggestions? Thanks in advance!

Link to comment
Share on other sites

Okey I found the textures. I was looking at the wrong place. However now I don't know how to set the texture of an entity. I can only find tutorials for 1.8 about entities and there they use Render classes for the entities, however I can't seem to find any of those in 1.11.

Link to comment
Share on other sites

Okay I thought I could do it but I can't get it to work.

 

I'm extending the EntityTippedArrow.

 

If I do that it works but I get the white ordinary arrow entity, which is a bit buffling since then my extended class must be registered with a renderer without me doing anything.

 

I've extended the RenderArrow class with the only differens that I'm using my texture instead.

 

I've tried the following in client proxy.

 

-----

        RenderingRegistry.registerEntityRenderingHandler(EntityObsidianArrow.class, RenderObsidianArrow::new);

-----

        RenderManager renderManager = Minecraft.getMinecraft().getRenderManager();

        renderManager.entityRenderMap.put(EntityObsidianArrow.class, new RenderObsidianArrow(renderManager));

-----

And now I wonder if I shouldn't use

EntityRegistry.registerModEntity(...);

 

But I'm unsure since there already is a entity that I'm using and can you change entity however you want?

 

Link to comment
Share on other sites

Everything works now thank you! however I have one last question.

 

This works:

    renderManager.entityRenderMap.put(EntityObsidianArrow.class, new RenderObsidianArrow(renderManager));

 

But this doesn't(Which I believed is the supposed way):

    RenderingRegistry.registerEntityRenderingHandler(EntityObsidianArrow.class, RenderObsidianArrow::new);

 

Why? Am I doing something wrong with the lambda cunstructor? To be honest I've never seen that such a lambda in java before and really don't see how that would bring an IRenderFactory to the picture to begin with, though I found it online.

 

And lastly I sat the the update time and such this way:

      EntityRegistry.registerModEntity(new ResourceLocation(ObsidianShardsMod.MODID, "textures/entity/obsidian_arrow.png"), EntityObsidianArrow.class, "obsidian_arrow", 1, ObsidianShardsMod.instance, 80,  3, true);

 

However it would be nice to do it just like in vanilla. I found a register of the tipped arrow in the minecraft code but there were no updatefrequency parameters and such there. So I just wonder what do the vanilla entities use for trackingRange and updateFrequency?

 

Also what is the first ResourceLocation parameter for? It says registryName. Am I using it wrong? Because I have the ResourceLocation that I use in my Renderer class so I don't see what it would be for.

 

 

 

Link to comment
Share on other sites

Ok I changed it to mimic vanilla arrows and are using RenderingRegistry now wich worked in preInit (i did it in clientproxy init before) , but now I have a bug were it looks like the arrow bounces of a wall directly when shot but the collider seems to behave correctly, and once the arrow hits something it renders correctly again. I can imagine it happening since the renderer seems to handle stuff depending on what the arrow is doing. But I have no idea how it happens.

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.