mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-06 15:12:13 -07:00
Update to Minecraft 1.13-pre7
This commit is contained in:
@@ -3,9 +3,15 @@ package org.bukkit.craftbukkit;
|
||||
import org.bukkit.ChunkSnapshot;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.craftbukkit.block.CraftBlock;
|
||||
import org.bukkit.craftbukkit.block.data.CraftBlockData;
|
||||
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
|
||||
|
||||
import net.minecraft.server.BiomeBase;
|
||||
import net.minecraft.server.DataPaletteBlock;
|
||||
import net.minecraft.server.HeightMap;
|
||||
import net.minecraft.server.IBlockData;
|
||||
|
||||
/**
|
||||
* Represents a static, thread-safe snapshot of chunk of blocks
|
||||
@@ -14,31 +20,27 @@ import net.minecraft.server.BiomeBase;
|
||||
public class CraftChunkSnapshot implements ChunkSnapshot {
|
||||
private final int x, z;
|
||||
private final String worldname;
|
||||
private final short[][] blockids; /* Block IDs, by section */
|
||||
private final byte[][] blockdata;
|
||||
private final DataPaletteBlock<IBlockData>[] blockids;
|
||||
private final byte[][] skylight;
|
||||
private final byte[][] emitlight;
|
||||
private final boolean[] empty;
|
||||
private final int[] hmap; // Height map
|
||||
private final HeightMap hmap; // Height map
|
||||
private final long captureFulltime;
|
||||
private final BiomeBase[] biome;
|
||||
private final double[] biomeTemp;
|
||||
private final double[] biomeRain;
|
||||
|
||||
CraftChunkSnapshot(int x, int z, String wname, long wtime, short[][] sectionBlockIDs, byte[][] sectionBlockData, byte[][] sectionSkyLights, byte[][] sectionEmitLights, boolean[] sectionEmpty, int[] hmap, BiomeBase[] biome, double[] biomeTemp, double[] biomeRain) {
|
||||
CraftChunkSnapshot(int x, int z, String wname, long wtime, DataPaletteBlock<IBlockData>[] sectionBlockIDs, byte[][] sectionSkyLights, byte[][] sectionEmitLights, boolean[] sectionEmpty, HeightMap hmap, BiomeBase[] biome, double[] biomeTemp) {
|
||||
this.x = x;
|
||||
this.z = z;
|
||||
this.worldname = wname;
|
||||
this.captureFulltime = wtime;
|
||||
this.blockids = sectionBlockIDs;
|
||||
this.blockdata = sectionBlockData;
|
||||
this.skylight = sectionSkyLights;
|
||||
this.emitlight = sectionEmitLights;
|
||||
this.empty = sectionEmpty;
|
||||
this.hmap = hmap;
|
||||
this.biome = biome;
|
||||
this.biomeTemp = biomeTemp;
|
||||
this.biomeRain = biomeRain;
|
||||
}
|
||||
|
||||
public int getX() {
|
||||
@@ -55,16 +57,17 @@ public class CraftChunkSnapshot implements ChunkSnapshot {
|
||||
|
||||
@Override
|
||||
public Material getBlockType(int x, int y, int z) {
|
||||
return Material.getMaterial(getBlockTypeId(x, y, z));
|
||||
return CraftMagicNumbers.getMaterial(blockids[y >> 4].a(x, y & 0xF, z).getBlock());
|
||||
}
|
||||
|
||||
public final int getBlockTypeId(int x, int y, int z) {
|
||||
return blockids[y >> 4][((y & 0xF) << 8) | (z << 4) | x];
|
||||
@Override
|
||||
public final BlockData getBlockData(int x, int y, int z) {
|
||||
return CraftBlockData.fromData(blockids[y >> 4].a(x, y & 0xF, z));
|
||||
}
|
||||
|
||||
public final int getBlockData(int x, int y, int z) {
|
||||
int off = ((y & 0xF) << 7) | (z << 3) | (x >> 1);
|
||||
return (blockdata[y >> 4][off] >> ((x & 1) << 2)) & 0xF;
|
||||
@Override
|
||||
public final int getData(int x, int y, int z) {
|
||||
return CraftMagicNumbers.toLegacyData(blockids[y >> 4].a(x, y & 0xF, z));
|
||||
}
|
||||
|
||||
public final int getBlockSkyLight(int x, int y, int z) {
|
||||
@@ -78,7 +81,7 @@ public class CraftChunkSnapshot implements ChunkSnapshot {
|
||||
}
|
||||
|
||||
public final int getHighestBlockYAt(int x, int z) {
|
||||
return hmap[z << 4 | x];
|
||||
return hmap.a(x, z);
|
||||
}
|
||||
|
||||
public final Biome getBiome(int x, int z) {
|
||||
@@ -89,10 +92,6 @@ public class CraftChunkSnapshot implements ChunkSnapshot {
|
||||
return biomeTemp[z << 4 | x];
|
||||
}
|
||||
|
||||
public final double getRawBiomeRainfall(int x, int z) {
|
||||
return biomeRain[z << 4 | x];
|
||||
}
|
||||
|
||||
public final long getCaptureFullTime() {
|
||||
return captureFulltime;
|
||||
}
|
||||
|
Reference in New Issue
Block a user