mirror of
https://github.com/PaperMC/Paper.git
synced 2025-09-02 05:13:51 -07:00
Update for 1.4_00_01 -- if you bypassed Bukkit, you will most likely break.
This commit is contained in:
@@ -14,18 +14,18 @@ public class CraftCreature extends CraftLivingEntity implements Creature{
|
||||
public void setTarget(LivingEntity target) {
|
||||
EntityCreature entity = getHandle();
|
||||
if (target == null) {
|
||||
entity.d = null;
|
||||
entity.target = null;
|
||||
} else if (target instanceof CraftLivingEntity) {
|
||||
EntityLiving victim = ((CraftLivingEntity) target).getHandle();
|
||||
entity.d = victim;
|
||||
entity.a = entity.world.a(entity, entity.d, 16.0F);
|
||||
entity.target = victim;
|
||||
entity.pathEntity = entity.world.findPath(entity, entity.target, 16.0F);
|
||||
}
|
||||
}
|
||||
|
||||
public CraftLivingEntity getTarget() {
|
||||
if (getHandle().d == null) return null;
|
||||
if (getHandle().target == null) return null;
|
||||
|
||||
return (CraftLivingEntity) getHandle().d.getBukkitEntity();
|
||||
return (CraftLivingEntity) getHandle().target.getBukkitEntity();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -77,9 +77,9 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
else if (entity instanceof EntityItem) { return new CraftItem( server, (EntityItem) entity); }
|
||||
else if (entity instanceof EntityMinecart) {
|
||||
EntityMinecart mc = (EntityMinecart) entity;
|
||||
if (mc.d == CraftMinecart.Type.StorageMinecart.getId()) {
|
||||
if (mc.type == CraftMinecart.Type.StorageMinecart.getId()) {
|
||||
return new CraftStorageMinecart(server, mc);
|
||||
} else if (mc.d == CraftMinecart.Type.PoweredMinecart.getId()) {
|
||||
} else if (mc.type == CraftMinecart.Type.PoweredMinecart.getId()) {
|
||||
return new CraftPoweredMinecart(server, mc);
|
||||
} else {
|
||||
return new CraftMinecart(server, mc);
|
||||
@@ -103,7 +103,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
entity.motX = vel.getX();
|
||||
entity.motY = vel.getY();
|
||||
entity.motZ = vel.getZ();
|
||||
entity.aZ = true;
|
||||
entity.velocityChanged = true;
|
||||
}
|
||||
|
||||
public World getWorld() {
|
||||
@@ -112,8 +112,8 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
|
||||
public boolean teleport(Location location) {
|
||||
entity.world = ((CraftWorld)location.getWorld()).getHandle();
|
||||
entity.b(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
||||
// entity.b() throws no event, and so cannot be cancelled
|
||||
entity.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
||||
// entity.setLocation() throws no event, and so cannot be cancelled
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
public void setFireTicks(int ticks) {
|
||||
entity.fireTicks = ticks;
|
||||
}
|
||||
|
||||
|
||||
public void remove() {
|
||||
entity.dead = true;
|
||||
}
|
||||
@@ -238,11 +238,11 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
getHandle().passenger.setPassengerOf(null);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public float getFallDistance() {
|
||||
return getHandle().fallDistance;
|
||||
}
|
||||
|
||||
|
||||
public void setFallDistance(float distance) {
|
||||
getHandle().fallDistance = distance;
|
||||
}
|
||||
|
@@ -15,11 +15,11 @@ public class CraftItem extends CraftEntity implements Item {
|
||||
}
|
||||
|
||||
public ItemStack getItemStack() {
|
||||
return new CraftItemStack(item.a);
|
||||
return new CraftItemStack(item.itemStack);
|
||||
}
|
||||
|
||||
public void setItemStack(ItemStack stack) {
|
||||
item.a = new net.minecraft.server.ItemStack(stack.getTypeId(), stack.getAmount(), stack.getDurability());
|
||||
item.itemStack = new net.minecraft.server.ItemStack(stack.getTypeId(), stack.getAmount(), stack.getDurability());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -59,14 +59,14 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
public Egg throwEgg() {
|
||||
net.minecraft.server.World world = ((CraftWorld)getWorld()).getHandle();
|
||||
EntityEgg egg = new EntityEgg(world, getHandle());
|
||||
world.a(egg);
|
||||
world.addEntity(egg);
|
||||
return (Egg) egg.getBukkitEntity();
|
||||
}
|
||||
|
||||
public Snowball throwSnowball() {
|
||||
net.minecraft.server.World world = ((CraftWorld)getWorld()).getHandle();
|
||||
EntitySnowball snowball = new EntitySnowball(world, getHandle());
|
||||
world.a(snowball);
|
||||
world.addEntity(snowball);
|
||||
return (Snowball) snowball.getBukkitEntity();
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
public Arrow shootArrow() {
|
||||
net.minecraft.server.World world = ((CraftWorld)getWorld()).getHandle();
|
||||
EntityArrow arrow = new EntityArrow(world, getHandle());
|
||||
world.a(arrow);
|
||||
world.addEntity(arrow);
|
||||
return (Arrow) arrow.getBukkitEntity();
|
||||
}
|
||||
|
||||
@@ -167,11 +167,11 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
}
|
||||
|
||||
public void damage(int amount) {
|
||||
entity.a((Entity)null, amount);
|
||||
entity.damageEntity((Entity) null, amount);
|
||||
}
|
||||
|
||||
public void damage(int amount, org.bukkit.entity.Entity source) {
|
||||
entity.a(((CraftEntity)source).getHandle(), amount);
|
||||
entity.damageEntity(((CraftEntity) source).getHandle(), amount);
|
||||
}
|
||||
|
||||
public Location getEyeLocation() {
|
||||
|
@@ -39,11 +39,11 @@ public class CraftMinecart extends CraftVehicle implements Minecart {
|
||||
}
|
||||
|
||||
public void setDamage(int damage) {
|
||||
minecart.a = damage;
|
||||
minecart.damage = damage;
|
||||
}
|
||||
|
||||
public int getDamage() {
|
||||
return minecart.a;
|
||||
return minecart.damage;
|
||||
}
|
||||
|
||||
public double getMaxSpeed() {
|
||||
|
@@ -23,7 +23,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
}
|
||||
|
||||
public boolean isOp() {
|
||||
return server.getHandle().h(getName());
|
||||
return server.getHandle().isOp(getName());
|
||||
}
|
||||
|
||||
public boolean isPlayer() {
|
||||
@@ -31,7 +31,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
}
|
||||
|
||||
public boolean isOnline() {
|
||||
for (Object obj: server.getHandle().b) {
|
||||
for (Object obj: server.getHandle().players) {
|
||||
EntityPlayer player = (EntityPlayer) obj;
|
||||
if (player.name.equalsIgnoreCase(getName())) {
|
||||
return true;
|
||||
@@ -41,7 +41,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
}
|
||||
|
||||
public InetSocketAddress getAddress() {
|
||||
SocketAddress addr = getHandle().a.b.b();
|
||||
SocketAddress addr = getHandle().netServerHandler.networkManager.getSocketAddress();
|
||||
if (addr instanceof InetSocketAddress) {
|
||||
return (InetSocketAddress) addr;
|
||||
} else {
|
||||
@@ -76,12 +76,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
}
|
||||
|
||||
public void sendRawMessage(String message) {
|
||||
getHandle().a.b(new Packet3Chat(message));
|
||||
getHandle().netServerHandler.sendPacket(new Packet3Chat(message));
|
||||
}
|
||||
|
||||
public void sendMessage(String message) {
|
||||
for (final String line: TextWrapper.wrapText(message)) {
|
||||
getHandle().a.b(new Packet3Chat(line));
|
||||
getHandle().netServerHandler.sendPacket(new Packet3Chat(line));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,12 +121,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
}
|
||||
|
||||
public void kickPlayer(String message) {
|
||||
getHandle().a.a(message == null ? "" : message);
|
||||
getHandle().netServerHandler.disconnect(message == null ? "" : message);
|
||||
}
|
||||
|
||||
public void setCompassTarget(Location loc) {
|
||||
// Do not directly assign here, from the packethandler we'll assign it.
|
||||
getHandle().a.b((Packet) new Packet6SpawnPosition(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
|
||||
getHandle().netServerHandler.sendPacket(new Packet6SpawnPosition(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
|
||||
}
|
||||
|
||||
public Location getCompassTarget() {
|
||||
@@ -134,7 +134,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
}
|
||||
|
||||
public void chat(String msg) {
|
||||
getHandle().a.chat(msg);
|
||||
getHandle().netServerHandler.chat(msg);
|
||||
}
|
||||
|
||||
public boolean performCommand(String command) {
|
||||
@@ -151,10 +151,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
|
||||
if (oldWorld != newWorld) {
|
||||
|
||||
EntityPlayer newEntity = new EntityPlayer(manager.c, newWorld, entity.name, new ItemInWorldManager(newWorld));
|
||||
EntityPlayer newEntity = new EntityPlayer(manager.server, newWorld, entity.name, new ItemInWorldManager(newWorld));
|
||||
|
||||
newEntity.id = entity.id;
|
||||
newEntity.a = entity.a;
|
||||
newEntity.netServerHandler = entity.netServerHandler;
|
||||
newEntity.health = entity.health;
|
||||
newEntity.fireTicks = entity.fireTicks;
|
||||
newEntity.inventory = entity.inventory;
|
||||
@@ -167,22 +167,22 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
newEntity.displayName = entity.displayName;
|
||||
newEntity.compassTarget = entity.compassTarget;
|
||||
newEntity.fauxSleeping = entity.fauxSleeping;
|
||||
newWorld.u.c((int) location.getBlockX() >> 4, (int) location.getBlockZ() >> 4);
|
||||
newWorld.chunkProviderServer.getChunkAt((int) location.getBlockX() >> 4, (int) location.getBlockZ() >> 4);
|
||||
|
||||
teleportSuccess = newEntity.a.teleport(location);
|
||||
teleportSuccess = newEntity.netServerHandler.teleport(location);
|
||||
|
||||
if (teleportSuccess) {
|
||||
manager.c.k.a(entity);
|
||||
manager.c.k.b(entity);
|
||||
oldWorld.manager.b(entity);
|
||||
manager.b.remove(entity);
|
||||
oldWorld.e(entity);
|
||||
manager.server.tracker.trackPlayer(entity);
|
||||
manager.server.tracker.untrackEntity(entity);
|
||||
oldWorld.manager.removePlayer(entity);
|
||||
manager.players.remove(entity);
|
||||
oldWorld.removeEntity(entity);
|
||||
|
||||
newWorld.manager.a(newEntity);
|
||||
newWorld.a(newEntity);
|
||||
manager.b.add(newEntity);
|
||||
newWorld.manager.addPlayer(newEntity);
|
||||
newWorld.addEntity(newEntity);
|
||||
manager.players.add(newEntity);
|
||||
|
||||
entity.a.e = newEntity;
|
||||
entity.netServerHandler.player = newEntity;
|
||||
this.entity = newEntity;
|
||||
|
||||
setCompassTarget(getCompassTarget());
|
||||
@@ -190,33 +190,33 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
|
||||
return teleportSuccess;
|
||||
} else {
|
||||
return entity.a.teleport(location);
|
||||
return entity.netServerHandler.teleport(location);
|
||||
}
|
||||
}
|
||||
|
||||
public void setSneaking(boolean sneak) {
|
||||
getHandle().e(sneak);
|
||||
getHandle().setSneak(sneak);
|
||||
}
|
||||
|
||||
public boolean isSneaking() {
|
||||
return getHandle().Z();
|
||||
return getHandle().isSneaking();
|
||||
}
|
||||
|
||||
public void loadData() {
|
||||
server.getHandle().n.b(getHandle());
|
||||
server.getHandle().playerFileData.b(getHandle());
|
||||
}
|
||||
|
||||
public void saveData() {
|
||||
server.getHandle().n.a(getHandle());
|
||||
server.getHandle().playerFileData.a(getHandle());
|
||||
}
|
||||
|
||||
public void updateInventory() {
|
||||
getHandle().m();
|
||||
getHandle().syncInventory();
|
||||
}
|
||||
|
||||
public void setSleepingIgnored(boolean isSleeping) {
|
||||
getHandle().fauxSleeping = isSleeping;
|
||||
((CraftWorld)getWorld()).getHandle().checkSleepStatus();
|
||||
((CraftWorld) getWorld()).getHandle().checkSleepStatus();
|
||||
}
|
||||
|
||||
public boolean isSleepingIgnored() {
|
||||
|
@@ -10,8 +10,7 @@ import org.bukkit.entity.PoweredMinecart;
|
||||
*
|
||||
* @author sk89q
|
||||
*/
|
||||
public class CraftPoweredMinecart extends CraftMinecart
|
||||
implements PoweredMinecart {
|
||||
public class CraftPoweredMinecart extends CraftMinecart implements PoweredMinecart {
|
||||
public CraftPoweredMinecart(CraftServer server, EntityMinecart entity) {
|
||||
super(server, entity);
|
||||
}
|
||||
|
@@ -22,19 +22,19 @@ public class CraftSheep extends CraftAnimals implements Sheep {
|
||||
}
|
||||
|
||||
public DyeColor getColor() {
|
||||
return DyeColor.getByData((byte) getHandle().o());
|
||||
return DyeColor.getByData((byte) getHandle().getColor());
|
||||
}
|
||||
|
||||
public void setColor(DyeColor color) {
|
||||
getHandle().a_(color.getData());
|
||||
getHandle().setColor(color.getData());
|
||||
}
|
||||
|
||||
public boolean isSheared() {
|
||||
return getHandle().j_();
|
||||
return getHandle().isSheared();
|
||||
}
|
||||
|
||||
public void setSheared(boolean flag) {
|
||||
getHandle().a(flag);
|
||||
getHandle().setSheared(flag);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -25,6 +25,6 @@ public class CraftSlime extends CraftLivingEntity implements Slime {
|
||||
}
|
||||
|
||||
public void setSize(int size) {
|
||||
getHandle().e(size);
|
||||
getHandle().setSize(size);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user