Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
- // Jad home page: http://www.kpdus.com/jad.html
- // Decompiler options: packimports(3) braces deadcode
- package net.minecraft.src;
- import java.io.PrintStream;
- import java.util.List;
- import java.util.Random;
- import net.minecraft.client.Minecraft;
- public class PaintballEntityClaymores extends PaintballEntityObjects
- {
- float anglerange;
- public PaintballEntityClaymores(World world)
- {
- super(world);
- setSize(0.5F, 0.5F);
- moveSpeed = 0.0F;
- health = 1;
- hasAttacked = false;
- isImmuneToFire = true;
- }
- public PaintballEntityClaymores(World world, boolean color, double d, double d1, double d2)
- {
- this(world);
- setPosition(d, d1, d2);
- motionX = 0.0D;
- motionY = 0.0D;
- motionZ = 0.0D;
- prevPosX = d;
- prevPosY = d1;
- prevPosZ = d2;
- claymore_isRed = color;
- EntityPlayer entity = findPlayerToWub();
- if(entity != null)
- {
- faceEntity(entity, 180F, 180F);
- rotationYaw -= 180;
- renderYawOffset = rotationYaw;
- }
- }
- protected EntityPlayer findPlayerToWub()
- {
- EntityPlayer entityplayer = worldObj.getClosestPlayerToEntity(this, 16D);
- if(entityplayer != null && canEntityBeSeen(entityplayer))
- {
- return entityplayer;
- } else
- {
- return null;
- }
- }
- public void onUpdate()
- {
- super.onUpdate();
- List list1;
- if(!claymore_isRed)
- {
- texture = "/PaintballPics/blueclaymore.png";
- List list1 = worldObj.getEntitiesWithinAABBExcludingEntity(this, boundingBox.expand(0.0D, 0.0D, 0.0D));
- } else {
- texture = "/PaintballPics/redclaymore.png";
- List list1 = worldObj.getEntitiesWithinAABBExcludingEntity(this, boundingBox.expand(0.0D, 0.0D, 0.0D));
- }
- for(int x = 0; x < list1.size(); x++)
- {
- Entity entity1 = (Entity)list1.get(x);
- double playerangle=Math.toDegrees(Math.atan2(entity1.posZ-this.posZ,entity1.posX - this.posX)); //java.lang.Math
- playerangle = playerangle < 0 ? playerangle + 180F : playerangle; //justify both to > 0 just in case
- rotationYaw = rotationYaw < 0 ? rotationYaw + 180F : rotationYaw;
- if(playerangle < rotationYaw-anglerange) continue;
- if(playerangle > rotationYaw+anglerange) continue;
- if(entity1 instanceof EntityPlayer)
- {
- EntityPlayer player = (EntityPlayer)entity1;
- boolean notsameteam = (claymore.isRed && (player.inventory.armorInventory[3] == null || player.inventory.armorInventory[3].itemID != mod_Paintball.RedHelmet.shiftedIndex
- || player.inventory.armorInventory[2] == null || player.inventory.armorInventory[2].itemID != mod_Paintball.RedPlate.shiftedIndex
- || player.inventory.armorInventory[1] == null || player.inventory.armorInventory[1].itemID != mod_Paintball.RedLegs.shiftedIndex
- || player.inventory.armorInventory[0] == null || player.inventory.armorInventory[0].itemID != mod_Paintball.RedBoots.shiftedIndex))
- ||
- (!claymore.isRed && (player.inventory.armorInventory[3] == null || player.inventory.armorInventory[3].itemID != mod_Paintball.BlueHelmet.shiftedIndex
- || player.inventory.armorInventory[2] == null || player.inventory.armorInventory[2].itemID != mod_Paintball.BluePlate.shiftedIndex
- || player.inventory.armorInventory[1] == null || player.inventory.armorInventory[1].itemID != mod_Paintball.BlueLegs.shiftedIndex
- || player.inventory.armorInventory[0] == null || player.inventory.armorInventory[0].itemID != mod_Paintball.BlueBoots.shiftedIndex));
- if(notsameteam)
- {
- entity1.attackEntityFrom(DamageSource.causePlayerDamage(player), 10);
- explode();
- }
- }
- else
- {
- entity1.attackEntityFrom(DamageSource.generic, 10);
- explode();
- }
- }
- }
- private void explode()
- {
- for(int jack = 0; jack < 60; jack++)
- {
- double d1, d2, d3, d4, d5, d6;
- d1 = posX + ((rand.nextFloat() - rand.nextFloat()) * 0.125F);
- d2 = boundingBox.minY + 0.25F + ((rand.nextFloat() - rand.nextFloat()) * 0.125F);
- d3 = posZ + ((rand.nextFloat() - rand.nextFloat()) * 0.125F);
- double g1 = (double)jack * 0.25D;
- double g2 = 0.075D + ((double)jack * 0.01D);
- d4 = Math.sin(g1) * g2;
- d5 = (rand.nextFloat() - rand.nextFloat()) * 0.3D;
- d6 = Math.cos(g1) * g2;
- String stringy = (rand.nextInt(5) < 3 ? "explode" : "smoke");
- worldObj.spawnParticle(stringy, d1, d2, d3, d4, d5, d6);
- }
- worldObj.playSoundEffect(posX, posY, posZ, "random.explode", 1F, (1.0F + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) * 0.2F) * 0.7F);
- setEntityDead();
- }
- public void writeEntityToNBT(NBTTagCompound nbttagcompound)
- {
- nbttagcompound.setBoolean("Color", claymore_isRed);
- }
- public void readEntityFromNBT(NBTTagCompound nbttagcompound)
- {
- claymore_isRed = nbttagcompound.getBoolean("Color");
- }
- protected int getDropItemId()
- {
- if(claymore_isRed)
- {
- entityDropItem(new ItemStack(mod_Paintball.PaintballClaymoreRed), 0.0F);
- }
- else
- {
- entityDropItem(new ItemStack(mod_Paintball.PaintballClaymoreBlue), 0.0F);
- }
- return 0;
- }
- public boolean claymore_isRed;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement