Jump to content

Custom Iron Bars help!


Recommended Posts

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.




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

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(itemStack.getItem() instanceof ItemFile)
			TileEntityIronBarFile te = (TileEntityIronBarFile) world.getTileEntity(x, y, z);
			te.triesRemaining -=1;
			if(te.triesRemaining == 0)
				world.setBlockToAir(x, y, z);
				tex = "portalcube:blockIronBarsBroke" + te.triesRemaining;

			return true;
	return false;

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

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



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.

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.


  • Create New...

Important Information

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