From 6bbb3b04ed5badcecec9e6073316621bb6bc9078 Mon Sep 17 00:00:00 2001 From: md_5 Date: Fri, 23 Aug 2019 20:10:58 +1000 Subject: [PATCH] SPIGOT-5281: Clearer error messages for ChunkSnapshot misuse --- src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java b/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java index 7f8434df0d..ee99b61f94 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java @@ -1,5 +1,6 @@ package org.bukkit.craftbukkit; +import com.google.common.base.Preconditions; import net.minecraft.server.BiomeBase; import net.minecraft.server.DataPaletteBlock; import net.minecraft.server.HeightMap; @@ -96,6 +97,7 @@ public class CraftChunkSnapshot implements ChunkSnapshot { @Override public final int getHighestBlockYAt(int x, int z) { + Preconditions.checkState(hmap != null, "ChunkSnapshot created without height map. Please call getSnapshot with includeMaxblocky=true"); CraftChunk.validateChunkCoordinates(x, 0, z); return hmap.a(x, z); @@ -103,6 +105,7 @@ public class CraftChunkSnapshot implements ChunkSnapshot { @Override public final Biome getBiome(int x, int z) { + Preconditions.checkState(biome != null, "ChunkSnapshot created without biome. Please call getSnapshot with includeBiome=true"); CraftChunk.validateChunkCoordinates(x, 0, z); return CraftBlock.biomeBaseToBiome(biome[z << 4 | x]); @@ -110,6 +113,7 @@ public class CraftChunkSnapshot implements ChunkSnapshot { @Override public final double getRawBiomeTemperature(int x, int z) { + Preconditions.checkState(biomeTemp != null, "ChunkSnapshot created without biome temperatures. Please call getSnapshot with includeBiomeTempRain=true"); CraftChunk.validateChunkCoordinates(x, 0, z); return biomeTemp[z << 4 | x];