Jump to content

[1.11] TileEntity Error heldItem.Item and heldItem.Size


ajose0538

Recommended Posts

Upgrade from 1.10 to 1.11

 

Help, on line 77 and 79 gives me an error for the text "heldItem.Item" and "heldItem.Size--;"

 

 

package com.modding.WillyWonka.blocks;

import java.util.List;

import com.modding.WillyWonka.Reference;
import com.modding.WillyWonka.WillyWonka;
import com.modding.WillyWonka.init.ModItems;
import com.modding.WillyWonka.tileentity.TileEntityJar;

import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;

public class BlockJar extends Block implements ITileEntityProvider {

// 1 / 16 = 0.0625

private static final AxisAlignedBB BOUNDING_BOX = new AxisAlignedBB(0.0625 * 4, 0, 0.0625 * 4, 0.0625 * 12,
		0.0625 * 8, 0.0625 * 12);
private static final AxisAlignedBB COLLISION_BOX = new AxisAlignedBB(0.0625 * 5, 0, 0.0625 * 5, 0.0625 * 13,
		0.0625 * 9, 0.0625 * 13);

public BlockJar() {
	super(Material.GLASS);
	setUnlocalizedName(Reference.WillyWonkanBlocks.JAR.getUnlocalizedName());
	setRegistryName(Reference.WillyWonkanBlocks.JAR.getRegistryName());
	setCreativeTab(WillyWonka.CREATIVE_TAB);
	setSoundType(SoundType.GLASS);
}

@Override
public boolean isFullBlock(IBlockState state) {
	return false;
}

@Override
public boolean isOpaqueCube(IBlockState state) {
	return false;
}

public BlockRenderLayer getBlockLayer() {
	return BlockRenderLayer.TRANSLUCENT;

}

@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
	return BOUNDING_BOX;
}

@Override
public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox,
		List<AxisAlignedBB> collidingBoxes, Entity entityIn) {
	super.addCollisionBoxToList(pos, entityBox, collidingBoxes, COLLISION_BOX);

}

@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn,
		EnumHand hand, EnumFacing heldItem, float side, float hitX, float hitY) {
	if (!worldIn.isRemote) {
		TileEntity tileEntity = worldIn.getTileEntity(pos);
		if (tileEntity instanceof TileEntityJar) {
			TileEntityJar jar = (TileEntityJar) tileEntity;
			if (heldItem.Item() == ModItems.chocolate) {
				if (jar.addChocolate()) {
					heldItem.Size--;

				}

			}
		}

	}

	return true;
}

@Override
public TileEntity createNewTileEntity(World worldIn, int meta) {
	return new TileEntityJar();
}

}

Link to comment
Share on other sites

Look at the ItemStack class to find the new getters and setters.

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.