public abstract class RODelegatingDimension<T extends Tile> extends Dimension
Dimension
which wraps another
Dimension
and delegates all read calls to it. All write calls throw
an UnsupportedOperationException
.
In addition the methods which return tiles wrap the returned tiles in
RODelegatingTile
s.
Intended to change the behaviour of one or more read calls by overriding them.
Dimension.Anchor, Dimension.Border, Dimension.LayerAnchor, Dimension.Listener, Dimension.Role, Dimension.TileVisitationBuilder, Dimension.TileVisitor, Dimension.WallType
InstanceKeeper.InstantiationListener<T>
Modifier and Type | Field and Description |
---|---|
protected Dimension |
dimension |
protected java.util.Map<java.awt.Point,java.lang.ref.Reference<T>> |
tileCache |
POSSIBLE_AUTO_BIOMES
Constructor and Description |
---|
RODelegatingDimension(Dimension dimension) |
Modifier and Type | Method and Description |
---|---|
void |
addDimensionListener(Dimension.Listener listener) |
int |
addOverlay(Overlay overlay) |
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener) |
void |
addPropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener) |
void |
addTile(Tile tile) |
void |
allBitLayerDataChanged(Tile tile) |
void |
allNonBitlayerDataChanged(Tile tile) |
void |
applyTheme(int x,
int y) |
void |
applyTheme(java.awt.Point coords) |
void |
armSavePoint() |
void |
changed()
Update the change number; for use when some aspect of a dimension changes
which the
Dimension class itself does not track. |
void |
clearLayerData(Layer layer) |
void |
clearRedo() |
void |
clearUndo() |
boolean |
containsOneOf(Layer... layers) |
protected Tile |
doGetTile(java.awt.Point coords) |
java.util.Set<Layer> |
getAllLayers(boolean applyCombinedLayers)
Returns the set of all layers currently in use on the world, optionally
including layers that are included in combined layers.
|
java.util.Map<Layer,ExporterSettings> |
getAllLayerSettings() |
java.util.Set<Terrain> |
getAllTerrains() |
Dimension.Anchor |
getAnchor() |
boolean |
getBitLayerValueAt(Layer layer,
int x,
int y) |
Dimension.Border |
getBorder() |
int |
getBorderLevel() |
int |
getBorderSize() |
long |
getChangeNo()
Get the change number.
|
int |
getContourSeparation() |
java.util.List<CustomBiome> |
getCustomBiomes() |
float |
getDistanceToEdge(Layer layer,
int x,
int y,
float maxDistance)
Get the distance from the specified coordinate to the nearest pixel where
the specified layer is not set.
|
int |
getFloodedCount(int x,
int y,
int r,
boolean lava)
Count the number of blocks that are flooded in a square around a
particular location
|
Garden |
getGarden() |
int |
getGridSize() |
int |
getHeight() |
float |
getHeightAt(int x,
int y)
Get the terrain height at the specified coordinates, if a tile exists in the specified location.
|
float |
getHeightAt(java.awt.Point coords)
Get the terrain height at the specified coordinates, if a tile exists in the specified location.
|
int |
getHighestX() |
int |
getHighestY() |
int |
getIntHeightAt(int x,
int y)
Get the terrain height at the specified coordinates, rounded to the nearest integer, if a tile exists in the
specified location.
|
int |
getIntHeightAt(int x,
int y,
int defaultValue)
Get the terrain height at the specified coordinates, rounded to the nearest integer, if a tile exists in the
specified location.
|
int |
getIntHeightAt(java.awt.Point coords)
Get the terrain height at the specified coordinates, rounded to the nearest integer, if a tile exists in the
specified location.
|
java.awt.Point |
getLastViewPosition() |
ExporterSettings |
getLayerSettings(Layer layer) |
int |
getLayerValueAt(Layer layer,
int x,
int y) |
int |
getLayerValueAt(Layer layer,
java.awt.Point coords) |
int |
getLowestX() |
int |
getLowestY() |
int |
getMaxHeight() |
long |
getMinecraftSeed() |
java.util.Set<Layer> |
getMinimumLayers()
Get the set of layers that has been configured to be applied everywhere.
|
java.lang.String |
getName() |
java.util.List<Overlay> |
getOverlays() |
int |
getRawHeightAt(int x,
int y)
Get the raw height value.
|
int |
getRawHeightAt(java.awt.Point coords)
Get the raw height value.
|
Dimension.WallType |
getRoofType() |
long |
getSeed() |
float |
getSlope(int x,
int y) |
Dimension |
getSnapshot()
Get a snapshot of the current state of this dimension.
|
Terrain |
getSubsurfaceMaterial() |
Terrain |
getTerrainAt(int x,
int y) |
T |
getTile(int x,
int y)
Get the tile for a particular set of world or absolute block coordinates.
|
T |
getTile(java.awt.Point coords)
If any transformations (scaling and/or translating) needs to be applied to the underlying tiles, this method
and
getTiles() must be overridden. |
java.util.Set<java.awt.Point> |
getTileCoords() |
int |
getTileCount() |
TileFactory |
getTileFactory() |
java.util.Collection<T> |
getTiles()
If any transformations (scaling and/or translating) needs to be applied to the underlying tiles, this method
and
getTile(Point) must be overridden. |
int |
getTopLayerDepth(int x,
int y,
int z) |
int |
getTopLayerMinDepth() |
int |
getTopLayerVariation() |
Dimension.WallType |
getWallType() |
int |
getWaterLevelAt(int x,
int y) |
int |
getWaterLevelAt(java.awt.Point coords) |
int |
getWidth() |
World2 |
getWorld() |
void |
heightMapChanged(Tile tile) |
boolean |
isBottomless() |
boolean |
isContoursEnabled() |
boolean |
isEventsInhibited() |
boolean |
isGridEnabled() |
boolean |
isOverlaysEnabled() |
boolean |
isPopulate() |
boolean |
isTilePresent(int x,
int y)
Determines whether a tile is present in the dimension on specific coordinates.
|
boolean |
isUndoAvailable() |
void |
layerDataChanged(Tile tile,
java.util.Set<Layer> changedLayers) |
void |
registerUndoManager(org.pepsoft.util.undo.UndoManager undoManager) |
void |
removeDimensionListener(Dimension.Listener listener) |
void |
removeOverlay(int index) |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener) |
void |
removePropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener) |
void |
removeTile(int tileX,
int tileY) |
void |
removeTile(java.awt.Point coords) |
void |
removeTile(Tile tile) |
void |
seedsChanged(Tile tile) |
void |
setBitLayerValueAt(Layer layer,
int x,
int y,
boolean value) |
void |
setBorder(Dimension.Border border) |
void |
setBorderLevel(int borderLevel) |
void |
setBorderSize(int borderSize) |
void |
setBottomless(boolean bottomless) |
void |
setContoursEnabled(boolean contoursEnabled) |
void |
setContourSeparation(int contourSeparation) |
void |
setCustomBiomes(java.util.List<CustomBiome> customBiomes) |
void |
setEventsInhibited(boolean eventsInhibited) |
void |
setGridEnabled(boolean gridEnabled) |
void |
setGridSize(int gridSize) |
void |
setHeightAt(int x,
int y,
float height) |
void |
setHeightAt(java.awt.Point coords,
float height) |
void |
setLastViewPosition(java.awt.Point lastViewPosition) |
void |
setLayerSettings(Layer layer,
ExporterSettings settings) |
void |
setLayerValueAt(Layer layer,
int x,
int y,
int value) |
void |
setMaxHeight(int maxHeight) |
void |
setMinecraftSeed(long minecraftSeed) |
void |
setOverlaysEnabled(boolean overlaysEnabled) |
void |
setPopulate(boolean populate) |
void |
setRawHeightAt(int x,
int y,
int rawHeight)
Set the raw height value.
|
void |
setRawHeightAt(java.awt.Point coords,
int rawHeight)
Set the raw height value.
|
void |
setRoofType(Dimension.WallType roofType) |
void |
setSubsurfaceMaterial(Terrain subsurfaceMaterial) |
void |
setTerrainAt(int x,
int y,
Terrain terrain) |
void |
setTerrainAt(java.awt.Point coords,
Terrain terrain) |
void |
setTopLayerMinDepth(int topLayerMinDepth) |
void |
setTopLayerVariation(int topLayerVariation) |
void |
setWallType(Dimension.WallType wallType) |
void |
setWaterLevelAt(int x,
int y,
int waterLevel) |
void |
terrainChanged(Tile tile) |
void |
transform(CoordinateTransform transform,
org.pepsoft.util.ProgressReceiver progressReceiver)
Transform the tiles of this dimension horizontally, for instance
translating and/or rotating them.
|
boolean |
undoChanges() |
void |
unregisterUndoManager() |
void |
waterLevelChanged(Tile tile) |
protected T |
wrapTile(Tile tile) |
clearLayerData, doGetDistanceToEdge, doGetFloodedCount, doGetSlope, getAttribute, getAutoBiome, getAutoBiome, getAutoBiome, getAutoBiome, getBitLayerCount, getCeilingHeight, getCustomLayers, getCustomLayers, getDistancesToEdge, getExportSettings, getExtent, getGenerator, getHeightRange, getHiddenPalettes, getHighestHeight, getHighestIntHeight, getHighestRawHeight, getId, getIntHeightRange, getLayersAt, getLowestHeight, getLowestIntHeight, getLowestRawHeight, getMinHeight, getMostPrevalentBiome, getRawHeightRange, getScale, getSoloedPalette, getSubsurfaceLayerAnchor, getTileForEditing, getTileForEditing, getTopLayerAnchor, getUndergroundBiome, isBorderTile, isCoverSteepTerrain, isFixOverlayCoords, rememberChanges, save, setAttribute, setCeilingHeight, setCoverSteepTerrain, setCustomLayers, setExportSettings, setFixOverlayCoords, setGenerator, setHiddenPalettes, setMinHeight, setName, setScale, setSoloedPalette, setSubsurfaceLayerAnchor, setTopLayerAnchor, setUndergroundBiome, setWorld, visitTiles, visitTilesForEditing
setInstantiationListener
protected final Dimension dimension
public RODelegatingDimension(Dimension dimension)
public Dimension.Anchor getAnchor()
public long getChangeNo()
Dimension
getChangeNo
in class Dimension
public Terrain getSubsurfaceMaterial()
getSubsurfaceMaterial
in class Dimension
public boolean isPopulate()
isPopulate
in class Dimension
public Dimension.Border getBorder()
public int getBorderLevel()
getBorderLevel
in class Dimension
public int getBorderSize()
getBorderSize
in class Dimension
public TileFactory getTileFactory()
getTileFactory
in class Dimension
public boolean isTilePresent(int x, int y)
Dimension
isTilePresent
in interface TileProvider
isTilePresent
in class Dimension
x
- The tile X coordinate for which to determine whether a tile is present.y
- The tile Y coordinate for which to determine whether a tile is present.true
if the dimension contains a tile at the specified location.public int getTileCount()
getTileCount
in class Dimension
public void removeTile(java.awt.Point coords)
removeTile
in class Dimension
public void removeTile(int tileX, int tileY)
removeTile
in class Dimension
public int getIntHeightAt(int x, int y)
Dimension
getIntHeightAt
in class Dimension
x
- The X coordinate to query.y
- The Y coordinate to query.Integer.MIN_VALUE
if there is no tile at the specified coordinates.public int getIntHeightAt(int x, int y, int defaultValue)
Dimension
getIntHeightAt
in class Dimension
x
- The X coordinate to query.y
- The Y coordinate to query.defaultValue
- The value to return if there is no tile at the specified coordinates.defaultHeight
if there is no tile at the specified coordinates.public int getIntHeightAt(java.awt.Point coords)
Dimension
getIntHeightAt
in class Dimension
coords
- The coordinates to query.Integer.MIN_VALUE
if there is no tile at the specified coordinates.public float getHeightAt(int x, int y)
Dimension
getHeightAt
in class Dimension
x
- The X coordinate to query.y
- The Y coordinate to query.-Float.MAX_VALUE
if there is
no tile at the specified coordinates.public float getHeightAt(java.awt.Point coords)
Dimension
getHeightAt
in class Dimension
coords
- The coordinates to query.-Float.MAX_VALUE
if there is
no tile at the specified coordinates.public int getRawHeightAt(int x, int y)
Dimension
minHeight
.getRawHeightAt
in class Dimension
public int getRawHeightAt(java.awt.Point coords)
Dimension
minHeight
.getRawHeightAt
in class Dimension
public final void setRawHeightAt(int x, int y, int rawHeight)
Dimension
minHeight
.setRawHeightAt
in class Dimension
public final void setRawHeightAt(java.awt.Point coords, int rawHeight)
Dimension
minHeight
.setRawHeightAt
in class Dimension
public Terrain getTerrainAt(int x, int y)
getTerrainAt
in class Dimension
public java.util.Set<Terrain> getAllTerrains()
getAllTerrains
in class Dimension
public int getWaterLevelAt(int x, int y)
getWaterLevelAt
in class Dimension
public int getWaterLevelAt(java.awt.Point coords)
getWaterLevelAt
in class Dimension
public int getLayerValueAt(Layer layer, int x, int y)
getLayerValueAt
in class Dimension
public int getLayerValueAt(Layer layer, java.awt.Point coords)
getLayerValueAt
in class Dimension
public boolean getBitLayerValueAt(Layer layer, int x, int y)
getBitLayerValueAt
in class Dimension
public float getDistanceToEdge(Layer layer, int x, int y, float maxDistance)
Dimension
getDistanceToEdge
in class Dimension
layer
- The layer for which to find the distance to the nearest
edge.x
- The X coordinate of the location towards which to determine the distance.y
- The Y coordinate of the location towards which to determine the distance.maxDistance
- The maximum distance to return. If the actual distance is further, this value will be returned.public final void clearLayerData(Layer layer)
clearLayerData
in class Dimension
public long getMinecraftSeed()
getMinecraftSeed
in class Dimension
public java.util.List<Overlay> getOverlays()
getOverlays
in class Dimension
public int addOverlay(Overlay overlay)
addOverlay
in class Dimension
public void removeOverlay(int index)
removeOverlay
in class Dimension
public boolean isGridEnabled()
isGridEnabled
in class Dimension
public final void setGridEnabled(boolean gridEnabled)
setGridEnabled
in class Dimension
public int getGridSize()
getGridSize
in class Dimension
public final void setGridSize(int gridSize)
setGridSize
in class Dimension
public boolean isOverlaysEnabled()
isOverlaysEnabled
in class Dimension
public final void setOverlaysEnabled(boolean overlaysEnabled)
setOverlaysEnabled
in class Dimension
public int getMaxHeight()
getMaxHeight
in class Dimension
public final void setMaxHeight(int maxHeight)
setMaxHeight
in class Dimension
public int getContourSeparation()
getContourSeparation
in class Dimension
public final void setContourSeparation(int contourSeparation)
setContourSeparation
in class Dimension
public boolean isContoursEnabled()
isContoursEnabled
in class Dimension
public final void setContoursEnabled(boolean contoursEnabled)
setContoursEnabled
in class Dimension
public int getTopLayerMinDepth()
getTopLayerMinDepth
in class Dimension
public final void setTopLayerMinDepth(int topLayerMinDepth)
setTopLayerMinDepth
in class Dimension
public int getTopLayerVariation()
getTopLayerVariation
in class Dimension
public final void setTopLayerVariation(int topLayerVariation)
setTopLayerVariation
in class Dimension
public boolean isBottomless()
isBottomless
in class Dimension
public final void setBottomless(boolean bottomless)
setBottomless
in class Dimension
public java.awt.Point getLastViewPosition()
getLastViewPosition
in class Dimension
public final void setLastViewPosition(java.awt.Point lastViewPosition)
setLastViewPosition
in class Dimension
public java.util.List<CustomBiome> getCustomBiomes()
getCustomBiomes
in class Dimension
public final void setCustomBiomes(java.util.List<CustomBiome> customBiomes)
setCustomBiomes
in class Dimension
public java.util.Set<Layer> getAllLayers(boolean applyCombinedLayers)
Dimension
getAllLayers
in class Dimension
applyCombinedLayers
- Whether to include layers from combined layers
which are not used independently in the dimension.public boolean containsOneOf(Layer... layers)
containsOneOf
in class Dimension
public java.util.Set<Layer> getMinimumLayers()
Dimension
getMinimumLayers
in class Dimension
public Dimension.WallType getWallType()
getWallType
in class Dimension
public final void setWallType(Dimension.WallType wallType)
setWallType
in class Dimension
public Dimension.WallType getRoofType()
getRoofType
in class Dimension
public final void setRoofType(Dimension.WallType roofType)
setRoofType
in class Dimension
public final boolean undoChanges()
undoChanges
in class Dimension
public Dimension getSnapshot()
Dimension
getSnapshot
in class Dimension
public int getTopLayerDepth(int x, int y, int z)
getTopLayerDepth
in class Dimension
public void removeDimensionListener(Dimension.Listener listener)
removeDimensionListener
in class Dimension
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
removePropertyChangeListener
in class Dimension
public void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
removePropertyChangeListener
in class Dimension
public final void transform(CoordinateTransform transform, org.pepsoft.util.ProgressReceiver progressReceiver) throws org.pepsoft.util.ProgressReceiver.OperationCancelled
Dimension
transform
in class Dimension
transform
- The transform to apply to the tiles and their contents.progressReceiver
- An optional progress receiver to which progress
of the operation will be reported.org.pepsoft.util.ProgressReceiver.OperationCancelled
- If the progress receiver threw an
OperationCancelled
exception indicating that the user wished
to cancel the operation.public void heightMapChanged(Tile tile)
heightMapChanged
in interface Tile.Listener
heightMapChanged
in class Dimension
public void terrainChanged(Tile tile)
terrainChanged
in interface Tile.Listener
terrainChanged
in class Dimension
public void waterLevelChanged(Tile tile)
waterLevelChanged
in interface Tile.Listener
waterLevelChanged
in class Dimension
public void seedsChanged(Tile tile)
seedsChanged
in interface Tile.Listener
seedsChanged
in class Dimension
public void layerDataChanged(Tile tile, java.util.Set<Layer> changedLayers)
layerDataChanged
in interface Tile.Listener
layerDataChanged
in class Dimension
public void allBitLayerDataChanged(Tile tile)
allBitLayerDataChanged
in interface Tile.Listener
allBitLayerDataChanged
in class Dimension
public void allNonBitlayerDataChanged(Tile tile)
allNonBitlayerDataChanged
in interface Tile.Listener
allNonBitlayerDataChanged
in class Dimension
public void addDimensionListener(Dimension.Listener listener)
addDimensionListener
in class Dimension
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
addPropertyChangeListener
in class Dimension
public void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
addPropertyChangeListener
in class Dimension
public final void applyTheme(int x, int y)
applyTheme
in class Dimension
public final void applyTheme(java.awt.Point coords)
applyTheme
in class Dimension
public void unregisterUndoManager()
unregisterUndoManager
in class Dimension
public void armSavePoint()
armSavePoint
in class Dimension
public void registerUndoManager(org.pepsoft.util.undo.UndoManager undoManager)
registerUndoManager
in class Dimension
public boolean isUndoAvailable()
isUndoAvailable
in class Dimension
public int getHighestX()
getHighestX
in class Dimension
public int getHighestY()
getHighestY
in class Dimension
public ExporterSettings getLayerSettings(Layer layer)
getLayerSettings
in class Dimension
public java.util.Map<Layer,ExporterSettings> getAllLayerSettings()
getAllLayerSettings
in class Dimension
public int getLowestX()
getLowestX
in class Dimension
public int getLowestY()
getLowestY
in class Dimension
public int getFloodedCount(int x, int y, int r, boolean lava)
Dimension
getFloodedCount
in class Dimension
x
- The global X coordinate of the location around which to count
flooded blocks.y
- The global Y coordinate of the location around which to count
flooded blocks.r
- The radius of the square.lava
- Whether to check for lava (when true
) or water
(when false
).public final T getTile(int x, int y)
Dimension
getTile
in interface TileProvider
getTile
in class Dimension
x
- The tile X coordinate for which to get the tile.y
- The tile Y coordinate for which to get the tile.null
if there is no tile for those coordinatespublic T getTile(java.awt.Point coords)
getTiles()
must be overridden. These implementations assume a 1:1 coordinate mapping.public java.util.Collection<T> getTiles()
getTile(Point)
must be overridden. These implementations assume a 1:1 coordinate mapping.public java.util.Set<java.awt.Point> getTileCoords()
getTileCoords
in class Dimension
public boolean isEventsInhibited()
isEventsInhibited
in class Dimension
public final void removeTile(Tile tile)
removeTile
in class Dimension
public final void setBitLayerValueAt(Layer layer, int x, int y, boolean value)
setBitLayerValueAt
in class Dimension
public final void setBorder(Dimension.Border border)
public final void setBorderLevel(int borderLevel)
setBorderLevel
in class Dimension
public final void setBorderSize(int borderSize)
setBorderSize
in class Dimension
public void changed()
Dimension
Dimension
class itself does not track.public void setEventsInhibited(boolean eventsInhibited)
setEventsInhibited
in class Dimension
public final void setHeightAt(int x, int y, float height)
setHeightAt
in class Dimension
public final void setHeightAt(java.awt.Point coords, float height)
setHeightAt
in class Dimension
public final void setLayerSettings(Layer layer, ExporterSettings settings)
setLayerSettings
in class Dimension
public final void setLayerValueAt(Layer layer, int x, int y, int value)
setLayerValueAt
in class Dimension
public final void setMinecraftSeed(long minecraftSeed)
setMinecraftSeed
in class Dimension
public final void setPopulate(boolean populate)
setPopulate
in class Dimension
public final void setSubsurfaceMaterial(Terrain subsurfaceMaterial)
setSubsurfaceMaterial
in class Dimension
public final void setTerrainAt(int x, int y, Terrain terrain)
setTerrainAt
in class Dimension
public final void setTerrainAt(java.awt.Point coords, Terrain terrain)
setTerrainAt
in class Dimension
public final void setWaterLevelAt(int x, int y, int waterLevel)
setWaterLevelAt
in class Dimension
protected Tile doGetTile(java.awt.Point coords)