TechReborn/src/main/java/techreborn/itemblocks/ItemBlockQuantumTank.java

43 lines
1.2 KiB
Java
Raw Normal View History

package techreborn.itemblocks;
import net.minecraft.block.Block;
2015-11-23 16:15:42 +01:00
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
2015-11-23 16:15:42 +01:00
import net.minecraft.util.EnumFacing;
2016-03-15 09:13:05 +01:00
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import techreborn.tiles.TileQuantumTank;
2016-03-24 01:39:26 +01:00
public class ItemBlockQuantumTank extends ItemBlock
{
2016-03-24 01:39:26 +01:00
public ItemBlockQuantumTank(Block block)
{
super(block);
}
2016-03-24 01:39:26 +01:00
@Override
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side,
float hitX, float hitY, float hitZ, IBlockState newState)
{
if (!world.setBlockState(pos, newState))
{
return false;
}
if (world.getBlockState(pos).getBlock() == block)
{
world.getBlockState(pos).getBlock().onBlockPlacedBy(world, pos, newState, player, stack);
// world.getBlockState(pos).getBlock().onPostBlockPlaced(world, x,
// y, z, metadata);
}
if (stack != null && stack.hasTagCompound())
{
((TileQuantumTank) world.getTileEntity(pos))
.readFromNBTWithoutCoords(stack.getTagCompound().getCompoundTag("tileEntity"));
}
return true;
}
}