Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Hey, so i created an Entity that extends Entity. I registered it correctly and I see the spawn egg and i can spawn it without any errors.

The problem is when i render it, It does not render correctly. I always see the model next to the player and not where the entity is. 

(The render is registered correctly as well)

 

I think i need to use some GL code but i really didnt see any explantion of this. 

 

Here is my render class: (I used boat textures just for testing purposes)

 

package me.dejoker.broomstick.render;

import me.dejoker.broomstick.entities.EntityBroomstick;
import me.dejoker.broomstick.models.ModelBroomstick;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

@SideOnly(Side.CLIENT)
public class RenderBroomstick extends Render<EntityBroomstick>
{
    private static final ResourceLocation BOAT_TEXTURES = new ResourceLocation("textures/entity/boat/boat_oak.png");

	ModelBase modelBroom = new ModelBroomstick();
	
	protected RenderBroomstick(RenderManager renderManager)
	{
		super(renderManager);
	}

	@Override
	public void doRender(EntityBroomstick entity, double x, double y, double z, float entityYaw, float partialTicks)
	{
        modelBroom.render(entity, 0f, 0f, -0.1f, 0f, 0f, 0.0625f);
		super.doRender(entity, x, y, z, entityYaw, partialTicks);
	}
	
	@Override
	protected ResourceLocation getEntityTexture(EntityBroomstick entity)
	{
		return BOAT_TEXTURES;
	}

}

 

2019-01-19_17_39_14.png.b05593aed8abecea87396f7314046056.png

Edited by De Joker

  • Author
33 minutes ago, diesieben07 said:

You need to use GLStateManager.translate(x, y, z) before rendering the model. And you need to pushMatrix before and popMatrix after, to return the matrix to it's original state afterwards.

Thanks! That did work.

 

Another thing I might ask is why when i extend EntityLiving the model register correctly and  when i extend Entityit does not?

Edited by De Joker

  • Author
3 hours ago, diesieben07 said:

Define "model register correctly".

I can see my model when it extends EntityLiving.

And when it extends Entity I do not see the model rendering at all

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.