01-17-2012, 20:24,
(This post was last modified: 01-17-2012, 20:25 by pavja2.)
|
|
pavja2
Banned Miner
|
|
Posts: 427
Threads: 39
Joined: Feb 2011
|
|
|
|
RE: Suggestion: Spy chickens
(01-17-2012, 18:49)Leech Wrote: (01-17-2012, 02:53)pavja2 Wrote: (01-17-2012, 02:31)asdfasdflkjty911 Wrote: If this would even be possible.. You could make it so if you have a dog sitting on your Territories property and someone not on your friends list or someone not in your town entered your house the dog would automatically attack.
I looked into this briefly, the wolf AI is a mess, I doubt it's possible to do without a lot of work
Sloppy code takes a sloppy fix. Although I'm not a great coder, I'll check when I get home
I have no idea what on earth is going on with this stuff. But to save you the trouble of hunting through the client source yourself, this is the wolf code it's in the TextureLavalFlowFX.java file for some reason:
Code: // 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 fieldsfirst
package net.minecraft.src;
import java.util.*;
// Referenced classes of package net.minecraft.src:
// RenderBlaze, EntityGiantZombie, EnumMobType, J_JsonNodeBuilder,
// WorldGenPumpkin, WorldChunkManagerHell, StructureNetherBridgePieces, RecipesWeapons,
// ComponentNetherBridgeCrossing, Packet13PlayerLookMove, EnumArt, EntityMagmaCube,
// BlockNetherrack, ModelPig, GameSettings, BlockMushroomCap
public class TextureLavaFlowFX extends RenderBlaze
{
private boolean a;
private float b;
private float c;
private boolean d;
private boolean e;
private float ap;
private float aq;
public TextureLavaFlowFX(J_JsonNodeBuilder j_jsonnodebuilder)
{
super(j_jsonnodebuilder);
a = false;
bn = "/mob/wolf.png";
a(0.8F, 0.8F);
cg = 1.1F;
bz = 8;
}
protected void clearBoundingBoxPool()
{
super.clearBoundingBoxPool();
af.a(16, Byte.valueOf((byte)0));
af.a(17, "");
af.a(18, new Integer(bz));
}
protected boolean f()
{
return false;
}
public String E()
{
if(ab())
{
return "/mob/wolf_tame.png";
}
if(aa())
{
return "/mob/wolf_angry.png";
} else
{
return super.E();
}
}
public void b(EnumMobType enummobtype)
{
super.b(enummobtype);
enummobtype.a("Angry", aa());
enummobtype.a("Sitting", Z());
if(Y() == null)
{
enummobtype.a("Owner", "");
} else
{
enummobtype.a("Owner", Y());
}
}
public void a(EnumMobType enummobtype)
{
super.a(enummobtype);
f(enummobtype.m("Angry"));
e(enummobtype.m("Sitting"));
String s = enummobtype.i("Owner");
if(s.length() > 0)
{
a(s);
g(true);
}
}
protected boolean c_()
{
return !ab();
}
protected String j()
{
if(aa())
{
return "mob.wolf.growl";
}
if(U.nextInt(3) == 0)
{
if(ab() && af.b(18) < 10)
{
return "mob.wolf.whine";
} else
{
return "mob.wolf.panting";
}
} else
{
return "mob.wolf.bark";
}
}
protected String f_()
{
return "mob.wolf.hurt";
}
protected String l()
{
return "mob.wolf.death";
}
protected float q_()
{
return 0.4F;
}
protected int m()
{
return -1;
}
protected void o_()
{
super.o_();
if(!as && !ae() && ab() && j == null)
{
WorldGenPumpkin worldgenpumpkin = k.a(Y());
if(worldgenpumpkin != null)
{
float f1 = worldgenpumpkin.d(this);
if(f1 > 5F)
{
c(worldgenpumpkin, f1);
}
} else
if(!A())
{
e(true);
}
} else
if(ar == null && !ae() && !ab() && k.w.nextInt(100) == 0)
{
List list = k.a(net.minecraft.src.WorldChunkManagerHell.class, StructureNetherBridgePieces.b(o, p, q, o + 1.0D, p + 1.0D, q + 1.0D).b(16D, 4D, 16D));
if(!list.isEmpty())
{
h((RecipesWeapons)list.get(k.w.nextInt(list.size())));
}
}
if(A())
{
e(false);
}
if(!k.I)
{
af.b(18, Integer.valueOf(bz));
}
}
public void p()
{
super.p();
a = false;
if(az() && !ae() && !aa())
{
RecipesWeapons recipesweapons = aA();
if(recipesweapons instanceof WorldGenPumpkin)
{
WorldGenPumpkin worldgenpumpkin = (WorldGenPumpkin)recipesweapons;
Packet13PlayerLookMove packet13playerlookmove = worldgenpumpkin.as.b();
if(packet13playerlookmove != null)
{
if(!ab() && packet13playerlookmove.c == EnumArt.aY.br)
{
a = true;
} else
if(ab() && (EnumArt.Plant[packet13playerlookmove.c] instanceof EntityMagmaCube))
{
a = ((EntityMagmaCube)EnumArt.Plant[packet13playerlookmove.c]).n();
}
}
}
}
if(!bu && d && !e && !ae() && z)
{
e = true;
ap = 0.0F;
aq = 0.0F;
k.a(this, (byte)8);
}
}
public void w_()
{
super.w_();
c = b;
if(a)
{
b = b + (1.0F - b) * 0.4F;
} else
{
b = b + (0.0F - b) * 0.4F;
}
if(a)
{
ch = 10;
}
if(z())
{
d = true;
e = false;
ap = 0.0F;
aq = 0.0F;
} else
if((d || e) && e)
{
if(ap == 0.0F)
{
this.k.a(this, "mob.wolf.shake", q_(), (U.nextFloat() - U.nextFloat()) * 0.2F + 1.0F);
}
aq = ap;
ap += 0.05F;
if(aq >= 2.0F)
{
d = false;
e = false;
aq = 0.0F;
ap = 0.0F;
}
if(ap > 0.4F)
{
float f1 = (float)y.field_40691_b;
int k = (int)(BlockNetherrack.a((ap - 0.4F) * 3.141593F) * 7F);
for(int i1 = 0; i1 < k; i1++)
{
float f2 = (U.nextFloat() * 2.0F - 1.0F) * I * 0.5F;
float f3 = (U.nextFloat() * 2.0F - 1.0F) * I * 0.5F;
this.k.a("splash", o + (double)f2, f1 + 0.8F, q + (double)f3, r, s, t);
}
}
}
}
public boolean U()
{
return d;
}
public float d(float f1)
{
return 0.75F + ((aq + (ap - aq) * f1) / 2.0F) * 0.25F;
}
public float d(float f1, float f2)
{
float f3 = (aq + (ap - aq) * f1 + f2) / 1.8F;
if(f3 < 0.0F)
{
f3 = 0.0F;
} else
if(f3 > 1.0F)
{
f3 = 1.0F;
}
return BlockNetherrack.a(f3 * 3.141593F) * BlockNetherrack.a(f3 * 3.141593F * 11F) * 0.15F * 3.141593F;
}
public float e(float f1)
{
return (c + (b - c) * f1) * 0.15F * 3.141593F;
}
public float B()
{
return J * 0.8F;
}
protected int v_()
{
if(Z())
{
return 20;
} else
{
return super.v_();
}
}
private void c(RecipesWeapons recipesweapons, float f1)
{
ContainerDispenser containerdispenser = this.k.a(this, recipesweapons, 16F);
if(containerdispenser == null && f1 > 12F)
{
int k = BlockNetherrack.b(recipesweapons.o) - 2;
int i1 = BlockNetherrack.b(recipesweapons.q) - 2;
int j1 = BlockNetherrack.b(recipesweapons.y.field_40691_b);
for(int k1 = 0; k1 <= 4; k1++)
{
for(int l1 = 0; l1 <= 4; l1++)
{
if((k1 < 1 || l1 < 1 || k1 > 3 || l1 > 3) && this.k.h(k + k1, j1 - 1, i1 + l1) && !this.k.h(k + k1, j1, i1 + l1) && !this.k.h(k + k1, j1 + 1, i1 + l1))
{
c((float)(k + k1) + 0.5F, j1, (float)(i1 + l1) + 0.5F, u, v);
return;
}
}
}
} else
{
a(containerdispenser);
}
}
protected boolean W()
{
return Z() || e;
}
public boolean a(ModelPig modelpig, int k)
{
RecipesWeapons recipesweapons = modelpig.a();
e(false);
if(recipesweapons != null && !(recipesweapons instanceof WorldGenPumpkin) && !(recipesweapons instanceof GameSettings))
{
k = (k + 1) / 2;
}
if(super.a(modelpig, k))
{
if(!ab() && !aa())
{
if(recipesweapons instanceof WorldGenPumpkin)
{
f(true);
ar = recipesweapons;
}
if((recipesweapons instanceof GameSettings) && ((GameSettings)recipesweapons).mouseSensitivity != null)
{
recipesweapons = ((GameSettings)recipesweapons).mouseSensitivity;
}
if(recipesweapons instanceof BlockMushroomCap)
{
List list = this.k.a(net.minecraft.src.TextureLavaFlowFX.class, StructureNetherBridgePieces.b(o, p, q, o + 1.0D, p + 1.0D, q + 1.0D).b(16D, 4D, 16D));
Iterator iterator = list.iterator();
do
{
if(!iterator.hasNext())
{
break;
}
RecipesWeapons recipesweapons1 = (RecipesWeapons)iterator.next();
TextureLavaFlowFX texturelavaflowfx = (TextureLavaFlowFX)recipesweapons1;
if(!texturelavaflowfx.ab() && texturelavaflowfx.ar == null)
{
texturelavaflowfx.ar = recipesweapons;
if(recipesweapons instanceof WorldGenPumpkin)
{
texturelavaflowfx.f(true);
}
}
} while(true);
}
} else
if(recipesweapons != this && recipesweapons != null)
{
if(ab() && (recipesweapons instanceof WorldGenPumpkin) && ((WorldGenPumpkin)recipesweapons).aD.equalsIgnoreCase(Y()))
{
return true;
}
ar = recipesweapons;
}
return true;
} else
{
return false;
}
}
protected RecipesWeapons i()
{
if(aa())
{
return k.a(this, 16D);
} else
{
return null;
}
}
protected void a(RecipesWeapons recipesweapons, float f1)
{
if(f1 > 2.0F && f1 < 6F && U.nextInt(10) == 0)
{
if(z)
{
double d1 = recipesweapons.o - o;
double d2 = recipesweapons.q - q;
float f2 = BlockNetherrack.a(d1 * d1 + d2 * d2);
r = (d1 / (double)f2) * 0.5D * 0.80000001192092896D + r * 0.20000000298023224D;
t = (d2 / (double)f2) * 0.5D * 0.80000001192092896D + t * 0.20000000298023224D;
s = 0.40000000596046448D;
}
} else
if((double)f1 < 1.5D && recipesweapons.y.e > y.field_40691_b && recipesweapons.y.field_40691_b < y.e)
{
bF = 20;
byte byte0 = 2;
if(ab())
{
byte0 = 4;
}
recipesweapons.a(ModelPig.a(this), byte0);
}
}
public boolean b(WorldGenPumpkin worldgenpumpkin)
{
Packet13PlayerLookMove packet13playerlookmove = worldgenpumpkin.as.b();
if(!ab())
{
if(packet13playerlookmove != null && packet13playerlookmove.c == EnumArt.aY.br && !aa())
{
packet13playerlookmove.a--;
if(packet13playerlookmove.a <= 0)
{
worldgenpumpkin.as.a(worldgenpumpkin.as.c, null);
}
if(!k.I)
{
if(U.nextInt(3) == 0)
{
g(true);
a(((ContainerDispenser) (null)));
e(true);
bz = 20;
a(worldgenpumpkin.aD);
b(true);
k.a(this, (byte)7);
} else
{
b(false);
k.a(this, (byte)6);
}
}
return true;
}
} else
{
if(packet13playerlookmove != null && (EnumArt.Plant[packet13playerlookmove.c] instanceof EntityMagmaCube))
{
EntityMagmaCube entitymagmacube = (EntityMagmaCube)EnumArt.Plant[packet13playerlookmove.c];
if(entitymagmacube.n() && af.b(18) < 20)
{
packet13playerlookmove.a--;
e(entitymagmacube.l());
if(packet13playerlookmove.a <= 0)
{
worldgenpumpkin.as.a(worldgenpumpkin.as.c, null);
}
return true;
}
}
if(worldgenpumpkin.aD.equalsIgnoreCase(Y()))
{
if(!k.I)
{
e(!Z());
ce = false;
a(((ContainerDispenser) (null)));
}
return true;
}
}
return false;
}
void b(boolean flag)
{
String s = "heart";
if(!flag)
{
s = "smoke";
}
for(int k = 0; k < 7; k++)
{
double d1 = U.nextGaussian() * 0.02D;
double d2 = U.nextGaussian() * 0.02D;
double d3 = U.nextGaussian() * 0.02D;
this.k.a(s, (o + (double)(U.nextFloat() * I * 2.0F)) - (double)I, p + 0.5D + (double)(U.nextFloat() * J), (q + (double)(U.nextFloat() * I * 2.0F)) - (double)I, d1, d2, d3);
}
}
public void a(byte byte0)
{
if(byte0 == 7)
{
b(true);
} else
if(byte0 == 6)
{
b(false);
} else
if(byte0 == 8)
{
e = true;
ap = 0.0F;
aq = 0.0F;
} else
{
super.a(byte0);
}
}
public float X()
{
if(aa())
{
return 1.53938F;
}
if(ab())
{
return (0.55F - (float)(20 - af.b(18)) * 0.02F) * 3.141593F;
} else
{
return 0.6283185F;
}
}
public int S()
{
return 8;
}
public String Y()
{
return af.c(17);
}
public void a(String s)
{
af.b(17, s);
}
public boolean Z()
{
return (af.a(16) & 1) != 0;
}
public void e(boolean flag)
{
byte byte0 = af.a(16);
if(flag)
{
af.b(16, Byte.valueOf((byte)(byte0 | 1)));
} else
{
af.b(16, Byte.valueOf((byte)(byte0 & -2)));
}
}
public boolean aa()
{
return (af.a(16) & 2) != 0;
}
public void f(boolean flag)
{
byte byte0 = af.a(16);
if(flag)
{
af.b(16, Byte.valueOf((byte)(byte0 | 2)));
} else
{
af.b(16, Byte.valueOf((byte)(byte0 & -3)));
}
}
public boolean ab()
{
return (af.a(16) & 4) != 0;
}
public void g(boolean flag)
{
byte byte0 = af.a(16);
if(flag)
{
af.b(16, Byte.valueOf((byte)(byte0 | 4)));
} else
{
af.b(16, Byte.valueOf((byte)(byte0 & -5)));
}
}
}
There's also a ton of confusing stuff about lava and pumpkins and some other mobs, it really is a mess.
|
|
|