mirror of
https://github.com/boy0001/FastAsyncWorldedit.git
synced 2024-11-28 21:56:33 +01:00
minor cleanup
This commit is contained in:
parent
283fd746d5
commit
043f1e6002
@ -55,11 +55,11 @@ public class RenderListener implements Listener {
|
||||
int nowTick = (int) (Fawe.get().getTimer().getTick());
|
||||
while (entrySet.hasNext()) {
|
||||
Map.Entry<UUID, int[]> entry = entrySet.next();
|
||||
int[] value = entry.getValue();
|
||||
if (nowTick - value[1] >= timeOut) {
|
||||
value[1] = nowTick + 1;
|
||||
Player player = Bukkit.getPlayer(entry.getKey());
|
||||
if (player != null) {
|
||||
Player player = Bukkit.getPlayer(entry.getKey());
|
||||
if (player != null) {
|
||||
int[] value = entry.getValue();
|
||||
if (nowTick - value[1] >= timeOut) {
|
||||
value[1] = nowTick + 1;
|
||||
setViewDistance(player, Math.max(4, value[0] + 1));
|
||||
long spent = System.currentTimeMillis() - now;
|
||||
if (spent > 5) {
|
||||
@ -132,4 +132,4 @@ public class RenderListener implements Listener {
|
||||
UUID uid = player.getUniqueId();
|
||||
views.remove(uid);
|
||||
}
|
||||
}
|
||||
}
|
@ -151,43 +151,44 @@ import javax.management.Notification;
|
||||
import javax.management.NotificationEmitter;
|
||||
import javax.management.NotificationListener;
|
||||
|
||||
/**[ WorldEdit action]
|
||||
* |
|
||||
* \|/
|
||||
* [ EditSession ] - The change is processed (area restrictions, change limit, block type)
|
||||
* |
|
||||
* \|/
|
||||
* [Block change] - A block change from some location
|
||||
* |
|
||||
* \|/
|
||||
* [ Set Queue ] - The SetQueue manages the implementation specific queue
|
||||
* |
|
||||
* \|/
|
||||
* [ Fawe Queue] - A queue of chunks - check if the queue has the chunk for a change
|
||||
* |
|
||||
* \|/
|
||||
* [ Fawe Chunk Implementation ] - Otherwise create a new FaweChunk object which is a wrapper around the Chunk object
|
||||
* |
|
||||
* \|/
|
||||
* [ Execution ] - When done, the queue then sets the blocks for the chunk, performs lighting updates and sends the chunk packet to the clients
|
||||
*
|
||||
* Why it's faster:
|
||||
* - The chunk is modified directly rather than through the API
|
||||
* \ Removes some overhead, and means some processing can be done async
|
||||
* - Lighting updates are performed on the chunk level rather than for every block
|
||||
* \ e.g. A blob of stone: only the visible blocks need to have the lighting calculated
|
||||
* - Block changes are sent with a chunk packet
|
||||
* \ A chunk packet is generally quicker to create and smaller for large world edits
|
||||
* - No physics updates
|
||||
* \ Physics updates are slow, and are usually performed on each block
|
||||
* - Block data shortcuts
|
||||
* \ Some known blocks don't need to have the data set or accessed (e.g. air is never going to have data)
|
||||
* - Remove redundant extents
|
||||
* \ Up to 11 layers of extents can be removed
|
||||
* - History bypassing
|
||||
* \ FastMode bypasses history and means blocks in the world don't need to be checked and recorded
|
||||
*/
|
||||
public class Fawe {
|
||||
/**
|
||||
* [ WorldEdit action]
|
||||
* |
|
||||
* \|/
|
||||
* [ EditSession ] - The change is processed (area restrictions, change limit, block type)
|
||||
* |
|
||||
* \|/
|
||||
* [Block change] - A block change from some location
|
||||
* |
|
||||
* \|/
|
||||
* [ Set Queue ] - The SetQueue manages the implementation specific queue
|
||||
* |
|
||||
* \|/
|
||||
* [ Fawe Queue] - A queue of chunks - check if the queue has the chunk for a change
|
||||
* |
|
||||
* \|/
|
||||
* [ Fawe Chunk Implementation ] - Otherwise create a new FaweChunk object which is a wrapper around the Chunk object
|
||||
* |
|
||||
* \|/
|
||||
* [ Execution ] - When done, the queue then sets the blocks for the chunk, performs lighting updates and sends the chunk packet to the clients
|
||||
* <p>
|
||||
* Why it's faster:
|
||||
* - The chunk is modified directly rather than through the API
|
||||
* \ Removes some overhead, and means some processing can be done async
|
||||
* - Lighting updates are performed on the chunk level rather than for every block
|
||||
* \ e.g. A blob of stone: only the visible blocks need to have the lighting calculated
|
||||
* - Block changes are sent with a chunk packet
|
||||
* \ A chunk packet is generally quicker to create and smaller for large world edits
|
||||
* - No physics updates
|
||||
* \ Physics updates are slow, and are usually performed on each block
|
||||
* - Block data shortcuts
|
||||
* \ Some known blocks don't need to have the data set or accessed (e.g. air is never going to have data)
|
||||
* - Remove redundant extents
|
||||
* \ Up to 11 layers of extents can be removed
|
||||
* - History bypassing
|
||||
* \ FastMode bypasses history and means blocks in the world don't need to be checked and recorded
|
||||
*/
|
||||
public class Fawe {
|
||||
/**
|
||||
* The FAWE instance;
|
||||
*/
|
||||
@ -208,6 +209,7 @@ public class Fawe {
|
||||
|
||||
/**
|
||||
* Get the implementation specific class
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@ -217,6 +219,7 @@ public class Fawe {
|
||||
|
||||
/**
|
||||
* Get the implementation independent class
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static Fawe get() {
|
||||
@ -225,6 +228,7 @@ public class Fawe {
|
||||
|
||||
/**
|
||||
* Setup Fawe
|
||||
*
|
||||
* @param implementation
|
||||
* @throws InstanceAlreadyExistsException
|
||||
*/
|
||||
@ -248,6 +252,7 @@ public class Fawe {
|
||||
|
||||
/**
|
||||
* Write something to the console
|
||||
*
|
||||
* @param s
|
||||
*/
|
||||
public static void debug(Object s) {
|
||||
@ -293,7 +298,8 @@ public class Fawe {
|
||||
WEManager.IMP.managers.addAll(Fawe.this.IMP.getMaskManagers());
|
||||
WEManager.IMP.managers.add(new PlotSquaredFeature());
|
||||
Fawe.debug("Plugin 'PlotSquared' found. Using it now.");
|
||||
} catch (Throwable e) {}
|
||||
} catch (Throwable e) {
|
||||
}
|
||||
}
|
||||
}, 0);
|
||||
|
||||
@ -336,7 +342,8 @@ public class Fawe {
|
||||
|
||||
/**
|
||||
* The FAWE updater class
|
||||
* - Use to get basic update information (changelog/version etc)
|
||||
* - Use to get basic update information (changelog/version etc)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Updater getUpdater() {
|
||||
@ -348,7 +355,9 @@ public class Fawe {
|
||||
try {
|
||||
tu = min == 0 && max == 100 ? tu : new CleanTextureUtil(tu, min, max);
|
||||
tu = randomize ? new RandomTextureUtil(tu) : new CachedTextureUtil(tu);
|
||||
} catch (FileNotFoundException neverHappens) { neverHappens.printStackTrace(); }
|
||||
} catch (FileNotFoundException neverHappens) {
|
||||
neverHappens.printStackTrace();
|
||||
}
|
||||
return tu;
|
||||
}
|
||||
|
||||
@ -372,6 +381,7 @@ public class Fawe {
|
||||
|
||||
/**
|
||||
* The FaweTimer is a useful class for monitoring TPS
|
||||
*
|
||||
* @return FaweTimer
|
||||
*/
|
||||
public FaweTimer getTimer() {
|
||||
@ -380,6 +390,7 @@ public class Fawe {
|
||||
|
||||
/**
|
||||
* The visual queue is used to queue visualizations
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public VisualQueue getVisualQueue() {
|
||||
@ -388,10 +399,13 @@ public class Fawe {
|
||||
|
||||
/**
|
||||
* The FAWE version
|
||||
* - Unofficial jars may be lacking version information
|
||||
* - Unofficial jars may be lacking version information
|
||||
*
|
||||
* @return FaweVersion
|
||||
*/
|
||||
public @Nullable FaweVersion getVersion() {
|
||||
public
|
||||
@Nullable
|
||||
FaweVersion getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
@ -419,7 +433,8 @@ public class Fawe {
|
||||
Settings.IMP.DATE = new Date(100 + version.year, version.month, version.day).toGMTString();
|
||||
Settings.IMP.BUILD = "https://ci.athion.net/job/FastAsyncWorldEdit/" + version.build;
|
||||
Settings.IMP.COMMIT = "https://github.com/boy0001/FastAsyncWorldedit/commit/" + Integer.toHexString(version.hash);
|
||||
} catch (Throwable ignore) {}
|
||||
} catch (Throwable ignore) {
|
||||
}
|
||||
Settings.IMP.reload(file);
|
||||
// Setting up message.yml
|
||||
BBC.load(new File(this.IMP.getDirectory(), "message.yml"));
|
||||
@ -638,7 +653,8 @@ public class Fawe {
|
||||
debug(" - This is only a recommendation");
|
||||
debug("====================================");
|
||||
}
|
||||
} catch (Throwable ignore) {}
|
||||
} catch (Throwable ignore) {
|
||||
}
|
||||
if (MainUtil.getJavaVersion() < 1.8) {
|
||||
debug("====== UPGRADE TO JAVA 8 ======");
|
||||
debug("You are running " + System.getProperty("java.version"));
|
||||
@ -692,6 +708,7 @@ public class Fawe {
|
||||
|
||||
/**
|
||||
* Get the main thread
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Thread getMainThread() {
|
||||
@ -704,6 +721,7 @@ public class Fawe {
|
||||
|
||||
/**
|
||||
* Sets the main thread to the current thread
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Thread setMainThread() {
|
||||
|
@ -63,17 +63,18 @@ import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* The FaweAPI class offers a few useful functions.<br>
|
||||
* - This class is not intended to replace the WorldEdit API<br>
|
||||
* - With FAWE installed, you can use the EditSession and other WorldEdit classes from an async thread.<br>
|
||||
* <br>
|
||||
* FaweAPI.[some method]
|
||||
* - This class is not intended to replace the WorldEdit API<br>
|
||||
* - With FAWE installed, you can use the EditSession and other WorldEdit classes from an async thread.<br>
|
||||
* <br>
|
||||
* FaweAPI.[some method]
|
||||
*/
|
||||
public class FaweAPI {
|
||||
/**
|
||||
* Offers a lot of options for building an EditSession
|
||||
* @see com.boydti.fawe.util.EditSessionBuilder
|
||||
*
|
||||
* @param world
|
||||
* @return A new EditSessionBuilder
|
||||
* @see com.boydti.fawe.util.EditSessionBuilder
|
||||
*/
|
||||
public static EditSessionBuilder getEditSessionBuilder(World world) {
|
||||
return new EditSessionBuilder(world);
|
||||
@ -81,6 +82,7 @@ public class FaweAPI {
|
||||
|
||||
/**
|
||||
* The TaskManager has some useful methods for doing things asynchronously
|
||||
*
|
||||
* @return TaskManager
|
||||
*/
|
||||
public static TaskManager getTaskManager() {
|
||||
@ -89,9 +91,10 @@ public class FaweAPI {
|
||||
|
||||
/**
|
||||
* Add a custom mask for use in e.g {@literal //mask #id:<input>}
|
||||
* @see com.sk89q.worldedit.command.MaskCommands
|
||||
*
|
||||
* @param methods The class with a bunch of mask methods
|
||||
* @return true if the mask was registered
|
||||
* @see com.sk89q.worldedit.command.MaskCommands
|
||||
*/
|
||||
public static boolean registerMasks(Object methods) {
|
||||
DefaultMaskParser parser = getParser(DefaultMaskParser.class);
|
||||
@ -101,9 +104,10 @@ public class FaweAPI {
|
||||
|
||||
/**
|
||||
* Add a custom material for use in e.g {@literal //material #id:<input>}
|
||||
* @see com.sk89q.worldedit.command.PatternCommands
|
||||
*
|
||||
* @param methods The class with a bunch of pattern methods
|
||||
* @return true if the mask was registered
|
||||
* @see com.sk89q.worldedit.command.PatternCommands
|
||||
*/
|
||||
public static boolean registerPatterns(Object methods) {
|
||||
HashTagPatternParser parser = getParser(HashTagPatternParser.class);
|
||||
@ -113,9 +117,10 @@ public class FaweAPI {
|
||||
|
||||
/**
|
||||
* Add a custom transform for use in
|
||||
* @see com.sk89q.worldedit.command.TransformCommands
|
||||
*
|
||||
* @param methods The class with a bunch of transform methods
|
||||
* @return true if the transform was registered
|
||||
* @see com.sk89q.worldedit.command.TransformCommands
|
||||
*/
|
||||
public static boolean registerTransforms(Object methods) {
|
||||
DefaultTransformParser parser = Fawe.get().getTransformParser();
|
||||
@ -146,9 +151,10 @@ public class FaweAPI {
|
||||
|
||||
/**
|
||||
* Create a command with the provided aliases and register all methods of the class as sub commands.<br>
|
||||
* - You should try to register commands during startup
|
||||
* - If no aliases are specified, all methods become root commands
|
||||
* @param clazz The class containing all the sub command methods
|
||||
* - You should try to register commands during startup
|
||||
* - If no aliases are specified, all methods become root commands
|
||||
*
|
||||
* @param clazz The class containing all the sub command methods
|
||||
* @param aliases The aliases to give the command (or none)
|
||||
*/
|
||||
public static void registerCommands(Object clazz, String... aliases) {
|
||||
@ -157,11 +163,12 @@ public class FaweAPI {
|
||||
|
||||
/**
|
||||
* Wrap some object into a FawePlayer<br>
|
||||
* - org.bukkit.entity.Player
|
||||
* - org.spongepowered.api.entity.living.player
|
||||
* - com.sk89q.worldedit.entity.Player
|
||||
* - String (name)
|
||||
* - UUID (player UUID)
|
||||
* - org.bukkit.entity.Player
|
||||
* - org.spongepowered.api.entity.living.player
|
||||
* - com.sk89q.worldedit.entity.Player
|
||||
* - String (name)
|
||||
* - UUID (player UUID)
|
||||
*
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
@ -175,13 +182,14 @@ public class FaweAPI {
|
||||
|
||||
/**
|
||||
* You can either use a FaweQueue or an EditSession to change blocks<br>
|
||||
* - The FaweQueue skips a bit of overhead so it's faster<br>
|
||||
* - The WorldEdit EditSession can do a lot more<br>
|
||||
* - The FaweQueue skips a bit of overhead so it's faster<br>
|
||||
* - The WorldEdit EditSession can do a lot more<br>
|
||||
* Remember to enqueue it when you're done!<br>
|
||||
* @see com.boydti.fawe.object.FaweQueue#enqueue()
|
||||
* @param world The name of the world
|
||||
*
|
||||
* @param world The name of the world
|
||||
* @param autoqueue If it should start dispatching before you enqueue it.
|
||||
* @return
|
||||
* @see com.boydti.fawe.object.FaweQueue#enqueue()
|
||||
*/
|
||||
public static FaweQueue createQueue(World world, boolean autoqueue) {
|
||||
return SetQueue.IMP.getNewQueue(world, true, autoqueue);
|
||||
@ -204,8 +212,9 @@ public class FaweAPI {
|
||||
|
||||
/**
|
||||
* Upload the clipboard to the configured web interface
|
||||
*
|
||||
* @param clipboard The clipboard (may not be null)
|
||||
* @param format The format to use (some formats may not be supported)
|
||||
* @param format The format to use (some formats may not be supported)
|
||||
* @return The download URL or null
|
||||
*/
|
||||
public static URL upload(final Clipboard clipboard, final ClipboardFormat format) {
|
||||
@ -214,10 +223,11 @@ public class FaweAPI {
|
||||
|
||||
/**
|
||||
* Just forwards to ClipboardFormat.SCHEMATIC.load(file)
|
||||
* @see com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat
|
||||
* @see com.boydti.fawe.object.schematic.Schematic
|
||||
*
|
||||
* @param file
|
||||
* @return
|
||||
* @see com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat
|
||||
* @see com.boydti.fawe.object.schematic.Schematic
|
||||
*/
|
||||
public static Schematic load(File file) throws IOException {
|
||||
return ClipboardFormat.SCHEMATIC.load(file);
|
||||
@ -225,6 +235,7 @@ public class FaweAPI {
|
||||
|
||||
/**
|
||||
* Get a list of supported protection plugin masks.
|
||||
*
|
||||
* @return Set of FaweMaskManager
|
||||
*/
|
||||
public static Set<FaweMaskManager> getMaskManagers() {
|
||||
@ -233,6 +244,7 @@ public class FaweAPI {
|
||||
|
||||
/**
|
||||
* Check if the server has more than the configured low memory threshold
|
||||
*
|
||||
* @return True if the server has limited memory
|
||||
*/
|
||||
public static boolean isMemoryLimited() {
|
||||
@ -241,6 +253,7 @@ public class FaweAPI {
|
||||
|
||||
/**
|
||||
* Use ThreadLocalRandom instead
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
@ -250,6 +263,7 @@ public class FaweAPI {
|
||||
|
||||
/**
|
||||
* Get a player's allowed WorldEdit region
|
||||
*
|
||||
* @param player
|
||||
* @return
|
||||
*/
|
||||
@ -259,16 +273,18 @@ public class FaweAPI {
|
||||
|
||||
/**
|
||||
* Cancel the edit with the following extent<br>
|
||||
* - The extent must be the one being used by an EditSession, otherwise an error may be thrown <br>
|
||||
* - Insert an extent into the EditSession using the EditSessionEvent: http://wiki.sk89q.com/wiki/WorldEdit/API/Hooking_EditSession <br>
|
||||
* @see com.sk89q.worldedit.EditSession#getRegionExtent() To get the FaweExtent for an EditSession
|
||||
* - The extent must be the one being used by an EditSession, otherwise an error may be thrown <br>
|
||||
* - Insert an extent into the EditSession using the EditSessionEvent: http://wiki.sk89q.com/wiki/WorldEdit/API/Hooking_EditSession <br>
|
||||
*
|
||||
* @param extent
|
||||
* @param reason
|
||||
* @see com.sk89q.worldedit.EditSession#getRegionExtent() To get the FaweExtent for an EditSession
|
||||
*/
|
||||
public static void cancelEdit(Extent extent, BBC reason) {
|
||||
try {
|
||||
WEManager.IMP.cancelEdit(extent, reason);
|
||||
} catch (WorldEditException ignore) {}
|
||||
} catch (WorldEditException ignore) {
|
||||
}
|
||||
}
|
||||
|
||||
public static void addMaskManager(FaweMaskManager maskMan) {
|
||||
@ -277,6 +293,7 @@ public class FaweAPI {
|
||||
|
||||
/**
|
||||
* Get the DiskStorageHistory object representing a File
|
||||
*
|
||||
* @param file
|
||||
* @return
|
||||
*/
|
||||
@ -312,13 +329,14 @@ public class FaweAPI {
|
||||
|
||||
/**
|
||||
* Used in the RollBack to generate a list of DiskStorageHistory objects<br>
|
||||
* - Note: An edit outside the radius may be included if it overlaps with an edit inside that depends on it.
|
||||
* @param origin - The origin location
|
||||
* @param user - The uuid (may be null)
|
||||
* @param radius - The radius from the origin of the edit
|
||||
* - Note: An edit outside the radius may be included if it overlaps with an edit inside that depends on it.
|
||||
*
|
||||
* @param origin - The origin location
|
||||
* @param user - The uuid (may be null)
|
||||
* @param radius - The radius from the origin of the edit
|
||||
* @param timediff - The max age of the file in milliseconds
|
||||
* @param shallow - If shallow is true, FAWE will only read the first Settings.IMP.BUFFER_SIZE bytes to obtain history info<br>
|
||||
* Reading only part of the file will result in unreliable bounds info for large edits
|
||||
* @param shallow - If shallow is true, FAWE will only read the first Settings.IMP.BUFFER_SIZE bytes to obtain history info<br>
|
||||
* Reading only part of the file will result in unreliable bounds info for large edits
|
||||
* @return
|
||||
*/
|
||||
public static List<DiskStorageHistory> getBDFiles(FaweLocation origin, UUID user, int radius, long timediff, boolean shallow) {
|
||||
@ -397,11 +415,12 @@ public class FaweAPI {
|
||||
|
||||
/**
|
||||
* The DiskStorageHistory class is what FAWE uses to represent the undo on disk.
|
||||
* @see com.boydti.fawe.object.changeset.DiskStorageHistory#toEditSession(com.boydti.fawe.object.FawePlayer)
|
||||
*
|
||||
* @param world
|
||||
* @param uuid
|
||||
* @param index
|
||||
* @return
|
||||
* @see com.boydti.fawe.object.changeset.DiskStorageHistory#toEditSession(com.boydti.fawe.object.FawePlayer)
|
||||
*/
|
||||
public static DiskStorageHistory getChangeSetFromDisk(World world, UUID uuid, int index) {
|
||||
return new DiskStorageHistory(world, uuid, index);
|
||||
@ -409,6 +428,7 @@ public class FaweAPI {
|
||||
|
||||
/**
|
||||
* Compare two versions
|
||||
*
|
||||
* @param version
|
||||
* @param major
|
||||
* @param minor
|
||||
@ -436,9 +456,10 @@ public class FaweAPI {
|
||||
|
||||
/**
|
||||
* Fix the lighting in a selection<br>
|
||||
* - First removes all lighting, then relights
|
||||
* - Relights in parallel (if enabled) for best performance<br>
|
||||
* - Also resends chunks<br>
|
||||
* - First removes all lighting, then relights
|
||||
* - Relights in parallel (if enabled) for best performance<br>
|
||||
* - Also resends chunks<br>
|
||||
*
|
||||
* @param world
|
||||
* @param selection (assumes cuboid)
|
||||
* @return
|
||||
@ -462,7 +483,7 @@ public class FaweAPI {
|
||||
final NMSMappedFaweQueue nmsQueue = (NMSMappedFaweQueue) queue;
|
||||
NMSRelighter relighter = new NMSRelighter(nmsQueue);
|
||||
for (int x = minX; x <= maxX; x++) {
|
||||
for (int z = minZ; z <= maxZ; z ++) {
|
||||
for (int z = minZ; z <= maxZ; z++) {
|
||||
relighter.addChunk(x, z, null, 65535);
|
||||
count++;
|
||||
}
|
||||
@ -483,8 +504,9 @@ public class FaweAPI {
|
||||
|
||||
/**
|
||||
* If a schematic is too large to be pasted normally<br>
|
||||
* - Skips any block history
|
||||
* - Ignores nbt
|
||||
* - Skips any block history
|
||||
* - Ignores nbt
|
||||
*
|
||||
* @param file
|
||||
* @param loc
|
||||
* @return
|
||||
@ -500,12 +522,12 @@ public class FaweAPI {
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Since I haven't finished it yet
|
||||
* If a schematic is too large to be pasted normally<br>
|
||||
* - Skips any block history
|
||||
* - Ignores nbt
|
||||
* @param url
|
||||
* @param loc
|
||||
* @deprecated Since I haven't finished it yet
|
||||
* If a schematic is too large to be pasted normally<br>
|
||||
* - Skips any block history
|
||||
* - Ignores nbt
|
||||
*/
|
||||
@Deprecated
|
||||
public static void streamSchematic(final URL url, final FaweLocation loc) {
|
||||
@ -519,14 +541,14 @@ public class FaweAPI {
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Since I haven't finished it yet
|
||||
* If a schematic is too large to be pasted normally<br>
|
||||
* - Skips any block history
|
||||
* - Ignores some block data
|
||||
* - Not actually streaming from disk, but it does skip a lot of overhead
|
||||
* @param is
|
||||
* @param loc
|
||||
* @throws IOException
|
||||
* @deprecated Since I haven't finished it yet
|
||||
* If a schematic is too large to be pasted normally<br>
|
||||
* - Skips any block history
|
||||
* - Ignores some block data
|
||||
* - Not actually streaming from disk, but it does skip a lot of overhead
|
||||
*/
|
||||
@Deprecated
|
||||
public static void streamSchematic(final InputStream is, final FaweLocation loc) throws IOException {
|
||||
@ -573,6 +595,7 @@ public class FaweAPI {
|
||||
|
||||
/**
|
||||
* Set a task to run when the global queue (SetQueue class) is empty
|
||||
*
|
||||
* @param whenDone
|
||||
*/
|
||||
public static void addTask(final Runnable whenDone) {
|
||||
@ -581,6 +604,7 @@ public class FaweAPI {
|
||||
|
||||
/**
|
||||
* Have a task run when the server is low on memory (configured threshold)
|
||||
*
|
||||
* @param run
|
||||
*/
|
||||
public static void addMemoryLimitedTask(Runnable run) {
|
||||
@ -589,6 +613,7 @@ public class FaweAPI {
|
||||
|
||||
/**
|
||||
* Have a task run when the server is no longer low on memory (configured threshold)
|
||||
*
|
||||
* @param run
|
||||
*/
|
||||
public static void addMemoryPlentifulTask(Runnable run) {
|
||||
@ -596,16 +621,16 @@ public class FaweAPI {
|
||||
}
|
||||
|
||||
/**
|
||||
* @see BBC
|
||||
* @return
|
||||
* @see BBC
|
||||
*/
|
||||
public static BBC[] getTranslations() {
|
||||
return BBC.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see #getEditSessionBuilder(com.sk89q.worldedit.world.World)
|
||||
* @deprecated
|
||||
*/
|
||||
@Deprecated
|
||||
public static EditSession getNewEditSession(@Nonnull FawePlayer player) {
|
||||
@ -616,8 +641,8 @@ public class FaweAPI {
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see #getEditSessionBuilder(com.sk89q.worldedit.world.World)
|
||||
* @deprecated
|
||||
*/
|
||||
@Deprecated
|
||||
public static EditSession getNewEditSession(World world) {
|
||||
|
@ -44,15 +44,15 @@ public class FaweCache {
|
||||
public final static short[][][] CACHE_J = new short[256][16][16];
|
||||
|
||||
/**
|
||||
* [ i | j ] => x
|
||||
* [ i | j ] => x
|
||||
*/
|
||||
public final static byte[][] CACHE_X = new byte[16][4096];
|
||||
/**
|
||||
* [ i | j ] => y
|
||||
* [ i | j ] => y
|
||||
*/
|
||||
public final static short[][] CACHE_Y = new short[16][4096];
|
||||
/**
|
||||
* [ i | j ] => z
|
||||
* [ i | j ] => z
|
||||
*/
|
||||
public final static byte[][] CACHE_Z = new byte[16][4096];
|
||||
|
||||
@ -81,7 +81,8 @@ public class FaweCache {
|
||||
|
||||
/**
|
||||
* Get the cached BaseBlock object for an id/data<br>
|
||||
* - The block is immutable
|
||||
* - The block is immutable
|
||||
*
|
||||
* @param id
|
||||
* @param data
|
||||
* @return
|
||||
@ -96,6 +97,7 @@ public class FaweCache {
|
||||
|
||||
/**
|
||||
* Get the combined data for a block
|
||||
*
|
||||
* @param id
|
||||
* @param data
|
||||
* @return
|
||||
@ -114,6 +116,7 @@ public class FaweCache {
|
||||
|
||||
/**
|
||||
* Get the combined id for a block
|
||||
*
|
||||
* @param block
|
||||
* @return
|
||||
*/
|
||||
@ -214,74 +217,74 @@ public class FaweCache {
|
||||
} catch (Throwable ignore) {
|
||||
ignore.printStackTrace();
|
||||
}
|
||||
CACHE_COLOR[getCombined(0, 0)] = new Color(128, 128, 128); //Air
|
||||
CACHE_COLOR[getCombined(1, 0)] = new Color(180, 180, 180); //stone
|
||||
CACHE_COLOR[getCombined(2, 0)] = new Color(0, 225, 0); //grass
|
||||
CACHE_COLOR[getCombined(3, 0)] = new Color(168, 117, 68); //dirt
|
||||
CACHE_COLOR[getCombined(4, 0)] = new Color(125, 125, 125); //cobblestone
|
||||
CACHE_COLOR[getCombined(5, 0)] = new Color(185, 133, 83); //wood planks
|
||||
CACHE_COLOR[getCombined(6, 0)] = new Color(0, 210, 0); //saplings
|
||||
CACHE_COLOR[getCombined(7, 0)] = new Color(60, 60, 60); //bedrock
|
||||
CACHE_COLOR[getCombined(8, 0)] = new Color(0, 0, 255); //water new Color(flowing)
|
||||
CACHE_COLOR[getCombined(9, 0)] = new Color(0, 0, 235); //water new Color(stationary)
|
||||
CACHE_COLOR[getCombined(10, 0)] = new Color(255, 155, 102); //lava new Color(flowing)
|
||||
CACHE_COLOR[getCombined(11, 0)] = new Color(255, 129, 61); //lava new Color(stationary)
|
||||
CACHE_COLOR[getCombined(12, 0)] = new Color(228, 216, 174); //sand
|
||||
CACHE_COLOR[getCombined(13, 0)] = new Color(190, 190, 210); //gravel
|
||||
CACHE_COLOR[getCombined(14, 0)] = new Color(245, 232, 73); //gold ore
|
||||
CACHE_COLOR[getCombined(15, 0)] = new Color(211, 179, 160); //iron ore
|
||||
CACHE_COLOR[getCombined(16, 0)] = new Color(61, 61, 61); //coal ore
|
||||
CACHE_COLOR[getCombined(17, 0)] = new Color(165, 103, 53); //wood
|
||||
CACHE_COLOR[getCombined(18, 0)] = new Color(76, 150, 24); //leaves
|
||||
CACHE_COLOR[getCombined(20, 0)] = new Color(158, 255, 243); //glass
|
||||
CACHE_COLOR[getCombined(24, 0)] = new Color(226, 206, 140); //sandstone
|
||||
CACHE_COLOR[getCombined(31, 0)] = new Color(0, 210, 0); //long grass
|
||||
CACHE_COLOR[getCombined(32, 0)] = new Color(224, 162, 64); //shrub
|
||||
CACHE_COLOR[getCombined(37, 0)] = new Color(255, 248, 56); //yellow flower
|
||||
CACHE_COLOR[getCombined(38, 0)] = new Color(225, 0, 0); //red rose
|
||||
CACHE_COLOR[getCombined(41, 0)] = new Color(255, 215, 0); //gold block
|
||||
CACHE_COLOR[getCombined(42, 0)] = new Color(135, 135, 135); //iron block
|
||||
CACHE_COLOR[getCombined(44, 0)] = new Color(165, 165, 165); //step
|
||||
CACHE_COLOR[getCombined(50, 0)] = new Color(255, 248, 56); //torch
|
||||
CACHE_COLOR[getCombined(53, 0)] = new Color(185, 133, 83); //wood stairs
|
||||
CACHE_COLOR[getCombined(59, 0)] = new Color(205, 222, 61); //wheat crops
|
||||
CACHE_COLOR[getCombined(65, 0)] = new Color(185, 133, 83); //ladder
|
||||
CACHE_COLOR[getCombined(67, 0)] = new Color(125, 125, 125); //cobblestone stairs
|
||||
CACHE_COLOR[getCombined(78, 0)] = new Color(230, 255, 255); //snow layer
|
||||
CACHE_COLOR[getCombined(79, 0)] = new Color(180, 255, 236); //ice
|
||||
CACHE_COLOR[getCombined(81, 0)] = new Color(76, 150, 24); //cactus
|
||||
CACHE_COLOR[getCombined(82, 0)] = new Color(150, 150, 180); //clay
|
||||
CACHE_COLOR[getCombined(83, 0)] = new Color(89, 255, 89); //reed
|
||||
CACHE_COLOR[getCombined(85, 0)] = new Color(185, 133, 83); //wood fence
|
||||
CACHE_COLOR[getCombined(99, 0)] = new Color(168, 125, 99); //large brown mushroom
|
||||
CACHE_COLOR[getCombined(100, 0)] = new Color(186, 27, 27); //large red mushroom
|
||||
CACHE_COLOR[getCombined(102, 0)] = new Color(158, 255, 243); //glass pane
|
||||
CACHE_COLOR[getCombined(106, 0)] = new Color(0, 150, 0); //vines
|
||||
CACHE_COLOR[getCombined(110, 0)] = new Color(100, 90, 100); //mycelium
|
||||
CACHE_COLOR[getCombined(111, 0)] = new Color(96, 188, 30); //lily pad
|
||||
CACHE_COLOR[getCombined(128, 0)] = new Color(226, 206, 140); //sandstone stairs
|
||||
CACHE_COLOR[getCombined(134, 0)] = new Color(185, 133, 83); //spruce wood stairs
|
||||
CACHE_COLOR[getCombined(141, 0)] = new Color(205, 222, 61); //carrot crops
|
||||
CACHE_COLOR[getCombined(142, 0)] = new Color(205, 222, 61); //potato crops
|
||||
CACHE_COLOR[getCombined(161, 0)] = new Color(67, 132, 21); //dark oak leaves
|
||||
CACHE_COLOR[getCombined(38, 8)] = new Color(255, 250, 155); //daisy flower
|
||||
CACHE_COLOR[getCombined(175, 8)] = new Color(0, 200, 0); //double tall grass and flowers top
|
||||
CACHE_COLOR[getCombined(35, 0)] = new Color(254, 254, 254); // White - Wools colors borrowed from Sk89q's draw script
|
||||
CACHE_COLOR[getCombined(35, 1)] = new Color(255, 100, 0); // Orange
|
||||
CACHE_COLOR[getCombined(35, 2)] = new Color(200, 0, 200); // Magenta
|
||||
CACHE_COLOR[getCombined(35, 3)] = new Color(87, 132, 223); // Light blue
|
||||
CACHE_COLOR[getCombined(35, 4)] = new Color(255, 255, 0); // Yellow
|
||||
CACHE_COLOR[getCombined(35, 5)] = new Color(0, 255, 0); // Green
|
||||
CACHE_COLOR[getCombined(35, 6)] = new Color(255, 180, 200); // Pink
|
||||
CACHE_COLOR[getCombined(35, 7)] = new Color(72, 72, 72); // Gray
|
||||
CACHE_COLOR[getCombined(35, 8)] = new Color(173, 173, 173); // Light grey
|
||||
CACHE_COLOR[getCombined(35, 9)] = new Color(0, 100, 160); // Cyan
|
||||
CACHE_COLOR[getCombined(35, 10)] = new Color(120, 0, 200); // Purple
|
||||
CACHE_COLOR[getCombined(35, 11)] = new Color(0, 0, 175); // Blue
|
||||
CACHE_COLOR[getCombined(35, 12)] = new Color(100, 60, 0); // Brown
|
||||
CACHE_COLOR[getCombined(35, 13)] = new Color(48, 160, 0); // Cactus green
|
||||
CACHE_COLOR[getCombined(35, 14)] = new Color(255, 0, 0); // Red
|
||||
CACHE_COLOR[getCombined(35, 15)] = new Color(0, 0, 0); // Black
|
||||
CACHE_COLOR[getCombined(0, 0)] = new Color(128, 128, 128); //Air
|
||||
CACHE_COLOR[getCombined(1, 0)] = new Color(180, 180, 180); //stone
|
||||
CACHE_COLOR[getCombined(2, 0)] = new Color(0, 225, 0); //grass
|
||||
CACHE_COLOR[getCombined(3, 0)] = new Color(168, 117, 68); //dirt
|
||||
CACHE_COLOR[getCombined(4, 0)] = new Color(125, 125, 125); //cobblestone
|
||||
CACHE_COLOR[getCombined(5, 0)] = new Color(185, 133, 83); //wood planks
|
||||
CACHE_COLOR[getCombined(6, 0)] = new Color(0, 210, 0); //saplings
|
||||
CACHE_COLOR[getCombined(7, 0)] = new Color(60, 60, 60); //bedrock
|
||||
CACHE_COLOR[getCombined(8, 0)] = new Color(0, 0, 255); //water new Color(flowing)
|
||||
CACHE_COLOR[getCombined(9, 0)] = new Color(0, 0, 235); //water new Color(stationary)
|
||||
CACHE_COLOR[getCombined(10, 0)] = new Color(255, 155, 102); //lava new Color(flowing)
|
||||
CACHE_COLOR[getCombined(11, 0)] = new Color(255, 129, 61); //lava new Color(stationary)
|
||||
CACHE_COLOR[getCombined(12, 0)] = new Color(228, 216, 174); //sand
|
||||
CACHE_COLOR[getCombined(13, 0)] = new Color(190, 190, 210); //gravel
|
||||
CACHE_COLOR[getCombined(14, 0)] = new Color(245, 232, 73); //gold ore
|
||||
CACHE_COLOR[getCombined(15, 0)] = new Color(211, 179, 160); //iron ore
|
||||
CACHE_COLOR[getCombined(16, 0)] = new Color(61, 61, 61); //coal ore
|
||||
CACHE_COLOR[getCombined(17, 0)] = new Color(165, 103, 53); //wood
|
||||
CACHE_COLOR[getCombined(18, 0)] = new Color(76, 150, 24); //leaves
|
||||
CACHE_COLOR[getCombined(20, 0)] = new Color(158, 255, 243); //glass
|
||||
CACHE_COLOR[getCombined(24, 0)] = new Color(226, 206, 140); //sandstone
|
||||
CACHE_COLOR[getCombined(31, 0)] = new Color(0, 210, 0); //long grass
|
||||
CACHE_COLOR[getCombined(32, 0)] = new Color(224, 162, 64); //shrub
|
||||
CACHE_COLOR[getCombined(37, 0)] = new Color(255, 248, 56); //yellow flower
|
||||
CACHE_COLOR[getCombined(38, 0)] = new Color(225, 0, 0); //red rose
|
||||
CACHE_COLOR[getCombined(41, 0)] = new Color(255, 215, 0); //gold block
|
||||
CACHE_COLOR[getCombined(42, 0)] = new Color(135, 135, 135); //iron block
|
||||
CACHE_COLOR[getCombined(44, 0)] = new Color(165, 165, 165); //step
|
||||
CACHE_COLOR[getCombined(50, 0)] = new Color(255, 248, 56); //torch
|
||||
CACHE_COLOR[getCombined(53, 0)] = new Color(185, 133, 83); //wood stairs
|
||||
CACHE_COLOR[getCombined(59, 0)] = new Color(205, 222, 61); //wheat crops
|
||||
CACHE_COLOR[getCombined(65, 0)] = new Color(185, 133, 83); //ladder
|
||||
CACHE_COLOR[getCombined(67, 0)] = new Color(125, 125, 125); //cobblestone stairs
|
||||
CACHE_COLOR[getCombined(78, 0)] = new Color(230, 255, 255); //snow layer
|
||||
CACHE_COLOR[getCombined(79, 0)] = new Color(180, 255, 236); //ice
|
||||
CACHE_COLOR[getCombined(81, 0)] = new Color(76, 150, 24); //cactus
|
||||
CACHE_COLOR[getCombined(82, 0)] = new Color(150, 150, 180); //clay
|
||||
CACHE_COLOR[getCombined(83, 0)] = new Color(89, 255, 89); //reed
|
||||
CACHE_COLOR[getCombined(85, 0)] = new Color(185, 133, 83); //wood fence
|
||||
CACHE_COLOR[getCombined(99, 0)] = new Color(168, 125, 99); //large brown mushroom
|
||||
CACHE_COLOR[getCombined(100, 0)] = new Color(186, 27, 27); //large red mushroom
|
||||
CACHE_COLOR[getCombined(102, 0)] = new Color(158, 255, 243); //glass pane
|
||||
CACHE_COLOR[getCombined(106, 0)] = new Color(0, 150, 0); //vines
|
||||
CACHE_COLOR[getCombined(110, 0)] = new Color(100, 90, 100); //mycelium
|
||||
CACHE_COLOR[getCombined(111, 0)] = new Color(96, 188, 30); //lily pad
|
||||
CACHE_COLOR[getCombined(128, 0)] = new Color(226, 206, 140); //sandstone stairs
|
||||
CACHE_COLOR[getCombined(134, 0)] = new Color(185, 133, 83); //spruce wood stairs
|
||||
CACHE_COLOR[getCombined(141, 0)] = new Color(205, 222, 61); //carrot crops
|
||||
CACHE_COLOR[getCombined(142, 0)] = new Color(205, 222, 61); //potato crops
|
||||
CACHE_COLOR[getCombined(161, 0)] = new Color(67, 132, 21); //dark oak leaves
|
||||
CACHE_COLOR[getCombined(38, 8)] = new Color(255, 250, 155); //daisy flower
|
||||
CACHE_COLOR[getCombined(175, 8)] = new Color(0, 200, 0); //double tall grass and flowers top
|
||||
CACHE_COLOR[getCombined(35, 0)] = new Color(254, 254, 254); // White - Wools colors borrowed from Sk89q's draw script
|
||||
CACHE_COLOR[getCombined(35, 1)] = new Color(255, 100, 0); // Orange
|
||||
CACHE_COLOR[getCombined(35, 2)] = new Color(200, 0, 200); // Magenta
|
||||
CACHE_COLOR[getCombined(35, 3)] = new Color(87, 132, 223); // Light blue
|
||||
CACHE_COLOR[getCombined(35, 4)] = new Color(255, 255, 0); // Yellow
|
||||
CACHE_COLOR[getCombined(35, 5)] = new Color(0, 255, 0); // Green
|
||||
CACHE_COLOR[getCombined(35, 6)] = new Color(255, 180, 200); // Pink
|
||||
CACHE_COLOR[getCombined(35, 7)] = new Color(72, 72, 72); // Gray
|
||||
CACHE_COLOR[getCombined(35, 8)] = new Color(173, 173, 173); // Light grey
|
||||
CACHE_COLOR[getCombined(35, 9)] = new Color(0, 100, 160); // Cyan
|
||||
CACHE_COLOR[getCombined(35, 10)] = new Color(120, 0, 200); // Purple
|
||||
CACHE_COLOR[getCombined(35, 11)] = new Color(0, 0, 175); // Blue
|
||||
CACHE_COLOR[getCombined(35, 12)] = new Color(100, 60, 0); // Brown
|
||||
CACHE_COLOR[getCombined(35, 13)] = new Color(48, 160, 0); // Cactus green
|
||||
CACHE_COLOR[getCombined(35, 14)] = new Color(255, 0, 0); // Red
|
||||
CACHE_COLOR[getCombined(35, 15)] = new Color(0, 0, 0); // Black
|
||||
}
|
||||
|
||||
public static boolean canPassThrough(int id, int data) {
|
||||
@ -558,12 +561,14 @@ public class FaweCache {
|
||||
case 212:
|
||||
case 217:
|
||||
return true;
|
||||
default: return false;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if an id might have data
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ -643,6 +648,7 @@ public class FaweCache {
|
||||
|
||||
/**
|
||||
* Check if an id might have nbt
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ -720,12 +726,12 @@ public class FaweCache {
|
||||
if (entry == null) {
|
||||
return data != 0 ? id + ":" + data : id + "";
|
||||
}
|
||||
return data != 0 ? entry.id.replace("minecraft:","") + ":" + data : entry.id.replace("minecraft:","");
|
||||
return data != 0 ? entry.id.replace("minecraft:", "") + ":" + data : entry.id.replace("minecraft:", "");
|
||||
}
|
||||
|
||||
public static Map<String, Object> asMap(Object... pairs) {
|
||||
HashMap<String, Object> map = new HashMap<String, Object>(pairs.length >> 1);
|
||||
for (int i = 0; i < pairs.length; i+=2) {
|
||||
for (int i = 0; i < pairs.length; i += 2) {
|
||||
String key = (String) pairs[i];
|
||||
Object value = pairs[i + 1];
|
||||
map.put(key, value);
|
||||
@ -783,27 +789,27 @@ public class FaweCache {
|
||||
public static Tag asTag(Object value) {
|
||||
if (value instanceof Integer) {
|
||||
return asTag((int) value);
|
||||
} else if (value instanceof Short) {
|
||||
} else if (value instanceof Short) {
|
||||
return asTag((short) value);
|
||||
} else if (value instanceof Double) {
|
||||
} else if (value instanceof Double) {
|
||||
return asTag((double) value);
|
||||
} else if (value instanceof Byte) {
|
||||
} else if (value instanceof Byte) {
|
||||
return asTag((byte) value);
|
||||
} else if (value instanceof Float) {
|
||||
} else if (value instanceof Float) {
|
||||
return asTag((float) value);
|
||||
} else if (value instanceof Long) {
|
||||
} else if (value instanceof Long) {
|
||||
return asTag((long) value);
|
||||
} else if (value instanceof String) {
|
||||
} else if (value instanceof String) {
|
||||
return asTag((String) value);
|
||||
} else if (value instanceof Map) {
|
||||
} else if (value instanceof Map) {
|
||||
return asTag((Map) value);
|
||||
} else if (value instanceof Collection) {
|
||||
} else if (value instanceof Collection) {
|
||||
return asTag((Collection) value);
|
||||
} else if (value instanceof byte[]) {
|
||||
} else if (value instanceof byte[]) {
|
||||
return asTag((byte[]) value);
|
||||
} else if (value instanceof int[]) {
|
||||
} else if (value instanceof int[]) {
|
||||
return asTag((int[]) value);
|
||||
} else if (value instanceof Tag) {
|
||||
} else if (value instanceof Tag) {
|
||||
return (Tag) value;
|
||||
} else if (value == null) {
|
||||
System.out.println("Invalid nbt: " + value);
|
||||
|
@ -69,6 +69,7 @@ public class AnvilCommands {
|
||||
|
||||
/**
|
||||
* Run safely on an unloaded world (no selection)
|
||||
*
|
||||
* @param player
|
||||
* @param folder
|
||||
* @param filter
|
||||
@ -88,6 +89,7 @@ public class AnvilCommands {
|
||||
|
||||
/**
|
||||
* Run safely on an existing world within a selection
|
||||
*
|
||||
* @param player
|
||||
* @param editSession
|
||||
* @param selection
|
||||
@ -221,7 +223,7 @@ public class AnvilCommands {
|
||||
aliases = {"clear", "unset"},
|
||||
desc = "Clear the chunks in a selection (delete without defrag)"
|
||||
)
|
||||
@CommandPermissions("worldedit.anvil.replaceall")
|
||||
@CommandPermissions("worldedit.anvil.clear")
|
||||
public void unset(Player player, EditSession editSession, @Selection Region selection) throws WorldEditException {
|
||||
Vector bot = selection.getMinimumPoint();
|
||||
Vector top = selection.getMaximumPoint();
|
||||
@ -239,7 +241,7 @@ public class AnvilCommands {
|
||||
if (region.isIn(bx, bz) && region.isIn(bx + 511, bz + 511)) {
|
||||
file.setDeleted(true);
|
||||
get().add(512 * 512 * 256);
|
||||
} else if (region.isInMCA(X, Z)){
|
||||
} else if (region.isInMCA(X, Z)) {
|
||||
file.init();
|
||||
final byte[] empty = new byte[4];
|
||||
RandomAccessFile raf = file.getRandomAccessFile();
|
||||
@ -307,6 +309,7 @@ public class AnvilCommands {
|
||||
public void applyBlock(int x, int y, int z, BaseBlock block, long[] counts) {
|
||||
counts[block.getCombined()]++;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long[] init() {
|
||||
return new long[Character.MAX_VALUE + 1];
|
||||
@ -319,6 +322,7 @@ public class AnvilCommands {
|
||||
public void applyBlock(int x, int y, int z, BaseBlock block, long[] counts) {
|
||||
counts[block.getId()]++;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long[] init() {
|
||||
return new long[4096];
|
||||
@ -334,7 +338,7 @@ public class AnvilCommands {
|
||||
}
|
||||
ArrayList<long[]> map = new ArrayList<>();
|
||||
for (int i = 0; i < count.length; i++) {
|
||||
if (count[i] != 0) map.add(new long[] { i, count[i]});
|
||||
if (count[i] != 0) map.add(new long[]{i, count[i]});
|
||||
}
|
||||
Collections.sort(map, new Comparator<long[]>() {
|
||||
@Override
|
||||
@ -467,7 +471,7 @@ public class AnvilCommands {
|
||||
desc = "Paste chunks from your anvil clipboard",
|
||||
help =
|
||||
"Paste the chunks from your anvil clipboard.\n" +
|
||||
"The -c will align the paste to the chunks.",
|
||||
"The -c flag will align the paste to the chunks.",
|
||||
flags = "c"
|
||||
|
||||
)
|
||||
|
@ -36,7 +36,7 @@ public class Cancel extends FaweCommand {
|
||||
}
|
||||
}
|
||||
}
|
||||
BBC.WORLDEDIT_CANCEL_COUNT.send(player,cancelled);
|
||||
BBC.WORLDEDIT_CANCEL_COUNT.send(player, cancelled);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ import java.lang.annotation.Annotation;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class FawePrimitiveBinding extends BindingHelper {
|
||||
@BindingMatch(type = { Long.class, long.class },
|
||||
@BindingMatch(type = {Long.class, long.class},
|
||||
behavior = BindingBehavior.CONSUMES,
|
||||
consumedCount = 1,
|
||||
provideModifiers = true)
|
||||
@ -109,8 +109,8 @@ public class FawePrimitiveBinding extends BindingHelper {
|
||||
/**
|
||||
* Gets a type from a {@link ArgumentStack}.
|
||||
*
|
||||
* @param context the context
|
||||
* @param text the text annotation
|
||||
* @param context the context
|
||||
* @param text the text annotation
|
||||
* @param modifiers a list of modifiers
|
||||
* @return the requested type
|
||||
* @throws ParameterException on error
|
||||
@ -130,7 +130,7 @@ public class FawePrimitiveBinding extends BindingHelper {
|
||||
/**
|
||||
* Gets a type from a {@link ArgumentStack}.
|
||||
*
|
||||
* @param context the context
|
||||
* @param context the context
|
||||
* @param modifiers a list of modifiers
|
||||
* @return the requested type
|
||||
* @throws ParameterException on error
|
||||
@ -153,7 +153,7 @@ public class FawePrimitiveBinding extends BindingHelper {
|
||||
* @return the requested type
|
||||
* @throws ParameterException on error
|
||||
*/
|
||||
@BindingMatch(type = { Boolean.class, boolean.class },
|
||||
@BindingMatch(type = {Boolean.class, boolean.class},
|
||||
behavior = BindingBehavior.CONSUMES,
|
||||
consumedCount = 1)
|
||||
public Boolean getBoolean(ArgumentStack context) throws ParameterException {
|
||||
@ -167,7 +167,8 @@ public class FawePrimitiveBinding extends BindingHelper {
|
||||
* @return a number
|
||||
* @throws ParameterException thrown on parse error
|
||||
*/
|
||||
public static @Nullable
|
||||
public static
|
||||
@Nullable
|
||||
Double parseNumericInput(@Nullable String input) throws ParameterException {
|
||||
if (input == null) {
|
||||
return null;
|
||||
@ -191,12 +192,12 @@ public class FawePrimitiveBinding extends BindingHelper {
|
||||
/**
|
||||
* Gets a type from a {@link ArgumentStack}.
|
||||
*
|
||||
* @param context the context
|
||||
* @param context the context
|
||||
* @param modifiers a list of modifiers
|
||||
* @return the requested type
|
||||
* @throws ParameterException on error
|
||||
*/
|
||||
@BindingMatch(type = { Integer.class, int.class },
|
||||
@BindingMatch(type = {Integer.class, int.class},
|
||||
behavior = BindingBehavior.CONSUMES,
|
||||
consumedCount = 1,
|
||||
provideModifiers = true)
|
||||
@ -214,12 +215,12 @@ public class FawePrimitiveBinding extends BindingHelper {
|
||||
/**
|
||||
* Gets a type from a {@link ArgumentStack}.
|
||||
*
|
||||
* @param context the context
|
||||
* @param context the context
|
||||
* @param modifiers a list of modifiers
|
||||
* @return the requested type
|
||||
* @throws ParameterException on error
|
||||
*/
|
||||
@BindingMatch(type = { Short.class, short.class },
|
||||
@BindingMatch(type = {Short.class, short.class},
|
||||
behavior = BindingBehavior.CONSUMES,
|
||||
consumedCount = 1,
|
||||
provideModifiers = true)
|
||||
@ -234,12 +235,12 @@ public class FawePrimitiveBinding extends BindingHelper {
|
||||
/**
|
||||
* Gets a type from a {@link ArgumentStack}.
|
||||
*
|
||||
* @param context the context
|
||||
* @param context the context
|
||||
* @param modifiers a list of modifiers
|
||||
* @return the requested type
|
||||
* @throws ParameterException on error
|
||||
*/
|
||||
@BindingMatch(type = { Double.class, double.class },
|
||||
@BindingMatch(type = {Double.class, double.class},
|
||||
behavior = BindingBehavior.CONSUMES,
|
||||
consumedCount = 1,
|
||||
provideModifiers = true)
|
||||
@ -256,12 +257,12 @@ public class FawePrimitiveBinding extends BindingHelper {
|
||||
/**
|
||||
* Gets a type from a {@link ArgumentStack}.
|
||||
*
|
||||
* @param context the context
|
||||
* @param context the context
|
||||
* @param modifiers a list of modifiers
|
||||
* @return the requested type
|
||||
* @throws ParameterException on error
|
||||
*/
|
||||
@BindingMatch(type = { Float.class, float.class },
|
||||
@BindingMatch(type = {Float.class, float.class},
|
||||
behavior = BindingBehavior.CONSUMES,
|
||||
consumedCount = 1,
|
||||
provideModifiers = true)
|
||||
@ -276,7 +277,7 @@ public class FawePrimitiveBinding extends BindingHelper {
|
||||
/**
|
||||
* Validate a number value using relevant modifiers.
|
||||
*
|
||||
* @param number the number
|
||||
* @param number the number
|
||||
* @param modifiers the list of modifiers to scan
|
||||
* @throws ParameterException on a validation error
|
||||
*/
|
||||
@ -303,7 +304,7 @@ public class FawePrimitiveBinding extends BindingHelper {
|
||||
/**
|
||||
* Validate a number value using relevant modifiers.
|
||||
*
|
||||
* @param number the number
|
||||
* @param number the number
|
||||
* @param modifiers the list of modifiers to scan
|
||||
* @throws ParameterException on a validation error
|
||||
*/
|
||||
@ -330,7 +331,7 @@ public class FawePrimitiveBinding extends BindingHelper {
|
||||
/**
|
||||
* Validate a string value using relevant modifiers.
|
||||
*
|
||||
* @param string the string
|
||||
* @param string the string
|
||||
* @param modifiers the list of modifiers to scan
|
||||
* @throws ParameterException on a validation error
|
||||
*/
|
||||
|
@ -149,7 +149,8 @@ public class Rollback extends FaweCommand {
|
||||
} else {
|
||||
user = Fawe.imp().getUUID(split[1]);
|
||||
}
|
||||
} catch (IllegalArgumentException e) {}
|
||||
} catch (IllegalArgumentException e) {
|
||||
}
|
||||
if (user == null) {
|
||||
player.sendMessage("&dInvalid user: " + split[1]);
|
||||
return;
|
||||
|
@ -63,7 +63,8 @@ public class SuggestInputParseException extends InputParseException {
|
||||
}
|
||||
if (suggestions.isEmpty()) {
|
||||
suggestions.addAll(inputs);
|
||||
} return suggestions;
|
||||
}
|
||||
return suggestions;
|
||||
}
|
||||
|
||||
private static ArrayList<String> getSuggestions(String input, String... inputs) {
|
||||
|
@ -138,8 +138,8 @@ public enum BBC {
|
||||
ROLLBACK_ELEMENT("Undoing %s0", "WorldEdit.Rollback"),
|
||||
|
||||
TOOL_INSPECT("Inspect tool bound to %s0.", "WorldEdit.Tool"),
|
||||
TOOL_INSPECT_INFO("&7%s0 changed %s1 to %s2 %s3 ago","WorldEdit.Tool"),
|
||||
TOOL_INSPECT_INFO_FOOTER("&6Total: &7%s0 changes","WorldEdit.Tool"),
|
||||
TOOL_INSPECT_INFO("&7%s0 changed %s1 to %s2 %s3 ago", "WorldEdit.Tool"),
|
||||
TOOL_INSPECT_INFO_FOOTER("&6Total: &7%s0 changes", "WorldEdit.Tool"),
|
||||
TOOL_NONE("Tool unbound from your current item.", "WorldEdit.Tool"),
|
||||
TOOL_INFO("Info tool bound to %s0.", "WorldEdit.Tool"),
|
||||
TOOL_TREE("Tree tool bound to %s0.", "WorldEdit.Tool"),
|
||||
@ -220,7 +220,7 @@ public enum BBC {
|
||||
|
||||
COMMAND_SYNTAX("&cUsage: &7%s0", "Error"),
|
||||
NO_PERM("&cYou are lacking the permission node: %s0", "Error"),
|
||||
SETTING_DISABLE("&cLacking setting: %s0","Error"),
|
||||
SETTING_DISABLE("&cLacking setting: %s0", "Error"),
|
||||
BRUSH_NOT_FOUND("&cAvailable brushes: %s0", "Error"),
|
||||
BRUSH_INCOMPATIBLE("&cBrush not compatible with this version", "Error"),
|
||||
SCHEMATIC_NOT_FOUND("&cSchematic not found: &7%s0", "Error"),
|
||||
@ -313,32 +313,7 @@ public enum BBC {
|
||||
TIP_REGEN_1("Tip: Use a seed with /regen [biome] [seed]", "Tips"),
|
||||
|
||||
TIP_BIOME_PATTERN("Tip: The &c#biome:forest&7 pattern can be used in any command", "Tips"),
|
||||
TIP_BIOME_MASK("Tip: Restrict to a biome with the `$jungle` mask", "Tips"),
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
;
|
||||
TIP_BIOME_MASK("Tip: Restrict to a biome with the `$jungle` mask", "Tips"),;
|
||||
|
||||
|
||||
private static final HashMap<String, String> replacements = new HashMap<>();
|
||||
@ -371,7 +346,7 @@ public enum BBC {
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param d default
|
||||
* @param d default
|
||||
* @param prefix use prefix
|
||||
*/
|
||||
BBC(final String d, final boolean prefix, final String cat) {
|
||||
@ -550,34 +525,55 @@ public enum BBC {
|
||||
|
||||
public static String getColorName(char code) {
|
||||
switch (code) {
|
||||
case '0': return "BLACK";
|
||||
case '1': return "DARK_BLUE";
|
||||
case '2': return "DARK_GREEN";
|
||||
case '3': return "DARK_AQUA";
|
||||
case '4': return "DARK_RED";
|
||||
case '5': return "DARK_PURPLE";
|
||||
case '6': return "GOLD";
|
||||
case '0':
|
||||
return "BLACK";
|
||||
case '1':
|
||||
return "DARK_BLUE";
|
||||
case '2':
|
||||
return "DARK_GREEN";
|
||||
case '3':
|
||||
return "DARK_AQUA";
|
||||
case '4':
|
||||
return "DARK_RED";
|
||||
case '5':
|
||||
return "DARK_PURPLE";
|
||||
case '6':
|
||||
return "GOLD";
|
||||
default:
|
||||
case '7': return "GRAY";
|
||||
case '8': return "DARK_GRAY";
|
||||
case '9': return "BLUE";
|
||||
case 'a': return "GREEN";
|
||||
case 'b': return "AQUA";
|
||||
case 'c': return "RED";
|
||||
case 'd': return "LIGHT_PURPLE";
|
||||
case 'e': return "YELLOW";
|
||||
case 'f': return "WHITE";
|
||||
case 'k': return "OBFUSCATED";
|
||||
case 'l': return "BOLD";
|
||||
case 'm': return "STRIKETHROUGH";
|
||||
case 'n': return "UNDERLINE";
|
||||
case 'o': return "ITALIC";
|
||||
case 'r': return "RESET";
|
||||
case '7':
|
||||
return "GRAY";
|
||||
case '8':
|
||||
return "DARK_GRAY";
|
||||
case '9':
|
||||
return "BLUE";
|
||||
case 'a':
|
||||
return "GREEN";
|
||||
case 'b':
|
||||
return "AQUA";
|
||||
case 'c':
|
||||
return "RED";
|
||||
case 'd':
|
||||
return "LIGHT_PURPLE";
|
||||
case 'e':
|
||||
return "YELLOW";
|
||||
case 'f':
|
||||
return "WHITE";
|
||||
case 'k':
|
||||
return "OBFUSCATED";
|
||||
case 'l':
|
||||
return "BOLD";
|
||||
case 'm':
|
||||
return "STRIKETHROUGH";
|
||||
case 'n':
|
||||
return "UNDERLINE";
|
||||
case 'o':
|
||||
return "ITALIC";
|
||||
case 'r':
|
||||
return "RESET";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param m
|
||||
* @param runPart Part, Color, NewLine
|
||||
*/
|
||||
|
@ -29,7 +29,8 @@ public class Config {
|
||||
|
||||
/**
|
||||
* Get the value for a node<br>
|
||||
* Probably throws some error if you try to get a non existent key
|
||||
* Probably throws some error if you try to get a non existent key
|
||||
*
|
||||
* @param key
|
||||
* @param <T>
|
||||
* @return
|
||||
@ -53,10 +54,10 @@ public class Config {
|
||||
|
||||
/**
|
||||
* Set the value of a specific node<br>
|
||||
* Probably throws some error if you supply non existing keys or invalid values
|
||||
* @param key config node
|
||||
* @param value value
|
||||
* Probably throws some error if you supply non existing keys or invalid values
|
||||
*
|
||||
* @param key config node
|
||||
* @param value value
|
||||
*/
|
||||
private void set(String key, Object value, Class root) {
|
||||
String[] split = key.split("\\.");
|
||||
@ -98,6 +99,7 @@ public class Config {
|
||||
|
||||
/**
|
||||
* Set all values in the file (load first to avoid overwriting)
|
||||
*
|
||||
* @param file
|
||||
*/
|
||||
public void save(File file) {
|
||||
@ -124,20 +126,22 @@ public class Config {
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.FIELD})
|
||||
public @interface Create {}
|
||||
public @interface Create {
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates that a field cannot be modified
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.FIELD})
|
||||
public @interface Final {}
|
||||
public @interface Final {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a comment
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.FIELD,ElementType.TYPE})
|
||||
@Target({ElementType.FIELD, ElementType.TYPE})
|
||||
public @interface Comment {
|
||||
String[] value();
|
||||
}
|
||||
@ -146,7 +150,7 @@ public class Config {
|
||||
* The names of any default blocks
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.FIELD,ElementType.TYPE})
|
||||
@Target({ElementType.FIELD, ElementType.TYPE})
|
||||
public @interface BlockName {
|
||||
String[] value();
|
||||
}
|
||||
@ -155,8 +159,9 @@ public class Config {
|
||||
* Any field or class with is not part of the config
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.FIELD,ElementType.TYPE})
|
||||
public @interface Ignore {}
|
||||
@Target({ElementType.FIELD, ElementType.TYPE})
|
||||
public @interface Ignore {
|
||||
}
|
||||
|
||||
@Ignore // This is not part of the config
|
||||
public static class ConfigBlock<T> {
|
||||
@ -190,6 +195,7 @@ public class Config {
|
||||
|
||||
/**
|
||||
* Get the static fields in a section
|
||||
*
|
||||
* @param clazz
|
||||
* @return
|
||||
*/
|
||||
@ -257,7 +263,7 @@ public class Config {
|
||||
}
|
||||
}
|
||||
BlockName blockNames = current.getAnnotation(BlockName.class);
|
||||
if (blockNames != null) {
|
||||
if (blockNames != null) {
|
||||
writer.write(spacing + toNodeName(current.getSimpleName()) + ":" + CTRF);
|
||||
ConfigBlock configBlock = (ConfigBlock) field.get(instance);
|
||||
if (configBlock == null || configBlock.getInstances().isEmpty()) {
|
||||
@ -307,6 +313,7 @@ public class Config {
|
||||
|
||||
/**
|
||||
* Get the field for a specific config node
|
||||
*
|
||||
* @param split the node (split by period)
|
||||
* @return
|
||||
*/
|
||||
@ -320,8 +327,9 @@ public class Config {
|
||||
|
||||
/**
|
||||
* Get the field for a specific config node and instance<br>
|
||||
* Note: As expiry can have multiple blocks there will be multiple instances
|
||||
* @param split the node (split by period)
|
||||
* Note: As expiry can have multiple blocks there will be multiple instances
|
||||
*
|
||||
* @param split the node (split by period)
|
||||
* @param instance the instance
|
||||
* @return
|
||||
*/
|
||||
@ -339,12 +347,14 @@ public class Config {
|
||||
private Object getInstance(Object instance, Class clazz) throws IllegalAccessException, InstantiationException {
|
||||
try {
|
||||
Field instanceField = clazz.getDeclaredField(clazz.getSimpleName());
|
||||
} catch (Throwable ignore) {}
|
||||
} catch (Throwable ignore) {
|
||||
}
|
||||
return clazz.newInstance();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the instance for a specific config node
|
||||
*
|
||||
* @param split the node (split by period)
|
||||
* @return The instance or null
|
||||
*/
|
||||
@ -392,7 +402,8 @@ public class Config {
|
||||
clazz = found;
|
||||
split = Arrays.copyOfRange(split, 2, split.length);
|
||||
continue;
|
||||
} catch (NoSuchFieldException ignore) {}
|
||||
} catch (NoSuchFieldException ignore) {
|
||||
}
|
||||
if (found != null) {
|
||||
split = Arrays.copyOfRange(split, 1, split.length);
|
||||
clazz = found;
|
||||
@ -410,24 +421,27 @@ public class Config {
|
||||
|
||||
/**
|
||||
* Translate a node to a java field name
|
||||
*
|
||||
* @param node
|
||||
* @return
|
||||
*/
|
||||
private String toFieldName(String node) {
|
||||
return node.toUpperCase().replaceAll("-","_");
|
||||
return node.toUpperCase().replaceAll("-", "_");
|
||||
}
|
||||
|
||||
/**
|
||||
* Translate a field to a config node
|
||||
*
|
||||
* @param field
|
||||
* @return
|
||||
*/
|
||||
private String toNodeName(String field) {
|
||||
return field.toLowerCase().replace("_","-");
|
||||
return field.toLowerCase().replace("_", "-");
|
||||
}
|
||||
|
||||
/**
|
||||
* Set some field to be accesible
|
||||
*
|
||||
* @param field
|
||||
* @throws NoSuchFieldException
|
||||
* @throws IllegalAccessException
|
||||
|
@ -26,7 +26,7 @@ public class Settings extends Config {
|
||||
public String PLATFORM; // These values are set from FAWE before loading
|
||||
|
||||
@Comment({"Options: de",
|
||||
"Create a PR to contribute a translation: https://github.com/boy0001/FastAsyncWorldedit/new/master/core/src/main/resources",})
|
||||
"Create a PR to contribute a translation: https://github.com/boy0001/FastAsyncWorldedit/new/master/core/src/main/resources",})
|
||||
public String LANGUAGE = "";
|
||||
@Comment("Allow the plugin to update")
|
||||
public boolean UPDATE = true;
|
||||
@ -232,11 +232,11 @@ public class Settings extends Config {
|
||||
@Create
|
||||
public static PROGRESS PROGRESS;
|
||||
@Comment({
|
||||
"When doing edits that effect more than this many chunks:",
|
||||
" - FAWE will start placing before all calculations are finished",
|
||||
" - A larger value will use slightly less CPU time",
|
||||
" - A smaller value will reduce memory usage",
|
||||
" - A value too small may break some operations (deform?)"
|
||||
"When doing edits that effect more than this many chunks:",
|
||||
" - FAWE will start placing before all calculations are finished",
|
||||
" - A larger value will use slightly less CPU time",
|
||||
" - A smaller value will reduce memory usage",
|
||||
" - A value too small may break some operations (deform?)"
|
||||
|
||||
})
|
||||
public int TARGET_SIZE = 64;
|
||||
|
@ -16,11 +16,12 @@ public interface Configuration extends ConfigurationSection {
|
||||
* If value is null, the value will be removed from the default
|
||||
* Configuration source.
|
||||
*
|
||||
* @param path Path of the value to set.
|
||||
* @param path Path of the value to set.
|
||||
* @param value Value to set the default to.
|
||||
* @throws IllegalArgumentException Thrown if path is null.
|
||||
*/
|
||||
@Override void addDefault(final String path, final Object value);
|
||||
@Override
|
||||
void addDefault(final String path, final Object value);
|
||||
|
||||
/**
|
||||
* Sets the default values of the given paths as provided.
|
||||
|
@ -20,7 +20,7 @@ public interface ConfigurationSection {
|
||||
* direct children, and not their own children.
|
||||
*
|
||||
* @param deep Whether or not to get a deep list, as opposed to a shallow
|
||||
* list.
|
||||
* list.
|
||||
* @return Set of keys contained within this ConfigurationSection.
|
||||
*/
|
||||
Set<String> getKeys(boolean deep);
|
||||
@ -36,7 +36,7 @@ public interface ConfigurationSection {
|
||||
* values of any direct children, and not their own children.
|
||||
*
|
||||
* @param deep Whether or not to get a deep list, as opposed to a shallow
|
||||
* list.
|
||||
* list.
|
||||
* @return Map of keys and values of this section.
|
||||
*/
|
||||
Map<String, Object> getValues(boolean deep);
|
||||
@ -49,7 +49,7 @@ public interface ConfigurationSection {
|
||||
*
|
||||
* @param path Path to check for existence.
|
||||
* @return True if this section contains the requested path, either via
|
||||
* default or being set.
|
||||
* default or being set.
|
||||
* @throws IllegalArgumentException Thrown when path is null.
|
||||
*/
|
||||
boolean contains(String path);
|
||||
@ -63,7 +63,7 @@ public interface ConfigurationSection {
|
||||
*
|
||||
* @param path Path to check for existence.
|
||||
* @return True if this section contains the requested path, regardless of
|
||||
* having a default.
|
||||
* having a default.
|
||||
* @throws IllegalArgumentException Thrown when path is null.
|
||||
*/
|
||||
boolean isSet(String path);
|
||||
@ -144,7 +144,7 @@ public interface ConfigurationSection {
|
||||
* {@link com.boydti.fawe.configuration.Configuration}.
|
||||
*
|
||||
* @param path Path of the Object to get.
|
||||
* @param def The default value to return if the path is not found.
|
||||
* @param def The default value to return if the path is not found.
|
||||
* @return Requested Object.
|
||||
*/
|
||||
Object get(String path, Object def);
|
||||
@ -160,7 +160,7 @@ public interface ConfigurationSection {
|
||||
* you to store {@link com.boydti.fawe.configuration.Configuration}s or {@link com.boydti.fawe.configuration.ConfigurationSection}s,
|
||||
* please use {@link #createSection(String)} for that.
|
||||
*
|
||||
* @param path Path of the object to set.
|
||||
* @param path Path of the object to set.
|
||||
* @param value New value to set the path to.
|
||||
*/
|
||||
void set(String path, Object value);
|
||||
@ -186,7 +186,7 @@ public interface ConfigurationSection {
|
||||
* be orphaned.
|
||||
*
|
||||
* @param path Path to create the section at.
|
||||
* @param map The values to used.
|
||||
* @param map The values to used.
|
||||
* @return Newly created section
|
||||
*/
|
||||
com.boydti.fawe.configuration.ConfigurationSection createSection(String path, Map<?, ?> map);
|
||||
@ -214,15 +214,15 @@ public interface ConfigurationSection {
|
||||
* {@link com.boydti.fawe.configuration.Configuration}.
|
||||
*
|
||||
* @param path Path of the String to get.
|
||||
* @param def The default value to return if the path is not found or is
|
||||
* not a String.
|
||||
* @param def The default value to return if the path is not found or is
|
||||
* not a String.
|
||||
* @return Requested String.
|
||||
*/
|
||||
String getString(String path, String def);
|
||||
|
||||
/**
|
||||
* Checks if the specified path is a String.
|
||||
*
|
||||
* <p>
|
||||
* <p> If the path exists but is not a String, this will return false. If the
|
||||
* path does not exist, this will return false. If the path does not exist
|
||||
* but a default value has been specified, this will check if that default
|
||||
@ -235,7 +235,7 @@ public interface ConfigurationSection {
|
||||
|
||||
/**
|
||||
* Gets the requested int by path.
|
||||
*
|
||||
* <p>
|
||||
* <p>If the int does not exist but a default value has been specified, this
|
||||
* will return the default value. If the int does not exist and no default
|
||||
* value was specified, this will return 0.</p>
|
||||
@ -247,21 +247,21 @@ public interface ConfigurationSection {
|
||||
|
||||
/**
|
||||
* Gets the requested int by path, returning a default value if not found.
|
||||
*
|
||||
* <p>
|
||||
* <p>If the int does not exist then the specified default value will
|
||||
* returned regardless of if a default has been identified in the root
|
||||
* {@link com.boydti.fawe.configuration.Configuration}.</p>
|
||||
*
|
||||
* @param path Path of the int to get.
|
||||
* @param def The default value to return if the path is not found or is
|
||||
* not an int.
|
||||
* @param def The default value to return if the path is not found or is
|
||||
* not an int.
|
||||
* @return Requested int.
|
||||
*/
|
||||
int getInt(String path, int def);
|
||||
|
||||
/**
|
||||
* Checks if the specified path is an int.
|
||||
*
|
||||
* <p>
|
||||
* <p>If the path exists but is not a int, this will return false. If the
|
||||
* path does not exist, this will return false. If the path does not exist
|
||||
* but a default value has been specified, this will check if that default
|
||||
@ -293,8 +293,8 @@ public interface ConfigurationSection {
|
||||
* {@link com.boydti.fawe.configuration.Configuration}.
|
||||
*
|
||||
* @param path Path of the boolean to get.
|
||||
* @param def The default value to return if the path is not found or is
|
||||
* not a boolean.
|
||||
* @param def The default value to return if the path is not found or is
|
||||
* not a boolean.
|
||||
* @return Requested boolean.
|
||||
*/
|
||||
boolean getBoolean(String path, boolean def);
|
||||
@ -333,8 +333,8 @@ public interface ConfigurationSection {
|
||||
* {@link com.boydti.fawe.configuration.Configuration}.
|
||||
*
|
||||
* @param path Path of the double to get.
|
||||
* @param def The default value to return if the path is not found or is
|
||||
* not a double.
|
||||
* @param def The default value to return if the path is not found or is
|
||||
* not a double.
|
||||
* @return Requested double.
|
||||
*/
|
||||
double getDouble(String path, double def);
|
||||
@ -373,8 +373,8 @@ public interface ConfigurationSection {
|
||||
* {@link com.boydti.fawe.configuration.Configuration}.
|
||||
*
|
||||
* @param path Path of the long to get.
|
||||
* @param def The default value to return if the path is not found or is
|
||||
* not a long.
|
||||
* @param def The default value to return if the path is not found or is
|
||||
* not a long.
|
||||
* @return Requested long.
|
||||
*/
|
||||
long getLong(String path, long def);
|
||||
@ -415,8 +415,8 @@ public interface ConfigurationSection {
|
||||
* {@link com.boydti.fawe.configuration.Configuration}.
|
||||
*
|
||||
* @param path Path of the List to get.
|
||||
* @param def The default value to return if the path is not found or is
|
||||
* not a List.
|
||||
* @param def The default value to return if the path is not found or is
|
||||
* not a List.
|
||||
* @return Requested List.
|
||||
*/
|
||||
List<?> getList(String path, List<?> def);
|
||||
@ -637,7 +637,7 @@ public interface ConfigurationSection {
|
||||
* this will create a new section at the path, replacing anything that may
|
||||
* have existed there previously.
|
||||
*
|
||||
* @param path Path of the value to set.
|
||||
* @param path Path of the value to set.
|
||||
* @param value Value to set the default to.
|
||||
* @throws IllegalArgumentException Thrown if path is null.
|
||||
*/
|
||||
|
@ -5,13 +5,14 @@ package com.boydti.fawe.configuration;
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class InvalidConfigurationException extends Exception {
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new instance of InvalidConfigurationException without a
|
||||
* message or cause.
|
||||
*/
|
||||
public InvalidConfigurationException() {}
|
||||
|
||||
public InvalidConfigurationException() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an instance of InvalidConfigurationException with the
|
||||
* specified message.
|
||||
@ -21,7 +22,7 @@ public class InvalidConfigurationException extends Exception {
|
||||
public InvalidConfigurationException(final String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructs an instance of InvalidConfigurationException with the
|
||||
* specified cause.
|
||||
@ -31,13 +32,13 @@ public class InvalidConfigurationException extends Exception {
|
||||
public InvalidConfigurationException(final Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructs an instance of InvalidConfigurationException with the
|
||||
* specified message and cause.
|
||||
*
|
||||
* @param cause The cause of the exception.
|
||||
* @param msg The details of the exception.
|
||||
* @param msg The details of the exception.
|
||||
*/
|
||||
public InvalidConfigurationException(final String msg, final Throwable cause) {
|
||||
super(msg, cause);
|
||||
|
@ -14,7 +14,8 @@ public class MemoryConfiguration extends MemorySection implements Configuration
|
||||
/**
|
||||
* Creates an empty {@link com.boydti.fawe.configuration.MemoryConfiguration} with no default values.
|
||||
*/
|
||||
public MemoryConfiguration() {}
|
||||
public MemoryConfiguration() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an empty {@link com.boydti.fawe.configuration.MemoryConfiguration} using the specified {@link
|
||||
@ -83,7 +84,7 @@ public class MemoryConfiguration extends MemorySection implements Configuration
|
||||
if (options == null) {
|
||||
options = new MemoryConfigurationOptions(this);
|
||||
}
|
||||
|
||||
|
||||
return options;
|
||||
}
|
||||
}
|
||||
|
@ -8,18 +8,18 @@ public class MemoryConfigurationOptions extends ConfigurationOptions {
|
||||
protected MemoryConfigurationOptions(final MemoryConfiguration configuration) {
|
||||
super(configuration);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public MemoryConfiguration configuration() {
|
||||
return (MemoryConfiguration) super.configuration();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public com.boydti.fawe.configuration.MemoryConfigurationOptions copyDefaults(final boolean value) {
|
||||
super.copyDefaults(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public com.boydti.fawe.configuration.MemoryConfigurationOptions pathSeparator(final char value) {
|
||||
super.pathSeparator(value);
|
||||
|
@ -26,7 +26,7 @@ public class MemorySection implements com.boydti.fawe.configuration.Configuratio
|
||||
* will throw an exception!
|
||||
*
|
||||
* @throws IllegalStateException Thrown if this is not a {@link
|
||||
* com.boydti.fawe.configuration.Configuration} root.
|
||||
* com.boydti.fawe.configuration.Configuration} root.
|
||||
*/
|
||||
protected MemorySection() {
|
||||
if (!(this instanceof Configuration)) {
|
||||
@ -43,10 +43,10 @@ public class MemorySection implements com.boydti.fawe.configuration.Configuratio
|
||||
* Creates an empty MemorySection with the specified parent and path.
|
||||
*
|
||||
* @param parent Parent section that contains this own section.
|
||||
* @param path Path that you may access this section from via the root
|
||||
* {@link com.boydti.fawe.configuration.Configuration}.
|
||||
* @param path Path that you may access this section from via the root
|
||||
* {@link com.boydti.fawe.configuration.Configuration}.
|
||||
* @throws IllegalArgumentException Thrown is parent or path is null, or
|
||||
* if parent contains no root Configuration.
|
||||
* if parent contains no root Configuration.
|
||||
*/
|
||||
protected MemorySection(com.boydti.fawe.configuration.ConfigurationSection parent, String path) {
|
||||
if (parent == null) {
|
||||
@ -129,7 +129,7 @@ public class MemorySection implements com.boydti.fawe.configuration.Configuratio
|
||||
* only {@link com.boydti.fawe.configuration.MemorySection}.
|
||||
*
|
||||
* @param section Section to create a path for.
|
||||
* @param key Name of the specified section.
|
||||
* @param key Name of the specified section.
|
||||
* @return Full path of the section from its root.
|
||||
*/
|
||||
public static String createPath(com.boydti.fawe.configuration.ConfigurationSection section, String key) {
|
||||
@ -143,8 +143,8 @@ public class MemorySection implements com.boydti.fawe.configuration.Configuratio
|
||||
* You may use this method for any given {@link com.boydti.fawe.configuration.ConfigurationSection}, not
|
||||
* only {@link com.boydti.fawe.configuration.MemorySection}.
|
||||
*
|
||||
* @param section Section to create a path for.
|
||||
* @param key Name of the specified section.
|
||||
* @param section Section to create a path for.
|
||||
* @param key Name of the specified section.
|
||||
* @param relativeTo Section to create the path relative to.
|
||||
* @return Full path of the section from its root.
|
||||
*/
|
||||
|
@ -1,12 +1,12 @@
|
||||
/**
|
||||
* Copyright (c) 2008, http://www.snakeyaml.org
|
||||
*
|
||||
* <p>
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* <p>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@ -17,7 +17,6 @@ package org.yaml.snakeyaml;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.yaml.snakeyaml.nodes.Tag;
|
||||
|
||||
/**
|
||||
@ -49,7 +48,7 @@ public final class TypeDescription {
|
||||
|
||||
/**
|
||||
* Get tag which shall be used to load or dump the type (class).
|
||||
*
|
||||
*
|
||||
* @return tag to be used. It may be a tag for Language-Independent Types
|
||||
* (http://www.yaml.org/type/)
|
||||
*/
|
||||
@ -59,7 +58,7 @@ public final class TypeDescription {
|
||||
|
||||
/**
|
||||
* Set tag to be used to load or dump the type (class).
|
||||
*
|
||||
*
|
||||
* @param tag
|
||||
* local or global tag
|
||||
*/
|
||||
@ -73,7 +72,7 @@ public final class TypeDescription {
|
||||
|
||||
/**
|
||||
* Get represented type (class)
|
||||
*
|
||||
*
|
||||
* @return type (class) to be described.
|
||||
*/
|
||||
public Class<? extends Object> getType() {
|
||||
@ -82,7 +81,7 @@ public final class TypeDescription {
|
||||
|
||||
/**
|
||||
* Specify that the property is a type-safe <code>List</code>.
|
||||
*
|
||||
*
|
||||
* @param property
|
||||
* name of the JavaBean property
|
||||
* @param type
|
||||
@ -94,7 +93,7 @@ public final class TypeDescription {
|
||||
|
||||
/**
|
||||
* Get class of List values for provided JavaBean property.
|
||||
*
|
||||
*
|
||||
* @param property
|
||||
* property name
|
||||
* @return class of List values
|
||||
@ -105,7 +104,7 @@ public final class TypeDescription {
|
||||
|
||||
/**
|
||||
* Specify that the property is a type-safe <code>Map</code>.
|
||||
*
|
||||
*
|
||||
* @param property
|
||||
* property name of this JavaBean
|
||||
* @param key
|
||||
@ -114,14 +113,14 @@ public final class TypeDescription {
|
||||
* class of values in Map
|
||||
*/
|
||||
public void putMapPropertyType(String property, Class<? extends Object> key,
|
||||
Class<? extends Object> value) {
|
||||
Class<? extends Object> value) {
|
||||
keyProperties.put(property, key);
|
||||
valueProperties.put(property, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get keys type info for this JavaBean
|
||||
*
|
||||
*
|
||||
* @param property
|
||||
* property name of this JavaBean
|
||||
* @return class of keys in the Map
|
||||
@ -132,7 +131,7 @@ public final class TypeDescription {
|
||||
|
||||
/**
|
||||
* Get values type info for this JavaBean
|
||||
*
|
||||
*
|
||||
* @param property
|
||||
* property name of this JavaBean
|
||||
* @return class of values in the Map
|
||||
|
@ -1,12 +1,12 @@
|
||||
/**
|
||||
* Copyright (c) 2008, http://www.snakeyaml.org
|
||||
*
|
||||
* <p>
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* <p>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@ -25,7 +25,6 @@ import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.yaml.snakeyaml.DumperOptions.FlowStyle;
|
||||
import org.yaml.snakeyaml.composer.Composer;
|
||||
import org.yaml.snakeyaml.constructor.BaseConstructor;
|
||||
@ -65,7 +64,7 @@ public class Yaml {
|
||||
|
||||
/**
|
||||
* Create Yaml instance.
|
||||
*
|
||||
*
|
||||
* @param dumperOptions
|
||||
* DumperOptions to configure outgoing objects
|
||||
*/
|
||||
@ -76,7 +75,7 @@ public class Yaml {
|
||||
/**
|
||||
* Create Yaml instance. It is safe to create a few instances and use them
|
||||
* in different Threads.
|
||||
*
|
||||
*
|
||||
* @param representer
|
||||
* Representer to emit outgoing objects
|
||||
*/
|
||||
@ -87,7 +86,7 @@ public class Yaml {
|
||||
/**
|
||||
* Create Yaml instance. It is safe to create a few instances and use them
|
||||
* in different Threads.
|
||||
*
|
||||
*
|
||||
* @param constructor
|
||||
* BaseConstructor to construct incoming documents
|
||||
*/
|
||||
@ -98,7 +97,7 @@ public class Yaml {
|
||||
/**
|
||||
* Create Yaml instance. It is safe to create a few instances and use them
|
||||
* in different Threads.
|
||||
*
|
||||
*
|
||||
* @param constructor
|
||||
* BaseConstructor to construct incoming documents
|
||||
* @param representer
|
||||
@ -111,7 +110,7 @@ public class Yaml {
|
||||
/**
|
||||
* Create Yaml instance. It is safe to create a few instances and use them
|
||||
* in different Threads.
|
||||
*
|
||||
*
|
||||
* @param representer
|
||||
* Representer to emit outgoing objects
|
||||
* @param dumperOptions
|
||||
@ -124,7 +123,7 @@ public class Yaml {
|
||||
/**
|
||||
* Create Yaml instance. It is safe to create a few instances and use them
|
||||
* in different Threads.
|
||||
*
|
||||
*
|
||||
* @param constructor
|
||||
* BaseConstructor to construct incoming documents
|
||||
* @param representer
|
||||
@ -139,7 +138,7 @@ public class Yaml {
|
||||
/**
|
||||
* Create Yaml instance. It is safe to create a few instances and use them
|
||||
* in different Threads.
|
||||
*
|
||||
*
|
||||
* @param constructor
|
||||
* BaseConstructor to construct incoming documents
|
||||
* @param representer
|
||||
@ -150,7 +149,7 @@ public class Yaml {
|
||||
* Resolver to detect implicit type
|
||||
*/
|
||||
public Yaml(BaseConstructor constructor, Representer representer, DumperOptions dumperOptions,
|
||||
Resolver resolver) {
|
||||
Resolver resolver) {
|
||||
if (!constructor.isExplicitPropertyUtils()) {
|
||||
constructor.setPropertyUtils(representer.getPropertyUtils());
|
||||
} else if (!representer.isExplicitPropertyUtils()) {
|
||||
@ -170,7 +169,7 @@ public class Yaml {
|
||||
|
||||
/**
|
||||
* Serialize a Java object into a YAML String.
|
||||
*
|
||||
*
|
||||
* @param data
|
||||
* Java object to be Serialized to YAML
|
||||
* @return YAML String
|
||||
@ -183,7 +182,7 @@ public class Yaml {
|
||||
|
||||
/**
|
||||
* Produce the corresponding representation tree for a given Object.
|
||||
*
|
||||
*
|
||||
* @see <a href="http://yaml.org/spec/1.1/#id859333">Figure 3.1. Processing
|
||||
* Overview</a>
|
||||
* @param data
|
||||
@ -196,7 +195,7 @@ public class Yaml {
|
||||
|
||||
/**
|
||||
* Serialize a sequence of Java objects into a YAML String.
|
||||
*
|
||||
*
|
||||
* @param data
|
||||
* Iterator with Objects
|
||||
* @return YAML String with all the objects in proper sequence
|
||||
@ -209,7 +208,7 @@ public class Yaml {
|
||||
|
||||
/**
|
||||
* Serialize a Java object into a YAML stream.
|
||||
*
|
||||
*
|
||||
* @param data
|
||||
* Java object to be serialized to YAML
|
||||
* @param output
|
||||
@ -223,7 +222,7 @@ public class Yaml {
|
||||
|
||||
/**
|
||||
* Serialize a sequence of Java objects into a YAML stream.
|
||||
*
|
||||
*
|
||||
* @param data
|
||||
* Iterator with Objects
|
||||
* @param output
|
||||
@ -253,26 +252,26 @@ public class Yaml {
|
||||
* Serialize a Java object into a YAML string. Override the default root tag
|
||||
* with <code>rootTag</code>.
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* This method is similar to <code>Yaml.dump(data)</code> except that the
|
||||
* root tag for the whole document is replaced with the given tag. This has
|
||||
* two main uses.
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* First, if the root tag is replaced with a standard YAML tag, such as
|
||||
* <code>Tag.MAP</code>, then the object will be dumped as a map. The root
|
||||
* tag will appear as <code>!!map</code>, or blank (implicit !!map).
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* Second, if the root tag is replaced by a different custom tag, then the
|
||||
* document appears to be a different type when loaded. For example, if an
|
||||
* instance of MyClass is dumped with the tag !!YourClass, then it will be
|
||||
* handled as an instance of YourClass when loaded.
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* @param data
|
||||
* Java object to be serialized to YAML
|
||||
* @param rootTag
|
||||
@ -285,7 +284,7 @@ public class Yaml {
|
||||
* Styles http://yaml.org/spec/1.1/#id930798. If
|
||||
* <code>null</code> is provided then the flow style from
|
||||
* DumperOptions is used.
|
||||
*
|
||||
*
|
||||
* @return YAML String
|
||||
*/
|
||||
public String dumpAs(Object data, Tag rootTag, FlowStyle flowStyle) {
|
||||
@ -315,7 +314,7 @@ public class Yaml {
|
||||
* Block Mapping is used as the collection style. See 10.2.2. Block Mappings
|
||||
* (http://yaml.org/spec/1.1/#id934537)
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* @param data
|
||||
* Java object to be serialized to YAML
|
||||
* @return YAML String
|
||||
@ -326,7 +325,7 @@ public class Yaml {
|
||||
|
||||
/**
|
||||
* Serialize the representation tree into Events.
|
||||
*
|
||||
*
|
||||
* @see <a href="http://yaml.org/spec/1.1/#id859333">Processing Overview</a>
|
||||
* @param data
|
||||
* representation tree
|
||||
@ -360,7 +359,7 @@ public class Yaml {
|
||||
/**
|
||||
* Parse the only YAML document in a String and produce the corresponding
|
||||
* Java object. (Because the encoding in known BOM is not respected.)
|
||||
*
|
||||
*
|
||||
* @param yaml
|
||||
* YAML data to load from (BOM must not be present)
|
||||
* @return parsed object
|
||||
@ -372,7 +371,7 @@ public class Yaml {
|
||||
/**
|
||||
* Parse the only YAML document in a stream and produce the corresponding
|
||||
* Java object.
|
||||
*
|
||||
*
|
||||
* @param io
|
||||
* data to load from (BOM is respected and removed)
|
||||
* @return parsed object
|
||||
@ -384,7 +383,7 @@ public class Yaml {
|
||||
/**
|
||||
* Parse the only YAML document in a stream and produce the corresponding
|
||||
* Java object.
|
||||
*
|
||||
*
|
||||
* @param io
|
||||
* data to load from (BOM must not be present)
|
||||
* @return parsed object
|
||||
@ -396,7 +395,7 @@ public class Yaml {
|
||||
/**
|
||||
* Parse the only YAML document in a stream and produce the corresponding
|
||||
* Java object.
|
||||
*
|
||||
*
|
||||
* @param <T>
|
||||
* Class is defined by the second argument
|
||||
* @param io
|
||||
@ -413,7 +412,7 @@ public class Yaml {
|
||||
/**
|
||||
* Parse the only YAML document in a String and produce the corresponding
|
||||
* Java object. (Because the encoding in known BOM is not respected.)
|
||||
*
|
||||
*
|
||||
* @param <T>
|
||||
* Class is defined by the second argument
|
||||
* @param yaml
|
||||
@ -430,7 +429,7 @@ public class Yaml {
|
||||
/**
|
||||
* Parse the only YAML document in a stream and produce the corresponding
|
||||
* Java object.
|
||||
*
|
||||
*
|
||||
* @param <T>
|
||||
* Class is defined by the second argument
|
||||
* @param input
|
||||
@ -453,7 +452,7 @@ public class Yaml {
|
||||
/**
|
||||
* Parse all YAML documents in a String and produce corresponding Java
|
||||
* objects. The documents are parsed only when the iterator is invoked.
|
||||
*
|
||||
*
|
||||
* @param yaml
|
||||
* YAML data to load from (BOM must not be present)
|
||||
* @return an iterator over the parsed Java objects in this String in proper
|
||||
@ -494,7 +493,7 @@ public class Yaml {
|
||||
* Parse all YAML documents in a String and produce corresponding Java
|
||||
* objects. (Because the encoding in known BOM is not respected.) The
|
||||
* documents are parsed only when the iterator is invoked.
|
||||
*
|
||||
*
|
||||
* @param yaml
|
||||
* YAML data to load from (BOM must not be present)
|
||||
* @return an iterator over the parsed Java objects in this String in proper
|
||||
@ -507,7 +506,7 @@ public class Yaml {
|
||||
/**
|
||||
* Parse all YAML documents in a stream and produce corresponding Java
|
||||
* objects. The documents are parsed only when the iterator is invoked.
|
||||
*
|
||||
*
|
||||
* @param yaml
|
||||
* YAML data to load from (BOM is respected and ignored)
|
||||
* @return an iterator over the parsed Java objects in this stream in proper
|
||||
@ -520,7 +519,7 @@ public class Yaml {
|
||||
/**
|
||||
* Parse the first YAML document in a stream and produce the corresponding
|
||||
* representation tree. (This is the opposite of the represent() method)
|
||||
*
|
||||
*
|
||||
* @see <a href="http://yaml.org/spec/1.1/#id859333">Figure 3.1. Processing
|
||||
* Overview</a>
|
||||
* @param yaml
|
||||
@ -536,7 +535,7 @@ public class Yaml {
|
||||
/**
|
||||
* Parse all YAML documents in a stream and produce corresponding
|
||||
* representation trees.
|
||||
*
|
||||
*
|
||||
* @see <a href="http://yaml.org/spec/1.1/#id859333">Processing Overview</a>
|
||||
* @param yaml
|
||||
* stream of YAML documents
|
||||
@ -576,7 +575,7 @@ public class Yaml {
|
||||
/**
|
||||
* Add an implicit scalar detector. If an implicit scalar value matches the
|
||||
* given regexp, the corresponding tag is assigned to the scalar.
|
||||
*
|
||||
*
|
||||
* @param tag
|
||||
* tag to assign to the node
|
||||
* @param regexp
|
||||
@ -598,7 +597,7 @@ public class Yaml {
|
||||
* Get a meaningful name. It simplifies debugging in a multi-threaded
|
||||
* environment. If nothing is set explicitly the address of the instance is
|
||||
* returned.
|
||||
*
|
||||
*
|
||||
* @return human readable name
|
||||
*/
|
||||
public String getName() {
|
||||
@ -607,7 +606,7 @@ public class Yaml {
|
||||
|
||||
/**
|
||||
* Set a meaningful name to be shown in toString()
|
||||
*
|
||||
*
|
||||
* @param name
|
||||
* human readable name
|
||||
*/
|
||||
@ -617,7 +616,7 @@ public class Yaml {
|
||||
|
||||
/**
|
||||
* Parse a YAML stream and produce parsing events.
|
||||
*
|
||||
*
|
||||
* @see <a href="http://yaml.org/spec/1.1/#id859333">Processing Overview</a>
|
||||
* @param yaml
|
||||
* YAML document(s)
|
||||
|
@ -47,8 +47,8 @@ public abstract class FileConfiguration extends MemoryConfiguration {
|
||||
* using UTF8.
|
||||
*
|
||||
* @param file File to save to.
|
||||
* @throws java.io.IOException Thrown when the given file cannot be written to for
|
||||
* any reason.
|
||||
* @throws java.io.IOException Thrown when the given file cannot be written to for
|
||||
* any reason.
|
||||
* @throws IllegalArgumentException Thrown when file is null.
|
||||
*/
|
||||
public void save(File file) throws IOException {
|
||||
@ -75,8 +75,8 @@ public abstract class FileConfiguration extends MemoryConfiguration {
|
||||
* using UTF8.
|
||||
*
|
||||
* @param file File to save to.
|
||||
* @throws java.io.IOException Thrown when the given file cannot be written to for
|
||||
* any reason.
|
||||
* @throws java.io.IOException Thrown when the given file cannot be written to for
|
||||
* any reason.
|
||||
* @throws IllegalArgumentException Thrown when file is null.
|
||||
*/
|
||||
public void save(String file) throws IOException {
|
||||
@ -106,12 +106,12 @@ public abstract class FileConfiguration extends MemoryConfiguration {
|
||||
* <p>
|
||||
*
|
||||
* @param file File to load from.
|
||||
* @throws java.io.FileNotFoundException Thrown when the given file cannot be
|
||||
* opened.
|
||||
* @throws java.io.IOException Thrown when the given file cannot be read.
|
||||
* @throws java.io.FileNotFoundException Thrown when the given file cannot be
|
||||
* opened.
|
||||
* @throws java.io.IOException Thrown when the given file cannot be read.
|
||||
* @throws com.boydti.fawe.configuration.InvalidConfigurationException Thrown when the given file is not
|
||||
* a valid Configuration.
|
||||
* @throws IllegalArgumentException Thrown when file is null.
|
||||
* a valid Configuration.
|
||||
* @throws IllegalArgumentException Thrown when file is null.
|
||||
*/
|
||||
public void load(File file) throws IOException, InvalidConfigurationException {
|
||||
if (file == null) {
|
||||
@ -131,10 +131,10 @@ public abstract class FileConfiguration extends MemoryConfiguration {
|
||||
* from the given stream.
|
||||
*
|
||||
* @param reader the reader to load from
|
||||
* @throws java.io.IOException thrown when underlying reader throws an IOException
|
||||
* @throws java.io.IOException thrown when underlying reader throws an IOException
|
||||
* @throws com.boydti.fawe.configuration.InvalidConfigurationException thrown when the reader does not
|
||||
* represent a valid Configuration
|
||||
* @throws IllegalArgumentException thrown when reader is null
|
||||
* represent a valid Configuration
|
||||
* @throws IllegalArgumentException thrown when reader is null
|
||||
*/
|
||||
public void load(Reader reader) throws IOException, InvalidConfigurationException {
|
||||
|
||||
@ -163,12 +163,12 @@ public abstract class FileConfiguration extends MemoryConfiguration {
|
||||
* thrown.
|
||||
*
|
||||
* @param file File to load from.
|
||||
* @throws java.io.FileNotFoundException Thrown when the given file cannot be
|
||||
* opened.
|
||||
* @throws java.io.IOException Thrown when the given file cannot be read.
|
||||
* @throws java.io.FileNotFoundException Thrown when the given file cannot be
|
||||
* opened.
|
||||
* @throws java.io.IOException Thrown when the given file cannot be read.
|
||||
* @throws com.boydti.fawe.configuration.InvalidConfigurationException Thrown when the given file is not
|
||||
* a valid Configuration.
|
||||
* @throws IllegalArgumentException Thrown when file is null.
|
||||
* a valid Configuration.
|
||||
* @throws IllegalArgumentException Thrown when file is null.
|
||||
*/
|
||||
public void load(String file) throws IOException, InvalidConfigurationException {
|
||||
if (file == null) {
|
||||
@ -190,8 +190,8 @@ public abstract class FileConfiguration extends MemoryConfiguration {
|
||||
*
|
||||
* @param contents Contents of a Configuration to load.
|
||||
* @throws com.boydti.fawe.configuration.InvalidConfigurationException Thrown if the specified string is
|
||||
* invalid.
|
||||
* @throws IllegalArgumentException Thrown if contents is null.
|
||||
* invalid.
|
||||
* @throws IllegalArgumentException Thrown if contents is null.
|
||||
*/
|
||||
public abstract void loadFromString(String contents) throws InvalidConfigurationException;
|
||||
|
||||
@ -206,7 +206,7 @@ public abstract class FileConfiguration extends MemoryConfiguration {
|
||||
* @return Compiled header
|
||||
*/
|
||||
protected abstract String buildHeader();
|
||||
|
||||
|
||||
@Override
|
||||
public FileConfigurationOptions options() {
|
||||
if (this.options == null) {
|
||||
|
@ -113,7 +113,7 @@ public class FileConfigurationOptions extends MemoryConfigurationOptions {
|
||||
*/
|
||||
public com.boydti.fawe.configuration.file.FileConfigurationOptions copyHeader(final boolean value) {
|
||||
copyHeader = value;
|
||||
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
@ -15,31 +15,31 @@ public class YamlConfigurationOptions extends FileConfigurationOptions {
|
||||
public YamlConfiguration configuration() {
|
||||
return (YamlConfiguration) super.configuration();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public com.boydti.fawe.configuration.file.YamlConfigurationOptions copyDefaults(final boolean value) {
|
||||
super.copyDefaults(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public com.boydti.fawe.configuration.file.YamlConfigurationOptions pathSeparator(final char value) {
|
||||
super.pathSeparator(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public com.boydti.fawe.configuration.file.YamlConfigurationOptions header(final String value) {
|
||||
super.header(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public com.boydti.fawe.configuration.file.YamlConfigurationOptions copyHeader(final boolean value) {
|
||||
super.copyHeader(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets how much spaces should be used to indent each line.
|
||||
* <p>
|
||||
@ -50,7 +50,7 @@ public class YamlConfigurationOptions extends FileConfigurationOptions {
|
||||
public int indent() {
|
||||
return indent;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets how much spaces should be used to indent each line.
|
||||
* <p>
|
||||
@ -66,7 +66,7 @@ public class YamlConfigurationOptions extends FileConfigurationOptions {
|
||||
if (value > 9) {
|
||||
throw new IllegalArgumentException("Indent cannot be greater than 9 characters");
|
||||
}
|
||||
|
||||
|
||||
indent = value;
|
||||
return this;
|
||||
}
|
||||
|
@ -9,36 +9,36 @@ import org.yaml.snakeyaml.nodes.Node;
|
||||
import org.yaml.snakeyaml.nodes.Tag;
|
||||
|
||||
public class YamlConstructor extends SafeConstructor {
|
||||
|
||||
|
||||
public YamlConstructor() {
|
||||
yamlConstructors.put(Tag.MAP, new ConstructCustomObject());
|
||||
}
|
||||
|
||||
|
||||
private class ConstructCustomObject extends ConstructYamlMap {
|
||||
@Override
|
||||
public Object construct(final Node node) {
|
||||
if (node.isTwoStepsConstruction()) {
|
||||
throw new YAMLException("Unexpected referential mapping structure. Node: " + node);
|
||||
}
|
||||
|
||||
|
||||
final Map<?, ?> raw = (Map<?, ?>) super.construct(node);
|
||||
|
||||
|
||||
if (raw.containsKey(ConfigurationSerialization.SERIALIZED_TYPE_KEY)) {
|
||||
final Map<String, Object> typed = new LinkedHashMap<>(raw.size());
|
||||
for (final Map.Entry<?, ?> entry : raw.entrySet()) {
|
||||
typed.put(entry.getKey().toString(), entry.getValue());
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
return ConfigurationSerialization.deserializeObject(typed);
|
||||
} catch (final IllegalArgumentException ex) {
|
||||
throw new YAMLException("Could not deserialize object", ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return raw;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void construct2ndStep(final Node node, final Object object) {
|
||||
throw new YAMLException("Unexpected referential mapping structure. Node: " + node);
|
||||
|
@ -26,15 +26,15 @@ public class ConfigurationSerialization {
|
||||
/**
|
||||
* Attempts to deserialize the given arguments into a new instance of the
|
||||
* given class.
|
||||
*
|
||||
* <p>
|
||||
* <p>The class must implement {@link com.boydti.fawe.configuration.serialization.ConfigurationSerializable}, including
|
||||
* the extra methods as specified in the javadoc of
|
||||
* ConfigurationSerializable.</p>
|
||||
*
|
||||
* <p>
|
||||
* <p>If a new instance could not be made, an example being the class not
|
||||
* fully implementing the interface, null will be returned.</p>
|
||||
*
|
||||
* @param args Arguments for deserialization
|
||||
* @param args Arguments for deserialization
|
||||
* @param clazz Class to deserialize into
|
||||
* @return New instance of the specified class
|
||||
*/
|
||||
@ -44,13 +44,13 @@ public class ConfigurationSerialization {
|
||||
|
||||
/**
|
||||
* Attempts to deserialize the given arguments into a new instance of the
|
||||
*
|
||||
* <p>
|
||||
* given class.
|
||||
* <p>
|
||||
* The class must implement {@link com.boydti.fawe.configuration.serialization.ConfigurationSerializable}, including
|
||||
* the extra methods as specified in the javadoc of
|
||||
* ConfigurationSerializable.</p>
|
||||
*
|
||||
* <p>
|
||||
* <p>
|
||||
* If a new instance could not be made, an example being the class not
|
||||
* fully implementing the interface, null will be returned.</p>
|
||||
|
@ -32,7 +32,7 @@ public class RollbackDatabase {
|
||||
|
||||
private String INSERT_EDIT;
|
||||
private String CREATE_TABLE;
|
||||
// private String GET_EDITS_POINT;
|
||||
// private String GET_EDITS_POINT;
|
||||
private String GET_EDITS;
|
||||
private String GET_EDITS_USER;
|
||||
private String DELETE_EDITS_USER;
|
||||
|
@ -71,6 +71,7 @@ public abstract class CharFaweChunk<T, V extends FaweQueue> extends FaweChunk<T>
|
||||
|
||||
/**
|
||||
* Get the number of block changes in a specified section
|
||||
*
|
||||
* @param i
|
||||
* @return
|
||||
*/
|
||||
@ -115,6 +116,7 @@ public abstract class CharFaweChunk<T, V extends FaweQueue> extends FaweChunk<T>
|
||||
|
||||
/**
|
||||
* Get the raw data for a section
|
||||
*
|
||||
* @param i
|
||||
* @return
|
||||
*/
|
||||
|
@ -139,7 +139,8 @@ public abstract class NMSMappedFaweQueue<WORLD, CHUNK, CHUNKSECTION, SECTION> ex
|
||||
return section[j] >> 4;
|
||||
}
|
||||
|
||||
public void saveChunk(CHUNK chunk) {}
|
||||
public void saveChunk(CHUNK chunk) {
|
||||
}
|
||||
|
||||
public abstract void relight(int x, int y, int z);
|
||||
|
||||
|
@ -45,7 +45,7 @@ public class NMSRelighter implements Relighter {
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return skyToRelight.isEmpty() && lightQueue.isEmpty();
|
||||
return skyToRelight.isEmpty() && lightQueue.isEmpty();
|
||||
}
|
||||
|
||||
public synchronized boolean addChunk(int cx, int cz, byte[] fix, int bitmask) {
|
||||
@ -156,7 +156,7 @@ public class NMSRelighter implements Relighter {
|
||||
}
|
||||
|
||||
private void computeRemoveBlockLight(int x, int y, int z, int currentLight, Queue<Object[]> queue, Queue<IntegerTrio> spreadQueue, Map<IntegerTrio, Object> visited,
|
||||
Map<IntegerTrio, Object> spreadVisited) {
|
||||
Map<IntegerTrio, Object> spreadVisited) {
|
||||
int current = this.queue.getEmmittedLight(x, y, z);
|
||||
if (current != 0 && current < currentLight) {
|
||||
this.queue.setBlockLight(x, y, z, 0);
|
||||
@ -164,7 +164,7 @@ public class NMSRelighter implements Relighter {
|
||||
if (!visited.containsKey(mutableBlockPos)) {
|
||||
IntegerTrio index = new IntegerTrio(x, y, z);
|
||||
visited.put(index, present);
|
||||
queue.add(new Object[] { index, current });
|
||||
queue.add(new Object[]{index, current});
|
||||
}
|
||||
}
|
||||
} else if (current >= currentLight) {
|
||||
@ -315,9 +315,9 @@ public class NMSRelighter implements Relighter {
|
||||
int bz = chunk.z << 4;
|
||||
Object chunkObj = queue.ensureChunkLoaded(chunk.x, chunk.z);
|
||||
Object sections = queue.getCachedSections(queue.getWorld(), chunk.x, chunk.z);
|
||||
if (sections == null)continue;
|
||||
if (sections == null) continue;
|
||||
Object section = queue.getCachedSection(sections, layer);
|
||||
if (section == null)continue;
|
||||
if (section == null) continue;
|
||||
chunk.smooth = false;
|
||||
for (int j = 0; j <= maxY; j++) {
|
||||
int x = cacheX[j];
|
||||
@ -326,7 +326,7 @@ public class NMSRelighter implements Relighter {
|
||||
byte pair = (byte) queue.getOpacityBrightnessPair(section, x, y, z);
|
||||
int opacity = MathMan.unpair16x(pair);
|
||||
int brightness = MathMan.unpair16y(pair);
|
||||
if (brightness > 1 && (brightness != 15 || opacity != 15)) {
|
||||
if (brightness > 1 && (brightness != 15 || opacity != 15)) {
|
||||
addLightUpdate(bx + x, y, bz + z);
|
||||
}
|
||||
switch (value) {
|
||||
@ -379,7 +379,7 @@ public class NMSRelighter implements Relighter {
|
||||
smoothSkyLight(chunk, y, true);
|
||||
}
|
||||
}
|
||||
for (int i = chunks.length - 1; i>= 0; i--) { // Smooth backwards
|
||||
for (int i = chunks.length - 1; i >= 0; i--) { // Smooth backwards
|
||||
RelightSkyEntry chunk = chunks[i];
|
||||
if (chunk.smooth) {
|
||||
smoothSkyLight(chunk, y, false);
|
||||
@ -405,8 +405,8 @@ public class NMSRelighter implements Relighter {
|
||||
continue;
|
||||
}
|
||||
byte value = mask[j];
|
||||
if ((value = (byte) Math.max(queue.getSkyLight(bx + x - 1, y, bz + z) - 1, value)) >= 14);
|
||||
else if ((value = (byte) Math.max(queue.getSkyLight(bx + x, y, bz + z - 1) - 1, value)) >= 14);
|
||||
if ((value = (byte) Math.max(queue.getSkyLight(bx + x - 1, y, bz + z) - 1, value)) >= 14) ;
|
||||
else if ((value = (byte) Math.max(queue.getSkyLight(bx + x, y, bz + z - 1) - 1, value)) >= 14) ;
|
||||
if (value > mask[j]) queue.setSkyLight(section, x, y, z, mask[j] = value);
|
||||
}
|
||||
} else {
|
||||
@ -417,8 +417,8 @@ public class NMSRelighter implements Relighter {
|
||||
continue;
|
||||
}
|
||||
byte value = mask[j];
|
||||
if ((value = (byte) Math.max(queue.getSkyLight(bx + x + 1, y, bz + z) - 1, value)) >= 14);
|
||||
else if ((value = (byte) Math.max(queue.getSkyLight(bx + x, y, bz + z + 1) - 1, value)) >= 14);
|
||||
if ((value = (byte) Math.max(queue.getSkyLight(bx + x + 1, y, bz + z) - 1, value)) >= 14) ;
|
||||
else if ((value = (byte) Math.max(queue.getSkyLight(bx + x, y, bz + z + 1) - 1, value)) >= 14) ;
|
||||
if (value > mask[j]) queue.setSkyLight(section, x, y, z, mask[j] = value);
|
||||
}
|
||||
}
|
||||
@ -465,7 +465,7 @@ public class NMSRelighter implements Relighter {
|
||||
this.mask = array;
|
||||
this.bitmask = bitmask;
|
||||
if (fix == null) {
|
||||
this.fix = new byte[(maxY + 1) >> 4];
|
||||
this.fix = new byte[(maxY + 1) >> 4];
|
||||
Arrays.fill(this.fix, SkipReason.NONE);
|
||||
} else {
|
||||
this.fix = fix;
|
||||
|
@ -11,7 +11,8 @@ import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
public class NullFaweChunk extends FaweChunk<Void> {
|
||||
public static final NullFaweChunk INSTANCE = new NullFaweChunk(null, 0 ,0);
|
||||
public static final NullFaweChunk INSTANCE = new NullFaweChunk(null, 0, 0);
|
||||
|
||||
/**
|
||||
* A FaweSections object represents a chunk and the blocks that you wish to change in it.
|
||||
*
|
||||
|
@ -4,7 +4,8 @@ public class NullRelighter implements Relighter {
|
||||
|
||||
public static NullRelighter INSTANCE = new NullRelighter();
|
||||
|
||||
private NullRelighter() {}
|
||||
private NullRelighter() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addChunk(int cx, int cz, byte[] fix, int bitmask) {
|
||||
|
@ -186,7 +186,7 @@ public class WeakFaweQueueMap implements IFaweQueueMap {
|
||||
ForkJoinPool pool = SetQueue.IMP.getForkJoinPool();
|
||||
boolean result = true;
|
||||
// amount = 8;
|
||||
for (int i = 0; i < amount && (result = iter.hasNext());) {
|
||||
for (int i = 0; i < amount && (result = iter.hasNext()); ) {
|
||||
Map.Entry<Long, Reference<FaweChunk>> item = iter.next();
|
||||
Reference<FaweChunk> chunkReference = item.getValue();
|
||||
FaweChunk chunk = chunkReference.get();
|
||||
|
@ -189,7 +189,7 @@ public class InstallerFrame extends JFrame {
|
||||
public void prompt(String message) {
|
||||
JOptionPane.showMessageDialog(null, message);
|
||||
}
|
||||
|
||||
|
||||
public void debug(String m) {
|
||||
System.out.println(m);
|
||||
}
|
||||
@ -223,7 +223,8 @@ public class InstallerFrame extends JFrame {
|
||||
Class.forName("com.boydti.fawe.forge." + version + ".ForgeChunk_All");
|
||||
supportedString = version;
|
||||
break;
|
||||
} catch (ClassNotFoundException ignore){}
|
||||
} catch (ClassNotFoundException ignore) {
|
||||
}
|
||||
}
|
||||
if (supportedString == null) {
|
||||
prompt("This version of FAWE cannot be installed this way.");
|
||||
@ -322,7 +323,7 @@ public class InstallerFrame extends JFrame {
|
||||
}
|
||||
try { // install FAWE
|
||||
debug("Copying FastAsyncWorldEdit to mods directory");
|
||||
File file = new File(InstallerFrame.class.getProtectionDomain().getCodeSource().getLocation().getPath());
|
||||
File file = new File(InstallerFrame.class.getProtectionDomain().getCodeSource().getLocation().getPath());
|
||||
debug(" - " + file.getPath());
|
||||
MainUtil.copyFile(file, new File(mods, "FastAsyncWorldEdit.jar"));
|
||||
debug("Installation complete!");
|
||||
@ -352,7 +353,7 @@ public class InstallerFrame extends JFrame {
|
||||
thread.start();
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception{
|
||||
public static void main(String[] args) throws Exception {
|
||||
InstallerFrame window = new InstallerFrame();
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ public class MinimizeButton extends InteractiveButton {
|
||||
super("-");
|
||||
this.window = window;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
window.setState(Frame.ICONIFIED);
|
||||
|
@ -11,6 +11,7 @@ public class TextAreaOutputStream extends PrintStream {
|
||||
super(new OutputStream() {
|
||||
private StringBuffer buffer = new StringBuffer();
|
||||
private String newLine = "";
|
||||
|
||||
@Override
|
||||
public void write(int b) throws IOException {
|
||||
if (b != '\n') {
|
||||
|
@ -60,7 +60,7 @@ public class CorruptSchematicStreamer {
|
||||
if (++matchIndex == match.length) {
|
||||
break;
|
||||
}
|
||||
} else if (read == expected){
|
||||
} else if (read == expected) {
|
||||
if (++matchIndex == match.length) {
|
||||
reader.run(dataInput);
|
||||
break;
|
||||
@ -253,7 +253,7 @@ public class CorruptSchematicStreamer {
|
||||
for (int i = (int) Math.sqrt(volume); i > 0; i--) {
|
||||
if (volume % i == 0) {
|
||||
factors.add(i);
|
||||
factors.add(volume/i);
|
||||
factors.add(volume / i);
|
||||
}
|
||||
}
|
||||
int min = Integer.MAX_VALUE;
|
||||
|
@ -28,12 +28,12 @@ public class JSON2NBT {
|
||||
|
||||
public static CompoundTag getTagFromJson(String jsonString) throws NBTException {
|
||||
jsonString = jsonString.trim();
|
||||
if(!jsonString.startsWith("{")) {
|
||||
if (!jsonString.startsWith("{")) {
|
||||
throw new NBTException("Invalid tag encountered, expected \'{\' as first char.");
|
||||
} else if(topTagsCount(jsonString) != 1) {
|
||||
} else if (topTagsCount(jsonString) != 1) {
|
||||
throw new NBTException("Encountered multiple top tags, only one expected");
|
||||
} else {
|
||||
return (CompoundTag)nameValueToNBT("tag", jsonString).parse();
|
||||
return (CompoundTag) nameValueToNBT("tag", jsonString).parse();
|
||||
}
|
||||
}
|
||||
|
||||
@ -42,27 +42,27 @@ public class JSON2NBT {
|
||||
boolean flag = false;
|
||||
Stack stack = new Stack();
|
||||
|
||||
for(int j = 0; j < str.length(); ++j) {
|
||||
for (int j = 0; j < str.length(); ++j) {
|
||||
char c0 = str.charAt(j);
|
||||
if(c0 == 34) {
|
||||
if(isCharEscaped(str, j)) {
|
||||
if(!flag) {
|
||||
if (c0 == 34) {
|
||||
if (isCharEscaped(str, j)) {
|
||||
if (!flag) {
|
||||
throw new NBTException("Illegal use of \\\": " + str);
|
||||
}
|
||||
} else {
|
||||
flag = !flag;
|
||||
}
|
||||
} else if(!flag) {
|
||||
if(c0 != 123 && c0 != 91) {
|
||||
if(c0 == 125 && (stack.isEmpty() || ((Character)stack.pop()).charValue() != 123)) {
|
||||
} else if (!flag) {
|
||||
if (c0 != 123 && c0 != 91) {
|
||||
if (c0 == 125 && (stack.isEmpty() || ((Character) stack.pop()).charValue() != 123)) {
|
||||
throw new NBTException("Unbalanced curly brackets {}: " + str);
|
||||
}
|
||||
|
||||
if(c0 == 93 && (stack.isEmpty() || ((Character)stack.pop()).charValue() != 91)) {
|
||||
if (c0 == 93 && (stack.isEmpty() || ((Character) stack.pop()).charValue() != 91)) {
|
||||
throw new NBTException("Unbalanced square brackets []: " + str);
|
||||
}
|
||||
} else {
|
||||
if(stack.isEmpty()) {
|
||||
if (stack.isEmpty()) {
|
||||
++i;
|
||||
}
|
||||
|
||||
@ -71,12 +71,12 @@ public class JSON2NBT {
|
||||
}
|
||||
}
|
||||
|
||||
if(flag) {
|
||||
if (flag) {
|
||||
throw new NBTException("Unbalanced quotation: " + str);
|
||||
} else if(!stack.isEmpty()) {
|
||||
} else if (!stack.isEmpty()) {
|
||||
throw new NBTException("Unbalanced brackets: " + str);
|
||||
} else {
|
||||
if(i == 0 && !str.isEmpty()) {
|
||||
if (i == 0 && !str.isEmpty()) {
|
||||
i = 1;
|
||||
}
|
||||
|
||||
@ -93,45 +93,45 @@ public class JSON2NBT {
|
||||
String s;
|
||||
boolean c0;
|
||||
char c01;
|
||||
if(value.startsWith("{")) {
|
||||
if (value.startsWith("{")) {
|
||||
value = value.substring(1, value.length() - 1);
|
||||
|
||||
JSON2NBT.Compound JSON2NBT$list1;
|
||||
for(JSON2NBT$list1 = new JSON2NBT.Compound(key); value.length() > 0; value = value.substring(s.length() + 1)) {
|
||||
for (JSON2NBT$list1 = new JSON2NBT.Compound(key); value.length() > 0; value = value.substring(s.length() + 1)) {
|
||||
s = nextNameValuePair(value, true);
|
||||
if(s.length() > 0) {
|
||||
if (s.length() > 0) {
|
||||
c0 = false;
|
||||
JSON2NBT$list1.tagList.add(getTagFromNameValue(s, false));
|
||||
}
|
||||
|
||||
if(value.length() < s.length() + 1) {
|
||||
if (value.length() < s.length() + 1) {
|
||||
break;
|
||||
}
|
||||
|
||||
c01 = value.charAt(s.length());
|
||||
if(c01 != 44 && c01 != 123 && c01 != 125 && c01 != 91 && c01 != 93) {
|
||||
if (c01 != 44 && c01 != 123 && c01 != 125 && c01 != 91 && c01 != 93) {
|
||||
throw new NBTException("Unexpected token \'" + c01 + "\' at: " + value.substring(s.length()));
|
||||
}
|
||||
}
|
||||
|
||||
return JSON2NBT$list1;
|
||||
} else if(value.startsWith("[") && !INT_ARRAY_MATCHER.matcher(value).matches()) {
|
||||
} else if (value.startsWith("[") && !INT_ARRAY_MATCHER.matcher(value).matches()) {
|
||||
value = value.substring(1, value.length() - 1);
|
||||
|
||||
JSON2NBT.List JSON2NBT$list;
|
||||
for(JSON2NBT$list = new JSON2NBT.List(key); value.length() > 0; value = value.substring(s.length() + 1)) {
|
||||
for (JSON2NBT$list = new JSON2NBT.List(key); value.length() > 0; value = value.substring(s.length() + 1)) {
|
||||
s = nextNameValuePair(value, false);
|
||||
if(s.length() > 0) {
|
||||
if (s.length() > 0) {
|
||||
c0 = true;
|
||||
JSON2NBT$list.tagList.add(getTagFromNameValue(s, true));
|
||||
}
|
||||
|
||||
if(value.length() < s.length() + 1) {
|
||||
if (value.length() < s.length() + 1) {
|
||||
break;
|
||||
}
|
||||
|
||||
c01 = value.charAt(s.length());
|
||||
if(c01 != 44 && c01 != 123 && c01 != 125 && c01 != 91 && c01 != 93) {
|
||||
if (c01 != 44 && c01 != 123 && c01 != 125 && c01 != 91 && c01 != 93) {
|
||||
throw new NBTException("Unexpected token \'" + c01 + "\' at: " + value.substring(s.length()));
|
||||
}
|
||||
}
|
||||
@ -151,15 +151,15 @@ public class JSON2NBT {
|
||||
private static String nextNameValuePair(String str, boolean isCompound) throws NBTException {
|
||||
int i = getNextCharIndex(str, ':');
|
||||
int j = getNextCharIndex(str, ',');
|
||||
if(isCompound) {
|
||||
if(i == -1) {
|
||||
if (isCompound) {
|
||||
if (i == -1) {
|
||||
throw new NBTException("Unable to locate name/value separator for string: " + str);
|
||||
}
|
||||
|
||||
if(j != -1 && j < i) {
|
||||
if (j != -1 && j < i) {
|
||||
throw new NBTException("Name error at: " + str);
|
||||
}
|
||||
} else if(i == -1 || i > j) {
|
||||
} else if (i == -1 || i > j) {
|
||||
i = -1;
|
||||
}
|
||||
|
||||
@ -173,34 +173,34 @@ public class JSON2NBT {
|
||||
boolean flag1 = false;
|
||||
boolean flag2 = false;
|
||||
|
||||
for(int j = 0; i < str.length(); ++i) {
|
||||
for (int j = 0; i < str.length(); ++i) {
|
||||
char c0 = str.charAt(i);
|
||||
if(c0 == 34) {
|
||||
if(isCharEscaped(str, i)) {
|
||||
if(!flag) {
|
||||
if (c0 == 34) {
|
||||
if (isCharEscaped(str, i)) {
|
||||
if (!flag) {
|
||||
throw new NBTException("Illegal use of \\\": " + str);
|
||||
}
|
||||
} else {
|
||||
flag = !flag;
|
||||
if(flag && !flag2) {
|
||||
if (flag && !flag2) {
|
||||
flag1 = true;
|
||||
}
|
||||
|
||||
if(!flag) {
|
||||
if (!flag) {
|
||||
j = i;
|
||||
}
|
||||
}
|
||||
} else if(!flag) {
|
||||
if(c0 != 123 && c0 != 91) {
|
||||
if(c0 == 125 && (stack.isEmpty() || ((Character)stack.pop()).charValue() != 123)) {
|
||||
} else if (!flag) {
|
||||
if (c0 != 123 && c0 != 91) {
|
||||
if (c0 == 125 && (stack.isEmpty() || ((Character) stack.pop()).charValue() != 123)) {
|
||||
throw new NBTException("Unbalanced curly brackets {}: " + str);
|
||||
}
|
||||
|
||||
if(c0 == 93 && (stack.isEmpty() || ((Character)stack.pop()).charValue() != 91)) {
|
||||
if (c0 == 93 && (stack.isEmpty() || ((Character) stack.pop()).charValue() != 91)) {
|
||||
throw new NBTException("Unbalanced square brackets []: " + str);
|
||||
}
|
||||
|
||||
if(c0 == 44 && stack.isEmpty()) {
|
||||
if (c0 == 44 && stack.isEmpty()) {
|
||||
return str.substring(0, i);
|
||||
}
|
||||
} else {
|
||||
@ -208,8 +208,8 @@ public class JSON2NBT {
|
||||
}
|
||||
}
|
||||
|
||||
if(!Character.isWhitespace(c0)) {
|
||||
if(!flag && flag1 && j != i) {
|
||||
if (!Character.isWhitespace(c0)) {
|
||||
if (!flag && flag1 && j != i) {
|
||||
return str.substring(0, j + 1);
|
||||
}
|
||||
|
||||
@ -221,16 +221,16 @@ public class JSON2NBT {
|
||||
}
|
||||
|
||||
private static String locateName(String str, boolean isArray) throws NBTException {
|
||||
if(isArray) {
|
||||
if (isArray) {
|
||||
str = str.trim();
|
||||
if(str.startsWith("{") || str.startsWith("[")) {
|
||||
if (str.startsWith("{") || str.startsWith("[")) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
int i = getNextCharIndex(str, ':');
|
||||
if(i == -1) {
|
||||
if(isArray) {
|
||||
if (i == -1) {
|
||||
if (isArray) {
|
||||
return "";
|
||||
} else {
|
||||
throw new NBTException("Unable to locate name/value separator for string: " + str);
|
||||
@ -241,16 +241,16 @@ public class JSON2NBT {
|
||||
}
|
||||
|
||||
private static String locateValue(String str, boolean isArray) throws NBTException {
|
||||
if(isArray) {
|
||||
if (isArray) {
|
||||
str = str.trim();
|
||||
if(str.startsWith("{") || str.startsWith("[")) {
|
||||
if (str.startsWith("{") || str.startsWith("[")) {
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
int i = getNextCharIndex(str, ':');
|
||||
if(i == -1) {
|
||||
if(isArray) {
|
||||
if (i == -1) {
|
||||
if (isArray) {
|
||||
return str;
|
||||
} else {
|
||||
throw new NBTException("Unable to locate name/value separator for string: " + str);
|
||||
@ -263,18 +263,18 @@ public class JSON2NBT {
|
||||
private static int getNextCharIndex(String str, char targetChar) {
|
||||
int i = 0;
|
||||
|
||||
for(boolean flag = true; i < str.length(); ++i) {
|
||||
for (boolean flag = true; i < str.length(); ++i) {
|
||||
char c0 = str.charAt(i);
|
||||
if(c0 == 34) {
|
||||
if(!isCharEscaped(str, i)) {
|
||||
if (c0 == 34) {
|
||||
if (!isCharEscaped(str, i)) {
|
||||
flag = !flag;
|
||||
}
|
||||
} else if(flag) {
|
||||
if(c0 == targetChar) {
|
||||
} else if (flag) {
|
||||
if (c0 == targetChar) {
|
||||
return i;
|
||||
}
|
||||
|
||||
if(c0 == 123 || c0 == 91) {
|
||||
if (c0 == 123 || c0 == 91) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -305,50 +305,50 @@ public class JSON2NBT {
|
||||
|
||||
public Tag parse() throws NBTException {
|
||||
try {
|
||||
if(DOUBLE.matcher(this.jsonValue).matches()) {
|
||||
if (DOUBLE.matcher(this.jsonValue).matches()) {
|
||||
return new DoubleTag(Double.parseDouble(this.jsonValue.substring(0, this.jsonValue.length() - 1)));
|
||||
}
|
||||
|
||||
if(FLOAT.matcher(this.jsonValue).matches()) {
|
||||
if (FLOAT.matcher(this.jsonValue).matches()) {
|
||||
return new FloatTag(Float.parseFloat(this.jsonValue.substring(0, this.jsonValue.length() - 1)));
|
||||
}
|
||||
|
||||
if(BYTE.matcher(this.jsonValue).matches()) {
|
||||
if (BYTE.matcher(this.jsonValue).matches()) {
|
||||
return new ByteTag(Byte.parseByte(this.jsonValue.substring(0, this.jsonValue.length() - 1)));
|
||||
}
|
||||
|
||||
if(LONG.matcher(this.jsonValue).matches()) {
|
||||
if (LONG.matcher(this.jsonValue).matches()) {
|
||||
return new LongTag(Long.parseLong(this.jsonValue.substring(0, this.jsonValue.length() - 1)));
|
||||
}
|
||||
|
||||
if(SHORT.matcher(this.jsonValue).matches()) {
|
||||
if (SHORT.matcher(this.jsonValue).matches()) {
|
||||
return new ShortTag(Short.parseShort(this.jsonValue.substring(0, this.jsonValue.length() - 1)));
|
||||
}
|
||||
|
||||
if(INTEGER.matcher(this.jsonValue).matches()) {
|
||||
if (INTEGER.matcher(this.jsonValue).matches()) {
|
||||
return new IntTag(Integer.parseInt(this.jsonValue));
|
||||
}
|
||||
|
||||
if(DOUBLE_UNTYPED.matcher(this.jsonValue).matches()) {
|
||||
if (DOUBLE_UNTYPED.matcher(this.jsonValue).matches()) {
|
||||
return new DoubleTag(Double.parseDouble(this.jsonValue));
|
||||
}
|
||||
|
||||
if("true".equalsIgnoreCase(this.jsonValue) || "false".equalsIgnoreCase(this.jsonValue)) {
|
||||
return new ByteTag((byte)(Boolean.parseBoolean(this.jsonValue)?1:0));
|
||||
if ("true".equalsIgnoreCase(this.jsonValue) || "false".equalsIgnoreCase(this.jsonValue)) {
|
||||
return new ByteTag((byte) (Boolean.parseBoolean(this.jsonValue) ? 1 : 0));
|
||||
}
|
||||
} catch (NumberFormatException var6) {
|
||||
this.jsonValue = this.jsonValue.replaceAll("\\\\\"", "\"");
|
||||
return new StringTag(this.jsonValue);
|
||||
}
|
||||
|
||||
if(this.jsonValue.startsWith("[") && this.jsonValue.endsWith("]")) {
|
||||
if (this.jsonValue.startsWith("[") && this.jsonValue.endsWith("]")) {
|
||||
String var7 = this.jsonValue.substring(1, this.jsonValue.length() - 1);
|
||||
String[] var8 = (String[])((String[]) Iterables.toArray(SPLITTER.split(var7), String.class));
|
||||
String[] var8 = (String[]) ((String[]) Iterables.toArray(SPLITTER.split(var7), String.class));
|
||||
|
||||
try {
|
||||
int[] var5 = new int[var8.length];
|
||||
|
||||
for(int j = 0; j < var8.length; ++j) {
|
||||
for (int j = 0; j < var8.length; ++j) {
|
||||
var5[j] = Integer.parseInt(var8[j].trim());
|
||||
}
|
||||
|
||||
@ -357,15 +357,15 @@ public class JSON2NBT {
|
||||
return new StringTag(this.jsonValue);
|
||||
}
|
||||
} else {
|
||||
if(this.jsonValue.startsWith("\"") && this.jsonValue.endsWith("\"")) {
|
||||
if (this.jsonValue.startsWith("\"") && this.jsonValue.endsWith("\"")) {
|
||||
this.jsonValue = this.jsonValue.substring(1, this.jsonValue.length() - 1);
|
||||
}
|
||||
|
||||
this.jsonValue = this.jsonValue.replaceAll("\\\\\"", "\"");
|
||||
StringBuilder stringbuilder = new StringBuilder();
|
||||
|
||||
for(int i = 0; i < this.jsonValue.length(); ++i) {
|
||||
if(i < this.jsonValue.length() - 1 && this.jsonValue.charAt(i) == 92 && this.jsonValue.charAt(i + 1) == 92) {
|
||||
for (int i = 0; i < this.jsonValue.length(); ++i) {
|
||||
if (i < this.jsonValue.length() - 1 && this.jsonValue.charAt(i) == 92 && this.jsonValue.charAt(i + 1) == 92) {
|
||||
stringbuilder.append('\\');
|
||||
++i;
|
||||
} else {
|
||||
@ -389,8 +389,8 @@ public class JSON2NBT {
|
||||
ArrayList<Tag> list = new ArrayList<>();
|
||||
Iterator var2 = this.tagList.iterator();
|
||||
|
||||
while(var2.hasNext()) {
|
||||
JSON2NBT.Any JSON2NBT$any = (JSON2NBT.Any)var2.next();
|
||||
while (var2.hasNext()) {
|
||||
JSON2NBT.Any JSON2NBT$any = (JSON2NBT.Any) var2.next();
|
||||
list.add(JSON2NBT$any.parse());
|
||||
}
|
||||
Class<? extends Tag> tagType = list.isEmpty() ? CompoundTag.class : list.get(0).getClass();
|
||||
@ -409,8 +409,8 @@ public class JSON2NBT {
|
||||
HashMap<String, Tag> map = new HashMap<String, Tag>();
|
||||
Iterator var2 = this.tagList.iterator();
|
||||
|
||||
while(var2.hasNext()) {
|
||||
JSON2NBT.Any JSON2NBT$any = (JSON2NBT.Any)var2.next();
|
||||
while (var2.hasNext()) {
|
||||
JSON2NBT.Any JSON2NBT$any = (JSON2NBT.Any) var2.next();
|
||||
map.put(JSON2NBT$any.json, JSON2NBT$any.parse());
|
||||
}
|
||||
|
||||
|
@ -1,11 +1,13 @@
|
||||
package com.boydti.fawe.jnbt;
|
||||
|
||||
public class NBTException extends RuntimeException{
|
||||
public class NBTException extends RuntimeException {
|
||||
public NBTException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Faster exception throwing if you don't fill the stacktrace
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
|
@ -18,6 +18,7 @@ public class NBTStreamer {
|
||||
|
||||
/**
|
||||
* Reads the entire stream and runs the applicable readers
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
public void readFully() throws IOException {
|
||||
@ -32,8 +33,9 @@ public class NBTStreamer {
|
||||
|
||||
/**
|
||||
* Reads the stream until all readers have been used<br>
|
||||
* - Use readFully if you expect a reader to appear more than once
|
||||
* - Can exit early without having reading the entire file
|
||||
* - Use readFully if you expect a reader to appear more than once
|
||||
* - Can exit early without having reading the entire file
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
public void readQuick() throws IOException {
|
||||
@ -47,7 +49,8 @@ public class NBTStreamer {
|
||||
this.value2 = readers.remove(node);
|
||||
}
|
||||
});
|
||||
} catch (FaweException ignore) {}
|
||||
} catch (FaweException ignore) {
|
||||
}
|
||||
is.close();
|
||||
}
|
||||
|
||||
@ -64,8 +67,9 @@ public class NBTStreamer {
|
||||
}
|
||||
}
|
||||
|
||||
public static abstract class NBTStreamReader<T, V> extends RunnableVal2<T, V> {
|
||||
public static abstract class NBTStreamReader<T, V> extends RunnableVal2<T, V> {
|
||||
private String node;
|
||||
|
||||
public void init(String node) {
|
||||
this.node = node;
|
||||
}
|
||||
|
@ -88,7 +88,10 @@ public class HeightMapMCAGenerator extends MCAWriter implements Extent {
|
||||
} else {
|
||||
return new CachedTextureUtil(textureUtil);
|
||||
}
|
||||
} catch (FileNotFoundException neverHappens) { neverHappens.printStackTrace(); return null; }
|
||||
} catch (FileNotFoundException neverHappens) {
|
||||
neverHappens.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void setWaterHeight(int waterHeight) {
|
||||
@ -176,7 +179,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements Extent {
|
||||
public void setHeight(BufferedImage img) {
|
||||
int index = 0;
|
||||
for (int z = 0; z < getLength(); z++) {
|
||||
for (int x = 0; x < getWidth(); x++, index++){
|
||||
for (int x = 0; x < getWidth(); x++, index++) {
|
||||
heights[index] = (byte) (img.getRGB(x, z) >> 8);
|
||||
}
|
||||
}
|
||||
@ -188,20 +191,21 @@ public class HeightMapMCAGenerator extends MCAWriter implements Extent {
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void addSchems(Mask mask, WorldData worldData, ClipboardHolder[] clipboards, int rarity, boolean rotate) throws WorldEditException{
|
||||
public void addSchems(Mask mask, WorldData worldData, ClipboardHolder[] clipboards, int rarity, boolean rotate) throws WorldEditException {
|
||||
CuboidRegion region = new CuboidRegion(new Vector(0, 0, 0), new Vector(getWidth(), 255, getLength()));
|
||||
addSchems(region, mask, worldData, clipboards, rarity, rotate);
|
||||
}
|
||||
|
||||
public void addSchems(BufferedImage img, Mask mask, WorldData worldData, ClipboardHolder[] clipboards, int rarity, int distance, boolean randomRotate) throws WorldEditException{
|
||||
if (img.getWidth() != getWidth() || img.getHeight() != getLength()) throw new IllegalArgumentException("Input image dimensions do not match the current height map!");
|
||||
public void addSchems(BufferedImage img, Mask mask, WorldData worldData, ClipboardHolder[] clipboards, int rarity, int distance, boolean randomRotate) throws WorldEditException {
|
||||
if (img.getWidth() != getWidth() || img.getHeight() != getLength())
|
||||
throw new IllegalArgumentException("Input image dimensions do not match the current height map!");
|
||||
double doubleRarity = rarity / 100d;
|
||||
int index = 0;
|
||||
AffineTransform identity = new AffineTransform();
|
||||
LocalBlockVector2DSet placed = new LocalBlockVector2DSet();
|
||||
for (int z = 0; z < getLength(); z++) {
|
||||
mutable.mutZ(z);
|
||||
for (int x = 0; x < getWidth(); x++, index++){
|
||||
for (int x = 0; x < getWidth(); x++, index++) {
|
||||
int y = heights[index];
|
||||
int height = img.getRGB(x, z) & 0xFF;
|
||||
if (height == 0 || PseudoRandom.random.nextInt(256) > height * doubleRarity) {
|
||||
@ -243,14 +247,14 @@ public class HeightMapMCAGenerator extends MCAWriter implements Extent {
|
||||
}
|
||||
}
|
||||
|
||||
public void addSchems(Mask mask, WorldData worldData, ClipboardHolder[] clipboards, int rarity, int distance, boolean randomRotate) throws WorldEditException{
|
||||
public void addSchems(Mask mask, WorldData worldData, ClipboardHolder[] clipboards, int rarity, int distance, boolean randomRotate) throws WorldEditException {
|
||||
int scaledRarity = (256 * rarity) / 100;
|
||||
int index = 0;
|
||||
AffineTransform identity = new AffineTransform();
|
||||
LocalBlockVector2DSet placed = new LocalBlockVector2DSet();
|
||||
for (int z = 0; z < getLength(); z++) {
|
||||
mutable.mutZ(z);
|
||||
for (int x = 0; x < getWidth(); x++, index++){
|
||||
for (int x = 0; x < getWidth(); x++, index++) {
|
||||
int y = heights[index];
|
||||
if (PseudoRandom.random.nextInt(256) > scaledRarity) {
|
||||
continue;
|
||||
@ -439,10 +443,11 @@ public class HeightMapMCAGenerator extends MCAWriter implements Extent {
|
||||
}
|
||||
|
||||
public void setBiome(BufferedImage img, byte biome, boolean white) {
|
||||
if (img.getWidth() != getWidth() || img.getHeight() != getLength()) throw new IllegalArgumentException("Input image dimensions do not match the current height map!");
|
||||
if (img.getWidth() != getWidth() || img.getHeight() != getLength())
|
||||
throw new IllegalArgumentException("Input image dimensions do not match the current height map!");
|
||||
int index = 0;
|
||||
for (int z = 0; z < getLength(); z++) {
|
||||
for (int x = 0; x < getWidth(); x++, index++){
|
||||
for (int x = 0; x < getWidth(); x++, index++) {
|
||||
int height = img.getRGB(x, z) & 0xFF;
|
||||
if (height == 255 || height > 0 && !white && PseudoRandom.random.nextInt(256) <= height) {
|
||||
biomes[index] = biome;
|
||||
@ -524,28 +529,28 @@ public class HeightMapMCAGenerator extends MCAWriter implements Extent {
|
||||
}
|
||||
|
||||
public void setColorWithGlass(BufferedImage img) {
|
||||
if (img.getWidth() != getWidth() || img.getHeight() != getLength())
|
||||
throw new IllegalArgumentException("Input image dimensions do not match the current height map!");
|
||||
if (img.getWidth() != getWidth() || img.getHeight() != getLength())
|
||||
throw new IllegalArgumentException("Input image dimensions do not match the current height map!");
|
||||
TextureUtil textureUtil = getTextureUtil();
|
||||
int index = 0;
|
||||
for (int y = 0; y < img.getHeight(); y++) {
|
||||
for (int x = 0; x < img.getWidth(); x++) {
|
||||
int color = img.getRGB(x, y);
|
||||
char[] layer = textureUtil.getNearestLayer(color);
|
||||
if (layer != null) {
|
||||
floor[index] = layer[0];
|
||||
main[index] = layer[1];
|
||||
}
|
||||
index++;
|
||||
int index = 0;
|
||||
for (int y = 0; y < img.getHeight(); y++) {
|
||||
for (int x = 0; x < img.getWidth(); x++) {
|
||||
int color = img.getRGB(x, y);
|
||||
char[] layer = textureUtil.getNearestLayer(color);
|
||||
if (layer != null) {
|
||||
floor[index] = layer[0];
|
||||
main[index] = layer[1];
|
||||
}
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setBiome(Mask mask, byte biome) {
|
||||
int index = 0;
|
||||
for (int z = 0; z < getLength(); z++) {
|
||||
mutable.mutZ(z);
|
||||
for (int x = 0; x < getWidth(); x++, index++){
|
||||
for (int x = 0; x < getWidth(); x++, index++) {
|
||||
int y = heights[index] & 0xFF;
|
||||
mutable.mutX(x);
|
||||
mutable.mutY(y);
|
||||
@ -561,12 +566,13 @@ public class HeightMapMCAGenerator extends MCAWriter implements Extent {
|
||||
setOverlay(img, (char) ((BlockPattern) pattern).getBlock().getCombined(), white);
|
||||
return;
|
||||
}
|
||||
if (img.getWidth() != getWidth() || img.getHeight() != getLength()) throw new IllegalArgumentException("Input image dimensions do not match the current height map!");
|
||||
if (img.getWidth() != getWidth() || img.getHeight() != getLength())
|
||||
throw new IllegalArgumentException("Input image dimensions do not match the current height map!");
|
||||
if (overlay == null) overlay = new char[getArea()];
|
||||
int index = 0;
|
||||
for (int z = 0; z < getLength(); z++) {
|
||||
mutable.mutZ(z);
|
||||
for (int x = 0; x < getWidth(); x++, index++){
|
||||
for (int x = 0; x < getWidth(); x++, index++) {
|
||||
int height = img.getRGB(x, z) & 0xFF;
|
||||
if (height == 255 || height > 0 && !white && PseudoRandom.random.nextInt(256) <= height) {
|
||||
mutable.mutX(x);
|
||||
@ -582,12 +588,13 @@ public class HeightMapMCAGenerator extends MCAWriter implements Extent {
|
||||
setMain(img, (char) ((BlockPattern) pattern).getBlock().getCombined(), white);
|
||||
return;
|
||||
}
|
||||
if (img.getWidth() != getWidth() || img.getHeight() != getLength()) throw new IllegalArgumentException("Input image dimensions do not match the current height map!");
|
||||
if (img.getWidth() != getWidth() || img.getHeight() != getLength())
|
||||
throw new IllegalArgumentException("Input image dimensions do not match the current height map!");
|
||||
modifiedMain = true;
|
||||
int index = 0;
|
||||
for (int z = 0; z < getLength(); z++) {
|
||||
mutable.mutZ(z);
|
||||
for (int x = 0; x < getWidth(); x++, index++){
|
||||
for (int x = 0; x < getWidth(); x++, index++) {
|
||||
int height = img.getRGB(x, z) & 0xFF;
|
||||
if (height == 255 || height > 0 && !white && PseudoRandom.random.nextInt(256) <= height) {
|
||||
mutable.mutX(x);
|
||||
@ -603,11 +610,12 @@ public class HeightMapMCAGenerator extends MCAWriter implements Extent {
|
||||
setFloor(img, (char) ((BlockPattern) pattern).getBlock().getCombined(), white);
|
||||
return;
|
||||
}
|
||||
if (img.getWidth() != getWidth() || img.getHeight() != getLength()) throw new IllegalArgumentException("Input image dimensions do not match the current height map!");
|
||||
if (img.getWidth() != getWidth() || img.getHeight() != getLength())
|
||||
throw new IllegalArgumentException("Input image dimensions do not match the current height map!");
|
||||
int index = 0;
|
||||
for (int z = 0; z < getLength(); z++) {
|
||||
mutable.mutZ(z);
|
||||
for (int x = 0; x < getWidth(); x++, index++){
|
||||
for (int x = 0; x < getWidth(); x++, index++) {
|
||||
int height = img.getRGB(x, z) & 0xFF;
|
||||
if (height == 255 || height > 0 && !white && PseudoRandom.random.nextInt(256) <= height) {
|
||||
mutable.mutX(x);
|
||||
@ -623,12 +631,13 @@ public class HeightMapMCAGenerator extends MCAWriter implements Extent {
|
||||
setColumn(img, (char) ((BlockPattern) pattern).getBlock().getCombined(), white);
|
||||
return;
|
||||
}
|
||||
if (img.getWidth() != getWidth() || img.getHeight() != getLength()) throw new IllegalArgumentException("Input image dimensions do not match the current height map!");
|
||||
if (img.getWidth() != getWidth() || img.getHeight() != getLength())
|
||||
throw new IllegalArgumentException("Input image dimensions do not match the current height map!");
|
||||
modifiedMain = true;
|
||||
int index = 0;
|
||||
for (int z = 0; z < getLength(); z++) {
|
||||
mutable.mutZ(z);
|
||||
for (int x = 0; x < getWidth(); x++, index++){
|
||||
for (int x = 0; x < getWidth(); x++, index++) {
|
||||
int height = img.getRGB(x, z) & 0xFF;
|
||||
if (height == 255 || height > 0 && !white && PseudoRandom.random.nextInt(256) <= height) {
|
||||
mutable.mutX(x);
|
||||
@ -650,7 +659,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements Extent {
|
||||
if (overlay == null) overlay = new char[getArea()];
|
||||
for (int z = 0; z < getLength(); z++) {
|
||||
mutable.mutZ(z);
|
||||
for (int x = 0; x < getWidth(); x++, index++){
|
||||
for (int x = 0; x < getWidth(); x++, index++) {
|
||||
int y = heights[index] & 0xFF;
|
||||
mutable.mutX(x);
|
||||
mutable.mutY(y);
|
||||
@ -669,7 +678,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements Extent {
|
||||
int index = 0;
|
||||
for (int z = 0; z < getLength(); z++) {
|
||||
mutable.mutZ(z);
|
||||
for (int x = 0; x < getWidth(); x++, index++){
|
||||
for (int x = 0; x < getWidth(); x++, index++) {
|
||||
int y = heights[index] & 0xFF;
|
||||
mutable.mutX(x);
|
||||
mutable.mutY(y);
|
||||
@ -689,7 +698,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements Extent {
|
||||
int index = 0;
|
||||
for (int z = 0; z < getLength(); z++) {
|
||||
mutable.mutZ(z);
|
||||
for (int x = 0; x < getWidth(); x++, index++){
|
||||
for (int x = 0; x < getWidth(); x++, index++) {
|
||||
int y = heights[index] & 0xFF;
|
||||
mutable.mutX(x);
|
||||
mutable.mutY(y);
|
||||
@ -709,7 +718,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements Extent {
|
||||
int index = 0;
|
||||
for (int z = 0; z < getLength(); z++) {
|
||||
mutable.mutZ(z);
|
||||
for (int x = 0; x < getWidth(); x++, index++){
|
||||
for (int x = 0; x < getWidth(); x++, index++) {
|
||||
int y = heights[index] & 0xFF;
|
||||
mutable.mutX(x);
|
||||
mutable.mutY(y);
|
||||
@ -1034,7 +1043,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements Extent {
|
||||
if (overlay == null) overlay = new char[getArea()];
|
||||
for (int z = 0; z < getLength(); z++) {
|
||||
mutable.mutZ(z);
|
||||
for (int x = 0; x < getWidth(); x++, index++){
|
||||
for (int x = 0; x < getWidth(); x++, index++) {
|
||||
int y = heights[index] & 0xFF;
|
||||
mutable.mutX(x);
|
||||
mutable.mutY(y);
|
||||
@ -1049,7 +1058,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements Extent {
|
||||
int index = 0;
|
||||
for (int z = 0; z < getLength(); z++) {
|
||||
mutable.mutZ(z);
|
||||
for (int x = 0; x < getWidth(); x++, index++){
|
||||
for (int x = 0; x < getWidth(); x++, index++) {
|
||||
int y = heights[index] & 0xFF;
|
||||
mutable.mutX(x);
|
||||
mutable.mutY(y);
|
||||
@ -1065,7 +1074,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements Extent {
|
||||
int index = 0;
|
||||
for (int z = 0; z < getLength(); z++) {
|
||||
mutable.mutZ(z);
|
||||
for (int x = 0; x < getWidth(); x++, index++){
|
||||
for (int x = 0; x < getWidth(); x++, index++) {
|
||||
int y = heights[index] & 0xFF;
|
||||
mutable.mutX(x);
|
||||
mutable.mutY(y);
|
||||
@ -1081,7 +1090,7 @@ public class HeightMapMCAGenerator extends MCAWriter implements Extent {
|
||||
int index = 0;
|
||||
for (int z = 0; z < getLength(); z++) {
|
||||
mutable.mutZ(z);
|
||||
for (int x = 0; x < getWidth(); x++, index++){
|
||||
for (int x = 0; x < getWidth(); x++, index++) {
|
||||
int y = heights[index] & 0xFF;
|
||||
mutable.mutX(x);
|
||||
mutable.mutY(y);
|
||||
@ -1113,11 +1122,12 @@ public class HeightMapMCAGenerator extends MCAWriter implements Extent {
|
||||
}
|
||||
|
||||
private void setOverlay(BufferedImage img, char combined, boolean white) {
|
||||
if (img.getWidth() != getWidth() || img.getHeight() != getLength()) throw new IllegalArgumentException("Input image dimensions do not match the current height map!");
|
||||
if (img.getWidth() != getWidth() || img.getHeight() != getLength())
|
||||
throw new IllegalArgumentException("Input image dimensions do not match the current height map!");
|
||||
if (overlay == null) overlay = new char[getArea()];
|
||||
int index = 0;
|
||||
for (int z = 0; z < getLength(); z++) {
|
||||
for (int x = 0; x < getWidth(); x++, index++){
|
||||
for (int x = 0; x < getWidth(); x++, index++) {
|
||||
int height = img.getRGB(x, z) & 0xFF;
|
||||
if (height == 255 || height > 0 && white && PseudoRandom.random.nextInt(256) <= height) {
|
||||
overlay[index] = combined;
|
||||
@ -1127,11 +1137,12 @@ public class HeightMapMCAGenerator extends MCAWriter implements Extent {
|
||||
}
|
||||
|
||||
private void setMain(BufferedImage img, char combined, boolean white) {
|
||||
if (img.getWidth() != getWidth() || img.getHeight() != getLength()) throw new IllegalArgumentException("Input image dimensions do not match the current height map!");
|
||||
if (img.getWidth() != getWidth() || img.getHeight() != getLength())
|
||||
throw new IllegalArgumentException("Input image dimensions do not match the current height map!");
|
||||
modifiedMain = true;
|
||||
int index = 0;
|
||||
for (int z = 0; z < getLength(); z++) {
|
||||
for (int x = 0; x < getWidth(); x++, index++){
|
||||
for (int x = 0; x < getWidth(); x++, index++) {
|
||||
int height = img.getRGB(x, z) & 0xFF;
|
||||
if (height == 255 || height > 0 && !white && PseudoRandom.random.nextInt(256) <= height) {
|
||||
main[index] = combined;
|
||||
@ -1141,10 +1152,11 @@ public class HeightMapMCAGenerator extends MCAWriter implements Extent {
|
||||
}
|
||||
|
||||
private void setFloor(BufferedImage img, char combined, boolean white) {
|
||||
if (img.getWidth() != getWidth() || img.getHeight() != getLength()) throw new IllegalArgumentException("Input image dimensions do not match the current height map!");
|
||||
if (img.getWidth() != getWidth() || img.getHeight() != getLength())
|
||||
throw new IllegalArgumentException("Input image dimensions do not match the current height map!");
|
||||
int index = 0;
|
||||
for (int z = 0; z < getLength(); z++) {
|
||||
for (int x = 0; x < getWidth(); x++, index++){
|
||||
for (int x = 0; x < getWidth(); x++, index++) {
|
||||
int height = img.getRGB(x, z) & 0xFF;
|
||||
if (height == 255 || height > 0 && !white && PseudoRandom.random.nextInt(256) <= height) {
|
||||
floor[index] = combined;
|
||||
@ -1154,11 +1166,12 @@ public class HeightMapMCAGenerator extends MCAWriter implements Extent {
|
||||
}
|
||||
|
||||
private void setColumn(BufferedImage img, char combined, boolean white) {
|
||||
if (img.getWidth() != getWidth() || img.getHeight() != getLength()) throw new IllegalArgumentException("Input image dimensions do not match the current height map!");
|
||||
if (img.getWidth() != getWidth() || img.getHeight() != getLength())
|
||||
throw new IllegalArgumentException("Input image dimensions do not match the current height map!");
|
||||
modifiedMain = true;
|
||||
int index = 0;
|
||||
for (int z = 0; z < getLength(); z++) {
|
||||
for (int x = 0; x < getWidth(); x++, index++){
|
||||
for (int x = 0; x < getWidth(); x++, index++) {
|
||||
int height = img.getRGB(x, z) & 0xFF;
|
||||
if (height == 255 || height > 0 && !white && PseudoRandom.random.nextInt(256) <= height) {
|
||||
main[index] = combined;
|
||||
|
@ -396,6 +396,7 @@ public class MCAChunk extends FaweChunk<Void> {
|
||||
|
||||
/**
|
||||
* Deprecated, use the toBytes method
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
@ -687,7 +688,7 @@ public class MCAChunk extends FaweChunk<Void> {
|
||||
|
||||
public int getNibble(int index, byte[] array) {
|
||||
int indexShift = index >> 1;
|
||||
if((index & 1) == 0) {
|
||||
if ((index & 1) == 0) {
|
||||
return array[indexShift] & 15;
|
||||
} else {
|
||||
return array[indexShift] >> 4 & 15;
|
||||
@ -701,10 +702,10 @@ public class MCAChunk extends FaweChunk<Void> {
|
||||
if (existing == value + valueShift) {
|
||||
return;
|
||||
}
|
||||
if((index & 1) == 0) {
|
||||
array[indexShift] = (byte)(existing & 240 | value);
|
||||
if ((index & 1) == 0) {
|
||||
array[indexShift] = (byte) (existing & 240 | value);
|
||||
} else {
|
||||
array[indexShift] = (byte)(existing & 15 | valueShift);
|
||||
array[indexShift] = (byte) (existing & 15 | valueShift);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,7 @@ public class MCAFile {
|
||||
|
||||
private static Field fieldBuf2;
|
||||
private static Field fieldBuf3;
|
||||
|
||||
static {
|
||||
try {
|
||||
fieldBuf2 = InflaterInputStream.class.getDeclaredField("buf");
|
||||
@ -170,7 +171,7 @@ public class MCAFile {
|
||||
|
||||
public MCAChunk readChunk(int cx, int cz) throws IOException {
|
||||
int i = ((cx & 31) << 2) + ((cz & 31) << 7);
|
||||
int offset = (((locations[i] & 0xFF) << 16) + ((locations[i + 1] & 0xFF) << 8) + ((locations[i+ 2] & 0xFF))) << 12;
|
||||
int offset = (((locations[i] & 0xFF) << 16) + ((locations[i + 1] & 0xFF) << 8) + ((locations[i + 2] & 0xFF))) << 12;
|
||||
int size = (locations[i + 3] & 0xFF) << 12;
|
||||
if (offset == 0) {
|
||||
return null;
|
||||
@ -187,6 +188,7 @@ public class MCAFile {
|
||||
|
||||
/**
|
||||
* CX, CZ, OFFSET, SIZE
|
||||
*
|
||||
* @param onEach
|
||||
* @throws IOException
|
||||
*/
|
||||
@ -196,7 +198,7 @@ public class MCAFile {
|
||||
char i = 0;
|
||||
for (int z = 0; z < 32; z++) {
|
||||
for (int x = 0; x < 32; x++, i += 4) {
|
||||
int offset = (((locations[i] & 0xFF) << 16) + ((locations[i + 1] & 0xFF) << 8) + ((locations[i+ 2] & 0xFF))) - 2;
|
||||
int offset = (((locations[i] & 0xFF) << 16) + ((locations[i + 1] & 0xFF) << 8) + ((locations[i + 2] & 0xFF))) - 2;
|
||||
int size = locations[i + 3] & 0xFF;
|
||||
if (size != 0) {
|
||||
if (offset < offsets.length) {
|
||||
@ -227,7 +229,7 @@ public class MCAFile {
|
||||
int i = 0;
|
||||
for (int z = 0; z < 32; z++) {
|
||||
for (int x = 0; x < 32; x++, i += 4) {
|
||||
int offset = (((locations[i] & 0xFF) << 16) + ((locations[i + 1] & 0xFF) << 8) + ((locations[i+ 2] & 0xFF)));
|
||||
int offset = (((locations[i] & 0xFF) << 16) + ((locations[i + 1] & 0xFF) << 8) + ((locations[i + 2] & 0xFF)));
|
||||
int size = locations[i + 3] & 0xFF;
|
||||
if (size != 0) {
|
||||
onEach.run(x, z, offset << 12, size << 12);
|
||||
@ -240,12 +242,13 @@ public class MCAFile {
|
||||
int i = 0;
|
||||
for (int z = 0; z < 32; z++) {
|
||||
for (int x = 0; x < 32; x++, i += 4) {
|
||||
int offset = (((locations[i] & 0xFF) << 16) + ((locations[i + 1] & 0xFF) << 8) + ((locations[i+ 2] & 0xFF)));
|
||||
int offset = (((locations[i] & 0xFF) << 16) + ((locations[i + 1] & 0xFF) << 8) + ((locations[i + 2] & 0xFF)));
|
||||
int size = locations[i + 3] & 0xFF;
|
||||
if (size != 0) {
|
||||
try {
|
||||
onEach.run(getChunk(x, z));
|
||||
} catch (Throwable ignore) {}
|
||||
} catch (Throwable ignore) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -253,7 +256,7 @@ public class MCAFile {
|
||||
|
||||
public int getOffset(int cx, int cz) {
|
||||
int i = ((cx & 31) << 2) + ((cz & 31) << 7);
|
||||
int offset = (((locations[i] & 0xFF) << 16) + ((locations[i + 1] & 0xFF) << 8) + ((locations[i+ 2] & 0xFF)));
|
||||
int offset = (((locations[i] & 0xFF) << 16) + ((locations[i + 1] & 0xFF) << 8) + ((locations[i + 2] & 0xFF)));
|
||||
return offset << 12;
|
||||
}
|
||||
|
||||
@ -264,14 +267,14 @@ public class MCAFile {
|
||||
|
||||
public List<Integer> getChunks() {
|
||||
final List<Integer> values = new ArrayList<>(chunks.size());
|
||||
for (int i = 0; i < locations.length; i+=4) {
|
||||
int offset = (((locations[i] & 0xFF) << 16) + ((locations[i + 1] & 0xFF) << 8) + ((locations[i+ 2] & 0xFF)));
|
||||
for (int i = 0; i < locations.length; i += 4) {
|
||||
int offset = (((locations[i] & 0xFF) << 16) + ((locations[i + 1] & 0xFF) << 8) + ((locations[i + 2] & 0xFF)));
|
||||
values.add(offset);
|
||||
}
|
||||
return values;
|
||||
}
|
||||
|
||||
public byte[] getChunkCompressedBytes(int offset) throws IOException{
|
||||
public byte[] getChunkCompressedBytes(int offset) throws IOException {
|
||||
if (offset == 0) {
|
||||
return null;
|
||||
}
|
||||
@ -362,7 +365,7 @@ public class MCAFile {
|
||||
return compressed;
|
||||
}
|
||||
|
||||
private byte[] getChunkBytes(int cx, int cz) throws Exception{
|
||||
private byte[] getChunkBytes(int cx, int cz) throws Exception {
|
||||
MCAChunk mca = getCachedChunk(cx, cz);
|
||||
if (mca == null) {
|
||||
int offset = getOffset(cx, cz);
|
||||
|
@ -5,12 +5,13 @@ import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
|
||||
/**
|
||||
* MCAQueue.filterWorld(MCAFilter)<br>
|
||||
* - Read and modify the world
|
||||
* - Read and modify the world
|
||||
*/
|
||||
public class MCAFilter<T> extends IterableThreadLocal<T> {
|
||||
|
||||
/**
|
||||
* Check whether a .mca file should be read
|
||||
*
|
||||
* @param mcaX
|
||||
* @param mcaZ
|
||||
* @return
|
||||
@ -21,8 +22,9 @@ public class MCAFilter<T> extends IterableThreadLocal<T> {
|
||||
|
||||
/**
|
||||
* Do something with the MCAFile<br>
|
||||
* - Return null if you don't want to filter chunks<br>
|
||||
* - Return the same file if you do want to filter chunks<br>
|
||||
* - Return null if you don't want to filter chunks<br>
|
||||
* - Return the same file if you do want to filter chunks<br>
|
||||
*
|
||||
* @param file
|
||||
* @return file or null
|
||||
*/
|
||||
@ -32,6 +34,7 @@ public class MCAFilter<T> extends IterableThreadLocal<T> {
|
||||
|
||||
/**
|
||||
* Check whether a chunk should be read
|
||||
*
|
||||
* @param cx
|
||||
* @param cz
|
||||
* @return
|
||||
@ -42,8 +45,9 @@ public class MCAFilter<T> extends IterableThreadLocal<T> {
|
||||
|
||||
/**
|
||||
* Do something with the MCAChunk<br>
|
||||
* - Return null if you don't want to filter blocks<br>
|
||||
* - Return the chunk if you do want to filter blocks<br>
|
||||
* - Return null if you don't want to filter blocks<br>
|
||||
* - Return the chunk if you do want to filter blocks<br>
|
||||
*
|
||||
* @param chunk
|
||||
* @return
|
||||
*/
|
||||
@ -53,20 +57,24 @@ public class MCAFilter<T> extends IterableThreadLocal<T> {
|
||||
|
||||
/**
|
||||
* Make changes to the block here<br>
|
||||
* - e.g. block.setId(...)<br>
|
||||
* - Note: Performance is critical here<br>
|
||||
* - e.g. block.setId(...)<br>
|
||||
* - Note: Performance is critical here<br>
|
||||
*
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @param block
|
||||
*/
|
||||
public void applyBlock(int x, int y, int z, BaseBlock block, T cache) {}
|
||||
public void applyBlock(int x, int y, int z, BaseBlock block, T cache) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Do something with the MCAChunk after block filtering<br>
|
||||
*
|
||||
* @param chunk
|
||||
* @param cache
|
||||
* @return
|
||||
*/
|
||||
public void finishChunk(MCAChunk chunk, T cache) {}
|
||||
public void finishChunk(MCAChunk chunk, T cache) {
|
||||
}
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ public class MCAQueue extends NMSMappedFaweQueue<FaweQueue, FaweChunk, FaweChunk
|
||||
public int getBiome(FaweChunk faweChunk, int x, int z) {
|
||||
if (faweChunk instanceof MCAChunk) {
|
||||
return ((MCAChunk) faweChunk).getBiomeArray()[((z & 0xF) << 4 | x & 0xF)];
|
||||
} else if (parent != null){
|
||||
} else if (parent != null) {
|
||||
return parent.getBiomeId(x, z);
|
||||
} else {
|
||||
return 0;
|
||||
|
@ -111,7 +111,7 @@ public class MCAQueueMap implements IFaweQueueMap {
|
||||
ignore.printStackTrace();
|
||||
}
|
||||
if (isHybridQueue) { // Use parent queue for in use chunks
|
||||
lastChunk = ((MappedFaweQueue)queue).getFaweQueueMap().getFaweChunk(cx, cz);
|
||||
lastChunk = ((MappedFaweQueue) queue).getFaweQueueMap().getFaweChunk(cx, cz);
|
||||
return lastChunk;
|
||||
}
|
||||
nullChunk.setLoc(queue, lastX, lastZ);
|
||||
|
@ -40,8 +40,9 @@ public abstract class MCAWriter {
|
||||
|
||||
/**
|
||||
* Set the MCA file offset (each mca file is 512 blocks)
|
||||
* - A negative value will shift the map negative
|
||||
* - This only applies to generation, not block get/set
|
||||
* - A negative value will shift the map negative
|
||||
* - This only applies to generation, not block get/set
|
||||
*
|
||||
* @param mcaOX
|
||||
* @param mcaOZ
|
||||
*/
|
||||
|
@ -81,10 +81,10 @@ public class MutableMCABackedBaseBlock extends BaseBlock {
|
||||
@Override
|
||||
public void setData(int value) {
|
||||
int indexShift = index >> 1;
|
||||
if((index & 1) == 0) {
|
||||
data[indexShift] = (byte)(data[indexShift] & 240 | value & 15);
|
||||
if ((index & 1) == 0) {
|
||||
data[indexShift] = (byte) (data[indexShift] & 240 | value & 15);
|
||||
} else {
|
||||
data[indexShift] = (byte)(data[indexShift] & 15 | (value & 15) << 4);
|
||||
data[indexShift] = (byte) (data[indexShift] & 15 | (value & 15) << 4);
|
||||
}
|
||||
chunk.setModified();
|
||||
}
|
||||
|
@ -10,14 +10,15 @@ public class CountFilter extends MCAFilterCounter {
|
||||
private final boolean[] allowedId = new boolean[FaweCache.getId(Character.MAX_VALUE)];
|
||||
private final boolean[] allowed = new boolean[Character.MAX_VALUE];
|
||||
|
||||
public CountFilter() {}
|
||||
public CountFilter() {
|
||||
}
|
||||
|
||||
public CountFilter addBlock(BaseBlock block) {
|
||||
addBlock(block.getId(), block.getData());
|
||||
return this;
|
||||
}
|
||||
|
||||
public CountFilter addBlock(int id, int data) {
|
||||
public CountFilter addBlock(int id, int data) {
|
||||
allowedId[id] = true;
|
||||
allowed[FaweCache.getCombined(id, data)] = true;
|
||||
return this;
|
||||
|
@ -9,7 +9,8 @@ import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
public class CountIdFilter extends MCAFilterCounter {
|
||||
private final boolean[] allowedId = new boolean[FaweCache.getId(Character.MAX_VALUE)];
|
||||
|
||||
public CountIdFilter() {}
|
||||
public CountIdFilter() {
|
||||
}
|
||||
|
||||
public CountIdFilter addBlock(int id) {
|
||||
allowedId[id] = true;
|
||||
|
@ -16,7 +16,7 @@ import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* Deletes unvisited MCA files and Chunks<br>
|
||||
* - This a global filter and cannot be used a selection<br>
|
||||
* - This a global filter and cannot be used a selection<br>
|
||||
*/
|
||||
public class DeleteUninhabitedFilter extends MCAFilterCounter {
|
||||
private final long inhabitedTicks;
|
||||
@ -26,6 +26,7 @@ public class DeleteUninhabitedFilter extends MCAFilterCounter {
|
||||
this.fileAgeMillis = fileAgeMillis;
|
||||
this.inhabitedTicks = inhabitedTicks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MCAFile applyFile(MCAFile mca) {
|
||||
File file = mca.getFile();
|
||||
@ -38,7 +39,8 @@ public class DeleteUninhabitedFilter extends MCAFilterCounter {
|
||||
get().add(512 * 512 * 256);
|
||||
return null;
|
||||
}
|
||||
} catch (IOException | UnsupportedOperationException ignore) {}
|
||||
} catch (IOException | UnsupportedOperationException ignore) {
|
||||
}
|
||||
try {
|
||||
ForkJoinPool pool = new ForkJoinPool();
|
||||
mca.init();
|
||||
|
@ -15,7 +15,8 @@ import java.util.List;
|
||||
public class MappedReplacePatternFilter extends MCAFilterCounter {
|
||||
private Pattern[] map = new Pattern[Character.MAX_VALUE + 1];
|
||||
|
||||
public MappedReplacePatternFilter() {}
|
||||
public MappedReplacePatternFilter() {
|
||||
}
|
||||
|
||||
public MappedReplacePatternFilter(String from, RandomPattern to, boolean useData) throws InputParseException {
|
||||
List<String> split = StringMan.split(from, ',');
|
||||
|
@ -13,6 +13,7 @@ public class ReplaceSimpleFilter extends MCAFilterCounter {
|
||||
this.from = from;
|
||||
this.to = to;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyBlock(int x, int y, int z, BaseBlock block, MutableLong count) {
|
||||
if (from.apply(block)) {
|
||||
|
@ -24,7 +24,7 @@ public class OreGen extends Resource {
|
||||
private double ONE_8 = 1 / 8F;
|
||||
private double ONE_16 = 1 / 16F;
|
||||
|
||||
public int laced =0;
|
||||
public int laced = 0;
|
||||
|
||||
public OreGen(Extent extent, Mask mask, Pattern pattern, int size, int minY, int maxY) {
|
||||
this.maxSize = size;
|
||||
|
@ -29,19 +29,19 @@ public class MutableVector extends Vector {
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if(!(obj instanceof Vector)) {
|
||||
if (!(obj instanceof Vector)) {
|
||||
return false;
|
||||
} else {
|
||||
Vector v = (Vector)obj;
|
||||
Vector v = (Vector) obj;
|
||||
return this.x == v.getX() && this.z == v.getZ() && this.y == v.getY();
|
||||
}
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
byte hash = 3;
|
||||
int hash1 = 59 * hash + (int)(Double.doubleToLongBits(this.x) ^ Double.doubleToLongBits(this.x) >>> 32);
|
||||
hash1 = 59 * hash1 + (int)(Double.doubleToLongBits(this.y) ^ Double.doubleToLongBits(this.y) >>> 32);
|
||||
hash1 = 59 * hash1 + (int)(Double.doubleToLongBits(this.z) ^ Double.doubleToLongBits(this.z) >>> 32);
|
||||
int hash1 = 59 * hash + (int) (Double.doubleToLongBits(this.x) ^ Double.doubleToLongBits(this.x) >>> 32);
|
||||
hash1 = 59 * hash1 + (int) (Double.doubleToLongBits(this.y) ^ Double.doubleToLongBits(this.y) >>> 32);
|
||||
hash1 = 59 * hash1 + (int) (Double.doubleToLongBits(this.z) ^ Double.doubleToLongBits(this.z) >>> 32);
|
||||
return hash1;
|
||||
}
|
||||
}
|
||||
|
@ -7,10 +7,10 @@ import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.function.pattern.AbstractPattern;
|
||||
|
||||
public class DataAngleMask extends AbstractPattern {
|
||||
public class DataAngleMask extends AbstractPattern {
|
||||
public final Extent extent;
|
||||
public final int maxY;
|
||||
public final double factor = 1d/255;
|
||||
public final double factor = 1d / 255;
|
||||
|
||||
public DataAngleMask(Extent extent) {
|
||||
this.extent = extent;
|
||||
|
@ -16,7 +16,7 @@ import javax.annotation.Nullable;
|
||||
public abstract class FaweChunk<T> implements Callable<FaweChunk> {
|
||||
|
||||
private FaweQueue parent;
|
||||
private int x,z;
|
||||
private int x, z;
|
||||
public static int HEIGHT = 256;
|
||||
|
||||
private final ArrayDeque<Runnable> tasks = new ArrayDeque<Runnable>();
|
||||
@ -32,7 +32,8 @@ public abstract class FaweChunk<T> implements Callable<FaweChunk> {
|
||||
|
||||
/**
|
||||
* Change the chunk's location<br>
|
||||
* - E.g. if you are cloning a chunk and want to set multiple
|
||||
* - E.g. if you are cloning a chunk and want to set multiple
|
||||
*
|
||||
* @param parent
|
||||
* @param x
|
||||
* @param z
|
||||
@ -45,6 +46,7 @@ public abstract class FaweChunk<T> implements Callable<FaweChunk> {
|
||||
|
||||
/**
|
||||
* Get the parent queue this chunk belongs to
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public FaweQueue getParent() {
|
||||
@ -61,6 +63,7 @@ public abstract class FaweChunk<T> implements Callable<FaweChunk> {
|
||||
|
||||
/**
|
||||
* Get a unique hashcode for this chunk
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public long longHash() {
|
||||
@ -69,6 +72,7 @@ public abstract class FaweChunk<T> implements Callable<FaweChunk> {
|
||||
|
||||
/**
|
||||
* Get a hashcode; unique below abs(x/z) < Short.MAX_VALUE
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@ -85,6 +89,7 @@ public abstract class FaweChunk<T> implements Callable<FaweChunk> {
|
||||
|
||||
/**
|
||||
* The modified sections
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public abstract int getBitMask();
|
||||
@ -92,6 +97,7 @@ public abstract class FaweChunk<T> implements Callable<FaweChunk> {
|
||||
/**
|
||||
* Get the combined block id at a location<br>
|
||||
* combined = (id <<<< 4) + data
|
||||
*
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
@ -127,10 +133,13 @@ public abstract class FaweChunk<T> implements Callable<FaweChunk> {
|
||||
|
||||
/**
|
||||
* Get the combined id array at a layer or null if it does not exist
|
||||
*
|
||||
* @param layer
|
||||
* @return char[] or null
|
||||
*/
|
||||
public @Nullable char[] getIdArray(int layer) {
|
||||
public
|
||||
@Nullable
|
||||
char[] getIdArray(int layer) {
|
||||
char[] ids = new char[4096];
|
||||
int by = layer << 4;
|
||||
int index = 0;
|
||||
@ -187,6 +196,7 @@ public abstract class FaweChunk<T> implements Callable<FaweChunk> {
|
||||
|
||||
/**
|
||||
* Fill this chunk with a block
|
||||
*
|
||||
* @param id
|
||||
* @param data
|
||||
*/
|
||||
@ -196,6 +206,7 @@ public abstract class FaweChunk<T> implements Callable<FaweChunk> {
|
||||
|
||||
/**
|
||||
* Fill a cuboid in this chunk with a block
|
||||
*
|
||||
* @param x1
|
||||
* @param x2
|
||||
* @param y1
|
||||
@ -217,6 +228,7 @@ public abstract class FaweChunk<T> implements Callable<FaweChunk> {
|
||||
|
||||
/**
|
||||
* Add a task to run when this chunk is dispatched
|
||||
*
|
||||
* @param run
|
||||
*/
|
||||
public void addNotifyTask(Runnable run) {
|
||||
@ -238,13 +250,15 @@ public abstract class FaweChunk<T> implements Callable<FaweChunk> {
|
||||
|
||||
/**
|
||||
* Get the underlying chunk object
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public abstract T getChunk();
|
||||
|
||||
/**
|
||||
* Set a tile entity at a location<br>
|
||||
* - May throw an error if an invalid block is at the location
|
||||
* - May throw an error if an invalid block is at the location
|
||||
*
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
@ -266,22 +280,25 @@ public abstract class FaweChunk<T> implements Callable<FaweChunk> {
|
||||
|
||||
/**
|
||||
* Get the UUID of entities being removed
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public abstract Set<UUID> getEntityRemoves();
|
||||
|
||||
/**
|
||||
* Get the map of location to tile entity<br>
|
||||
* - The byte pair represents the location in the chunk<br>
|
||||
* - The byte pair represents the location in the chunk<br>
|
||||
*
|
||||
* @return
|
||||
* @see com.boydti.fawe.util.MathMan#unpair16x (get0) => x
|
||||
* @see com.boydti.fawe.util.MathMan#unpair16y (get0) => z
|
||||
* get1 => y
|
||||
* @return
|
||||
*/
|
||||
public abstract Map<Short, CompoundTag> getTiles();
|
||||
|
||||
/**
|
||||
* Get the tile at a location
|
||||
*
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
@ -305,9 +322,10 @@ public abstract class FaweChunk<T> implements Callable<FaweChunk> {
|
||||
|
||||
/**
|
||||
* Spend time now so that the chunk can be more efficiently dispatched later<br>
|
||||
* - Modifications after this call will be ignored
|
||||
* - Modifications after this call will be ignored
|
||||
*/
|
||||
public void optimize() {}
|
||||
public void optimize() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
@ -319,9 +337,15 @@ public abstract class FaweChunk<T> implements Callable<FaweChunk> {
|
||||
|
||||
public abstract FaweChunk<T> copy(boolean shallow);
|
||||
|
||||
public void start() {};
|
||||
public void start() {
|
||||
}
|
||||
|
||||
public void end() {};
|
||||
;
|
||||
|
||||
public void end() {
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
@Override
|
||||
public abstract FaweChunk call();
|
||||
|
@ -22,7 +22,7 @@ public class FaweInputStream extends DataInputStream {
|
||||
public int readMedium() throws IOException {
|
||||
return (int) (
|
||||
(read() << 16) +
|
||||
(read() << 8) +
|
||||
(read() << 8) +
|
||||
read());
|
||||
}
|
||||
|
||||
|
@ -20,28 +20,34 @@ public class FaweLimit {
|
||||
|
||||
|
||||
public static FaweLimit MAX;
|
||||
|
||||
static {
|
||||
MAX = new FaweLimit() {
|
||||
@Override
|
||||
public boolean MAX_CHANGES() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean MAX_BLOCKSTATES() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean MAX_CHECKS() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean MAX_ENTITIES() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean MAX_FAILS() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean MAX_ITERATIONS() {
|
||||
return true;
|
||||
@ -88,15 +94,15 @@ public class FaweLimit {
|
||||
|
||||
public boolean isUnlimited() {
|
||||
return MAX_CHANGES == Integer.MAX_VALUE &&
|
||||
MAX_FAILS == Integer.MAX_VALUE &&
|
||||
MAX_CHECKS == Integer.MAX_VALUE &&
|
||||
MAX_ITERATIONS == Integer.MAX_VALUE &&
|
||||
MAX_BLOCKSTATES == Integer.MAX_VALUE &&
|
||||
MAX_ENTITIES == Integer.MAX_VALUE &&
|
||||
MAX_HISTORY == Integer.MAX_VALUE &&
|
||||
INVENTORY_MODE == 0 &&
|
||||
SPEED_REDUCTION == 0 &&
|
||||
FAST_PLACEMENT == true;
|
||||
MAX_FAILS == Integer.MAX_VALUE &&
|
||||
MAX_CHECKS == Integer.MAX_VALUE &&
|
||||
MAX_ITERATIONS == Integer.MAX_VALUE &&
|
||||
MAX_BLOCKSTATES == Integer.MAX_VALUE &&
|
||||
MAX_ENTITIES == Integer.MAX_VALUE &&
|
||||
MAX_HISTORY == Integer.MAX_VALUE &&
|
||||
INVENTORY_MODE == 0 &&
|
||||
SPEED_REDUCTION == 0 &&
|
||||
FAST_PLACEMENT == true;
|
||||
}
|
||||
|
||||
public void set(FaweLimit limit) {
|
||||
|
@ -42,7 +42,7 @@ public class FaweOutputStream extends DataOutputStream {
|
||||
if (nbtOut == null) {
|
||||
nbtOut = new NBTOutputStream(parent);
|
||||
}
|
||||
nbtOut.writeNamedTag(name,tag);
|
||||
nbtOut.writeNamedTag(name, tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -54,11 +54,12 @@ public abstract class FawePlayer<T> extends Metadatable {
|
||||
|
||||
/**
|
||||
* Wrap some object into a FawePlayer<br>
|
||||
* - org.bukkit.entity.Player
|
||||
* - org.spongepowered.api.entity.living.player
|
||||
* - com.sk89q.worldedit.entity.Player
|
||||
* - String (name)
|
||||
* - UUID (player UUID)
|
||||
* - org.bukkit.entity.Player
|
||||
* - org.spongepowered.api.entity.living.player
|
||||
* - com.sk89q.worldedit.entity.Player
|
||||
* - String (name)
|
||||
* - UUID (player UUID)
|
||||
*
|
||||
* @param obj
|
||||
* @param <V>
|
||||
* @return
|
||||
@ -86,14 +87,15 @@ public abstract class FawePlayer<T> extends Metadatable {
|
||||
MainUtil.handleError(e);
|
||||
return Fawe.imp().wrap(actor.getName());
|
||||
}
|
||||
} else if (obj instanceof PlayerWrapper){
|
||||
} else if (obj instanceof PlayerWrapper) {
|
||||
return wrap(((PlayerWrapper) obj).getParent());
|
||||
} else {
|
||||
try {
|
||||
Field fieldPlayer = actor.getClass().getDeclaredField("player");
|
||||
fieldPlayer.setAccessible(true);
|
||||
return wrap(fieldPlayer.get(actor));
|
||||
} catch (Throwable ignore) {}
|
||||
} catch (Throwable ignore) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (obj instanceof Actor) {
|
||||
@ -262,7 +264,7 @@ public abstract class FawePlayer<T> extends Metadatable {
|
||||
|
||||
/**
|
||||
* Loads any history items from disk:
|
||||
* - Should already be called if history on disk is enabled
|
||||
* - Should already be called if history on disk is enabled
|
||||
*/
|
||||
public void loadClipboardFromDisk() {
|
||||
File file = MainUtil.getFile(Fawe.imp().getDirectory(), Settings.IMP.PATHS.CLIPBOARD + File.separator + getUUID() + ".bd");
|
||||
@ -275,7 +277,8 @@ public abstract class FawePlayer<T> extends Metadatable {
|
||||
if (session.getClipboard() != null) {
|
||||
return;
|
||||
}
|
||||
} catch (EmptyClipboardException e) {}
|
||||
} catch (EmptyClipboardException e) {
|
||||
}
|
||||
if (player != null && session != null) {
|
||||
WorldData worldData = player.getWorld().getWorldData();
|
||||
Clipboard clip = doc.toClipboard();
|
||||
@ -295,6 +298,7 @@ public abstract class FawePlayer<T> extends Metadatable {
|
||||
|
||||
/**
|
||||
* Get the current World
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public World getWorld() {
|
||||
@ -312,7 +316,8 @@ public abstract class FawePlayer<T> extends Metadatable {
|
||||
|
||||
/**
|
||||
* Load all the undo EditSession's from disk for a world <br>
|
||||
* - Usually already called when necessary
|
||||
* - Usually already called when necessary
|
||||
*
|
||||
* @param world
|
||||
*/
|
||||
public void loadSessionsFromDisk(final World world) {
|
||||
@ -324,6 +329,7 @@ public abstract class FawePlayer<T> extends Metadatable {
|
||||
|
||||
/**
|
||||
* Send a title
|
||||
*
|
||||
* @param head
|
||||
* @param sub
|
||||
*/
|
||||
@ -336,6 +342,7 @@ public abstract class FawePlayer<T> extends Metadatable {
|
||||
|
||||
/**
|
||||
* Get the player's limit
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public FaweLimit getLimit() {
|
||||
@ -344,18 +351,21 @@ public abstract class FawePlayer<T> extends Metadatable {
|
||||
|
||||
/**
|
||||
* Get the player's name
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public abstract String getName();
|
||||
|
||||
/**
|
||||
* Get the player's UUID
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public abstract UUID getUUID();
|
||||
|
||||
/**
|
||||
* Check the player's permission
|
||||
*
|
||||
* @param perm
|
||||
* @return
|
||||
*/
|
||||
@ -363,6 +373,7 @@ public abstract class FawePlayer<T> extends Metadatable {
|
||||
|
||||
/**
|
||||
* Set a permission (requires Vault)
|
||||
*
|
||||
* @param perm
|
||||
* @param flag
|
||||
*/
|
||||
@ -370,24 +381,28 @@ public abstract class FawePlayer<T> extends Metadatable {
|
||||
|
||||
/**
|
||||
* Send a message to the player
|
||||
*
|
||||
* @param message
|
||||
*/
|
||||
public abstract void sendMessage(final String message);
|
||||
|
||||
/**
|
||||
* Have the player execute a command
|
||||
*
|
||||
* @param substring
|
||||
*/
|
||||
public abstract void executeCommand(final String substring);
|
||||
|
||||
/**
|
||||
* Get the player's location
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public abstract FaweLocation getLocation();
|
||||
|
||||
/**
|
||||
* Get the WorldEdit player object
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public abstract Player toWorldEditPlayer();
|
||||
@ -403,6 +418,7 @@ public abstract class FawePlayer<T> extends Metadatable {
|
||||
|
||||
/**
|
||||
* Get the player's current selection (or null)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Region getSelection() {
|
||||
@ -415,6 +431,7 @@ public abstract class FawePlayer<T> extends Metadatable {
|
||||
|
||||
/**
|
||||
* Get the player's current LocalSession
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public LocalSession getSession() {
|
||||
@ -423,6 +440,7 @@ public abstract class FawePlayer<T> extends Metadatable {
|
||||
|
||||
/**
|
||||
* Get the player's current allowed WorldEdit regions
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public RegionWrapper[] getCurrentRegions() {
|
||||
@ -435,6 +453,7 @@ public abstract class FawePlayer<T> extends Metadatable {
|
||||
|
||||
/**
|
||||
* Set the player's WorldEdit selection to the following CuboidRegion
|
||||
*
|
||||
* @param region
|
||||
*/
|
||||
public void setSelection(final RegionWrapper region) {
|
||||
@ -447,6 +466,7 @@ public abstract class FawePlayer<T> extends Metadatable {
|
||||
|
||||
/**
|
||||
* Set the player's WorldEdit selection
|
||||
*
|
||||
* @param selector
|
||||
*/
|
||||
public void setSelection(final RegionSelector selector) {
|
||||
@ -455,6 +475,7 @@ public abstract class FawePlayer<T> extends Metadatable {
|
||||
|
||||
/**
|
||||
* Get the largest region in the player's allowed WorldEdit region
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public RegionWrapper getLargestRegion() {
|
||||
@ -477,6 +498,7 @@ public abstract class FawePlayer<T> extends Metadatable {
|
||||
|
||||
/**
|
||||
* Check if the player has WorldEdit bypass enabled
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean hasWorldEditBypass() {
|
||||
@ -485,7 +507,7 @@ public abstract class FawePlayer<T> extends Metadatable {
|
||||
|
||||
/**
|
||||
* Unregister this player (delets all metadata etc)
|
||||
* - Usually called on logout
|
||||
* - Usually called on logout
|
||||
*/
|
||||
public void unregister() {
|
||||
if (Settings.IMP.HISTORY.DELETE_ON_LOGOUT) {
|
||||
@ -507,7 +529,8 @@ public abstract class FawePlayer<T> extends Metadatable {
|
||||
|
||||
/**
|
||||
* Get the tracked EditSession(s) for this player<br>
|
||||
* - Queued or autoqueued EditSessions are considered tracked
|
||||
* - Queued or autoqueued EditSessions are considered tracked
|
||||
*
|
||||
* @param requiredStage
|
||||
* @return
|
||||
*/
|
||||
|
@ -106,8 +106,9 @@ public abstract class FaweQueue implements HasFaweQueue {
|
||||
|
||||
/**
|
||||
* Add a progress task<br>
|
||||
* - Progress type
|
||||
* - Amount of type
|
||||
* - Progress type
|
||||
* - Amount of type
|
||||
*
|
||||
* @param progressTask
|
||||
*/
|
||||
public void setProgressTracker(RunnableVal2<ProgressType, Integer> progressTask) {
|
||||
@ -150,7 +151,8 @@ public abstract class FaweQueue implements HasFaweQueue {
|
||||
return changeTask;
|
||||
}
|
||||
|
||||
public void optimize() {}
|
||||
public void optimize() {
|
||||
}
|
||||
|
||||
public int setBlocks(CuboidRegion cuboid, final int id, final int data) {
|
||||
RegionWrapper current = new RegionWrapper(cuboid.getMinimumPoint(), cuboid.getMaximumPoint());
|
||||
@ -295,9 +297,11 @@ public abstract class FaweQueue implements HasFaweQueue {
|
||||
|
||||
public abstract boolean regenerateChunk(int x, int z, @Nullable BaseBiome biome, @Nullable Long seed);
|
||||
|
||||
public void startSet(boolean parallel) {}
|
||||
public void startSet(boolean parallel) {
|
||||
}
|
||||
|
||||
public void endSet(boolean parallel) {}
|
||||
public void endSet(boolean parallel) {
|
||||
}
|
||||
|
||||
public int cancel() {
|
||||
clear();
|
||||
@ -321,6 +325,7 @@ public abstract class FaweQueue implements HasFaweQueue {
|
||||
|
||||
/**
|
||||
* Gets the FaweChunk and sets the requested blocks
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public abstract boolean next(int amount, long time);
|
||||
@ -346,10 +351,10 @@ public abstract class FaweQueue implements HasFaweQueue {
|
||||
* This method is called when the server is < 1% available memory
|
||||
*/
|
||||
public abstract void clear();
|
||||
|
||||
|
||||
public abstract void addNotifyTask(int x, int z, Runnable runnable);
|
||||
|
||||
public boolean hasBlock(int x, int y, int z) throws FaweException.FaweChunkLoadException {
|
||||
public boolean hasBlock(int x, int y, int z) throws FaweException.FaweChunkLoadException {
|
||||
return getCombinedId4Data(x, y, z) != 0;
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ public class HistoryExtent extends AbstractDelegateExtent {
|
||||
/**
|
||||
* Create a new instance.
|
||||
*
|
||||
* @param extent the extent
|
||||
* @param extent the extent
|
||||
* @param changeSet the change set
|
||||
*/
|
||||
public HistoryExtent(final EditSession session, final Extent extent, final FaweChangeSet changeSet, FaweQueue queue) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.boydti.fawe.object;
|
||||
|
||||
public class IntegerTrio {
|
||||
public int x,y,z;
|
||||
public int x, y, z;
|
||||
|
||||
public IntegerTrio(int x, int y, int z) {
|
||||
this.x = x;
|
||||
@ -15,7 +15,8 @@ public class IntegerTrio {
|
||||
this.z = node.z;
|
||||
}
|
||||
|
||||
public IntegerTrio() {}
|
||||
public IntegerTrio() {
|
||||
}
|
||||
|
||||
public final void set(int x, int y, int z) {
|
||||
this.x = x;
|
||||
|
@ -8,6 +8,7 @@ public class Metadatable {
|
||||
|
||||
/**
|
||||
* Set some session only metadata for the player
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
* @return previous value
|
||||
@ -22,6 +23,7 @@ public class Metadatable {
|
||||
|
||||
/**
|
||||
* Get the metadata for a key.
|
||||
*
|
||||
* @param <V>
|
||||
* @param key
|
||||
* @return
|
||||
@ -35,6 +37,7 @@ public class Metadatable {
|
||||
|
||||
/**
|
||||
* Get the metadata for a specific key (or return the default provided)
|
||||
*
|
||||
* @param key
|
||||
* @param def
|
||||
* @param <V>
|
||||
@ -50,8 +53,9 @@ public class Metadatable {
|
||||
|
||||
/**
|
||||
* Delete the metadata for a key.
|
||||
* - metadata is session only
|
||||
* - deleting other plugin's metadata may cause issues
|
||||
* - metadata is session only
|
||||
* - deleting other plugin's metadata may cause issues
|
||||
*
|
||||
* @param key
|
||||
*/
|
||||
public <V> V deleteMeta(String key) {
|
||||
|
@ -2,9 +2,10 @@ package com.boydti.fawe.object;
|
||||
|
||||
public abstract class RunnableVal<T> implements Runnable {
|
||||
public T value;
|
||||
|
||||
public RunnableVal() {}
|
||||
|
||||
|
||||
public RunnableVal() {
|
||||
}
|
||||
|
||||
public RunnableVal(T value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
@ -3,9 +3,10 @@ package com.boydti.fawe.object;
|
||||
public abstract class RunnableVal2<T, U> implements Runnable {
|
||||
public T value1;
|
||||
public U value2;
|
||||
|
||||
public RunnableVal2() {}
|
||||
|
||||
|
||||
public RunnableVal2() {
|
||||
}
|
||||
|
||||
public RunnableVal2(T value1, U value2) {
|
||||
this.value1 = value1;
|
||||
this.value2 = value2;
|
||||
@ -15,7 +16,7 @@ public abstract class RunnableVal2<T, U> implements Runnable {
|
||||
public void run() {
|
||||
run(this.value1, this.value2);
|
||||
}
|
||||
|
||||
|
||||
public abstract void run(T value1, U value2);
|
||||
|
||||
public RunnableVal2<T, U> runAndGet(T value1, U value2) {
|
||||
|
@ -4,9 +4,10 @@ public abstract class RunnableVal3<T, U, V> implements Runnable {
|
||||
public T value1;
|
||||
public U value2;
|
||||
public V value3;
|
||||
|
||||
public RunnableVal3() {}
|
||||
|
||||
|
||||
public RunnableVal3() {
|
||||
}
|
||||
|
||||
public RunnableVal3(T value1, U value2, V value3) {
|
||||
this.value1 = value1;
|
||||
this.value2 = value2;
|
||||
@ -17,6 +18,6 @@ public abstract class RunnableVal3<T, U, V> implements Runnable {
|
||||
public void run() {
|
||||
run(value1, value2, value3);
|
||||
}
|
||||
|
||||
|
||||
public abstract void run(T value1, U value2, V value3);
|
||||
}
|
||||
|
@ -6,7 +6,8 @@ public abstract class RunnableVal4<T, U, V, W> implements Runnable {
|
||||
public V value3;
|
||||
public W value4;
|
||||
|
||||
public RunnableVal4() {}
|
||||
public RunnableVal4() {
|
||||
}
|
||||
|
||||
public RunnableVal4(T value1, U value2, V value3, W value4) {
|
||||
this.value1 = value1;
|
||||
|
@ -18,7 +18,7 @@ public class ErodeBrush implements Brush {
|
||||
private PseudoRandom rand = new PseudoRandom();
|
||||
|
||||
private static final Vector[] FACES_TO_CHECK = {new Vector(0, 0, 1), new Vector(0, 0, -1), new Vector(0, 1, 0), new Vector(0, -1, 0), new Vector(1, 0, 0), new Vector(-1, 0, 0)};
|
||||
|
||||
|
||||
@Override
|
||||
public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException {
|
||||
this.erosion(editSession, 2, 1, 5, 1, position, size);
|
||||
|
@ -82,7 +82,8 @@ public class ScatterBrush implements Brush {
|
||||
finish(editSession, placed, position, pattern, size);
|
||||
}
|
||||
|
||||
public void finish(EditSession editSession, LocalBlockVectorSet placed, Vector pos, Pattern pattern, double size) {}
|
||||
public void finish(EditSession editSession, LocalBlockVectorSet placed, Vector pos, Pattern pattern, double size) {
|
||||
}
|
||||
|
||||
public boolean canApply(EditSession editSession, Vector pos) {
|
||||
return mask.test(pos);
|
||||
|
@ -17,7 +17,7 @@ import com.sk89q.worldedit.regions.selector.CuboidRegionSelector;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import java.util.List;
|
||||
|
||||
public class ScatterCommand extends ScatterBrush{
|
||||
public class ScatterCommand extends ScatterBrush {
|
||||
private final String command;
|
||||
|
||||
public ScatterCommand(int count, int distance, String command) {
|
||||
|
@ -56,51 +56,51 @@ public class SplineBrush implements Brush {
|
||||
boolean newPos = this.position == null || !position.equals(this.position);
|
||||
this.position = position;
|
||||
if (newPos) {
|
||||
if (positionSets.size() >= MAX_POINTS) {
|
||||
throw new FaweException(BBC.WORLDEDIT_CANCEL_REASON_MAX_CHECKS);
|
||||
}
|
||||
final ArrayList<Vector> points = new ArrayList<>();
|
||||
if (size > 0) {
|
||||
DFSRecursiveVisitor visitor = new DFSRecursiveVisitor(mask, new RegionFunction() {
|
||||
@Override
|
||||
public boolean apply(Vector p) throws WorldEditException {
|
||||
points.add(new Vector(p));
|
||||
return true;
|
||||
}
|
||||
}, (int) size, 1);
|
||||
List<Vector> directions = visitor.getDirections();
|
||||
for (int x = -1; x <= 1; x++) {
|
||||
for (int y = -1; y <= 1; y++) {
|
||||
for (int z = -1; z <= 1; z++) {
|
||||
if (x != 0 || y != 0 || z != 0) {
|
||||
Vector pos = new Vector(x, y, z);
|
||||
if (!directions.contains(pos)) {
|
||||
directions.add(pos);
|
||||
}
|
||||
if (positionSets.size() >= MAX_POINTS) {
|
||||
throw new FaweException(BBC.WORLDEDIT_CANCEL_REASON_MAX_CHECKS);
|
||||
}
|
||||
final ArrayList<Vector> points = new ArrayList<>();
|
||||
if (size > 0) {
|
||||
DFSRecursiveVisitor visitor = new DFSRecursiveVisitor(mask, new RegionFunction() {
|
||||
@Override
|
||||
public boolean apply(Vector p) throws WorldEditException {
|
||||
points.add(new Vector(p));
|
||||
return true;
|
||||
}
|
||||
}, (int) size, 1);
|
||||
List<Vector> directions = visitor.getDirections();
|
||||
for (int x = -1; x <= 1; x++) {
|
||||
for (int y = -1; y <= 1; y++) {
|
||||
for (int z = -1; z <= 1; z++) {
|
||||
if (x != 0 || y != 0 || z != 0) {
|
||||
Vector pos = new Vector(x, y, z);
|
||||
if (!directions.contains(pos)) {
|
||||
directions.add(pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Collections.sort(directions, new Comparator<Vector>() {
|
||||
@Override
|
||||
public int compare(Vector o1, Vector o2) {
|
||||
return (int) Math.signum(o1.lengthSq() - o2.lengthSq());
|
||||
}
|
||||
});
|
||||
visitor.visit(position);
|
||||
Operations.completeBlindly(visitor);
|
||||
if (points.size() > numSplines) {
|
||||
numSplines = points.size();
|
||||
}
|
||||
Collections.sort(directions, new Comparator<Vector>() {
|
||||
@Override
|
||||
public int compare(Vector o1, Vector o2) {
|
||||
return (int) Math.signum(o1.lengthSq() - o2.lengthSq());
|
||||
}
|
||||
} else {
|
||||
points.add(position);
|
||||
}
|
||||
this.positionSets.add(points);
|
||||
player.print(BBC.getPrefix() + BBC.BRUSH_SPLINE_PRIMARY_2.s());
|
||||
if (!visualization) {
|
||||
return;
|
||||
});
|
||||
visitor.visit(position);
|
||||
Operations.completeBlindly(visitor);
|
||||
if (points.size() > numSplines) {
|
||||
numSplines = points.size();
|
||||
}
|
||||
} else {
|
||||
points.add(position);
|
||||
}
|
||||
this.positionSets.add(points);
|
||||
player.print(BBC.getPrefix() + BBC.BRUSH_SPLINE_PRIMARY_2.s());
|
||||
if (!visualization) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (positionSets.size() < 2) {
|
||||
player.print(BBC.getPrefix() + BBC.BRUSH_SPLINE_SECONDARY_ERROR.s());
|
||||
return;
|
||||
@ -166,8 +166,12 @@ public class SplineBrush implements Brush {
|
||||
}
|
||||
|
||||
// Calc full 3x3 covariance matrix, excluding symmetries:
|
||||
double xx = 0.0; double xy = 0.0; double xz = 0.0;
|
||||
double yy = 0.0; double yz = 0.0; double zz = 0.0;
|
||||
double xx = 0.0;
|
||||
double xy = 0.0;
|
||||
double xz = 0.0;
|
||||
double yy = 0.0;
|
||||
double yz = 0.0;
|
||||
double zz = 0.0;
|
||||
|
||||
Vector r = new Vector();
|
||||
for (Vector p : points) {
|
||||
@ -182,9 +186,9 @@ public class SplineBrush implements Brush {
|
||||
zz += r.getZ() * r.getZ();
|
||||
}
|
||||
|
||||
double det_x = yy*zz - yz*yz;
|
||||
double det_y = xx*zz - xz*xz;
|
||||
double det_z = xx*yy - xy*xy;
|
||||
double det_x = yy * zz - yz * yz;
|
||||
double det_y = xx * zz - xz * xz;
|
||||
double det_z = xx * yy - xy * xy;
|
||||
|
||||
double det_max = Math.max(Math.max(det_x, det_y), det_z);
|
||||
if (det_max <= 0.0) {
|
||||
@ -194,18 +198,19 @@ public class SplineBrush implements Brush {
|
||||
// Pick path with best conditioning:
|
||||
Vector dir;
|
||||
if (det_max == det_x) {
|
||||
double a = (xz*yz - xy*zz) / det_x;
|
||||
double b = (xy*yz - xz*yy) / det_x;
|
||||
double a = (xz * yz - xy * zz) / det_x;
|
||||
double b = (xy * yz - xz * yy) / det_x;
|
||||
dir = new Vector(1.0, a, b);
|
||||
} else if (det_max == det_y) {
|
||||
double a = (yz*xz - xy*zz) / det_y;
|
||||
double b = (xy*xz - yz*xx) / det_y;
|
||||
double a = (yz * xz - xy * zz) / det_y;
|
||||
double b = (xy * xz - yz * xx) / det_y;
|
||||
dir = new Vector(a, 1.0, b);
|
||||
} else {
|
||||
double a = (yz*xy - xz*yy) / det_z;
|
||||
double b = (xz*xy - yz*xx) / det_z;
|
||||
double a = (yz * xy - xz * yy) / det_z;
|
||||
double b = (xz * xy - yz * xx) / det_z;
|
||||
dir = new Vector(a, b, 1.0);
|
||||
};
|
||||
}
|
||||
;
|
||||
return dir.normalize();
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SurfaceSpline implements Brush {
|
||||
final double tension, bias,continuity, quality;
|
||||
final double tension, bias, continuity, quality;
|
||||
|
||||
public SurfaceSpline(final double tension, final double bias, final double continuity, final double quality) {
|
||||
this.tension = tension;
|
||||
@ -60,7 +60,7 @@ public class SurfaceSpline implements Brush {
|
||||
if (tipy == -1) continue;
|
||||
if (radius == 0) {
|
||||
editSession.setBlock(tipx, tipy, tipz, pattern.next(tipx, tipy, tipz));
|
||||
} else {
|
||||
} else {
|
||||
vset.add(tipx, tipy, tipz);
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
package com.boydti.fawe.object.brush;
|
||||
|
||||
public enum TargetMode {
|
||||
TARGET_BLOCK_RANGE,
|
||||
FOWARD_POINT_PITCH,
|
||||
TARGET_POINT_HEIGHT,
|
||||
TARGET_FACE_RANGE,
|
||||
TARGET_BLOCK_RANGE,
|
||||
FOWARD_POINT_PITCH,
|
||||
TARGET_POINT_HEIGHT,
|
||||
TARGET_FACE_RANGE,
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ public class ArrayHeightMap extends ScalableHeightMap {
|
||||
// The height map width/length
|
||||
private final int width, length;
|
||||
// The size to width/length ratio
|
||||
private double rx,rz;
|
||||
private double rx, rz;
|
||||
|
||||
public ArrayHeightMap(byte[][] height) {
|
||||
setSize(5);
|
||||
|
@ -16,6 +16,7 @@ public class AverageHeightMapFilter {
|
||||
this.maxY = maxY;
|
||||
this.buffer = new int[inData.length];
|
||||
}
|
||||
|
||||
public int[] filter(int iterations) {
|
||||
for (int j = 0; j < iterations; j++) {
|
||||
int a = -width;
|
||||
|
@ -157,6 +157,6 @@ public interface HeightMap {
|
||||
}
|
||||
}
|
||||
}
|
||||
return new int[][] {oldData, newData};
|
||||
return new int[][]{oldData, newData};
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ import java.io.InputStream;
|
||||
import java.util.HashSet;
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
public class ScalableHeightMap implements com.boydti.fawe.object.brush.heightmap.HeightMap{
|
||||
public class ScalableHeightMap implements com.boydti.fawe.object.brush.heightmap.HeightMap {
|
||||
public int size2;
|
||||
public int size;
|
||||
|
||||
@ -97,8 +97,8 @@ public class ScalableHeightMap implements com.boydti.fawe.object.brush.heightmap
|
||||
int length = heightFile.getHeight();
|
||||
Raster data = heightFile.getData();
|
||||
byte[][] array = new byte[width][length];
|
||||
double third = 1/3.0;
|
||||
double alphaInverse = 1/255.0;
|
||||
double third = 1 / 3.0;
|
||||
double alphaInverse = 1 / 255.0;
|
||||
for (int x = 0; x < width; x++) {
|
||||
for (int z = 0; z < length; z++) {
|
||||
int pixel = heightFile.getRGB(x, z);
|
||||
|
@ -17,7 +17,7 @@ public class ScrollMask extends ScrollAction {
|
||||
|
||||
@Override
|
||||
public boolean increment(Player player, int amount) {
|
||||
if (masks.length > 1) {
|
||||
if (masks.length > 1) {
|
||||
getTool().setMask(masks[MathMan.wrap(index += amount, 0, masks.length - 1)]);
|
||||
return true;
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ public class ScrollPattern extends ScrollAction {
|
||||
|
||||
@Override
|
||||
public boolean increment(Player player, int amount) {
|
||||
if (patterns.length > 1) {
|
||||
if (patterns.length > 1) {
|
||||
getTool().setFill(patterns[MathMan.wrap(index += amount, 0, patterns.length - 1)]);
|
||||
return true;
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ import java.util.UUID;
|
||||
|
||||
/**
|
||||
* FAWE visualizations display glass (20) as a placeholder
|
||||
* - Using a non transparent block can cause FPS lag
|
||||
* - Using a non transparent block can cause FPS lag
|
||||
*/
|
||||
public class VisualChunk extends FaweChunk<FaweChunk> {
|
||||
|
||||
@ -112,13 +112,13 @@ public class VisualChunk extends FaweChunk<FaweChunk> {
|
||||
public void setBlock(int x, int y, int z, int id, int data) {
|
||||
int index = getIndex(x, y, z);
|
||||
try {
|
||||
if (id == 0) {
|
||||
add.clear(index);
|
||||
remove.set(index);
|
||||
} else {
|
||||
remove.clear(index);
|
||||
add.set(index);
|
||||
}
|
||||
if (id == 0) {
|
||||
add.clear(index);
|
||||
remove.set(index);
|
||||
} else {
|
||||
remove.clear(index);
|
||||
add.set(index);
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ public class MutableBiomeChange implements Change {
|
||||
private MutableBlockVector2D mutable = new MutableBlockVector2D();
|
||||
private BaseBiome from;
|
||||
private BaseBiome to;
|
||||
|
||||
public MutableBiomeChange() {
|
||||
this.from = new BaseBiome(0);
|
||||
this.to = new BaseBiome(0);
|
||||
|
@ -30,7 +30,8 @@ public class BlockBagChangeSet extends AbstractDelegateChangeSet {
|
||||
*
|
||||
* @return a block bag, which may be null if none is used
|
||||
*/
|
||||
public @Nullable
|
||||
public
|
||||
@Nullable
|
||||
BlockBag getBlockBag() {
|
||||
return blockBag;
|
||||
}
|
||||
@ -79,7 +80,8 @@ public class BlockBagChangeSet extends AbstractDelegateChangeSet {
|
||||
if (combinedFrom != 0) {
|
||||
try {
|
||||
blockBag.storeDroppedBlock(FaweCache.getId(combinedFrom), FaweCache.getData(combinedFrom));
|
||||
} catch (BlockBagException ignored) {}
|
||||
} catch (BlockBagException ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
super.add(x, y, z, combinedFrom, combinedTo);
|
||||
|
@ -24,10 +24,10 @@ import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Store the change on disk
|
||||
* - High disk usage
|
||||
* - Moderate CPU usage
|
||||
* - Minimal memory usage
|
||||
* - Slow
|
||||
* - High disk usage
|
||||
* - Moderate CPU usage
|
||||
* - Minimal memory usage
|
||||
* - Slow
|
||||
*/
|
||||
public class DiskStorageHistory extends FaweStreamChangeSet {
|
||||
|
||||
|
@ -127,16 +127,25 @@ public abstract class FaweChangeSet implements ChangeSet {
|
||||
}
|
||||
|
||||
public abstract void addTileCreate(CompoundTag tag);
|
||||
|
||||
public abstract void addTileRemove(CompoundTag tag);
|
||||
|
||||
public abstract void addEntityRemove(CompoundTag tag);
|
||||
|
||||
public abstract void addEntityCreate(CompoundTag tag);
|
||||
|
||||
public abstract void addBiomeChange(int x, int z, BaseBiome from, BaseBiome to);
|
||||
|
||||
public Iterator<Change> getIterator(BlockBag blockBag, int mode, boolean redo) {
|
||||
return getIterator(redo);
|
||||
}
|
||||
|
||||
public abstract Iterator<Change> getIterator(boolean redo);
|
||||
|
||||
public void delete() {};
|
||||
public void delete() {
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
public EditSession toEditSession(FawePlayer player) {
|
||||
return toEditSession(player, null);
|
||||
|
@ -70,14 +70,19 @@ public abstract class FaweStreamChangeSet extends FaweChangeSet {
|
||||
|
||||
public interface FaweStreamPositionDelegate {
|
||||
void write(OutputStream out, int x, int y, int z) throws IOException;
|
||||
|
||||
int readX(FaweInputStream in) throws IOException;
|
||||
|
||||
int readY(FaweInputStream in) throws IOException;
|
||||
|
||||
int readZ(FaweInputStream in) throws IOException;
|
||||
}
|
||||
|
||||
public interface FaweStreamIdDelegate {
|
||||
void writeChange(OutputStream out, int from, int to) throws IOException;
|
||||
|
||||
void readCombined(FaweInputStream in, MutableBlockChange change, boolean dir) throws IOException;
|
||||
|
||||
void readCombined(FaweInputStream in, MutableFullBlockChange change, boolean dir) throws IOException;
|
||||
}
|
||||
|
||||
@ -141,7 +146,8 @@ public abstract class FaweStreamChangeSet extends FaweChangeSet {
|
||||
}
|
||||
if (mode == 1 || mode == 4) { // small
|
||||
posDel = new FaweStreamPositionDelegate() {
|
||||
int lx,ly,lz;
|
||||
int lx, ly, lz;
|
||||
|
||||
@Override
|
||||
public void write(OutputStream out, int x, int y, int z) throws IOException {
|
||||
int rx = -lx + (lx = x);
|
||||
@ -180,7 +186,8 @@ public abstract class FaweStreamChangeSet extends FaweChangeSet {
|
||||
} else {
|
||||
posDel = new FaweStreamPositionDelegate() {
|
||||
byte[] buffer = new byte[5];
|
||||
int lx,ly,lz;
|
||||
int lx, ly, lz;
|
||||
|
||||
@Override
|
||||
public void write(OutputStream stream, int x, int y, int z) throws IOException {
|
||||
int rx = -lx + (lx = x);
|
||||
@ -268,17 +275,27 @@ public abstract class FaweStreamChangeSet extends FaweChangeSet {
|
||||
}
|
||||
|
||||
public abstract OutputStream getBlockOS(int x, int y, int z) throws IOException;
|
||||
|
||||
public abstract OutputStream getBiomeOS() throws IOException;
|
||||
|
||||
public abstract NBTOutputStream getEntityCreateOS() throws IOException;
|
||||
|
||||
public abstract NBTOutputStream getEntityRemoveOS() throws IOException;
|
||||
|
||||
public abstract NBTOutputStream getTileCreateOS() throws IOException;
|
||||
|
||||
public abstract NBTOutputStream getTileRemoveOS() throws IOException;
|
||||
|
||||
public abstract FaweInputStream getBlockIS() throws IOException;
|
||||
|
||||
public abstract FaweInputStream getBiomeIS() throws IOException;
|
||||
|
||||
public abstract NBTInputStream getEntityCreateIS() throws IOException;
|
||||
|
||||
public abstract NBTInputStream getEntityRemoveIS() throws IOException;
|
||||
|
||||
public abstract NBTInputStream getTileCreateIS() throws IOException;
|
||||
|
||||
public abstract NBTInputStream getTileRemoveIS() throws IOException;
|
||||
|
||||
private int blockSize;
|
||||
@ -310,8 +327,7 @@ public abstract class FaweStreamChangeSet extends FaweChangeSet {
|
||||
//x
|
||||
posDel.write(stream, x - originX, y, z - originZ);
|
||||
idDel.writeChange(stream, combinedFrom, combinedTo);
|
||||
}
|
||||
catch (Throwable e) {
|
||||
} catch (Throwable e) {
|
||||
MainUtil.handleError(e);
|
||||
}
|
||||
}
|
||||
@ -331,8 +347,7 @@ public abstract class FaweStreamChangeSet extends FaweChangeSet {
|
||||
os.write((byte) (z));
|
||||
os.write(from.getId());
|
||||
os.write(to.getId());
|
||||
}
|
||||
catch (Throwable e) {
|
||||
} catch (Throwable e) {
|
||||
MainUtil.handleError(e);
|
||||
}
|
||||
}
|
||||
@ -397,6 +412,7 @@ public abstract class FaweStreamChangeSet extends FaweChangeSet {
|
||||
final MutableBlockChange change = new MutableBlockChange(0, 0, 0, (short) 0, (byte) 0);
|
||||
return new Iterator<MutableBlockChange>() {
|
||||
private MutableBlockChange last = read();
|
||||
|
||||
public MutableBlockChange read() {
|
||||
try {
|
||||
change.x = posDel.readX(is) + originX;
|
||||
@ -447,6 +463,7 @@ public abstract class FaweStreamChangeSet extends FaweChangeSet {
|
||||
final MutableBiomeChange change = new MutableBiomeChange();
|
||||
return new Iterator<MutableBiomeChange>() {
|
||||
private MutableBiomeChange last = new MutableBiomeChange();
|
||||
|
||||
public MutableBiomeChange read() {
|
||||
try {
|
||||
int int1 = is.read();
|
||||
@ -513,6 +530,7 @@ public abstract class FaweStreamChangeSet extends FaweChangeSet {
|
||||
final MutableFullBlockChange change = new MutableFullBlockChange(blockBag, inventory, dir);
|
||||
return new Iterator<MutableFullBlockChange>() {
|
||||
private MutableFullBlockChange last = read();
|
||||
|
||||
public MutableFullBlockChange read() {
|
||||
try {
|
||||
change.x = posDel.readX(is) + originX;
|
||||
@ -569,7 +587,8 @@ public abstract class FaweStreamChangeSet extends FaweChangeSet {
|
||||
CompoundTag tag = (CompoundTag) is.readTag();
|
||||
change.tag = tag;
|
||||
return change;
|
||||
} catch (Exception ignoreOEF) {}
|
||||
} catch (Exception ignoreOEF) {
|
||||
}
|
||||
try {
|
||||
is.close();
|
||||
} catch (IOException e) {
|
||||
@ -618,7 +637,8 @@ public abstract class FaweStreamChangeSet extends FaweChangeSet {
|
||||
CompoundTag tag = (CompoundTag) is.readTag();
|
||||
change.tag = tag;
|
||||
return change;
|
||||
} catch (Exception ignoreOEF) {}
|
||||
} catch (Exception ignoreOEF) {
|
||||
}
|
||||
try {
|
||||
is.close();
|
||||
} catch (IOException e) {
|
||||
|
@ -14,9 +14,9 @@ import java.io.OutputStream;
|
||||
|
||||
/**
|
||||
* ChangeSet optimized for low memory usage
|
||||
* - No disk usage
|
||||
* - High CPU usage
|
||||
* - Low memory usage
|
||||
* - No disk usage
|
||||
* - High CPU usage
|
||||
* - Low memory usage
|
||||
*/
|
||||
public class MemoryOptimizedHistory extends FaweStreamChangeSet {
|
||||
|
||||
|
@ -35,9 +35,8 @@ import java.util.UUID;
|
||||
|
||||
/**
|
||||
* A clipboard with disk backed storage. (lower memory + loads on crash)
|
||||
* - Uses an auto closable RandomAccessFile for getting / setting id / data
|
||||
* - I don't know how to reduce nbt / entities to O(2) complexity, so it is stored in memory.
|
||||
*
|
||||
* - Uses an auto closable RandomAccessFile for getting / setting id / data
|
||||
* - I don't know how to reduce nbt / entities to O(2) complexity, so it is stored in memory.
|
||||
*/
|
||||
public class DiskOptimizedClipboard extends FaweClipboard implements Closeable {
|
||||
|
||||
@ -201,7 +200,7 @@ public class DiskOptimizedClipboard extends FaweClipboard implements Closeable {
|
||||
}
|
||||
|
||||
private void closeDirectBuffer(ByteBuffer cb) {
|
||||
if (cb==null || !cb.isDirect()) return;
|
||||
if (cb == null || !cb.isDirect()) return;
|
||||
|
||||
// we could use this type cast and call functions without reflection code,
|
||||
// but static import from sun.* package is risky for non-SUN virtual machine.
|
||||
@ -212,7 +211,8 @@ public class DiskOptimizedClipboard extends FaweClipboard implements Closeable {
|
||||
Method clean = Class.forName("sun.misc.Cleaner").getMethod("clean");
|
||||
clean.setAccessible(true);
|
||||
clean.invoke(cleaner.invoke(cb));
|
||||
} catch(Exception ex) { }
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
cb = null;
|
||||
}
|
||||
|
||||
@ -380,7 +380,7 @@ public class DiskOptimizedClipboard extends FaweClipboard implements Closeable {
|
||||
}
|
||||
}
|
||||
return block;
|
||||
} catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
MainUtil.handleError(e);
|
||||
}
|
||||
return EditSession.nullBlock;
|
||||
@ -413,7 +413,7 @@ public class DiskOptimizedClipboard extends FaweClipboard implements Closeable {
|
||||
setTile(x, y, z, tile);
|
||||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
MainUtil.handleError(e);
|
||||
}
|
||||
return false;
|
||||
|
@ -21,7 +21,8 @@ public class EmptyClipboard implements Clipboard {
|
||||
|
||||
public static final EmptyClipboard INSTANCE = new EmptyClipboard();
|
||||
|
||||
private EmptyClipboard() {}
|
||||
private EmptyClipboard() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Region getRegion() {
|
||||
@ -39,7 +40,8 @@ public class EmptyClipboard implements Clipboard {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOrigin(Vector origin) {}
|
||||
public void setOrigin(Vector origin) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector getMinimumPoint() {
|
||||
|
@ -38,7 +38,8 @@ public abstract class FaweClipboard {
|
||||
|
||||
public abstract boolean remove(ClipboardEntity clipboardEntity);
|
||||
|
||||
public void setOrigin(Vector offset) {} // Do nothing
|
||||
public void setOrigin(Vector offset) {
|
||||
} // Do nothing
|
||||
|
||||
public abstract void setDimensions(Vector dimensions);
|
||||
|
||||
@ -46,6 +47,7 @@ public abstract class FaweClipboard {
|
||||
|
||||
/**
|
||||
* The locations provided are relative to the clipboard min
|
||||
*
|
||||
* @param task
|
||||
* @param air
|
||||
*/
|
||||
@ -58,6 +60,7 @@ public abstract class FaweClipboard {
|
||||
public void streamIds(final NBTStreamer.ByteReader task) {
|
||||
forEach(new BlockReader() {
|
||||
private int index = 0;
|
||||
|
||||
@Override
|
||||
public void run(int x, int y, int z, BaseBlock block) {
|
||||
task.run(index++, block.getId());
|
||||
@ -68,6 +71,7 @@ public abstract class FaweClipboard {
|
||||
public void streamDatas(final NBTStreamer.ByteReader task) {
|
||||
forEach(new BlockReader() {
|
||||
private int index = 0;
|
||||
|
||||
@Override
|
||||
public void run(int x, int y, int z, BaseBlock block) {
|
||||
task.run(index++, block.getData());
|
||||
@ -79,6 +83,7 @@ public abstract class FaweClipboard {
|
||||
final List<CompoundTag> tiles = new ArrayList<>();
|
||||
forEach(new BlockReader() {
|
||||
private int index = 0;
|
||||
|
||||
@Override
|
||||
public void run(int x, int y, int z, BaseBlock block) {
|
||||
CompoundTag tag = block.getNbtData();
|
||||
@ -94,9 +99,11 @@ public abstract class FaweClipboard {
|
||||
return tiles;
|
||||
}
|
||||
|
||||
public void close() {}
|
||||
public void close() {
|
||||
}
|
||||
|
||||
public void flush() {}
|
||||
public void flush() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Stores entity data.
|
||||
@ -104,8 +111,8 @@ public abstract class FaweClipboard {
|
||||
public class ClipboardEntity implements Entity {
|
||||
private final BaseEntity entity;
|
||||
private final Extent world;
|
||||
private final double x,y,z;
|
||||
private final float yaw,pitch;
|
||||
private final double x, y, z;
|
||||
private final float yaw, pitch;
|
||||
|
||||
public ClipboardEntity(Extent world, double x, double y, double z, float yaw, float pitch, BaseEntity entity) {
|
||||
checkNotNull(entity);
|
||||
|
@ -11,6 +11,7 @@ import java.util.Set;
|
||||
public interface IClipboardFormat {
|
||||
/**
|
||||
* Returns the name of this format.
|
||||
*
|
||||
* @return The name of the format
|
||||
*/
|
||||
String getName();
|
||||
@ -43,6 +44,7 @@ public interface IClipboardFormat {
|
||||
|
||||
/**
|
||||
* Get the default extension
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String getExtension();
|
||||
|
@ -54,7 +54,7 @@ public class MemoryOptimizedClipboard extends FaweClipboard {
|
||||
private boolean saveIds = false;
|
||||
private boolean saveDatas = false;
|
||||
private boolean saveAdd = false;
|
||||
|
||||
|
||||
private int compressionLevel;
|
||||
|
||||
public MemoryOptimizedClipboard(int width, int height, int length) {
|
||||
|
@ -1,12 +1,12 @@
|
||||
package com.boydti.fawe.object.clipboard;
|
||||
|
||||
import com.boydti.fawe.object.PseudoRandom;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.math.transform.Transform;
|
||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||
import com.sk89q.worldedit.world.registry.WorldData;
|
||||
import com.boydti.fawe.object.PseudoRandom;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.math.transform.Transform;
|
||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||
import com.sk89q.worldedit.world.registry.WorldData;
|
||||
|
||||
public class MultiClipboardHolder extends ClipboardHolder{
|
||||
public class MultiClipboardHolder extends ClipboardHolder {
|
||||
private final ClipboardHolder[] holders;
|
||||
|
||||
private ClipboardHolder holder;
|
||||
@ -18,7 +18,6 @@ public class MultiClipboardHolder extends ClipboardHolder{
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Clipboard getClipboard() {
|
||||
holder = holders[PseudoRandom.random.nextInt(holders.length)];
|
||||
|
@ -36,8 +36,7 @@ public class ResizableClipboardBuilder extends MemoryOptimizedHistory {
|
||||
maxX = x;
|
||||
}
|
||||
minX = x;
|
||||
}
|
||||
else if (x > maxX) {
|
||||
} else if (x > maxX) {
|
||||
maxX = x;
|
||||
}
|
||||
if (y < minY) {
|
||||
@ -45,8 +44,7 @@ public class ResizableClipboardBuilder extends MemoryOptimizedHistory {
|
||||
maxY = y;
|
||||
}
|
||||
minY = y;
|
||||
}
|
||||
else if (y > maxY) {
|
||||
} else if (y > maxY) {
|
||||
maxY = y;
|
||||
}
|
||||
if (z < minZ) {
|
||||
@ -54,8 +52,7 @@ public class ResizableClipboardBuilder extends MemoryOptimizedHistory {
|
||||
maxZ = z;
|
||||
}
|
||||
minZ = z;
|
||||
}
|
||||
else if (z > maxZ) {
|
||||
} else if (z > maxZ) {
|
||||
maxZ = z;
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ import java.util.Map;
|
||||
|
||||
public class WorldCopyClipboard extends ReadOnlyClipboard {
|
||||
|
||||
public final int mx,my,mz;
|
||||
public final int mx, my, mz;
|
||||
public final EditSession editSession;
|
||||
|
||||
public WorldCopyClipboard(EditSession editSession, Region region) {
|
||||
|
@ -1,8 +1,6 @@
|
||||
package com.boydti.fawe.object.clipboard;
|
||||
|
||||
import com.boydti.fawe.object.RunnableVal2;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
|
||||
|
@ -16,9 +16,9 @@ import java.util.Set;
|
||||
|
||||
/**
|
||||
* The BlockVectorSet is a Memory optimized Set for storing BlockVectors
|
||||
* - Internally it uses a map of Index->LocalBlockVectorSet
|
||||
* - All BlockVectors must be a valid world coordinate: y=[0,255],x=[-30000000,30000000],z=[-30000000,30000000]
|
||||
* - This will use ~8 bytes for every 64 BlockVectors (about 800x less than a HashSet)
|
||||
* - Internally it uses a map of Index->LocalBlockVectorSet
|
||||
* - All BlockVectors must be a valid world coordinate: y=[0,255],x=[-30000000,30000000],z=[-30000000,30000000]
|
||||
* - This will use ~8 bytes for every 64 BlockVectors (about 800x less than a HashSet)
|
||||
*/
|
||||
public class BlockVectorSet extends AbstractCollection<Vector> implements Set<Vector> {
|
||||
private Int2ObjectMap<LocalBlockVectorSet> localSets = new Int2ObjectOpenHashMap<>();
|
||||
@ -79,7 +79,7 @@ public class BlockVectorSet extends AbstractCollection<Vector> implements Set<Ve
|
||||
Vector v = (Vector) o;
|
||||
return contains(v.getBlockX(), v.getBlockY(), v.getBlockZ());
|
||||
}
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -152,7 +152,6 @@ public class BlockVectorSet extends AbstractCollection<Vector> implements Set<Ve
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean remove(Object o) {
|
||||
if (o instanceof Vector) {
|
||||
@ -205,7 +204,6 @@ public class BlockVectorSet extends AbstractCollection<Vector> implements Set<Ve
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
localSets.clear();
|
||||
|
@ -9,7 +9,8 @@ public abstract class IterableThreadLocal<T> extends ThreadLocal<T> implements I
|
||||
private ThreadLocal<T> flag;
|
||||
private ConcurrentLinkedDeque<T> allValues = new ConcurrentLinkedDeque<T>();
|
||||
|
||||
public IterableThreadLocal() { }
|
||||
public IterableThreadLocal() {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final T initialValue() {
|
||||
@ -25,7 +26,9 @@ public abstract class IterableThreadLocal<T> extends ThreadLocal<T> implements I
|
||||
return getAll().iterator();
|
||||
}
|
||||
|
||||
public T init() { return null; }
|
||||
public T init() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public final Collection<T> getAll() {
|
||||
return Collections.unmodifiableCollection(allValues);
|
||||
|
@ -10,8 +10,8 @@ import java.util.Set;
|
||||
|
||||
/**
|
||||
* The LocalPartitionedBlockVector2DSet is a Memory and CPU optimized Set for storing Vector2Ds which are all in a local region
|
||||
* - All Vector2Ds must be within x[0,32768), y[0,32768)
|
||||
* - This will use 8 bytes for every 64 Vector2Ds (about 800x less than a HashSet)
|
||||
* - All Vector2Ds must be within x[0,32768), y[0,32768)
|
||||
* - This will use 8 bytes for every 64 Vector2Ds (about 800x less than a HashSet)
|
||||
*/
|
||||
public class LocalBlockVector2DSet implements Set<Vector2D> {
|
||||
private final SparseBitSet set;
|
||||
@ -112,14 +112,17 @@ public class LocalBlockVector2DSet implements Set<Vector2D> {
|
||||
return new Iterator<Vector2D>() {
|
||||
int index = set.nextSetBit(0);
|
||||
int previous = -1;
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
set.clear(previous);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return index != -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector2D next() {
|
||||
if (index != -1) {
|
||||
|
@ -10,8 +10,8 @@ import java.util.Set;
|
||||
|
||||
/**
|
||||
* The LocalBlockVectorSet is a Memory and CPU optimized Set for storing BlockVectors which are all in a local region
|
||||
* - All vectors must be in a 2048 * 2048 area centered around the first entry
|
||||
* - This will use 8 bytes for every 64 BlockVectors (about 800x less than a HashSet)
|
||||
* - All vectors must be in a 2048 * 2048 area centered around the first entry
|
||||
* - This will use 8 bytes for every 64 BlockVectors (about 800x less than a HashSet)
|
||||
*/
|
||||
public class LocalBlockVectorSet implements Set<Vector> {
|
||||
private int offsetX, offsetZ;
|
||||
@ -70,7 +70,7 @@ public class LocalBlockVectorSet implements Set<Vector> {
|
||||
while ((index = set.nextSetBit(index + 1)) != -1) {
|
||||
int b1 = (index & 0xFF);
|
||||
int b2 = ((byte) (index >> 8)) & 0x7F;
|
||||
int b3 = ((byte)(index >> 15)) & 0xFF;
|
||||
int b3 = ((byte) (index >> 15)) & 0xFF;
|
||||
int b4 = ((byte) (index >> 23)) & 0xFF;
|
||||
if (Math.abs((offsetX + (((b3 + ((MathMan.unpair8x(b2)) << 8)) << 21) >> 21)) - x) <= radius && Math.abs((offsetZ + (((b4 + ((MathMan.unpair8y(b2)) << 8)) << 21) >> 21)) - z) <= radius && Math.abs((b1) - y) <= radius) {
|
||||
return true;
|
||||
@ -112,7 +112,7 @@ public class LocalBlockVectorSet implements Set<Vector> {
|
||||
if (index != -1) {
|
||||
int b1 = (index & 0xFF);
|
||||
int b2 = ((byte) (index >> 8)) & 0x7F;
|
||||
int b3 = ((byte)(index >> 15)) & 0xFF;
|
||||
int b3 = ((byte) (index >> 15)) & 0xFF;
|
||||
int b4 = ((byte) (index >> 23)) & 0xFF;
|
||||
int x = offsetX + (((b3 + ((MathMan.unpair8x(b2)) << 8)) << 21) >> 21);
|
||||
int y = b1;
|
||||
@ -128,20 +128,23 @@ public class LocalBlockVectorSet implements Set<Vector> {
|
||||
int index = set.nextSetBit(0);
|
||||
int previous = -1;
|
||||
MutableBlockVector mutable = new MutableBlockVector(0, 0, 0);
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
set.clear(previous);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return index != -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockVector next() {
|
||||
if (index != -1) {
|
||||
int b1 = (index & 0xFF);
|
||||
int b2 = ((byte) (index >> 8)) & 0x7F;
|
||||
int b3 = ((byte)(index >> 15)) & 0xFF;
|
||||
int b3 = ((byte) (index >> 15)) & 0xFF;
|
||||
int b4 = ((byte) (index >> 23)) & 0xFF;
|
||||
mutable.mutX(offsetX + (((b3 + ((MathMan.unpair8x(b2)) << 8)) << 21) >> 21));
|
||||
mutable.mutY(b1);
|
||||
@ -171,7 +174,7 @@ public class LocalBlockVectorSet implements Set<Vector> {
|
||||
index = set.nextSetBit(index);
|
||||
int b1 = (index & 0xFF);
|
||||
int b2 = ((byte) (index >> 8)) & 0x7F;
|
||||
int b3 = ((byte)(index >> 15)) & 0xFF;
|
||||
int b3 = ((byte) (index >> 15)) & 0xFF;
|
||||
int b4 = ((byte) (index >> 23)) & 0xFF;
|
||||
int x = offsetX + (((b3 + ((MathMan.unpair8x(b2)) << 8)) << 21) >> 21);
|
||||
int y = b1;
|
||||
@ -282,7 +285,7 @@ public class LocalBlockVectorSet implements Set<Vector> {
|
||||
index = set.nextSetBit(index + 1);
|
||||
int b1 = (index & 0xFF);
|
||||
int b2 = ((byte) (index >> 8)) & 0x7F;
|
||||
int b3 = ((byte)(index >> 15)) & 0xFF;
|
||||
int b3 = ((byte) (index >> 15)) & 0xFF;
|
||||
int b4 = ((byte) (index >> 23)) & 0xFF;
|
||||
mVec.mutX(offsetX + (((b3 + ((MathMan.unpair8x(b2)) << 8)) << 21) >> 21));
|
||||
mVec.mutY(b1);
|
||||
@ -312,7 +315,7 @@ public class LocalBlockVectorSet implements Set<Vector> {
|
||||
index = set.nextSetBit(index + 1);
|
||||
int b1 = (index & 0xFF);
|
||||
int b2 = ((byte) (index >> 8)) & 0x7F;
|
||||
int b3 = ((byte)(index >> 15)) & 0xFF;
|
||||
int b3 = ((byte) (index >> 15)) & 0xFF;
|
||||
int b4 = ((byte) (index >> 23)) & 0xFF;
|
||||
int x = offsetX + (((b3 + ((MathMan.unpair8x(b2)) << 8)) << 21) >> 21);
|
||||
int y = b1;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user