Advertisement
Corosus

Untitled

Dec 7th, 2011
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 6.28 KB | None | 0 0
  1. package net.minecraft.src;
  2. // Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
  3.  
  4. import java.util.List;
  5.  
  6. public class EntityPlayerProxy extends EntityZombie {
  7.  
  8.     public MovingObjectPosition aimHit = null;
  9.     public int blockID = Block.ladder.blockID;
  10.    
  11.     public InventoryPlayer inventory;
  12.     //public ItemStack[] mainInventory = new ItemStack[36];
  13.     //public ItemStack[] armorInventory = new ItemStack[4];
  14.    
  15.     public EntityPlayer fakePlayer;
  16.    
  17.     public EntityPlayerProxy(World world) {
  18.         super(world);
  19.         swingArm = false;
  20.         swingTick = 0;
  21.         texture = "/mob/zombie.png";
  22.         moveSpeed = 0.8F;
  23.         attackStrength = 5;
  24.         health = 40;
  25.         try {
  26.             fakePlayer = new EntityPlayerSP(ModLoader.getMinecraftInstance(), world, ModLoader.getMinecraftInstance().session, world.worldProvider.worldType);
  27.         } catch (Exception ex) {
  28.             return;
  29.         }
  30.         inventory = new InventoryPlayer(fakePlayer);
  31.         inventory.mainInventory[0] = new ItemStack(Item.snowball, 32);
  32.         inventory.mainInventory[1] = new ItemStack(Item.arrow, 64);
  33.        
  34.         //use canClimb() instead
  35.         //pf.canClimb = true;
  36.     }
  37.    
  38.     public boolean canClimb() {
  39.         return true;
  40.     }
  41.    
  42.     public boolean shouldFaceTarget() {
  43.  
  44.     public void onLivingUpdate() {
  45.        
  46.         aimHit = rayTrace(1.0D, 1.0F);
  47.        
  48.         if(!handleWaterMovement()/* && !mod_MinerZombie.isSameTeam(this)*/) {
  49.             forcejump = false;
  50.             mineDelay--;
  51.  
  52.             if(mineDelay < 1 && noMoveTicks > 10) {
  53.                 mineDelay = 3;
  54.                 mining = true;
  55.                 if (entityToAttack instanceof EntityLiving) {
  56.                     ItemStack itemToUse = inventory.mainInventory[0];
  57.                     if (itemToUse.getItem() instanceof ItemBlock) {
  58.                     //mod_MinerZombie.tryDig(this, (EntityLiving)entityToAttack);
  59.                         if (aimHit != null && aimHit.typeOfHit == EnumMovingObjectType.TILE) {
  60.                             if (worldObj.getBlockId(aimHit.blockX, aimHit.blockY, aimHit.blockZ) != 0 && worldObj.getBlockId(aimHit.blockX, aimHit.blockY, aimHit.blockZ) != Block.ladder.blockID) {
  61.                                 sync();
  62.                                 //int var8 = itemToUse.getBlockId(var4, var5, var6);
  63.                                 if (!itemToUse.useItem(fakePlayer, worldObj, aimHit.blockX, aimHit.blockY, aimHit.blockZ, aimHit.sideHit)) {
  64.                                     useInvItem(itemToUse);
  65.                                    
  66.                                 }
  67.                                 setPrjOwner();
  68.                                 //System.out.println(worldObj.loadedEntityList.get(worldObj.loadedEntityList.size()-1));
  69.                                 //itemToUse.useItem(itemToUse, this, this.worldObj, aimHit.blockX, aimHit.blockY, aimHit.blockZ, aimHit.sideHit);
  70.                             }
  71.                         }
  72.                     } else {
  73.                         useInvItem(itemToUse);
  74.                         setPrjOwner();
  75.                     }
  76.                 }
  77.             }
  78. //aimHit.entityHit
  79.             info = noMoveTicks;
  80.         } else {
  81.             if(this.isCollidedHorizontally && !forcejump) {
  82.                 this.isJumping = true;
  83.             } else {
  84.                 this.isJumping = false;
  85.             }
  86.         }
  87.  
  88.         if(worldObj.isDaytime()) {
  89.             float f = getEntityBrightness(1.0F);
  90.  
  91.             if(f > 0.5F && worldObj.canBlockSeeTheSky(MathHelper.floor_double(posX), MathHelper.floor_double(posY), MathHelper.floor_double(posZ)) && rand.nextFloat() * 30F < (f - 0.4F) * 2.0F) {
  92.                 func_40046_d(15);
  93.             }
  94.         }
  95.  
  96.         /*if(!mod_MinerZombie.hostilesBreakWallsB.get()) {
  97.             setEntityDead();
  98.         }*/
  99.  
  100.         if(swingArm) {
  101.             swingTick++;
  102.  
  103.             if(swingTick == 8) {
  104.                 swingTick = 0;
  105.                 swingArm = false;
  106.             }
  107.         } else {
  108.             swingTick = 0;
  109.         }
  110.  
  111.         swingProgress = (float)swingTick / 8F;
  112.        
  113.        
  114.        
  115.         super.onLivingUpdate();
  116.     }
  117.    
  118.     public void useInvItem(ItemStack itemstack) {
  119.         sync();
  120.         itemstack.useItemRightClick(worldObj, fakePlayer);
  121.     }
  122.    
  123.     public void setPrjOwner() {
  124.         Entity ent = (Entity)worldObj.loadedEntityList.get(worldObj.loadedEntityList.size()-1);
  125.         if (ent instanceof EntityThrowable) {
  126.             try {
  127.                 ModLoader.setPrivateValue(EntityThrowable.class, ent, "field_40083_c", this);
  128.             } catch (Exception ex) {
  129.                
  130.             }
  131.         } else if (ent instanceof EntityArrow) {
  132.             ((EntityArrow) ent).shootingEntity = this;
  133.         }
  134.         //System.out.println(worldObj.loadedEntityList.get(worldObj.loadedEntityList.size()-1));
  135.     }
  136.    
  137.     public void sync() {
  138.         fakePlayer.posX = posX;
  139.         fakePlayer.posY = posY;
  140.         fakePlayer.posZ = posZ;
  141.         fakePlayer.rotationPitch = this.rotationPitch;
  142.         fakePlayer.rotationYaw = this.rotationYaw;
  143.         fakePlayer.inventory = inventory;
  144.        
  145.     }
  146.    
  147.     public void tryPlace(EntityCreature entityliving, EntityLiving entityliving1) {
  148.    
  149.     public boolean onItemUse(ItemStack var1, EntityLiving var2, World var3, int var4, int var5, int var6, int var7) {
  150.  
  151.     protected String getLivingSound() {
  152.         return "mob.zombie";
  153.     }
  154.  
  155.     protected String getHurtSound() {
  156.         return "mob.zombiehurt";
  157.     }
  158.  
  159.     protected String getDeathSound() {
  160.         return "mob.zombiedeath";
  161.     }
  162.  
  163.     protected int getDropItemId() {
  164.         return 0;
  165.     }
  166.  
  167.     public ItemStack getHeldItem() {
  168.         //if (inventory.mainInventory[0] != null) { return inventory.mainInventory[0]; } else { return new ItemStack(Block.ladder, 1); }
  169.         return new ItemStack(Block.ladder, 1);
  170.     }
  171.  
  172.     public boolean getCanSpawnHere() {
  173.         if(rand.nextInt(15) == 0) {
  174.             int i = MathHelper.floor_double(posX);
  175.             int j = MathHelper.floor_double(boundingBox.minY);
  176.             int k = MathHelper.floor_double(posZ);
  177.  
  178.             if(worldObj.getSavedLightValue(EnumSkyBlock.Sky, i, j, k) > rand.nextInt(32)) {
  179.                 return false;
  180.             } else {
  181.                 int l = worldObj.getBlockLightValue(i, j, k);
  182.                 return l <= rand.nextInt(8) && super.getCanSpawnHere();
  183.             }
  184.         } else {
  185.             return false;
  186.         }
  187.     }
  188.  
  189.     public boolean swingArm;
  190.     public int swingTick;
  191. }
  192.  
  193.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement