Update for Minecraft 1.8

By: Dinnerbone <dinnerbone@dinnerbone.com>
This commit is contained in:
CraftBukkit/Spigot 2011-09-15 01:23:52 +01:00
parent c4875394c3
commit d902201875
6 changed files with 46 additions and 45 deletions

View file

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

View file

@ -154,7 +154,7 @@ public class CraftChunk implements Chunk {
if (includeBiome || includeBiomeTempRain) { if (includeBiome || includeBiomeTempRain) {
WorldChunkManager wcm = chunk.world.getWorldChunkManager(); WorldChunkManager wcm = chunk.world.getWorldChunkManager();
BiomeBase[] biomeBase = wcm.getBiomeData(getX() << 4, getZ() << 4, 16, 16); BiomeBase[] biomeBase = wcm.b((BiomeBase[])null, getX() << 4, getZ() << 4, 16, 16);
if (includeBiome) { if (includeBiome) {
biome = new BiomeBase[256]; biome = new BiomeBase[256];
@ -164,8 +164,9 @@ public class CraftChunk implements Chunk {
if (includeBiomeTempRain) { if (includeBiomeTempRain) {
biomeTemp = new double[256]; biomeTemp = new double[256];
biomeRain = new double[256]; biomeRain = new double[256];
System.arraycopy(wcm.temperature, 0, biomeTemp, 0, biomeTemp.length); //System.arraycopy(wcm.temperature, 0, biomeTemp, 0, biomeTemp.length);
System.arraycopy(wcm.rain, 0, biomeRain, 0, biomeRain.length); //System.arraycopy(wcm.rain, 0, biomeRain, 0, biomeRain.length);
// TODO: Figure out new snapshot stuff
} }
} }
World world = getWorld(); World world = getWorld();
@ -208,7 +209,7 @@ public class CraftChunk implements Chunk {
if (includeBiome || includeBiomeTempRain) { if (includeBiome || includeBiomeTempRain) {
WorldChunkManager wcm = world.getHandle().getWorldChunkManager(); WorldChunkManager wcm = world.getHandle().getWorldChunkManager();
BiomeBase[] biomeBase = wcm.getBiomeData(x << 4, z << 4, 16, 16); BiomeBase[] biomeBase = wcm.b((BiomeBase[])null, x << 4, z << 4, 16, 16);
if (includeBiome) { if (includeBiome) {
biome = new BiomeBase[256]; biome = new BiomeBase[256];
@ -218,8 +219,9 @@ public class CraftChunk implements Chunk {
if (includeBiomeTempRain) { if (includeBiomeTempRain) {
biomeTemp = new double[256]; biomeTemp = new double[256];
biomeRain = new double[256]; biomeRain = new double[256];
System.arraycopy(wcm.temperature, 0, biomeTemp, 0, biomeTemp.length); //System.arraycopy(wcm.temperature, 0, biomeTemp, 0, biomeTemp.length);
System.arraycopy(wcm.rain, 0, biomeRain, 0, biomeRain.length); //System.arraycopy(wcm.rain, 0, biomeRain, 0, biomeRain.length);
// TODO: Figure out new snapshot stuff
} }
} }
return new EmptyChunkSnapshot(x, z, world.getName(), world.getFullTime(), biome, biomeTemp, biomeRain); return new EmptyChunkSnapshot(x, z, world.getName(), world.getFullTime(), biome, biomeTemp, biomeRain);

View file

@ -50,6 +50,7 @@ import net.minecraft.server.Item;
import net.minecraft.server.ItemStack; import net.minecraft.server.ItemStack;
import net.minecraft.server.WorldMap; import net.minecraft.server.WorldMap;
import net.minecraft.server.WorldMapCollection; import net.minecraft.server.WorldMapCollection;
import net.minecraft.server.WorldSettings;
import org.bukkit.*; import org.bukkit.*;
import org.bukkit.permissions.Permissible; import org.bukkit.permissions.Permissible;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
@ -79,7 +80,7 @@ import org.yaml.snakeyaml.error.MarkedYAMLException;
public final class CraftServer implements Server { public final class CraftServer implements Server {
private final String serverName = "Craftbukkit"; private final String serverName = "Craftbukkit";
private final String serverVersion; private final String serverVersion;
private final String protocolVersion = "1.7.3"; private final String protocolVersion = "1.8";
private final ServicesManager servicesManager = new SimpleServicesManager(); private final ServicesManager servicesManager = new SimpleServicesManager();
private final BukkitScheduler scheduler = new CraftScheduler(this); private final BukkitScheduler scheduler = new CraftScheduler(this);
private final SimpleCommandMap commandMap = new SimpleCommandMap(this); private final SimpleCommandMap commandMap = new SimpleCommandMap(this);
@ -489,7 +490,7 @@ public final class CraftServer implements Server {
} }
int dimension = 10 + console.worlds.size(); int dimension = 10 + 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, new WorldSettings(seed, getDefaultGameMode().getValue(), true), environment, generator);
if (!(worlds.containsKey(name.toLowerCase()))) { if (!(worlds.containsKey(name.toLowerCase()))) {
return null; return null;
@ -532,7 +533,7 @@ public final class CraftServer implements Server {
ChunkCoordinates chunkcoordinates = internal.getSpawn(); ChunkCoordinates chunkcoordinates = internal.getSpawn();
internal.chunkProviderServer.getChunkAt(chunkcoordinates.x + j >> 4, chunkcoordinates.z + k >> 4); internal.chunkProviderServer.getChunkAt(chunkcoordinates.x + j >> 4, chunkcoordinates.z + k >> 4);
while (internal.doLighting()) { while (internal.v()) {
; ;
} }
} }

View file

@ -153,7 +153,7 @@ public class CraftWorld implements World {
net.minecraft.server.Chunk chunk = world.chunkProviderServer.getOrCreateChunk(x, z); net.minecraft.server.Chunk chunk = world.chunkProviderServer.getOrCreateChunk(x, z);
if (save && !chunk.isEmpty()) { if (save && !(chunk instanceof EmptyChunk)) {
chunk.removeEntities(); chunk.removeEntities();
world.chunkProviderServer.saveChunk(chunk); world.chunkProviderServer.saveChunk(chunk);
world.chunkProviderServer.saveChunkNOP(chunk); world.chunkProviderServer.saveChunkNOP(chunk);
@ -474,43 +474,37 @@ public class CraftWorld implements World {
public Biome getBiome(int x, int z) { public Biome getBiome(int x, int z) {
BiomeBase base = getHandle().getWorldChunkManager().getBiome(x, z); BiomeBase base = getHandle().getWorldChunkManager().getBiome(x, z);
if (base == BiomeBase.RAINFOREST) { if (base == BiomeBase.SWAMPLAND) {
return Biome.RAINFOREST;
} else if (base == BiomeBase.SWAMPLAND) {
return Biome.SWAMPLAND; return Biome.SWAMPLAND;
} else if (base == BiomeBase.SEASONAL_FOREST) {
return Biome.SEASONAL_FOREST;
} else if (base == BiomeBase.FOREST) { } else if (base == BiomeBase.FOREST) {
return Biome.FOREST; return Biome.FOREST;
} else if (base == BiomeBase.SAVANNA) {
return Biome.SAVANNA;
} else if (base == BiomeBase.SHRUBLAND) {
return Biome.SHRUBLAND;
} else if (base == BiomeBase.TAIGA) { } else if (base == BiomeBase.TAIGA) {
return Biome.TAIGA; return Biome.TAIGA;
} else if (base == BiomeBase.DESERT) { } else if (base == BiomeBase.DESERT) {
return Biome.DESERT; return Biome.DESERT;
} else if (base == BiomeBase.PLAINS) { } else if (base == BiomeBase.PLAINS) {
return Biome.PLAINS; return Biome.PLAINS;
} else if (base == BiomeBase.ICE_DESERT) {
return Biome.ICE_DESERT;
} else if (base == BiomeBase.TUNDRA) {
return Biome.TUNDRA;
} else if (base == BiomeBase.HELL) { } else if (base == BiomeBase.HELL) {
return Biome.HELL; return Biome.HELL;
} else if (base == BiomeBase.SKY) { } else if (base == BiomeBase.SKY) {
return Biome.SKY; return Biome.SKY;
} else if (base == BiomeBase.OCEAN) {
return Biome.OCEAN;
} else if (base == BiomeBase.EXTREME_HILLS) {
return Biome.EXTREME_HILLS;
} else if (base == BiomeBase.RIVER) {
return Biome.RIVER;
} }
return null; return null;
} }
public double getTemperature(int x, int z) { public double getTemperature(int x, int z) {
return getHandle().getWorldChunkManager().a((double[])null, x, z, 1, 1)[0]; throw new UnsupportedOperationException("Not compatible with 1.8");
} }
public double getHumidity(int x, int z) { public double getHumidity(int x, int z) {
return getHandle().getWorldChunkManager().getHumidity(x, z); throw new UnsupportedOperationException("Not compatible with 1.8");
} }
public List<Entity> getEntities() { public List<Entity> getEntities() {
@ -810,7 +804,7 @@ public class CraftWorld implements World {
loadChunk(chunkCoordX + x, chunkCoordZ + z); loadChunk(chunkCoordX + x, chunkCoordZ + z);
} else { } else {
if (isChunkLoaded(chunkCoordX + x, chunkCoordZ + z)) { if (isChunkLoaded(chunkCoordX + x, chunkCoordZ + z)) {
if (this.getHandle().getChunkAt(chunkCoordX + x, chunkCoordZ + z).isEmpty()) { if (this.getHandle().getChunkAt(chunkCoordX + x, chunkCoordZ + z) instanceof EmptyChunk) {
unloadChunk(chunkCoordX + x, chunkCoordZ + z, false); unloadChunk(chunkCoordX + x, chunkCoordZ + z, false);
} else { } else {
unloadChunk(chunkCoordX + x, chunkCoordZ + z); unloadChunk(chunkCoordX + x, chunkCoordZ + z);

View file

@ -222,32 +222,26 @@ public class CraftBlock implements Block {
} }
public static final Biome biomeBaseToBiome(BiomeBase base) { public static final Biome biomeBaseToBiome(BiomeBase base) {
if (base == BiomeBase.RAINFOREST) { if (base == BiomeBase.SWAMPLAND) {
return Biome.RAINFOREST;
} else if (base == BiomeBase.SWAMPLAND) {
return Biome.SWAMPLAND; return Biome.SWAMPLAND;
} else if (base == BiomeBase.SEASONAL_FOREST) {
return Biome.SEASONAL_FOREST;
} else if (base == BiomeBase.FOREST) { } else if (base == BiomeBase.FOREST) {
return Biome.FOREST; return Biome.FOREST;
} else if (base == BiomeBase.SAVANNA) {
return Biome.SAVANNA;
} else if (base == BiomeBase.SHRUBLAND) {
return Biome.SHRUBLAND;
} else if (base == BiomeBase.TAIGA) { } else if (base == BiomeBase.TAIGA) {
return Biome.TAIGA; return Biome.TAIGA;
} else if (base == BiomeBase.DESERT) { } else if (base == BiomeBase.DESERT) {
return Biome.DESERT; return Biome.DESERT;
} else if (base == BiomeBase.PLAINS) { } else if (base == BiomeBase.PLAINS) {
return Biome.PLAINS; return Biome.PLAINS;
} else if (base == BiomeBase.ICE_DESERT) {
return Biome.ICE_DESERT;
} else if (base == BiomeBase.TUNDRA) {
return Biome.TUNDRA;
} else if (base == BiomeBase.HELL) { } else if (base == BiomeBase.HELL) {
return Biome.HELL; return Biome.HELL;
} else if (base == BiomeBase.SKY) { } else if (base == BiomeBase.SKY) {
return Biome.SKY; return Biome.SKY;
} else if (base == BiomeBase.RIVER) {
return Biome.RIVER;
} else if (base == BiomeBase.EXTREME_HILLS) {
return Biome.EXTREME_HILLS;
} else if (base == BiomeBase.OCEAN) {
return Biome.OCEAN;
} }
return null; return null;
@ -308,7 +302,7 @@ public class CraftBlock implements Block {
} }
public PistonMoveReaction getPistonMoveReaction() { public PistonMoveReaction getPistonMoveReaction() {
return PistonMoveReaction.getById(net.minecraft.server.Block.byId[this.getTypeId()].material.j()); return PistonMoveReaction.getById(net.minecraft.server.Block.byId[this.getTypeId()].material.l());
} }
} }

View file

@ -23,6 +23,8 @@ import java.util.List;
import java.util.HashSet; import java.util.HashSet;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import net.minecraft.server.DamageSource;
import org.bukkit.entity.HumanEntity;
public class CraftLivingEntity extends CraftEntity implements LivingEntity { public class CraftLivingEntity extends CraftEntity implements LivingEntity {
public CraftLivingEntity(final CraftServer server, final EntityLiving entity) { public CraftLivingEntity(final CraftServer server, final EntityLiving entity) {
@ -39,7 +41,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
} }
if (entity instanceof EntityPlayer && health == 0) { if (entity instanceof EntityPlayer && health == 0) {
((EntityPlayer) entity).die((Entity) null); ((EntityPlayer) entity).die(DamageSource.j);
} }
getHandle().health = health; getHandle().health = health;
@ -125,7 +127,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
public Arrow shootArrow() { public Arrow shootArrow() {
net.minecraft.server.World world = ((CraftWorld) getWorld()).getHandle(); net.minecraft.server.World world = ((CraftWorld) getWorld()).getHandle();
EntityArrow arrow = new EntityArrow(world, getHandle()); EntityArrow arrow = new EntityArrow(world, getHandle(), 1);
world.addEntity(arrow); world.addEntity(arrow);
return (Arrow) arrow.getBukkitEntity(); return (Arrow) arrow.getBukkitEntity();
@ -174,11 +176,19 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
} }
public void damage(int amount) { public void damage(int amount) {
entity.damageEntity((Entity) null, amount); entity.damageEntity(DamageSource.j, amount);
} }
public void damage(int amount, org.bukkit.entity.Entity source) { public void damage(int amount, org.bukkit.entity.Entity source) {
entity.damageEntity(((CraftEntity) source).getHandle(), amount); DamageSource reason = DamageSource.a.j;
if (source instanceof HumanEntity) {
reason = DamageSource.b(((CraftHumanEntity)source).getHandle());
} else if (source instanceof LivingEntity) {
reason = DamageSource.a(((CraftLivingEntity)source).getHandle());
}
entity.damageEntity(reason, amount);
} }
public Location getEyeLocation() { public Location getEyeLocation() {