Jump to content

Recommended Posts

Posted

Derp, me being blind. You need your modId prefixed before your texture name in the texture name:

*modID*:*block name*

 

Hmm, I'm having the exact same problem with the break particles.  Here are my classes:

 

BlockUnknownEgg:

package com.caske2000.carnivores.blocks;

import com.caske2000.carnivores.Carnivores;
import com.caske2000.carnivores.tileentities.TileEntityUnknownEgg;

import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;

public class BlockUnknownEgg extends BlockContainer {

protected BlockUnknownEgg(Material material) {
	super(material);
	this.setHardness(2.0F);
	this.setResistance(5.0F);
	this.setCreativeTab(Carnivores.carnivoresTab);
	this.setBlockBounds(0F, 0F, 0F, 1.0F, 1.125F, 1.0F);
}

public int getRenderType()
{
	return -1;

}

public boolean isOpaqueCube(){
	return false;
}

public boolean renderAsNormalBlock()
{
	return false;
}

@Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {

	return new TileEntityUnknownEgg();
}

}

 

RenderUnknownEgg:

 

package com.caske2000.carnivores.render;

import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;

import org.lwjgl.opengl.GL11;

import com.caske2000.carnivores.model.ModelUnknownEgg;
import com.caske2000.carnivores.reference.Reference;

public class RenderUnknownEgg extends TileEntitySpecialRenderer{

private static final ResourceLocation texture = new ResourceLocation(Reference.MODID + ":" + "textures/blocks/unknownEgg.png");

private ModelUnknownEgg model;

public RenderUnknownEgg() {
	this.model = new ModelUnknownEgg();
}

@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
	GL11.glPushMatrix();
	GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
	GL11.glRotatef(180, 0F, 0F, 1F);
	this.bindTexture(texture);

	GL11.glPushMatrix();
	this.model.renderModel(0.0625F);
	GL11.glPopMatrix();

	GL11.glPopMatrix();

}

}

Posted

Did you set it to the same texture as the one for the model? If so, what are its dimensions?

 

Actually, I erred in that respect.  The block texture was for a custom modeled block, modeled with Techne and the texture was set through the ResourceLocation field.  The dimensions of the texture are 128x128.  As it is a Techne model, it required such dimensions.

Posted

Make 2 textures, one for the techne model, and a 16x16 normal block texture that will show up as the particles. Sort of like how chests display oak wood particles when they are broken.

Check out my mod, Realms of Chaos, here.

 

If I helped you, be sure to press the "Thank You" button!

Posted

Ok, that's all done and over with.  Now a new problem.  I set up the block to render in hand, and it renders completely invisible.  I made sure to register the TileEntity as well. 

 

ItemRenderUnknownEggOpen.java:

package com.caske2000.carnivores.render;

import org.lwjgl.opengl.GL11;

import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.client.IItemRenderer;

public class ItemRenderUnknownEggOpen implements IItemRenderer {

TileEntitySpecialRenderer render;
private TileEntity entity;

public ItemRenderUnknownEggOpen(TileEntitySpecialRenderer render, TileEntity entity){
	this.entity = entity;
	this.render = render;
}


@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
	// TODO Auto-generated method stub
	return true;
}

@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item,
		ItemRendererHelper helper) {
	// TODO Auto-generated method stub
	return true;
}

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
	if(type == IItemRenderer.ItemRenderType.ENTITY){
		GL11.glTranslatef(-0.5F, 0.0F, -0.5F);
		this.render.renderTileEntityAt(this.entity, 0.0D, 0.0D, 0.0D, 0.0F);
	}

}

}

Posted

I've got exactly the same type of code, of course referring to my block.

 

Edit:  Redid the last method similar to EternalDoom's class(with my fields of course), and it renders correctly in hand.  Thank you Eternal.

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.