Get render module compiling on 1.13
This commit is contained in:
@@ -14,12 +14,13 @@ import de.johni0702.minecraft.gui.element.advanced.GuiProgressBar;
|
||||
import de.johni0702.minecraft.gui.function.Tickable;
|
||||
import de.johni0702.minecraft.gui.layout.CustomLayout;
|
||||
import de.johni0702.minecraft.gui.layout.HorizontalLayout;
|
||||
import de.johni0702.minecraft.gui.utils.lwjgl.Dimension;
|
||||
import de.johni0702.minecraft.gui.utils.lwjgl.ReadableDimension;
|
||||
import de.johni0702.minecraft.gui.utils.lwjgl.ReadablePoint;
|
||||
import net.minecraft.client.renderer.texture.DynamicTexture;
|
||||
import net.minecraft.client.renderer.texture.NativeImage;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.util.Dimension;
|
||||
import org.lwjgl.util.ReadableDimension;
|
||||
import org.lwjgl.util.ReadablePoint;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
@@ -228,7 +229,11 @@ public class GuiVideoRenderer extends GuiScreen implements Tickable {
|
||||
final int videoHeight = videoSize.getHeight();
|
||||
|
||||
if (previewTexture == null) {
|
||||
previewTexture = new DynamicTexture(videoWidth, videoHeight);
|
||||
//#if MC>=11300
|
||||
previewTexture = new DynamicTexture(videoWidth, videoHeight, true);
|
||||
//#else
|
||||
//$$ previewTexture = new DynamicTexture(videoWidth, videoHeight);
|
||||
//#endif
|
||||
}
|
||||
|
||||
if (previewTextureDirty) {
|
||||
@@ -262,13 +267,24 @@ public class GuiVideoRenderer extends GuiScreen implements Tickable {
|
||||
ByteBuffer buffer = frame.getByteBuffer();
|
||||
buffer.mark();
|
||||
synchronized (this) {
|
||||
int[] data = previewTexture.getTextureData();
|
||||
// Optifine changes the texture data array to be three times as long (for use by shaders),
|
||||
// we only want to initialize the first third which is why we use the length of the buffer instead
|
||||
// of the length of the data array
|
||||
for (int i = 0; buffer.remaining() > 0; i++) {
|
||||
data[i] = 0xff << 24 | (buffer.get() & 0xff) << 16 | (buffer.get() & 0xff) << 8 | (buffer.get() & 0xff);
|
||||
//#if MC>=11300
|
||||
NativeImage data = previewTexture.getTextureData();
|
||||
assert data != null;
|
||||
for (int x = 0; x < data.getWidth(); x++) {
|
||||
for (int y = 0; y < data.getHeight(); y++) {
|
||||
int value = 0xff << 24 | (buffer.get() & 0xff) << 16 | (buffer.get() & 0xff) << 8 | (buffer.get() & 0xff);
|
||||
data.setPixelRGBA(x, y, value);
|
||||
}
|
||||
}
|
||||
//#else
|
||||
//$$ int[] data = previewTexture.getTextureData();
|
||||
//$$ // Optifine changes the texture data array to be three times as long (for use by shaders),
|
||||
//$$ // we only want to initialize the first third which is why we use the length of the buffer instead
|
||||
//$$ // of the length of the data array
|
||||
//$$ for (int i = 0; buffer.remaining() > 0; i++) {
|
||||
//$$ data[i] = 0xff << 24 | (buffer.get() & 0xff) << 16 | (buffer.get() & 0xff) << 8 | (buffer.get() & 0xff);
|
||||
//$$ }
|
||||
//#endif
|
||||
previewTextureDirty = true;
|
||||
}
|
||||
buffer.reset();
|
||||
|
||||
Reference in New Issue
Block a user