Update to latest P2

This commit is contained in:
Jesse Boyd 2019-11-10 22:20:46 +00:00
parent 59897dea11
commit 10a6619853
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
5 changed files with 23 additions and 27 deletions

View File

@ -8,7 +8,7 @@ fun Project.applyCommonConfiguration() {
repositories {
mavenCentral()
mavenLocal()
maven { url = uri("http://ci.athion.net/job/PlotSquared-we/ws/mvn/") }
maven { url = uri("http://ci.athion.net/job/PlotSquared-breaking/ws/mvn/") }
maven { url = uri("https://maven.sk89q.com/repo/") }
maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots/") }
maven { url = uri("http://empcraft.com/maven2") }

View File

@ -7,7 +7,7 @@ plugins {
}
repositories {
maven { url = uri("http://ci.athion.net/job/PlotSquared-we/ws/mvn/") }
maven { url = uri("http://ci.athion.net/job/PlotSquared-breaking/ws/mvn/") }
}
applyPlatformAndCoreConfiguration()

View File

@ -6,6 +6,7 @@ import com.boydti.fawe.object.io.BufferedRandomAccessFile;
import com.boydti.fawe.util.MainUtil;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.world.block.BlockID;
import it.unimi.dsi.fastutil.io.FastByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
@ -138,11 +139,14 @@ public abstract class MCAWriter implements Extent {
chunk.setPosition(fcx + (getOffsetX() >> 4), fcz + (getOffsetZ() >> 4));
// Compress
byte[] bytes = chunk.toBytes(byteStore1.get());
byte[] compressedBytes = MainUtil.compress(bytes, byteStore2.get(), deflateStore.get());
FastByteArrayOutputStream uncompressed = chunk.toBytes(byteStore1.get());
int len = uncompressed.length;
uncompressed.reset();
MainUtil.compress(uncompressed.array, len , byteStore2.get(), uncompressed, deflateStore.get());
byte[] clone = Arrays.copyOf(uncompressed.array, uncompressed.length);
// TODO optimize (avoid cloning) by add a synchronized block and write to the RAF here instead of below
compressed[((fcx & 31)) + ((fcz & 31) << 5)] = compressedBytes.clone();
compressed[((fcx & 31)) + ((fcz & 31) << 5)] = clone;
}
} catch (Throwable e) {
e.printStackTrace();

View File

@ -4,20 +4,16 @@ import com.boydti.fawe.Fawe;
import com.boydti.fawe.FaweAPI;
import com.boydti.fawe.FaweCache;
import com.boydti.fawe.beta.IQueueExtent;
import com.github.intellectualsites.plotsquared.plot.util.StringMan;
import com.github.intellectualsites.plotsquared.plot.util.block.LocalBlockQueue;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.extension.platform.Capability;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.MutableBlockVector3;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.biome.BiomeTypes;
import com.sk89q.worldedit.world.biome.Biomes;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.registry.BiomeRegistry;
import com.sk89q.worldedit.world.registry.LegacyMapper;
import java.util.Collection;
// TODO FIXME
public class FaweLocalBlockQueue extends LocalBlockQueue {
@ -25,6 +21,7 @@ public class FaweLocalBlockQueue extends LocalBlockQueue {
public final IQueueExtent IMP;
private final LegacyMapper legacyMapper;
private final World world;
private BlockVector3 mutable = new MutableBlockVector3();
public FaweLocalBlockQueue(String worldName) {
super(worldName);
@ -74,6 +71,12 @@ public class FaweLocalBlockQueue extends LocalBlockQueue {
return IMP.setBlock(x, y, z, id);
}
@Override
public boolean setBlock(int x, int y, int z, Pattern pattern) {
mutable.setComponents(x, y, z);
return pattern.apply(IMP, mutable, mutable);
}
@Override
public boolean setBlock(final int x, final int y, final int z, final BaseBlock id) {
return IMP.setBlock(x, y, z, id);
@ -84,21 +87,9 @@ public class FaweLocalBlockQueue extends LocalBlockQueue {
return IMP.getBlock(x, y, z);
}
private BiomeType biome;
private String lastBiome;
private BiomeRegistry reg;
@Override
public boolean setBiome(int x, int z, String biome) {
if (!StringMan.isEqual(biome, lastBiome)) {
if (reg == null) {
reg = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.USER_COMMANDS).getRegistries().getBiomeRegistry();
}
Collection<BiomeType> biomes = BiomeTypes.values();
lastBiome = biome;
this.biome = Biomes.findBiomeByName(biomes, biome, reg);
}
return IMP.setBiome(x, 0, z, this.biome);
public boolean setBiome(int x, int z, BiomeType biomeType) {
return IMP.setBiome(x, 0, z, biomeType);
}
@Override

View File

@ -59,7 +59,8 @@ public class PlotSetBiome extends Command {
Collection<BiomeType> knownBiomes = BiomeTypes.values();
final BiomeType biome = Biomes.findBiomeByName(knownBiomes, args[0], biomeRegistry);
if (biome == null) {
String biomes = StringMan.join(WorldUtil.IMP.getBiomeList(), Captions.BLOCK_LIST_SEPARATOR.toString());
String biomes = StringMan
.join(BiomeType.REGISTRY.values(), Captions.BLOCK_LIST_SEPARATOR.getTranslated());
Captions.NEED_BIOME.send(player);
MainUtil.sendMessage(player, Captions.SUBCOMMAND_SET_OPTIONS_HEADER.toString() + biomes);
return CompletableFuture.completedFuture(false);