This commit is contained in:
Jesse Boyd 2018-01-17 11:57:01 +11:00
parent bcbf307e8d
commit 1186a00b47
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
4 changed files with 24 additions and 12 deletions

1
.gitignore vendored
View File

@ -20,6 +20,7 @@ gradle.log
/forge1710/build /forge1710/build
/sponge/build /sponge/build
/sponge111/build /sponge111/build
/bukkit/out
/nukkit/out /nukkit/out
/sponge112/build /sponge112/build
/core/out /core/out

View File

@ -1,5 +1,6 @@
package com.boydti.fawe.bukkit.wrapper.state; package com.boydti.fawe.bukkit.wrapper.state;
import com.boydti.fawe.bukkit.chat.FancyMessage;
import com.boydti.fawe.bukkit.wrapper.AsyncBlock; import com.boydti.fawe.bukkit.wrapper.AsyncBlock;
import com.boydti.fawe.bukkit.wrapper.AsyncBlockState; import com.boydti.fawe.bukkit.wrapper.AsyncBlockState;
import com.boydti.fawe.util.ReflectionUtils; import com.boydti.fawe.util.ReflectionUtils;
@ -20,16 +21,26 @@ public class AsyncSign extends AsyncBlockState implements Sign {
String[] data = new String[4]; String[] data = new String[4];
if (nbt != null) { if (nbt != null) {
for (int i = 1; i <= 4; i++) { for (int i = 1; i <= 4; i++) {
data[i - 1] = nbt.getString("Text" + i); data[i - 1] = fromJson(nbt.getString("Text" + i));
} }
} }
return data; return data;
} }
private String fromJson(String jsonInput) {
if (jsonInput == null) return "";
return FancyMessage.deserialize(jsonInput).toOldMessageFormat();
}
private String toJson(String oldInput) {
if (oldInput == null || oldInput.isEmpty()) return "";
return new FancyMessage("").color(oldInput).toJSONString();
}
@Override @Override
public String getLine(int index) throws IndexOutOfBoundsException { public String getLine(int index) throws IndexOutOfBoundsException {
CompoundTag nbt = getNbtData(); CompoundTag nbt = getNbtData();
return nbt == null ? null : nbt.getString("Text" + (index + 1)); return nbt == null ? null : fromJson(nbt.getString("Text" + (index + 1)));
} }
@Override @Override
@ -37,7 +48,7 @@ public class AsyncSign extends AsyncBlockState implements Sign {
CompoundTag nbt = getNbtData(); CompoundTag nbt = getNbtData();
if (nbt != null) { if (nbt != null) {
Map<String, Tag> map = ReflectionUtils.getMap(nbt.getValue()); Map<String, Tag> map = ReflectionUtils.getMap(nbt.getValue());
map.put("Text" + (index + 1), new StringTag(line)); map.put("Text" + (index + 1), new StringTag(toJson(line)));
} }
} }
} }

View File

@ -6,7 +6,7 @@ import com.boydti.fawe.object.FaweChunk;
import com.boydti.fawe.object.FaweQueue; import com.boydti.fawe.object.FaweQueue;
import com.boydti.fawe.object.IntegerTrio; import com.boydti.fawe.object.IntegerTrio;
import com.boydti.fawe.object.RunnableVal; import com.boydti.fawe.object.RunnableVal;
import com.boydti.fawe.object.collection.LocalBlockVector2DSet; import com.boydti.fawe.object.collection.BlockVectorSet;
import com.boydti.fawe.util.MathMan; import com.boydti.fawe.util.MathMan;
import com.boydti.fawe.util.TaskManager; import com.boydti.fawe.util.TaskManager;
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
@ -390,18 +390,18 @@ public class NMSRelighter implements Relighter {
private void fixSkyLighting(List<RelightSkyEntry> sorted) { private void fixSkyLighting(List<RelightSkyEntry> sorted) {
RelightSkyEntry[] chunks = sorted.toArray(new RelightSkyEntry[sorted.size()]); RelightSkyEntry[] chunks = sorted.toArray(new RelightSkyEntry[sorted.size()]);
boolean remove = this.removeFirst; boolean remove = this.removeFirst;
LocalBlockVector2DSet chunkSet = null; BlockVectorSet chunkSet = null;
if (remove) { if (remove) {
chunkSet = new LocalBlockVector2DSet(); chunkSet = new BlockVectorSet();
LocalBlockVector2DSet tmpSet = new LocalBlockVector2DSet(); BlockVectorSet tmpSet = new BlockVectorSet();
for (RelightSkyEntry chunk : chunks) { for (RelightSkyEntry chunk : chunks) {
chunkSet.add(chunk.x, chunk.z); tmpSet.add(chunk.x, 0, chunk.z);
} }
for (RelightSkyEntry chunk : chunks) { for (RelightSkyEntry chunk : chunks) {
int x = chunk.x; int x = chunk.x;
int z = chunk.z; int z = chunk.z;
if (tmpSet.contains(x + 1, z) && tmpSet.contains(x - 1, z) && tmpSet.contains(x, z + 1) && tmpSet.contains(x, z - 1)) { if (tmpSet.contains(x + 1, 0, z) && tmpSet.contains(x - 1, 0, z) && tmpSet.contains(x, 0, z + 1) && tmpSet.contains(x, 0, z - 1)) {
chunkSet.add(x, z); chunkSet.add(x, 0, z);
} }
} }
} }
@ -427,7 +427,7 @@ public class NMSRelighter implements Relighter {
if (section == null) continue; if (section == null) continue;
chunk.smooth = false; chunk.smooth = false;
if (remove && (y & 15) == 15 && chunkSet.contains(chunk.x, chunk.z)) { if (remove && (y & 15) == 15 && chunkSet.contains(chunk.x, 0, chunk.z)) {
queue.removeSectionLighting(section, y >> 4, true); queue.removeSectionLighting(section, y >> 4, true);
} }

View File

@ -30,7 +30,7 @@ public class FastWorldEditExtent extends AbstractDelegateExtent implements HasFa
private final int maxY; private final int maxY;
public FastWorldEditExtent(final World world, FaweQueue queue) { public FastWorldEditExtent(final World world, FaweQueue queue) {
super(world); super(queue);
this.queue = queue; this.queue = queue;
this.maxY = world.getMaxY(); this.maxY = world.getMaxY();
} }