3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-13 22:50:06 +01:00

Moved the block data check to LocalWorld, adding preliminary support for custom blocks.

All unknown blocks are now assumed to carry data, and so this will also future proof WorldEdit (for the immediate future). However, be aware that full custom block support requires carrying TileEntity data (and perhaps other data) and that is not yet supported.
Dieser Commit ist enthalten in:
sk89q 2012-02-05 17:46:26 -08:00
Ursprung 4bb5b56da8
Commit 09f3364d9f
2 geänderte Dateien mit 12 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -217,7 +217,7 @@ public class EditSession {
final boolean result; final boolean result;
if (BlockType.usesData(type)) { if (world.usesBlockData(type)) {
if (fastMode) { if (fastMode) {
result = world.setTypeIdAndDataFast(pt, type, block.getData() > -1 ? block.getData() : 0); result = world.setTypeIdAndDataFast(pt, type, block.getData() > -1 ? block.getData() : 0);
} else { } else {

Datei anzeigen

@ -328,6 +328,17 @@ public abstract class LocalWorld {
return BlockType.fromID(type) != null; return BlockType.fromID(type) != null;
} }
/**
* Returns whether a block uses its data value.
*
* @param type block ID type
* @return true if the block uses data value
*/
public boolean usesBlockData(int type) {
// We future proof here by assuming all unknown blocks use data
return BlockType.usesData(type) || BlockType.fromID(type) == null;
}
/** /**
* Checks if the chunk pt is in is loaded. if not, loads the chunk * Checks if the chunk pt is in is loaded. if not, loads the chunk
* *