Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.