mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-01 02:46:41 +00:00
.
This commit is contained in:
@ -117,7 +117,7 @@ public class BlockArrayClipboard implements Clipboard, LightingExtent, Closeable
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
protected void finalize() {
|
||||
close();
|
||||
}
|
||||
|
||||
@ -196,11 +196,6 @@ public class BlockArrayClipboard implements Clipboard, LightingExtent, Closeable
|
||||
return BlockTypes.AIR.getDefaultState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getLazyBlock(BlockVector3 position) {
|
||||
return getBlock(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBlock getFullBlock(BlockVector3 position) {
|
||||
if(region.contains(position)) {
|
||||
@ -266,8 +261,6 @@ public class BlockArrayClipboard implements Clipboard, LightingExtent, Closeable
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int getLight(int x, int y, int z) {
|
||||
return getBlockLight(x, y, z);
|
||||
@ -285,11 +278,11 @@ public class BlockArrayClipboard implements Clipboard, LightingExtent, Closeable
|
||||
|
||||
@Override
|
||||
public int getOpacity(int x, int y, int z) {
|
||||
return getBlock(BlockVector3.at(x, y, z)).getBlockType().getMaterial().getLightOpacity();
|
||||
return getBlock(x, y, z).getBlockType().getMaterial().getLightOpacity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBrightness(int x, int y, int z) {
|
||||
return getBlock(BlockVector3.at(x, y, z)).getBlockType().getMaterial().getLightValue();
|
||||
return getBlock(x, y, z).getBlockType().getMaterial().getLightValue();
|
||||
}
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ public interface Clipboard extends Extent {
|
||||
|
||||
/**
|
||||
* Returns true if the clipboard has biome data. This can be checked since {@link Extent#getBiome(BlockVector2)}
|
||||
* strongly suggests returning {@link com.sk89q.worldedit.world.biome.BiomeTypes.OCEAN} instead of {@code null}
|
||||
* strongly suggests returning {@link com.sk89q.worldedit.world.biome.BiomeTypes#OCEAN} instead of {@code null}
|
||||
* if biomes aren't present. However, it might not be desired to set areas to ocean if the clipboard is defaulting
|
||||
* to ocean, instead of having biomes explicitly set.
|
||||
*
|
||||
|
@ -22,7 +22,8 @@ package com.sk89q.worldedit.extent.clipboard.io;
|
||||
import com.boydti.fawe.object.io.PGZIPOutputStream;
|
||||
import com.boydti.fawe.object.io.ResettableFileInputStream;
|
||||
import com.boydti.fawe.object.schematic.PNGWriter;
|
||||
import com.boydti.fawe.object.schematic.StructureFormat;
|
||||
import com.boydti.fawe.object.schematic.MinecraftStructure;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.jnbt.NBTInputStream;
|
||||
@ -122,35 +123,41 @@ public enum BuiltInClipboardFormat implements ClipboardFormat {
|
||||
* The structure block format:
|
||||
* http://minecraft.gamepedia.com/Structure_block_file_format
|
||||
*/
|
||||
STRUCTURE("structure", "nbt") {
|
||||
MINECRAFT_STRUCTURE("structure") {
|
||||
@Override
|
||||
public String getPrimaryFileExtension() {
|
||||
return "nbt";
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClipboardReader getReader(InputStream inputStream) throws IOException {
|
||||
inputStream = new BufferedInputStream(inputStream);
|
||||
NBTInputStream nbtStream = new NBTInputStream(new BufferedInputStream(new GZIPInputStream(inputStream)));
|
||||
return new StructureFormat(nbtStream);
|
||||
return new MinecraftStructure(nbtStream);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClipboardWriter getWriter(OutputStream outputStream) throws IOException {
|
||||
outputStream = new BufferedOutputStream(outputStream);
|
||||
OutputStream gzip;
|
||||
if (outputStream instanceof PGZIPOutputStream || outputStream instanceof GZIPOutputStream) {
|
||||
gzip = outputStream;
|
||||
} else {
|
||||
gzip = new PGZIPOutputStream(outputStream);
|
||||
}
|
||||
OutputStream gzip = new PGZIPOutputStream(outputStream);
|
||||
NBTOutputStream nbtStream = new NBTOutputStream(new BufferedOutputStream(gzip));
|
||||
return new StructureFormat(nbtStream);
|
||||
return new MinecraftStructure(nbtStream);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFormat(File file) {
|
||||
return file.getName().toLowerCase().endsWith(".nbt");
|
||||
}
|
||||
try (NBTInputStream str = new NBTInputStream(new GZIPInputStream(new FileInputStream(file)))) {
|
||||
NamedTag rootTag = str.readNamedTag();
|
||||
CompoundTag structureTag = (CompoundTag) rootTag.getTag();
|
||||
Map<String, Tag> structure = structureTag.getValue();
|
||||
if (!structure.containsKey("DataVersion")) {
|
||||
return false;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPrimaryFileExtension() {
|
||||
return "nbt";
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -70,7 +70,7 @@ public class ClipboardFormats {
|
||||
checkNotNull(format);
|
||||
|
||||
for (String key : format.getAliases()) {
|
||||
String lowKey = key.toLowerCase(Locale.ENGLISH);
|
||||
String lowKey = key.toLowerCase(Locale.ROOT);
|
||||
ClipboardFormat old = aliasMap.put(lowKey, format);
|
||||
if (old != null) {
|
||||
aliasMap.put(lowKey, old);
|
||||
@ -78,7 +78,7 @@ public class ClipboardFormats {
|
||||
}
|
||||
}
|
||||
for (String ext : format.getFileExtensions()) {
|
||||
String lowExt = ext.toLowerCase(Locale.ENGLISH);
|
||||
String lowExt = ext.toLowerCase(Locale.ROOT);
|
||||
fileExtensionMap.put(lowExt, format);
|
||||
}
|
||||
registeredFormats.add(format);
|
||||
@ -100,7 +100,7 @@ public class ClipboardFormats {
|
||||
@Nullable
|
||||
public static ClipboardFormat findByAlias(String alias) {
|
||||
checkNotNull(alias);
|
||||
return aliasMap.get(alias.toLowerCase(Locale.ENGLISH).trim());
|
||||
return aliasMap.get(alias.toLowerCase(Locale.ROOT).trim());
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user