Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class ItemBlockCoalGun extends ItemBlock {
- public ItemBlockCoalGun() {
- super(UnLogicII.coal_gun);
- setMaxStackSize(1);
- setUnlocalizedName("coal_gun");
- }
- @Override
- public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn)
- {//shoots the coal type the user is currently on
- if(ExtendedPlayer.get(playerIn).getAmmoType() == EnumAmmo.COAL){
- worldIn.spawnEntityInWorld(new EntityCoal(worldIn, playerIn));
- }
- return itemStackIn;
- }
- @Override
- public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker)
- {
- if(((EntityPlayer)attacker).capabilities.isCreativeMode || ((EntityPlayer)attacker).inventory.consumeInventoryItem(Items.gunpowder)){
- if(((EntityPlayer)attacker).capabilities.isCreativeMode || ((EntityPlayer)attacker).inventory.consumeInventoryItem(Items.gunpowder)){
- target.worldObj.createExplosion(null, (attacker.posX + target.posX)/2, (attacker.posY + target.posY)/2, (attacker.posZ + target.posZ)/2, 2, false);
- return true;
- }else{
- target.worldObj.createExplosion(null, (attacker.posX + target.posX)/2, (attacker.posY + target.posY)/2, (attacker.posZ + target.posZ)/2, 1, false);
- return true;
- }
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement