Fix nukkit compile

This commit is contained in:
Jesse Boyd 2018-03-19 16:05:12 +11:00
parent ded33aa9be
commit 39084be791
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
3 changed files with 13 additions and 20 deletions

View File

@ -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) {

View File

@ -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<T> extends BasicLocalBlockQueue<T> {
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);
}
}
}

View File

@ -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());
}
}
}