Jump to content

Recommended Posts

Posted (edited)

I have a throwable entity that works great and I am satisfied with the onImpact and onUpdate methods, but It still lacks a render. In it's item form it renders fine, but I cannot figure out how to render its entity state. I looked at the RenderSnowball class, but I cannot understand the constructor, which requires three different objects (RenderManager, Item, RenderItem), but got stuck when I came to the constructor for RenderItem and RenderManager because they both require a TextureManager object (which I do not know how to construct). The problem with the TextureManager is that it requires a IResourceManager object in its constructor, and IResourceManagers are interfaces (I'm inexperienced with interfaces).

 

Can anyone explain to me how to render an EntityThrowable or provide me with an accurate 1.8.9  tutorial? 

Edited by bignose956
Posted (edited)
16 minutes ago, draganz said:

1.8.9 is no longer supported, and help shall not be given on this forum.

Uhhh, you might wan't double check that. 1.8.9 is still on forge (http://files.minecraftforge.net/maven/net/minecraftforge/forge/index_1.8.9.html), and this is the official Forge Forums. Furthermore, I've been receiving help with 1.8.9 this whole week, and you are the only person that has made an unsupported claim about it.

Edited by bignose956
Posted (edited)
4 hours ago, bignose956 said:

I have a throwable entity that works great and I am satisfied with the onImpact and onUpdate methods, but It still lacks a render. In it's item form it renders fine, but I cannot figure out how to render its entity state. I looked at the RenderSnowball class, but I cannot understand the constructor, which requires three different objects (RenderManager, Item, RenderItem), but got stuck when I came to the constructor for RenderItem and RenderManager because they both require a TextureManager object (which I do not know how to construct). The problem with the TextureManager is that it requires a IResourceManager object in its constructor, and IResourceManagers are interfaces (I'm inexperienced with interfaces).

 

Can anyone explain to me how to render an EntityThrowable or provide me with an accurate 1.8.9  tutorial? 

 

You don't create the RenderManager or RenderItem instances yourself, you use the instances Minecraft has already created.

 

To register a Render for an Entity class, call RenderingRegistry.registerEntityRenderingHandler(Class<T>, IRenderFactory<? super T>) in preInit. In the IRenderFactory#createRenderFor implementation, create and return the Render instance.

 

You receive the RenderManager instance as an argument of IRenderFactory#createRenderFor and you can get the RenderItem instance using Minecraft#getRenderItem.

 

This advice applies to all versions from 1.8.9 onwards.

 

 

4 hours ago, bignose956 said:

Uhhh, you might wan't double check that. 1.8.9 is still on forge (http://files.minecraftforge.net/maven/net/minecraftforge/forge/index_1.8.9.html), and this is the official Forge Forums. Furthermore, I've been receiving help with 1.8.9 this whole week, and you are the only person that has made an unsupported claim about it.

 

1.7.10 and earlier are still available for download, but they're not supported on this forum. I believe 1.8.9 is still supported, but you should really update.

Edited by Choonster

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.

Posted (edited)
18 hours ago, Choonster said:

 

You don't create the RenderManager or RenderItem instances yourself, you use the instances Minecraft has already created.

 

To register a Render for an Entity class, call RenderingRegistry.registerEntityRenderingHandler(Class<T>, IRenderFactory<? super T>) in preInit. In the IRenderFactory#createRenderFor implementation, create and return the Render instance.

 

You receive the RenderManager instance as an argument of IRenderFactory#createRenderFor and you can get the RenderItem instance using Minecraft#getRenderItem.

 

This advice applies to all versions from 1.8.9 onwards.

 

 

 

1.7.10 and earlier are still available for download, but they're not supported on this forum. I believe 1.8.9 is still supported, but you should really update.

Ok, I got this far:

public class RenderRock extends Render<EntityRock>{

	public static Factory FACTORY = new Factory();
	
	protected RenderRock(RenderManager renderManager) {
		super(renderManager);
	}

	@Override
	protected ResourceLocation getEntityTexture(EntityRock entity) {
		return new ResourceLocation(Ref.MOD_ID, "textures/entities/projectile/Rock.png");
	}
	
	public static class Factory implements IRenderFactory<EntityRock>{

        @Override
        public Render<? super EntityRock> createRenderFor(RenderManager manager) {
            return new RenderRock(manager);
        }
    }
}

and the preInit:

@EventHandler
	public void preInit(FMLPreInitializationEvent event)
	{
		
		MinecraftForge.EVENT_BUS.register(handler);
		
		theseBlocks.Init();
		theseBlocks.register();
		theseItems.Init();
		theseItems.register();
		
		RenderingRegistry.registerEntityRenderingHandler(EntityRock.class, RenderRock.FACTORY);
		
	}

But the textures are still not rendering... What am I doing wrong? All my texture images are 16x16 or a multiple. (They render fine as items...)

 

Also, I really despise 1.9 and higher, and could't image "updating" to them, >_<  but thank you for the advice =)

Edited by bignose956
Posted
5 hours ago, bignose956 said:

Also, I really despise 1.9 and higher, and could't image "updating" to them, >_<

Why? There are no reasons to stay on the outdated versions. Especially now, with the community actively wanting to set 1.12 as the "mainstream" version. There are modpacks for it already for crying out loud, we don't even have a stable forge yet...

No one is going to use your mod if it is that outdated.

 

5 hours ago, bignose956 said:

What am I doing wrong?

Well, you've registered your renderer. Are you maybe going to do something in there? You know, by default an implementation of Render is not going to do anything. You need to provide it with code that it will use to render something. You currently have only defined the textures used for rendering, but you are not telling the game how to render your entity.

Maybe you could use an implementation of RenderSnowball that renders your rock instead of the snowball? Please explain what you want your entity to look like.

Posted (edited)
57 minutes ago, V0idWa1k3r said:

Why? There are no reasons to stay on the outdated versions. Especially now, with the community actively wanting to set 1.12 as the "mainstream" version. There are modpacks for it already for crying out loud, we don't even have a stable forge yet...

No one is going to use your mod if it is that outdated.


I wouldn't use the term "outdated", because a lot of negative features were added post 1.8. Minecraft used to be a noob friendly sandbox game, and was transformed into a complicated RPG with too many options. I specifically hate this because it is forcing players like myself to update, when indeed we dislike the "new content". I don't like any of the combat 'improvements', the elytra thing is nothing like Minecraft (especially if you're from the 1.3 era). I believe that the updates should have been kept simple, and none should have changed the game fundamentals. If players want this, they can always build or download a mod. But now we are basically being forced to use mods we are not interested in.

 

57 minutes ago, V0idWa1k3r said:

Well, you've registered your renderer. Are you maybe going to do something in there? You know, by default an implementation of Render is not going to do anything. You need to provide it with code that it will use to render something. You currently have only defined the textures used for rendering, but you are not telling the game how to render your entity.

Maybe you could use an implementation of RenderSnowball that renders your rock instead of the snowball? Please explain what you want your entity to look like.

I want my entity to be the same as a snowball as in its render is the same as it's item form, and it is "2D" from all angles. I tried this: 

public void doRender(EntityRock entity, double x, double y, double z, float entityYaw, float partialTicks)
    {
        GlStateManager.pushMatrix();
        GlStateManager.translate((float)x, (float)y, (float)z);
        GlStateManager.enableRescaleNormal();
        GlStateManager.scale(0.5F, 0.5F, 0.5F);
        GlStateManager.rotate(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
        GlStateManager.rotate(this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
        this.bindTexture(getEntityTexture(entity));
        this.theRenderItem.renderItem(this.getItemStack(entity), ItemCameraTransforms.TransformType.GROUND);
        GlStateManager.disableRescaleNormal();
        GlStateManager.popMatrix();
        super.doRender(entity, x, y, z, entityYaw, partialTicks);
    }

but I got a nullpointer at 

this.theRenderItem.renderItem(this.getItemStack(entity), ItemCameraTransforms.TransformType.GROUND);

 

Edited by bignose956
Posted
1 minute ago, bignose956 said:

I want my entity to be the same as a snowball as in its render is the same as it's item form, and it is "2D" from all angles.

It seems that you can simply return a new instance of RenderSnowball then. Look at it's constructor. You already have your RenderManager in your factory, the Item is your item(the rock) and you can obtain an instance of RenderItem at Minecraft::getRenderItem

Posted
28 minutes ago, V0idWa1k3r said:

It seems that you can simply return a new instance of RenderSnowball then. Look at it's constructor. You already have your RenderManager in your factory, the Item is your item(the rock) and you can obtain an instance of RenderItem at Minecraft::getRenderItem

I didn't understand that at all ???

Posted

In your render factory (the RenderRock.Factory subclass), in it's 

6 hours ago, bignose956 said:

createRenderFor

method return a new instance of RenderSnowball(new RenderSnowball). It's constructor takes 3 parameters.

1. a RenderManager. You already have one(it is the only parameter of the createRenderFor method)

2. an Item. That is the item you want the texture of to render. In your case it is your Rock item if you have one. I do not know where do you keep your item references so I can't give you a code snippet to use.

3. a RenderItem. You can obtain one using Minecraft.getMinecraft().getRenderItem().

If you want your item to render as a snowball but with a different texture you might aswell use snowball's renderer instead of writing your own.

  • Like 1
  • 2 weeks later...
Posted
On 6/13/2017 at 3:25 AM, V0idWa1k3r said:

In your render factory (the RenderRock.Factory subclass), in it's 

method return a new instance of RenderSnowball(new RenderSnowball). It's constructor takes 3 parameters.

1. a RenderManager. You already have one(it is the only parameter of the createRenderFor method)

2. an Item. That is the item you want the texture of to render. In your case it is your Rock item if you have one. I do not know where do you keep your item references so I can't give you a code snippet to use.

3. a RenderItem. You can obtain one using Minecraft.getMinecraft().getRenderItem().

If you want your item to render as a snowball but with a different texture you might aswell use snowball's renderer instead of writing your own.

Ohh!! I got it! Thanks!

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.