3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-19 04:50:06 +01:00

Implemented new age methods in animals, and made spawned animals via eggs properly age back to children

Dieser Commit ist enthalten in:
Nathan Adams 2011-11-24 20:16:43 +00:00
Ursprung 47b4406b7e
Commit a7664a104f
2 geänderte Dateien mit 14 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -1,6 +1,7 @@
package net.minecraft.server; package net.minecraft.server;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Animals;
import org.bukkit.entity.CreatureType; import org.bukkit.entity.CreatureType;
import org.bukkit.entity.Projectile; import org.bukkit.entity.Projectile;
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
@ -74,7 +75,11 @@ public class EntityEgg extends EntityProjectile {
if (hatching) { if (hatching) {
for (int k = 0; k < numHatching; k++) { for (int k = 0; k < numHatching; k++) {
world.getWorld().spawn(new Location(world.getWorld(), this.locX, this.locY, this.locZ, this.yaw, 0.0F), hatchingType.getEntityClass(), SpawnReason.EGG); org.bukkit.entity.Entity entity = world.getWorld().spawn(new Location(world.getWorld(), this.locX, this.locY, this.locZ, this.yaw, 0.0F), hatchingType.getEntityClass(), SpawnReason.EGG);
if (entity instanceof Animals) {
((Animals)entity).setAge(-24000);
}
} }
} }
// CraftBukkit end // CraftBukkit end

Datei anzeigen

@ -19,4 +19,12 @@ public class CraftAnimals extends CraftCreature implements Animals {
public EntityAnimal getHandle() { public EntityAnimal getHandle() {
return (EntityAnimal) entity; return (EntityAnimal) entity;
} }
public int getAge() {
return getHandle().getAge();
}
public void setAge(int age) {
getHandle().setAge(age);
}
} }