2015-04-11 20:08:22 +02:00
|
|
|
package techreborn.itemblocks;
|
|
|
|
|
2015-11-23 15:40:30 +01:00
|
|
|
import net.minecraftforge.fml.relauncher.Side;
|
|
|
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
2015-04-11 20:08:22 +02:00
|
|
|
import net.minecraft.block.Block;
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
import net.minecraft.item.ItemBlock;
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraft.world.World;
|
|
|
|
import techreborn.init.ModBlocks;
|
|
|
|
import techreborn.tiles.TileQuantumChest;
|
2015-07-02 20:51:24 +02:00
|
|
|
|
|
|
|
import java.util.List;
|
2015-04-11 20:08:22 +02:00
|
|
|
|
|
|
|
public class ItemBlockQuantumChest extends ItemBlock {
|
|
|
|
|
2015-08-09 12:05:32 +02:00
|
|
|
public ItemBlockQuantumChest(Block p_i45328_1_) {
|
|
|
|
super(p_i45328_1_);
|
|
|
|
}
|
2015-04-24 15:20:09 +02:00
|
|
|
|
2015-08-09 12:05:32 +02:00
|
|
|
@SuppressWarnings(
|
|
|
|
{"rawtypes", "unchecked"})
|
|
|
|
@Override
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
public void addInformation(ItemStack stack, EntityPlayer player, List list,
|
|
|
|
boolean par4) {
|
|
|
|
if (stack != null && stack.hasTagCompound()) {
|
|
|
|
if (stack.getTagCompound().getCompoundTag("tileEntity") != null)
|
|
|
|
list.add(stack.getTagCompound().getCompoundTag("tileEntity")
|
|
|
|
.getInteger("storedQuantity")
|
|
|
|
+ " items");
|
|
|
|
}
|
|
|
|
}
|
2015-04-24 15:20:09 +02:00
|
|
|
|
2015-08-09 12:05:32 +02:00
|
|
|
@Override
|
|
|
|
public boolean placeBlockAt(ItemStack stack, EntityPlayer player,
|
|
|
|
World world, int x, int y, int z, int side, float hitX, float hitY,
|
|
|
|
float hitZ, int metadata) {
|
|
|
|
if (!world.setBlock(x, y, z, ModBlocks.quantumChest, metadata, 3)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (world.getBlock(x, y, z) == ModBlocks.quantumChest) {
|
|
|
|
world.getBlock(x, y, z).onBlockPlacedBy(world, x, y, z, player,
|
|
|
|
stack);
|
|
|
|
world.getBlock(x, y, z).onPostBlockPlaced(world, x, y, z, metadata);
|
|
|
|
}
|
|
|
|
if (stack != null && stack.hasTagCompound()) {
|
|
|
|
((TileQuantumChest) world.getTileEntity(x, y, z))
|
|
|
|
.readFromNBTWithoutCoords(stack.getTagCompound()
|
|
|
|
.getCompoundTag("tileEntity"));
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
2015-04-11 20:08:22 +02:00
|
|
|
}
|