mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 07:20:24 +01:00
Added LivingEntity.throwEgg() and LivingEntity.throwSnowball().
By: sk89q <the.sk89q@gmail.com>
This commit is contained in:
parent
73f551d19c
commit
1e159ac832
3 changed files with 51 additions and 0 deletions
|
@ -0,0 +1,15 @@
|
||||||
|
package org.bukkit.craftbukkit;
|
||||||
|
|
||||||
|
import net.minecraft.server.EntityEgg;
|
||||||
|
import org.bukkit.Egg;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An egg.
|
||||||
|
*
|
||||||
|
* @author sk89q
|
||||||
|
*/
|
||||||
|
public class CraftEgg extends CraftEntity implements Egg {
|
||||||
|
public CraftEgg(CraftServer server, EntityEgg ent) {
|
||||||
|
super(server, ent);
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,8 +2,13 @@
|
||||||
package org.bukkit.craftbukkit;
|
package org.bukkit.craftbukkit;
|
||||||
|
|
||||||
import net.minecraft.server.Entity;
|
import net.minecraft.server.Entity;
|
||||||
|
import net.minecraft.server.EntityEgg;
|
||||||
import net.minecraft.server.EntityLiving;
|
import net.minecraft.server.EntityLiving;
|
||||||
|
import net.minecraft.server.EntitySnowball;
|
||||||
|
|
||||||
|
import org.bukkit.Egg;
|
||||||
import org.bukkit.LivingEntity;
|
import org.bukkit.LivingEntity;
|
||||||
|
import org.bukkit.Snowball;
|
||||||
|
|
||||||
public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||||
private EntityLiving entity;
|
private EntityLiving entity;
|
||||||
|
@ -39,4 +44,20 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "CraftLivingEntity{" + "id=" + getEntityID() + '}';
|
return "CraftLivingEntity{" + "id=" + getEntityID() + '}';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Egg throwEgg() {
|
||||||
|
net.minecraft.server.World world = ((CraftWorld)getWorld()).getHandle();
|
||||||
|
EntityEgg egg = new EntityEgg(world, entity);
|
||||||
|
world.a(egg);
|
||||||
|
return new CraftEgg(server, egg);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Snowball throwSnowball() {
|
||||||
|
net.minecraft.server.World world = ((CraftWorld)getWorld()).getHandle();
|
||||||
|
EntitySnowball snowball = new EntitySnowball(world, entity);
|
||||||
|
world.a(snowball);
|
||||||
|
return new CraftSnowball(server, snowball);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
package org.bukkit.craftbukkit;
|
||||||
|
|
||||||
|
import net.minecraft.server.EntitySnowball;
|
||||||
|
import org.bukkit.Snowball;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A snowball.
|
||||||
|
*
|
||||||
|
* @author sk89q
|
||||||
|
*/
|
||||||
|
public class CraftSnowball extends CraftEntity implements Snowball {
|
||||||
|
public CraftSnowball(CraftServer server, EntitySnowball ent) {
|
||||||
|
super(server, ent);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue