Massive renaming update in nms. If you bypassed Bukkit, you will likely break.

Also minimized all the nms diffs and generic cleanups all around.

By: Erik Broes <erikbroes@grum.nl>
This commit is contained in:
CraftBukkit/Spigot 2011-06-27 00:25:01 +02:00
parent 912a9c2c1a
commit 85e8cedcff
19 changed files with 88 additions and 79 deletions

View file

@ -39,7 +39,7 @@
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>minecraft-server</artifactId>
<version>1.6.6</version>
<version>1.6.6_01</version>
<type>jar</type>
<scope>compile</scope>
</dependency>

View file

@ -126,12 +126,12 @@ public class CraftChunk implements Chunk {
public ChunkSnapshot getChunkSnapshot(boolean includeMaxblocky, boolean includeBiome, boolean includeBiomeTempRain) {
net.minecraft.server.Chunk chunk = getHandle();
byte[] buf = new byte[32768 + 16384 + 16384 + 16384]; // Get big enough buffer for whole chunk
chunk.a(buf, 0, 0, 0, 16, 128, 16, 0); // Get whole chunk
chunk.getData(buf, 0, 0, 0, 16, 128, 16, 0); // Get whole chunk
byte[] hmap = null;
if (includeMaxblocky) {
hmap = new byte[256]; // Get copy of height map
System.arraycopy(chunk.h, 0, hmap, 0, 256);
System.arraycopy(chunk.heightMap, 0, hmap, 0, 256);
}
BiomeBase[] biome = null;
@ -140,29 +140,29 @@ public class CraftChunk implements Chunk {
if (includeBiome || includeBiomeTempRain) {
WorldChunkManager wcm = chunk.world.getWorldChunkManager();
BiomeBase[] bb = wcm.a(getX()<<4, getZ()<<4, 16, 16);
BiomeBase[] biomeBase = wcm.getBiomeData(getX() << 4, getZ() << 4, 16, 16);
if (includeBiome) {
biome = new BiomeBase[256];
System.arraycopy(bb, 0, biome, 0, biome.length);
System.arraycopy(biomeBase, 0, biome, 0, biome.length);
}
if (includeBiomeTempRain) {
biomeTemp = new double[256];
biomeRain = new double[256];
System.arraycopy(wcm.a, 0, biomeTemp, 0, biomeTemp.length);
System.arraycopy(wcm.b, 0, biomeRain, 0, biomeRain.length);
System.arraycopy(wcm.temperature, 0, biomeTemp, 0, biomeTemp.length);
System.arraycopy(wcm.rain, 0, biomeRain, 0, biomeRain.length);
}
}
World w = getWorld();
return new CraftChunkSnapshot(getX(), getZ(), w.getName(), w.getFullTime(), buf, hmap, biome, biomeTemp, biomeRain);
World world = getWorld();
return new CraftChunkSnapshot(getX(), getZ(), world.getName(), world.getFullTime(), buf, hmap, biome, biomeTemp, biomeRain);
}
/**
* Empty chunk snapshot - nothing but air blocks, but can include valid biome data
*/
private static class EmptyChunkSnapshot extends CraftChunkSnapshot {
EmptyChunkSnapshot(int x, int z, String w, long wtime, BiomeBase[] biome, double[] biomeTemp, double[] biomeRain) {
super(x, z, w, wtime, null, null, biome, biomeTemp, biomeRain);
EmptyChunkSnapshot(int x, int z, String worldName, long time, BiomeBase[] biome, double[] biomeTemp, double[] biomeRain) {
super(x, z, worldName, time, null, null, biome, biomeTemp, biomeRain);
}
public final int getBlockTypeId(int x, int y, int z) {
@ -186,27 +186,27 @@ public class CraftChunk implements Chunk {
}
}
public static ChunkSnapshot getEmptyChunkSnapshot(int x, int z, CraftWorld w, boolean includeBiome, boolean includeBiomeTempRain) {
public static ChunkSnapshot getEmptyChunkSnapshot(int x, int z, CraftWorld world, boolean includeBiome, boolean includeBiomeTempRain) {
BiomeBase[] biome = null;
double[] biomeTemp = null;
double[] biomeRain = null;
if (includeBiome || includeBiomeTempRain) {
WorldChunkManager wcm = w.getHandle().getWorldChunkManager();
BiomeBase[] bb = wcm.a(x<<4, z<<4, 16, 16);
WorldChunkManager wcm = world.getHandle().getWorldChunkManager();
BiomeBase[] biomeBase = wcm.getBiomeData(x << 4, z << 4, 16, 16);
if (includeBiome) {
biome = new BiomeBase[256];
System.arraycopy(bb, 0, biome, 0, biome.length);
System.arraycopy(biomeBase, 0, biome, 0, biome.length);
}
if (includeBiomeTempRain) {
biomeTemp = new double[256];
biomeRain = new double[256];
System.arraycopy(wcm.a, 0, biomeTemp, 0, biomeTemp.length);
System.arraycopy(wcm.b, 0, biomeRain, 0, biomeRain.length);
System.arraycopy(wcm.temperature, 0, biomeTemp, 0, biomeTemp.length);
System.arraycopy(wcm.rain, 0, biomeRain, 0, biomeRain.length);
}
}
return new EmptyChunkSnapshot(x, z, w.getName(), w.getFullTime(), biome, biomeTemp, biomeRain);
return new EmptyChunkSnapshot(x, z, world.getName(), world.getFullTime(), biome, biomeTemp, biomeRain);
}
}

View file

@ -319,7 +319,7 @@ public final class CraftServer implements Server {
console.onlineMode = config.getBoolean("online-mode", console.onlineMode);
console.spawnAnimals = config.getBoolean("spawn-animals", console.spawnAnimals);
console.pvpMode = config.getBoolean("pvp", console.pvpMode);
console.o = config.getBoolean("allow-flight", console.o);
console.allowFlight = config.getBoolean("allow-flight", console.allowFlight);
for (WorldServer world : console.worlds) {
world.spawnMonsters = monsters ? 1 : 0;
@ -395,7 +395,7 @@ public final class CraftServer implements Server {
int dimension = 200 + console.worlds.size();
WorldServer internal = new WorldServer(console, new ServerNBTManager(new File("."), name, true), name, dimension, seed, environment, generator);
internal.z = console.worlds.get(0).z;
internal.worldMaps = console.worlds.get(0).worldMaps;
internal.tracker = new EntityTracker(console, dimension);
internal.addIWorldAccess((IWorldAccess) new WorldManager(console, internal));

View file

@ -357,13 +357,13 @@ public class CraftWorld implements World {
public LightningStrike strikeLightning(Location loc) {
EntityWeatherStorm lightning = new EntityWeatherStorm(world, loc.getX(), loc.getY(), loc.getZ());
world.a(lightning);
world.strikeLightning(lightning);
return new CraftLightningStrike(server, lightning);
}
public LightningStrike strikeLightningEffect(Location loc) {
EntityWeatherStorm lightning = new EntityWeatherStorm(world, loc.getX(), loc.getY(), loc.getZ(), true);
world.a(lightning);
world.strikeLightning(lightning);
return new CraftLightningStrike(server, lightning);
}
@ -396,7 +396,7 @@ public class CraftWorld implements World {
}
public long getId() {
return world.worldData.b();
return world.worldData.getSeed();
}
@Override
@ -453,7 +453,7 @@ public class CraftWorld implements World {
public void setEnvironment(Environment env) {
if (environment != env) {
environment = env;
world.worldProvider = WorldProvider.a(environment.getId());
world.worldProvider = WorldProvider.byDimension(environment.getId());
}
}
@ -579,7 +579,7 @@ public class CraftWorld implements World {
}
public boolean hasStorm() {
return world.worldData.l();
return world.worldData.hasStorm();
}
public void setStorm(boolean hasStorm) {
@ -588,7 +588,7 @@ public class CraftWorld implements World {
WeatherChangeEvent weather = new WeatherChangeEvent((org.bukkit.World) this, hasStorm);
server.getPluginManager().callEvent(weather);
if (!weather.isCancelled()) {
world.worldData.b(hasStorm);
world.worldData.setStorm(hasStorm);
// These numbers are from Minecraft
if (hasStorm) {
@ -600,15 +600,15 @@ public class CraftWorld implements World {
}
public int getWeatherDuration() {
return world.worldData.m();
return world.worldData.getWeatherDuration();
}
public void setWeatherDuration(int duration) {
world.worldData.c(duration);
world.worldData.setWeatherDuration(duration);
}
public boolean isThundering() {
return world.worldData.j();
return world.worldData.isThundering();
}
public void setThundering(boolean thundering) {
@ -617,7 +617,7 @@ public class CraftWorld implements World {
ThunderChangeEvent thunder = new ThunderChangeEvent((org.bukkit.World) this, thundering);
server.getPluginManager().callEvent(thunder);
if (!thunder.isCancelled()) {
world.worldData.a(thundering);
world.worldData.setThundering(thundering);
// These numbers are from Minecraft
if (thundering) {
@ -629,15 +629,15 @@ public class CraftWorld implements World {
}
public int getThunderDuration() {
return world.worldData.k();
return world.worldData.getThunderDuration();
}
public void setThunderDuration(int duration) {
world.worldData.b(duration);
world.worldData.setThunderDuration(duration);
}
public long getSeed() {
return world.worldData.b();
return world.worldData.getSeed();
}
public boolean getPVP() {

View file

@ -22,7 +22,7 @@ public class PortalTravelAgent implements TravelAgent {
public Location findOrCreate(Location location) {
WorldServer worldServer = ((CraftWorld) location.getWorld()).getHandle();
worldServer.chunkProviderServer.a = true;
worldServer.chunkProviderServer.forceChunkLoad = true;
// Attempt to find a Portal.
Location resultLocation = this.findPortal(location);
// If a Portal cannot be found we will attempt to create one.
@ -36,7 +36,7 @@ public class PortalTravelAgent implements TravelAgent {
resultLocation = location;
}
}
worldServer.chunkProviderServer.a = false;
worldServer.chunkProviderServer.forceChunkLoad = false;
// Return our resulting portal location.
return resultLocation;
}
@ -53,10 +53,10 @@ public class PortalTravelAgent implements TravelAgent {
double d1;
for (int j1 = l - searchRadius; j1 <= l + searchRadius; ++j1) {
for (int j1 = l - this.searchRadius; j1 <= l + this.searchRadius; ++j1) {
double d2 = (double) j1 + 0.5D - location.getX();
for (int k1 = i1 - searchRadius; k1 <= i1 + searchRadius; ++k1) {
for (int k1 = i1 - this.searchRadius; k1 <= i1 + this.searchRadius; ++k1) {
double d3 = (double) k1 + 0.5D - location.getZ();
for (int l1 = 127; l1 >= 0; --l1) {
@ -135,10 +135,10 @@ public class PortalTravelAgent implements TravelAgent {
double d3;
double d4;
for (i2 = i - creationRadius; i2 <= i + creationRadius; ++i2) {
for (i2 = i - this.creationRadius; i2 <= i + this.creationRadius; ++i2) {
d1 = (double) i2 + 0.5D - location.getX();
for (j2 = k - creationRadius; j2 <= k + creationRadius; ++j2) {
for (j2 = k - this.creationRadius; j2 <= k + this.creationRadius; ++j2) {
d2 = (double) j2 + 0.5D - location.getZ();
label271:
@ -186,10 +186,10 @@ public class PortalTravelAgent implements TravelAgent {
}
if (d0 < 0.0D) {
for (i2 = i - creationRadius; i2 <= i + creationRadius; ++i2) {
for (i2 = i - this.creationRadius; i2 <= i + this.creationRadius; ++i2) {
d1 = (double) i2 + 0.5D - location.getX();
for (j2 = k - creationRadius; j2 <= k + creationRadius; ++j2) {
for (j2 = k - this.creationRadius; j2 <= k + this.creationRadius; ++j2) {
d2 = (double) j2 + 0.5D - location.getZ();
label219:
@ -321,7 +321,7 @@ public class PortalTravelAgent implements TravelAgent {
}
for (l2 = 0; l2 < 4; ++l2) {
world.o = true;
world.suppressPhysics = true;
for (k2 = 0; k2 < 4; ++k2) {
for (j3 = -1; j3 < 4; ++j3) {
@ -333,7 +333,7 @@ public class PortalTravelAgent implements TravelAgent {
}
}
world.o = false;
world.suppressPhysics = false;
for (k2 = 0; k2 < 4; ++k2) {
for (j3 = -1; j3 < 4; ++j3) {

View file

@ -26,7 +26,7 @@ public class TextWrapper {
private static final char COLOR_CHAR = '\u00A7';
private static final int CHAT_WINDOW_WIDTH = 320;
private static final int CHAT_STRING_LENGTH = 119;
private static final String allowedChars = net.minecraft.server.FontAllowedCharacters.a;
private static final String allowedChars = net.minecraft.server.FontAllowedCharacters.allowedCharacters;
public static String[] wrapText(final String text) {
final StringBuilder out = new StringBuilder();

View file

@ -34,8 +34,8 @@ public class CraftBlockState implements BlockState {
createData(block.getData());
}
public static BlockState getBlockState(net.minecraft.server.World world, int x, int y, int z) {
return new CraftBlockState(((WorldServer) world).getWorld().getBlockAt(x, y, z));
public static CraftBlockState getBlockState(net.minecraft.server.World world, int x, int y, int z) {
return new CraftBlockState(world.getWorld().getBlockAt(x, y, z));
}
/**

View file

@ -63,7 +63,7 @@ public class CraftNoteBlock extends CraftBlockState implements NoteBlock {
synchronized (block) {
if (block.getType() == Material.NOTE_BLOCK) {
world.getHandle().d(getX(), getY(), getZ(), instrument, note);
world.getHandle().playNote(getX(), getY(), getZ(), instrument, note);
return true;
} else {
return false;
@ -76,7 +76,7 @@ public class CraftNoteBlock extends CraftBlockState implements NoteBlock {
synchronized (block) {
if (block.getType() == Material.NOTE_BLOCK) {
world.getHandle().d(getX(), getY(), getZ(), instrument.getType(), note.getId());
world.getHandle().playNote(getX(), getY(), getZ(), instrument.getType(), note.getId());
return true;
} else {
return false;

View file

@ -1,7 +1,6 @@
package org.bukkit.craftbukkit.entity;
import net.minecraft.server.EntityCreeper;
import net.minecraft.server.WorldServer;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.Creeper;
@ -13,13 +12,18 @@ public class CraftCreeper extends CraftMonster implements Creeper {
super(server, entity);
}
@Override
public EntityCreeper getHandle() {
return (EntityCreeper) super.getHandle();
}
@Override
public String toString() {
return "CraftCreeper";
}
public boolean isPowered() {
return getHandle().Z().a(17) == 1;
return getHandle().isPowered();
}
public void setPowered(boolean powered) {
@ -32,14 +36,14 @@ public class CraftCreeper extends CraftMonster implements Creeper {
server.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
getHandle().Z().b(17, (byte) 1);
getHandle().setPowered(true);
}
} else {
CreeperPowerEvent event = new CreeperPowerEvent(entity, CreeperPowerEvent.PowerCause.SET_OFF);
server.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
getHandle().Z().b(17, (byte) 0);
getHandle().setPowered(false);
}
}

View file

@ -40,7 +40,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
}
if (entity instanceof EntityPlayer && health == 0) {
((EntityPlayer) entity).a((Entity) null);
((EntityPlayer) entity).die((Entity) null);
}
getHandle().health = health;

View file

@ -10,11 +10,11 @@ public class CraftPig extends CraftAnimals implements Pig {
}
public boolean hasSaddle() {
return getHandle().x();
return getHandle().hasSaddle();
}
public void setSaddle(boolean saddled) {
getHandle().a(saddled);
getHandle().setSaddle(saddled);
}
public EntityPig getHandle() {

View file

@ -169,8 +169,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
public void sendBlockChange(Location loc, int material, byte data) {
Packet53BlockChange packet = new Packet53BlockChange(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), ((CraftWorld) loc.getWorld()).getHandle());
packet.d = material;
packet.e = data;
packet.material = material;
packet.data = data;
getHandle().netServerHandler.sendPacket(packet);
}
@ -228,7 +228,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
if (fromWorld == toWorld) {
entity.netServerHandler.teleport(to);
} else {
server.getHandle().a(entity, toWorld.dimension, to);
server.getHandle().moveToWorld(entity, toWorld.dimension, to);
}
return true;
}
@ -250,7 +250,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
public void updateInventory() {
getHandle().a(getHandle().activeContainer);
getHandle().updateInventory(getHandle().activeContainer);
}
public void setSleepingIgnored(boolean isSleeping) {

View file

@ -16,28 +16,33 @@ public class CraftTNTPrimed extends CraftEntity implements TNTPrimed {
return "CraftTNTPrimed";
}
@Override
public EntityTNTPrimed getHandle() {
return (EntityTNTPrimed) super.getHandle();
}
public float getYield() {
return ((EntityTNTPrimed) getHandle()).yield;
return getHandle().yield;
}
public boolean isIncendiary() {
return ((EntityTNTPrimed) getHandle()).isIncendiary;
return getHandle().isIncendiary;
}
public void setIsIncendiary(boolean isIncendiary) {
((EntityTNTPrimed) getHandle()).isIncendiary = isIncendiary;
getHandle().isIncendiary = isIncendiary;
}
public void setYield(float yield) {
((EntityTNTPrimed) getHandle()).yield = yield;
getHandle().yield = yield;
}
public int getFuseTicks() {
return ((EntityTNTPrimed) getHandle()).a;
return getHandle().fuseTicks;
}
public void setFuseTicks(int fuseTicks) {
((EntityTNTPrimed) getHandle()).a = fuseTicks;
getHandle().fuseTicks = fuseTicks;
}
}

View file

@ -35,11 +35,11 @@ public class CraftWolf extends CraftAnimals implements Wolf {
}
public boolean isTamed() {
return getHandle().A();
return getHandle().isTamed();
}
public void setTamed(boolean tame) {
getHandle().d(tame);
getHandle().setTamed(tame);
}
public AnimalTamer getOwner() {
@ -75,11 +75,11 @@ public class CraftWolf extends CraftAnimals implements Wolf {
* @return the owner's name, if they are a player; otherwise, the empty string or null.
*/
String getOwnerName() {
return getHandle().x();
return getHandle().getOwnerName();
}
void setOwnerName(String ownerName) {
getHandle().a(ownerName);
getHandle().setOwnerName(ownerName);
}
/**
@ -88,7 +88,7 @@ public class CraftWolf extends CraftAnimals implements Wolf {
* @param pathentity currently the MC defined PathEntity class. Should be replaced with an API interface at some point.
*/
private void setPath(PathEntity pathentity) {
getHandle().a(pathentity);
getHandle().setPathEntity(pathentity);
}
/*

View file

@ -34,7 +34,7 @@ public class CustomChunkGenerator extends InternalChunkGenerator {
Chunk chunk = new Chunk(world, types, x, z);
chunk.b();
chunk.initLighting();
return chunk;
}
@ -51,7 +51,7 @@ public class CustomChunkGenerator extends InternalChunkGenerator {
return false;
}
public boolean b() {
public boolean canSave() {
return true;
}

View file

@ -14,7 +14,7 @@ public class NormalChunkGenerator extends InternalChunkGenerator {
private final IChunkProvider provider;
public NormalChunkGenerator(World world, long seed) {
provider = world.worldProvider.b();
provider = world.worldProvider.getChunkProvider();
}
public byte[] generate(org.bukkit.World world, Random random, int x, int z) {
@ -22,7 +22,7 @@ public class NormalChunkGenerator extends InternalChunkGenerator {
}
public boolean canSpawn(org.bukkit.World world, int x, int z) {
return ((CraftWorld) world).getHandle().worldProvider.a(x, z);
return ((CraftWorld) world).getHandle().worldProvider.canSpawn(x, z);
}
public List<BlockPopulator> getDefaultPopulators(org.bukkit.World world) {
@ -53,7 +53,7 @@ public class NormalChunkGenerator extends InternalChunkGenerator {
return provider.unloadChunks();
}
public boolean b() {
return provider.b();
public boolean canSave() {
return provider.canSave();
}
}

View file

@ -29,6 +29,6 @@ public class CraftFurnaceRecipe extends FurnaceRecipe implements CraftRecipe {
int id = result.getTypeId();
int amount = result.getAmount();
int dmg = result.getDurability();
FurnaceRecipes.a().a(input.getItemTypeId(), new net.minecraft.server.ItemStack(id, amount, dmg));
FurnaceRecipes.getInstance().registerRecipe(input.getItemTypeId(), new net.minecraft.server.ItemStack(id, amount, dmg));
}
}

View file

@ -49,6 +49,6 @@ public class CraftShapedRecipe extends ShapedRecipe implements CraftRecipe {
int id = this.getResult().getTypeId();
int amount = this.getResult().getAmount();
short durability = this.getResult().getDurability();
CraftingManager.a().a(new net.minecraft.server.ItemStack(id, amount, durability), data);
CraftingManager.getInstance().registerShapedRecipe(new net.minecraft.server.ItemStack(id, amount, durability), data);
}
}

View file

@ -37,6 +37,6 @@ public class CraftShapelessRecipe extends ShapelessRecipe implements CraftRecipe
int id = this.getResult().getTypeId();
int amount = this.getResult().getAmount();
short durability = this.getResult().getDurability();
CraftingManager.a().b(new net.minecraft.server.ItemStack(id, amount, durability), data);
CraftingManager.getInstance().registerShapelessRecipe(new net.minecraft.server.ItemStack(id, amount, durability), data);
}
}