Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-03 01:50:07 +01:00
Added some error handling for legacy conversions of schematics.
Dieser Commit ist enthalten in:
Ursprung
57eaa5f8f2
Commit
fdb7ada295
@ -43,6 +43,7 @@ import com.sk89q.worldedit.regions.CuboidRegion;
|
|||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
import com.sk89q.worldedit.util.Location;
|
import com.sk89q.worldedit.util.Location;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
|
import com.sk89q.worldedit.world.entity.EntityType;
|
||||||
import com.sk89q.worldedit.world.entity.EntityTypes;
|
import com.sk89q.worldedit.world.entity.EntityTypes;
|
||||||
import com.sk89q.worldedit.world.registry.LegacyMapper;
|
import com.sk89q.worldedit.world.registry.LegacyMapper;
|
||||||
import com.sk89q.worldedit.world.storage.NBTConversions;
|
import com.sk89q.worldedit.world.storage.NBTConversions;
|
||||||
@ -199,9 +200,11 @@ public class SchematicReader implements ClipboardReader {
|
|||||||
|
|
||||||
int index = y * width * length + z * width + x;
|
int index = y * width * length + z * width + x;
|
||||||
BlockState block = LegacyMapper.getInstance().getBlockFromLegacy(blocks[index], blockData[index]);
|
BlockState block = LegacyMapper.getInstance().getBlockFromLegacy(blocks[index], blockData[index]);
|
||||||
for (NBTCompatibilityHandler handler : COMPATIBILITY_HANDLERS) {
|
if (block != null) {
|
||||||
if (handler.isAffectedBlock(block)) {
|
for (NBTCompatibilityHandler handler : COMPATIBILITY_HANDLERS) {
|
||||||
handler.updateNBT(block, values);
|
if (handler.isAffectedBlock(block)) {
|
||||||
|
handler.updateNBT(block, values);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -223,10 +226,14 @@ public class SchematicReader implements ClipboardReader {
|
|||||||
BlockState state = LegacyMapper.getInstance().getBlockFromLegacy(blocks[index], blockData[index]);
|
BlockState state = LegacyMapper.getInstance().getBlockFromLegacy(blocks[index], blockData[index]);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (tileEntitiesMap.containsKey(pt)) {
|
if (state != null) {
|
||||||
clipboard.setBlock(region.getMinimumPoint().add(pt), new BaseBlock(state, new CompoundTag(tileEntitiesMap.get(pt))));
|
if (tileEntitiesMap.containsKey(pt)) {
|
||||||
|
clipboard.setBlock(region.getMinimumPoint().add(pt), new BaseBlock(state, new CompoundTag(tileEntitiesMap.get(pt))));
|
||||||
|
} else {
|
||||||
|
clipboard.setBlock(region.getMinimumPoint().add(pt), state);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
clipboard.setBlock(region.getMinimumPoint().add(pt), state);
|
log.warning("Unknown block when pasting schematic: " + blocks[index] + ":" + blockData[index] + ". Please report this issue.");
|
||||||
}
|
}
|
||||||
} catch (WorldEditException e) {
|
} catch (WorldEditException e) {
|
||||||
switch (failedBlockSets) {
|
switch (failedBlockSets) {
|
||||||
@ -259,8 +266,13 @@ public class SchematicReader implements ClipboardReader {
|
|||||||
Location location = NBTConversions.toLocation(clipboard, compound.getListTag("Pos"), compound.getListTag("Rotation"));
|
Location location = NBTConversions.toLocation(clipboard, compound.getListTag("Pos"), compound.getListTag("Rotation"));
|
||||||
|
|
||||||
if (!id.isEmpty()) {
|
if (!id.isEmpty()) {
|
||||||
BaseEntity state = new BaseEntity(EntityTypes.get(id), compound);
|
EntityType entityType = EntityTypes.get(id.toLowerCase());
|
||||||
clipboard.createEntity(location, state);
|
if (entityType != null) {
|
||||||
|
BaseEntity state = new BaseEntity(entityType, compound);
|
||||||
|
clipboard.createEntity(location, state);
|
||||||
|
} else {
|
||||||
|
log.warning("Unknown entity when pasting schematic: " + id.toLowerCase());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren