Jump to content

Recommended Posts

Posted

So i just started make custom modeled blocks and it works but the blocks don't show up in my inventory it just says Texture missing

EDW5wTM.png

If someone could help me i would be really happy ^^

Posted

Two questions:

1: have you done .setUnlocalizedName("Mod:block.png") when you initialized the block?

2: did you use a tile entity in that block? if so what line did you put in your main mod file to register the renderer to the tile entity?

Posted
  On 6/22/2013 at 12:58 AM, ninjapancakes87 said:

Two questions:

1: have you done .setUnlocalizedName("Mod:block.png") when you initialized the block?

2: did you use a tile entity in that block? if so what line did you put in your main mod file to register the renderer to the tile entity?

Two answers:

1: Yes

2:Yes

BlockFryer:

@Override
public TileEntity createNewTileEntity(World world) {

	return new TileEntityFryer();
}

Main:

ClientRegistry.bindTileEntitySpecialRenderer(TileEntityFryer.class, new RenderFryer());

Posted

Since you are using a custom rendering method for the block in the overworld, then you also need to use a custom rendering method for the block in other cases, such as in your inventory.

To do this, you need to create a IItemRenderer and register it for your block ID.

 

For example, in your new class that implements IItemRenderer:

public class FryerRenderer implements IItemRenderer {
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
	return true;
}

@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
	return true;
}

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
	switch(type) {
		case INVENTORY: {
			renderYourModel();
			return;
		}

		default: return;
	}
}

private void renderYourModel()
{
	// insert OpenGL code here....
}
}

 

Then, register it for your blockID in your mod class:

MinecraftForgeClient.registerItemRenderer(block_fryer.blockID, new FryerRenderer());

 

Hope I helped!

Posted
  On 6/27/2013 at 5:24 PM, Naftoreiclag said:

Since you are using a custom rendering method for the block in the overworld, then you also need to use a custom rendering method for the block in other cases, such as in your inventory.

To do this, you need to create a IItemRenderer and register it for your block ID.

 

For example, in your new class that implements IItemRenderer:

public class FryerRenderer implements IItemRenderer {
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
	return true;
}

@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
	return true;
}

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
	switch(type) {
		case INVENTORY: {
			renderYourModel();
			return;
		}

		default: return;
	}
}

private void renderYourModel()
{
	// insert OpenGL code here....
}
}

 

Then, register it for your blockID in your mod class:

MinecraftForgeClient.registerItemRenderer(block_fryer.blockID, new FryerRenderer());

 

Hope I helped!

I don't know what you mean with insert opengl code

Sorry this is first time i made a custom modeled block

Posted
  On 6/27/2013 at 6:21 PM, TwinAndy said:

  Quote

-snip-

I don't know what you mean with insert opengl code

Sorry this is first time i made a custom modeled block

 

How are you rendering your "custom modeled block" then? Certainly there is some code you used. Did you use a wavefront (.obj)? Did you code it out yourself using those tedious openGL functions? Can you show me your class for rendering your tile entity? I kind of assumed that you already knew the rendering stuff; sorry if I confused you. I'll be able to help you if you show me your rendering code.

Posted
  On 6/27/2013 at 6:59 PM, Naftoreiclag said:

-snip-

How are you rendering your "custom modeled block" then? Certainly there is some code you used. Did you use a wavefront (.obj)? Did you code it out yourself using those tedious openGL functions? Can you show me your class for rendering your tile entity? I kind of assumed that you already knew the rendering stuff; sorry if I confused you. I'll be able to help you if you show me your rendering code.

RenderFryer

package TwinAndysMods.SomeLittleThingsMod;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;

import org.lwjgl.opengl.GL11;
public class RenderFryer extends TileEntitySpecialRenderer
{
        public RenderFryer()
        {
                aModel = new ModelFryer();
        }

        public void renderAModelAt(TileEntityFryer tileentity1, double d, double d1, double d2, float f)
        {  
                GL11.glPushMatrix();
                GL11.glTranslatef((float)d + 0.5F, (float)d1 + 1.52F, (float)d2 + 0.5F);
                GL11.glRotatef(180F, 0F, 0F, 1F);
                bindTextureByName("/textures/blocks/FryerTexture.png");
                GL11.glPushMatrix();
                aModel.renderAll(0.0625F);
                GL11.glPopMatrix();     
                GL11.glPopMatrix();                                     
        }
        public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2,
                        float f)
        {
                renderAModelAt((TileEntityFryer)tileentity, d, d1, d2, f);
        }
        private ModelFryer aModel;
}



If you could help me i would love you (No homo)

Posted
  On 6/27/2013 at 9:03 PM, TwinAndy said:

If you could help me i would love you (No homo)

 

How about just a simple "thank you"?  :P

 

Anyway, since you didn't provide the code for the model, I couldn't test it, so I just copied and pasted your code. (Like I expected you would have tried on your own...)

 

Add this to the FryerRenderer class I made for you.

private ModelFryer aModel;

public FryerRenderer()
{
    aModel = new ModelFryer();
}

...

private void renderYourModel()
{
    GL11.glPushMatrix();
    GL11.glTranslatef(0.0F, 0.0F, 0.0F); // play around with these numbers until you get it where you want it. (should work by itself)
    GL11.glRotatef(180F, 0F, 0F, 1F);
    bindTextureByName("/textures/blocks/FryerTexture.png");
    aModel.renderAll(0.0625F);
    GL11.glPopMatrix();
}

 

Also, I don't think you need to do two glPushMatrix()'s since you aren't doing anything special to your model between the second one and the first glPopMatrix(); one pair should be good enough.

Posted
  Quote
Also, I don't think you need to do two glPushMatrix()'s since you aren't doing anything special to your model between the second one and the first glPopMatrix(); one pair should be good enough.

 

definitely ^

 

you probably should rotate before you translate

 

doing translation before implies that you want to rotate according to the origin

 

 

  Reveal hidden contents

 

 

if you dont give a shit about why, or if i wasn't clear enough,

 

jsut switch glRotate and glTranslate order

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

Posted
  On 6/28/2013 at 5:59 PM, Naftoreiclag said:

  Quote

If you could help me i would love you (No homo)

 

How about just a simple "thank you"?  :P

 

Anyway, since you didn't provide the code for the model, I couldn't test it, so I just copied and pasted your code. (Like I expected you would have tried on your own...)

 

Add this to the FryerRenderer class I made for you.

-snip-

 

Also, I don't think you need to do two glPushMatrix()'s since you aren't doing anything special to your model between the second one and the first glPopMatrix(); one pair should be good enough.

It doesn't work.

Im sorry that i didn't gave you a model.

ModelFryer

package TwinAndysMods.SomeLittleThingsMod;

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

public class ModelFryer extends ModelBase
{
  //fields
    ModelRenderer Shape1;
    ModelRenderer Shape2;
    ModelRenderer Shape3;
    ModelRenderer Shape4;
    ModelRenderer Shape5;
    ModelRenderer Shape6;
    ModelRenderer Shape7;
    ModelRenderer Shape8;
    ModelRenderer Shape9;
    ModelRenderer Shape10;
    ModelRenderer Shape11;
    ModelRenderer Shape12;
  
  public ModelFryer()
  {
    textureWidth = 64;
    textureHeight = 32;
    
      Shape1 = new ModelRenderer(this, 0, 0);
      Shape1.addBox(0F, 0F, 0F, 13, 1, 9);
      Shape1.setRotationPoint(-8F, 23F, -4F);
      Shape1.setTextureSize(64, 32);
      Shape1.mirror = true;
      setRotation(Shape1, 0F, 0F, 0F);
      Shape2 = new ModelRenderer(this, 0, 12);
      Shape2.addBox(0F, 0F, 0F, 1, 5, 9);
      Shape2.setRotationPoint(4F, 18F, -4F);
      Shape2.setTextureSize(64, 32);
      Shape2.mirror = true;
      setRotation(Shape2, 0F, 0F, 0F);
      Shape3 = new ModelRenderer(this, 44, 1);
      Shape3.addBox(0F, 0F, 0F, 1, 9, 9);
      Shape3.setRotationPoint(-8F, 14F, -4F);
      Shape3.setTextureSize(64, 32);
      Shape3.mirror = true;
      setRotation(Shape3, 0F, 0F, 0F);
      Shape4 = new ModelRenderer(this, 32, 26);
      Shape4.addBox(0F, 0F, 0F, 11, 5, 1);
      Shape4.setRotationPoint(-7F, 18F, 4F);
      Shape4.setTextureSize(64, 32);
      Shape4.mirror = true;
      setRotation(Shape4, 0F, 0F, 0F);
      Shape5 = new ModelRenderer(this, 32, 26);
      Shape5.addBox(0F, 0F, 0F, 11, 5, 1);
      Shape5.setRotationPoint(-7F, 18F, -4F);
      Shape5.setTextureSize(64, 32);
      Shape5.mirror = true;
      setRotation(Shape5, 0F, 0F, 0F);
      Shape6 = new ModelRenderer(this, 32, 19);
      Shape6.addBox(0F, 0F, 0F, 10, 1, 6);
      Shape6.setRotationPoint(-6.5F, 21F, -2.5F);
      Shape6.setTextureSize(64, 32);
      Shape6.mirror = true;
      setRotation(Shape6, 0F, 0F, 0F);
      Shape7 = new ModelRenderer(this, 0, 28);
      Shape7.addBox(0F, 0F, 0F, 10, 3, 1);
      Shape7.setRotationPoint(-6.5F, 18F, -2.5F);
      Shape7.setTextureSize(64, 32);
      Shape7.mirror = true;
      setRotation(Shape7, 0F, 0F, 0F);
      Shape8 = new ModelRenderer(this, 0, 28);
      Shape8.addBox(0F, 0F, 0F, 10, 3, 1);
      Shape8.setRotationPoint(-6.5F, 18F, 2.5F);
      Shape8.setTextureSize(64, 32);
      Shape8.mirror = true;
      setRotation(Shape8, 0F, 0F, 0F);
      Shape9 = new ModelRenderer(this, 22, 25);
      Shape9.addBox(0F, 0F, 0F, 1, 3, 4);
      Shape9.setRotationPoint(2.5F, 18F, -1.5F);
      Shape9.setTextureSize(64, 32);
      Shape9.mirror = true;
      setRotation(Shape9, 0F, 0F, 0F);
      Shape10 = new ModelRenderer(this, 22, 25);
      Shape10.addBox(0F, 0F, 0F, 1, 3, 4);
      Shape10.setRotationPoint(-6.5F, 18F, -1.5F);
      Shape10.setTextureSize(64, 32);
      Shape10.mirror = true;
      setRotation(Shape10, 0F, 0F, 0F);
      Shape11 = new ModelRenderer(this, 13, 11);
      Shape11.addBox(0F, 0F, 0F, 11, 0, 7);
      Shape11.setRotationPoint(-7F, 19F, -3F);
      Shape11.setTextureSize(64, 32);
      Shape11.mirror = true;
      setRotation(Shape11, 0F, 0F, 0F);
      Shape12 = new ModelRenderer(this, 0, 26);
      Shape12.addBox(0F, 0F, 0F, 6, 1, 1);
      Shape12.setRotationPoint(2.5F, 17F, 0F);
      Shape12.setTextureSize(64, 32);
      Shape12.mirror = true;
      setRotation(Shape12, 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);
    Shape1.render(f5);
    Shape2.render(f5);
    Shape3.render(f5);
    Shape4.render(f5);
    Shape5.render(f5);
    Shape6.render(f5);
    Shape7.render(f5);
    Shape8.render(f5);
    Shape9.render(f5);
    Shape10.render(f5);
    Shape11.render(f5);
    Shape12.render(f5);
  }
  public void renderAll(float f5){
  Shape1.render(f5);
    Shape2.render(f5);
    Shape3.render(f5);
    Shape4.render(f5);
    Shape5.render(f5);
    Shape6.render(f5);
    Shape7.render(f5);
    Shape8.render(f5);
    Shape9.render(f5);
    Shape10.render(f5);
    Shape11.render(f5);
    Shape12.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)
  {
    
  }

}

FryerRenderer

package TwinAndysMods.SomeLittleThingsMod;

import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer;

import org.lwjgl.opengl.GL11;

public class FryerRenderer implements IItemRenderer {
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
	return true;
}

@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
	return true;
}

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
	switch(type) {
		case INVENTORY: {
			renderModelFryer();
			return;
		}

		default: return;
	}
}


private ModelFryer aModel;

public FryerRenderer()
{
    aModel = new ModelFryer();
}


private void renderModelFryer()
{
    GL11.glPushMatrix();
    GL11.glTranslatef(0.0F, 0.0F, 0.0F); // play around with these numbers until you get it where you want it. (should work by itself)
    GL11.glRotatef(180F, 0F, 0F, 1F);
    bindTextureByName("/textures/blocks/FryerTexture.png");
    aModel.renderAll(0.0625F);
    GL11.glPopMatrix();
}

private void bindTextureByName(String string) {


}
}

I think i did something wron with the bindTextureByName....

I already gave you a thank you but if you still want to help me out a bit.

Posted
  On 6/28/2013 at 7:30 PM, TwinAndy said:

  Quote

  Quote

If you could help me i would love you (No homo)

 

How about just a simple "thank you"?  :P

 

Anyway, since you didn't provide the code for the model, I couldn't test it, so I just copied and pasted your code. (Like I expected you would have tried on your own...)

 

Add this to the FryerRenderer class I made for you.

-snip-

 

Also, I don't think you need to do two glPushMatrix()'s since you aren't doing anything special to your model between the second one and the first glPopMatrix(); one pair should be good enough.

It doesn't work.

Im sorry that i didn't gave you a model.

ModelFryer

package TwinAndysMods.SomeLittleThingsMod;

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

public class ModelFryer extends ModelBase
{
  //fields
    ModelRenderer Shape1;
    ModelRenderer Shape2;
    ModelRenderer Shape3;
    ModelRenderer Shape4;
    ModelRenderer Shape5;
    ModelRenderer Shape6;
    ModelRenderer Shape7;
    ModelRenderer Shape8;
    ModelRenderer Shape9;
    ModelRenderer Shape10;
    ModelRenderer Shape11;
    ModelRenderer Shape12;
  
  public ModelFryer()
  {
    textureWidth = 64;
    textureHeight = 32;
    
      Shape1 = new ModelRenderer(this, 0, 0);
      Shape1.addBox(0F, 0F, 0F, 13, 1, 9);
      Shape1.setRotationPoint(-8F, 23F, -4F);
      Shape1.setTextureSize(64, 32);
      Shape1.mirror = true;
      setRotation(Shape1, 0F, 0F, 0F);
      Shape2 = new ModelRenderer(this, 0, 12);
      Shape2.addBox(0F, 0F, 0F, 1, 5, 9);
      Shape2.setRotationPoint(4F, 18F, -4F);
      Shape2.setTextureSize(64, 32);
      Shape2.mirror = true;
      setRotation(Shape2, 0F, 0F, 0F);
      Shape3 = new ModelRenderer(this, 44, 1);
      Shape3.addBox(0F, 0F, 0F, 1, 9, 9);
      Shape3.setRotationPoint(-8F, 14F, -4F);
      Shape3.setTextureSize(64, 32);
      Shape3.mirror = true;
      setRotation(Shape3, 0F, 0F, 0F);
      Shape4 = new ModelRenderer(this, 32, 26);
      Shape4.addBox(0F, 0F, 0F, 11, 5, 1);
      Shape4.setRotationPoint(-7F, 18F, 4F);
      Shape4.setTextureSize(64, 32);
      Shape4.mirror = true;
      setRotation(Shape4, 0F, 0F, 0F);
      Shape5 = new ModelRenderer(this, 32, 26);
      Shape5.addBox(0F, 0F, 0F, 11, 5, 1);
      Shape5.setRotationPoint(-7F, 18F, -4F);
      Shape5.setTextureSize(64, 32);
      Shape5.mirror = true;
      setRotation(Shape5, 0F, 0F, 0F);
      Shape6 = new ModelRenderer(this, 32, 19);
      Shape6.addBox(0F, 0F, 0F, 10, 1, 6);
      Shape6.setRotationPoint(-6.5F, 21F, -2.5F);
      Shape6.setTextureSize(64, 32);
      Shape6.mirror = true;
      setRotation(Shape6, 0F, 0F, 0F);
      Shape7 = new ModelRenderer(this, 0, 28);
      Shape7.addBox(0F, 0F, 0F, 10, 3, 1);
      Shape7.setRotationPoint(-6.5F, 18F, -2.5F);
      Shape7.setTextureSize(64, 32);
      Shape7.mirror = true;
      setRotation(Shape7, 0F, 0F, 0F);
      Shape8 = new ModelRenderer(this, 0, 28);
      Shape8.addBox(0F, 0F, 0F, 10, 3, 1);
      Shape8.setRotationPoint(-6.5F, 18F, 2.5F);
      Shape8.setTextureSize(64, 32);
      Shape8.mirror = true;
      setRotation(Shape8, 0F, 0F, 0F);
      Shape9 = new ModelRenderer(this, 22, 25);
      Shape9.addBox(0F, 0F, 0F, 1, 3, 4);
      Shape9.setRotationPoint(2.5F, 18F, -1.5F);
      Shape9.setTextureSize(64, 32);
      Shape9.mirror = true;
      setRotation(Shape9, 0F, 0F, 0F);
      Shape10 = new ModelRenderer(this, 22, 25);
      Shape10.addBox(0F, 0F, 0F, 1, 3, 4);
      Shape10.setRotationPoint(-6.5F, 18F, -1.5F);
      Shape10.setTextureSize(64, 32);
      Shape10.mirror = true;
      setRotation(Shape10, 0F, 0F, 0F);
      Shape11 = new ModelRenderer(this, 13, 11);
      Shape11.addBox(0F, 0F, 0F, 11, 0, 7);
      Shape11.setRotationPoint(-7F, 19F, -3F);
      Shape11.setTextureSize(64, 32);
      Shape11.mirror = true;
      setRotation(Shape11, 0F, 0F, 0F);
      Shape12 = new ModelRenderer(this, 0, 26);
      Shape12.addBox(0F, 0F, 0F, 6, 1, 1);
      Shape12.setRotationPoint(2.5F, 17F, 0F);
      Shape12.setTextureSize(64, 32);
      Shape12.mirror = true;
      setRotation(Shape12, 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);
    Shape1.render(f5);
    Shape2.render(f5);
    Shape3.render(f5);
    Shape4.render(f5);
    Shape5.render(f5);
    Shape6.render(f5);
    Shape7.render(f5);
    Shape8.render(f5);
    Shape9.render(f5);
    Shape10.render(f5);
    Shape11.render(f5);
    Shape12.render(f5);
  }
  public void renderAll(float f5){
  Shape1.render(f5);
    Shape2.render(f5);
    Shape3.render(f5);
    Shape4.render(f5);
    Shape5.render(f5);
    Shape6.render(f5);
    Shape7.render(f5);
    Shape8.render(f5);
    Shape9.render(f5);
    Shape10.render(f5);
    Shape11.render(f5);
    Shape12.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)
  {
    
  }

}

FryerRenderer

package TwinAndysMods.SomeLittleThingsMod;

import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer;

import org.lwjgl.opengl.GL11;

public class FryerRenderer implements IItemRenderer {
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
	return true;
}

@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
	return true;
}

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
	switch(type) {
		case INVENTORY: {
			renderModelFryer();
			return;
		}

		default: return;
	}
}


private ModelFryer aModel;

public FryerRenderer()
{
    aModel = new ModelFryer();
}


private void renderModelFryer()
{
    GL11.glPushMatrix();
    GL11.glTranslatef(0.0F, 0.0F, 0.0F); // play around with these numbers until you get it where you want it. (should work by itself)
    GL11.glRotatef(180F, 0F, 0F, 1F);
    bindTextureByName("/textures/blocks/FryerTexture.png");
    aModel.renderAll(0.0625F);
    GL11.glPopMatrix();
}

private void bindTextureByName(String string) {


}
}

I think i did something wron with the bindTextureByName....

I already gave you a thank you but if you still want to help me out a bit.

I'll daresay you did. This probably isn't right, but try Minecraft.theMinecraft.renderEngine.bindTexture("..."); instead.

BEWARE OF GOD

---

Co-author of Pentachoron Labs' SBFP Tech.

Posted
  On 6/30/2013 at 10:40 PM, ObsequiousNewt said:

I'll daresay you did. This probably isn't right, but try Minecraft.theMinecraft.renderEngine.bindTexture("..."); instead.

Minecraft.theMinecraft.renderEngine.bindTexture("/textures/blocks/FryerTexture.png");

I get an error under theMinecraft

Posted

Try this:

this.bindTexture("/textures/blocks/FryerTexture.png");

Check out my m2cAPI: http://pastebin.com/SJmjgdgK [WIP! If something doesnt work or you have a better resolution, write me a PM]

If you want to use my API please give me a Karma/Thank you

Sorry for some bad words ´cause I am not a walkin´ library!

Posted

So

bindTextureByName("/textures/blocks/FryerTexture.png");

In this code you need to place your model texture into the minecraft.jar/textures/block

So, you need this, If you want to have your texture in diff location:

bindTextureByName("mods/YOURMODID/textures/blocks/FryerTexture.png");

And your modid is Mod´s modid, defined in main class of mod.

This will allow you to place the texture into the minecraft.jar/mods/YOURMODID/textures/block

Try, and write back! Good luck with your mod  :)

Check out my m2cAPI: http://pastebin.com/SJmjgdgK [WIP! If something doesnt work or you have a better resolution, write me a PM]

If you want to use my API please give me a Karma/Thank you

Sorry for some bad words ´cause I am not a walkin´ library!

Posted
  On 7/4/2013 at 3:40 PM, mar21 said:

-snip-

Try, and write back! Good luck with your mod  :)

I do have my textures in textures/blocks but the model doesn't show up in my inventory...

Posted
  On 7/5/2013 at 12:11 PM, TwinAndy said:

  Quote

-snip-

Try, and write back! Good luck with your mod  :)

I do have my textures in textures/blocks but the model doesn't show up in my inventory...

 

Ok let me help you out with this quickly because it's easy enough if you know where what goes

 

Now we are assuming the following;

 

1) You are using a model ingame

2) You manage to render the model ingame

3) You haven't manage to render the model in your hand while holding it.

 

Now another way to do this one used by many was to create a normal item then register that item and use the item to place the model, this off course is a lot more work for something you can easily obtain by usng the following methods.

 

Drop your render file as it is atm as in completely and create a new one that should look like this

 

public class FryerRenderer extends TileEntitySpecialRenderer
{
    private ModelFryer aModel = new ModelFryer();

    public void renderAModel(TileEntityFryer var1, double var2, double var4, double var6, float var8)
    {
    	
        int i1 = 0;

        if (var1.worldObj != null)
        {
            i1 = var1.getBlockMetadata();
        }
    	
    	
        int var9;

        if (var1.worldObj == null)
        {
            var9 = 0;
        }
        else
        {
            Block var10 = var1.getBlockType();
            var9 = var1.getBlockMetadata();

            if (var10 != null && var9 == 0)
            {
                var9 = var1.getBlockMetadata();
            }
        }

        GL11.glPushMatrix();
        GL11.glTranslatef((float)var2 + 0.5F, (float)var4 + 1.5F, (float)var6 + 0.5F);
        short var11 = 0;

        if (var9 == 3)
        {
            var11 = 90;
        }

        if (var9 == 2)
        {
            var11 = 180;
        }

        if (var9 == 1)
        {
            var11 = 270;
        }

        GL11.glRotatef((float)var11, 0.0F, 1.0F, 0.0F);
        GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
        this.bindTextureByName("/textures/blocks/FryerTexture.png");
        GL11.glPushMatrix();
        this.aModel.renderModel(0.0625F);
        GL11.glPopMatrix();
        GL11.glPopMatrix();
    }

    public void renderTileEntityAt(TileEntity var1, double var2, double var4, double var6, float var8)
    {
        this.renderAModel((TileEntityFryer)var1, var2, var4, var6, var8);
    }
    

}

 

So instead of implementing ItemRenderer you implement TileEntitySpecialRenderer, for your tile entity you just need a file that can basically be empty something like this

 

public class TileEntityFryer extends TileEntity
{
}

 

Off course if your model has special function it would be in the tileentity so it will look a bit different.

 

Your model file is fine no changes needed their, the method that will be rendering your item for you is inside the render file this bit public void renderTileEntityAt, this is also used to render the model in game so the results would be that whatever you place in world would render in your hands and also in the inventory

 

The last bit of info you need to make sure you have is the registering part;

 

Now depending on how you go about registering your model the code should be like below I basically call my model registering from another class because i have over 30+ models in game and I use my clientproxy to register the model in cause you mostly need this to be client side only it will look something like this;

 

RenderingRegistry.registerBlockHandler(FryerID,new RenderInv());
FryerID = RenderingRegistry.getNextAvailableRenderId();

ClientRegistry.bindTileEntitySpecialRenderer(TileEntityFryer.class, new FryerRenderer());

 

then the following need to be register inside your proxy i basicly have thsi inside my client proxy and proxy just to make double sure it gets registered

 

GameRegistry.registerTileEntity(TileEntityFryer.class, "TileEntityFryer");

 

Now this code can be place anywhere as long as it's executed at runtime or while registering takes place.

 

just import all your class files you need and then you wil have to create the following class file you can call it anything you like actually I call mine RenderInv and this is where I would tell my model where and how to render the item in hand the code will look like this

 

public class RenderInv  implements ISimpleBlockRenderingHandler
{

public void renderInventoryBlock(Block block, int metadata, int modelID,
		RenderBlocks renderer) {

        if (block == BlockFryer)
        {
         TileEntityRenderer.instance.renderTileEntityAt(new TileEntityFryer(), 0.0D, 0.0D, 0.0D, 0.0F);
        }

}

public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z,
		Block block, int modelId, RenderBlocks renderer) {
	return false;
}

public boolean shouldRender3DInInventory() {
	return true;
}

public int getRenderId() {
	return 0;
}

}

 

That's basically all you need to see your model in your hand, without the need to add an extra item into the game this will take your 3d model and create a 3d model for you that you can hold it in your hand. All you now need to do is take this code and implement it into your project the RenderInv can be expanded later on to include all your models inventory items and off course you need to make sure everything is imported and pointing towards the right class file names.

 

Happy coding...

Posted
  On 7/5/2013 at 1:18 PM, Conraad said:

  Quote

  Quote

-snip-

Try, and write back! Good luck with your mod  :)

I do have my textures in textures/blocks but the model doesn't show up in my inventory...

-snip-

Do you maybe have skype, still i don't really getting it to work

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Verified user can get a $100 off Temu   Coupon code using the code ((“aci789589”)). This Temu   $100 Off code is specifically for new and existing customers both and can be redeemed to receive a $100 discount on your purchase. Our exclusive Temu   Coupon code offers a flat $100 off your purchase, plus an additional 100% discount on top of that. You can slash prices by up to $100 as a new Temu   customer using code ((“aci789589”)). Existing users can enjoy $100 off their next haul with this code. But that’s not all! With our Temu   Coupon codes for 2025, you can get up to 90% discount on select items and clearance sales. Whether you’re a new customer or an existing shopper, our Temu   codes provide extra discounts tailored just for you. Save up to 100% with these current Temu   Coupons ["^"aci789589 "^"] for April 2025. The latest Temu   coupon codes at here. New users at Temu   receive a $100 discount on orders over $100 Use the code ((“aci789589”)) during checkout to get Temu   Coupon $100 Off For New Users. You can save $100 Off your first order with the coupon code available for a limited time only. Temu   90% Off promo code ((“aci789589”)) will save you $100 on your order. To get a discount, click on the item to purchase and enter the code. Yes, Temu   offers $100 Off coupon code “aci789589” for first time users. You can get a $100 bonus plus $100 Off any purchase at Temu   with the $100 Coupon Bundle at Temu   if you sign up with the referral code ((“aci789589”)) and make a first purchase of $100 or more. Free Temu   codes $100 off — ((“aci789589”)) Temu Coupon $100 off — ((“aci789589”)) Temu Coupon 100% off — ((“aci789589”)) Temu Memorial Day Sale $100 off — ((“aci789589”)) Temu Coupon code today — ((“aci789589”)) Temu free gift code — ["^"aci789589"^"](Without inviting friends or family member) Temu Coupon code for  USA      - $100 Off— ((“aci789589”)) Temu Coupon code  USA     - $100 Off— ((“aci789589”)) Temu Coupon code USA  - $100 Off — ((“aci789589”)) Temu Coupon code Japan - $100 Off — ((“aci789589”)) Temu Coupon code Mexico - $100 Off — ((“aci789589”)) Temu Coupon code Chile - $100 Off — ((“aci789589”)) Temu Coupon code USA - $100 Off — ((“aci789589”)) Temu Coupon code Colombia - $100 Off — ((“aci789589”)) Temu Coupon code Malaysia - $100 Off — ((“aci789589”)) Temu Coupon code Philippines - $100 Off — ((“aci789589”)) Temu Coupon code South Korea - $100 Off — ((“aci789589”)) Redeem Free Temu   Coupon Code ["^"aci789589"^"] for first-time users Get a $100 discount on your Temu   order with the promo code "aci789589". You can get a discount by clicking on the item to purchase and entering this Temu   Coupon code $100 off ((“aci789589”)). Temu   New User Coupon ((“aci789589)): Up To $100 OFF For First-Time Users Our Temu   first-time user coupon codes are designed just for new customers, offering the biggest discounts and the best deals currently available on Temu  . To maximize your savings, download the Temu   app and apply our Temu   new user coupon during checkout. Temu   Coupon Codes For Existing Users ((“aci789589”)): $100 Price Slash Have you been shopping on Temu   for a while? Our Temu   Coupon for existing customers is here to reward you for your continued support, offering incredible discounts on your favorite products. Temu   Coupon For $100 Off ((“aci789589”)): Get A Flat $100 Discount On Order Value Get ready to save big with our incredible Temu   Coupon for $100 off! Our amazing Temu   $100 off coupon code will give you a flat $100 discount on your order value, making your shopping experience even more rewarding. Temu   Coupon Code For $100 Off ((“aci789589”)): For Both New And Existing Customers Our incredible Temu   Coupon code for $100 off is here to help you save big on your purchases. Whether you’re a new user or an existing customer, our $100 off code for Temu   will give you an additional discount! Temu   Coupon Bundle ((“aci789589”)): Flat $100 Off + Up To $100 Discount Get ready for an unbelievable deal with our Temu   Coupon bundle for 2025! Our Temu   Coupon bundles will give you a flat $100 discount and an additional $100 off on top of it. Free Temu   Coupons ((“aci789589”)): Unlock Unlimited Savings! Get ready to unlock a world of savings with our free Temu   Coupons! We’ve got you covered with a wide range of Temu   Coupon code options that will help you maximize your shopping experience. 100% Off Temu   Coupons, Promo Codes + 25% Cash Back ((“aci789589”)) Redeem Temu   Coupon Code ((“aci789589”)) Temu Coupon $100 OFF ((“aci789589”)) Temu Coupon $100 OFF FOR EXISTING CUSTOMERS ((“aci789589”)) Temu Coupon $100 OFF FIRST ORDER ((“aci789589”)) Temu Coupon $100 OFF REDDIT ((“aci789589”)) Temu Coupon $100 OFF FOR EXISTING CUSTOMERS REDDIT ((“aci789589”)) Temu $100 OFF CODE ((“aci789589”)) Temu 70 OFF COUPON 2025 ((“aci789589”)) DOMINOS 70 RS OFF COUPON CODE ((“aci789589”)) WHAT IS A COUPON RATE ((“aci789589”)) Temu $100 OFF FOR EXISTING CUSTOMERS ((“aci789589”)) Temu $100 OFF FIRST ORDER ((“aci789589”)) Temu $100 OFF FREE SHIPPING ((“aci789589”)) You can get an exclusive $100 off discount on your Temu   purchase with the code [aci789589] Or [aci789589].This code is specially designed for new customers and offers a significant price cut on your shopping. Make your first purchase on Temu   more rewarding by using this code to get $100 off instantly. Temu   Coupon Code For $100 Off [aci789589] Or [aci789589]: Get A Flat $100 Discount On Order Value Get ready to save big with our incredible Temu   coupon for $100 off! Our coupon code will give you a flat $100 discount on your order value, making your shopping experience even more rewarding. Exclusive Temu   Discount Code [aci789589] Or [aci789589]: Flat $200 OFF for New and Existing Customers Using our Temu   promo code you can get A$ 200 off your order and 100% off using our Temu   promo code [aci789589] Or [aci789589]. As a new Temu   customer, you can save up to $100 using this promo code. For returning users, our Temu   promo code offers a $100 price slash on your next shopping spree. This is our way of saying thank you for shopping with us! Best Temu   Deals and Coupons [aci789589] Or [aci789589]: During 2025, Temu   coupon codes offer discounts of up to 90% on select items, making it possible for both new and existing users to get incredible deals. From $100 off deals to 100% discounts, our Temu   promo codes make shopping more affordable than ever. Temu   Coupon Code For $100% Off [aci789589] Or [aci789589]: For Both New And Existing Customers Free Temu   $100 Off Code — [aci789589] Or [aci789589] Temu Coupon 100% Off — [aci789589] Or [aci789589] Temu Memorial Day Sale - $100 Off — [aci789589] Or [aci789589] Temu Free Gift Code — [aci789589] Or [aci789589] Temu $500 Off Code — [aci789589 ] Or [aci789589] Best Temu   $200 Off Code — [aci789589 ] Or [aci789589] Temu Coupon Code first order — [aci789589] Or [aci789589] Temu Coupon Code for New user — [aci789589] Or [aci789589] Temu Coupon Code A$100 off — [aci789589] Or [aci789589] Temu Coupon Code $50 off — [aci789589] Or [aci789589] Temu Coupon Code $100 off — [aci789589] Or [aci789589] Temu Promo Code 2025 — [aci789589] Or [aci789589] Temu Coupon Code $200 off — [aci789589] Or [aci789589] Temu Coupon Code $90 off — [aci789589] Or [aci789589] Temu Sign up Bonus Code — [aci789589] Or [aci789589] Temu Coupon Code A$120 off — [aci789589] Or [aci789589] Our exclusive Temu   coupon code allows you to take a flat $200 off your purchase with an added 100% discount on top. As a new Temu   shopper, you can save up to $100 using code [aci789589] Or [aci789589]. Returning customers can also enjoy a $100 discount on their next purchases with this code. Temu Coupon Code for Your Country Sign-up Bonus Temu $100 Off Code  USA      [aci789589] Or [aci789589] - 100% off Temu $100 Off Code  USA     [aci789589] Or [aci789589] - 100% off Temu $100 Off Code USA  [aci789589] Or [aci789589] - 100% off Temu $100 Off Code Japan [aci789589] Or [aci789589] - 100% off Temu $100 Off Code Mexico [aci789589] Or [aci789589] - 100% off Temu $100 Off Code Chile [aci789589] Or [aci789589] - 100% off Temu $100 Off Code USA [aci789589] Or [aci789589] - 100% off Temu $100 Off Code Colombia [aci789589] Or [aci789589] - 100% off Temu $100 Off Code Malaysia [aci789589] Or [aci789589] - 100% off Temu $100 Off Code Philippines [aci789589] Or [aci789589] - 100% off Temu $100 Off Code South Korea [aci789589] Or [aci789589] - 100% off Temu $100 Off Code  USA      [aci789589] Or [aci789589] - 100% off Temu $100 Off Code Pakistan [aci789589] Or [aci789589] - 100% off Temu $100 Off Code Finland [aci789589] Or [aci789589] - 100% off Temu $100 Off Code Saudi Arabia [aci789589] Or [aci789589] - 100% off Temu $100 Off Code Qatar [aci789589] Or [aci789589] - 100% off Temu $100 Off Code France [aci789589] Or [aci789589] - 100% off Temu $100 Off Code Germany [aci789589] Or [aci789589] - 100% off Temu $100 Off Code  USA   [aci789589] Or [aci789589] - 100% off Temu $100 Off Code Israel [aci789589] Or [aci789589] - 100% off Get a $100 discount on your Temu   order with the promo code [aci789589] Or [aci789589]. You can get a discount by clicking on the item to purchase and entering this Temu   coupon code $100 off [aci789589] Or [aci789589]. Temu   Coupon Code [aci789589] Or [aci789589]: Get Up To 90% OFF In NOV 2025 Are you looking for the best Temu   coupon codes to get amazing discounts? Our Temu   coupons are perfect for getting those extra savings you crave. We regularly test our coupon codes for Temu   to ensure they work flawlessly, giving you a guaranteed discount every time. Temu   New User Coupon [aci789589] Or [aci789589]: Up To $100 OFF For First-Time Users Our Temu   first-time user coupon codes are designed just for new customers, offering the biggest discounts and the best deals currently available on Temu  . To maximize your savings, download the Temu   app and apply our Temu   new user coupon during checkout.
    • Hi everyone, I'm currently developing a Forge 1.21 mod for Minecraft and I want to display a custom HUD overlay for a minigame. My goal: When the game starts, all players should see an item/block icon (from the base game, not a custom texture) plus its name/text in the HUD – similar to how the bossbar overlay works. The HUD should appear centered above the hotbar (or at a similar prominent spot), and update dynamically (icon and name change as the target item changes). What I've tried: I looked at many online tutorials and several GitHub repos (e.g. SeasonHUD, MiniHUD), but most of them use NeoForge or Forge versions <1.20 that provide the IGuiOverlay API (e.g. implements IGuiOverlay, RegisterGuiOverlaysEvent). In Forge 1.21, it seems that neither IGuiOverlay nor RegisterGuiOverlaysEvent exist anymore – at least, I can't import them and they are missing from the docs and code completion. I tried using RenderLevelStageEvent as a workaround but it is probably not intended for custom HUDs. I am not using NeoForge, and switching the project to NeoForge is currently not an option for me. I tried to look at the original minecraft source code to see how elements like hearts, hotbar etc are drawn on the screen but I am too new to Minecraft modding to understand. What I'm looking for: What is the correct way to add a custom HUD element (icon + text) in Forge 1.21, given that the previous overlay API is missing? Is there a new recommended event, callback, or method in Forge 1.21 for custom HUD overlays, or is everyone just using a workaround? Is there a minimal open-source example repo for Forge 1.21 that demonstrates a working HUD overlay without relying on NeoForge or deprecated Forge APIs? My ideal solution: Centered HUD element with an in-game item/block icon (from the base game's assets, e.g. a diamond or any ItemStack / Item) and its name as text, with a transparent background rectangle. It should be visible to the players when the mini game is running. Easy to update the item (e.g. static variable or other method), so it can change dynamically during the game. Any help, code snippets, or up-to-date references would be really appreciated! If this is simply not possible right now in Forge 1.21, it would also help to know that for sure. Thank you very much in advance!
    • The simple answer is there is not an easy way. You would need to know how to program in Java, as well as at least some familiarity with how Forge works so you could port the differences. You would also need the sourcecode for the original mod, and permission from the author to modify it, if they did not use some sort of open source license. So it's not impossible, but it would take some effort, but doing so would open up a whole new world of possibilities for you!
    • Does it still crash if you remove holdmyitems? Looks like that mod doesn't work on a server as far as I can tell from the error.  
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

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