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)
- // Source File Name: SourceFile
- import java.util.*;
- public class oh extends jo
- implements og, un
- {
- public oh(ux ux1)
- {
- this(ux1, 0);
- }
- public oh(ux ux1, int k)
- {
- super(ux1);
- e = 0;
- f = false;
- g = false;
- d = null;
- c(k);
- az = "/mob/villager/villager.png";
- by = 0.5F;
- at().b(true);
- at().a(true);
- bg.a(0, new kw(this));
- bg.a(1, new kp(this, oe, 8F, 0.3F, 0.35F));
- bg.a(1, new ma(this));
- bg.a(1, new lf(this));
- bg.a(2, new li(this));
- bg.a(3, new lu(this));
- bg.a(4, new lo(this, true));
- bg.a(5, new lk(this, 0.3F));
- bg.a(6, new lg(this));
- bg.a(7, new ly(this));
- bg.a(8, new lr(this, 0.32F));
- bg.a(9, new lc(this, ok, 3F, 1.0F));
- bg.a(9, new lc(this, oh, 5F, 0.02F));
- bg.a(9, new lt(this, 0.3F));
- bg.a(10, new le(this, ka, 8F));
- }
- //isAIEnabled(): use new AI
- public boolean aW()
- {
- return true;
- }
- //updateAITick()
- protected void be()
- {
- //standard behavior
- if(--e <= 0)
- {
- p.D.a(il.c(t), il.c(u), il.c(v)); //world.villages
- e = 70 + Z.nextInt(50);
- d = p.D.a(il.c(t), il.c(u), il.c(v), 32);
- if(d == null)
- {
- aF(); //detatchHome
- } else
- {
- j j1 = d.a();
- b(j1.a, j1.b, j1.c, (int)((float)d.b() * 0.6F));
- }
- }
- //trading related behavior
- if(!r() && j > 0) //player is not bound to villager, and j>0 (is 40 when trade is made)
- {
- j--;
- if(j <= 0) //ooh, those 40 ticks are up!
- {
- if(bA) //were we adding a new offer?
- {
- if(i.size() > 1) //Do we already have more than one offer?
- {
- Iterator iterator = i.iterator();
- do
- {
- if(!iterator.hasNext())
- break;
- uo uo1 = (uo)iterator.next();
- if(uo1.g()) //Uses surpassed max uses, or equal to it?
- uo1.a(Z.nextInt(6) + Z.nextInt(6) + 2); //increase max uses by 2-12
- } while(true);
- }
- r(1); //Add new offer
- bA = false; //we did it!
- if(d != null && bC != null) //I can has village and player?
- {
- p.a(this, (byte)14); //cue happy particles
- d.a(bC, 1); //+1 to that player
- }
- }
- d(new jn(jm.l.H, 200, 0)); //Regen potion particle effect
- }
- }
- super.be();
- }
- //interact: Attempt to trade
- public boolean c(ok ok1)
- {
- if(T() && !r() && !d()) //alive, adult, and nobody else is trading
- {
- if(!p.K)
- {
- a_(ok1);
- ok1.a(this); //open trade for human
- }
- return true;
- } else
- {
- return super.c(ok1);
- }
- }
- //entityInit()
- protected void a()
- {
- super.a();
- af.a(16, Integer.valueOf(0)); //datawatcher.addObject
- }
- //Gets max health
- public int aN()
- {
- return 20;
- }
- //Store NBT Data
- public void b(aq aq1)
- {
- super.b(aq1);
- aq1.a("Profession", o());
- aq1.a("Riches", bB);
- if(i != null)
- aq1.a("Offers", i.a());
- }
- //Load NBT Data
- public void a(aq aq1)
- {
- super.a(aq1);
- c(aq1.e("Profession"));
- bB = aq1.e("Riches");
- if(aq1.b("Offers"))
- {
- aq aq2 = aq1.l("Offers");
- i = new up(aq2);
- }
- }
- //Returns location of skin to use
- public String P()
- {
- switch(o())
- {
- case 0: // '\0'
- return "/mob/villager/farmer.png";
- case 1: // '\001'
- return "/mob/villager/librarian.png";
- case 2: // '\002'
- return "/mob/villager/priest.png";
- case 3: // '\003'
- return "/mob/villager/smith.png";
- case 4: // '\004'
- return "/mob/villager/butcher.png";
- }
- return super.P();
- }
- //canDespawn()
- protected boolean bb()
- {
- return false;
- }
- //idle sound
- protected String aR()
- {
- return "mob.villager.default";
- }
- //hurt sound
- protected String aS()
- {
- return "mob.villager.defaulthurt";
- }
- //death sound
- protected String aT()
- {
- return "mob.villager.defaultdeath";
- }
- //setProfession
- public void c(int k)
- {
- af.b(16, Integer.valueOf(k)); //datawatcher.watch
- }
- //getProfession
- public int o()
- {
- return af.c(16); //datawatcher.getInt
- }
- //isMating
- public boolean p()
- {
- return f;
- }
- //set isMating
- public void e(boolean flag)
- {
- f = flag;
- }
- //set isPlaying
- public void f(boolean flag)
- {
- g = flag;
- }
- //isPlaying
- public boolean q()
- {
- return g;
- }
- //setRevengeTarget
- public void c(ka ka1)
- {
- super.c(ka1);
- if(d != null && ka1 != null) //if(village != null && entityliving != null)
- {
- d.a(ka1); //enemy of the state
- if(ka1 instanceof ok) //If entity is player
- {
- byte byte0 = -1;
- if(d())
- byte0 = -3; //if isChild()
- d.a(((ok)ka1).c_(), byte0); //playername, emnity. emnity is capped at -30 and +10
- if(T()) //if still alive
- p.a(this, (byte)13); //cue angry particles
- }
- }
- }
- //onDeath
- public void a(ji ji1) //parameter DamageSource
- {
- if(d != null) //if there is a village
- {
- jr jr = ji1.g(); //getEntity
- if(jr != null)
- {
- if(jr instanceof ok) //if player
- d.a(((ok)jr).c_(), -2); //-2 emnity
- else
- if(jr instanceof ny) //if EntityMob
- d.h(); //stunt mating for a good 3600 ticks
- } else
- if(jr == null) //not caused by entity
- {
- ok ok1 = p.a(this, 16D); //getClosestPlayerToEntity within 16 blocks
- if(ok1 != null) //if a player was nearby
- d.h(); //stunt mating for a good 3600 ticks
- }
- }
- super.a(ji1);
- }
- //Binds a player to this Villager
- public void a_(ok ok1)
- {
- h = ok1;
- }
- //Returns the player bound to this Villager
- public ok k_()
- {
- return h;
- }
- //Is a player bound to this Villager?
- public boolean r()
- {
- return h != null;
- }
- //Offer addition, and riches count, called when a trade is made.
- public void a(uo uo1) //MerchantRecipe parameter
- {
- uo1.f(); //increments offer uses
- if(uo1.a((uo)i.get(i.size() - 1))) //Does this offer equal the last offer on the list?
- {
- j = 40; //set offer update ticks to 40.
- bA = true; //let's add a new offer! soon!
- if(h != null) //a player is bound to this villager.
- bC = h.c_(); //write their name down.
- else
- bC = null; //no name to write.
- }
- if(uo1.a().c == rn.bH.bT) //did you give me emerald?
- bB += uo1.a().a; //increment riches by amount of emeralds.
- }
- //Gives offers, generating one if none exist.
- public up b(ok ok1)
- {
- if(i == null)
- r(1);
- return i;
- }
- //Modify probability values: if there are many offers, the rarer offers start to become more common.
- private float j(float f1)
- {
- float f2 = f1 + bD; //Probability is increased by 0.2*sqrt(numOffers)
- if(f2 > 0.9F)
- return 0.9F - (f2 - 0.9F); //Past a certain point, offer probability actually decreases.
- else
- return f2;
- }
- //Generate new offers
- private void r(int k)
- {
- if(i != null)
- bD = il.c(i.size()) * 0.2F;//il = MathHelper. bD = Math.sqrt(i.size()) * 0.2;
- else
- bD = 0.0F;
- up up1 = new up();
- switch(o())
- {
- case 0: // '\0'
- a(up1, rn.T.bT, Z, j(0.9F));
- a(up1, aiq.ab.cc, Z, j(0.5F));
- a(up1, rn.bk.bT, Z, j(0.5F));
- a(up1, rn.aV.bT, Z, j(0.4F));
- b(up1, rn.U.bT, Z, j(0.9F));
- b(up1, rn.bf.bT, Z, j(0.3F));
- b(up1, rn.j.bT, Z, j(0.3F));
- b(up1, rn.bc.bT, Z, j(0.3F));
- b(up1, rn.be.bT, Z, j(0.3F));
- b(up1, rn.i.bT, Z, j(0.3F));
- b(up1, rn.bl.bT, Z, j(0.3F));
- b(up1, rn.l.bT, Z, j(0.5F));
- if(Z.nextFloat() < j(0.5F))
- up1.add(new uo(new rp(aiq.F, 10), new rp(rn.bH), new rp(rn.ap.bT, 4 + Z.nextInt(2), 0)));
- break;
- case 4: // '\004'
- a(up1, rn.m.bT, Z, j(0.7F));
- a(up1, rn.aq.bT, Z, j(0.5F));
- a(up1, rn.bi.bT, Z, j(0.5F));
- b(up1, rn.aA.bT, Z, j(0.1F));
- b(up1, rn.W.bT, Z, j(0.3F));
- b(up1, rn.Y.bT, Z, j(0.3F));
- b(up1, rn.V.bT, Z, j(0.3F));
- b(up1, rn.X.bT, Z, j(0.3F));
- b(up1, rn.ar.bT, Z, j(0.3F));
- b(up1, rn.bj.bT, Z, j(0.3F));
- break;
- case 3: // '\003'
- a(up1, rn.m.bT, Z, j(0.7F));
- a(up1, rn.o.bT, Z, j(0.5F));
- a(up1, rn.p.bT, Z, j(0.5F));
- a(up1, rn.n.bT, Z, j(0.5F));
- b(up1, rn.q.bT, Z, j(0.5F));
- b(up1, rn.z.bT, Z, j(0.5F));
- b(up1, rn.h.bT, Z, j(0.3F));
- b(up1, rn.C.bT, Z, j(0.3F));
- b(up1, rn.g.bT, Z, j(0.5F));
- b(up1, rn.B.bT, Z, j(0.5F));
- b(up1, rn.f.bT, Z, j(0.2F));
- b(up1, rn.A.bT, Z, j(0.2F));
- b(up1, rn.P.bT, Z, j(0.2F));
- b(up1, rn.Q.bT, Z, j(0.2F));
- b(up1, rn.ag.bT, Z, j(0.2F));
- b(up1, rn.ak.bT, Z, j(0.2F));
- b(up1, rn.ad.bT, Z, j(0.2F));
- b(up1, rn.ah.bT, Z, j(0.2F));
- b(up1, rn.ae.bT, Z, j(0.2F));
- b(up1, rn.ai.bT, Z, j(0.2F));
- b(up1, rn.af.bT, Z, j(0.2F));
- b(up1, rn.aj.bT, Z, j(0.2F));
- b(up1, rn.ac.bT, Z, j(0.1F));
- b(up1, rn.Z.bT, Z, j(0.1F));
- b(up1, rn.aa.bT, Z, j(0.1F));
- b(up1, rn.ab.bT, Z, j(0.1F));
- break;
- case 1: // '\001'
- a(up1, rn.aK.bT, Z, j(0.8F));
- a(up1, rn.aL.bT, Z, j(0.8F));
- a(up1, rn.bG.bT, Z, j(0.3F));
- b(up1, aiq.an.cc, Z, j(0.8F));
- b(up1, aiq.M.cc, Z, j(0.2F));
- b(up1, rn.aQ.bT, Z, j(0.2F));
- b(up1, rn.aS.bT, Z, j(0.2F));
- break;
- case 2: // '\002'
- b(up1, rn.bA.bT, Z, j(0.3F));
- b(up1, rn.bD.bT, Z, j(0.2F));
- b(up1, rn.aC.bT, Z, j(0.4F));
- b(up1, aiq.bd.cc, Z, j(0.3F));
- int ai[] = {
- rn.q.bT, rn.z.bT, rn.ae.bT, rn.ai.bT, rn.h.bT, rn.C.bT, rn.g.bT, rn.B.bT
- };
- int ai1[] = ai;
- int i1 = ai1.length;
- for(int j1 = 0; j1 < i1; j1++)
- {
- int k1 = ai1[j1];
- if(Z.nextFloat() < j(0.05F))
- up1.add(new uo(new rp(k1, 1, 0), new rp(rn.bH, 2 + Z.nextInt(3), 0), ua.a(Z, new rp(k1, 1, 0), 5 + Z.nextInt(15))));
- }
- break;
- }
- if(up1.isEmpty())
- a(up1, rn.p.bT, Z, 1.0F);
- Collections.shuffle(up1);
- if(i == null)
- i = new up();
- for(int l = 0; l < k && l < up1.size(); l++)
- i.a((uo)up1.get(l));
- }
- //Takes a MerchantRecipeList and does nothing with it.
- public void a(up up1)
- {
- }
- //Adds a buy offer to the given list.
- private static void a(up up1, int k, Random random, float f1)
- {
- if(random.nextFloat() < f1)
- up1.add(new uo(a(k, random), rn.bH));
- }
- //Creates an offer's ItemStack
- private static rp a(int k, Random random)
- {
- return new rp(k, b(k, random), 0);
- }
- //Determines the value of a buy offer, correcting for incorrect declarations.
- private static int b(int k, Random random)
- {
- iu iu1 = (iu)bE.get(Integer.valueOf(k));
- if(iu1 == null)
- return 1;
- if(((Integer)iu1.a()).intValue() >= ((Integer)iu1.b()).intValue())
- return ((Integer)iu1.a()).intValue();
- else
- return ((Integer)iu1.a()).intValue() + random.nextInt(((Integer)iu1.b()).intValue() - ((Integer)iu1.a()).intValue());
- }
- //Adds a sell offer to the given list.
- private static void b(up up1, int k, Random random, float f1)
- {
- if(random.nextFloat() < f1)
- {
- int l = c(k, random);
- rp rp1;
- rp rp2;
- if(l < 0)
- {
- rp1 = new rp(rn.bH.bT, 1, 0);
- rp2 = new rp(k, -l, 0);
- } else
- {
- rp1 = new rp(rn.bH.bT, l, 0);
- rp2 = new rp(k, 1, 0);
- }
- up1.add(new uo(rp1, rp2));
- }
- }
- //Determines the value of a sale offer, correcting for incorrect declarations.
- private static int c(int k, Random random)
- {
- iu iu1 = (iu)bF.get(Integer.valueOf(k));
- if(iu1 == null)
- return 1;
- if(((Integer)iu1.a()).intValue() >= ((Integer)iu1.b()).intValue())
- return ((Integer)iu1.a()).intValue();
- else
- return ((Integer)iu1.a()).intValue() + random.nextInt(((Integer)iu1.b()).intValue() - ((Integer)iu1.a()).intValue());
- }
- //Produces particles of given type
- public void a(byte byte0)
- {
- if(byte0 == 12)
- a("heart");
- else
- if(byte0 == 13)
- a("angryVillager");
- else
- if(byte0 == 14)
- a("happyVillager");
- else
- super.a(byte0);
- }
- //Creates given particles around villager
- private void a(String s)
- {
- for(int k = 0; k < 5; k++)
- {
- double d1 = Z.nextGaussian() * 0.02D;
- double d2 = Z.nextGaussian() * 0.02D;
- double d3 = Z.nextGaussian() * 0.02D;
- p.a(s, (t + (double)(Z.nextFloat() * N * 2.0F)) - (double)N, u + 1.0D + (double)(Z.nextFloat() * O), (v + (double)(Z.nextFloat() * N * 2.0F)) - (double)N, d1, d2, d3);
- }
- }
- //Sets random profession
- public void bx()
- {
- c(p.v.nextInt(5)); //world.random 0-4
- }
- private int e;
- private boolean f;
- private boolean g;
- mn d;
- private ok h;
- private up i;
- private int j;
- private boolean bA;
- private int bB;
- private String bC;
- private float bD;
- private static final Map bE;
- private static final Map bF;
- //The going rates
- static
- {
- bE = new HashMap();
- bF = new HashMap();
- bE.put(Integer.valueOf(rn.m.bT), new iu(Integer.valueOf(16), Integer.valueOf(24)));
- bE.put(Integer.valueOf(rn.o.bT), new iu(Integer.valueOf(8), Integer.valueOf(10)));
- bE.put(Integer.valueOf(rn.p.bT), new iu(Integer.valueOf(8), Integer.valueOf(10)));
- bE.put(Integer.valueOf(rn.n.bT), new iu(Integer.valueOf(4), Integer.valueOf(6)));
- bE.put(Integer.valueOf(rn.aK.bT), new iu(Integer.valueOf(24), Integer.valueOf(36))); //paper, nerfed
- bE.put(Integer.valueOf(rn.aL.bT), new iu(Integer.valueOf(11), Integer.valueOf(13)));
- bE.put(Integer.valueOf(rn.bG.bT), new iu(Integer.valueOf(1), Integer.valueOf(1)));
- bE.put(Integer.valueOf(rn.bn.bT), new iu(Integer.valueOf(3), Integer.valueOf(4)));
- bE.put(Integer.valueOf(rn.bA.bT), new iu(Integer.valueOf(2), Integer.valueOf(3)));
- bE.put(Integer.valueOf(rn.aq.bT), new iu(Integer.valueOf(14), Integer.valueOf(18)));
- bE.put(Integer.valueOf(rn.bi.bT), new iu(Integer.valueOf(14), Integer.valueOf(18)));
- bE.put(Integer.valueOf(rn.bk.bT), new iu(Integer.valueOf(14), Integer.valueOf(18)));
- bE.put(Integer.valueOf(rn.aV.bT), new iu(Integer.valueOf(9), Integer.valueOf(13)));
- bE.put(Integer.valueOf(rn.S.bT), new iu(Integer.valueOf(34), Integer.valueOf(48)));
- bE.put(Integer.valueOf(rn.bh.bT), new iu(Integer.valueOf(30), Integer.valueOf(38)));
- bE.put(Integer.valueOf(rn.bg.bT), new iu(Integer.valueOf(30), Integer.valueOf(38)));
- bE.put(Integer.valueOf(rn.T.bT), new iu(Integer.valueOf(18), Integer.valueOf(22)));
- bE.put(Integer.valueOf(aiq.ab.cc), new iu(Integer.valueOf(14), Integer.valueOf(22)));
- bE.put(Integer.valueOf(rn.bm.bT), new iu(Integer.valueOf(36), Integer.valueOf(64)));
- bF.put(Integer.valueOf(rn.i.bT), new iu(Integer.valueOf(3), Integer.valueOf(4)));
- bF.put(Integer.valueOf(rn.be.bT), new iu(Integer.valueOf(3), Integer.valueOf(4)));
- bF.put(Integer.valueOf(rn.q.bT), new iu(Integer.valueOf(7), Integer.valueOf(11)));
- bF.put(Integer.valueOf(rn.z.bT), new iu(Integer.valueOf(12), Integer.valueOf(14)));
- bF.put(Integer.valueOf(rn.h.bT), new iu(Integer.valueOf(6), Integer.valueOf(8)));
- bF.put(Integer.valueOf(rn.C.bT), new iu(Integer.valueOf(9), Integer.valueOf(12)));
- bF.put(Integer.valueOf(rn.g.bT), new iu(Integer.valueOf(7), Integer.valueOf(9)));
- bF.put(Integer.valueOf(rn.B.bT), new iu(Integer.valueOf(10), Integer.valueOf(12)));
- bF.put(Integer.valueOf(rn.f.bT), new iu(Integer.valueOf(4), Integer.valueOf(6)));
- bF.put(Integer.valueOf(rn.A.bT), new iu(Integer.valueOf(7), Integer.valueOf(8)));
- bF.put(Integer.valueOf(rn.P.bT), new iu(Integer.valueOf(4), Integer.valueOf(6)));
- bF.put(Integer.valueOf(rn.Q.bT), new iu(Integer.valueOf(7), Integer.valueOf(8)));
- bF.put(Integer.valueOf(rn.ag.bT), new iu(Integer.valueOf(4), Integer.valueOf(6)));
- bF.put(Integer.valueOf(rn.ak.bT), new iu(Integer.valueOf(7), Integer.valueOf(8)));
- bF.put(Integer.valueOf(rn.ad.bT), new iu(Integer.valueOf(4), Integer.valueOf(6)));
- bF.put(Integer.valueOf(rn.ah.bT), new iu(Integer.valueOf(7), Integer.valueOf(8)));
- bF.put(Integer.valueOf(rn.ae.bT), new iu(Integer.valueOf(10), Integer.valueOf(14)));
- bF.put(Integer.valueOf(rn.ai.bT), new iu(Integer.valueOf(16), Integer.valueOf(19)));
- bF.put(Integer.valueOf(rn.af.bT), new iu(Integer.valueOf(8), Integer.valueOf(10)));
- bF.put(Integer.valueOf(rn.aj.bT), new iu(Integer.valueOf(11), Integer.valueOf(14)));
- bF.put(Integer.valueOf(rn.ac.bT), new iu(Integer.valueOf(5), Integer.valueOf(7)));
- bF.put(Integer.valueOf(rn.Z.bT), new iu(Integer.valueOf(5), Integer.valueOf(7)));
- bF.put(Integer.valueOf(rn.aa.bT), new iu(Integer.valueOf(11), Integer.valueOf(15)));
- bF.put(Integer.valueOf(rn.ab.bT), new iu(Integer.valueOf(9), Integer.valueOf(11)));
- bF.put(Integer.valueOf(rn.U.bT), new iu(Integer.valueOf(-4), Integer.valueOf(-2)));
- bF.put(Integer.valueOf(rn.bf.bT), new iu(Integer.valueOf(-8), Integer.valueOf(-4)));
- bF.put(Integer.valueOf(rn.j.bT), new iu(Integer.valueOf(-8), Integer.valueOf(-4)));
- bF.put(Integer.valueOf(rn.bc.bT), new iu(Integer.valueOf(-10), Integer.valueOf(-7)));
- bF.put(Integer.valueOf(aiq.M.cc), new iu(Integer.valueOf(-5), Integer.valueOf(-3)));
- bF.put(Integer.valueOf(aiq.an.cc), new iu(Integer.valueOf(3), Integer.valueOf(4)));
- bF.put(Integer.valueOf(rn.W.bT), new iu(Integer.valueOf(4), Integer.valueOf(5)));
- bF.put(Integer.valueOf(rn.Y.bT), new iu(Integer.valueOf(2), Integer.valueOf(4)));
- bF.put(Integer.valueOf(rn.V.bT), new iu(Integer.valueOf(2), Integer.valueOf(4)));
- bF.put(Integer.valueOf(rn.X.bT), new iu(Integer.valueOf(2), Integer.valueOf(4)));
- bF.put(Integer.valueOf(rn.aA.bT), new iu(Integer.valueOf(6), Integer.valueOf(8)));
- bF.put(Integer.valueOf(rn.bD.bT), new iu(Integer.valueOf(-4), Integer.valueOf(-1)));
- bF.put(Integer.valueOf(rn.aC.bT), new iu(Integer.valueOf(-4), Integer.valueOf(-1)));
- bF.put(Integer.valueOf(rn.aQ.bT), new iu(Integer.valueOf(10), Integer.valueOf(12)));
- bF.put(Integer.valueOf(rn.aS.bT), new iu(Integer.valueOf(10), Integer.valueOf(12)));
- bF.put(Integer.valueOf(aiq.bd.cc), new iu(Integer.valueOf(-3), Integer.valueOf(-1)));
- bF.put(Integer.valueOf(rn.ar.bT), new iu(Integer.valueOf(-7), Integer.valueOf(-5)));
- bF.put(Integer.valueOf(rn.bj.bT), new iu(Integer.valueOf(-7), Integer.valueOf(-5)));
- bF.put(Integer.valueOf(rn.bl.bT), new iu(Integer.valueOf(-8), Integer.valueOf(-6)));
- bF.put(Integer.valueOf(rn.bA.bT), new iu(Integer.valueOf(7), Integer.valueOf(11)));
- bF.put(Integer.valueOf(rn.l.bT), new iu(Integer.valueOf(-12), Integer.valueOf(-8))); //arrows, fixed
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement