2015-04-11 20:13:31 +02:00
|
|
|
package techreborn.itemblocks;
|
|
|
|
|
|
|
|
import net.minecraft.block.Block;
|
2015-11-23 16:15:42 +01:00
|
|
|
import net.minecraft.block.state.IBlockState;
|
2015-04-11 20:13:31 +02:00
|
|
|
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.BlockPos;
|
|
|
|
import net.minecraft.util.EnumFacing;
|
2015-04-11 20:13:31 +02:00
|
|
|
import net.minecraft.world.World;
|
|
|
|
import techreborn.tiles.TileQuantumTank;
|
|
|
|
|
|
|
|
public class ItemBlockQuantumTank extends ItemBlock {
|
|
|
|
|
2015-08-09 12:05:32 +02:00
|
|
|
public ItemBlockQuantumTank(Block block) {
|
|
|
|
super(block);
|
|
|
|
}
|
2015-04-11 20:13:31 +02:00
|
|
|
|
2015-08-09 12:05:32 +02:00
|
|
|
@Override
|
2015-11-23 16:15:42 +01:00
|
|
|
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)) {
|
2015-08-09 12:05:32 +02:00
|
|
|
return false;
|
|
|
|
}
|
2015-11-23 16:15:42 +01:00
|
|
|
if (world.getBlockState(pos).getBlock() == block) {
|
|
|
|
world.getBlockState(pos).getBlock().onBlockPlacedBy(world, pos, newState, player,
|
2015-08-09 12:05:32 +02:00
|
|
|
stack);
|
2015-11-23 16:15:42 +01:00
|
|
|
// world.getBlockState(pos).getBlock().onPostBlockPlaced(world, x, y, z, metadata);
|
2015-08-09 12:05:32 +02:00
|
|
|
}
|
|
|
|
if (stack != null && stack.hasTagCompound()) {
|
2015-11-23 16:15:42 +01:00
|
|
|
((TileQuantumTank) world.getTileEntity(pos))
|
2015-08-09 12:05:32 +02:00
|
|
|
.readFromNBTWithoutCoords(stack.getTagCompound()
|
|
|
|
.getCompoundTag("tileEntity"));
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
2015-04-11 20:13:31 +02:00
|
|
|
}
|