Jump to content

Recommended Posts

Posted

Hello, I am trying to make an iron bars block that can be filed away by a file item. But through using BlockPane as my super class, I get this error upon placing the block in the world or entering a world with the block already placed.

 

http://pastebin.com/S1XS4e8r

 

Heres my code:

package io.github.keegandeathman.portalcube.blocks;

import io.github.keegandeathman.portalcube.items.ItemFile;
import io.github.keegandeathman.portalcube.tileentity.TileEntityIronBarFile;
import net.minecraft.block.Block;
import net.minecraft.block.BlockPane;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;

public class BlockIronBarsFile extends BlockPane implements ITileEntityProvider
{

private static String tex = "portalcube:blockIronBars";

public BlockIronBarsFile(Material p_i45394_1_) 
{
	super("portalcube:blockIronBarsBroke", "portalcube:blockIronBarsBroke", p_i45394_1_, false);
	// TODO Auto-generated constructor stub
}


@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par5, float par6, float par7, float par8)
{
	ItemStack itemStack = player.getCurrentEquippedItem();
	if(!world.isRemote)
	{
		if(itemStack.getItem() instanceof ItemFile)
		{
			TileEntityIronBarFile te = (TileEntityIronBarFile) world.getTileEntity(x, y, z);
			te.triesRemaining -=1;
			if(te.triesRemaining == 0)
			{
				world.setBlockToAir(x, y, z);
			}
			else
			{
				tex = "portalcube:blockIronBarsBroke" + te.triesRemaining;
			}

			System.out.println(te.triesRemaining);
			return true;
		}
	}
	return false;
}


@Override
public void registerBlockIcons(IIconRegister par1IconRegister)
    {
        // blockIcon - blockIcon
        this.blockIcon = par1IconRegister.registerIcon(tex);
    }


@Override
public TileEntity createNewTileEntity(World var1, int var2) {
	// TODO Auto-generated method stub
	return new TileEntityIronBarFile();
}

}

[shadow=gray,left][glow=red,2,300]KEEGAN[/glow][/shadow]

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.