public final class JavaPlatformProvider extends AbstractPlatformProvider implements BlockBasedPlatformProvider, MapExplorerSupport, MapImporterProvider
Created by Pepijn on 9-3-2017.
PlatformProvider.MapInfo
Modifier and Type | Field and Description |
---|---|
static javax.swing.Icon |
ICON |
PROPERTY_MINIMUM_WORLDPAINTER_VERSION, PROPERTY_NAME, PROPERTY_UUIDS, PROPERTY_VERSION
Constructor and Description |
---|
JavaPlatformProvider() |
Modifier and Type | Method and Description |
---|---|
Chunk |
createChunk(Platform platform,
int x,
int z,
int minHeight,
int maxHeight)
Create a new, empty chunk for a platform supported by this provider.
|
NBTChunk |
createChunk(Platform platform,
java.util.Map<DataType,org.jnbt.Tag> tags,
int minHeight,
int maxHeight) |
NBTChunk |
createChunk(Platform platform,
java.util.Map<DataType,org.jnbt.Tag> tags,
int minHeight,
int maxHeight,
boolean readOnly) |
JavaChunkStore |
getChunkStore(Platform platform,
java.io.File worldDir,
int dimension)
Obtain a
ChunkStore which will save chunks in the format of the
platform, for a platform supported by this provider and for a specific
map base directory and dimension number. |
java.util.Set<DataType> |
getDataTypes(Platform platform) |
java.io.File |
getDefaultExportDir(Platform platform)
Get the default directory to select on the Export screen for a
platform supported by this provider.
|
ExportSettings |
getDefaultExportSettings(Platform platform)
Get the default
ExportSettings for a supported platform, or null if the platform has no export
settings. |
int[] |
getDimensions(Platform platform,
java.io.File worldDir)
Determine which dimensions are present in the map specified by a
particular
Platform and directory. |
WorldExporter |
getExporter(World2 world,
WorldExportSettings exportSettings)
Obtain a
WorldExporter for the platform currently configured in
the specified world. |
ExportSettingsEditor |
getExportSettingsEditor(Platform platform)
Get an instance of an
ExportSettingsEditor suitable for editing an ExportSettings object as
returned by PlatformProvider.getDefaultExportSettings(Platform) . |
MapImporter |
getImporter(java.io.File dir,
TileFactory tileFactory,
java.util.Set<MinecraftCoords> chunksToSkip,
MapImporter.ReadOnlyOption readOnlyOption,
java.util.Set<java.lang.Integer> dimensionsToImport)
Get a
MapImporter configured for the specified map and settings. |
Node |
getMapNode(java.io.File mapDir) |
PostProcessor |
getPostProcessor(Platform platform)
Obtain a
PostProcessor for a platform supported by this provider. |
RegionFile |
getRegionFile(Platform platform,
java.io.File regionDir,
DataType dataType,
java.awt.Point coords,
boolean readOnly)
Get a region file.
|
RegionFile |
getRegionFileIfExists(Platform platform,
java.io.File regionDir,
DataType dataType,
java.awt.Point coords,
boolean readOnly)
Get a region file, if it exists.
|
java.io.File[] |
getRegionFiles(Platform platform,
java.io.File regionDir,
DataType dataType) |
PlatformProvider.MapInfo |
identifyMap(java.io.File dir)
Identify the map in the specified directory, if it is a map supported by the plugin to which this provider
belongs, and provide some identifying information if so.
|
java.lang.String |
isCompatible(Platform platform,
World2 world)
Determines whether a world could be retargeted to a platform supported by this provider without requiring any
changes or edits.
|
java.io.File |
selectBackupDir(java.io.File exportDir)
Indicate into which directory the existing map, if any, would be backed up if it were being exported into
exportDir , but do not create it if it does not exist. |
ensurePlatformSupported, getKeys
getName, getProperties, getUUIDs, getVersion
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getMapRecognizer
getMinimumWorldPainterVersion, getName, getProperties, getUUIDs, getVersion, init
public NBTChunk createChunk(Platform platform, java.util.Map<DataType,org.jnbt.Tag> tags, int minHeight, int maxHeight)
public NBTChunk createChunk(Platform platform, java.util.Map<DataType,org.jnbt.Tag> tags, int minHeight, int maxHeight, boolean readOnly)
public java.io.File[] getRegionFiles(Platform platform, java.io.File regionDir, DataType dataType)
public RegionFile getRegionFile(Platform platform, java.io.File regionDir, DataType dataType, java.awt.Point coords, boolean readOnly) throws java.io.IOException
readOnly
is false, a region file will be created if it does not exist. Otherwise,
null
will be returned if the region file does not exist.java.io.IOException
public RegionFile getRegionFileIfExists(Platform platform, java.io.File regionDir, DataType dataType, java.awt.Point coords, boolean readOnly) throws java.io.IOException
null
will be returned.java.io.IOException
public int[] getDimensions(Platform platform, java.io.File worldDir)
BlockBasedPlatformProvider
Platform
and directory.getDimensions
in interface BlockBasedPlatformProvider
platform
- The platform for which to determine the dimensions.worldDir
- The map base directory for which to determine the
dimensions.Constants.DIM_NORMAL
, Constants.DIM_NETHER
and
Constants.DIM_END
for dimensions which correspond to vanilla
Minecraft dimensions.public Chunk createChunk(Platform platform, int x, int z, int minHeight, int maxHeight)
BlockBasedPlatformProvider
The default implementation delegates to #createChunk(Platform, int, int, int)
if minHeight
is
zero, or throws an IllegalArgumentException
otherwise.
Implementations MUST implement at least on of BlockBasedPlatformProvider.createChunk(Platform, int, int, int, int)
or
#createChunk(Platform, int, int, int)
.
createChunk
in interface BlockBasedPlatformProvider
platform
- The platform for which to create a chunk.x
- The X coordinate (in chunks) of the chunk to create.z
- The Z coordinate (in chunks) of the chunk to create.minHeight
- The depth (in blocks) ot the chunk to create.maxHeight
- The height (in blocks) of the chunk to create.public JavaChunkStore getChunkStore(Platform platform, java.io.File worldDir, int dimension)
BlockBasedPlatformProvider
ChunkStore
which will save chunks in the format of the
platform, for a platform supported by this provider and for a specific
map base directory and dimension number.getChunkStore
in interface BlockBasedPlatformProvider
platform
- The platform for which to provide a chunk store.worldDir
- The map base directory for which to provide a chunk
store.dimension
- The dimension number for which to provide a chunk store.public PostProcessor getPostProcessor(Platform platform)
BlockBasedPlatformProvider
PostProcessor
for a platform supported by this provider.getPostProcessor
in interface BlockBasedPlatformProvider
platform
- The platform for which to provide a post processor.public WorldExporter getExporter(World2 world, WorldExportSettings exportSettings)
PlatformProvider
WorldExporter
for the platform currently configured in
the specified world.getExporter
in interface PlatformProvider
world
- The world to export.exportSettings
- The export settings to use for this export. If this is null
then the export
settings stored on the world
object will be used, if any.public java.io.File getDefaultExportDir(Platform platform)
PlatformProvider
getDefaultExportDir
in interface PlatformProvider
platform
- The platform for which to provide the default export
directory.public java.io.File selectBackupDir(java.io.File exportDir)
PlatformProvider
exportDir
, but do not create it if it does not exist.selectBackupDir
in interface PlatformProvider
exportDir
- The directory into which the world would be going to be exported.null
if
this is not supported or it cannot be determined.public PlatformProvider.MapInfo identifyMap(java.io.File dir)
PlatformProvider
The default implementation returns null
. This will make it harder to select maps of the type(s)
supported by this platform provider for users when they wish to Import a map. If the platform provider does not
support Importing this is not relevant.
identifyMap
in interface PlatformProvider
dir
- The directory to identify.null
if it was
not recognised.public Node getMapNode(java.io.File mapDir)
getMapNode
in interface MapExplorerSupport
public MapImporter getImporter(java.io.File dir, TileFactory tileFactory, java.util.Set<MinecraftCoords> chunksToSkip, MapImporter.ReadOnlyOption readOnlyOption, java.util.Set<java.lang.Integer> dimensionsToImport)
MapImporterProvider
MapImporter
configured for the specified map and settings.getImporter
in interface MapImporterProvider
dir
- The directory of the map to import.tileFactory
- The TileFactory
to use, optionally, for creating the tiles into which the map will be imported.chunksToSkip
- A set of coordinates of chunks to skip. The importer should act as if these chunks do not exist in the map.readOnlyOption
- Whether and how to apply the ReadOnly
layer to the imported world.dimensionsToImport
- The set of dimensions (specified as a set of Constants.DIM_NORMAL
, Constants.DIM_NETHER
and/or Constants.DIM_END
) to import.public ExportSettings getDefaultExportSettings(Platform platform)
PlatformProvider
ExportSettings
for a supported platform, or null
if the platform has no export
settings.
The default implementation returns null
.
getDefaultExportSettings
in interface PlatformProvider
platform
- The platform for which to provide the default export settings.ExportSettings
for the specified platform, or null
if the platform has no
export settings.public ExportSettingsEditor getExportSettingsEditor(Platform platform)
PlatformProvider
ExportSettingsEditor
suitable for editing an ExportSettings
object as
returned by PlatformProvider.getDefaultExportSettings(Platform)
. Will only be invoked if
PlatformProvider.getDefaultExportSettings(Platform)
does not return null
.
The default implementation throws an UnsupportedOperationException
.
getExportSettingsEditor
in interface PlatformProvider
platform
- The platform for which to provide the export settings editor.ExportSettingsEditor
.public java.lang.String isCompatible(Platform platform, World2 world)
PlatformProvider
The default implementation just returns platform.isCompatible(world)
.
isCompatible
in interface PlatformProvider
platform
- The platform with which to check compatibility.world
- The world to check for compatibility.null
if the world could be trivially retargeted to the specified platform, or a short description
of the reason if it cannot.