Jump to content

[1.5.2] TileEntity Block missing texture


DoorCloser

Recommended Posts

I've made everything correct, i have no errors. But when i spawn my block( which supposed to be TileEntity ), it spawns only a missing texture block. I'll get codes here:

 

BlockXenTree

package doorcloser.modding;

import java.util.ArrayList;
import java.util.Random;

import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.registry.LanguageRegistry;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;


public class BlockXenTree extends Block {
public static int renderType;
public BlockXenTree(int par1, String texture) 
{
	super(par1, Material.ground);
	setCreativeTab(mod_HalflifeMod.tabxen);
}

public int idDropped(int i, Random random, int j) {
	return mod_HalflifeMod.xeniantree.blockID;
}
public int quantityDropped(Random random) {
	return 1;
}

public void setBlockBoundsBasedOnState(IBlockAccess iblockacess, int i, int j, int k) 
{
	setBlockBounds(0.0F, 0.0F, 0.0F, 1F, 1F, 1F);
}

public void getCollidingBoundingBoxes(World world, int i, int j, int k, AxisAlignedBB axisalignedbb, ArrayList arraylist) 
{
	setBlockBounds(0.3F, 0.3F, 0.03F, 0.7F, 0.7F, 0.7F);

}
public boolean renderAsNormalBlock()
{
	return false;

}
public boolean isOpaqueCube()
{
	return false;
}
public String getTextureFIle(){
	return "/textures/blocks/xeniantree.png";
}
}

 

ModelXenTree

package doorcloser.modding;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.monster.EntityIronGolem;
import net.minecraft.util.MathHelper;

@SideOnly(Side.CLIENT)
public class ModelXenTree extends ModelBase {

// fields
ModelRenderer main;
ModelRenderer forebody;
ModelRenderer clawa;
ModelRenderer clawb;
ModelRenderer clawc;
ModelRenderer clawmain;

public ModelXenTree() {
	textureWidth = 64;
	textureHeight = 128;

	main = new ModelRenderer(this, 0, 0);
	main.addBox(0F, 0F, 0F, 11, 24, 11);
	main.setRotationPoint(-5.5F, 0F, -4F);
	main.setTextureSize(64, 128);
	main.mirror = true;
	setRotation(main, 0F, 0F, 0F);
	forebody = new ModelRenderer(this, -1, 99);
	forebody.addBox(0F, 0F, 0.2F, 9, 14, 9);
	forebody.setRotationPoint(-4.5F, -13F, -3F);
	forebody.setTextureSize(64, 128);
	forebody.mirror = true;
	setRotation(forebody, -0.0743572F, 0F, 0F);
	clawa = new ModelRenderer(this, 0, 40);
	clawa.addBox(-3.5F, -9.8F, -3F, 7, 10, ;
	clawa.setRotationPoint(0F, -11.5F, 1F);
	clawa.setTextureSize(64, 128);
	clawa.mirror = true;
	setRotation(clawa, 0.2617994F, 0F, 0F);
	clawb = new ModelRenderer(this, 0, 63);
	clawb.addBox(-3F, -11F, -10F, 6, 5, 9);
	clawb.setRotationPoint(0F, -11.5F, 1F);
	clawb.setTextureSize(64, 128);
	clawb.mirror = true;
	setRotation(clawb, 0F, 0F, 0F);
	clawc = new ModelRenderer(this, 0, 80);
	clawc.addBox(-2.5F, -13F, -17F, 5, 3, 13);
	clawc.setRotationPoint(0F, -11.5F, 1F);
	clawc.setTextureSize(64, 128);
	clawc.mirror = true;
	setRotation(clawc, 0.4089647F, 0F, 0F);
	clawmain = new ModelRenderer(this, 39, 82);
	clawmain.addBox(-1F, 5.8F, -20.5F, 2, 12, 2);
	clawmain.setRotationPoint(0F, -11.5F, 1F);
	clawmain.setTextureSize(64, 128);
	clawmain.mirror = true;
	setRotation(clawmain, -0.5205006F, 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);
	main.render(f5);
	forebody.render(f5);
	clawa.render(f5);
	clawb.render(f5);
	clawc.render(f5);
	clawmain.render(f5);
}

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

}

TileEntityXenTree

package doorcloser.modding;

import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.Packet;
import net.minecraft.network.packet.Packet132TileEntityData;
import net.minecraft.tileentity.TileEntity;

public class TileEntityXenTree extends TileEntity {


public void writeToNBT(NBTTagCompound nbt) {
	super.writeToNBT(nbt);
}

public void readFromNBT(NBTTagCompound nbt) {
	super.readFromNBT(nbt);
}

public Packet getDescriptionPacket() {
	NBTTagCompound nbtTag = new NBTTagCompound();
	this.writeToNBT(nbtTag);
	return new Packet132TileEntityData(this.xCoord, this.yCoord,
			this.zCoord, 1, nbtTag);
}

public void onDataPacket(INetworkManager net, Packet132TileEntityData packet) {
	readFromNBT(packet.customParam1);
}
}

 

TileEntityXenTreeRenderer

package doorcloser.modding;

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

import org.lwjgl.opengl.GL11;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

@SideOnly(Side.CLIENT)
public class TileEntityXenTreeRenderer extends TileEntitySpecialRenderer{
ModelXenTree model = new ModelXenTree();
public void renderAModelAt(TileEntityXenTree tileentity, double d, double d1, double d2, float f)
    {  
        GL11.glPushMatrix();
        GL11.glTranslatef((float)d + 0.5F, (float)d1 + 0.5F, (float)d2 + 0.5F);
        GL11.glPushMatrix();
        GL11.glPopMatrix();    
        GL11.glPopMatrix();                    
    }

    public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2,
            float f)
    {
        renderAModelAt((TileEntityXenTree)tileentity, d, d1, d2, f);
    }
}

 

My mod "piece of code"

xeniantree = new BlockXenTree(2021, "xeniantree")
			.setUnlocalizedName("xeniantree")
			.setHardness(8.0F)
			.setResistance(4.0F)
			.setStepSound(Block.soundStoneFootstep);
			GameRegistry.registerTileEntity(doorcloser.modding.TileEntityXenTree.class, "xeniantree");
			ClientRegistry.bindTileEntitySpecialRenderer(doorcloser.modding.TileEntityXenTree.class, new TileEntityXenTreeRenderer());
			GameRegistry.registerBlock(xeniantree, "xeniantree");
			LanguageRegistry.addName(xeniantree, "Xenian Tree");

 

Repeat: It only spawns a missing textured block. But i have get my textures inside of minecraft.jar. They are looking different than basic block textures(not 16 to 16 but 128 to 64). So what am i suppose to do? Help please.

Link to comment
Share on other sites

setTextureName(...)?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Look at vanilla.  Specifically in the Block class.  Look at how it defines each block.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Look at vanilla.  Specifically in the Block class.  Look at how it defines each block.

 

Do you really think i understand your hints? I dont understand what i suppose to do. I've get all codes here, you havent said that something wrong with them. What is Vanilla and how i can find it in Block class. Vanilla is moded minecraft, isnt it? Where can i find a string, that defines each block? Could you explain more detailed, please.

Link to comment
Share on other sites

Look at vanilla.  Specifically in the Block class.  Look at how it defines each block.

What is Vanilla and how i can find it in Block class. Vanilla is moded minecraft, isnt it?

 

http://www.urbandictionary.com/define.php?term=vanilla

Preferring an activity or thing in its basic and unmodified state.

It's the original of something, like the original Ice Cream flavour. In computergames the original game is called classic or vanilla

 

You have to tell where is the texture:

 

Minecraft.getMinecraft().renderEngine.bindTexture("modID:textures/entities/textureName.png");

 

While not technically wrong, that's not how it's done for blocks.

 

Here's how Minecraft handles stone:

 

public static final Block stone = (new BlockStone(1)).setHardness(1.5F).setResistance(10.0F).setStepSound(soundStoneFootstep).setUnlocalizedName("stone").setTextureName("stone");

 

Bonus hint:

 

    public void registerIcons(IconRegister par1IconRegister)
    {
        this.blockIcon = par1IconRegister.registerIcon(this.getTextureName());
    }

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

You have to tell where is the texture:

 

Minecraft.getMinecraft().renderEngine.bindTexture("modID:textures/entities/textureName.png");

 

While not technically wrong, that's not how it's done for blocks.

 

Here's how Minecraft handles stone:

 

public static final Block stone = (new BlockStone(1)).setHardness(1.5F).setResistance(10.0F).setStepSound(soundStoneFootstep).setUnlocalizedName("stone").setTextureName("stone");

 

Bonus hint:

 

    public void registerIcons(IconRegister par1IconRegister)
    {
        this.blockIcon = par1IconRegister.registerIcon(this.getTextureName());
    }

 

It's for normal blocks (a full cube), but i think that if it has a custom Renderer class, then it isn't a normal block, isn't it?

Link to comment
Share on other sites

It's for normal blocks (a full cube), but i think that if it has a custom Renderer class, then it isn't a normal block, isn't it?

 

You are correct sir.  Somewhere along the way that fact slipped my mind.

Only so many "textures not working" threads you can remember the exact answers to.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

It's for normal blocks (a full cube), but i think that if it has a custom Renderer class, then it isn't a normal block, isn't it?

 

You are correct sir.  Somewhere along the way that fact slipped my mind.

Only so many "textures not working" threads you can remember the exact answers to.

 

I dont think the whole problem is in textures only. Code is really messed up. I cant find any good tutorials on 1.5.2 version or similar. I followed some minecraftforge wiki tutorials and that couldnt help too.Is there any other tutorials on how to create TileEntity block?

Link to comment
Share on other sites

I dont think the whole problem is in textures only. Code is really messed up. I cant find any good tutorials on 1.5.2 version or similar. I followed some minecraftforge wiki tutorials and that couldnt help too.Is there any other tutorials on how to create TileEntity block?

 

"Code is really messed up" tells us nothing specific.

There are tutorials for 1.5.2 but most of the good ones have been updated to 1.6.4.

 

http://www.minecraftforge.net/wiki/Basic_Tile_Entity

 

Should work with minor changes to back-date to 1.5.2

Link to comment
Share on other sites

I've also got an open source mod with a TileEntity and SpecialRenderer

https://github.com/Draco18s/Artifacts

 

(Look for the DisplayPedestal)

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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