Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.7.10] Multiple Item Rendered at once


MrNegaBlox
 Share

Recommended Posts

When I launch my game, I would hold my Item and multiple iterations of the same model in wierd areas and not rendering in first person.

Third Person

width=180 height=102http://s18.postimg.org/4jaxgqe8l/2014_12_18_18_42_17.png[/img]

 

width=180 height=102http://s18.postimg.org/p4pp8mvth/2014_12_18_18_42_21.png[/img]

 

I don't get why this happens.

Please excuse me for being new to coding

 

Model:

// Date: 12/13/2014 7:48:41 AM
// Template version 1.1
// Java generated by Techne
// Keep in mind that you still need to fill in some blanks
// - ZeuX






package io.github.mrnegablox.mythos.render;

import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;

public class ModelSoulJar extends ModelBase
{
//fields
public ModelRenderer Top;
public ModelRenderer Side_3;
public ModelRenderer Side_1;
public ModelRenderer Side_2;
public ModelRenderer Side_4;
public ModelRenderer Base;
public ModelRenderer Cap;
public ModelRenderer Shape1;

public ModelSoulJar()
{
	textureWidth = 64;
	textureHeight = 32;

	Top = new ModelRenderer(this, 0, 0);
	Top.addBox(0F, 0F, 0F, 9, 1, 9);
	Top.setRotationPoint(-1F, -11F, -1F);
	Top.setTextureSize(64, 32);
	Top.mirror = true;
	setRotation(Top, 0F, 0F, 0F);
	Side_3 = new ModelRenderer(this, 36, 0);
	Side_3.addBox(0F, 0F, 0F, 7, 10, 0);
	Side_3.setRotationPoint(0F, -10F, 0F);
	Side_3.setTextureSize(64, 32);
	Side_3.mirror = true;
	setRotation(Side_3, 0F, 0F, 0F);
	Side_1 = new ModelRenderer(this, 36, 0);
	Side_1.addBox(0F, 0F, 0F, 7, 10, 0);
	Side_1.setRotationPoint(0F, -10F, 7F);
	Side_1.setTextureSize(64, 32);
	Side_1.mirror = true;
	setRotation(Side_1, 0F, 0F, 0F);
	Side_2 = new ModelRenderer(this, 36, -7);
	Side_2.addBox(0F, 0F, 0F, 0, 10, 7);
	Side_2.setRotationPoint(0F, -10F, 0F);
	Side_2.setTextureSize(64, 32);
	Side_2.mirror = true;
	setRotation(Side_2, 0F, 0F, 0F);
	Side_4 = new ModelRenderer(this, 36, -7);
	Side_4.addBox(0F, 0F, 0F, 0, 10, 7);
	Side_4.setRotationPoint(7F, -10F, 0F);
	Side_4.setTextureSize(64, 32);
	Side_4.mirror = true;
	setRotation(Side_4, 0F, 0F, 0F);
	Base = new ModelRenderer(this, 0, 0);
	Base.addBox(0F, 0F, 0F, 9, 1, 9);
	Base.setRotationPoint(-1F, 0F, -1F);
	Base.setTextureSize(64, 32);
	Base.mirror = true;
	setRotation(Base, 0F, 0F, 0F);
	Cap = new ModelRenderer(this, 0, 10);
	Cap.addBox(0F, 0F, 0F, 5, 1, 5);
	Cap.setRotationPoint(1F, -12F, 1F);
	Cap.setTextureSize(64, 32);
	Cap.mirror = true;
	setRotation(Cap, 0F, 0F, 0F);
	Shape1 = new ModelRenderer(this, 20, 10);
	Shape1.addBox(0F, 0F, 0F, 5, 8, 5);
	Shape1.setRotationPoint(1F, -9F, 1F);
	Shape1.setTextureSize(64, 32);
	Shape1.mirror = true;
	setRotation(Shape1, 0F, 0F, 0F);
}

public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
{
	super.render(entity, f, f1, f2, f3, f4, f5);
	setRotationAngles(f, f1, f2, f3, f4, f5, entity);
	Top.render(f5);
	Side_3.render(f5);
	Side_1.render(f5);
	Side_2.render(f5);
	Side_4.render(f5);
	Base.render(f5);
	Cap.render(f5);
}

private void setRotation(ModelRenderer model, float x, float y, float z)
{
	model.rotateAngleX = x;
	model.rotateAngleY = y;
	model.rotateAngleZ = z;
}

public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity ent)
{
	super.setRotationAngles(f, f1, f2, f3, f4, f5, ent);
}

}

 

Render:

package io.github.mrnegablox.mythos.render;

import javax.swing.Icon;

import io.github.mrnegablox.mythos.Main;
import io.github.mrnegablox.mythos.items.ModItems;

import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainerCreative;
import net.minecraft.client.gui.inventory.GuiInventory;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.renderer.texture.TextureUtil;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.ForgeHooksClient;
import net.minecraftforge.client.IItemRenderer;

public class RenderSoulJar implements IItemRenderer{

public boolean isKappa;
protected ModelSoulJar souljarmodel;
protected ModelSoulJar souljarmodel2;
private static RenderItem renderItem = new RenderItem();
private Minecraft mc;
private RenderBlocks renderBlocksIr = new RenderBlocks();
public RenderSoulJar(){
	souljarmodel = new ModelSoulJar();
	souljarmodel2 = new ModelSoulJar();
	mc = Minecraft.getMinecraft();
}

@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
	// TODO Auto-generated method stub
	return type == ItemRenderType.EQUIPPED || type == ItemRenderType.EQUIPPED_FIRST_PERSON || type == ItemRenderType.ENTITY || type == ItemRenderType.INVENTORY;

}

@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item,
		ItemRendererHelper helper) {
	if(type != ItemRenderType.EQUIPPED){
	return item.getItem() == ModItems.ItemSoulJar;
	}
	return false;
}

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {

	switch(type) {


	case EQUIPPED:
	{
		GL11.glPushMatrix();
		GL11.glEnable(GL11.GL_BLEND);;
		GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
		Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation(Main.MODID, "textures/model/ModelSoulJar.png"));
		GL11.glRotatef(180F, 0F, 1.0F, 0.0F);
		GL11.glRotatef(90F, 0.0F, 0.0F, 1.0F);
		GL11.glRotatef(15F, 1F, 0.0F, 0F);
		GL11.glTranslatef(0.0f, 1.5F, -0.4f);


		souljarmodel.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);

		GL11.glPopMatrix();

	}

	case INVENTORY:
	{
		//IIcon icon = Items.beef.getIconIndex(new ItemStack(Items.beef));
		// Use vanilla code to render the icon in a 16x16 square of inventory slot
		//renderItem.renderIcon(0, 0, icon, 16, 16);
	}
	case EQUIPPED_FIRST_PERSON:
	{
		GL11.glPushMatrix();
		GL11.glEnable(GL11.GL_BLEND);;
		GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
		GL11.glRotatef(90, 0, 1, 0);
		Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation(Main.MODID, "textures/model/ModelSoulJar.png"));



		souljarmodel.render(null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);


		GL11.glPopMatrix();
	}
	case ENTITY:
	{
		GL11.glPushMatrix();
		GL11.glEnable(GL11.GL_BLEND);;
		GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
		Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation(Main.MODID, "textures/model/ModelSoulJar.png"));
		GL11.glRotatef(90F, 0F, 1.0F, 0.0F);
		GL11.glRotatef(90F, 0.0F, 0.0F, 1.0F);
		GL11.glRotatef(15F, 1F, 0.0F, 0F);
		GL11.glTranslatef(1.0f, 0.5F, -0.4f);


			souljarmodel.render(null, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);

		GL11.glPopMatrix();

	}
	default:
		break;

	}

}

private void drawAs2D(ItemRenderType type, ItemStack item) {
	Tessellator tessellator = Tessellator.instance;
	tessellator.startDrawingQuads();

	IIcon icon1 = Items.potionitem.getIconIndex(new ItemStack(Items.potionitem));

	double minU1 = (double)icon1.getMinU();
	double minV1 = (double)icon1.getMinV();
	double maxU1 = (double)icon1.getMaxU();
	double maxV1 = (double)icon1.getMaxV();

	tessellator.addVertexWithUV(16.0, 16.0, 0.0, maxU1, maxV1);
	tessellator.addVertexWithUV(16.0,  0.0, 0.0, maxU1, minV1);
	tessellator.addVertexWithUV( 0.0,  0.0, 0.0, minU1, minV1);
	tessellator.addVertexWithUV( 0.0, 16.0, 0.0, minU1, maxV1);
	tessellator.draw();

}

}

Link to comment
Share on other sites

You forgot

break

statements.

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

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

 Share



×
×
  • Create New...

Important Information

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