3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-18 20:40:08 +01:00

Generic cleanup

Dieser Commit ist enthalten in:
Erik Broes 2011-06-12 00:02:58 +02:00
Ursprung 938db4de2d
Commit 96b1b8a10c
37 geänderte Dateien mit 667 neuen und 635 gelöschten Zeilen

Datei anzeigen

@ -114,10 +114,8 @@ public class BlockDispenser extends BlockContainer {
if (itemstack == null) {
world.e(1001, i, j, k, 0);
} else {
double d3;
// CraftBukkit start
d3 = random.nextDouble() * 0.1D + 0.2D;
double d3 = random.nextDouble() * 0.1D + 0.2D;
double motX = (double) b0 * d3;
double motY = 0.20000000298023224D;
double motZ = (double) b1 * d3;
@ -167,9 +165,9 @@ public class BlockDispenser extends BlockContainer {
world.e(1002, i, j, k, 0);
} else {
EntityItem entityitem = new EntityItem(world, d0, d1 - 0.3D, d2, itemstack);
// CraftBukkit start
d3 = random.nextDouble() * 0.1D + 0.2D;
// double d3 = random.nextDouble() * 0.1D + 0.2D; // Moved up
entityitem.motX = motX;
entityitem.motY = motY;
entityitem.motZ = motZ;

Datei anzeigen

@ -177,8 +177,8 @@ public class BlockDoor extends Block {
int power = block.getBlockPower();
int powerTop = blockTop.getBlockPower();
if (powerTop > power) power = powerTop;
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, (world.getData(i, j, k) & 4) > 0 ? 15 : 0, power);
server.getPluginManager().callEvent(eventRedstone);
flag1 = eventRedstone.getNewCurrent() > 0;

Datei anzeigen

@ -128,6 +128,7 @@ public class BlockFlowing extends BlockFluids {
// CraftBukkit start - all four cardinal directions. Do not change the order!
BlockFace[] faces = new BlockFace[] { BlockFace.NORTH, BlockFace.SOUTH, BlockFace.EAST, BlockFace.WEST };
int index = 0;
for (BlockFace currentFace: faces) {
if (aboolean[index]) {
BlockFromToEvent event = new BlockFromToEvent(source, currentFace);

Datei anzeigen

@ -2,10 +2,12 @@ package net.minecraft.server;
import java.util.Random;
// CraftBukkit start
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.block.CraftBlock;
import org.bukkit.event.entity.EntityPortalEnterEvent;
// CraftBukkit end
public class BlockPortal extends BlockBreakable {
@ -144,6 +146,7 @@ public class BlockPortal extends BlockBreakable {
EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(craftWorld, i, j, k));
Bukkit.getServer().getPluginManager().callEvent(event);
// CraftBukkit end
entity.O();
}
}

Datei anzeigen

@ -108,14 +108,15 @@ public class BlockPressurePlate extends Block {
for (Object object: list) {
if (object != null) {
Cancellable cancellable;
if (object instanceof EntityHuman) {
cancellable = CraftEventFactory.callPlayerInteractEvent((EntityHuman) object, Action.PHYSICAL, i, j, k, -1, null);
}
else if (object instanceof Entity) {
} else if (object instanceof Entity) {
cancellable = new EntityInteractEvent(((Entity) object).getBukkitEntity(), ((WorldServer) world).getWorld().getBlockAt(i, j, k));
((CraftServer) Bukkit.getServer()).getPluginManager().callEvent((EntityInteractEvent) cancellable);
} else {
continue;
}
else continue;
if (cancellable.isCancelled()) {
return;
}

Datei anzeigen

@ -362,9 +362,9 @@ public class Chunk {
if (i != this.x || j != this.z) {
System.out.println("Wrong location! " + entity);
// Thread.dumpStack(); // CraftBukkit
// CraftBukkit
System.out.println("" + entity.locX + "," + entity.locZ + "(" + i + "," + j + ") vs " + this.x + "," + this.z);
// Thread.dumpStack(); // CraftBukkit
}
int k = MathHelper.floor(entity.locY / 16.0D);

Datei anzeigen

@ -6,10 +6,10 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Set;
// CraftBukkit start
import java.util.Random;
import org.bukkit.Server;
import org.bukkit.craftbukkit.CraftChunk;
import org.bukkit.craftbukkit.CraftServer;
@ -175,7 +175,7 @@ public class ChunkProviderServer implements IChunkProvider {
if (this.chunkProvider != null) {
this.chunkProvider.getChunkAt(ichunkprovider, i, j);
// Craftbukkit start
// CraftBukkit start
BlockSand.a = true;
Random random = new Random();
random.setSeed(world.getSeed());
@ -186,7 +186,7 @@ public class ChunkProviderServer implements IChunkProvider {
populator.populate(world.getWorld(), random, chunk.bukkitChunk);
}
BlockSand.a = false;
// Craftbukkit end
// CraftBukkit end
chunk.f();
}

Datei anzeigen

@ -4,12 +4,12 @@ import java.util.Iterator;
import java.util.Set;
import java.util.logging.Logger;
// Craftbukkit start
// CraftBukkit start
import java.util.List;
import org.bukkit.craftbukkit.command.ServerCommandListener;
import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.command.CommandSender;
// Craftbukkit end
// CraftBukkit end
public class ConsoleCommandHandler {
@ -44,7 +44,7 @@ public class ConsoleCommandHandler {
serverconfigurationmanager.savePlayers();
}
// Craftbukkit start
// CraftBukkit start
for (i = 0; i < this.server.worlds.size(); ++i) {
worldserver = this.server.worlds.get(i);
boolean save = worldserver.E;
@ -58,15 +58,15 @@ public class ConsoleCommandHandler {
} else if (s.toLowerCase().startsWith("save-off")) {
this.print(s1, "Disabling level saving..");
for (i = 0; i < this.server.worlds.size(); ++i) { // Craftbukkit start
worldserver = this.server.worlds.get(i); // Craftbukkit start
for (i = 0; i < this.server.worlds.size(); ++i) { // CraftBukkit
worldserver = this.server.worlds.get(i); // CraftBukkit
worldserver.E = true;
}
} else if (s.toLowerCase().startsWith("save-on")) {
this.print(s1, "Enabling level saving..");
for (i = 0; i < this.server.worlds.size(); ++i) { // Craftbukkit start
worldserver = this.server.worlds.get(i); // Craftbukkit start
for (i = 0; i < this.server.worlds.size(); ++i) { // CraftBukkit
worldserver = this.server.worlds.get(i); // CraftBukkit
worldserver.E = false;
}
} else {
@ -205,15 +205,15 @@ public class ConsoleCommandHandler {
WorldServer worldserver1;
if ("add".equalsIgnoreCase(s3)) {
for (k = 0; k < this.server.worlds.size(); ++k) { // Craftbukkit start
worldserver1 = this.server.worlds.get(k); // Craftbukkit start
for (k = 0; k < this.server.worlds.size(); ++k) { // CraftBukkit
worldserver1 = this.server.worlds.get(k); // CraftBukkit
worldserver1.setTime(worldserver1.getTime() + (long) j);
}
this.print(s1, "Added " + j + " to time");
} else if ("set".equalsIgnoreCase(s3)) {
for (k = 0; k < this.server.worlds.size(); ++k) { // Craftbukkit start
worldserver1 = this.server.worlds.get(k); // Craftbukkit start
for (k = 0; k < this.server.worlds.size(); ++k) { // CraftBukkit
worldserver1 = this.server.worlds.get(k); // CraftBukkit
worldserver1.setTime((long) j);
}

Datei anzeigen

@ -755,8 +755,9 @@ public abstract class Entity {
if (world == null) {
this.die();
this.world = ((CraftWorld) Bukkit.getServer().getWorlds().get(0)).getHandle();
} else {
this.world = world;
}
else this.world = world;
// CraftBukkit end
}
@ -909,9 +910,11 @@ public abstract class Entity {
nbttagcompound.a("Fire", (short) this.fireTicks);
nbttagcompound.a("Air", (short) this.airTicks);
nbttagcompound.a("OnGround", this.onGround);
nbttagcompound.setString("World", world.worldData.name); // CraftBukkit
nbttagcompound.a("UUIDLeast", this.uniqueId.getLeastSignificantBits()); // CraftBukkit
nbttagcompound.a("UUIDMost", this.uniqueId.getMostSignificantBits()); // CraftBukkit
// CraftBukkit start
nbttagcompound.setString("World", world.worldData.name);
nbttagcompound.a("UUIDLeast", this.uniqueId.getLeastSignificantBits());
nbttagcompound.a("UUIDMost", this.uniqueId.getMostSignificantBits());
// CraftBukkit end
this.b(nbttagcompound);
}
@ -923,6 +926,19 @@ public abstract class Entity {
this.motX = ((NBTTagDouble) nbttaglist1.a(0)).a;
this.motY = ((NBTTagDouble) nbttaglist1.a(1)).a;
this.motZ = ((NBTTagDouble) nbttaglist1.a(2)).a;
/* CraftBukkit start - moved section down
if (Math.abs(this.motX) > 10.0D) {
this.motX = 0.0D;
}
if (Math.abs(this.motY) > 10.0D) {
this.motY = 0.0D;
}
if (Math.abs(this.motZ) > 10.0D) {
this.motZ = 0.0D;
}
// CraftBukkit end */
this.lastX = this.bo = this.locX = ((NBTTagDouble) nbttaglist.a(0)).a;
this.lastY = this.bp = this.locY = ((NBTTagDouble) nbttaglist.a(1)).a;

Datei anzeigen

@ -383,7 +383,7 @@ public class EntityBoat extends Entity {
}
if (this.passenger != null && this.passenger.dead) {
this.passenger.vehicle = null;
this.passenger.vehicle = null; // CraftBukkit
this.passenger = null;
}
}

Datei anzeigen

@ -152,6 +152,7 @@ public class EntityFireball extends Entity {
CraftServer server = ((WorldServer) this.world).getServer();
ExplosionPrimeEvent event = new ExplosionPrimeEvent(CraftEntity.getEntity(server, this), 1.0F, true);
server.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
// give 'this' instead of (Entity) null so we know what causes the damage

Datei anzeigen

@ -602,6 +602,7 @@ public abstract class EntityHuman extends EntityLiving {
Player player = (Player) this.getBukkitEntity();
CraftServer server = ((WorldServer) world).getServer();
org.bukkit.block.Block bed = ((WorldServer) world).getWorld().getBlockAt(i, j, k);
PlayerBedEnterEvent event = new PlayerBedEnterEvent(player, bed);
server.getPluginManager().callEvent(event);
@ -760,7 +761,7 @@ public abstract class EntityHuman extends EntityLiving {
public void a(ChunkCoordinates chunkcoordinates) {
if (chunkcoordinates != null) {
this.b = new ChunkCoordinates(chunkcoordinates);
this.spawnWorld = world.worldData.name;
this.spawnWorld = world.worldData.name; // CraftBukkit
} else {
this.b = null;
}

Datei anzeigen

@ -583,7 +583,7 @@ public class EntityMinecart extends Entity implements IInventory {
}
if (this.passenger != null && this.passenger.dead) {
this.passenger.vehicle = null;
this.passenger.vehicle = null; // CraftBukkit
this.passenger = null;
}

Datei anzeigen

@ -315,6 +315,7 @@ public class EntityWolf extends EntityAnimal {
return false;
}
// CraftBukkit end
this.d(true);
this.a((PathEntity) null);
this.setSitting(true);

Datei anzeigen

@ -66,9 +66,9 @@ public class ItemFlintAndSteel extends Item {
itemstack.damage(1, entityhuman);
return false;
}
// CraftBukkit end
BlockState blockState = CraftBlockState.getBlockState(world, i, j, k); // CraftBukkit
BlockState blockState = CraftBlockState.getBlockState(world, i, j, k);
// CraftBukkit end
world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "fire.ignite", 1.0F, b.nextFloat() * 0.4F + 0.8F);
world.setTypeId(i, j, k, Block.FIRE.id);

Datei anzeigen

@ -51,6 +51,7 @@ public class ItemInWorldManager {
}
public void dig(int i, int j, int k, int l) {
// this.world.a((EntityHuman) null, i, j, k, l); // CraftBukkit - moved down
this.d = (int) (System.currentTimeMillis() / 50); // CraftBukkit
int i1 = this.world.getTypeId(i, j, k);

Datei anzeigen

@ -437,7 +437,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
StatisticList.a();
try {
MinecraftServer minecraftserver = new MinecraftServer(options); // CraftBukkit pass in the options
MinecraftServer minecraftserver = new MinecraftServer(options); // CraftBukkit - pass in the options
// CraftBukkit - remove gui

Datei anzeigen

@ -84,7 +84,7 @@ public class NetLoginHandler extends NetHandler {
if (entityplayer != null) {
this.server.serverConfigurationManager.b(entityplayer);
// entityplayer.a((World) this.server.a(entityplayer.dimension)); // CraftBukkit - set by Entity
a.info(this.b() + " logged in with entity id " + entityplayer.id + " at ([ "+ entityplayer.world.worldData.name + "] " + entityplayer.locX + ", " + entityplayer.locY + ", " + entityplayer.locZ + ")");
a.info(this.b() + " logged in with entity id " + entityplayer.id + " at ([ " + entityplayer.world.worldData.name + "] " + entityplayer.locX + ", " + entityplayer.locY + ", " + entityplayer.locZ + ")"); // CraftBukkit
WorldServer worldserver = (WorldServer) entityplayer.world; // CraftBukkit
ChunkCoordinates chunkcoordinates = worldserver.getSpawn();
NetServerHandler netserverhandler = new NetServerHandler(this.server, this.networkManager, entityplayer);

Datei anzeigen

@ -136,6 +136,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
// Skip the first time we do this
if (lastPosX != Double.MAX_VALUE) {
PlayerMoveEvent event = new PlayerMoveEvent(player, from, to);
server.getPluginManager().callEvent(event);
from = event.getFrom();
@ -297,6 +298,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
// CraftBukkit start - make the movement speed check behave properly under tick degradation.
int elapsedTicks = MinecraftServer.currentTick - this.lastTick;
// Added this.m condition to solve this check being triggered by teleports
if (d8 > 100.0D * (elapsedTicks <= 0 ? 1 : elapsedTicks) && this.m) {
a.warning(this.player.name + " moved too quickly! Elapsed ticks: " + (elapsedTicks == 0 ? 1 : elapsedTicks) + ", Distance change: " + d8);
@ -410,7 +412,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
if (packet14blockdig.e == 4) {
this.player.E();
} else {
boolean flag = worldserver.weirdIsOpCache = worldserver.dimension != 0 || this.minecraftServer.serverConfigurationManager.isOp(this.player.name);
boolean flag = worldserver.weirdIsOpCache = worldserver.dimension != 0 || this.minecraftServer.serverConfigurationManager.isOp(this.player.name); // CraftBukkit
boolean flag1 = false;
if (packet14blockdig.e == 0) {
@ -506,7 +508,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
// CraftBukkit end
ItemStack itemstack = this.player.inventory.getItemInHand();
boolean flag = worldserver.weirdIsOpCache = worldserver.dimension != 0 || this.minecraftServer.serverConfigurationManager.isOp(this.player.name);
boolean flag = worldserver.weirdIsOpCache = worldserver.dimension != 0 || this.minecraftServer.serverConfigurationManager.isOp(this.player.name); // CraftBukkit
if (packet15place.face == 255) {
if (itemstack == null) {
@ -750,7 +752,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
s1 = s.substring(1);
a.info(this.player.name + " tried command: " + s1);
}
*/ // CraftBukkit end
// CraftBukkit end */
}
}

Datei anzeigen

@ -5,13 +5,11 @@ import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.net.Socket;
import java.net.SocketAddress;
import java.io.IOException; // CraftBukkit - instead of SocketException
import java.net.SocketException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
// CraftBukkit
import java.net.SocketException;
import java.io.IOException; // CraftBukkit
public class NetworkManager {
@ -49,8 +47,7 @@ public class NetworkManager {
// CraftBukkit start - IPv6 stack in Java on BSD/OSX doesn't support setTrafficClass
try {
socket.setTrafficClass(24);
} catch (SocketException e) {
}
} catch (SocketException e) {}
// CraftBukkit end
try {

Datei anzeigen

@ -37,7 +37,7 @@ public class Packet51MapChunk extends Packet {
this.e = i1;
this.f = j1;
byte[] abyte = data; // CraftBukkit - uses data from above constructor
Deflater deflater = new Deflater(1);
Deflater deflater = new Deflater(-1);
try {
deflater.setInput(abyte);

Datei anzeigen

@ -271,7 +271,9 @@ public class PortalTravelAgent {
PortalCreateEvent event = new PortalCreateEvent(blocks, (org.bukkit.World) craftWorld);
Bukkit.getServer().getPluginManager().callEvent(event);
if(event.isCancelled()) return true;
if (event.isCancelled()) {
return true;
}
// CraftBukkit end
if (d0 < 0.0D) {

Datei anzeigen

@ -1,6 +1,6 @@
package net.minecraft.server;
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.generator.ChunkGenerator; // CraftBukkit
public class SecondaryWorldServer extends WorldServer {
// CraftBukkit start

Datei anzeigen

@ -32,7 +32,7 @@ public class ServerConfigurationManager {
public static Logger a = Logger.getLogger("Minecraft");
public List players = new ArrayList();
public MinecraftServer server; // CraftBukkit - private -> public
// private PlayerManager[] d = new PlayerManager[2]; // Craftbukkit - removed
// private PlayerManager[] d = new PlayerManager[2]; // CraftBukkit - removed
public int maxPlayers; // CraftBukkit - private -> public
private Set banByName = new HashSet();
private Set banByIP = new HashSet();
@ -61,7 +61,7 @@ public class ServerConfigurationManager {
this.m = minecraftserver.a("white-list.txt");
int i = minecraftserver.propertyManager.getInt("view-distance", 10);
// Craftbukkit - removed playermanagers
// CraftBukkit - removed playermanagers
this.maxPlayers = minecraftserver.propertyManager.getInt("max-players", 20);
this.o = minecraftserver.propertyManager.getBoolean("white-list", false);
this.g();
@ -80,7 +80,7 @@ public class ServerConfigurationManager {
}
public void a(EntityPlayer entityplayer) {
// Craftbukkit - removed playermanagers
// CraftBukkit - removed playermanagers
for (WorldServer world : this.server.worlds) {
if (world.manager.a.contains(entityplayer)) {
world.manager.removePlayer(entityplayer);
@ -94,17 +94,17 @@ public class ServerConfigurationManager {
}
public int a() {
// Craftbukkit start
// CraftBukkit start
if (this.server.worlds.size() == 0) {
return this.server.propertyManager.getInt("view-distance", 10) * 16 - 16;
} else {
return this.server.worlds.get(0).manager.c();
}
// Craftbukkit end
// CraftBukkit end
}
private PlayerManager a(int i) {
return server.a(i).manager; // Craftbukkit
return server.a(i).manager; // CraftBukkit
}
public void b(EntityPlayer entityplayer) {
@ -226,14 +226,17 @@ public class ServerConfigurationManager {
entityplayer1.netServerHandler.sendPacket(new Packet70Bed(0));
}
}
if (location == null) {
cw = (CraftWorld) this.server.server.getWorlds().get(0);
chunkcoordinates = cw.getHandle().getSpawn();
location = new Location(cw, chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z);
}
Player respawnPlayer = cserver.getPlayer(entityplayer);
PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location);
cserver.getPluginManager().callEvent(respawnEvent);
location = respawnEvent.getRespawnLocation();
entityplayer.health = 20;
entityplayer.fireTicks = 0;
@ -269,10 +272,9 @@ public class ServerConfigurationManager {
}
public void f(EntityPlayer entityplayer) {
// CraftBukkit start
WorldServer worldserver = this.server.a(entityplayer.dimension);
boolean flag = false; // Unused
int b0; // byte -> int
boolean flag = false;
int b0; // CraftBukkit - byte -> int
if (entityplayer.dimension == -1) {
b0 = 0;
@ -280,17 +282,19 @@ public class ServerConfigurationManager {
b0 = -1;
}
// entityplayer.dimension = b0;
// WorldServer worldserver1 = this.server.a(entityplayer.dimension);
/* CraftBukkit start
entityplayer.dimension = b0;
WorldServer worldserver1 = this.server.a(entityplayer.dimension);
// entityplayer.netServerHandler.sendPacket(new Packet9Respawn((byte) entityplayer.dimension));
// worldserver.removeEntity(entityplayer);
// entityplayer.dead = false;
entityplayer.netServerHandler.sendPacket(new Packet9Respawn((byte) entityplayer.dimension));
worldserver.removeEntity(entityplayer);
entityplayer.dead = false;
// CraftBukkit end */
double d0 = entityplayer.locX;
double d1 = entityplayer.locZ;
double d2 = 8.0D;
if (b0 == -1) { // entityplayer.dimension -> b0
if (b0 == -1) { // CraftBukkit - entityplayer.dimension -> b0
d0 /= d2;
d1 /= d2;
entityplayer.setPositionRotation(d0, entityplayer.locY, d1, entityplayer.yaw, entityplayer.pitch);
@ -306,6 +310,7 @@ public class ServerConfigurationManager {
}
}
// CraftBukkit start
CraftWorld fromCraftWorld = worldserver.getWorld();
CraftWorld toCraftWorld = this.server.a(b0).getWorld();
Location startLocation = new Location(fromCraftWorld, entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch);
@ -336,21 +341,23 @@ public class ServerConfigurationManager {
}
}
// this.a(entityplayer);
// entityplayer.netServerHandler.a(entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch);
// entityplayer.a((World) worldserver1);
// this.a(entityplayer, worldserver1);
// this.g(entityplayer);
/* CraftBukkit -- not needed
this.a(entityplayer);
entityplayer.netServerHandler.a(entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch);
entityplayer.a((World) worldserver1);
this.a(entityplayer, worldserver1);
this.g(entityplayer);
// CraftBukkit */
this.a(entityplayer, b0, endLocation);
// CraftBukkit end
}
public void b() {
// Craftbukkit start
// CraftBukkit start
for (int i = 0; i < this.server.worlds.size(); ++i) {
this.server.worlds.get(i).manager.flush();
}
// Craftbukkit end
// CraftBukkit end
}
public void flagDirty(int i, int j, int k, int l) {

Datei anzeigen

@ -50,7 +50,7 @@ public class World implements IBlockAccess {
public int spawnMonsters;
public Random random = new Random();
public boolean s = false;
public WorldProvider worldProvider; // Craftbukkit - remove final
public WorldProvider worldProvider; // CraftBukkit - remove final
protected List u = new ArrayList();
public IChunkProvider chunkProvider; // CraftBukkit - protected -> public
protected final IDataManager w;
@ -62,22 +62,36 @@ public class World implements IBlockAccess {
private int K = 0;
public boolean allowMonsters = true; // CraftBukkit - private -> public
public boolean allowAnimals = true; // CraftBukkit - private -> public
public boolean pvpMode; // CraftBukkit
static int A = 0;
private Set N = new HashSet();
private int O;
private List P;
public boolean isStatic;
public ChunkGenerator generator; // Craftbukkit
public WorldChunkManager getWorldChunkManager() {
return this.worldProvider.b;
}
// Craftbukkit start - changed signature
// CraftBukkit start
public boolean pvpMode;
public ChunkGenerator generator;
Chunk lastChunkAccessed;
int lastXAccessed = Integer.MIN_VALUE;
int lastZAccessed = Integer.MIN_VALUE;
final Object chunkLock = new Object();
private boolean canSpawn(int x, int z) {
if (generator != null) {
return this.generator.canSpawn(((WorldServer) this).getWorld(), x, z);
} else {
return this.worldProvider.a(x, z);
}
}
// CraftBukkit - changed signature
public World(IDataManager idatamanager, String s, long i, WorldProvider worldprovider, ChunkGenerator gen) {
this.generator = gen;
// Craftbukkit end
// CraftBukkit end
this.O = this.random.nextInt(12000);
this.P = new ArrayList();
@ -126,10 +140,11 @@ public class World implements IBlockAccess {
int j;
// Craftbukkit start
// CraftBukkit start
if (generator != null) {
Random rand = new Random(getSeed());
Location spawn = generator.getFixedSpawnLocation(((WorldServer) this).getWorld(), rand);
if (spawn != null) {
if (spawn.getWorld() != ((WorldServer) this).getWorld()) {
throw new IllegalStateException("Cannot set spawn point for " + worldData.name + " to be in another world (" + spawn.getWorld().getName() + ")");
@ -144,22 +159,12 @@ public class World implements IBlockAccess {
for (j = 0; !canSpawn(i, j); j += this.random.nextInt(64) - this.random.nextInt(64)) {
i += this.random.nextInt(64) - this.random.nextInt(64);
}
// Craftbukkit end
// CraftBukkit end
this.worldData.setSpawn(i, b0, j);
this.isLoading = false;
}
// Craftbukkit start
private boolean canSpawn(int x, int z) {
if (generator != null) {
return this.generator.canSpawn(((WorldServer)this).getWorld(), x, z);
} else {
return this.worldProvider.a(x, z);
}
}
// Craftbukkit end
public int a(int i, int j) {
int k;
@ -239,10 +244,6 @@ public class World implements IBlockAccess {
}
// CraftBukkit start
Chunk lastChunkAccessed;
int lastXAccessed = Integer.MIN_VALUE;
int lastZAccessed = Integer.MIN_VALUE;
final Object chunkLock = new Object();
public Chunk getChunkAt(int i, int j) {
Chunk result = null;
synchronized (chunkLock) {
@ -818,6 +819,7 @@ public class World implements IBlockAccess {
// CraftBukkit start
if (entity instanceof EntityLiving && !(entity instanceof EntityPlayer)) {
CreatureSpawnEvent event = CraftEventFactory.callCreatureSpawnEvent((EntityLiving) entity);
if (event.isCancelled()) {
return false;
}
@ -1815,8 +1817,8 @@ public class World implements IBlockAccess {
if (this.v() && i2 == 0 && Block.SNOW.canPlace(this, l + i, k1, j1 + j) && l1 != 0 && l1 != Block.ICE.id && Block.byId[l1].material.isSolid()) {
// CraftBukkit start
SnowFormEvent snow = new SnowFormEvent(((WorldServer) this).getWorld().getBlockAt(l + i, k1, j1 + j));
((WorldServer)this).getServer().getPluginManager().callEvent(snow);
((WorldServer) this).getServer().getPluginManager().callEvent(snow);
if (!snow.isCancelled()) {
this.setTypeId(l + i, k1, j1 + j, snow.getMaterial().getId());
this.setData(l + i, k1, j1 + j, snow.getData());
@ -1946,7 +1948,6 @@ public class World implements IBlockAccess {
this.entityList.add(entity);
// CraftBukkit end
this.c((Entity) list.get(i));
}
}
@ -1965,19 +1966,16 @@ public class World implements IBlockAccess {
axisalignedbb = null;
}
// CraftBukkit - store the default action
boolean defaultReturn;
boolean defaultReturn; // CraftBukkit - store the default action
if (axisalignedbb != null && !this.containsEntity(axisalignedbb)) {
// CraftBukkit
defaultReturn = false;
defaultReturn = false; // CraftBukkit
} else {
if (block == Block.WATER || block == Block.STATIONARY_WATER || block == Block.LAVA || block == Block.STATIONARY_LAVA || block == Block.FIRE || block == Block.SNOW) {
block = null;
}
// CraftBukkit
defaultReturn = i > 0 && block == null && block1.canPlace(this, j, k, l, i1);
defaultReturn = i > 0 && block == null && block1.canPlace(this, j, k, l, i1); // CraftBukkit
}
// CraftBukkit start

Datei anzeigen

@ -3,7 +3,7 @@ package net.minecraft.server;
public class WorldManager implements IWorldAccess {
private MinecraftServer server;
public WorldServer world; // CraftBukkit private -> public
public WorldServer world; // CraftBukkit - private -> public
public WorldManager(MinecraftServer minecraftserver, WorldServer worldserver) {
this.server = minecraftserver;

Datei anzeigen

@ -95,6 +95,7 @@ public class WorldMap extends WorldMapBase {
byte b2 = 0;
byte b3 = (byte) ((int) ((double) (f * 2.0F) + 0.5D));
byte b4 = (byte) ((int) ((double) (f1 * 2.0F) + 0.5D));
// CraftBukkit
byte b5 = (byte) ((int) ((double) (worldmaphumantracker1.a.yaw * 16.0F / 360.0F) + 0.5D));
if (this.d < 0) {

Datei anzeigen

@ -70,7 +70,7 @@ public class WorldServer extends World implements BlockChangeDelegate {
protected IChunkProvider b() {
IChunkLoader ichunkloader = this.w.a(this.worldProvider);
// Craftbukkit start
// CraftBukkit start
InternalChunkGenerator gen;
if (this.generator != null) {
@ -84,7 +84,7 @@ public class WorldServer extends World implements BlockChangeDelegate {
}
this.chunkProviderServer = new ChunkProviderServer(this, ichunkloader, gen);
// Craftbukkit end
// CraftBukkit end
return this.chunkProviderServer;
}
@ -162,9 +162,11 @@ public class WorldServer extends World implements BlockChangeDelegate {
return explosion;
}
// explosion.a = flag;
// explosion.a();
// explosion.a(false);
/* CraftBukkit
explosion.a = flag;
explosion.a();
explosion.a(false);
// CraftBukkit */
this.server.serverConfigurationManager.a(d0, d1, d2, 64.0D, this.dimension, new Packet60Explosion(d0, d1, d2, f, explosion.g));
// CraftBukkit end
return explosion;