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 @Override
public int getDataVersion() { public int getDataVersion() {
// TODO - add to adapter - CraftMagicNumbers#getDataVersion if (plugin.getBukkitImplAdapter() != null) {
return 1631; return plugin.getBukkitImplAdapter().getDataVersion();
}
return 0;
} }
@Override @Override

Datei anzeigen

@ -40,6 +40,13 @@ import javax.annotation.Nullable;
*/ */
public interface BukkitImplAdapter { 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. * Get the block at the given location.
* *

Datei anzeigen

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