Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.nukacraft.src;
- import java.util.List;
- import net.minecraft.client.Minecraft;
- import net.minecraft.creativetab.CreativeTabs;
- import net.minecraft.entity.Entity;
- import net.minecraft.entity.EntityLivingBase;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.init.Items;
- import net.minecraft.item.EnumAction;
- import net.minecraft.item.Item;
- import net.minecraft.item.ItemStack;
- import net.minecraft.nbt.NBTTagCompound;
- import net.minecraft.tileentity.TileEntity;
- import net.minecraft.world.World;
- import net.minecraftforge.fluids.ItemFluidContainer;
- import java.awt.Color;
- import org.lwjgl.input.Keyboard;
- import org.lwjgl.input.Mouse;
- import org.lwjgl.opengl.GL11;
- import com.sun.security.ntlm.Client;
- import cpw.mods.fml.relauncher.Side;
- import cpw.mods.fml.relauncher.SideOnly;
- public class Gun extends Item implements IActionPrimaryKey,IActionPrimaryKey2
- {
- public int var10 = 5;
- private String far = "Status Working";
- public Gun(int i)
- {
- super();
- super.maxStackSize = 1;
- setMaxDamage(6);
- this.setUnlocalizedName("colt");
- this.setCreativeTab(CreativeTabs.tabCombat);
- this.setTextureName(ModInf.MODID + ":" + "Gun");
- }
- public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, EntityPlayer par3Entityplayer, int par4, boolean par5){
- if (Keyboard.isKeyDown(Keyboard.KEY_R)) { NukaCraft.network.sendToServer(new MessageActionWeapons(3));
- }
- if(Mouse.isButtonDown(1))
- {
- var10 = 3;
- }
- else{
- var10 = 5;
- }
- }
- public boolean onEntitySwing(EntityLivingBase entityLiving, ItemStack stack) { return true; }
- public void onPlayerStoppedUsing(ItemStack itemstack, World world, EntityPlayer entityplayer, int i)
- {
- if (itemstack.stackTagCompound == null) {
- itemstack.stackTagCompound = new NBTTagCompound();
- itemstack.stackTagCompound.setInteger("kat", 0);
- }
- boolean flag = entityplayer.capabilities.isCreativeMode;
- if (itemstack.getItemDamage() < getMaxDamage())
- {
- NukaCraft.rabbut7 = 3.4F;
- int j = getMaxItemUseDuration(itemstack) - i;
- float f = 1.0F;
- NukaCraft.Faf= 30;
- EntityBullet entitybullet = new EntityBullet(world, entityplayer, 4, var10);
- world.playSoundAtEntity(entityplayer, "random.bow", 1.0F, 1.0F);
- itemstack.damageItem(1, entityplayer);
- if (!world.isRemote)
- {
- world.spawnEntityInWorld(entitybullet);
- }}
- }
- public ItemStack onFoodEaten(ItemStack itemstack, World world, EntityPlayer entityplayer)
- {
- return itemstack;
- }
- public int getMaxItemUseDuration(ItemStack itemstack)
- {
- return 0x11940;
- }
- public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
- {
- entityplayer.setItemInUse(itemstack, getMaxItemUseDuration(itemstack));
- return itemstack;
- }
- public void addInformation(ItemStack itemStack, EntityPlayer player, List list, boolean par4) {
- if (itemStack.stackTagCompound != null) {
- int var1 = itemStack.stackTagCompound.getInteger("kat");
- list.add("Повреждение " + String.valueOf(var1) +""+ (var1 == 1 ? "" : "%"));
- list.add("Урон"+var10);
- list.add("Тип:Пистолет");
- list.add("6 патрон(ов)");
- }
- }
- @SideOnly(Side.CLIENT)
- public void onReloadClient(ItemStack is, World world, EntityPlayer player, boolean isPress) {
- if (isPress) NukaCraft.network.sendToServer(new MessageActionWeapons(3));
- }
- public void reload(ItemStack is, World world, EntityPlayer player) {
- if (is.getItemDamage() >= 1 && player.inventory.hasItem(NukaCraft.Magnum41))
- {
- int k = getMaxItemUseDuration(is) - 1;
- float f1 = (float)k / 20F;
- f1 = (f1 * f1 + f1 * 2.0F) / 3F;
- if (f1 >= 1.0F)
- {
- is.setItemDamage(0);
- world.playSoundAtEntity(player, "random.bow", 1.0F, 1.0F);
- player.inventory.consumeInventoryItem(NukaCraft.Magnum41);
- is.getTagCompound().setInteger("kat", is.getTagCompound().getInteger("kat") + 2);
- }}
- else
- {
- world.playSoundAtEntity(player, "random.click", 1.0F, 1.0F);
- }
- }
- @SideOnly(Side.CLIENT)
- public void onButton_leftClient(ItemStack is, World world, EntityPlayer player, boolean isPress) {
- if (isPress) NukaCraft.net.sendToServer(new MessageActionWeapons2(3));
- }
- public void Button_left(ItemStack is, World world, EntityPlayer player) {
- //
- if (is.stackTagCompound == null) {
- is.stackTagCompound = new NBTTagCompound();
- is.stackTagCompound.setInteger("kat", 0);
- }
- boolean flag = player.capabilities.isCreativeMode;
- if (is.getItemDamage() < getMaxDamage())
- {
- NukaCraft.rabbut7 = 3.4F;
- int j = getMaxItemUseDuration(is) - 1;
- float f = 1.0F;
- NukaCraft.Faf= 30;
- EntityBullet entitybullet = new EntityBullet(world, player, 4, var10);
- world.playSoundAtEntity(player, "random.bow", 1.0F, 1.0F);
- is.damageItem(1, player);
- if (!world.isRemote)
- {
- world.spawnEntityInWorld(entitybullet);
- }}
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment