01-17-2012, 18:49,
|
|
Leech
Bedrock Miner
Flying_Leech
|
|
Posts: 1,120
Threads: 41
Joined: Apr 2011
|
|
|
|
RE: Suggestion: Spy chickens
(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
Leech: Moderating the wiki for over 75 years
|
|
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.
|
|
01-17-2012, 21:05,
(This post was last modified: 01-17-2012, 21:05 by yottabyte.)
|
|
yottabyte
Bookshelf Miner
yottabyte
|
|
Posts: 4,134
Threads: 320
Joined: Nov 2010
|
|
|
|
RE: Suggestion: Spy chickens
The Bukkit API makes handling living entities much simpler though afaik. Just use like setTarget(Player) and all that good stuff.
|
|
01-17-2012, 22:05,
(This post was last modified: 01-17-2012, 22:16 by pavja2.)
|
|
pavja2
Banned Miner
|
|
Posts: 427
Threads: 39
Joined: Feb 2011
|
|
|
|
RE: Suggestion: Spy chickens
(01-17-2012, 21:05)yottabyte Wrote: The Bukkit API makes handling living entities much simpler though afaik. Just use like setTarget(Player) and all that good stuff.
Oh, that's much simpler, I've never actually written a plugin before so I have no idea if I will be able to do anything with it but it is so much more straightforward than modifying whatever notch has written. Although I really know nothing about how to make it work intuitively (link a toggle in the targeting of the wolf to the opening of a nearby door) but I suppose that's what thinking is for.
I think in a pseudo coding sense:
Code: 10 Get Nearby Entities within 10 blocks
15 If one or more of those Entities is a player then
20 Check if player is wolf owner for each player
25 If true for all players
30 goto 10
40 Else SetTarget(Nearest non-owner player)
50 Else goto 10
To trigger the code could involve feeding a wolf something special (iron or apples etc) to start the "Guard mode" function for a tamed wolf.
No idea if that makes any sense though....
|
|
01-17-2012, 22:38,
|
|
Sir Prize
Bedrock Miner
Hoiafar
|
|
Posts: 1,280
Threads: 42
Joined: Jun 2011
|
Hoiafar
Hoiafar
|
Hoiafar
|
|
RE: Suggestion: Spy chickens
A nice feature to add would also be to add a timer between the wolf noticing the player and reporting.
And in that time the player in question can feed it a steak or similar to make it go on standby for a set amount of time.
I wish I was an insane space wizard.
sethd13 Wrote:i like misquoting people
Spammuf Wrote:I have a severe craving for gold.
|
|
01-17-2012, 22:43,
(This post was last modified: 01-17-2012, 22:43 by pavja2.)
|
|
pavja2
Banned Miner
|
|
Posts: 427
Threads: 39
Joined: Feb 2011
|
|
|
|
RE: Suggestion: Spy chickens
(01-17-2012, 22:38)Sir Prize Wrote: A nice feature to add would also be to add a timer between the wolf noticing the player and reporting.
And in that time the player in question can feed it a steak or similar to make it go on standby for a set amount of time.
Yeah, that and a feature where a wolf has shorter vision when the player is sneaking. I don't have too much time but I've been meaning to try plugin writing for a while now. If I get something coded will you consider adding it to the server yotta? Or is guard dogs not something we would want for revamped?
|
|
01-17-2012, 22:51,
|
|
yottabyte
Bookshelf Miner
yottabyte
|
|
Posts: 4,134
Threads: 320
Joined: Nov 2010
|
|
|
|
RE: Suggestion: Spy chickens
I think it sounds like a pretty cool feature.
|
|
01-18-2012, 00:07,
|
|
Leech
Bedrock Miner
Flying_Leech
|
|
Posts: 1,120
Threads: 41
Joined: Apr 2011
|
|
|
|
RE: Suggestion: Spy chickens
Ya, Yotta, we will all wait for you to get Revamped done first. Then, decide if you want to do it
Leech: Moderating the wiki for over 75 years
|
|
01-19-2012, 18:43,
|
|
guthriearmstrong
Bedrock Miner
guthrie0
|
|
Posts: 1,043
Threads: 62
Joined: Jul 2011
|
|
|
|
RE: Suggestion: Spy chickens
Quote:this is the wolf code it's in the TextureLavalFlowFX.java file for some reason:
But, of course! That explains why wolves seem so attracted to lava.
|
|
|