Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.minecraft.src;
- // Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
- import java.util.List;
- public class EntityPlayerProxy extends EntityZombie {
- public MovingObjectPosition aimHit = null;
- public int blockID = Block.ladder.blockID;
- public InventoryPlayer inventory;
- //public ItemStack[] mainInventory = new ItemStack[36];
- //public ItemStack[] armorInventory = new ItemStack[4];
- public EntityPlayer fakePlayer;
- public EntityPlayerProxy(World world) {
- super(world);
- swingArm = false;
- swingTick = 0;
- texture = "/mob/zombie.png";
- moveSpeed = 0.8F;
- attackStrength = 5;
- health = 40;
- try {
- fakePlayer = new EntityPlayerSP(ModLoader.getMinecraftInstance(), world, ModLoader.getMinecraftInstance().session, world.worldProvider.worldType);
- } catch (Exception ex) {
- return;
- }
- inventory = new InventoryPlayer(fakePlayer);
- inventory.mainInventory[0] = new ItemStack(Item.snowball, 32);
- inventory.mainInventory[1] = new ItemStack(Item.arrow, 64);
- //use canClimb() instead
- //pf.canClimb = true;
- }
- public boolean canClimb() {
- return true;
- }
- public boolean shouldFaceTarget() {
- public void onLivingUpdate() {
- aimHit = rayTrace(1.0D, 1.0F);
- if(!handleWaterMovement()/* && !mod_MinerZombie.isSameTeam(this)*/) {
- forcejump = false;
- mineDelay--;
- if(mineDelay < 1 && noMoveTicks > 10) {
- mineDelay = 3;
- mining = true;
- if (entityToAttack instanceof EntityLiving) {
- ItemStack itemToUse = inventory.mainInventory[0];
- if (itemToUse.getItem() instanceof ItemBlock) {
- //mod_MinerZombie.tryDig(this, (EntityLiving)entityToAttack);
- if (aimHit != null && aimHit.typeOfHit == EnumMovingObjectType.TILE) {
- if (worldObj.getBlockId(aimHit.blockX, aimHit.blockY, aimHit.blockZ) != 0 && worldObj.getBlockId(aimHit.blockX, aimHit.blockY, aimHit.blockZ) != Block.ladder.blockID) {
- sync();
- //int var8 = itemToUse.getBlockId(var4, var5, var6);
- if (!itemToUse.useItem(fakePlayer, worldObj, aimHit.blockX, aimHit.blockY, aimHit.blockZ, aimHit.sideHit)) {
- useInvItem(itemToUse);
- }
- setPrjOwner();
- //System.out.println(worldObj.loadedEntityList.get(worldObj.loadedEntityList.size()-1));
- //itemToUse.useItem(itemToUse, this, this.worldObj, aimHit.blockX, aimHit.blockY, aimHit.blockZ, aimHit.sideHit);
- }
- }
- } else {
- useInvItem(itemToUse);
- setPrjOwner();
- }
- }
- }
- //aimHit.entityHit
- info = noMoveTicks;
- } else {
- if(this.isCollidedHorizontally && !forcejump) {
- this.isJumping = true;
- } else {
- this.isJumping = false;
- }
- }
- if(worldObj.isDaytime()) {
- float f = getEntityBrightness(1.0F);
- 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) {
- func_40046_d(15);
- }
- }
- /*if(!mod_MinerZombie.hostilesBreakWallsB.get()) {
- setEntityDead();
- }*/
- if(swingArm) {
- swingTick++;
- if(swingTick == 8) {
- swingTick = 0;
- swingArm = false;
- }
- } else {
- swingTick = 0;
- }
- swingProgress = (float)swingTick / 8F;
- super.onLivingUpdate();
- }
- public void useInvItem(ItemStack itemstack) {
- sync();
- itemstack.useItemRightClick(worldObj, fakePlayer);
- }
- public void setPrjOwner() {
- Entity ent = (Entity)worldObj.loadedEntityList.get(worldObj.loadedEntityList.size()-1);
- if (ent instanceof EntityThrowable) {
- try {
- ModLoader.setPrivateValue(EntityThrowable.class, ent, "field_40083_c", this);
- } catch (Exception ex) {
- }
- } else if (ent instanceof EntityArrow) {
- ((EntityArrow) ent).shootingEntity = this;
- }
- //System.out.println(worldObj.loadedEntityList.get(worldObj.loadedEntityList.size()-1));
- }
- public void sync() {
- fakePlayer.posX = posX;
- fakePlayer.posY = posY;
- fakePlayer.posZ = posZ;
- fakePlayer.rotationPitch = this.rotationPitch;
- fakePlayer.rotationYaw = this.rotationYaw;
- fakePlayer.inventory = inventory;
- }
- public void tryPlace(EntityCreature entityliving, EntityLiving entityliving1) {
- public boolean onItemUse(ItemStack var1, EntityLiving var2, World var3, int var4, int var5, int var6, int var7) {
- protected String getLivingSound() {
- return "mob.zombie";
- }
- protected String getHurtSound() {
- return "mob.zombiehurt";
- }
- protected String getDeathSound() {
- return "mob.zombiedeath";
- }
- protected int getDropItemId() {
- return 0;
- }
- public ItemStack getHeldItem() {
- //if (inventory.mainInventory[0] != null) { return inventory.mainInventory[0]; } else { return new ItemStack(Block.ladder, 1); }
- return new ItemStack(Block.ladder, 1);
- }
- public boolean getCanSpawnHere() {
- if(rand.nextInt(15) == 0) {
- int i = MathHelper.floor_double(posX);
- int j = MathHelper.floor_double(boundingBox.minY);
- int k = MathHelper.floor_double(posZ);
- if(worldObj.getSavedLightValue(EnumSkyBlock.Sky, i, j, k) > rand.nextInt(32)) {
- return false;
- } else {
- int l = worldObj.getBlockLightValue(i, j, k);
- return l <= rand.nextInt(8) && super.getCanSpawnHere();
- }
- } else {
- return false;
- }
- }
- public boolean swingArm;
- public int swingTick;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement