mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 01:37:37 +00: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
This commit is contained in:
parent
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
|
||||||
|
Loading…
Reference in New Issue
Block a user