mirror of
https://github.com/xfl03/MCCustomSkinLoader.git
synced 2026-11-19 09:39:15 +00:00
Try to fix skin texture parsing bug
This commit is contained in:
1 parent
164632c7be
commit
c9181c411f
15 files changed
+115
-681
No files matched your search
@@ -1,109 +0,0 @@
|
||||
package net.minecraft.client.renderer;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.DataBufferInt;
|
||||
import java.awt.image.ImageObserver;
|
||||
|
||||
public class ImageBufferDownload implements IImageBuffer
|
||||
{
|
||||
private int[] imageData;
|
||||
private int imageWidth;
|
||||
private int imageHeight;
|
||||
|
||||
public BufferedImage parseUserSkin(BufferedImage image)
|
||||
{
|
||||
if (image == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
int ratio = image.getWidth() / 64;
|
||||
this.imageWidth = 64 * ratio;
|
||||
this.imageHeight = 64 * ratio;
|
||||
BufferedImage bufferedimage = new BufferedImage(this.imageWidth, this.imageHeight, 2);
|
||||
Graphics graphics = bufferedimage.getGraphics();
|
||||
graphics.drawImage(image, 0, 0, (ImageObserver)null);
|
||||
boolean flag = image.getHeight() == 32 * ratio;
|
||||
|
||||
if (flag)
|
||||
{
|
||||
if(!customskinloader.CustomSkinLoader.config.enableTransparentSkin){
|
||||
graphics.setColor(new Color(0, 0, 0, 0));
|
||||
graphics.fillRect(0, 32, 64, 32);
|
||||
}
|
||||
graphics.drawImage(bufferedimage, 24 * ratio, 48 * ratio, 20 * ratio, 52 * ratio, 4 * ratio, 16 * ratio, 8 * ratio, 20 * ratio, (ImageObserver)null);
|
||||
graphics.drawImage(bufferedimage, 28 * ratio, 48 * ratio, 24 * ratio, 52 * ratio, 8 * ratio, 16 * ratio, 12 * ratio, 20 * ratio, (ImageObserver)null);
|
||||
graphics.drawImage(bufferedimage, 20 * ratio, 52 * ratio, 16 * ratio, 64 * ratio, 8 * ratio, 20 * ratio, 12 * ratio, 32 * ratio, (ImageObserver)null);
|
||||
graphics.drawImage(bufferedimage, 24 * ratio, 52 * ratio, 20 * ratio, 64 * ratio, 4 * ratio, 20 * ratio, 8 * ratio, 32 * ratio, (ImageObserver)null);
|
||||
graphics.drawImage(bufferedimage, 28 * ratio, 52 * ratio, 24 * ratio, 64 * ratio, 0 * ratio, 20 * ratio, 4 * ratio, 32 * ratio, (ImageObserver)null);
|
||||
graphics.drawImage(bufferedimage, 32 * ratio, 52 * ratio, 28 * ratio, 64 * ratio, 12 * ratio, 20 * ratio, 16 * ratio, 32 * ratio, (ImageObserver)null);
|
||||
graphics.drawImage(bufferedimage, 40 * ratio, 48 * ratio, 36 * ratio, 52 * ratio, 44 * ratio, 16 * ratio, 48 * ratio, 20 * ratio, (ImageObserver)null);
|
||||
graphics.drawImage(bufferedimage, 44 * ratio, 48 * ratio, 40 * ratio, 52 * ratio, 48 * ratio, 16 * ratio, 52 * ratio, 20 * ratio, (ImageObserver)null);
|
||||
graphics.drawImage(bufferedimage, 36 * ratio, 52 * ratio, 32 * ratio, 64 * ratio, 48 * ratio, 20 * ratio, 52 * ratio, 32 * ratio, (ImageObserver)null);
|
||||
graphics.drawImage(bufferedimage, 40 * ratio, 52 * ratio, 36 * ratio, 64 * ratio, 44 * ratio, 20 * ratio, 48 * ratio, 32 * ratio, (ImageObserver)null);
|
||||
graphics.drawImage(bufferedimage, 44 * ratio, 52 * ratio, 40 * ratio, 64 * ratio, 40 * ratio, 20 * ratio, 44 * ratio, 32 * ratio, (ImageObserver)null);
|
||||
graphics.drawImage(bufferedimage, 48 * ratio, 52 * ratio, 44 * ratio, 64 * ratio, 52 * ratio, 20 * ratio, 56 * ratio, 32 * ratio, (ImageObserver)null);
|
||||
}
|
||||
|
||||
graphics.dispose();
|
||||
this.imageData = ((DataBufferInt)bufferedimage.getRaster().getDataBuffer()).getData();
|
||||
if(!customskinloader.CustomSkinLoader.config.enableTransparentSkin){
|
||||
this.setAreaOpaque(0, 0, 32, 16);
|
||||
|
||||
if (flag)
|
||||
{
|
||||
this.doTransparencyHack(32, 0, 64, 32);
|
||||
}
|
||||
|
||||
this.setAreaOpaque(0, 16, 64, 32);
|
||||
this.setAreaOpaque(16, 48, 48, 64);
|
||||
}
|
||||
return bufferedimage;
|
||||
}
|
||||
}
|
||||
|
||||
public void skinAvailable()
|
||||
{
|
||||
}
|
||||
|
||||
private void doTransparencyHack(int p_189559_1_, int p_189559_2_, int p_189559_3_, int p_189559_4_)
|
||||
{
|
||||
for (int i = p_189559_1_; i < p_189559_3_; ++i)
|
||||
{
|
||||
for (int j = p_189559_2_; j < p_189559_4_; ++j)
|
||||
{
|
||||
int k = this.imageData[i + j * this.imageWidth];
|
||||
|
||||
if ((k >> 24 & 255) < 128)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int l = p_189559_1_; l < p_189559_3_; ++l)
|
||||
{
|
||||
for (int i1 = p_189559_2_; i1 < p_189559_4_; ++i1)
|
||||
{
|
||||
this.imageData[l + i1 * this.imageWidth] &= 16777215;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes the given area of the image opaque
|
||||
*/
|
||||
private void setAreaOpaque(int x, int y, int width, int height)
|
||||
{
|
||||
for (int i = x; i < width; ++i)
|
||||
{
|
||||
for (int j = y; j < height; ++j)
|
||||
{
|
||||
this.imageData[i + j * this.imageWidth] |= -16777216;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -78,7 +78,7 @@ public class SkinManager
|
||||
}
|
||||
else
|
||||
{
|
||||
final IImageBuffer iimagebuffer = textureType == Type.SKIN ? new ImageBufferDownload() : null;
|
||||
final IImageBuffer iimagebuffer = textureType == Type.SKIN ? new customskinloader.renderer.SkinBuffer() : null;//Modified
|
||||
ThreadDownloadImageData threaddownloadimagedata = new ThreadDownloadImageData(info.cacheFile, info.url, DefaultPlayerSkin.getDefaultSkinLegacy(), new IImageBuffer()//Modified
|
||||
{
|
||||
public BufferedImage parseUserSkin(BufferedImage image)
|
||||
|
||||
@@ -1,100 +0,0 @@
|
||||
package net.minecraft.client.renderer;
|
||||
|
||||
import java.awt.Graphics;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.DataBufferInt;
|
||||
import java.awt.image.ImageObserver;
|
||||
|
||||
public class ImageBufferDownload implements IImageBuffer
|
||||
{
|
||||
private int[] imageData;
|
||||
private int imageWidth;
|
||||
private int imageHeight;
|
||||
private static final String __OBFID = "CL_00000956";
|
||||
|
||||
public BufferedImage parseUserSkin(BufferedImage p_78432_1_)
|
||||
{
|
||||
if (p_78432_1_ == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
int radio=p_78432_1_.getWidth()/64;
|
||||
this.imageWidth = 64*radio;
|
||||
this.imageHeight = 32*radio;
|
||||
BufferedImage var2 = new BufferedImage(this.imageWidth, this.imageHeight, 2);
|
||||
Graphics var3 = var2.getGraphics();
|
||||
if(imageWidth == p_78432_1_.getHeight()){
|
||||
var3.drawImage(p_78432_1_, 0 *radio, 0 *radio, 64*radio, 32*radio, 0 *radio, 0 *radio, 64*radio, 32*radio, (ImageObserver)null);
|
||||
var3.drawImage(p_78432_1_, 0 *radio, 16*radio, 64*radio, 32*radio, 0 *radio, 32*radio, 64*radio, 48*radio, (ImageObserver)null);
|
||||
}else{
|
||||
var3.drawImage(p_78432_1_, 0, 0, (ImageObserver)null);
|
||||
}
|
||||
var3.dispose();
|
||||
this.imageData = ((DataBufferInt)var2.getRaster().getDataBuffer()).getData();
|
||||
if(!customskinloader.CustomSkinLoader.config.enableTransparentSkin){
|
||||
this.setAreaOpaque(0, 0, 32*radio, 16*radio);
|
||||
this.setAreaTransparent(32*radio, 0, 64*radio, 32*radio);
|
||||
this.setAreaOpaque(0, 16*radio, 64*radio, 32*radio);
|
||||
}
|
||||
return var2;
|
||||
}
|
||||
}
|
||||
|
||||
public void func_152634_a() {}
|
||||
|
||||
/**
|
||||
* Makes the given area of the image transparent if it was previously completely opaque (used to remove the outer
|
||||
* layer of a skin around the head if it was saved all opaque; this would be redundant so it's assumed that the skin
|
||||
* maker is just using an image editor without an alpha channel)
|
||||
*/
|
||||
private void setAreaTransparent(int p_78434_1_, int p_78434_2_, int p_78434_3_, int p_78434_4_)
|
||||
{
|
||||
if (!this.hasTransparency(p_78434_1_, p_78434_2_, p_78434_3_, p_78434_4_))
|
||||
{
|
||||
for (int var5 = p_78434_1_; var5 < p_78434_3_; ++var5)
|
||||
{
|
||||
for (int var6 = p_78434_2_; var6 < p_78434_4_; ++var6)
|
||||
{
|
||||
this.imageData[var5 + var6 * this.imageWidth] &= 16777215;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes the given area of the image opaque
|
||||
*/
|
||||
private void setAreaOpaque(int p_78433_1_, int p_78433_2_, int p_78433_3_, int p_78433_4_)
|
||||
{
|
||||
for (int var5 = p_78433_1_; var5 < p_78433_3_; ++var5)
|
||||
{
|
||||
for (int var6 = p_78433_2_; var6 < p_78433_4_; ++var6)
|
||||
{
|
||||
this.imageData[var5 + var6 * this.imageWidth] |= -16777216;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the given area of the image contains transparent pixels
|
||||
*/
|
||||
private boolean hasTransparency(int p_78435_1_, int p_78435_2_, int p_78435_3_, int p_78435_4_)
|
||||
{
|
||||
for (int var5 = p_78435_1_; var5 < p_78435_3_; ++var5)
|
||||
{
|
||||
for (int var6 = p_78435_2_; var6 < p_78435_4_; ++var6)
|
||||
{
|
||||
int var7 = this.imageData[var5 + var6 * this.imageWidth];
|
||||
|
||||
if ((var7 >> 24 & 255) < 128)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -85,7 +85,7 @@ public class SkinManager
|
||||
}
|
||||
else
|
||||
{
|
||||
final ImageBufferDownload var8 = p_152789_2_ == Type.SKIN ? new ImageBufferDownload() : null;
|
||||
final ImageBufferDownload var8 = p_152789_2_ == Type.SKIN ? new customskinloader.renderer.SkinBuffer() : null;//Modified
|
||||
ThreadDownloadImageData var9 = new ThreadDownloadImageData(info.cacheFile, info.url, DEFAULT_SKIN, new IImageBuffer()//Modified
|
||||
{
|
||||
private static final String __OBFID = "CL_00001828";
|
||||
|
||||
@@ -1,118 +0,0 @@
|
||||
package net.minecraft.client.renderer;
|
||||
|
||||
import java.awt.Graphics;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.DataBufferInt;
|
||||
import java.awt.image.ImageObserver;
|
||||
|
||||
public class ImageBufferDownload implements IImageBuffer
|
||||
{
|
||||
private int[] imageData;
|
||||
private int imageWidth;
|
||||
private int imageHeight;
|
||||
private static final String __OBFID = "CL_00000956";
|
||||
|
||||
public BufferedImage parseUserSkin(BufferedImage image)
|
||||
{
|
||||
if (image == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
int ratio=image.getWidth()/64;
|
||||
this.imageWidth = 64 * ratio;
|
||||
this.imageHeight = 64 * ratio;
|
||||
BufferedImage var2 = new BufferedImage(this.imageWidth, this.imageHeight, 2);
|
||||
Graphics var3 = var2.getGraphics();
|
||||
var3.drawImage(image, 0, 0, (ImageObserver)null);
|
||||
|
||||
if (image.getHeight() == 32 * ratio)
|
||||
{
|
||||
var3.drawImage(var2, 24 * ratio, 48 * ratio, 20 * ratio, 52 * ratio, 4 * ratio, 16 * ratio, 8 * ratio, 20 * ratio, (ImageObserver)null);
|
||||
var3.drawImage(var2, 28 * ratio, 48 * ratio, 24 * ratio, 52 * ratio, 8 * ratio, 16 * ratio, 12 * ratio, 20 * ratio, (ImageObserver)null);
|
||||
var3.drawImage(var2, 20 * ratio, 52 * ratio, 16 * ratio, 64 * ratio, 8 * ratio, 20 * ratio, 12 * ratio, 32 * ratio, (ImageObserver)null);
|
||||
var3.drawImage(var2, 24 * ratio, 52 * ratio, 20 * ratio, 64 * ratio, 4 * ratio, 20 * ratio, 8 * ratio, 32 * ratio, (ImageObserver)null);
|
||||
var3.drawImage(var2, 28 * ratio, 52 * ratio, 24 * ratio, 64 * ratio, 0 * ratio, 20 * ratio, 4 * ratio, 32 * ratio, (ImageObserver)null);
|
||||
var3.drawImage(var2, 32 * ratio, 52 * ratio, 28 * ratio, 64 * ratio, 12 * ratio, 20 * ratio, 16 * ratio, 32 * ratio, (ImageObserver)null);
|
||||
var3.drawImage(var2, 40 * ratio, 48 * ratio, 36 * ratio, 52 * ratio, 44 * ratio, 16 * ratio, 48 * ratio, 20 * ratio, (ImageObserver)null);
|
||||
var3.drawImage(var2, 44 * ratio, 48 * ratio, 40 * ratio, 52 * ratio, 48 * ratio, 16 * ratio, 52 * ratio, 20 * ratio, (ImageObserver)null);
|
||||
var3.drawImage(var2, 36 * ratio, 52 * ratio, 32 * ratio, 64 * ratio, 48 * ratio, 20 * ratio, 52 * ratio, 32 * ratio, (ImageObserver)null);
|
||||
var3.drawImage(var2, 40 * ratio, 52 * ratio, 36 * ratio, 64 * ratio, 44 * ratio, 20 * ratio, 48 * ratio, 32 * ratio, (ImageObserver)null);
|
||||
var3.drawImage(var2, 44 * ratio, 52 * ratio, 40 * ratio, 64 * ratio, 40 * ratio, 20 * ratio, 44 * ratio, 32 * ratio, (ImageObserver)null);
|
||||
var3.drawImage(var2, 48 * ratio, 52 * ratio, 44 * ratio, 64 * ratio, 52 * ratio, 20 * ratio, 56 * ratio, 32 * ratio, (ImageObserver)null);
|
||||
}
|
||||
|
||||
var3.dispose();
|
||||
this.imageData = ((DataBufferInt)var2.getRaster().getDataBuffer()).getData();
|
||||
if(!customskinloader.CustomSkinLoader.config.enableTransparentSkin){
|
||||
this.setAreaOpaque(0, 0, 32 * ratio, 16 * ratio);
|
||||
this.setAreaTransparent(32 * ratio, 0, 64 * ratio, 32 * ratio);
|
||||
this.setAreaOpaque(0, 16 * ratio, 64 * ratio, 32 * ratio);
|
||||
this.setAreaTransparent(0, 32 * ratio, 16 * ratio, 48 * ratio);
|
||||
this.setAreaTransparent(16 * ratio, 32 * ratio, 40 * ratio, 48 * ratio);
|
||||
this.setAreaTransparent(40 * ratio, 32 * ratio, 56 * ratio, 48 * ratio);
|
||||
this.setAreaTransparent(0, 48 * ratio, 16 * ratio, 64 * ratio);
|
||||
this.setAreaOpaque(16 * ratio, 48 * ratio, 48 * ratio, 64 * ratio);
|
||||
this.setAreaTransparent(48 * ratio, 48 * ratio, 64 * ratio, 64 * ratio);
|
||||
}
|
||||
return var2;
|
||||
}
|
||||
}
|
||||
|
||||
public void skinAvailable() {}
|
||||
|
||||
/**
|
||||
* Makes the given area of the image transparent if it was previously completely opaque (used to remove the outer
|
||||
* layer of a skin around the head if it was saved all opaque; this would be redundant so it's assumed that the skin
|
||||
* maker is just using an image editor without an alpha channel)
|
||||
*/
|
||||
private void setAreaTransparent(int p_78434_1_, int p_78434_2_, int p_78434_3_, int p_78434_4_)
|
||||
{
|
||||
if (!this.hasTransparency(p_78434_1_, p_78434_2_, p_78434_3_, p_78434_4_))
|
||||
{
|
||||
for (int var5 = p_78434_1_; var5 < p_78434_3_; ++var5)
|
||||
{
|
||||
for (int var6 = p_78434_2_; var6 < p_78434_4_; ++var6)
|
||||
{
|
||||
this.imageData[var5 + var6 * this.imageWidth] &= 16777215;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes the given area of the image opaque
|
||||
*/
|
||||
private void setAreaOpaque(int p_78433_1_, int p_78433_2_, int p_78433_3_, int p_78433_4_)
|
||||
{
|
||||
for (int var5 = p_78433_1_; var5 < p_78433_3_; ++var5)
|
||||
{
|
||||
for (int var6 = p_78433_2_; var6 < p_78433_4_; ++var6)
|
||||
{
|
||||
this.imageData[var5 + var6 * this.imageWidth] |= -16777216;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the given area of the image contains transparent pixels
|
||||
*/
|
||||
private boolean hasTransparency(int p_78435_1_, int p_78435_2_, int p_78435_3_, int p_78435_4_)
|
||||
{
|
||||
for (int var5 = p_78435_1_; var5 < p_78435_3_; ++var5)
|
||||
{
|
||||
for (int var6 = p_78435_2_; var6 < p_78435_4_; ++var6)
|
||||
{
|
||||
int var7 = this.imageData[var5 + var6 * this.imageWidth];
|
||||
|
||||
if ((var7 >> 24 & 255) < 128)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -84,7 +84,7 @@ public class SkinManager
|
||||
}
|
||||
else
|
||||
{
|
||||
final ImageBufferDownload var8 = p_152789_2_ == Type.SKIN ? new ImageBufferDownload() : null;
|
||||
final ImageBufferDownload var8 = p_152789_2_ == Type.SKIN ? new customskinloader.renderer.SkinBuffer() : null;//Modified
|
||||
ThreadDownloadImageData var9 = new ThreadDownloadImageData(info.cacheFile, info.url, DefaultPlayerSkin.getDefaultSkinLegacy(), new IImageBuffer()//Modified
|
||||
{
|
||||
private static final String __OBFID = "CL_00001828";
|
||||
|
||||
@@ -1,119 +0,0 @@
|
||||
package net.minecraft.client.renderer;
|
||||
|
||||
import java.awt.Graphics;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.DataBufferInt;
|
||||
import java.awt.image.ImageObserver;
|
||||
|
||||
public class ImageBufferDownload implements IImageBuffer
|
||||
{
|
||||
private int[] imageData;
|
||||
private int imageWidth;
|
||||
private int imageHeight;
|
||||
|
||||
public BufferedImage parseUserSkin(BufferedImage image)
|
||||
{
|
||||
if (image == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
int ratio=image.getWidth()/64;
|
||||
this.imageWidth = 64 * ratio;
|
||||
this.imageHeight = 64 * ratio;
|
||||
BufferedImage var2 = new BufferedImage(this.imageWidth, this.imageHeight, 2);
|
||||
Graphics var3 = var2.getGraphics();
|
||||
var3.drawImage(image, 0, 0, (ImageObserver)null);
|
||||
|
||||
if (image.getHeight() == 32 * ratio)
|
||||
{
|
||||
var3.drawImage(var2, 24 * ratio, 48 * ratio, 20 * ratio, 52 * ratio, 4 * ratio, 16 * ratio, 8 * ratio, 20 * ratio, (ImageObserver)null);
|
||||
var3.drawImage(var2, 28 * ratio, 48 * ratio, 24 * ratio, 52 * ratio, 8 * ratio, 16 * ratio, 12 * ratio, 20 * ratio, (ImageObserver)null);
|
||||
var3.drawImage(var2, 20 * ratio, 52 * ratio, 16 * ratio, 64 * ratio, 8 * ratio, 20 * ratio, 12 * ratio, 32 * ratio, (ImageObserver)null);
|
||||
var3.drawImage(var2, 24 * ratio, 52 * ratio, 20 * ratio, 64 * ratio, 4 * ratio, 20 * ratio, 8 * ratio, 32 * ratio, (ImageObserver)null);
|
||||
var3.drawImage(var2, 28 * ratio, 52 * ratio, 24 * ratio, 64 * ratio, 0 * ratio, 20 * ratio, 4 * ratio, 32 * ratio, (ImageObserver)null);
|
||||
var3.drawImage(var2, 32 * ratio, 52 * ratio, 28 * ratio, 64 * ratio, 12 * ratio, 20 * ratio, 16 * ratio, 32 * ratio, (ImageObserver)null);
|
||||
var3.drawImage(var2, 40 * ratio, 48 * ratio, 36 * ratio, 52 * ratio, 44 * ratio, 16 * ratio, 48 * ratio, 20 * ratio, (ImageObserver)null);
|
||||
var3.drawImage(var2, 44 * ratio, 48 * ratio, 40 * ratio, 52 * ratio, 48 * ratio, 16 * ratio, 52 * ratio, 20 * ratio, (ImageObserver)null);
|
||||
var3.drawImage(var2, 36 * ratio, 52 * ratio, 32 * ratio, 64 * ratio, 48 * ratio, 20 * ratio, 52 * ratio, 32 * ratio, (ImageObserver)null);
|
||||
var3.drawImage(var2, 40 * ratio, 52 * ratio, 36 * ratio, 64 * ratio, 44 * ratio, 20 * ratio, 48 * ratio, 32 * ratio, (ImageObserver)null);
|
||||
var3.drawImage(var2, 44 * ratio, 52 * ratio, 40 * ratio, 64 * ratio, 40 * ratio, 20 * ratio, 44 * ratio, 32 * ratio, (ImageObserver)null);
|
||||
var3.drawImage(var2, 48 * ratio, 52 * ratio, 44 * ratio, 64 * ratio, 52 * ratio, 20 * ratio, 56 * ratio, 32 * ratio, (ImageObserver)null);
|
||||
}
|
||||
|
||||
var3.dispose();
|
||||
this.imageData = ((DataBufferInt)var2.getRaster().getDataBuffer()).getData();
|
||||
if(!customskinloader.CustomSkinLoader.config.enableTransparentSkin){
|
||||
this.setAreaOpaque(0, 0, 32 * ratio, 16 * ratio);
|
||||
this.setAreaTransparent(32 * ratio, 0, 64 * ratio, 32 * ratio);
|
||||
this.setAreaOpaque(0, 16 * ratio, 64 * ratio, 32 * ratio);
|
||||
this.setAreaTransparent(0, 32 * ratio, 16 * ratio, 48 * ratio);
|
||||
this.setAreaTransparent(16 * ratio, 32 * ratio, 40 * ratio, 48 * ratio);
|
||||
this.setAreaTransparent(40 * ratio, 32 * ratio, 56 * ratio, 48 * ratio);
|
||||
this.setAreaTransparent(0, 48 * ratio, 16 * ratio, 64 * ratio);
|
||||
this.setAreaOpaque(16 * ratio, 48 * ratio, 48 * ratio, 64 * ratio);
|
||||
this.setAreaTransparent(48 * ratio, 48 * ratio, 64 * ratio, 64 * ratio);
|
||||
}
|
||||
return var2;
|
||||
}
|
||||
}
|
||||
|
||||
public void skinAvailable()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes the given area of the image transparent if it was previously completely opaque (used to remove the outer
|
||||
* layer of a skin around the head if it was saved all opaque; this would be redundant so it's assumed that the skin
|
||||
* maker is just using an image editor without an alpha channel)
|
||||
*/
|
||||
private void setAreaTransparent(int p_78434_1_, int p_78434_2_, int p_78434_3_, int p_78434_4_)
|
||||
{
|
||||
if (!this.hasTransparency(p_78434_1_, p_78434_2_, p_78434_3_, p_78434_4_))
|
||||
{
|
||||
for (int i = p_78434_1_; i < p_78434_3_; ++i)
|
||||
{
|
||||
for (int j = p_78434_2_; j < p_78434_4_; ++j)
|
||||
{
|
||||
this.imageData[i + j * this.imageWidth] &= 16777215;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes the given area of the image opaque
|
||||
*/
|
||||
private void setAreaOpaque(int p_78433_1_, int p_78433_2_, int p_78433_3_, int p_78433_4_)
|
||||
{
|
||||
for (int i = p_78433_1_; i < p_78433_3_; ++i)
|
||||
{
|
||||
for (int j = p_78433_2_; j < p_78433_4_; ++j)
|
||||
{
|
||||
this.imageData[i + j * this.imageWidth] |= -16777216;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the given area of the image contains transparent pixels
|
||||
*/
|
||||
private boolean hasTransparency(int p_78435_1_, int p_78435_2_, int p_78435_3_, int p_78435_4_)
|
||||
{
|
||||
for (int i = p_78435_1_; i < p_78435_3_; ++i)
|
||||
{
|
||||
for (int j = p_78435_2_; j < p_78435_4_; ++j)
|
||||
{
|
||||
int k = this.imageData[i + j * this.imageWidth];
|
||||
|
||||
if ((k >> 24 & 255) < 128)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -77,7 +77,7 @@ public class SkinManager
|
||||
}
|
||||
else
|
||||
{
|
||||
final IImageBuffer iimagebuffer = p_152789_2_ == Type.SKIN ? new ImageBufferDownload() : null;
|
||||
final IImageBuffer iimagebuffer = p_152789_2_ == Type.SKIN ? new customskinloader.renderer.SkinBuffer() : null;//Modified
|
||||
ThreadDownloadImageData threaddownloadimagedata = new ThreadDownloadImageData(info.cacheFile, info.url, DefaultPlayerSkin.getDefaultSkinLegacy(), new IImageBuffer()//Modified
|
||||
{
|
||||
public BufferedImage parseUserSkin(BufferedImage image)
|
||||
|
||||
@@ -1,117 +0,0 @@
|
||||
package net.minecraft.client.renderer;
|
||||
|
||||
import java.awt.Graphics;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.DataBufferInt;
|
||||
import java.awt.image.ImageObserver;
|
||||
|
||||
public class ImageBufferDownload implements IImageBuffer
|
||||
{
|
||||
private int[] imageData;
|
||||
private int imageWidth;
|
||||
private int imageHeight;
|
||||
|
||||
public BufferedImage parseUserSkin(BufferedImage image)
|
||||
{
|
||||
if (image == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
int ratio = image.getWidth() / 64;
|
||||
this.imageWidth = 64 * ratio;
|
||||
this.imageHeight = 64 * ratio;
|
||||
BufferedImage bufferedimage = new BufferedImage(this.imageWidth, this.imageHeight, 2);
|
||||
Graphics graphics = bufferedimage.getGraphics();
|
||||
graphics.drawImage(image, 0, 0, null);
|
||||
if (image.getHeight() == 32 * ratio)
|
||||
{
|
||||
graphics.drawImage(bufferedimage, 24 * ratio, 48 * ratio, 20 * ratio, 52 * ratio, 4 * ratio, 16 * ratio, 8 * ratio, 20 * ratio, (ImageObserver)null);
|
||||
graphics.drawImage(bufferedimage, 28 * ratio, 48 * ratio, 24 * ratio, 52 * ratio, 8 * ratio, 16 * ratio, 12 * ratio, 20 * ratio, (ImageObserver)null);
|
||||
graphics.drawImage(bufferedimage, 20 * ratio, 52 * ratio, 16 * ratio, 64 * ratio, 8 * ratio, 20 * ratio, 12 * ratio, 32 * ratio, (ImageObserver)null);
|
||||
graphics.drawImage(bufferedimage, 24 * ratio, 52 * ratio, 20 * ratio, 64 * ratio, 4 * ratio, 20 * ratio, 8 * ratio, 32 * ratio, (ImageObserver)null);
|
||||
graphics.drawImage(bufferedimage, 28 * ratio, 52 * ratio, 24 * ratio, 64 * ratio, 0 * ratio, 20 * ratio, 4 * ratio, 32 * ratio, (ImageObserver)null);
|
||||
graphics.drawImage(bufferedimage, 32 * ratio, 52 * ratio, 28 * ratio, 64 * ratio, 12 * ratio, 20 * ratio, 16 * ratio, 32 * ratio, (ImageObserver)null);
|
||||
graphics.drawImage(bufferedimage, 40 * ratio, 48 * ratio, 36 * ratio, 52 * ratio, 44 * ratio, 16 * ratio, 48 * ratio, 20 * ratio, (ImageObserver)null);
|
||||
graphics.drawImage(bufferedimage, 44 * ratio, 48 * ratio, 40 * ratio, 52 * ratio, 48 * ratio, 16 * ratio, 52 * ratio, 20 * ratio, (ImageObserver)null);
|
||||
graphics.drawImage(bufferedimage, 36 * ratio, 52 * ratio, 32 * ratio, 64 * ratio, 48 * ratio, 20 * ratio, 52 * ratio, 32 * ratio, (ImageObserver)null);
|
||||
graphics.drawImage(bufferedimage, 40 * ratio, 52 * ratio, 36 * ratio, 64 * ratio, 44 * ratio, 20 * ratio, 48 * ratio, 32 * ratio, (ImageObserver)null);
|
||||
graphics.drawImage(bufferedimage, 44 * ratio, 52 * ratio, 40 * ratio, 64 * ratio, 40 * ratio, 20 * ratio, 44 * ratio, 32 * ratio, (ImageObserver)null);
|
||||
graphics.drawImage(bufferedimage, 48 * ratio, 52 * ratio, 44 * ratio, 64 * ratio, 52 * ratio, 20 * ratio, 56 * ratio, 32 * ratio, (ImageObserver)null);
|
||||
}
|
||||
graphics.dispose();
|
||||
this.imageData = ((DataBufferInt)bufferedimage.getRaster().getDataBuffer()).getData();
|
||||
if(!customskinloader.CustomSkinLoader.config.enableTransparentSkin){
|
||||
this.setAreaOpaque(0, 0, 32 * ratio, 16 * ratio);
|
||||
this.setAreaTransparent(32 * ratio, 0, 64 * ratio, 32 * ratio);
|
||||
this.setAreaOpaque(0, 16 * ratio, 64 * ratio, 32 * ratio);
|
||||
this.setAreaTransparent(0, 32 * ratio, 16 * ratio, 48 * ratio);
|
||||
this.setAreaTransparent(16 * ratio, 32 * ratio, 40 * ratio, 48 * ratio);
|
||||
this.setAreaTransparent(40 * ratio, 32 * ratio, 56 * ratio, 48 * ratio);
|
||||
this.setAreaTransparent(0, 48 * ratio, 16 * ratio, 64 * ratio);
|
||||
this.setAreaOpaque(16 * ratio, 48 * ratio, 48 * ratio, 64 * ratio);
|
||||
this.setAreaTransparent(48 * ratio, 48 * ratio, 64 * ratio, 64 * ratio);
|
||||
}
|
||||
return bufferedimage;
|
||||
}
|
||||
}
|
||||
|
||||
public void skinAvailable()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes the given area of the image transparent if it was previously completely opaque (used to remove the outer
|
||||
* layer of a skin around the head if it was saved all opaque; this would be redundant so it's assumed that the skin
|
||||
* maker is just using an image editor without an alpha channel)
|
||||
*/
|
||||
private void setAreaTransparent(int x, int y, int width, int height)
|
||||
{
|
||||
if (!this.hasTransparency(x, y, width, height))
|
||||
{
|
||||
for (int i = x; i < width; ++i)
|
||||
{
|
||||
for (int j = y; j < height; ++j)
|
||||
{
|
||||
this.imageData[i + j * this.imageWidth] &= 16777215;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes the given area of the image opaque
|
||||
*/
|
||||
private void setAreaOpaque(int x, int y, int width, int height)
|
||||
{
|
||||
for (int i = x; i < width; ++i)
|
||||
{
|
||||
for (int j = y; j < height; ++j)
|
||||
{
|
||||
this.imageData[i + j * this.imageWidth] |= -16777216;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the given area of the image contains transparent pixels
|
||||
*/
|
||||
private boolean hasTransparency(int x, int y, int width, int height)
|
||||
{
|
||||
for (int i = x; i < width; ++i)
|
||||
{
|
||||
for (int j = y; j < height; ++j)
|
||||
{
|
||||
int k = this.imageData[i + j * this.imageWidth];
|
||||
|
||||
if ((k >> 24 & 255) < 128)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -78,7 +78,7 @@ public class SkinManager
|
||||
}
|
||||
else
|
||||
{
|
||||
final IImageBuffer iimagebuffer = textureType == Type.SKIN ? new ImageBufferDownload() : null;
|
||||
final IImageBuffer iimagebuffer = textureType == Type.SKIN ? new customskinloader.renderer.SkinBuffer() : null;//Modified
|
||||
ThreadDownloadImageData threaddownloadimagedata = new ThreadDownloadImageData(info.cacheFile, info.url, DefaultPlayerSkin.getDefaultSkinLegacy(), new IImageBuffer()//Modified
|
||||
{
|
||||
public BufferedImage parseUserSkin(BufferedImage image)
|
||||
|
||||
@@ -1,109 +0,0 @@
|
||||
package net.minecraft.client.renderer;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.DataBufferInt;
|
||||
import java.awt.image.ImageObserver;
|
||||
|
||||
public class ImageBufferDownload implements IImageBuffer
|
||||
{
|
||||
private int[] imageData;
|
||||
private int imageWidth;
|
||||
private int imageHeight;
|
||||
|
||||
public BufferedImage parseUserSkin(BufferedImage image)
|
||||
{
|
||||
if (image == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
int ratio = image.getWidth() / 64;
|
||||
this.imageWidth = 64 * ratio;
|
||||
this.imageHeight = 64 * ratio;
|
||||
BufferedImage bufferedimage = new BufferedImage(this.imageWidth, this.imageHeight, 2);
|
||||
Graphics graphics = bufferedimage.getGraphics();
|
||||
graphics.drawImage(image, 0, 0, (ImageObserver)null);
|
||||
boolean flag = image.getHeight() == 32 * ratio;
|
||||
|
||||
if (flag)
|
||||
{
|
||||
if(!customskinloader.CustomSkinLoader.config.enableTransparentSkin){
|
||||
graphics.setColor(new Color(0, 0, 0, 0));
|
||||
graphics.fillRect(0, 32 * ratio, 64 * ratio, 32 * ratio);
|
||||
}
|
||||
graphics.drawImage(bufferedimage, 24 * ratio, 48 * ratio, 20 * ratio, 52 * ratio, 4 * ratio, 16 * ratio, 8 * ratio, 20 * ratio, (ImageObserver)null);
|
||||
graphics.drawImage(bufferedimage, 28 * ratio, 48 * ratio, 24 * ratio, 52 * ratio, 8 * ratio, 16 * ratio, 12 * ratio, 20 * ratio, (ImageObserver)null);
|
||||
graphics.drawImage(bufferedimage, 20 * ratio, 52 * ratio, 16 * ratio, 64 * ratio, 8 * ratio, 20 * ratio, 12 * ratio, 32 * ratio, (ImageObserver)null);
|
||||
graphics.drawImage(bufferedimage, 24 * ratio, 52 * ratio, 20 * ratio, 64 * ratio, 4 * ratio, 20 * ratio, 8 * ratio, 32 * ratio, (ImageObserver)null);
|
||||
graphics.drawImage(bufferedimage, 28 * ratio, 52 * ratio, 24 * ratio, 64 * ratio, 0 * ratio, 20 * ratio, 4 * ratio, 32 * ratio, (ImageObserver)null);
|
||||
graphics.drawImage(bufferedimage, 32 * ratio, 52 * ratio, 28 * ratio, 64 * ratio, 12 * ratio, 20 * ratio, 16 * ratio, 32 * ratio, (ImageObserver)null);
|
||||
graphics.drawImage(bufferedimage, 40 * ratio, 48 * ratio, 36 * ratio, 52 * ratio, 44 * ratio, 16 * ratio, 48 * ratio, 20 * ratio, (ImageObserver)null);
|
||||
graphics.drawImage(bufferedimage, 44 * ratio, 48 * ratio, 40 * ratio, 52 * ratio, 48 * ratio, 16 * ratio, 52 * ratio, 20 * ratio, (ImageObserver)null);
|
||||
graphics.drawImage(bufferedimage, 36 * ratio, 52 * ratio, 32 * ratio, 64 * ratio, 48 * ratio, 20 * ratio, 52 * ratio, 32 * ratio, (ImageObserver)null);
|
||||
graphics.drawImage(bufferedimage, 40 * ratio, 52 * ratio, 36 * ratio, 64 * ratio, 44 * ratio, 20 * ratio, 48 * ratio, 32 * ratio, (ImageObserver)null);
|
||||
graphics.drawImage(bufferedimage, 44 * ratio, 52 * ratio, 40 * ratio, 64 * ratio, 40 * ratio, 20 * ratio, 44 * ratio, 32 * ratio, (ImageObserver)null);
|
||||
graphics.drawImage(bufferedimage, 48 * ratio, 52 * ratio, 44 * ratio, 64 * ratio, 52 * ratio, 20 * ratio, 56 * ratio, 32 * ratio, (ImageObserver)null);
|
||||
}
|
||||
|
||||
graphics.dispose();
|
||||
this.imageData = ((DataBufferInt)bufferedimage.getRaster().getDataBuffer()).getData();
|
||||
if(!customskinloader.CustomSkinLoader.config.enableTransparentSkin){
|
||||
this.setAreaOpaque( 0 * ratio, 0 * ratio, 32 * ratio, 16 * ratio);
|
||||
|
||||
if (flag)
|
||||
{
|
||||
this.doTransparencyHack(32 * ratio, 0, 64 * ratio, 32 * ratio);
|
||||
}
|
||||
|
||||
this.setAreaOpaque( 0 * ratio, 16 * ratio, 64 * ratio, 32 * ratio);
|
||||
this.setAreaOpaque(16 * ratio, 48 * ratio, 48 * ratio, 64 * ratio);
|
||||
}
|
||||
return bufferedimage;
|
||||
}
|
||||
}
|
||||
|
||||
public void skinAvailable()
|
||||
{
|
||||
}
|
||||
|
||||
private void doTransparencyHack(int p_189559_1_, int p_189559_2_, int p_189559_3_, int p_189559_4_)
|
||||
{
|
||||
for (int i = p_189559_1_; i < p_189559_3_; ++i)
|
||||
{
|
||||
for (int j = p_189559_2_; j < p_189559_4_; ++j)
|
||||
{
|
||||
int k = this.imageData[i + j * this.imageWidth];
|
||||
|
||||
if ((k >> 24 & 255) < 128)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int l = p_189559_1_; l < p_189559_3_; ++l)
|
||||
{
|
||||
for (int i1 = p_189559_2_; i1 < p_189559_4_; ++i1)
|
||||
{
|
||||
this.imageData[l + i1 * this.imageWidth] &= 16777215;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes the given area of the image opaque
|
||||
*/
|
||||
private void setAreaOpaque(int x, int y, int width, int height)
|
||||
{
|
||||
for (int i = x; i < width; ++i)
|
||||
{
|
||||
for (int j = y; j < height; ++j)
|
||||
{
|
||||
this.imageData[i + j * this.imageWidth] |= -16777216;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -78,7 +78,7 @@ public class SkinManager
|
||||
}
|
||||
else
|
||||
{
|
||||
final IImageBuffer iimagebuffer = textureType == Type.SKIN ? new ImageBufferDownload() : null;
|
||||
final IImageBuffer iimagebuffer = textureType == Type.SKIN ? new customskinloader.renderer.SkinBuffer() : null;//Modified
|
||||
ThreadDownloadImageData threaddownloadimagedata = new ThreadDownloadImageData(info.cacheFile, info.url, DefaultPlayerSkin.getDefaultSkinLegacy(), new IImageBuffer()//Modified
|
||||
{
|
||||
public BufferedImage parseUserSkin(BufferedImage image)
|
||||
|
||||
@@ -16,7 +16,7 @@ public class Config {
|
||||
public String version;
|
||||
public boolean enable=true;
|
||||
public boolean enableSkull=true;
|
||||
public boolean enableTransparentSkin=false;
|
||||
public boolean enableTransparentSkin=true;
|
||||
public int cacheExpiry=10;
|
||||
public boolean enableUpdateSkull=false;
|
||||
public boolean enableLocalProfileCache=false;
|
||||
@@ -77,7 +77,7 @@ public class Config {
|
||||
ArrayList<SkinSiteProfile> adds=new ArrayList<SkinSiteProfile>();
|
||||
File[] files=listAddition.listFiles();
|
||||
for(File file:files){
|
||||
if(!file.getName().endsWith(".json")&&!file.getName().endsWith(".txt"))
|
||||
if(!file.getName().toLowerCase().endsWith(".json")&&!file.getName().toLowerCase().endsWith(".txt"))
|
||||
continue;
|
||||
try {
|
||||
CustomSkinLoader.logger.info("Try to load Extra List.("+file.getName()+")");
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
package customskinloader.renderer;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.DataBufferInt;
|
||||
import java.awt.image.ImageObserver;
|
||||
|
||||
public class SkinBuffer implements net.minecraft.client.renderer.IImageBuffer {
|
||||
|
||||
private int[] imageData;
|
||||
private int ratio=1;
|
||||
|
||||
@Override
|
||||
public BufferedImage parseUserSkin(BufferedImage image) {
|
||||
if(image==null)
|
||||
return null;
|
||||
ratio = image.getWidth() / 64;
|
||||
BufferedImage bufferedimage = new BufferedImage(64 * ratio, 64 * ratio, 2);
|
||||
Graphics graphics = bufferedimage.getGraphics();
|
||||
graphics.setColor(new Color(0,0,0,0));
|
||||
graphics.fillRect(0,0,64,64);
|
||||
graphics.drawImage(image,0,0,(ImageObserver)null);
|
||||
boolean flag = image.getHeight() == 32 * ratio;
|
||||
if (flag)
|
||||
{
|
||||
graphics.drawImage(bufferedimage,32 * ratio,48 * ratio,16 * ratio,64 * ratio, 0 * ratio,16 * ratio,16 * ratio,32 * ratio,(ImageObserver)null);
|
||||
graphics.drawImage(bufferedimage,48 * ratio,48 * ratio,32 * ratio,64 * ratio,40 * ratio,16 * ratio,56 * ratio,32 * ratio,(ImageObserver)null);
|
||||
}
|
||||
graphics.dispose();
|
||||
this.imageData = ((DataBufferInt)bufferedimage.getRaster().getDataBuffer()).getData();
|
||||
|
||||
setAreaDueToConfig( 0 * ratio, 0 * ratio,32 * ratio,16 * ratio);//Head - 1
|
||||
setAreaTransparent(32 * ratio, 0 * ratio,64 * ratio,16 * ratio);//Head - 2
|
||||
|
||||
setAreaDueToConfig( 0 * ratio,16 * ratio,16 * ratio,32 * ratio);//Right Leg - 1
|
||||
setAreaDueToConfig(16 * ratio,16 * ratio,40 * ratio,32 * ratio);//Body - 1
|
||||
setAreaDueToConfig(40 * ratio,16 * ratio,56 * ratio,32 * ratio);//Right Arm - 1
|
||||
|
||||
setAreaTransparent( 0 * ratio,32 * ratio,16 * ratio,48 * ratio);//Right Leg - 2
|
||||
setAreaTransparent(16 * ratio,32 * ratio,40 * ratio,48 * ratio);//Body - 2
|
||||
setAreaTransparent(40 * ratio,32 * ratio,56 * ratio,48 * ratio);//Right Arm - 2
|
||||
|
||||
setAreaTransparent( 0 * ratio,48 * ratio,16 * ratio,64 * ratio);//Left Leg - 2
|
||||
setAreaDueToConfig(16 * ratio,48 * ratio,32 * ratio,64 * ratio);//Left Leg - 1
|
||||
setAreaDueToConfig(32 * ratio,48 * ratio,48 * ratio,64 * ratio);//Left Arm - 1
|
||||
setAreaTransparent(48 * ratio,48 * ratio,64 * ratio,64 * ratio);//Left Arm - 2
|
||||
|
||||
return bufferedimage;
|
||||
}
|
||||
|
||||
/* 2^24-1
|
||||
* 00000000 11111111 11111111 11111111 */
|
||||
private static final int A=16777215;
|
||||
private static final int WHITE=getARGB(255,255,255,255);
|
||||
private static final int BLACK=getARGB(255,0,0,0);
|
||||
private boolean isFilled(int x0,int y0,int x1,int y1){
|
||||
int data=this.imageData[getPosition(x0,y0)];
|
||||
if(data!=WHITE && data!=BLACK)
|
||||
return false;
|
||||
for (int x=x0;x<x1;++x)
|
||||
for (int y=y0;y<y1;++y)
|
||||
if(this.imageData[getPosition(x,y)]!=data)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
private void setAreaTransparent(int x0,int y0,int x1,int y1){
|
||||
if(!isFilled(x0,y0,x1,y1))
|
||||
return;
|
||||
for (int x=x0;x<x1;++x)
|
||||
for (int y=y0;y<y1;++y)
|
||||
this.imageData[getPosition(x,y)] &= A;
|
||||
}
|
||||
|
||||
/* -2^24
|
||||
* 00000001 00000000 00000000 00000000 ->
|
||||
* 11111110 11111111 11111111 11111111 ->
|
||||
* 11111111 00000000 00000000 00000000 */
|
||||
private static final int B=-16777216;
|
||||
private void setAreaOpaque(int x0,int y0,int x1,int y1)
|
||||
{
|
||||
for (int x=x0;x<x1;++x)
|
||||
for (int y=y0;y<y1;++y)
|
||||
this.imageData[getPosition(x,y)] |= B;
|
||||
}
|
||||
|
||||
private void setAreaDueToConfig(int x0,int y0,int x1,int y1){
|
||||
if(customskinloader.CustomSkinLoader.config.enableTransparentSkin)
|
||||
setAreaTransparent(x0,y0,x1,y1);
|
||||
else
|
||||
setAreaOpaque(x0,y0,x1,y1);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void skinAvailable() {
|
||||
}
|
||||
|
||||
private static int getARGB(int a,int r,int g,int b) {
|
||||
return (a << 24) | (r << 16) | (g << 8) | b;
|
||||
}
|
||||
|
||||
private int getPosition(int x,int y){
|
||||
return x+y*64*ratio;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -3,4 +3,4 @@ group=customskinloader
|
||||
version=14.4
|
||||
dev_version=
|
||||
#RELEASE: snapshot_version=
|
||||
snapshot_version=20160821
|
||||
snapshot_version=20160828
|
||||
Reference in new issue
Block a user