mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-07 11:05:13 +01:00
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:
parent
912a9c2c1a
commit
85e8cedcff
19 changed files with 88 additions and 79 deletions
|
@ -39,7 +39,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.bukkit</groupId>
|
<groupId>org.bukkit</groupId>
|
||||||
<artifactId>minecraft-server</artifactId>
|
<artifactId>minecraft-server</artifactId>
|
||||||
<version>1.6.6</version>
|
<version>1.6.6_01</version>
|
||||||
<type>jar</type>
|
<type>jar</type>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
|
@ -126,12 +126,12 @@ public class CraftChunk implements Chunk {
|
||||||
public ChunkSnapshot getChunkSnapshot(boolean includeMaxblocky, boolean includeBiome, boolean includeBiomeTempRain) {
|
public ChunkSnapshot getChunkSnapshot(boolean includeMaxblocky, boolean includeBiome, boolean includeBiomeTempRain) {
|
||||||
net.minecraft.server.Chunk chunk = getHandle();
|
net.minecraft.server.Chunk chunk = getHandle();
|
||||||
byte[] buf = new byte[32768 + 16384 + 16384 + 16384]; // Get big enough buffer for whole chunk
|
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;
|
byte[] hmap = null;
|
||||||
|
|
||||||
if (includeMaxblocky) {
|
if (includeMaxblocky) {
|
||||||
hmap = new byte[256]; // Get copy of height map
|
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;
|
BiomeBase[] biome = null;
|
||||||
|
@ -140,29 +140,29 @@ public class CraftChunk implements Chunk {
|
||||||
|
|
||||||
if (includeBiome || includeBiomeTempRain) {
|
if (includeBiome || includeBiomeTempRain) {
|
||||||
WorldChunkManager wcm = chunk.world.getWorldChunkManager();
|
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) {
|
if (includeBiome) {
|
||||||
biome = new BiomeBase[256];
|
biome = new BiomeBase[256];
|
||||||
System.arraycopy(bb, 0, biome, 0, biome.length);
|
System.arraycopy(biomeBase, 0, biome, 0, biome.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (includeBiomeTempRain) {
|
if (includeBiomeTempRain) {
|
||||||
biomeTemp = new double[256];
|
biomeTemp = new double[256];
|
||||||
biomeRain = new double[256];
|
biomeRain = new double[256];
|
||||||
System.arraycopy(wcm.a, 0, biomeTemp, 0, biomeTemp.length);
|
System.arraycopy(wcm.temperature, 0, biomeTemp, 0, biomeTemp.length);
|
||||||
System.arraycopy(wcm.b, 0, biomeRain, 0, biomeRain.length);
|
System.arraycopy(wcm.rain, 0, biomeRain, 0, biomeRain.length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
World w = getWorld();
|
World world = getWorld();
|
||||||
return new CraftChunkSnapshot(getX(), getZ(), w.getName(), w.getFullTime(), buf, hmap, biome, biomeTemp, biomeRain);
|
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
|
* Empty chunk snapshot - nothing but air blocks, but can include valid biome data
|
||||||
*/
|
*/
|
||||||
private static class EmptyChunkSnapshot extends CraftChunkSnapshot {
|
private static class EmptyChunkSnapshot extends CraftChunkSnapshot {
|
||||||
EmptyChunkSnapshot(int x, int z, String w, long wtime, BiomeBase[] biome, double[] biomeTemp, double[] biomeRain) {
|
EmptyChunkSnapshot(int x, int z, String worldName, long time, BiomeBase[] biome, double[] biomeTemp, double[] biomeRain) {
|
||||||
super(x, z, w, wtime, null, null, biome, biomeTemp, biomeRain);
|
super(x, z, worldName, time, null, null, biome, biomeTemp, biomeRain);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final int getBlockTypeId(int x, int y, int z) {
|
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;
|
BiomeBase[] biome = null;
|
||||||
double[] biomeTemp = null;
|
double[] biomeTemp = null;
|
||||||
double[] biomeRain = null;
|
double[] biomeRain = null;
|
||||||
|
|
||||||
if (includeBiome || includeBiomeTempRain) {
|
if (includeBiome || includeBiomeTempRain) {
|
||||||
WorldChunkManager wcm = w.getHandle().getWorldChunkManager();
|
WorldChunkManager wcm = world.getHandle().getWorldChunkManager();
|
||||||
BiomeBase[] bb = wcm.a(x<<4, z<<4, 16, 16);
|
BiomeBase[] biomeBase = wcm.getBiomeData(x << 4, z << 4, 16, 16);
|
||||||
|
|
||||||
if (includeBiome) {
|
if (includeBiome) {
|
||||||
biome = new BiomeBase[256];
|
biome = new BiomeBase[256];
|
||||||
System.arraycopy(bb, 0, biome, 0, biome.length);
|
System.arraycopy(biomeBase, 0, biome, 0, biome.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (includeBiomeTempRain) {
|
if (includeBiomeTempRain) {
|
||||||
biomeTemp = new double[256];
|
biomeTemp = new double[256];
|
||||||
biomeRain = new double[256];
|
biomeRain = new double[256];
|
||||||
System.arraycopy(wcm.a, 0, biomeTemp, 0, biomeTemp.length);
|
System.arraycopy(wcm.temperature, 0, biomeTemp, 0, biomeTemp.length);
|
||||||
System.arraycopy(wcm.b, 0, biomeRain, 0, biomeRain.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);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -319,7 +319,7 @@ public final class CraftServer implements Server {
|
||||||
console.onlineMode = config.getBoolean("online-mode", console.onlineMode);
|
console.onlineMode = config.getBoolean("online-mode", console.onlineMode);
|
||||||
console.spawnAnimals = config.getBoolean("spawn-animals", console.spawnAnimals);
|
console.spawnAnimals = config.getBoolean("spawn-animals", console.spawnAnimals);
|
||||||
console.pvpMode = config.getBoolean("pvp", console.pvpMode);
|
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) {
|
for (WorldServer world : console.worlds) {
|
||||||
world.spawnMonsters = monsters ? 1 : 0;
|
world.spawnMonsters = monsters ? 1 : 0;
|
||||||
|
@ -395,7 +395,7 @@ public final class CraftServer implements Server {
|
||||||
|
|
||||||
int dimension = 200 + console.worlds.size();
|
int dimension = 200 + console.worlds.size();
|
||||||
WorldServer internal = new WorldServer(console, new ServerNBTManager(new File("."), name, true), name, dimension, seed, environment, generator);
|
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.tracker = new EntityTracker(console, dimension);
|
||||||
internal.addIWorldAccess((IWorldAccess) new WorldManager(console, internal));
|
internal.addIWorldAccess((IWorldAccess) new WorldManager(console, internal));
|
||||||
|
|
|
@ -357,13 +357,13 @@ public class CraftWorld implements World {
|
||||||
|
|
||||||
public LightningStrike strikeLightning(Location loc) {
|
public LightningStrike strikeLightning(Location loc) {
|
||||||
EntityWeatherStorm lightning = new EntityWeatherStorm(world, loc.getX(), loc.getY(), loc.getZ());
|
EntityWeatherStorm lightning = new EntityWeatherStorm(world, loc.getX(), loc.getY(), loc.getZ());
|
||||||
world.a(lightning);
|
world.strikeLightning(lightning);
|
||||||
return new CraftLightningStrike(server, lightning);
|
return new CraftLightningStrike(server, lightning);
|
||||||
}
|
}
|
||||||
|
|
||||||
public LightningStrike strikeLightningEffect(Location loc) {
|
public LightningStrike strikeLightningEffect(Location loc) {
|
||||||
EntityWeatherStorm lightning = new EntityWeatherStorm(world, loc.getX(), loc.getY(), loc.getZ(), true);
|
EntityWeatherStorm lightning = new EntityWeatherStorm(world, loc.getX(), loc.getY(), loc.getZ(), true);
|
||||||
world.a(lightning);
|
world.strikeLightning(lightning);
|
||||||
return new CraftLightningStrike(server, lightning);
|
return new CraftLightningStrike(server, lightning);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -396,7 +396,7 @@ public class CraftWorld implements World {
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getId() {
|
public long getId() {
|
||||||
return world.worldData.b();
|
return world.worldData.getSeed();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -453,7 +453,7 @@ public class CraftWorld implements World {
|
||||||
public void setEnvironment(Environment env) {
|
public void setEnvironment(Environment env) {
|
||||||
if (environment != env) {
|
if (environment != env) {
|
||||||
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() {
|
public boolean hasStorm() {
|
||||||
return world.worldData.l();
|
return world.worldData.hasStorm();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStorm(boolean hasStorm) {
|
public void setStorm(boolean hasStorm) {
|
||||||
|
@ -588,7 +588,7 @@ public class CraftWorld implements World {
|
||||||
WeatherChangeEvent weather = new WeatherChangeEvent((org.bukkit.World) this, hasStorm);
|
WeatherChangeEvent weather = new WeatherChangeEvent((org.bukkit.World) this, hasStorm);
|
||||||
server.getPluginManager().callEvent(weather);
|
server.getPluginManager().callEvent(weather);
|
||||||
if (!weather.isCancelled()) {
|
if (!weather.isCancelled()) {
|
||||||
world.worldData.b(hasStorm);
|
world.worldData.setStorm(hasStorm);
|
||||||
|
|
||||||
// These numbers are from Minecraft
|
// These numbers are from Minecraft
|
||||||
if (hasStorm) {
|
if (hasStorm) {
|
||||||
|
@ -600,15 +600,15 @@ public class CraftWorld implements World {
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getWeatherDuration() {
|
public int getWeatherDuration() {
|
||||||
return world.worldData.m();
|
return world.worldData.getWeatherDuration();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWeatherDuration(int duration) {
|
public void setWeatherDuration(int duration) {
|
||||||
world.worldData.c(duration);
|
world.worldData.setWeatherDuration(duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isThundering() {
|
public boolean isThundering() {
|
||||||
return world.worldData.j();
|
return world.worldData.isThundering();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setThundering(boolean thundering) {
|
public void setThundering(boolean thundering) {
|
||||||
|
@ -617,7 +617,7 @@ public class CraftWorld implements World {
|
||||||
ThunderChangeEvent thunder = new ThunderChangeEvent((org.bukkit.World) this, thundering);
|
ThunderChangeEvent thunder = new ThunderChangeEvent((org.bukkit.World) this, thundering);
|
||||||
server.getPluginManager().callEvent(thunder);
|
server.getPluginManager().callEvent(thunder);
|
||||||
if (!thunder.isCancelled()) {
|
if (!thunder.isCancelled()) {
|
||||||
world.worldData.a(thundering);
|
world.worldData.setThundering(thundering);
|
||||||
|
|
||||||
// These numbers are from Minecraft
|
// These numbers are from Minecraft
|
||||||
if (thundering) {
|
if (thundering) {
|
||||||
|
@ -629,15 +629,15 @@ public class CraftWorld implements World {
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getThunderDuration() {
|
public int getThunderDuration() {
|
||||||
return world.worldData.k();
|
return world.worldData.getThunderDuration();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setThunderDuration(int duration) {
|
public void setThunderDuration(int duration) {
|
||||||
world.worldData.b(duration);
|
world.worldData.setThunderDuration(duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getSeed() {
|
public long getSeed() {
|
||||||
return world.worldData.b();
|
return world.worldData.getSeed();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getPVP() {
|
public boolean getPVP() {
|
||||||
|
|
|
@ -22,7 +22,7 @@ public class PortalTravelAgent implements TravelAgent {
|
||||||
|
|
||||||
public Location findOrCreate(Location location) {
|
public Location findOrCreate(Location location) {
|
||||||
WorldServer worldServer = ((CraftWorld) location.getWorld()).getHandle();
|
WorldServer worldServer = ((CraftWorld) location.getWorld()).getHandle();
|
||||||
worldServer.chunkProviderServer.a = true;
|
worldServer.chunkProviderServer.forceChunkLoad = true;
|
||||||
// Attempt to find a Portal.
|
// Attempt to find a Portal.
|
||||||
Location resultLocation = this.findPortal(location);
|
Location resultLocation = this.findPortal(location);
|
||||||
// If a Portal cannot be found we will attempt to create one.
|
// If a Portal cannot be found we will attempt to create one.
|
||||||
|
@ -36,7 +36,7 @@ public class PortalTravelAgent implements TravelAgent {
|
||||||
resultLocation = location;
|
resultLocation = location;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
worldServer.chunkProviderServer.a = false;
|
worldServer.chunkProviderServer.forceChunkLoad = false;
|
||||||
// Return our resulting portal location.
|
// Return our resulting portal location.
|
||||||
return resultLocation;
|
return resultLocation;
|
||||||
}
|
}
|
||||||
|
@ -53,10 +53,10 @@ public class PortalTravelAgent implements TravelAgent {
|
||||||
|
|
||||||
double d1;
|
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();
|
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();
|
double d3 = (double) k1 + 0.5D - location.getZ();
|
||||||
|
|
||||||
for (int l1 = 127; l1 >= 0; --l1) {
|
for (int l1 = 127; l1 >= 0; --l1) {
|
||||||
|
@ -135,10 +135,10 @@ public class PortalTravelAgent implements TravelAgent {
|
||||||
double d3;
|
double d3;
|
||||||
double d4;
|
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();
|
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();
|
d2 = (double) j2 + 0.5D - location.getZ();
|
||||||
|
|
||||||
label271:
|
label271:
|
||||||
|
@ -186,10 +186,10 @@ public class PortalTravelAgent implements TravelAgent {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (d0 < 0.0D) {
|
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();
|
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();
|
d2 = (double) j2 + 0.5D - location.getZ();
|
||||||
|
|
||||||
label219:
|
label219:
|
||||||
|
@ -321,7 +321,7 @@ public class PortalTravelAgent implements TravelAgent {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (l2 = 0; l2 < 4; ++l2) {
|
for (l2 = 0; l2 < 4; ++l2) {
|
||||||
world.o = true;
|
world.suppressPhysics = true;
|
||||||
|
|
||||||
for (k2 = 0; k2 < 4; ++k2) {
|
for (k2 = 0; k2 < 4; ++k2) {
|
||||||
for (j3 = -1; j3 < 4; ++j3) {
|
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 (k2 = 0; k2 < 4; ++k2) {
|
||||||
for (j3 = -1; j3 < 4; ++j3) {
|
for (j3 = -1; j3 < 4; ++j3) {
|
||||||
|
|
|
@ -26,7 +26,7 @@ public class TextWrapper {
|
||||||
private static final char COLOR_CHAR = '\u00A7';
|
private static final char COLOR_CHAR = '\u00A7';
|
||||||
private static final int CHAT_WINDOW_WIDTH = 320;
|
private static final int CHAT_WINDOW_WIDTH = 320;
|
||||||
private static final int CHAT_STRING_LENGTH = 119;
|
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) {
|
public static String[] wrapText(final String text) {
|
||||||
final StringBuilder out = new StringBuilder();
|
final StringBuilder out = new StringBuilder();
|
||||||
|
|
|
@ -34,8 +34,8 @@ public class CraftBlockState implements BlockState {
|
||||||
createData(block.getData());
|
createData(block.getData());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BlockState getBlockState(net.minecraft.server.World world, int x, int y, int z) {
|
public static CraftBlockState getBlockState(net.minecraft.server.World world, int x, int y, int z) {
|
||||||
return new CraftBlockState(((WorldServer) world).getWorld().getBlockAt(x, y, z));
|
return new CraftBlockState(world.getWorld().getBlockAt(x, y, z));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -63,7 +63,7 @@ public class CraftNoteBlock extends CraftBlockState implements NoteBlock {
|
||||||
|
|
||||||
synchronized (block) {
|
synchronized (block) {
|
||||||
if (block.getType() == Material.NOTE_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;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
@ -76,7 +76,7 @@ public class CraftNoteBlock extends CraftBlockState implements NoteBlock {
|
||||||
|
|
||||||
synchronized (block) {
|
synchronized (block) {
|
||||||
if (block.getType() == Material.NOTE_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;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package org.bukkit.craftbukkit.entity;
|
package org.bukkit.craftbukkit.entity;
|
||||||
|
|
||||||
import net.minecraft.server.EntityCreeper;
|
import net.minecraft.server.EntityCreeper;
|
||||||
import net.minecraft.server.WorldServer;
|
|
||||||
|
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
import org.bukkit.craftbukkit.CraftServer;
|
||||||
import org.bukkit.entity.Creeper;
|
import org.bukkit.entity.Creeper;
|
||||||
|
@ -13,13 +12,18 @@ public class CraftCreeper extends CraftMonster implements Creeper {
|
||||||
super(server, entity);
|
super(server, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EntityCreeper getHandle() {
|
||||||
|
return (EntityCreeper) super.getHandle();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "CraftCreeper";
|
return "CraftCreeper";
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPowered() {
|
public boolean isPowered() {
|
||||||
return getHandle().Z().a(17) == 1;
|
return getHandle().isPowered();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPowered(boolean powered) {
|
public void setPowered(boolean powered) {
|
||||||
|
@ -32,14 +36,14 @@ public class CraftCreeper extends CraftMonster implements Creeper {
|
||||||
server.getPluginManager().callEvent(event);
|
server.getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
getHandle().Z().b(17, (byte) 1);
|
getHandle().setPowered(true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
CreeperPowerEvent event = new CreeperPowerEvent(entity, CreeperPowerEvent.PowerCause.SET_OFF);
|
CreeperPowerEvent event = new CreeperPowerEvent(entity, CreeperPowerEvent.PowerCause.SET_OFF);
|
||||||
server.getPluginManager().callEvent(event);
|
server.getPluginManager().callEvent(event);
|
||||||
|
|
||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
getHandle().Z().b(17, (byte) 0);
|
getHandle().setPowered(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entity instanceof EntityPlayer && health == 0) {
|
if (entity instanceof EntityPlayer && health == 0) {
|
||||||
((EntityPlayer) entity).a((Entity) null);
|
((EntityPlayer) entity).die((Entity) null);
|
||||||
}
|
}
|
||||||
|
|
||||||
getHandle().health = health;
|
getHandle().health = health;
|
||||||
|
|
|
@ -10,11 +10,11 @@ public class CraftPig extends CraftAnimals implements Pig {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasSaddle() {
|
public boolean hasSaddle() {
|
||||||
return getHandle().x();
|
return getHandle().hasSaddle();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSaddle(boolean saddled) {
|
public void setSaddle(boolean saddled) {
|
||||||
getHandle().a(saddled);
|
getHandle().setSaddle(saddled);
|
||||||
}
|
}
|
||||||
|
|
||||||
public EntityPig getHandle() {
|
public EntityPig getHandle() {
|
||||||
|
|
|
@ -169,8 +169,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||||
public void sendBlockChange(Location loc, int material, byte data) {
|
public void sendBlockChange(Location loc, int material, byte data) {
|
||||||
Packet53BlockChange packet = new Packet53BlockChange(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), ((CraftWorld) loc.getWorld()).getHandle());
|
Packet53BlockChange packet = new Packet53BlockChange(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), ((CraftWorld) loc.getWorld()).getHandle());
|
||||||
|
|
||||||
packet.d = material;
|
packet.material = material;
|
||||||
packet.e = data;
|
packet.data = data;
|
||||||
getHandle().netServerHandler.sendPacket(packet);
|
getHandle().netServerHandler.sendPacket(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,7 +228,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||||
if (fromWorld == toWorld) {
|
if (fromWorld == toWorld) {
|
||||||
entity.netServerHandler.teleport(to);
|
entity.netServerHandler.teleport(to);
|
||||||
} else {
|
} else {
|
||||||
server.getHandle().a(entity, toWorld.dimension, to);
|
server.getHandle().moveToWorld(entity, toWorld.dimension, to);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -250,7 +250,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateInventory() {
|
public void updateInventory() {
|
||||||
getHandle().a(getHandle().activeContainer);
|
getHandle().updateInventory(getHandle().activeContainer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSleepingIgnored(boolean isSleeping) {
|
public void setSleepingIgnored(boolean isSleeping) {
|
||||||
|
|
|
@ -16,28 +16,33 @@ public class CraftTNTPrimed extends CraftEntity implements TNTPrimed {
|
||||||
return "CraftTNTPrimed";
|
return "CraftTNTPrimed";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EntityTNTPrimed getHandle() {
|
||||||
|
return (EntityTNTPrimed) super.getHandle();
|
||||||
|
}
|
||||||
|
|
||||||
public float getYield() {
|
public float getYield() {
|
||||||
return ((EntityTNTPrimed) getHandle()).yield;
|
return getHandle().yield;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isIncendiary() {
|
public boolean isIncendiary() {
|
||||||
return ((EntityTNTPrimed) getHandle()).isIncendiary;
|
return getHandle().isIncendiary;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIsIncendiary(boolean isIncendiary) {
|
public void setIsIncendiary(boolean isIncendiary) {
|
||||||
((EntityTNTPrimed) getHandle()).isIncendiary = isIncendiary;
|
getHandle().isIncendiary = isIncendiary;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setYield(float yield) {
|
public void setYield(float yield) {
|
||||||
((EntityTNTPrimed) getHandle()).yield = yield;
|
getHandle().yield = yield;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getFuseTicks() {
|
public int getFuseTicks() {
|
||||||
return ((EntityTNTPrimed) getHandle()).a;
|
return getHandle().fuseTicks;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFuseTicks(int fuseTicks) {
|
public void setFuseTicks(int fuseTicks) {
|
||||||
((EntityTNTPrimed) getHandle()).a = fuseTicks;
|
getHandle().fuseTicks = fuseTicks;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,11 +35,11 @@ public class CraftWolf extends CraftAnimals implements Wolf {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isTamed() {
|
public boolean isTamed() {
|
||||||
return getHandle().A();
|
return getHandle().isTamed();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTamed(boolean tame) {
|
public void setTamed(boolean tame) {
|
||||||
getHandle().d(tame);
|
getHandle().setTamed(tame);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AnimalTamer getOwner() {
|
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.
|
* @return the owner's name, if they are a player; otherwise, the empty string or null.
|
||||||
*/
|
*/
|
||||||
String getOwnerName() {
|
String getOwnerName() {
|
||||||
return getHandle().x();
|
return getHandle().getOwnerName();
|
||||||
}
|
}
|
||||||
|
|
||||||
void setOwnerName(String ownerName) {
|
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.
|
* @param pathentity currently the MC defined PathEntity class. Should be replaced with an API interface at some point.
|
||||||
*/
|
*/
|
||||||
private void setPath(PathEntity pathentity) {
|
private void setPath(PathEntity pathentity) {
|
||||||
getHandle().a(pathentity);
|
getHandle().setPathEntity(pathentity);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class CustomChunkGenerator extends InternalChunkGenerator {
|
||||||
|
|
||||||
Chunk chunk = new Chunk(world, types, x, z);
|
Chunk chunk = new Chunk(world, types, x, z);
|
||||||
|
|
||||||
chunk.b();
|
chunk.initLighting();
|
||||||
|
|
||||||
return chunk;
|
return chunk;
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ public class CustomChunkGenerator extends InternalChunkGenerator {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean b() {
|
public boolean canSave() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ public class NormalChunkGenerator extends InternalChunkGenerator {
|
||||||
private final IChunkProvider provider;
|
private final IChunkProvider provider;
|
||||||
|
|
||||||
public NormalChunkGenerator(World world, long seed) {
|
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) {
|
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) {
|
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) {
|
public List<BlockPopulator> getDefaultPopulators(org.bukkit.World world) {
|
||||||
|
@ -53,7 +53,7 @@ public class NormalChunkGenerator extends InternalChunkGenerator {
|
||||||
return provider.unloadChunks();
|
return provider.unloadChunks();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean b() {
|
public boolean canSave() {
|
||||||
return provider.b();
|
return provider.canSave();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,6 @@ public class CraftFurnaceRecipe extends FurnaceRecipe implements CraftRecipe {
|
||||||
int id = result.getTypeId();
|
int id = result.getTypeId();
|
||||||
int amount = result.getAmount();
|
int amount = result.getAmount();
|
||||||
int dmg = result.getDurability();
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,6 +49,6 @@ public class CraftShapedRecipe extends ShapedRecipe implements CraftRecipe {
|
||||||
int id = this.getResult().getTypeId();
|
int id = this.getResult().getTypeId();
|
||||||
int amount = this.getResult().getAmount();
|
int amount = this.getResult().getAmount();
|
||||||
short durability = this.getResult().getDurability();
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,6 @@ public class CraftShapelessRecipe extends ShapelessRecipe implements CraftRecipe
|
||||||
int id = this.getResult().getTypeId();
|
int id = this.getResult().getTypeId();
|
||||||
int amount = this.getResult().getAmount();
|
int amount = this.getResult().getAmount();
|
||||||
short durability = this.getResult().getDurability();
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue