net.minestom.server.map.framebuffers.DirectFramebuffer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of minestom-snapshots Show documentation
Show all versions of minestom-snapshots Show documentation
1.20.4 Lightweight Minecraft server
package net.minestom.server.map.framebuffers;
import net.minestom.server.map.Framebuffer;
/**
* {@link Framebuffer} with direct access to the colors array
*/
public class DirectFramebuffer implements Framebuffer {
private final byte[] colors = new byte[WIDTH * HEIGHT];
/**
* Mutable colors array
*
* @return
*/
public byte[] getColors() {
return colors;
}
public byte get(int x, int z) {
return colors[Framebuffer.index(x, z)];
}
public DirectFramebuffer set(int x, int z, byte color) {
colors[Framebuffer.index(x, z)] = color;
return this;
}
@Override
public byte[] toMapColors() {
return colors;
}
}