From 39084be79114f0bd4d7ea62a75576a92f4525ee5 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Mon, 19 Mar 2018 16:05:12 +1100 Subject: [PATCH] Fix nukkit compile --- .../com/plotsquared/nukkit/util/NukkitUtil.java | 15 ++++++--------- .../nukkit/util/block/NukkitLocalQueue.java | 6 +++--- .../nukkit/util/block/NukkitWrappedChunk.java | 12 ++++-------- 3 files changed, 13 insertions(+), 20 deletions(-) diff --git a/Nukkit/src/main/java/com/plotsquared/nukkit/util/NukkitUtil.java b/Nukkit/src/main/java/com/plotsquared/nukkit/util/NukkitUtil.java index 21c635500..a2ba75120 100644 --- a/Nukkit/src/main/java/com/plotsquared/nukkit/util/NukkitUtil.java +++ b/Nukkit/src/main/java/com/plotsquared/nukkit/util/NukkitUtil.java @@ -10,18 +10,15 @@ import cn.nukkit.entity.Entity; import cn.nukkit.item.Item; import cn.nukkit.level.Level; import cn.nukkit.level.Position; -import cn.nukkit.level.generator.biome.Biome; +import cn.nukkit.level.biome.Biome; +import cn.nukkit.level.biome.EnumBiome; import cn.nukkit.math.Vector3; import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.PlotBlock; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.RegionWrapper; import com.intellectualcrafters.plot.object.schematic.PlotItem; -import com.intellectualcrafters.plot.util.MathMan; -import com.intellectualcrafters.plot.util.StringComparison; -import com.intellectualcrafters.plot.util.StringMan; -import com.intellectualcrafters.plot.util.UUIDHandler; -import com.intellectualcrafters.plot.util.WorldUtil; +import com.intellectualcrafters.plot.util.*; import com.plotsquared.nukkit.NukkitMain; import com.plotsquared.nukkit.object.NukkitPlayer; import java.lang.reflect.Field; @@ -121,7 +118,7 @@ public class NukkitUtil extends WorldUtil { @Override public String getBiome(String world, int x, int z) { int id = getWorld(world).getBiomeId(x, z); - return Biome.getBiome(id).getName(); + return EnumBiome.getBiome(id).getName(); } @Override @@ -183,7 +180,7 @@ public class NukkitUtil extends WorldUtil { @Override public int getBiomeFromString(String biomeString) { try { - Biome biome = Biome.getBiome(biomeString.toUpperCase()); + Biome biome = EnumBiome.getBiome(biomeString.toUpperCase()); return biome.getId(); } catch (Throwable ignored) { return -1; @@ -266,7 +263,7 @@ public class NukkitUtil extends WorldUtil { int biome = (int) Biome.class.getDeclaredField(biomeString.toUpperCase()).get(null); for (int x = region.minX; x <= region.maxX; x++) { for (int z = region.minZ; z <= region.maxZ; z++) { - world.setBiomeId(x, z, biome); + world.setBiomeId(x, z, (byte) biome); } } } catch (Throwable e) { diff --git a/Nukkit/src/main/java/com/plotsquared/nukkit/util/block/NukkitLocalQueue.java b/Nukkit/src/main/java/com/plotsquared/nukkit/util/block/NukkitLocalQueue.java index d8e3492d5..d82d6d9ba 100644 --- a/Nukkit/src/main/java/com/plotsquared/nukkit/util/block/NukkitLocalQueue.java +++ b/Nukkit/src/main/java/com/plotsquared/nukkit/util/block/NukkitLocalQueue.java @@ -2,9 +2,9 @@ package com.plotsquared.nukkit.util.block; import cn.nukkit.block.Block; import cn.nukkit.level.Level; +import cn.nukkit.level.biome.EnumBiome; import cn.nukkit.level.format.FullChunk; import cn.nukkit.level.format.generic.BaseFullChunk; -import cn.nukkit.level.generator.biome.Biome; import cn.nukkit.math.Vector3; import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.object.PlotBlock; @@ -111,8 +111,8 @@ public class NukkitLocalQueue extends BasicLocalBlockQueue { for (int y = 0; y < biomes2.length; y++) { String biomeStr = biomes2[y]; if (biomeStr != null) { - biome = Biome.getBiome(biomeStr.toUpperCase()).getId(); - level.setBiomeId(bx + x, bz + y, biome); + biome = EnumBiome.getBiome(biomeStr.toUpperCase()).getId(); + level.setBiomeId(bx + x, bz + y, (byte) biome); } } } diff --git a/Nukkit/src/main/java/com/plotsquared/nukkit/util/block/NukkitWrappedChunk.java b/Nukkit/src/main/java/com/plotsquared/nukkit/util/block/NukkitWrappedChunk.java index 6daf07f67..15c0edd1e 100644 --- a/Nukkit/src/main/java/com/plotsquared/nukkit/util/block/NukkitWrappedChunk.java +++ b/Nukkit/src/main/java/com/plotsquared/nukkit/util/block/NukkitWrappedChunk.java @@ -1,11 +1,11 @@ package com.plotsquared.nukkit.util.block; +import cn.nukkit.level.biome.Biome; +import cn.nukkit.level.biome.EnumBiome; import cn.nukkit.level.format.generic.BaseFullChunk; -import cn.nukkit.level.generator.biome.Biome; import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.PlotBlock; import com.intellectualcrafters.plot.util.block.ScopedLocalBlockQueue; -import java.awt.Color; public class NukkitWrappedChunk extends ScopedLocalBlockQueue { private final String world; @@ -39,23 +39,19 @@ public class NukkitWrappedChunk extends ScopedLocalBlockQueue { @Override public boolean setBiome(int x, int z, String biome) { - Biome b = Biome.getBiome(biome); + Biome b = EnumBiome.getBiome(biome); int id = b.getId(); - Color color = new Color(b.getColor()); chunk.setBiomeId(x, z, id); - chunk.setBiomeColor(x, z, color.getRed(), color.getGreen(), color.getBlue()); return true; } @Override public void fillBiome(String biome) { - Biome b = Biome.getBiome(biome); + Biome b = EnumBiome.getBiome(biome); int id = b.getId(); - Color color = new Color(b.getColor()); for (int x = 0; x < 16; x++) { for (int z = 0; z < 16; z++) { chunk.setBiomeId(x, z, id); - chunk.setBiomeColor(x, z, color.getRed(), color.getGreen(), color.getBlue()); } } }