mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-05 18:27:17 +01:00
Update for Minecraft 1.8
By: Dinnerbone <dinnerbone@dinnerbone.com>
This commit is contained in:
parent
c4875394c3
commit
d902201875
6 changed files with 46 additions and 45 deletions
|
@ -39,7 +39,7 @@
|
|||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>minecraft-server</artifactId>
|
||||
<version>1.7.3</version>
|
||||
<version>1.8</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
|
|
@ -154,7 +154,7 @@ public class CraftChunk implements Chunk {
|
|||
|
||||
if (includeBiome || includeBiomeTempRain) {
|
||||
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) {
|
||||
biome = new BiomeBase[256];
|
||||
|
@ -164,8 +164,9 @@ public class CraftChunk implements Chunk {
|
|||
if (includeBiomeTempRain) {
|
||||
biomeTemp = new double[256];
|
||||
biomeRain = new double[256];
|
||||
System.arraycopy(wcm.temperature, 0, biomeTemp, 0, biomeTemp.length);
|
||||
System.arraycopy(wcm.rain, 0, biomeRain, 0, biomeRain.length);
|
||||
//System.arraycopy(wcm.temperature, 0, biomeTemp, 0, biomeTemp.length);
|
||||
//System.arraycopy(wcm.rain, 0, biomeRain, 0, biomeRain.length);
|
||||
// TODO: Figure out new snapshot stuff
|
||||
}
|
||||
}
|
||||
World world = getWorld();
|
||||
|
@ -208,7 +209,7 @@ public class CraftChunk implements Chunk {
|
|||
|
||||
if (includeBiome || includeBiomeTempRain) {
|
||||
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) {
|
||||
biome = new BiomeBase[256];
|
||||
|
@ -218,8 +219,9 @@ public class CraftChunk implements Chunk {
|
|||
if (includeBiomeTempRain) {
|
||||
biomeTemp = new double[256];
|
||||
biomeRain = new double[256];
|
||||
System.arraycopy(wcm.temperature, 0, biomeTemp, 0, biomeTemp.length);
|
||||
System.arraycopy(wcm.rain, 0, biomeRain, 0, biomeRain.length);
|
||||
//System.arraycopy(wcm.temperature, 0, biomeTemp, 0, biomeTemp.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);
|
||||
|
|
|
@ -50,6 +50,7 @@ import net.minecraft.server.Item;
|
|||
import net.minecraft.server.ItemStack;
|
||||
import net.minecraft.server.WorldMap;
|
||||
import net.minecraft.server.WorldMapCollection;
|
||||
import net.minecraft.server.WorldSettings;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.permissions.Permissible;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
@ -79,7 +80,7 @@ import org.yaml.snakeyaml.error.MarkedYAMLException;
|
|||
public final class CraftServer implements Server {
|
||||
private final String serverName = "Craftbukkit";
|
||||
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 BukkitScheduler scheduler = new CraftScheduler(this);
|
||||
private final SimpleCommandMap commandMap = new SimpleCommandMap(this);
|
||||
|
@ -489,7 +490,7 @@ public final class CraftServer implements Server {
|
|||
}
|
||||
|
||||
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()))) {
|
||||
return null;
|
||||
|
@ -532,7 +533,7 @@ public final class CraftServer implements Server {
|
|||
ChunkCoordinates chunkcoordinates = internal.getSpawn();
|
||||
internal.chunkProviderServer.getChunkAt(chunkcoordinates.x + j >> 4, chunkcoordinates.z + k >> 4);
|
||||
|
||||
while (internal.doLighting()) {
|
||||
while (internal.v()) {
|
||||
;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -153,7 +153,7 @@ public class CraftWorld implements World {
|
|||
|
||||
net.minecraft.server.Chunk chunk = world.chunkProviderServer.getOrCreateChunk(x, z);
|
||||
|
||||
if (save && !chunk.isEmpty()) {
|
||||
if (save && !(chunk instanceof EmptyChunk)) {
|
||||
chunk.removeEntities();
|
||||
world.chunkProviderServer.saveChunk(chunk);
|
||||
world.chunkProviderServer.saveChunkNOP(chunk);
|
||||
|
@ -474,43 +474,37 @@ public class CraftWorld implements World {
|
|||
public Biome getBiome(int x, int z) {
|
||||
BiomeBase base = getHandle().getWorldChunkManager().getBiome(x, z);
|
||||
|
||||
if (base == BiomeBase.RAINFOREST) {
|
||||
return Biome.RAINFOREST;
|
||||
} else if (base == BiomeBase.SWAMPLAND) {
|
||||
if (base == BiomeBase.SWAMPLAND) {
|
||||
return Biome.SWAMPLAND;
|
||||
} else if (base == BiomeBase.SEASONAL_FOREST) {
|
||||
return Biome.SEASONAL_FOREST;
|
||||
} else if (base == BiomeBase.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) {
|
||||
return Biome.TAIGA;
|
||||
} else if (base == BiomeBase.DESERT) {
|
||||
return Biome.DESERT;
|
||||
} else if (base == BiomeBase.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) {
|
||||
return Biome.HELL;
|
||||
} else if (base == BiomeBase.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;
|
||||
}
|
||||
|
||||
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) {
|
||||
return getHandle().getWorldChunkManager().getHumidity(x, z);
|
||||
throw new UnsupportedOperationException("Not compatible with 1.8");
|
||||
}
|
||||
|
||||
public List<Entity> getEntities() {
|
||||
|
@ -810,7 +804,7 @@ public class CraftWorld implements World {
|
|||
loadChunk(chunkCoordX + x, chunkCoordZ + z);
|
||||
} else {
|
||||
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);
|
||||
} else {
|
||||
unloadChunk(chunkCoordX + x, chunkCoordZ + z);
|
||||
|
|
|
@ -222,32 +222,26 @@ public class CraftBlock implements Block {
|
|||
}
|
||||
|
||||
public static final Biome biomeBaseToBiome(BiomeBase base) {
|
||||
if (base == BiomeBase.RAINFOREST) {
|
||||
return Biome.RAINFOREST;
|
||||
} else if (base == BiomeBase.SWAMPLAND) {
|
||||
if (base == BiomeBase.SWAMPLAND) {
|
||||
return Biome.SWAMPLAND;
|
||||
} else if (base == BiomeBase.SEASONAL_FOREST) {
|
||||
return Biome.SEASONAL_FOREST;
|
||||
} else if (base == BiomeBase.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) {
|
||||
return Biome.TAIGA;
|
||||
} else if (base == BiomeBase.DESERT) {
|
||||
return Biome.DESERT;
|
||||
} else if (base == BiomeBase.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) {
|
||||
return Biome.HELL;
|
||||
} else if (base == BiomeBase.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;
|
||||
|
@ -308,7 +302,7 @@ public class CraftBlock implements Block {
|
|||
}
|
||||
|
||||
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());
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,8 @@ import java.util.List;
|
|||
import java.util.HashSet;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import net.minecraft.server.DamageSource;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
|
||||
public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
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) {
|
||||
((EntityPlayer) entity).die((Entity) null);
|
||||
((EntityPlayer) entity).die(DamageSource.j);
|
||||
}
|
||||
|
||||
getHandle().health = health;
|
||||
|
@ -125,7 +127,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
|||
|
||||
public Arrow shootArrow() {
|
||||
net.minecraft.server.World world = ((CraftWorld) getWorld()).getHandle();
|
||||
EntityArrow arrow = new EntityArrow(world, getHandle());
|
||||
EntityArrow arrow = new EntityArrow(world, getHandle(), 1);
|
||||
|
||||
world.addEntity(arrow);
|
||||
return (Arrow) arrow.getBukkitEntity();
|
||||
|
@ -174,11 +176,19 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
|||
}
|
||||
|
||||
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) {
|
||||
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() {
|
||||
|
|
Loading…
Reference in a new issue