Fixed a few errors that are to come.

This commit is contained in:
ImHacking 2022-06-24 03:18:10 -04:00
parent d6bf6ca0aa
commit b8bddfd9b3
5 changed files with 173 additions and 9 deletions

View File

@ -33,8 +33,8 @@ public class EntityVillager extends EntityAgeable implements IMerchant, NPC {
this.inventory = new InventorySubcontainer("Items", false, 8, (CraftVillager) this.getBukkitEntity()); // CraftBukkit add argument this.inventory = new InventorySubcontainer("Items", false, 8, (CraftVillager) this.getBukkitEntity()); // CraftBukkit add argument
this.setProfession(i); this.setProfession(i);
this.setSize(0.6F, 1.8F); this.setSize(0.6F, 1.8F);
((Navigation) this.getNavigation()).b(true); (this.getNavigation()).b(true);
((Navigation) this.getNavigation()).a(true); (this.getNavigation()).a(true);
this.goalSelector.a(0, new PathfinderGoalFloat(this)); this.goalSelector.a(0, new PathfinderGoalFloat(this));
this.goalSelector.a(1, new PathfinderGoalAvoidTarget(this, EntityZombie.class, 8.0F, 0.6D, 0.6D)); this.goalSelector.a(1, new PathfinderGoalAvoidTarget(this, EntityZombie.class, 8.0F, 0.6D, 0.6D));
this.goalSelector.a(1, new PathfinderGoalTradeWithPlayer(this)); this.goalSelector.a(1, new PathfinderGoalTradeWithPlayer(this));
@ -216,7 +216,7 @@ public class EntityVillager extends EntityAgeable implements IMerchant, NPC {
} }
public void setProfession(int i) { public void setProfession(int i) {
this.datawatcher.watch(16, Integer.valueOf(i)); this.datawatcher.watch(16, i);
} }
public int getProfession() { public int getProfession() {
@ -462,7 +462,7 @@ public class EntityVillager extends EntityAgeable implements IMerchant, NPC {
} }
if (s1 != null) { if (s1 != null) {
ChatMessage chatmessage = new ChatMessage("entity.Villager." + s1, new Object[0]); ChatMessage chatmessage = new ChatMessage("entity.Villager." + s1);
chatmessage.getChatModifier().setChatHoverable(this.aQ()); chatmessage.getChatModifier().setChatHoverable(this.aQ());
chatmessage.getChatModifier().setInsertion(this.getUniqueID().toString()); chatmessage.getChatModifier().setInsertion(this.getUniqueID().toString());
@ -497,7 +497,7 @@ public class EntityVillager extends EntityAgeable implements IMerchant, NPC {
public EntityVillager b(EntityAgeable entityageable) { public EntityVillager b(EntityAgeable entityageable) {
EntityVillager entityvillager = new EntityVillager(this.world); EntityVillager entityvillager = new EntityVillager(this.world);
entityvillager.prepare(this.world.E(new BlockPosition(entityvillager)), (GroupDataEntity) null); entityvillager.prepare(this.world.E(new BlockPosition(entityvillager)), null);
return entityvillager; return entityvillager;
} }
@ -567,7 +567,9 @@ public class EntityVillager extends EntityAgeable implements IMerchant, NPC {
ItemStack itemstack = this.inventory.getItem(j); ItemStack itemstack = this.inventory.getItem(j);
if (itemstack != null) { if (itemstack != null) {
if (itemstack.getItem() == Items.BREAD && itemstack.count >= 3 * i || itemstack.getItem() == Items.POTATO && itemstack.count >= 12 * i || itemstack.getItem() == Items.CARROT && itemstack.count >= 12 * i) { if (itemstack.getItem() == Items.BREAD && itemstack.count >= 3 * i
|| itemstack.getItem() == Items.POTATO && itemstack.count >= 12 * i
|| itemstack.getItem() == Items.CARROT && itemstack.count >= 12 * i) {
return true; return true;
} }
@ -751,11 +753,11 @@ public class EntityVillager extends EntityAgeable implements IMerchant, NPC {
static class MerchantOptionRandomRange extends Tuple<Integer, Integer> { static class MerchantOptionRandomRange extends Tuple<Integer, Integer> {
public MerchantOptionRandomRange(int i, int j) { public MerchantOptionRandomRange(int i, int j) {
super(Integer.valueOf(i), Integer.valueOf(j)); super(i, j);
} }
public int a(Random random) { public int a(Random random) {
return ((Integer) this.a()).intValue() >= ((Integer) this.b()).intValue() ? ((Integer) this.a()).intValue() : ((Integer) this.a()).intValue() + random.nextInt(((Integer) this.b()).intValue() - ((Integer) this.a()).intValue() + 1); return this.a() >= this.b() ? this.a() : this.a() + random.nextInt( this.b() - this.a() + 1);
} }
} }
} }

View File

@ -8,7 +8,7 @@ public class PathfinderGoalFloat extends PathfinderGoal {
this.a = entityinsentient; this.a = entityinsentient;
entityinsentient.goalFloat = this; // PaperSpigot entityinsentient.goalFloat = this; // PaperSpigot
this.a(4); this.a(4);
((Navigation) entityinsentient.getNavigation()).d(true); (entityinsentient.getNavigation()).d(true);
} }
public boolean a() { public boolean a() {

View File

@ -0,0 +1,61 @@
package net.minecraft.server;
public class PathfinderGoalMoveIndoors extends PathfinderGoal {
private EntityCreature a;
private VillageDoor b;
private int c = -1;
private int d = -1;
public PathfinderGoalMoveIndoors(EntityCreature var1) {
this.a = var1;
this.a(1);
}
public boolean a() {
BlockPosition blockPosition = new BlockPosition(this.a);
if ((!this.a.world.w() || this.a.world.S() && !this.a.world.getBiome(blockPosition).e()) && !this.a.world.worldProvider.o()) {
if (this.a.bc().nextInt(50) != 0) {
return false;
} else if (this.c != -1 && this.a.e(this.c, this.a.locY, this.d) < 4.0) {
return false;
} else {
Village var2 = this.a.world.ae().getClosestVillage(blockPosition, 14);
if (var2 == null) {
return false;
} else {
this.b = var2.c(blockPosition);
return this.b != null;
}
}
} else {
return false;
}
}
public boolean b() {
return !this.a.getNavigation().m();
}
public void c() {
this.c = -1;
BlockPosition var1 = this.b.e();
int var2 = var1.getX();
int var3 = var1.getY();
int var4 = var1.getZ();
if (this.a.b(var1) > 256.0) {
Vec3D var5 = RandomPositionGenerator.a(this.a, 14, 3, new Vec3D((double)var2 + 0.5, var3, (double)var4 + 0.5));
if (var5 != null) {
this.a.getNavigation().a(var5.a, var5.b, var5.c, 1.0);
}
} else {
this.a.getNavigation().a((double)var2 + 0.5, var3, var4 + 0.5, 1.0);
}
}
public void d() {
this.c = this.b.e().getX();
this.d = this.b.e().getZ();
this.b = null;
}
}

View File

@ -0,0 +1,40 @@
package net.minecraft.server;
public class PathfinderGoalMoveTowardsRestriction extends PathfinderGoal {
private EntityCreature a;
private double b;
private double c;
private double d;
private double e;
public PathfinderGoalMoveTowardsRestriction(EntityCreature var1, double var2) {
this.a = var1;
this.e = var2;
this.a(1);
}
public boolean a() {
if (this.a.cg()) {
return false;
} else {
BlockPosition var1 = this.a.ch();
Vec3D var2 = RandomPositionGenerator.a(this.a, 16, 7, new Vec3D(var1.getX(), var1.getY(), var1.getZ()));
if (var2 == null) {
return false;
} else {
this.b = var2.a;
this.c = var2.b;
this.d = var2.c;
return true;
}
}
}
public boolean b() {
return !this.a.getNavigation().m();
}
public void c() {
this.a.getNavigation().a(this.b, this.c, this.d, this.e);
}
}

View File

@ -0,0 +1,61 @@
package net.minecraft.server;
public class PathfinderGoalRandomStroll extends PathfinderGoal {
private EntityCreature a;
private double b;
private double c;
private double d;
private double e;
private int f;
private boolean g;
public PathfinderGoalRandomStroll(EntityCreature var1, double var2) {
this(var1, var2, 120);
}
public PathfinderGoalRandomStroll(EntityCreature var1, double var2, int var4) {
this.a = var1;
this.e = var2;
this.f = var4;
this.a(1);
}
public boolean a() {
if (!this.g) {
if (this.a.bh() >= 100) {
return false;
}
if (this.a.bc().nextInt(this.f) != 0) {
return false;
}
}
Vec3D var1 = RandomPositionGenerator.a(this.a, 10, 7);
if (var1 == null) {
return false;
} else {
this.b = var1.a;
this.c = var1.b;
this.d = var1.c;
this.g = false;
return true;
}
}
public boolean b() {
return !this.a.getNavigation().m();
}
public void c() {
this.a.getNavigation().a(this.b, this.c, this.d, this.e);
}
public void f() {
this.g = true;
}
public void setTimeBetweenMovement(int var1) {
this.f = var1;
}
}