mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-13 16:24:23 +01:00
Fix GL loading
Works for resources and other player skins, broken for own skin
This commit is contained in:
parent
70d24e377f
commit
5791a021ef
1 changed files with 5 additions and 11 deletions
|
@ -27,13 +27,11 @@ import net.minecraft.util.math.Box;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
import org.lwjgl.BufferUtils;
|
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import javax.annotation.concurrent.Immutable;
|
import javax.annotation.concurrent.Immutable;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.ByteBuffer;
|
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
import static com.mojang.blaze3d.platform.GlStateManager.getTexLevelParameter;
|
import static com.mojang.blaze3d.platform.GlStateManager.getTexLevelParameter;
|
||||||
|
@ -109,19 +107,15 @@ public class Pony implements IPony {
|
||||||
int width = getTexLevelParameter(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH);
|
int width = getTexLevelParameter(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH);
|
||||||
int height = getTexLevelParameter(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT);
|
int height = getTexLevelParameter(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT);
|
||||||
|
|
||||||
int channels = 4;
|
NativeImage.Format channels = NativeImage.Format.RGBA;
|
||||||
if (format == GL_RGB) {
|
if (format == GL_RGB) {
|
||||||
channels = 3;
|
channels = NativeImage.Format.RGB;
|
||||||
}
|
}
|
||||||
|
|
||||||
ByteBuffer buffer = BufferUtils.createByteBuffer(width * height * channels);
|
NativeImage image = new NativeImage(channels, width, height, false);
|
||||||
glGetTexImage(GL_TEXTURE_2D, 0, format, GL_UNSIGNED_BYTE, buffer);
|
image.loadFromTextureImage(0, false);
|
||||||
|
return image;
|
||||||
|
|
||||||
try {
|
|
||||||
return NativeImage.fromByteBuffer(buffer);
|
|
||||||
} catch (IOException e) {
|
|
||||||
return MissingSprite.getMissingSpriteTexture().getImage();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private IPonyData checkSkin(NativeImage bufferedimage) {
|
private IPonyData checkSkin(NativeImage bufferedimage) {
|
||||||
|
|
Loading…
Reference in a new issue