Various
Fix forge multiworld Add NMS setLight (sky/block) Fix clipboard on disk start index Fix cmd block data
This commit is contained in:
parent
d562b6cf66
commit
4bde477206
@ -30,9 +30,9 @@ import org.bukkit.event.world.WorldInitEvent;
|
|||||||
|
|
||||||
public abstract class BukkitQueue_0<CHUNK, CHUNKSECTIONS, SECTION> extends NMSMappedFaweQueue<World, CHUNK, CHUNKSECTIONS, SECTION> implements Listener {
|
public abstract class BukkitQueue_0<CHUNK, CHUNKSECTIONS, SECTION> extends NMSMappedFaweQueue<World, CHUNK, CHUNKSECTIONS, SECTION> implements Listener {
|
||||||
|
|
||||||
public Object adapter;
|
public static Object adapter;
|
||||||
public Method methodToNative;
|
public static Method methodToNative;
|
||||||
public Method methodFromNative;
|
public static Method methodFromNative;
|
||||||
|
|
||||||
public BukkitQueue_0(final String world) {
|
public BukkitQueue_0(final String world) {
|
||||||
super(world);
|
super(world);
|
||||||
@ -51,16 +51,6 @@ public abstract class BukkitQueue_0<CHUNK, CHUNKSECTIONS, SECTION> extends NMSMa
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getEmmittedLight(CHUNKSECTIONS sections, int x, int y, int z) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getSkyLight(CHUNKSECTIONS sections, int x, int y, int z) {
|
|
||||||
return 15;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void relight(int x, int y, int z) {}
|
public void relight(int x, int y, int z) {}
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ import com.boydti.fawe.FaweCache;
|
|||||||
import com.boydti.fawe.config.Settings;
|
import com.boydti.fawe.config.Settings;
|
||||||
import com.boydti.fawe.object.FaweChunk;
|
import com.boydti.fawe.object.FaweChunk;
|
||||||
import com.boydti.fawe.object.RunnableVal;
|
import com.boydti.fawe.object.RunnableVal;
|
||||||
|
import com.boydti.fawe.util.TaskManager;
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
@ -23,6 +24,16 @@ public class BukkitQueue_All extends BukkitQueue_0<Chunk, Chunk, Chunk> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setSkyLight(int x, int y, int z, int value) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setBlockLight(int x, int y, int z, int value) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public int getCombinedId4Data(Chunk section, int x, int y, int z) {
|
public int getCombinedId4Data(Chunk section, int x, int y, int z) {
|
||||||
Block block = ((Chunk) section).getBlock(x & 15, y, z & 15);
|
Block block = ((Chunk) section).getBlock(x & 15, y, z & 15);
|
||||||
int combined = block.getTypeId() << 4;
|
int combined = block.getTypeId() << 4;
|
||||||
@ -32,6 +43,45 @@ public class BukkitQueue_All extends BukkitQueue_0<Chunk, Chunk, Chunk> {
|
|||||||
return combined;
|
return combined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getEmmittedLight(final Chunk chunk, int x, int y, int z) {
|
||||||
|
if (!chunk.isLoaded()) {
|
||||||
|
TaskManager.IMP.sync(new RunnableVal<Object>() {
|
||||||
|
@Override
|
||||||
|
public void run(Object value) {
|
||||||
|
chunk.load(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return chunk.getBlock(x, y, z).getLightFromBlocks();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getSkyLight(final Chunk chunk, int x, int y, int z) {
|
||||||
|
if (!chunk.isLoaded()) {
|
||||||
|
TaskManager.IMP.sync(new RunnableVal<Object>() {
|
||||||
|
@Override
|
||||||
|
public void run(Object value) {
|
||||||
|
chunk.load(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return chunk.getBlock(x, y, z).getLightFromSky();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getLight(final Chunk chunk, int x, int y, int z) {
|
||||||
|
if (!chunk.isLoaded()) {
|
||||||
|
TaskManager.IMP.sync(new RunnableVal<Object>() {
|
||||||
|
@Override
|
||||||
|
public void run(Object value) {
|
||||||
|
chunk.load(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return chunk.getBlock(x, y, z).getLightLevel();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean fixLighting(FaweChunk<?> fc, RelightMode mode) {
|
public boolean fixLighting(FaweChunk<?> fc, RelightMode mode) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -36,6 +36,7 @@ import net.minecraft.server.v1_10_R1.BlockPosition;
|
|||||||
import net.minecraft.server.v1_10_R1.Blocks;
|
import net.minecraft.server.v1_10_R1.Blocks;
|
||||||
import net.minecraft.server.v1_10_R1.ChunkCoordIntPair;
|
import net.minecraft.server.v1_10_R1.ChunkCoordIntPair;
|
||||||
import net.minecraft.server.v1_10_R1.ChunkSection;
|
import net.minecraft.server.v1_10_R1.ChunkSection;
|
||||||
|
import net.minecraft.server.v1_10_R1.DataBits;
|
||||||
import net.minecraft.server.v1_10_R1.DataPaletteBlock;
|
import net.minecraft.server.v1_10_R1.DataPaletteBlock;
|
||||||
import net.minecraft.server.v1_10_R1.Entity;
|
import net.minecraft.server.v1_10_R1.Entity;
|
||||||
import net.minecraft.server.v1_10_R1.EntityHuman;
|
import net.minecraft.server.v1_10_R1.EntityHuman;
|
||||||
@ -77,15 +78,19 @@ import org.bukkit.generator.ChunkGenerator;
|
|||||||
|
|
||||||
public class BukkitQueue_1_10 extends BukkitQueue_0<Chunk, ChunkSection[], DataPaletteBlock> {
|
public class BukkitQueue_1_10 extends BukkitQueue_0<Chunk, ChunkSection[], DataPaletteBlock> {
|
||||||
|
|
||||||
private IBlockData air;
|
private static IBlockData air;
|
||||||
|
private static Field fieldBits;
|
||||||
|
|
||||||
public BukkitQueue_1_10(final String world) {
|
public BukkitQueue_1_10(final String world) {
|
||||||
super(world);
|
super(world);
|
||||||
checkVersion("v1_10_R1");
|
checkVersion("v1_10_R1");
|
||||||
|
if (adapter == null) {
|
||||||
try {
|
try {
|
||||||
Field fieldAir = DataPaletteBlock.class.getDeclaredField("a");
|
Field fieldAir = DataPaletteBlock.class.getDeclaredField("a");
|
||||||
fieldAir.setAccessible(true);
|
fieldAir.setAccessible(true);
|
||||||
air = (IBlockData) fieldAir.get(null);
|
air = (IBlockData) fieldAir.get(null);
|
||||||
|
fieldBits = DataPaletteBlock.class.getDeclaredField("b");
|
||||||
|
fieldBits.setAccessible(true);
|
||||||
if (adapter == null) {
|
if (adapter == null) {
|
||||||
setupAdapter(new com.boydti.fawe.bukkit.v1_10.FaweAdapter_1_10());
|
setupAdapter(new com.boydti.fawe.bukkit.v1_10.FaweAdapter_1_10());
|
||||||
Fawe.debug("Using adapter: " + adapter);
|
Fawe.debug("Using adapter: " + adapter);
|
||||||
@ -95,6 +100,55 @@ public class BukkitQueue_1_10 extends BukkitQueue_0<Chunk, ChunkSection[], DataP
|
|||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setSkyLight(int x, int y, int z, int value) {
|
||||||
|
int cx = x >> 4;
|
||||||
|
int cz = z >> 4;
|
||||||
|
if (!ensureChunkLoaded(cx, cz)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ChunkSection[] sections = getCachedSections(getWorld(), cx, cz);
|
||||||
|
ChunkSection section = sections[y >> 4];
|
||||||
|
if (section == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
section.getSkyLightArray().a(x & 15, y & 15, z & 15, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setBlockLight(int x, int y, int z, int value) {
|
||||||
|
int cx = x >> 4;
|
||||||
|
int cz = z >> 4;
|
||||||
|
if (!ensureChunkLoaded(cx, cz)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ChunkSection[] sections = getCachedSections(getWorld(), cx, cz);
|
||||||
|
ChunkSection section = sections[y >> 4];
|
||||||
|
if (section == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
section.getEmittedLightArray().a(x & 15, y & 15, z & 15, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private DataBits lastBits;
|
||||||
|
private DataPaletteBlock lastBlocks;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasBlock(DataPaletteBlock dataPaletteBlock, int x, int y, int z) {
|
||||||
|
try {
|
||||||
|
if (lastBlocks != dataPaletteBlock) {
|
||||||
|
lastBits = (DataBits) fieldBits.get(dataPaletteBlock);
|
||||||
|
lastBlocks = dataPaletteBlock;
|
||||||
|
}
|
||||||
|
int i = FaweCache.CACHE_J[y][x & 15][z & 15];
|
||||||
|
return lastBits.a(i) != 0;
|
||||||
|
} catch (IllegalAccessException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public World createWorld(final WorldCreator creator) {
|
public World createWorld(final WorldCreator creator) {
|
||||||
|
@ -673,4 +673,34 @@ public class BukkitQueue17 extends BukkitQueue_0<Chunk, ChunkSection[], ChunkSec
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setSkyLight(int x, int y, int z, int value) {
|
||||||
|
int cx = x >> 4;
|
||||||
|
int cz = z >> 4;
|
||||||
|
if (!ensureChunkLoaded(cx, cz)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ChunkSection[] sections = getCachedSections(getWorld(), cx, cz);
|
||||||
|
ChunkSection section = sections[y >> 4];
|
||||||
|
if (section == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
section.getSkyLightArray().a(x & 15, y & 15, z & 15, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setBlockLight(int x, int y, int z, int value) {
|
||||||
|
int cx = x >> 4;
|
||||||
|
int cz = z >> 4;
|
||||||
|
if (!ensureChunkLoaded(cx, cz)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ChunkSection[] sections = getCachedSections(getWorld(), cx, cz);
|
||||||
|
ChunkSection section = sections[y >> 4];
|
||||||
|
if (section == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
section.getEmittedLightArray().a(x & 15, y & 15, z & 15, value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -659,4 +659,34 @@ public class BukkitQueue18R3 extends BukkitQueue_0<Chunk, ChunkSection[], char[]
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setSkyLight(int x, int y, int z, int value) {
|
||||||
|
int cx = x >> 4;
|
||||||
|
int cz = z >> 4;
|
||||||
|
if (!ensureChunkLoaded(cx, cz)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ChunkSection[] sections = getCachedSections(getWorld(), cx, cz);
|
||||||
|
ChunkSection section = sections[y >> 4];
|
||||||
|
if (section == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
section.getSkyLightArray().a(x & 15, y & 15, z & 15, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setBlockLight(int x, int y, int z, int value) {
|
||||||
|
int cx = x >> 4;
|
||||||
|
int cz = z >> 4;
|
||||||
|
if (!ensureChunkLoaded(cx, cz)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ChunkSection[] sections = getCachedSections(getWorld(), cx, cz);
|
||||||
|
ChunkSection section = sections[y >> 4];
|
||||||
|
if (section == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
section.getEmittedLightArray().a(x & 15, y & 15, z & 15, value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -791,4 +791,34 @@ public class BukkitQueue_1_9_R1 extends BukkitQueue_0<Chunk, ChunkSection[], Dat
|
|||||||
public FaweChunk getFaweChunk(int x, int z) {
|
public FaweChunk getFaweChunk(int x, int z) {
|
||||||
return new BukkitChunk_1_9(this, x, z);
|
return new BukkitChunk_1_9(this, x, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setSkyLight(int x, int y, int z, int value) {
|
||||||
|
int cx = x >> 4;
|
||||||
|
int cz = z >> 4;
|
||||||
|
if (!ensureChunkLoaded(cx, cz)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ChunkSection[] sections = getCachedSections(getWorld(), cx, cz);
|
||||||
|
ChunkSection section = sections[y >> 4];
|
||||||
|
if (section == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
section.getSkyLightArray().a(x & 15, y & 15, z & 15, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setBlockLight(int x, int y, int z, int value) {
|
||||||
|
int cx = x >> 4;
|
||||||
|
int cz = z >> 4;
|
||||||
|
if (!ensureChunkLoaded(cx, cz)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ChunkSection[] sections = getCachedSections(getWorld(), cx, cz);
|
||||||
|
ChunkSection section = sections[y >> 4];
|
||||||
|
if (section == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
section.getEmittedLightArray().a(x & 15, y & 15, z & 15, value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -114,11 +114,17 @@ public class FaweAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static World getWorld(String worldName) {
|
public static World getWorld(String worldName) {
|
||||||
for (World current : WorldEdit.getInstance().getServer().getWorlds()) {
|
List<? extends World> worlds = WorldEdit.getInstance().getServer().getWorlds();
|
||||||
|
for (World current : worlds) {
|
||||||
if (Fawe.imp().getWorldName(current).equals(worldName)) {
|
if (Fawe.imp().getWorldName(current).equals(worldName)) {
|
||||||
return WorldWrapper.wrap((AbstractWorld) current);
|
return WorldWrapper.wrap((AbstractWorld) current);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (World current : worlds) {
|
||||||
|
if (current.getName().equals(worldName)) {
|
||||||
|
return WorldWrapper.wrap((AbstractWorld) current);
|
||||||
|
}
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -439,7 +439,6 @@ public class FaweCache {
|
|||||||
case 129:
|
case 129:
|
||||||
case 133:
|
case 133:
|
||||||
case 138:
|
case 138:
|
||||||
case 137:
|
|
||||||
case 140:
|
case 140:
|
||||||
case 165:
|
case 165:
|
||||||
case 166:
|
case 166:
|
||||||
|
@ -102,8 +102,8 @@ public enum BBC {
|
|||||||
VISITOR_ENTITY("%s0 entities affected", "WorldEdit.Visitor"),
|
VISITOR_ENTITY("%s0 entities affected", "WorldEdit.Visitor"),
|
||||||
VISITOR_FLAT("%s0 columns affected", "WorldEdit.Visitor"),
|
VISITOR_FLAT("%s0 columns affected", "WorldEdit.Visitor"),
|
||||||
|
|
||||||
SELECTOR_CUBOID_POS1("First position set to %s0 %s1.", "WorldEdit.Selector"),
|
SELECTOR_CUBOID_POS1("pos1 set to %s0 %s1.", "WorldEdit.Selector"),
|
||||||
SELECTOR_CUBOID_POS2("Second position set to %s0 %s1.", "WorldEdit.Selector"),
|
SELECTOR_CUBOID_POS2("pos2 set to %s0 %s1.", "WorldEdit.Selector"),
|
||||||
SELECTOR_INVALID_COORDINATES("Invalid coordinates %s0", "WorldEdit.Selector"),
|
SELECTOR_INVALID_COORDINATES("Invalid coordinates %s0", "WorldEdit.Selector"),
|
||||||
SELECTOR_ALREADY_SET("Position already set.", "WorldEdit.Selector"),
|
SELECTOR_ALREADY_SET("Position already set.", "WorldEdit.Selector"),
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ public abstract class MappedFaweQueue<WORLD, CHUNK, SECTION> extends FaweQueue {
|
|||||||
long pair = (long) (cx) << 32 | (cz) & 0xFFFFFFFFL;
|
long pair = (long) (cx) << 32 | (cz) & 0xFFFFFFFFL;
|
||||||
lastWrappedChunk = this.blocks.get(pair);
|
lastWrappedChunk = this.blocks.get(pair);
|
||||||
if (lastWrappedChunk == null) {
|
if (lastWrappedChunk == null) {
|
||||||
lastWrappedChunk = this.getFaweChunk(x >> 4, z >> 4);
|
lastWrappedChunk = this.getFaweChunk(cx, cz);
|
||||||
lastWrappedChunk.setBlock(x & 15, y, z & 15, id, data);
|
lastWrappedChunk.setBlock(x & 15, y, z & 15, id, data);
|
||||||
FaweChunk previous = this.blocks.put(pair, lastWrappedChunk);
|
FaweChunk previous = this.blocks.put(pair, lastWrappedChunk);
|
||||||
if (previous == null) {
|
if (previous == null) {
|
||||||
@ -386,19 +386,8 @@ public abstract class MappedFaweQueue<WORLD, CHUNK, SECTION> extends FaweQueue {
|
|||||||
|
|
||||||
long average = 0;
|
long average = 0;
|
||||||
|
|
||||||
@Override
|
public boolean ensureChunkLoaded(int cx, int cz) throws FaweException.FaweChunkLoadException {
|
||||||
public int getCombinedId4Data(int x, int y, int z) throws FaweException.FaweChunkLoadException {
|
|
||||||
if (y < 0 || y > 255) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
int cx = x >> 4;
|
|
||||||
int cz = z >> 4;
|
|
||||||
int cy = y >> 4;
|
|
||||||
if (cx != lastChunkX || cz != lastChunkZ) {
|
|
||||||
lastChunkX = cx;
|
|
||||||
lastChunkZ = cz;
|
|
||||||
if (!isChunkLoaded(cx, cz)) {
|
if (!isChunkLoaded(cx, cz)) {
|
||||||
long start = System.currentTimeMillis();
|
|
||||||
boolean sync = Thread.currentThread() == Fawe.get().getMainThread();
|
boolean sync = Thread.currentThread() == Fawe.get().getMainThread();
|
||||||
if (sync) {
|
if (sync) {
|
||||||
loadChunk(getWorld(), cx, cz, true);
|
loadChunk(getWorld(), cx, cz, true);
|
||||||
@ -409,9 +398,53 @@ public abstract class MappedFaweQueue<WORLD, CHUNK, SECTION> extends FaweQueue {
|
|||||||
throw new FaweException.FaweChunkLoadException();
|
throw new FaweException.FaweChunkLoadException();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasBlock(int x, int y, int z) throws FaweException.FaweChunkLoadException {
|
||||||
|
int cx = x >> 4;
|
||||||
|
int cz = z >> 4;
|
||||||
|
int cy = y >> 4;
|
||||||
|
if (cx != lastChunkX || cz != lastChunkZ) {
|
||||||
|
lastChunkX = cx;
|
||||||
|
lastChunkZ = cz;
|
||||||
|
if (!ensureChunkLoaded(cx, cz)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
lastChunkSections = getCachedSections(getWorld(), cx, cz);
|
||||||
|
lastSection = getCachedSection(lastChunkSections, cy);
|
||||||
|
} else if (cy != lastChunkY) {
|
||||||
|
if (lastChunkSections == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
lastSection = getCachedSection(lastChunkSections, cy);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lastSection == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return hasBlock(lastSection, x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasBlock(SECTION section, int x, int y, int z) {
|
||||||
|
return getCombinedId4Data(lastSection, x, y, z) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCombinedId4Data(int x, int y, int z) throws FaweException.FaweChunkLoadException {
|
||||||
|
int cx = x >> 4;
|
||||||
|
int cz = z >> 4;
|
||||||
|
int cy = y >> 4;
|
||||||
|
if (cx != lastChunkX || cz != lastChunkZ) {
|
||||||
|
lastChunkX = cx;
|
||||||
|
lastChunkZ = cz;
|
||||||
|
if (!ensureChunkLoaded(cx, cz)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
lastChunkSections = getCachedSections(getWorld(), cx, cz);
|
lastChunkSections = getCachedSections(getWorld(), cx, cz);
|
||||||
lastSection = getCachedSection(lastChunkSections, cy);
|
lastSection = getCachedSection(lastChunkSections, cy);
|
||||||
} else if (cy != lastChunkY) {
|
} else if (cy != lastChunkY) {
|
||||||
|
@ -97,6 +97,10 @@ public abstract class NMSMappedFaweQueue<WORLD, CHUNK, CHUNKSECTION, SECTION> ex
|
|||||||
|
|
||||||
public abstract void relight(int x, int y, int z);
|
public abstract void relight(int x, int y, int z);
|
||||||
|
|
||||||
|
public abstract void setSkyLight(int x, int y, int z, int value);
|
||||||
|
|
||||||
|
public abstract void setBlockLight(int x, int y, int z, int value);
|
||||||
|
|
||||||
public abstract int getSkyLight(CHUNKSECTION sections, int x, int y, int z);
|
public abstract int getSkyLight(CHUNKSECTION sections, int x, int y, int z);
|
||||||
|
|
||||||
public abstract int getEmmittedLight(CHUNKSECTION sections, int x, int y, int z);
|
public abstract int getEmmittedLight(CHUNKSECTION sections, int x, int y, int z);
|
||||||
|
@ -39,6 +39,11 @@ public class FaweLocation {
|
|||||||
return FaweAPI.getWorld(world);
|
return FaweAPI.getWorld(world);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return world + "," + x + "," + y + "," + z;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return this.x << (8 + this.z) << (4 + this.y);
|
return this.x << (8 + this.z) << (4 + this.y);
|
||||||
|
@ -115,7 +115,7 @@ public abstract class FawePlayer<T> {
|
|||||||
String currentWorldName = getLocation().world;
|
String currentWorldName = getLocation().world;
|
||||||
World world = getWorld();
|
World world = getWorld();
|
||||||
if (world != null) {
|
if (world != null) {
|
||||||
if (world.getName().equals(currentWorldName)) {
|
if (Fawe.imp().getWorldName(world).equals(currentWorldName)) {
|
||||||
getSession().clearHistory();
|
getSession().clearHistory();
|
||||||
loadSessionsFromDisk(world);
|
loadSessionsFromDisk(world);
|
||||||
}
|
}
|
||||||
@ -176,7 +176,7 @@ public abstract class FawePlayer<T> {
|
|||||||
final long start = System.currentTimeMillis();
|
final long start = System.currentTimeMillis();
|
||||||
final UUID uuid = getUUID();
|
final UUID uuid = getUUID();
|
||||||
final List<Integer> editIds = new ArrayList<>();
|
final List<Integer> editIds = new ArrayList<>();
|
||||||
final File folder = new File(Fawe.imp().getDirectory(), "history" + File.separator + world.getName() + File.separator + uuid);
|
final File folder = new File(Fawe.imp().getDirectory(), "history" + File.separator + Fawe.imp().getWorldName(world) + File.separator + uuid);
|
||||||
if (folder.isDirectory()) {
|
if (folder.isDirectory()) {
|
||||||
for (File file : folder.listFiles()) {
|
for (File file : folder.listFiles()) {
|
||||||
if (file.getName().endsWith(".bd")) {
|
if (file.getName().endsWith(".bd")) {
|
||||||
|
@ -202,6 +202,10 @@ public abstract class FaweQueue {
|
|||||||
|
|
||||||
public abstract void addNotifyTask(Runnable runnable);
|
public abstract void addNotifyTask(Runnable runnable);
|
||||||
|
|
||||||
|
public boolean hasBlock(int x, int y, int z) throws FaweException.FaweChunkLoadException {
|
||||||
|
return getCombinedId4Data(x, y, z) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
public abstract int getCombinedId4Data(int x, int y, int z) throws FaweException.FaweChunkLoadException;
|
public abstract int getCombinedId4Data(int x, int y, int z) throws FaweException.FaweChunkLoadException;
|
||||||
|
|
||||||
public abstract CompoundTag getTileEntity(int x, int y, int z) throws FaweException.FaweChunkLoadException;
|
public abstract CompoundTag getTileEntity(int x, int y, int z) throws FaweException.FaweChunkLoadException;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.boydti.fawe.object.brush;
|
package com.boydti.fawe.object.brush;
|
||||||
|
|
||||||
|
import com.boydti.fawe.Fawe;
|
||||||
import com.boydti.fawe.object.FawePlayer;
|
import com.boydti.fawe.object.FawePlayer;
|
||||||
import com.boydti.fawe.wrappers.LocationMaskedPlayerWrapper;
|
import com.boydti.fawe.wrappers.LocationMaskedPlayerWrapper;
|
||||||
import com.boydti.fawe.wrappers.PlayerWrapper;
|
import com.boydti.fawe.wrappers.PlayerWrapper;
|
||||||
@ -33,7 +34,7 @@ public class CommandBrush implements Brush {
|
|||||||
String replaced = command.replace("{x}", position.getBlockX() + "")
|
String replaced = command.replace("{x}", position.getBlockX() + "")
|
||||||
.replace("{y}", position.getBlockY() + "")
|
.replace("{y}", position.getBlockY() + "")
|
||||||
.replace("{z}", position.getBlockZ() + "")
|
.replace("{z}", position.getBlockZ() + "")
|
||||||
.replace("{world}", editSession.getWorld().getName() + "")
|
.replace("{world}", Fawe.imp().getWorldName(editSession.getWorld()) + "")
|
||||||
.replace("{size}", radius + "");
|
.replace("{size}", radius + "");
|
||||||
|
|
||||||
WorldVectorFace face = player.getBlockTraceFace(256, true);
|
WorldVectorFace face = player.getBlockTraceFace(256, true);
|
||||||
|
@ -73,7 +73,7 @@ public class DiskStorageHistory extends FaweStreamChangeSet {
|
|||||||
|
|
||||||
public DiskStorageHistory(World world, UUID uuid) {
|
public DiskStorageHistory(World world, UUID uuid) {
|
||||||
super(world);
|
super(world);
|
||||||
String base = "history" + File.separator + world.getName() + File.separator + uuid;
|
String base = "history" + File.separator + Fawe.imp().getWorldName(world) + File.separator + uuid;
|
||||||
File folder = new File(Fawe.imp().getDirectory(), base);
|
File folder = new File(Fawe.imp().getDirectory(), base);
|
||||||
int max = 0;
|
int max = 0;
|
||||||
if (folder.exists()) {
|
if (folder.exists()) {
|
||||||
@ -97,7 +97,7 @@ public class DiskStorageHistory extends FaweStreamChangeSet {
|
|||||||
|
|
||||||
private void init(UUID uuid, int i) {
|
private void init(UUID uuid, int i) {
|
||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
String base = "history" + File.separator + getWorld().getName() + File.separator + uuid;
|
String base = "history" + File.separator + Fawe.imp().getWorldName(getWorld()) + File.separator + uuid;
|
||||||
base += File.separator + i;
|
base += File.separator + i;
|
||||||
nbtfFile = new File(Fawe.imp().getDirectory(), base + ".nbtf");
|
nbtfFile = new File(Fawe.imp().getDirectory(), base + ".nbtf");
|
||||||
nbttFile = new File(Fawe.imp().getDirectory(), base + ".nbtt");
|
nbttFile = new File(Fawe.imp().getDirectory(), base + ".nbtt");
|
||||||
|
@ -112,7 +112,10 @@ public class MemoryOptimizedHistory extends FaweStreamChangeSet {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InputStream getBlockIS() throws IOException {
|
public InputStream getBlockIS() throws IOException {
|
||||||
FaweInputStream result = ids == null ? null : MainUtil.getCompressedIS(new ByteArrayInputStream(ids));
|
if (ids == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
FaweInputStream result = MainUtil.getCompressedIS(new ByteArrayInputStream(ids));
|
||||||
result.skip(FaweStreamChangeSet.HEADER_SIZE);
|
result.skip(FaweStreamChangeSet.HEADER_SIZE);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ public class SchematicWriter implements ClipboardWriter {
|
|||||||
int x = -1;
|
int x = -1;
|
||||||
int y = 0;
|
int y = 0;
|
||||||
int z = 0;
|
int z = 0;
|
||||||
int index = 0;
|
int index = -1;
|
||||||
|
|
||||||
public int[] yarea;
|
public int[] yarea;
|
||||||
public int[] zwidth;
|
public int[] zwidth;
|
||||||
|
@ -111,7 +111,12 @@ public class FaweForge implements IFawe {
|
|||||||
if (world instanceof WorldWrapper) {
|
if (world instanceof WorldWrapper) {
|
||||||
world = ((WorldWrapper) world).getParent();
|
world = ((WorldWrapper) world).getParent();
|
||||||
}
|
}
|
||||||
return ((ForgeWorld) world).getWorld().getWorldInfo().getWorldName();
|
return getWorldName(((ForgeWorld) world).getWorld());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getWorldName(net.minecraft.world.World w) {
|
||||||
|
return w.getWorldInfo().getWorldName() + ";" + w.provider.getDimension();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.boydti.fawe.forge;
|
package com.boydti.fawe.forge;
|
||||||
|
|
||||||
|
import com.boydti.fawe.Fawe;
|
||||||
import com.boydti.fawe.config.BBC;
|
import com.boydti.fawe.config.BBC;
|
||||||
import com.boydti.fawe.config.Settings;
|
import com.boydti.fawe.config.Settings;
|
||||||
import com.boydti.fawe.object.FaweLocation;
|
import com.boydti.fawe.object.FaweLocation;
|
||||||
@ -66,7 +67,7 @@ public class ForgePlayer extends FawePlayer<EntityPlayerMP> {
|
|||||||
public FaweLocation getLocation() {
|
public FaweLocation getLocation() {
|
||||||
World world = parent.worldObj;
|
World world = parent.worldObj;
|
||||||
BlockPos pos = parent.getPosition();
|
BlockPos pos = parent.getPosition();
|
||||||
return new FaweLocation(world.getWorldInfo().getWorldName(), pos.getX(), pos.getY(), pos.getZ());
|
return new FaweLocation(Fawe.<FaweForge>imp().getWorldName(world), pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -55,7 +55,7 @@ import net.minecraft.world.chunk.IChunkProvider;
|
|||||||
import net.minecraft.world.chunk.NibbleArray;
|
import net.minecraft.world.chunk.NibbleArray;
|
||||||
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
|
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
|
||||||
import net.minecraft.world.gen.ChunkProviderServer;
|
import net.minecraft.world.gen.ChunkProviderServer;
|
||||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
import net.minecraftforge.common.DimensionManager;
|
||||||
|
|
||||||
public class ForgeQueue_All extends NMSMappedFaweQueue<World, Chunk, ExtendedBlockStorage[], BlockStateContainer> {
|
public class ForgeQueue_All extends NMSMappedFaweQueue<World, Chunk, ExtendedBlockStorage[], BlockStateContainer> {
|
||||||
|
|
||||||
@ -687,12 +687,42 @@ public class ForgeQueue_All extends NMSMappedFaweQueue<World, Chunk, ExtendedBlo
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public World getImpWorld() {
|
public World getImpWorld() {
|
||||||
WorldServer[] worlds = FMLCommonHandler.instance().getMinecraftServerInstance().worldServers;
|
if (nmsWorld != null) {
|
||||||
for (WorldServer ws : worlds) {
|
return nmsWorld;
|
||||||
if (ws.getWorldInfo().getWorldName().equals(getWorldName())) {
|
|
||||||
return nmsWorld = ws;
|
|
||||||
}
|
}
|
||||||
|
String[] split = getWorldName().split(";");
|
||||||
|
int id = Integer.parseInt(split[split.length - 1]);
|
||||||
|
nmsWorld = DimensionManager.getWorld(id);
|
||||||
|
return nmsWorld;
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
|
@Override
|
||||||
|
public void setSkyLight(int x, int y, int z, int value) {
|
||||||
|
int cx = x >> 4;
|
||||||
|
int cz = z >> 4;
|
||||||
|
if (!ensureChunkLoaded(cx, cz)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ExtendedBlockStorage[] sections = getCachedSections(getWorld(), cx, cz);
|
||||||
|
ExtendedBlockStorage section = sections[y >> 4];
|
||||||
|
if (section == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
section.getSkylightArray().set(x & 15, y & 15, z & 15, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setBlockLight(int x, int y, int z, int value) {
|
||||||
|
int cx = x >> 4;
|
||||||
|
int cz = z >> 4;
|
||||||
|
if (!ensureChunkLoaded(cx, cz)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ExtendedBlockStorage[] sections = getCachedSections(getWorld(), cx, cz);
|
||||||
|
ExtendedBlockStorage section = sections[y >> 4];
|
||||||
|
if (section == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
section.getBlocklightArray().set(x & 15, y & 15, z & 15, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,12 @@ public class FaweForge implements IFawe {
|
|||||||
if (world instanceof WorldWrapper) {
|
if (world instanceof WorldWrapper) {
|
||||||
world = ((WorldWrapper) world).getParent();
|
world = ((WorldWrapper) world).getParent();
|
||||||
}
|
}
|
||||||
return ((ForgeWorld) world).getWorld().provider.getDimensionName();
|
return getWorldName(((ForgeWorld) world).getWorld());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getWorldName(net.minecraft.world.World w) {
|
||||||
|
return w.getWorldInfo().getWorldName() + ";" + w.provider.dimensionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.boydti.fawe.forge;
|
package com.boydti.fawe.forge;
|
||||||
|
|
||||||
|
import com.boydti.fawe.Fawe;
|
||||||
import com.boydti.fawe.config.BBC;
|
import com.boydti.fawe.config.BBC;
|
||||||
import com.boydti.fawe.config.Settings;
|
import com.boydti.fawe.config.Settings;
|
||||||
import com.boydti.fawe.object.FaweLocation;
|
import com.boydti.fawe.object.FaweLocation;
|
||||||
@ -68,7 +69,7 @@ public class ForgePlayer extends FawePlayer<EntityPlayerMP> {
|
|||||||
public FaweLocation getLocation() {
|
public FaweLocation getLocation() {
|
||||||
World world = parent.worldObj;
|
World world = parent.worldObj;
|
||||||
ChunkCoordinates pos = parent.getPlayerCoordinates();
|
ChunkCoordinates pos = parent.getPlayerCoordinates();
|
||||||
return new FaweLocation(world.provider.getDimensionName(), pos.posX, pos.posY, pos.posZ);
|
return new FaweLocation(Fawe.<FaweForge>imp().getWorldName(world), pos.posX, pos.posY, pos.posZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -37,7 +37,6 @@ import net.minecraft.nbt.NBTBase;
|
|||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.network.play.server.S13PacketDestroyEntities;
|
import net.minecraft.network.play.server.S13PacketDestroyEntities;
|
||||||
import net.minecraft.network.play.server.S21PacketChunkData;
|
import net.minecraft.network.play.server.S21PacketChunkData;
|
||||||
import net.minecraft.server.MinecraftServer;
|
|
||||||
import net.minecraft.server.management.PlayerManager;
|
import net.minecraft.server.management.PlayerManager;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.IntHashMap;
|
import net.minecraft.util.IntHashMap;
|
||||||
@ -51,6 +50,7 @@ import net.minecraft.world.chunk.IChunkProvider;
|
|||||||
import net.minecraft.world.chunk.NibbleArray;
|
import net.minecraft.world.chunk.NibbleArray;
|
||||||
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
|
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
|
||||||
import net.minecraft.world.gen.ChunkProviderServer;
|
import net.minecraft.world.gen.ChunkProviderServer;
|
||||||
|
import net.minecraftforge.common.DimensionManager;
|
||||||
|
|
||||||
public class ForgeQueue_All extends NMSMappedFaweQueue<World, Chunk, ExtendedBlockStorage[], ExtendedBlockStorage> {
|
public class ForgeQueue_All extends NMSMappedFaweQueue<World, Chunk, ExtendedBlockStorage[], ExtendedBlockStorage> {
|
||||||
|
|
||||||
@ -680,12 +680,41 @@ public class ForgeQueue_All extends NMSMappedFaweQueue<World, Chunk, ExtendedBlo
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public World getImpWorld() {
|
public World getImpWorld() {
|
||||||
WorldServer[] worlds = MinecraftServer.getServer().worldServers;
|
if (nmsWorld != null) {
|
||||||
for (WorldServer ws : worlds) {
|
return nmsWorld;
|
||||||
if (ws.provider.getDimensionName().equals(getWorldName())) {
|
|
||||||
return nmsWorld = ws;
|
|
||||||
}
|
}
|
||||||
|
String[] split = getWorldName().split(";");
|
||||||
|
int id = Integer.parseInt(split[split.length - 1]);
|
||||||
|
return nmsWorld = DimensionManager.getWorld(id);
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
|
@Override
|
||||||
|
public void setSkyLight(int x, int y, int z, int value) {
|
||||||
|
int cx = x >> 4;
|
||||||
|
int cz = z >> 4;
|
||||||
|
if (!ensureChunkLoaded(cx, cz)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ExtendedBlockStorage[] sections = getCachedSections(getWorld(), cx, cz);
|
||||||
|
ExtendedBlockStorage section = sections[y >> 4];
|
||||||
|
if (section == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
section.getSkylightArray().set(x & 15, y & 15, z & 15, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setBlockLight(int x, int y, int z, int value) {
|
||||||
|
int cx = x >> 4;
|
||||||
|
int cz = z >> 4;
|
||||||
|
if (!ensureChunkLoaded(cx, cz)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ExtendedBlockStorage[] sections = getCachedSections(getWorld(), cx, cz);
|
||||||
|
ExtendedBlockStorage section = sections[y >> 4];
|
||||||
|
if (section == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
section.getBlocklightArray().set(x & 15, y & 15, z & 15, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -111,7 +111,12 @@ public class FaweForge implements IFawe {
|
|||||||
if (world instanceof WorldWrapper) {
|
if (world instanceof WorldWrapper) {
|
||||||
world = ((WorldWrapper) world).getParent();
|
world = ((WorldWrapper) world).getParent();
|
||||||
}
|
}
|
||||||
return ((ForgeWorld) world).getWorld().provider.getDimensionName();
|
return getWorldName(((ForgeWorld) world).getWorld());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getWorldName(net.minecraft.world.World w) {
|
||||||
|
return w.getWorldInfo().getWorldName() + ";" + w.provider.getDimensionId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.boydti.fawe.forge;
|
package com.boydti.fawe.forge;
|
||||||
|
|
||||||
|
import com.boydti.fawe.Fawe;
|
||||||
import com.boydti.fawe.config.BBC;
|
import com.boydti.fawe.config.BBC;
|
||||||
import com.boydti.fawe.config.Settings;
|
import com.boydti.fawe.config.Settings;
|
||||||
import com.boydti.fawe.object.FaweLocation;
|
import com.boydti.fawe.object.FaweLocation;
|
||||||
@ -69,7 +70,7 @@ public class ForgePlayer extends FawePlayer<EntityPlayerMP> {
|
|||||||
public FaweLocation getLocation() {
|
public FaweLocation getLocation() {
|
||||||
World world = parent.worldObj;
|
World world = parent.worldObj;
|
||||||
BlockPos pos = parent.getPosition();
|
BlockPos pos = parent.getPosition();
|
||||||
return new FaweLocation(world.provider.getDimensionName(), pos.getX(), pos.getY(), pos.getZ());
|
return new FaweLocation(Fawe.<FaweForge>imp().getWorldName(world), pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -35,7 +35,6 @@ import net.minecraft.nbt.NBTBase;
|
|||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.network.play.server.S13PacketDestroyEntities;
|
import net.minecraft.network.play.server.S13PacketDestroyEntities;
|
||||||
import net.minecraft.network.play.server.S21PacketChunkData;
|
import net.minecraft.network.play.server.S21PacketChunkData;
|
||||||
import net.minecraft.server.MinecraftServer;
|
|
||||||
import net.minecraft.server.management.PlayerManager;
|
import net.minecraft.server.management.PlayerManager;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.BlockPos;
|
import net.minecraft.util.BlockPos;
|
||||||
@ -49,6 +48,7 @@ import net.minecraft.world.chunk.IChunkProvider;
|
|||||||
import net.minecraft.world.chunk.NibbleArray;
|
import net.minecraft.world.chunk.NibbleArray;
|
||||||
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
|
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
|
||||||
import net.minecraft.world.gen.ChunkProviderServer;
|
import net.minecraft.world.gen.ChunkProviderServer;
|
||||||
|
import net.minecraftforge.common.DimensionManager;
|
||||||
|
|
||||||
public class ForgeQueue_All extends NMSMappedFaweQueue<World, Chunk, ExtendedBlockStorage[], char[]> {
|
public class ForgeQueue_All extends NMSMappedFaweQueue<World, Chunk, ExtendedBlockStorage[], char[]> {
|
||||||
|
|
||||||
@ -643,12 +643,41 @@ public class ForgeQueue_All extends NMSMappedFaweQueue<World, Chunk, ExtendedBlo
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public World getImpWorld() {
|
public World getImpWorld() {
|
||||||
WorldServer[] worlds = MinecraftServer.getServer().worldServers;
|
if (nmsWorld != null) {
|
||||||
for (WorldServer ws : worlds) {
|
return nmsWorld;
|
||||||
if (ws.provider.getDimensionName().equals(getWorldName())) {
|
|
||||||
return nmsWorld = ws;
|
|
||||||
}
|
}
|
||||||
|
String[] split = getWorldName().split(";");
|
||||||
|
int id = Integer.parseInt(split[split.length - 1]);
|
||||||
|
return nmsWorld = DimensionManager.getWorld(id);
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
|
@Override
|
||||||
|
public void setSkyLight(int x, int y, int z, int value) {
|
||||||
|
int cx = x >> 4;
|
||||||
|
int cz = z >> 4;
|
||||||
|
if (!ensureChunkLoaded(cx, cz)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ExtendedBlockStorage[] sections = getCachedSections(getWorld(), cx, cz);
|
||||||
|
ExtendedBlockStorage section = sections[y >> 4];
|
||||||
|
if (section == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
section.getSkylightArray().set(x & 15, y & 15, z & 15, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setBlockLight(int x, int y, int z, int value) {
|
||||||
|
int cx = x >> 4;
|
||||||
|
int cz = z >> 4;
|
||||||
|
if (!ensureChunkLoaded(cx, cz)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ExtendedBlockStorage[] sections = getCachedSections(getWorld(), cx, cz);
|
||||||
|
ExtendedBlockStorage section = sections[y >> 4];
|
||||||
|
if (section == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
section.getBlocklightArray().set(x & 15, y & 15, z & 15, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -111,7 +111,12 @@ public class FaweForge implements IFawe {
|
|||||||
if (world instanceof WorldWrapper) {
|
if (world instanceof WorldWrapper) {
|
||||||
world = ((WorldWrapper) world).getParent();
|
world = ((WorldWrapper) world).getParent();
|
||||||
}
|
}
|
||||||
return ((ForgeWorld) world).getWorld().getWorldInfo().getWorldName();
|
return getWorldName(((ForgeWorld) world).getWorld());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getWorldName(net.minecraft.world.World w) {
|
||||||
|
return w.getWorldInfo().getWorldName() + ";" + w.provider.getDimension();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.boydti.fawe.forge;
|
package com.boydti.fawe.forge;
|
||||||
|
|
||||||
|
import com.boydti.fawe.Fawe;
|
||||||
import com.boydti.fawe.config.BBC;
|
import com.boydti.fawe.config.BBC;
|
||||||
import com.boydti.fawe.config.Settings;
|
import com.boydti.fawe.config.Settings;
|
||||||
import com.boydti.fawe.object.FaweLocation;
|
import com.boydti.fawe.object.FaweLocation;
|
||||||
@ -68,7 +69,7 @@ public class ForgePlayer extends FawePlayer<EntityPlayerMP> {
|
|||||||
public FaweLocation getLocation() {
|
public FaweLocation getLocation() {
|
||||||
World world = parent.worldObj;
|
World world = parent.worldObj;
|
||||||
BlockPos pos = parent.getPosition();
|
BlockPos pos = parent.getPosition();
|
||||||
return new FaweLocation(world.getWorldInfo().getWorldName(), pos.getX(), pos.getY(), pos.getZ());
|
return new FaweLocation(Fawe.<FaweForge>imp().getWorldName(world), pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -55,7 +55,7 @@ import net.minecraft.world.chunk.IChunkProvider;
|
|||||||
import net.minecraft.world.chunk.NibbleArray;
|
import net.minecraft.world.chunk.NibbleArray;
|
||||||
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
|
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
|
||||||
import net.minecraft.world.gen.ChunkProviderServer;
|
import net.minecraft.world.gen.ChunkProviderServer;
|
||||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
import net.minecraftforge.common.DimensionManager;
|
||||||
|
|
||||||
public class ForgeQueue_All extends NMSMappedFaweQueue<World, Chunk, ExtendedBlockStorage[], BlockStateContainer> {
|
public class ForgeQueue_All extends NMSMappedFaweQueue<World, Chunk, ExtendedBlockStorage[], BlockStateContainer> {
|
||||||
|
|
||||||
@ -687,12 +687,41 @@ public class ForgeQueue_All extends NMSMappedFaweQueue<World, Chunk, ExtendedBlo
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public World getImpWorld() {
|
public World getImpWorld() {
|
||||||
WorldServer[] worlds = FMLCommonHandler.instance().getMinecraftServerInstance().worldServers;
|
if (nmsWorld != null) {
|
||||||
for (WorldServer ws : worlds) {
|
return nmsWorld;
|
||||||
if (ws.getWorldInfo().getWorldName().equals(getWorldName())) {
|
|
||||||
return nmsWorld = ws;
|
|
||||||
}
|
}
|
||||||
|
String[] split = getWorldName().split(";");
|
||||||
|
int id = Integer.parseInt(split[split.length - 1]);
|
||||||
|
return nmsWorld = DimensionManager.getWorld(id);
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
|
@Override
|
||||||
|
public void setSkyLight(int x, int y, int z, int value) {
|
||||||
|
int cx = x >> 4;
|
||||||
|
int cz = z >> 4;
|
||||||
|
if (!ensureChunkLoaded(cx, cz)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ExtendedBlockStorage[] sections = getCachedSections(getWorld(), cx, cz);
|
||||||
|
ExtendedBlockStorage section = sections[y >> 4];
|
||||||
|
if (section == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
section.getSkylightArray().set(x & 15, y & 15, z & 15, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setBlockLight(int x, int y, int z, int value) {
|
||||||
|
int cx = x >> 4;
|
||||||
|
int cz = z >> 4;
|
||||||
|
if (!ensureChunkLoaded(cx, cz)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ExtendedBlockStorage[] sections = getCachedSections(getWorld(), cx, cz);
|
||||||
|
ExtendedBlockStorage section = sections[y >> 4];
|
||||||
|
if (section == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
section.getBlocklightArray().set(x & 15, y & 15, z & 15, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user