Various minor

Fixes #620
Fixes VS pattern region restrictions
Fix some bukkit 1.7.10 issues
tweak debugpaste formatting
This commit is contained in:
Jesse Boyd 2017-07-11 22:37:41 +10:00
parent a79003f2a3
commit 65c6702d94
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
9 changed files with 139 additions and 36 deletions

View File

@ -1,21 +1,19 @@
# Bug report template
<!--- In order to create a valid issue report you have to follow this template. -->
<!--- You may remove it if you are posting a feature request. -->
# Bug report
<!--- Follow this template if reporting an issue. -->
<!--- Remove this template if making a suggestion or asking a question. -->
<!--- Please comment or react to an existing ticket if it exists -->
**Debug paste link**:
<!--- Enter /fawe debugpaste in game or in your console and copy the output here -->
**Description of the problem:**
<!--- Include relevant info like errors or a picture of the problem -->
**How to replicate**:
<!--- If you can reproduce the issue please tell us as detailed as possible step by step how to do that -->
**Checklist**:
<!-- Make sure you've completed the following steps (put an "X" between of brackets): -->
<!--- Make sure you've completed the following steps (put an "X" between of brackets): -->
- [] I included a `/fawe debugpaste` link
- [] I made sure there aren't duplicates of this report [(Use Search)](https://github.com/boy0001/FastAsyncWorldedit/issues?utf8=%E2%9C%93&q=is%3Aissue)
- [] I made sure I am using an up-to-date version of FAWE
- [] I Made sure the bug/error is not caused by any other plugin
- [] I Made sure the bug/error is not caused by any other plugin

View File

@ -29,7 +29,6 @@ import com.boydti.fawe.object.FaweQueue;
import com.boydti.fawe.regions.FaweMaskManager;
import com.boydti.fawe.util.MainUtil;
import com.boydti.fawe.util.ReflectionUtils;
import com.boydti.fawe.util.StringMan;
import com.boydti.fawe.util.TaskManager;
import com.sk89q.worldedit.bukkit.BukkitWorld;
import com.sk89q.worldedit.bukkit.EditSessionBlockChangeDelegate;
@ -183,11 +182,11 @@ public class FaweBukkit implements IFawe, Listener {
public String getDebugInfo() {
StringBuilder msg = new StringBuilder();
List<String> pl = new ArrayList<>();
msg.append("server.plugins: \n");
for (Plugin p : Bukkit.getPluginManager().getPlugins()) {
pl.add(p.getName());
msg.append(" - " + p.getName() + ": " + p.getDescription().getVersion() + "\n");
}
msg.append("server.plugins: \n - " + StringMan.join(pl, " - ") + "\n");
msg.append("server.version: " + Bukkit.getVersion() + " / " + Bukkit.getBukkitVersion());
msg.append("server.version: " + Bukkit.getVersion() + " / " + Bukkit.getBukkitVersion() + "\n");
return msg.toString();
}

View File

@ -13,6 +13,7 @@ import com.sk89q.jnbt.StringTag;
import com.sk89q.jnbt.Tag;
import com.sk89q.worldedit.internal.Constants;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
@ -305,8 +306,10 @@ public class BukkitChunk_1_7 extends CharFaweChunk<Chunk, BukkitQueue17> {
continue;
}
sections[j] = section = new ChunkSection(j << 4, flag);
section.setIdArray(null);
section.setIdArray(newIdArray);
getParent().setCount(0, count - this.getAir(j), section);
section.setDataArray(null);
if (newDataArray != null) {
section.setDataArray(newDataArray);
}
@ -317,26 +320,73 @@ public class BukkitChunk_1_7 extends CharFaweChunk<Chunk, BukkitQueue17> {
sections[j] = null;
continue;
}
section.setIdArray(null);
section.setIdArray(newIdArray);
getParent().setCount(0, count - this.getAir(j), section);
section.setDataArray(null);
if (newDataArray != null) {
section.setDataArray(newDataArray);
}
continue;
}
char[] charArray = this.getIdArray(j);
byte[] currentIdArray = (byte[]) BukkitQueue17.fieldIds.get(section);
NibbleArray currentDataArray = (NibbleArray) BukkitQueue17.fieldData.get(section);
boolean data = currentDataArray != null && newDataArray != null;
if (currentDataArray == null && newDataArray != null) {
section.setDataArray(newDataArray);
if (currentDataArray == null) {
byte compactData = (byte) section.getData(0, 0, 0);
if (compactData != 0 && newDataArray == null) {
newDataArray = new NibbleArray(new byte[2048], 4);
byte full = (byte) ((compactData << 4) + compactData);
Arrays.fill(newDataArray.a, full);
for (int i = 0; i < newDataArray.a.length; i++) {
int i2 = i << 1;
int i3 = i2 + 1;
byte val = newDataArray.a[i];
if (FaweCache.hasData(charArray[i3] >> 4)) {
newDataArray.a[i] = (byte) (val & 15);
}
if (FaweCache.hasData(charArray[i2] >> 4)) {
newDataArray.a[i] = (byte) (val & 240);
}
}
}
else if (newDataArray != null) {
if (compactData != 0) {
byte full = (byte) ((compactData << 4) + compactData);
for (int i = 0; i < newDataArray.a.length; i++) {
int i2 = i << 1;
int i3 = i2 + 1;
byte val = newDataArray.a[i];
if (charArray[i3] != 0) {
if (charArray[i2] != 0) continue;
newDataArray.a[i] = (byte) (val & 240 | compactData);
continue;
}
if (charArray[i2] != 0) {
if (charArray[i3] != 0) continue;
newDataArray.a[i] = (byte) (val & 15 | (compactData) << 4);
continue;
}
newDataArray.a[i] = full;
}
}
section.setDataArray(null);
section.setDataArray(newDataArray);
}
}
if (currentIdArray == null) {
section.setIdArray(newIdArray);
getParent().setCount(0, count - this.getAir(j), section);
continue;
if (currentIdArray == null && newIdArray != null) {
int id = (int) BukkitQueue17.fieldCompactId.get(section);
if (id == 0) {
section.setIdArray(null);
section.setIdArray(newIdArray);
getParent().setCount(0, count - this.getAir(j), section);
continue;
} else {
currentIdArray = section.getIdArray();
}
}
int nonEmptyBlockCount = 0;
char[] charArray = this.getIdArray(j);
for (int k = 0; k < newIdArray.length; k++) {
char combined = charArray[k];
switch (combined) {
@ -360,11 +410,11 @@ public class BukkitChunk_1_7 extends CharFaweChunk<Chunk, BukkitQueue17> {
currentIdArray[k] = newIdArray[k];
if (data) {
int dataByte = FaweCache.getData(combined);
int x = FaweCache.CACHE_X[0][k];
int y = FaweCache.CACHE_Y[0][k];
int z = FaweCache.CACHE_Z[0][k];
int newData = newDataArray.a(x, y, z);
currentDataArray.a(x, y, z, newData);
if ((k & 1) == 0) {
currentDataArray.a[k] = (byte) (currentDataArray.a[k] & 240 | dataByte);
} else {
currentDataArray.a[k] = (byte) (currentDataArray.a[k] & 15 | (dataByte) << 4);
}
}
continue;
}

View File

@ -69,6 +69,7 @@ public class BukkitQueue17 extends BukkitQueue_0<net.minecraft.server.v1_7_R4.Ch
protected static Field fieldData;
protected static Field fieldIds;
protected static Field fieldCompactId;
protected static Field fieldTickingBlockCount;
protected static Field fieldNonEmptyBlockCount;
protected static Field fieldBiomes;
@ -88,6 +89,8 @@ public class BukkitQueue17 extends BukkitQueue_0<net.minecraft.server.v1_7_R4.Ch
fieldData.setAccessible(true);
fieldIds = ChunkSection.class.getDeclaredField("blockIds");
fieldIds.setAccessible(true);
fieldCompactId = ChunkSection.class.getDeclaredField("compactId");
fieldCompactId.setAccessible(true);
fieldTickingBlockCount = ChunkSection.class.getDeclaredField("tickingBlockCount");
fieldNonEmptyBlockCount = ChunkSection.class.getDeclaredField("nonEmptyBlockCount");
fieldTickingBlockCount.setAccessible(true);
@ -397,7 +400,7 @@ public class BukkitQueue17 extends BukkitQueue_0<net.minecraft.server.v1_7_R4.Ch
@Override
public CompoundTag getTileEntity(net.minecraft.server.v1_7_R4.Chunk chunk, int x, int y, int z) {
Map<ChunkPosition, TileEntity> tiles = chunk.tileEntities;
ChunkPosition pos = new ChunkPosition(x, y, z);
ChunkPosition pos = new ChunkPosition(x & 15, y, z & 15);
TileEntity tile = tiles.get(pos);
return tile != null ? getTag(tile) : null;
}

View File

@ -39,6 +39,14 @@ public class MaskedFaweQueue extends DelegateFaweQueue {
return false;
}
@Override
public boolean setBlock(int x, int y, int z, int id, int data, CompoundTag nbt) {
if (WEManager.IMP.maskContains(mask, x, z)) {
return super.setBlock(x, y, z, id, data, nbt);
}
return false;
}
@Override
public boolean setBiome(int x, int z, BaseBiome biome) {
if (WEManager.IMP.maskContains(mask, x, z)) {

View File

@ -297,7 +297,7 @@ public class SchematicCommands {
player.printError("Deletion of " + filename + " failed! Maybe it is read-only.");
return;
}
BBC.SCHEMATIC_DELETE.send(player, filename);
BBC.FILE_DELETED.send(player, filename);
}
@Command(aliases = {"formats", "listformats", "f"}, desc = "List available formats", max = 0)

View File

@ -198,7 +198,8 @@ public class BlockTransformExtent extends ResettableExtent {
return changedBlock;
}
for (State state : states.values()) {
for (Map.Entry<String, ? extends State> entry : states.entrySet()) {
State state = entry.getValue();
if (state.hasDirection()) {
StateValue value = state.getValue(block);
if (value != null && value.getDirection() != null) {
@ -231,7 +232,8 @@ public class BlockTransformExtent extends ResettableExtent {
double closest = -2;
boolean found = false;
for (StateValue v : state.valueMap().values()) {
for (Map.Entry<String, ? extends StateValue> entry : state.valueMap().entrySet()) {
StateValue v = entry.getValue();
if (v.getDirection() != null) {
double dot = v.getDirection().normalize().dot(newDirection);
if (dot >= closest) {

View File

@ -33,6 +33,9 @@ import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.blocks.BlockMaterial;
import com.sk89q.worldedit.extent.transform.BlockTransformExtent;
import com.sk89q.worldedit.math.transform.AffineTransform;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Type;
import java.net.URL;
@ -168,15 +171,37 @@ public class BundledBlockData {
return true;
}
for (Map.Entry<String, FaweState> stateEntry : entry.states.entrySet()) {
for (Map.Entry<String, FaweStateValue> valueEntry : stateEntry.getValue().valueMap().entrySet()) {
FaweState faweState = stateEntry.getValue();
for (Map.Entry<String, FaweStateValue> valueEntry : faweState.valueMap().entrySet()) {
String key = valueEntry.getKey();
FaweStateValue faweStateValue = valueEntry.getValue();
if (key.equals("true")) {
key = stateEntry.getKey();
}
stateMap.put(entry.id + ":" + key, FaweCache.getBlock(entry.legacyId, valueEntry.getValue().data));
stateMap.put(id + ":" + key, FaweCache.getBlock(entry.legacyId, valueEntry.getValue().data));
stateMap.putIfAbsent(modId + ":" + key, FaweCache.getBlock(entry.legacyId, valueEntry.getValue().data));
stateMap.putIfAbsent(key, FaweCache.getBlock(entry.legacyId, valueEntry.getValue().data));
stateMap.put(entry.id + ":" + key, FaweCache.getBlock(entry.legacyId, faweStateValue.data));
stateMap.put(id + ":" + key, FaweCache.getBlock(entry.legacyId, faweStateValue.data));
stateMap.putIfAbsent(modId + ":" + key, FaweCache.getBlock(entry.legacyId, faweStateValue.data));
stateMap.putIfAbsent(key, FaweCache.getBlock(entry.legacyId, faweStateValue.data));
}
}
if (!entry.states.isEmpty()) { // Fix vine direction 2
String[] states = new String[] {"north", "east", "south", "west", "up", "down"};
Vector[] dirs = new Vector[] {
new Vector(0, 0, -1),
new Vector(1, 0, 0),
new Vector(0, 0, 1),
new Vector(-1, 0, 0),
new Vector(0, 1, 0),
new Vector(0, -1, 0),
};
for (int i = 0; i < states.length; i++) {
FaweState state = entry.states.get(states[i]);
if (state != null && !state.hasDirection()) {
FaweStateValue active = state.valueMap().get("true");
if (active != null) {
entry.fixDirection(dirs[i], states[i], null, active.data);
}
}
}
}
FaweState half = entry.states.get("half");
@ -370,8 +395,27 @@ public class BundledBlockData {
state.postDeserialization();
}
}
protected void fixDirection(Vector direction, String key, Byte mask, int data) {
FaweState state = states.remove(key);
if (state != null && !state.hasDirection()) {
FaweState facing = states.get("facing");
if (facing == null) {
facing = BundledBlockData.getInstance().new FaweState();
facing.values = new HashMap<>();
states.put("facing", facing);
}
if (mask != null) facing.dataMask = (byte) (facing.getDataMask() | mask);
FaweStateValue value = BundledBlockData.getInstance().new FaweStateValue();
value.state = facing;
value.data = (byte) data;
value.direction = direction;
facing.values.put(key, value);
}
}
}
public static Class<?> inject() {
return BundledBlockData.class;
}
@ -414,7 +458,7 @@ public class BundledBlockData {
@Override
public boolean isSet(BaseBlock block) {
return data != null && (block.getData() & state.getDataMask()) == data;
return data != null && ((state.dataMask == null && block.getData() == data) || (block.getData() & state.getDataMask()) == data);
}
@Override

View File

@ -35,7 +35,6 @@ public class Favs extends JavaPlugin {
String name = file.getName().toLowerCase();
if (name.endsWith(".jar") && name.contains("voxelsniper") && !name.contains("fastasyncvoxelsniper")) {
output = file;
System.out.println("File " + file + " | " + thisName);
break;
}
}