Files
TinkersConstruct/src/main/java/tconstruct/items/blocks/ItemBlockLandmine.java
T

91 lines
2.4 KiB
Java
Raw Normal View History

package tconstruct.items.blocks;
2013-07-27 17:03:16 +10:00
import java.util.List;
import java.util.Random;
2013-12-31 15:30:34 -05:00
import net.minecraft.block.Block;
2013-07-27 17:03:16 +10:00
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraft.util.StatCollector;
import tconstruct.blocks.logic.TileEntityLandmine;
2013-11-29 23:16:32 -05:00
import tconstruct.common.TRepo;
2013-07-27 17:03:16 +10:00
/**
*
* @author fuj1n
*
*/
2013-08-31 05:13:31 -07:00
public class ItemBlockLandmine extends ItemBlock
{
2013-12-31 15:30:34 -05:00
public ItemBlockLandmine(Block b)
2013-08-31 05:13:31 -07:00
{
2013-12-31 15:30:34 -05:00
super(b);
2013-08-31 05:13:31 -07:00
this.setHasSubtypes(true);
}
@Override
public void addInformation (ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
String interaction = null;
switch (par1ItemStack.getItemDamage())
{
case 0:
interaction = StatCollector.translateToLocal("landmine1.tooltip");
2013-08-31 05:13:31 -07:00
break;
case 1:
interaction = StatCollector.translateToLocal("landmine2.tooltip");
2013-08-31 05:13:31 -07:00
break;
case 2:
interaction = StatCollector.translateToLocal("landmine3.tooltip");
2013-08-31 05:13:31 -07:00
break;
default:
interaction = StatCollector.translateToLocal("landmine4.tooltip");
2013-08-31 05:13:31 -07:00
break;
}
2013-11-26 07:08:06 -05:00
par3List.add(StatCollector.translateToLocal("landmine5.tooltip") + interaction);
2013-08-31 05:13:31 -07:00
}
@Override
public int getMetadata (int par1)
{
return 0;
}
@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)
{
2014-01-16 01:36:18 -05:00
if (!world.func_147465_d(x, y, z, TRepo.landmine, metadata, 3))
2013-08-31 05:13:31 -07:00
{
return false;
}
2014-01-30 20:34:22 -05:00
if (world.func_147439_a(x, y, z) == TRepo.landmine)
2013-08-31 05:13:31 -07:00
{
2014-01-30 20:34:22 -05:00
TRepo.landmine.func_149689_a(world, x, y, z, player, stack);
2013-08-31 05:13:31 -07:00
2014-02-01 14:18:17 -05:00
TileEntityLandmine te = (TileEntityLandmine) world.func_147438_o(x, y, z);
2013-08-31 05:13:31 -07:00
if (te == null)
{
2013-11-29 23:16:32 -05:00
te = (TileEntityLandmine) TRepo.landmine.createTileEntity(world, metadata);
2013-08-31 05:13:31 -07:00
}
te.triggerType = stack.getItemDamage();
2014-02-01 14:18:17 -05:00
world.func_147455_a(x, y, z, te);
2013-08-31 05:13:31 -07:00
2014-01-30 20:34:22 -05:00
TRepo.landmine.func_149714_e(world, x, y, z, metadata);
2013-08-31 05:13:31 -07:00
}
return true;
}
public static Random getRandom ()
{
return itemRand;
}
2013-07-27 17:03:16 +10:00
}