Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-12-25 02:20:07 +01:00
Fix PNGWriter exporting blank PNGs (#1807)
* Fix horrendous variable assignment in PNGWriter - Fixes #1679 * More detailed information on PNG format * Avoid a larger number of blocks that do nto have a color assigned in TextureUtil * Don't error in PNGWriter if biomes aren't saved to clipboard and grass is present
Dieser Commit ist enthalten in:
Ursprung
ac11da855a
Commit
1da987d594
@ -7,6 +7,7 @@ import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
|||||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardWriter;
|
import com.sk89q.worldedit.extent.clipboard.io.ClipboardWriter;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
import com.sk89q.worldedit.world.block.BlockType;
|
import com.sk89q.worldedit.world.block.BlockType;
|
||||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||||
@ -68,14 +69,10 @@ public class PNGWriter implements ClipboardWriter {
|
|||||||
|
|
||||||
boolean fill = length * 4 < imageSize && width * 4 < imageSize;
|
boolean fill = length * 4 < imageSize && width * 4 < imageSize;
|
||||||
|
|
||||||
MutableBlockVector3 mutable;
|
MutableBlockVector3 mutable = new MutableBlockVector3(0, 0, 0);
|
||||||
MutableBlockVector3 mutableTop;
|
MutableBlockVector3 mutableTop = new MutableBlockVector3(0, 0, 0);
|
||||||
MutableBlockVector3 mutableRight;
|
MutableBlockVector3 mutableRight = new MutableBlockVector3(0, 0, 0);
|
||||||
MutableBlockVector3 mutableLeft;
|
MutableBlockVector3 mutableLeft = new MutableBlockVector3(0, 0, 0);
|
||||||
mutable = mutableTop = mutableRight = mutableLeft = new MutableBlockVector3(0, 0, 0);
|
|
||||||
// Vector mutableTop = new Vector(0, 0, 0);
|
|
||||||
// Vector mutableRight = new Vector(0, 0, 0);
|
|
||||||
// Vector mutableLeft = new Vector(0, 0, 0);
|
|
||||||
|
|
||||||
BlockVector3 min = clipboard.getMinimumPoint();
|
BlockVector3 min = clipboard.getMinimumPoint();
|
||||||
int y0 = min.getBlockY();
|
int y0 = min.getBlockY();
|
||||||
@ -100,7 +97,7 @@ public class PNGWriter implements ClipboardWriter {
|
|||||||
for (int y = y0; y < y0 + height; y++) {
|
for (int y = y0; y < y0 + height; y++) {
|
||||||
mutable.mutY(y);
|
mutable.mutY(y);
|
||||||
BlockState block = clipboard.getBlock(mutable);
|
BlockState block = clipboard.getBlock(mutable);
|
||||||
if (block.getBlockType().getMaterial().isAir()) {
|
if (!block.getBlockType().getMaterial().isSolid() || block.getBlockType().getMaterial().isTranslucent()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
mutableTop.mutY(y + 1);
|
mutableTop.mutY(y + 1);
|
||||||
@ -141,8 +138,9 @@ public class PNGWriter implements ClipboardWriter {
|
|||||||
|
|
||||||
BlockType type = block.getBlockType();
|
BlockType type = block.getBlockType();
|
||||||
int color;
|
int color;
|
||||||
if (type == BlockTypes.GRASS_BLOCK) {
|
BiomeType biome;
|
||||||
color = tu.getColor(clipboard.getBiome(mutable));
|
if (type == BlockTypes.GRASS_BLOCK && (biome = clipboard.getBiome(mutable)) != null) {
|
||||||
|
color = tu.getColor(biome);
|
||||||
} else {
|
} else {
|
||||||
color = tu.getColor(type);
|
color = tu.getColor(type);
|
||||||
}
|
}
|
||||||
|
@ -239,7 +239,8 @@ public enum BuiltInClipboardFormat implements ClipboardFormat {
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Isometric PNG writer.
|
* Isometric PNG writer. Only supports solid, full-cube blocks and creates a view of the clipboard looking FROM the south
|
||||||
|
* east of the clipboard
|
||||||
*/
|
*/
|
||||||
PNG("png", "image") {
|
PNG("png", "image") {
|
||||||
@Override
|
@Override
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren