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

I am working on making a spear weapon and I can't make my model be rendered. In the initial code I have

 

RenderingRegistry.registerEntityRenderingHandler(ProjectileSpear.class, new RenderSpear(new ModelSpear(), 0));

 

I have used things to check that it is being registered, both debugging and such so I know this one is executed, it is executed along with another mob model I have which IS being rendered properly. This is my render file

 

package aerosteam.renderer.mob;

import org.lwjgl.opengl.GL11;

import aerosteam.AeroSteam;
import aerosteam.mobs.MobThief;
import aerosteam.model.mobs.ModelThief;
import aerosteam.model.various.ModelBullet;
import aerosteam.model.various.ModelSpear;
import aerosteam.projectiles.ProjectileBullet;
import aerosteam.projectiles.ProjectileSpear;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;

public class RenderSpear extends Render {

private static final ResourceLocation textureStone = new ResourceLocation(AeroSteam.MODID + ":" + "textures/model/SpearStone.png");
private static final ResourceLocation textureWooden = new ResourceLocation(AeroSteam.MODID + ":" + "textures/model/SpearWooden.png");

protected ModelSpear modelEntity;

public RenderSpear(ModelBase model, float f) {
	super();
	modelEntity=((ModelSpear) model);
	System.out.println("Register Spear");
}


public void doRender(Entity entity, double x, double y, double z, float u, float v){
	System.out.println("Spear is rendering");
	GL11.glPushMatrix();
		GL11.glTranslatef((float)x+0.0F,(float)y-0.875F,(float)z+0.0F);
		this.bindTexture(textureStone);
		GL11.glPushMatrix();
			this.modelEntity.renderModel(0.0625F*1F);
		GL11.glPopMatrix();
	GL11.glPopMatrix();
}
public void renderSpear(ProjectileSpear entityarrow, double d, double d1, double d2, float f, float f1)
/*     */   {
	System.out.println("Spear is rendering-2");
/*  18 */     
/*     */   }
public void func_76986_a(Entity entity, double d, double d1, double d2, float f, float f1)
/*     */   {
/*  99 */     renderSpear((ProjectileSpear)entity, d, d1, d2, f, f1);
/*     */   }
@Override
protected ResourceLocation getEntityTexture(Entity p_110775_1_) {
	System.out.println("Spear texture");
	return textureStone;
}
}

 

As you can see I have it giving text to write when certain things are meant to appear, sadly only "register spear" is the one showing up, none of the others are beign activated strangely enough. What am I doing wrong here?

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.