mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 07:06:44 +01:00
Minor sponge fix
This commit is contained in:
parent
ffddf5c187
commit
409456e895
@ -114,7 +114,7 @@ public final class Flags {
|
||||
}
|
||||
};
|
||||
public static final BooleanFlag SLEEP = new BooleanFlag("sleep");
|
||||
public static final TeleportDenyFlag DENY_TELEPORT = new TeleportDenyFlag("teleport-deny");
|
||||
public static final TeleportDenyFlag TELEPORT_DENY = new TeleportDenyFlag("teleport-deny");
|
||||
|
||||
|
||||
private static final HashMap<String, Flag<?>> flags;
|
||||
|
@ -332,7 +332,7 @@ public class SpongeMain implements IPlotMain {
|
||||
if (gen instanceof SpongePlotGenerator) {
|
||||
PS.get().loadWorld(worldName, (SpongePlotGenerator) gen);
|
||||
} else {
|
||||
throw new UnsupportedOperationException("NOT IMPLEMENTED YET!");
|
||||
throw new UnsupportedOperationException("NOT IMPLEMENTED YET! " + worldName + " | " + gen);
|
||||
}
|
||||
}
|
||||
|
||||
@ -345,6 +345,8 @@ public class SpongeMain implements IPlotMain {
|
||||
public PlotPlayer wrapPlayer(Object player) {
|
||||
if (player instanceof Player) {
|
||||
return SpongeUtil.getPlayer((Player) player);
|
||||
} else if (UUIDHandler.implementation == null) {
|
||||
return null;
|
||||
} else if (player instanceof String) {
|
||||
return UUIDHandler.getPlayer((String) player);
|
||||
} else if (player instanceof UUID) {
|
||||
|
@ -149,7 +149,7 @@ public class SpongeSetupUtils extends SetupUtils {
|
||||
.generator(GeneratorTypes.OVERWORLD)
|
||||
.usesMapFeatures(false)
|
||||
.enabled(true)
|
||||
//.generatorModifiers(wgm)
|
||||
.generatorModifiers(wgm)
|
||||
.build("PS",object.world);
|
||||
WorldProperties properties = null;
|
||||
try {
|
||||
|
@ -15,6 +15,7 @@ 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.plotsquared.sponge.SpongeMain;
|
||||
import com.plotsquared.sponge.object.SpongePlayer;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
@ -52,7 +53,7 @@ import org.spongepowered.api.world.extent.Extent;
|
||||
|
||||
public class SpongeUtil extends WorldUtil {
|
||||
|
||||
public static Cause CAUSE = Cause.of(NamedCause.source("PlotSquared"));
|
||||
public static Cause CAUSE = Cause.of(NamedCause.source(Sponge.getPluginManager().fromInstance(SpongeMain.THIS).get()));
|
||||
private static BiomeType[] biomes;
|
||||
private static HashMap<String, Integer> biomeMap;
|
||||
private static HashMap<BlockState, PlotBlock> stateMap;
|
||||
|
@ -17,6 +17,7 @@ import net.minecraft.entity.EntityTracker;
|
||||
import net.minecraft.entity.EntityTrackerEntry;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.network.play.server.SPacketChunkData;
|
||||
import net.minecraft.network.play.server.SPacketDestroyEntities;
|
||||
import net.minecraft.server.management.PlayerChunkMap;
|
||||
@ -31,9 +32,6 @@ import org.spongepowered.api.block.BlockState;
|
||||
import org.spongepowered.api.block.BlockTypes;
|
||||
import org.spongepowered.api.world.World;
|
||||
import org.spongepowered.api.world.biome.BiomeType;
|
||||
import org.spongepowered.api.world.extent.UnmodifiableBlockVolume;
|
||||
import org.spongepowered.api.world.extent.worker.MutableBlockVolumeWorker;
|
||||
import org.spongepowered.api.world.extent.worker.procedure.BlockVolumeMapper;
|
||||
|
||||
public class SpongeLocalQueue extends BasicLocalBlockQueue<char[]> {
|
||||
|
||||
@ -59,7 +57,6 @@ public class SpongeLocalQueue extends BasicLocalBlockQueue<char[]> {
|
||||
|
||||
@Override
|
||||
public PlotBlock getBlock(int x, int y, int z) {
|
||||
|
||||
World worldObj = getSpongeWorld();
|
||||
BlockState block = worldObj.getBlock(x, y, z);
|
||||
if (block == null) {
|
||||
@ -440,24 +437,28 @@ public class SpongeLocalQueue extends BasicLocalBlockQueue<char[]> {
|
||||
public void setBlocks(LocalChunk<char[]> lc) {
|
||||
World worldObj = getSpongeWorld();
|
||||
org.spongepowered.api.world.Chunk spongeChunk = (org.spongepowered.api.world.Chunk) getChunk(worldObj, lc.getX(), lc.getZ());
|
||||
Chunk nmsChunk = (Chunk) spongeChunk;
|
||||
char[][] ids = ((CharLocalChunk) lc).blocks;
|
||||
MutableBlockVolumeWorker<? extends org.spongepowered.api.world.Chunk> blockWorker = spongeChunk.getBlockWorker(SpongeUtil.CAUSE);
|
||||
blockWorker.map(new BlockVolumeMapper() {
|
||||
@Override
|
||||
public BlockState map(UnmodifiableBlockVolume volume, int xx, int y, int zz) {
|
||||
int x = xx & 15;
|
||||
int z = zz & 15;
|
||||
int i = MainUtil.CACHE_I[y][x][z];
|
||||
char[] array = ids[i];
|
||||
for (int layer = 0; layer < 16; layer++) {
|
||||
char[] array = ids[layer];
|
||||
if (array == null) {
|
||||
return null;
|
||||
continue;
|
||||
}
|
||||
int combinedId = array[MainUtil.CACHE_J[y][x][z]];
|
||||
ExtendedBlockStorage section = nmsChunk.getBlockStorageArray()[layer];
|
||||
short[] cacheX = MainUtil.x_loc[0];
|
||||
short[] cacheY = MainUtil.y_loc[0];
|
||||
short[] cacheZ = MainUtil.z_loc[0];
|
||||
for (int j = 0; j < array.length; j++) {
|
||||
int combinedId = array[j];
|
||||
switch (combinedId) {
|
||||
case 0:
|
||||
return null;
|
||||
continue;
|
||||
case 1:
|
||||
return AIR;
|
||||
int x = cacheX[j];
|
||||
int y = cacheY[j];
|
||||
int z = cacheZ[j];
|
||||
section.set(x, y, z, Blocks.AIR.getDefaultState());
|
||||
continue;
|
||||
default:
|
||||
int id = combinedId >> 4;
|
||||
Block block = Block.getBlockById(id);
|
||||
@ -468,10 +469,15 @@ public class SpongeLocalQueue extends BasicLocalBlockQueue<char[]> {
|
||||
} else {
|
||||
ibd = block.getDefaultState();
|
||||
}
|
||||
return (BlockState) ibd;
|
||||
x = cacheX[j];
|
||||
y = cacheY[j];
|
||||
z = cacheZ[j];
|
||||
section.set(x, y, z, ibd);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
refreshChunk(nmsChunk.xPosition, nmsChunk.zPosition);
|
||||
}
|
||||
|
||||
public void setBiomes(LocalChunk<char[]> lc) {
|
||||
|
Loading…
Reference in New Issue
Block a user