3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-12-24 18:10:08 +01:00

Add data version to BukkitImplAdapter.

Also throttle unknown-block warning when loading MCEdit schematics.
Dieser Commit ist enthalten in:
wizjany 2019-04-25 18:58:06 -04:00 committet von Matthew Miller
Ursprung f0587354be
Commit 31a8328fb5
11 geänderte Dateien mit 21 neuen und 7 gelöschten Zeilen

Datei anzeigen

@ -67,8 +67,10 @@ public class BukkitServerInterface implements MultiUserPlatform {
@Override
public int getDataVersion() {
// TODO - add to adapter - CraftMagicNumbers#getDataVersion
return 1631;
if (plugin.getBukkitImplAdapter() != null) {
return plugin.getBukkitImplAdapter().getDataVersion();
}
return 0;
}
@Override

Datei anzeigen

@ -40,6 +40,13 @@ import javax.annotation.Nullable;
*/
public interface BukkitImplAdapter {
/**
* Get the Minecraft data version for the current world data.
*
* @return the data version
*/
int getDataVersion();
/**
* Get the block at the given location.
*

Datei anzeigen

@ -53,10 +53,11 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import static com.google.common.base.Preconditions.checkNotNull;
@ -213,6 +214,7 @@ public class MCEditSchematicReader extends NBTSchematicReader {
clipboard.setOrigin(origin);
Set<Integer> unknownBlocks = new HashSet<>();
for (int x = 0; x < width; ++x) {
for (int y = 0; y < height; ++y) {
for (int z = 0; z < length; ++z) {
@ -230,9 +232,13 @@ public class MCEditSchematicReader extends NBTSchematicReader {
} else {
clipboard.setBlock(region.getMinimumPoint().add(pt), state);
}
} else {
if (!useOverride) {
log.warn("Unknown block when pasting schematic: " + blocks[index] + ":" + blockData[index] + ". Please report this issue.");
} else if (!useOverride) {
short block = blocks[index];
byte data = blockData[index];
int combined = block << 8 | data;
if (unknownBlocks.add(combined)) {
log.warn("Unknown block when pasting schematic: "
+ block + ":" + data + ". Please report this issue.");
}
}
} catch (WorldEditException ignored) { // BlockArrayClipboard won't throw this
@ -316,7 +322,6 @@ public class MCEditSchematicReader extends NBTSchematicReader {
case "PigZombie": return "zombie_pigman";
default: return id;
}
return id;
}
private String convertBlockEntityId(String id) {