@@ -0,0 +1,85 @@
|
||||
package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import net.minecraft.server.BlockPosition;
|
||||
import net.minecraft.server.EntityBee;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.Bee;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
public class CraftBee extends CraftAnimals implements Bee {
|
||||
|
||||
public CraftBee(CraftServer server, EntityBee entity) {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityBee getHandle() {
|
||||
return (EntityBee) entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CraftBee";
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityType getType() {
|
||||
return EntityType.BEE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getHive() {
|
||||
BlockPosition hive = getHandle().getHivePos();
|
||||
return (hive == null) ? null : new Location(getWorld(), hive.getX(), hive.getY(), hive.getZ());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHive(Location location) {
|
||||
Preconditions.checkArgument(location == null || this.getWorld().equals(location.getWorld()), "Hive must be in same world");
|
||||
getHandle().hivePos = (location == null) ? null : new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getFlower() {
|
||||
BlockPosition flower = getHandle().getFlowerPos();
|
||||
return (flower == null) ? null : new Location(getWorld(), flower.getX(), flower.getY(), flower.getZ());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFlower(Location location) {
|
||||
Preconditions.checkArgument(location == null || this.getWorld().equals(location.getWorld()), "Flower must be in same world");
|
||||
getHandle().setFlowerPos(location == null ? null : new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNectar() {
|
||||
return getHandle().hasNectar();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHasNectar(boolean nectar) {
|
||||
getHandle().setHasNectar(nectar);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasStung() {
|
||||
return getHandle().hasStung();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHasStung(boolean stung) {
|
||||
getHandle().setHasStung(stung);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAnger() {
|
||||
return getHandle().getAnger();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAnger(int anger) {
|
||||
getHandle().setAnger(anger);
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@ import net.minecraft.server.EntityAreaEffectCloud;
|
||||
import net.minecraft.server.EntityArmorStand;
|
||||
import net.minecraft.server.EntityArrow;
|
||||
import net.minecraft.server.EntityBat;
|
||||
import net.minecraft.server.EntityBee;
|
||||
import net.minecraft.server.EntityBlaze;
|
||||
import net.minecraft.server.EntityBoat;
|
||||
import net.minecraft.server.EntityCat;
|
||||
@@ -232,6 +233,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
else if (entity instanceof EntityOcelot) { return new CraftOcelot(server, (EntityOcelot) entity); }
|
||||
else if (entity instanceof EntityPanda) { return new CraftPanda(server, (EntityPanda) entity); }
|
||||
else if (entity instanceof EntityFox) { return new CraftFox(server, (EntityFox) entity); }
|
||||
else if (entity instanceof EntityBee) { return new CraftBee(server, (EntityBee) entity); }
|
||||
else { return new CraftAnimals(server, (EntityAnimal) entity); }
|
||||
}
|
||||
// Monsters
|
||||
@@ -372,16 +374,16 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
|
||||
@Override
|
||||
public Location getLocation() {
|
||||
return new Location(getWorld(), entity.locX, entity.locY, entity.locZ, entity.getBukkitYaw(), entity.pitch);
|
||||
return new Location(getWorld(), entity.locX(), entity.locY(), entity.locZ(), entity.getBukkitYaw(), entity.pitch);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getLocation(Location loc) {
|
||||
if (loc != null) {
|
||||
loc.setWorld(getWorld());
|
||||
loc.setX(entity.locX);
|
||||
loc.setY(entity.locY);
|
||||
loc.setZ(entity.locZ);
|
||||
loc.setX(entity.locX());
|
||||
loc.setY(entity.locY());
|
||||
loc.setZ(entity.locZ());
|
||||
loc.setYaw(entity.getBukkitYaw());
|
||||
loc.setPitch(entity.pitch);
|
||||
}
|
||||
|
||||
@@ -71,11 +71,11 @@ public class CraftFirework extends CraftEntity implements Firework {
|
||||
|
||||
@Override
|
||||
public boolean isShotAtAngle() {
|
||||
return getHandle().i();
|
||||
return getHandle().isShotAtAngle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setShotAtAngle(boolean shotAtAngle) {
|
||||
getHandle().getDataWatcher().set(EntityFireworks.d, shotAtAngle);
|
||||
getHandle().getDataWatcher().set(EntityFireworks.SHOT_AT_ANGLE, shotAtAngle);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ public class CraftFishHook extends AbstractProjectile implements FishHook {
|
||||
EntityFishingHook hook = getHandle();
|
||||
|
||||
if (this.biteChance == -1) {
|
||||
if (hook.world.isRainingAt(new BlockPosition(MathHelper.floor(hook.locX), MathHelper.floor(hook.locY) + 1, MathHelper.floor(hook.locZ)))) {
|
||||
if (hook.world.isRainingAt(new BlockPosition(MathHelper.floor(hook.locX()), MathHelper.floor(hook.locY()) + 1, MathHelper.floor(hook.locZ())))) {
|
||||
return 1/300.0;
|
||||
}
|
||||
return 1/500.0;
|
||||
|
||||
@@ -164,9 +164,9 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
||||
@Override
|
||||
public void setBedSpawnLocation(Location location, boolean override) {
|
||||
if (location == null) {
|
||||
getHandle().setRespawnPosition(null, override);
|
||||
getHandle().setRespawnPosition(null, override, false);
|
||||
} else {
|
||||
getHandle().setRespawnPosition(new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()), override);
|
||||
getHandle().setRespawnPosition(new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()), override, false);
|
||||
getHandle().spawnWorld = location.getWorld().getName();
|
||||
}
|
||||
}
|
||||
@@ -198,7 +198,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
||||
public void wakeup(boolean setSpawnLocation) {
|
||||
Preconditions.checkState(isSleeping(), "Cannot wakeup if not sleeping");
|
||||
|
||||
getHandle().wakeup(true, true, setSpawnLocation);
|
||||
getHandle().wakeup(true, setSpawnLocation);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -335,7 +335,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
||||
if (iinventory instanceof TileEntity) {
|
||||
TileEntity te = (TileEntity) iinventory;
|
||||
if (!te.hasWorld()) {
|
||||
te.setWorld(getHandle().world);
|
||||
te.setLocation(getHandle().world, getHandle().getChunkCoordinates());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -473,7 +473,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
||||
openCustomInventory(inventory, player, Containers.LOOM);
|
||||
break;
|
||||
case CARTOGRAPHY:
|
||||
openCustomInventory(inventory, player, Containers.CARTOGRAPHY);
|
||||
openCustomInventory(inventory, player, Containers.CARTOGRAPHY_TABLE);
|
||||
break;
|
||||
case GRINDSTONE:
|
||||
openCustomInventory(inventory, player, Containers.GRINDSTONE);
|
||||
|
||||
@@ -30,6 +30,6 @@ public class CraftPillager extends CraftIllager implements Pillager {
|
||||
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
return new CraftInventory(getHandle().getInventory());
|
||||
return new CraftInventory(getHandle().inventory);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +66,6 @@ import net.minecraft.server.WhiteListEntry;
|
||||
import net.minecraft.server.WorldServer;
|
||||
import org.apache.commons.lang.NotImplementedException;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Achievement;
|
||||
import org.bukkit.BanList;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.DyeColor;
|
||||
@@ -713,21 +712,6 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
return getHandle().fauxSleeping;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void awardAchievement(Achievement achievement) {
|
||||
throw new UnsupportedOperationException("Not supported in this Minecraft version.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAchievement(Achievement achievement) {
|
||||
throw new UnsupportedOperationException("Not supported in this Minecraft version.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasAchievement(Achievement achievement) {
|
||||
throw new UnsupportedOperationException("Not supported in this Minecraft version.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void incrementStatistic(Statistic statistic) {
|
||||
incrementStatistic(statistic, 1);
|
||||
|
||||
@@ -94,7 +94,7 @@ public class CraftVillager extends CraftAbstractVillager implements Villager {
|
||||
return false;
|
||||
}
|
||||
|
||||
getHandle().e(position); // PAIL rename sleep
|
||||
getHandle().entitySleep(position);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ public class CraftVillager extends CraftAbstractVillager implements Villager {
|
||||
public void wakeup() {
|
||||
Preconditions.checkState(isSleeping(), "Cannot wakeup if not sleeping");
|
||||
|
||||
getHandle().dy(); // PAIL rename wakeup
|
||||
getHandle().entityWakeup();
|
||||
}
|
||||
|
||||
public static Profession nmsToBukkitProfession(VillagerProfession nms) {
|
||||
|
||||
Reference in New Issue
Block a user