Updates to FaweLocalBlockQueue to allow FAWE-P2 compatibility

This commit is contained in:
IronApollo 2018-11-01 07:24:56 -04:00
parent dcd041e847
commit 9896a1339e
2 changed files with 23 additions and 15 deletions

View File

@ -278,7 +278,12 @@ public abstract class BukkitQueue_0<CHUNK, CHUNKSECTIONS, SECTION> extends NMSMa
public void sendChunk(int x, int z, int bitMask) {} public void sendChunk(int x, int z, int bitMask) {}
@Override @Override
public void refreshChunk(FaweChunk fs) {} public void refreshChunk(FaweChunk fs) {
World world = getWorld();
if(world != null) {
world.refreshChunk(fs.getX(), fs.getZ());
}
}
@Override @Override
public boolean regenerateChunk(World world, int x, int z, BaseBiome biome, Long seed) { public boolean regenerateChunk(World world, int x, int z, BaseBiome biome, Long seed) {

View File

@ -8,10 +8,15 @@ import com.intellectualcrafters.jnbt.CompoundTag;
import com.intellectualcrafters.plot.object.PlotBlock; import com.intellectualcrafters.plot.object.PlotBlock;
import com.intellectualcrafters.plot.util.StringMan; import com.intellectualcrafters.plot.util.StringMan;
import com.intellectualcrafters.plot.util.block.LocalBlockQueue; import com.intellectualcrafters.plot.util.block.LocalBlockQueue;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.extension.platform.Capability;
import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.biome.BaseBiome; import com.sk89q.worldedit.world.biome.BaseBiome;
import com.sk89q.worldedit.world.biome.Biomes; import com.sk89q.worldedit.world.biome.Biomes;
import com.sk89q.worldedit.world.block.BlockTypes;
import com.sk89q.worldedit.world.registry.BiomeRegistry; import com.sk89q.worldedit.world.registry.BiomeRegistry;
import com.sk89q.worldedit.world.registry.LegacyMapper;
import java.util.List; import java.util.List;
// TODO FIXME // TODO FIXME
@ -61,15 +66,14 @@ public class FaweLocalBlockQueue extends LocalBlockQueue {
@Override @Override
public boolean setBlock(int x, int y, int z, int id, int data) { public boolean setBlock(int x, int y, int z, int id, int data) {
return false; return IMP.setBlock(x, y, z, LegacyMapper.getInstance().getBlockFromLegacy(id, data));
// return IMP.setBlock(x, y, z, (short) id, (byte) data);
} }
@Override @Override
public PlotBlock getBlock(int x, int y, int z) { public PlotBlock getBlock(int x, int y, int z) {
// int combined = IMP.getCombinedId4Data(x, y, z); int combined = IMP.getCombinedId4Data(x, y, z);
// return PlotBlock.get(FaweCache.getId(combined), FaweCache.getData(combined)); com.sk89q.worldedit.world.block.BlockState state = com.sk89q.worldedit.world.block.BlockState.getFromInternalId(combined);
return null; return PlotBlock.get(state.getInternalBlockTypeId(), state.getInternalPropertiesId());
} }
private BaseBiome biome; private BaseBiome biome;
@ -78,15 +82,14 @@ public class FaweLocalBlockQueue extends LocalBlockQueue {
@Override @Override
public boolean setBiome(int x, int z, String biome) { public boolean setBiome(int x, int z, String biome) {
// if (!StringMan.isEqual(biome, lastBiome)) { if (!StringMan.isEqual(biome, lastBiome)) {
// if (reg == null) { if (reg == null) {
// World weWorld = IMP.getWEWorld(); reg = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.USER_COMMANDS).getRegistries().getBiomeRegistry();
// reg = weWorld.getWorldData().getBiomeRegistry(); }
// } List<BaseBiome> biomes = reg.getBiomes();
// List<BaseBiome> biomes = reg.getBiomes(); lastBiome = biome;
// lastBiome = biome; this.biome = Biomes.findBiomeByName(biomes, biome, reg);
// this.biome = Biomes.findBiomeByName(biomes, biome, reg); }
// }
return IMP.setBiome(x, z, this.biome); return IMP.setBiome(x, z, this.biome);
} }