mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-02 17:32:03 +01:00
Implemented 1.6!
By: Dinnerbone <dinnerbone@dinnerbone.com>
This commit is contained in:
parent
31ed3023b5
commit
dda3416326
4 changed files with 27 additions and 54 deletions
|
@ -39,7 +39,7 @@
|
|||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>minecraft-server</artifactId>
|
||||
<version>1.5</version>
|
||||
<version>1.6</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
|
|
@ -27,6 +27,7 @@ import net.minecraft.server.ChunkCoordinates;
|
|||
import net.minecraft.server.ConvertProgressUpdater;
|
||||
import net.minecraft.server.Convertable;
|
||||
import net.minecraft.server.EntityPlayer;
|
||||
import net.minecraft.server.EntityTracker;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.PropertyManager;
|
||||
import net.minecraft.server.ServerConfigurationManager;
|
||||
|
@ -36,6 +37,7 @@ import net.minecraft.server.WorldManager;
|
|||
import net.minecraft.server.WorldServer;
|
||||
import net.minecraft.server.ServerCommand;
|
||||
import net.minecraft.server.ICommandListener;
|
||||
import net.minecraft.server.SecondaryWorldServer;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
|
@ -57,7 +59,7 @@ import org.bukkit.util.config.Configuration;
|
|||
public final class CraftServer implements Server {
|
||||
private final String serverName = "Craftbukkit";
|
||||
private final String serverVersion;
|
||||
private final String protocolVersion = "1.5_02";
|
||||
private final String protocolVersion = "1.6.2";
|
||||
private final PluginManager pluginManager = new SimplePluginManager(this);
|
||||
private final ServicesManager servicesManager = new SimpleServicesManager();
|
||||
private final BukkitScheduler scheduler = new CraftScheduler(this);
|
||||
|
@ -364,12 +366,13 @@ public final class CraftServer implements Server {
|
|||
converter.convert(name, new ConvertProgressUpdater(console));
|
||||
}
|
||||
|
||||
WorldServer internal = new WorldServer(console, new ServerNBTManager(new File("."), name, true), name, environment == World.Environment.NETHER ? -1 : 0, seed);
|
||||
WorldServer internal = new WorldServer(console, new ServerNBTManager(new File("."), name, true), name, environment.getId(), seed);
|
||||
internal.z = console.worlds.get(0).z;
|
||||
|
||||
internal.tracker = new EntityTracker(console, environment.getId());
|
||||
internal.addIWorldAccess((IWorldAccess)new WorldManager(console, internal));
|
||||
internal.spawnMonsters = 1;
|
||||
internal.setSpawnFlags(true, true);
|
||||
console.serverConfigurationManager.setPlayerFileData(internal);
|
||||
console.worlds.add(internal);
|
||||
|
||||
short short1 = 196;
|
||||
|
|
|
@ -19,7 +19,7 @@ public class CraftCreeper extends CraftMonster implements Creeper {
|
|||
}
|
||||
|
||||
public boolean isPowered() {
|
||||
return getHandle().W().a(17) == 1;
|
||||
return getHandle().X().a(17) == 1;
|
||||
}
|
||||
|
||||
public void setPowered(boolean powered) {
|
||||
|
@ -32,14 +32,14 @@ public class CraftCreeper extends CraftMonster implements Creeper {
|
|||
server.getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
getHandle().W().b(17, (byte)1);
|
||||
getHandle().X().b(17, (byte)1);
|
||||
}
|
||||
} else {
|
||||
CreeperPowerEvent event = new CreeperPowerEvent(entity, CreeperPowerEvent.PowerCause.SET_OFF);
|
||||
server.getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
getHandle().W().b(17, (byte)0);
|
||||
getHandle().X().b(17, (byte)0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,8 @@ import net.minecraft.server.Packet6SpawnPosition;
|
|||
import net.minecraft.server.ServerConfigurationManager;
|
||||
import net.minecraft.server.WorldServer;
|
||||
import net.minecraft.server.ChunkCoordIntPair;
|
||||
import net.minecraft.server.Packet9Respawn;
|
||||
import net.minecraft.server.World;
|
||||
import org.bukkit.Achievement;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
|
@ -168,58 +170,26 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|||
WorldServer newWorld = ((CraftWorld)location.getWorld()).getHandle();
|
||||
ServerConfigurationManager manager = server.getHandle();
|
||||
EntityPlayer entity = getHandle();
|
||||
boolean teleportSuccess;
|
||||
|
||||
if (oldWorld != newWorld) {
|
||||
entity.dimension = newWorld.dimension;
|
||||
entity.netServerHandler.sendPacket(new Packet9Respawn((byte) entity.dimension));
|
||||
oldWorld.removeEntity(entity);
|
||||
entity.dead = false;
|
||||
|
||||
EntityPlayer newEntity = new EntityPlayer(manager.server, newWorld, entity.name, new ItemInWorldManager(newWorld));
|
||||
|
||||
newEntity.id = entity.id;
|
||||
newEntity.netServerHandler = entity.netServerHandler;
|
||||
newEntity.health = entity.health;
|
||||
newEntity.fireTicks = entity.fireTicks;
|
||||
newEntity.inventory = entity.inventory;
|
||||
newEntity.inventory.d = newEntity;
|
||||
newEntity.activeContainer = entity.activeContainer;
|
||||
newEntity.defaultContainer = entity.defaultContainer;
|
||||
newEntity.locX = location.getX();
|
||||
newEntity.locY = location.getY();
|
||||
newEntity.locZ = location.getZ();
|
||||
newEntity.displayName = entity.displayName;
|
||||
newEntity.compassTarget = entity.compassTarget;
|
||||
newEntity.fauxSleeping = entity.fauxSleeping;
|
||||
newWorld.chunkProviderServer.getChunkAt((int) location.getBlockX() >> 4, (int) location.getBlockZ() >> 4);
|
||||
|
||||
teleportSuccess = newEntity.netServerHandler.teleport(location);
|
||||
|
||||
if (teleportSuccess) {
|
||||
manager.server.tracker.trackPlayer(entity);
|
||||
manager.server.tracker.untrackEntity(entity);
|
||||
int cx = (int) location.getBlockX() >> 4;
|
||||
int cz = (int) location.getBlockZ() >> 4;
|
||||
for (int x = -10 ; x <= 10 ; x++) {
|
||||
for (int z = -10 ; z <= 10 ; z++) {
|
||||
ChunkCoordIntPair chunkPosition = new ChunkCoordIntPair(cx + x, cz + z);
|
||||
if (entity.g.remove(chunkPosition)) {
|
||||
newEntity.g.add(chunkPosition);
|
||||
}
|
||||
}
|
||||
}
|
||||
oldWorld.manager.removePlayer(entity);
|
||||
manager.players.remove(entity);
|
||||
oldWorld.removeEntity(entity);
|
||||
|
||||
newWorld.manager.addPlayer(newEntity);
|
||||
newWorld.addEntity(newEntity);
|
||||
manager.players.add(newEntity);
|
||||
|
||||
entity.netServerHandler.player = newEntity;
|
||||
this.entity = newEntity;
|
||||
|
||||
setCompassTarget(getCompassTarget());
|
||||
if (entity.Q()) {
|
||||
newWorld.addEntity(entity);
|
||||
entity.setPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
||||
newWorld.entityJoinedWorld(entity, false);
|
||||
}
|
||||
|
||||
return teleportSuccess;
|
||||
manager.a(entity);
|
||||
entity.netServerHandler.a(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
||||
entity.a((World)newWorld);
|
||||
manager.a(entity, newWorld);
|
||||
entity.a(entity.defaultContainer);
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return entity.netServerHandler.teleport(location);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue