updated EntityEgg
Dieser Commit ist enthalten in:
Ursprung
94bccb6f92
Commit
6a34f200ae
@ -1,9 +1,12 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.MobType;
|
||||
import org.bukkit.craftbukkit.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.event.Event.Type;
|
||||
import org.bukkit.event.player.PlayerEggThrowEvent;
|
||||
|
||||
public class EntityEgg extends Entity {
|
||||
|
||||
@ -150,20 +153,69 @@ public class EntityEgg extends Entity {
|
||||
;
|
||||
}
|
||||
}
|
||||
if (!this.l.z && W.nextInt(8) == 0) {
|
||||
byte byte0 = 1;
|
||||
|
||||
if (W.nextInt(32) == 0) {
|
||||
byte0 = 4;
|
||||
// Craftbukkit start
|
||||
boolean hatching = !this.l.z && W.nextInt(8) == 0;
|
||||
byte numHatching = (hatching && W.nextInt(32) == 0) ? (byte) 4 : (byte) 1;
|
||||
if (!hatching) {
|
||||
numHatching = 0;
|
||||
}
|
||||
for (int k = 0; k < byte0; k++) {
|
||||
EntityChicken entitychicken = new EntityChicken(this.l);
|
||||
MobType type = MobType.CHICKEN;
|
||||
|
||||
entitychicken.c(p, q, r, v, 0.0F);
|
||||
this.l.a(entitychicken);
|
||||
if (aj instanceof EntityPlayerMP) {
|
||||
CraftServer server = ((WorldServer) l).getServer();
|
||||
CraftPlayer player = new CraftPlayer(server, (EntityPlayerMP) aj);
|
||||
PlayerEggThrowEvent event = new PlayerEggThrowEvent(Type.PLAYER_EGG_THROW, player, hatching, numHatching, type);
|
||||
server.getPluginManager().callEvent(event);
|
||||
hatching = event.isHatching();
|
||||
numHatching = event.getNumHatches();
|
||||
type = event.getHatchType();
|
||||
}
|
||||
|
||||
if (hatching) {
|
||||
for (int k = 0; k < numHatching; k++) {
|
||||
Entity entity = null;
|
||||
switch (type) {
|
||||
case CHICKEN:
|
||||
entity = new EntityChicken(this.l);
|
||||
break;
|
||||
case COW:
|
||||
entity = new EntityCow(this.l);
|
||||
break;
|
||||
case CREEPER:
|
||||
entity = new EntityCreeper(this.l);
|
||||
break;
|
||||
case GHAST:
|
||||
entity = new EntityGhast(this.l);
|
||||
break;
|
||||
case PIG:
|
||||
entity = new EntityPig(this.l);
|
||||
break;
|
||||
case PIG_ZOMBIE:
|
||||
entity = new EntityPigZombie(this.l);
|
||||
break;
|
||||
case SHEEP:
|
||||
entity = new EntitySheep(this.l);
|
||||
break;
|
||||
case SKELETON:
|
||||
entity = new EntitySkeleton(this.l);
|
||||
break;
|
||||
case SPIDER:
|
||||
entity = new EntitySpider(this.l);
|
||||
break;
|
||||
case ZOMBIE:
|
||||
entity = new EntityZombie(this.l);
|
||||
break;
|
||||
default:
|
||||
entity = new EntityChicken(this.l);
|
||||
break;
|
||||
}
|
||||
entity.c(p, q, r, v, 0.0F);
|
||||
this.l.a(entity);
|
||||
}
|
||||
}
|
||||
// Craftbukkit stop
|
||||
|
||||
for (int j = 0; j < 8; j++) {
|
||||
this.l.a("snowballpoof", p, q, r, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
@ -235,4 +287,3 @@ public class EntityEgg extends Entity {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren