Rewrite texture loading & remove unused multiplayer code (again)
This commit is contained in:
parent
84cea78151
commit
a5957ad6b2
|
@ -6,9 +6,7 @@ import com.mojang.minecraft.level.liquid.LiquidType;
|
||||||
import com.mojang.minecraft.level.tile.Block;
|
import com.mojang.minecraft.level.tile.Block;
|
||||||
import com.mojang.minecraft.level.tile.Tile$SoundType;
|
import com.mojang.minecraft.level.tile.Tile$SoundType;
|
||||||
import com.mojang.minecraft.model.Vec3D;
|
import com.mojang.minecraft.model.Vec3D;
|
||||||
import com.mojang.minecraft.net.PositionUpdate;
|
|
||||||
import com.mojang.minecraft.phys.AABB;
|
import com.mojang.minecraft.phys.AABB;
|
||||||
import com.mojang.minecraft.render.TextureManager;
|
|
||||||
import net.PeytonPlayz585.math.MathHelper;
|
import net.PeytonPlayz585.math.MathHelper;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -88,20 +86,6 @@ public abstract class Entity implements Serializable {
|
||||||
this.bbHeight = var2;
|
this.bbHeight = var2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPos(PositionUpdate var1) {
|
|
||||||
if(var1.position) {
|
|
||||||
this.setPos(var1.x, var1.y, var1.z);
|
|
||||||
} else {
|
|
||||||
this.setPos(this.x, this.y, this.z);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(var1.rotation) {
|
|
||||||
this.setRot(var1.yaw, var1.pitch);
|
|
||||||
} else {
|
|
||||||
this.setRot(this.yRot, this.xRot);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void setRot(float var1, float var2) {
|
protected void setRot(float var1, float var2) {
|
||||||
this.yRot = var1;
|
this.yRot = var1;
|
||||||
this.xRot = var2;
|
this.xRot = var2;
|
||||||
|
@ -360,7 +344,7 @@ public abstract class Entity implements Serializable {
|
||||||
return this.level.getBrightness(var4, var2, var3);
|
return this.level.getBrightness(var4, var2, var3);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void render(TextureManager var1, float var2) {}
|
public void render(float var2) {}
|
||||||
|
|
||||||
public void setLevel(Level var1) {
|
public void setLevel(Level var1) {
|
||||||
this.level = var1;
|
this.level = var1;
|
||||||
|
@ -465,5 +449,5 @@ public abstract class Entity implements Serializable {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void renderHover(TextureManager var1, float var2) {}
|
public void renderHover(float var2) {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@ import com.mojang.minecraft.model.HumanoidModel;
|
||||||
import com.mojang.minecraft.model.ModelManager;
|
import com.mojang.minecraft.model.ModelManager;
|
||||||
import com.mojang.minecraft.model.ModelPart;
|
import com.mojang.minecraft.model.ModelPart;
|
||||||
import com.mojang.minecraft.model.Vec3D;
|
import com.mojang.minecraft.model.Vec3D;
|
||||||
import com.mojang.minecraft.net.NetworkPlayer;
|
|
||||||
import com.mojang.minecraft.particle.Particle;
|
import com.mojang.minecraft.particle.Particle;
|
||||||
import com.mojang.minecraft.particle.ParticleManager;
|
import com.mojang.minecraft.particle.ParticleManager;
|
||||||
import com.mojang.minecraft.particle.WaterDropParticle;
|
import com.mojang.minecraft.particle.WaterDropParticle;
|
||||||
|
@ -54,7 +53,6 @@ public final class Minecraft implements Runnable {
|
||||||
public String host;
|
public String host;
|
||||||
public boolean levelLoaded = false;
|
public boolean levelLoaded = false;
|
||||||
public volatile boolean waiting = false;
|
public volatile boolean waiting = false;
|
||||||
public TextureManager textureManager;
|
|
||||||
public FontRenderer fontRenderer;
|
public FontRenderer fontRenderer;
|
||||||
public GuiScreen currentScreen = null;
|
public GuiScreen currentScreen = null;
|
||||||
public ProgressBarDisplay progressBar = new ProgressBarDisplay(this);
|
public ProgressBarDisplay progressBar = new ProgressBarDisplay(this);
|
||||||
|
@ -67,7 +65,7 @@ public final class Minecraft implements Runnable {
|
||||||
public HUDScreen hud;
|
public HUDScreen hud;
|
||||||
public boolean online;
|
public boolean online;
|
||||||
public MovingObjectPosition selected;
|
public MovingObjectPosition selected;
|
||||||
public GameSettings settings;
|
public static GameSettings settings;
|
||||||
String server;
|
String server;
|
||||||
int port;
|
int port;
|
||||||
volatile boolean running;
|
volatile boolean running;
|
||||||
|
@ -161,13 +159,10 @@ public final class Minecraft implements Runnable {
|
||||||
GL11.glMatrixMode(5888);
|
GL11.glMatrixMode(5888);
|
||||||
checkGLError("Startup");
|
checkGLError("Startup");
|
||||||
this.settings = new GameSettings(this);
|
this.settings = new GameSettings(this);
|
||||||
this.textureManager = new TextureManager(this.settings);
|
this.fontRenderer = new FontRenderer(this.settings, "/default.png");
|
||||||
this.textureManager.registerAnimation(new TextureLavaFX());
|
|
||||||
this.textureManager.registerAnimation(new TextureWaterFX());
|
|
||||||
this.fontRenderer = new FontRenderer(this.settings, "/default.png", this.textureManager);
|
|
||||||
IntBuffer var9;
|
IntBuffer var9;
|
||||||
(var9 = GLAllocation.createDirectIntBuffer(256)).clear().limit(256);
|
(var9 = GLAllocation.createDirectIntBuffer(256)).clear().limit(256);
|
||||||
this.levelRenderer = new LevelRenderer(this, this.textureManager);
|
this.levelRenderer = new LevelRenderer(this);
|
||||||
Item.initModels();
|
Item.initModels();
|
||||||
Mob.modelCache = new ModelManager();
|
Mob.modelCache = new ModelManager();
|
||||||
GL11.glViewport(0, 0, this.width, this.height);
|
GL11.glViewport(0, 0, this.width, this.height);
|
||||||
|
@ -180,7 +175,7 @@ public final class Minecraft implements Runnable {
|
||||||
this.generateLevel(1);
|
this.generateLevel(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.particleManager = new ParticleManager(this.level, this.textureManager);
|
this.particleManager = new ParticleManager(this.level);
|
||||||
checkGLError("Post startup");
|
checkGLError("Post startup");
|
||||||
this.hud = new HUDScreen(this, this.width, this.height);
|
this.hud = new HUDScreen(this, this.width, this.height);
|
||||||
//} catch (Exception var62) {
|
//} catch (Exception var62) {
|
||||||
|
@ -502,7 +497,7 @@ public final class Minecraft implements Runnable {
|
||||||
|
|
||||||
var82.setLighting(true);
|
var82.setLighting(true);
|
||||||
Vec3D var103 = var82.getPlayerVector(var80);
|
Vec3D var103 = var82.getPlayerVector(var80);
|
||||||
var89.level.blockMap.render(var103, var76, var89.textureManager, var80);
|
var89.level.blockMap.render(var103, var76, var80);
|
||||||
var82.setLighting(false);
|
var82.setLighting(false);
|
||||||
var82.updateFog();
|
var82.updateFog();
|
||||||
float var107 = var80;
|
float var107 = var80;
|
||||||
|
@ -516,14 +511,13 @@ public final class Minecraft implements Runnable {
|
||||||
if(var96.particles[var83].size() != 0) {
|
if(var96.particles[var83].size() != 0) {
|
||||||
var110 = 0;
|
var110 = 0;
|
||||||
if(var83 == 0) {
|
if(var83 == 0) {
|
||||||
var110 = var96.textureManager.load("/particles.png");
|
var110 = new TextureLocation("/particles.png").bindTexture();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(var83 == 1) {
|
if(var83 == 1) {
|
||||||
var110 = var96.textureManager.load("/terrain.png");
|
var110 = new TextureLocation("/terrain.png").bindTexture();
|
||||||
}
|
}
|
||||||
|
|
||||||
GL11.glBindTexture(3553, var110);
|
|
||||||
ShapeRenderer var121 = ShapeRenderer.instance;
|
ShapeRenderer var121 = ShapeRenderer.instance;
|
||||||
ShapeRenderer.instance.begin();
|
ShapeRenderer.instance.begin();
|
||||||
|
|
||||||
|
@ -535,12 +529,12 @@ public final class Minecraft implements Runnable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GL11.glBindTexture(3553, var89.textureManager.load("/rock.png"));
|
new TextureLocation("/rock.png").bindTexture();
|
||||||
GL11.glEnable(3553);
|
GL11.glEnable(3553);
|
||||||
GL11.glCallList(var89.listId);
|
GL11.glCallList(var89.listId);
|
||||||
var82.updateFog();
|
var82.updateFog();
|
||||||
var101 = var89;
|
var101 = var89;
|
||||||
GL11.glBindTexture(3553, var89.textureManager.load("/clouds.png"));
|
new TextureLocation("/clouds.png").bindTexture();
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
var107 = (float)(var89.level.cloudColor >> 16 & 255) / 255.0F;
|
var107 = (float)(var89.level.cloudColor >> 16 & 255) / 255.0F;
|
||||||
var29 = (float)(var89.level.cloudColor >> 8 & 255) / 255.0F;
|
var29 = (float)(var89.level.cloudColor >> 8 & 255) / 255.0F;
|
||||||
|
@ -621,7 +615,7 @@ public final class Minecraft implements Runnable {
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, (MathHelper.sin((float)System.currentTimeMillis() / 100.0F) * 0.2F + 0.4F) * 0.5F);
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, (MathHelper.sin((float)System.currentTimeMillis() / 100.0F) * 0.2F + 0.4F) * 0.5F);
|
||||||
if(var89.cracks > 0.0F) {
|
if(var89.cracks > 0.0F) {
|
||||||
GL11.glBlendFunc(774, 768);
|
GL11.glBlendFunc(774, 768);
|
||||||
var108 = var89.textureManager.load("/terrain.png");
|
var108 = new TextureLocation("/terrain.png").bindTexture();
|
||||||
GL11.glBindTexture(3553, var108);
|
GL11.glBindTexture(3553, var108);
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5F);
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5F);
|
||||||
GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
|
@ -673,7 +667,7 @@ public final class Minecraft implements Runnable {
|
||||||
var82.updateFog();
|
var82.updateFog();
|
||||||
GL11.glEnable(3553);
|
GL11.glEnable(3553);
|
||||||
GL11.glEnable(3042);
|
GL11.glEnable(3042);
|
||||||
GL11.glBindTexture(3553, var89.textureManager.load("/water.png"));
|
new TextureLocation("/water.png").bindTexture();
|
||||||
GL11.glCallList(var89.listId + 1);
|
GL11.glCallList(var89.listId + 1);
|
||||||
GL11.glDisable(3042);
|
GL11.glDisable(3042);
|
||||||
GL11.glEnable(3042);
|
GL11.glEnable(3042);
|
||||||
|
@ -689,7 +683,7 @@ public final class Minecraft implements Runnable {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(var120 > 0) {
|
if(var120 > 0) {
|
||||||
GL11.glBindTexture(3553, var89.textureManager.load("/terrain.png"));
|
new TextureLocation("/terrain.png").bindTexture();
|
||||||
GL11.glCallLists(var89.buffer);
|
GL11.glCallLists(var89.buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -709,7 +703,7 @@ public final class Minecraft implements Runnable {
|
||||||
GL11.glNormal3f(0.0F, 1.0F, 0.0F);
|
GL11.glNormal3f(0.0F, 1.0F, 0.0F);
|
||||||
GL11.glEnable(3042);
|
GL11.glEnable(3042);
|
||||||
GL11.glBlendFunc(770, 771);
|
GL11.glBlendFunc(770, 771);
|
||||||
GL11.glBindTexture(3553, var82.minecraft.textureManager.load("/rain.png"));
|
new TextureLocation("/rain.png").bindTexture();
|
||||||
|
|
||||||
for(var110 = var104 - 5; var110 <= var104 + 5; ++var110) {
|
for(var110 = var104 - 5; var110 <= var104 + 5; ++var110) {
|
||||||
for(var122 = var114 - 5; var122 <= var114 + 5; ++var122) {
|
for(var122 = var114 - 5; var122 <= var114 + 5; ++var122) {
|
||||||
|
@ -749,7 +743,7 @@ public final class Minecraft implements Runnable {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(var82.entity != null) {
|
if(var82.entity != null) {
|
||||||
var82.entity.renderHover(var82.minecraft.textureManager, var80);
|
var82.entity.renderHover(var80);
|
||||||
}
|
}
|
||||||
|
|
||||||
GL11.glClear(256);
|
GL11.glClear(256);
|
||||||
|
@ -793,10 +787,10 @@ public final class Minecraft implements Runnable {
|
||||||
var34 = 0.4F;
|
var34 = 0.4F;
|
||||||
GL11.glScalef(0.4F, var34, var34);
|
GL11.glScalef(0.4F, var34, var34);
|
||||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||||
GL11.glBindTexture(3553, var112.minecraft.textureManager.load("/terrain.png"));
|
new TextureLocation("/terrain.png").bindTexture();
|
||||||
var112.block.renderPreview(var123);
|
var112.block.renderPreview(var123);
|
||||||
} else {
|
} else {
|
||||||
var116.bindTexture(var112.minecraft.textureManager);
|
var116.bindTexture();
|
||||||
GL11.glScalef(1.0F, -1.0F, -1.0F);
|
GL11.glScalef(1.0F, -1.0F, -1.0F);
|
||||||
GL11.glTranslatef(0.0F, 0.2F, 0.0F);
|
GL11.glTranslatef(0.0F, 0.2F, 0.0F);
|
||||||
GL11.glRotatef(-120.0F, 0.0F, 0.0F, 1.0F);
|
GL11.glRotatef(-120.0F, 0.0F, 0.0F, 1.0F);
|
||||||
|
@ -988,18 +982,19 @@ public final class Minecraft implements Runnable {
|
||||||
++((ChatLine)var17.chat.get(var16)).time;
|
++((ChatLine)var17.chat.get(var16)).time;
|
||||||
}
|
}
|
||||||
|
|
||||||
GL11.glBindTexture(3553, this.textureManager.load("/terrain.png"));
|
new TextureLocation("/terrain.png").bindTexture();
|
||||||
TextureManager var19 = this.textureManager;
|
|
||||||
|
//TODO: Write a system for block animations
|
||||||
|
|
||||||
for(var16 = 0; var16 < var19.animations.size(); ++var16) {
|
// for(var16 = 0; var16 < var19.animations.size(); ++var16) {
|
||||||
TextureFX var3;
|
// TextureFX var3;
|
||||||
(var3 = (TextureFX)var19.animations.get(var16)).anaglyph = var19.settings.anaglyph;
|
// (var3 = (TextureFX)var19.animations.get(var16)).anaglyph = var19.settings.anaglyph;
|
||||||
var3.animate();
|
// var3.animate();
|
||||||
var19.textureBuffer.clear();
|
// var19.textureBuffer.clear();
|
||||||
var19.textureBuffer.put(var3.textureData);
|
// var19.textureBuffer.put(var3.textureData);
|
||||||
var19.textureBuffer.position(0).limit(var3.textureData.length);
|
// var19.textureBuffer.position(0).limit(var3.textureData.length);
|
||||||
GL11.glTexSubImage2D(3553, 0, var3.textureId % 16 << 4, var3.textureId / 16 << 4, 16, 16, 6408, 5121, var19.textureBuffer);
|
// GL11.glTexSubImage2D(3553, 0, var3.textureId % 16 << 4, var3.textureId / 16 << 4, 16, 16, 6408, 5121, var19.textureBuffer);
|
||||||
}
|
// }
|
||||||
|
|
||||||
int var4;
|
int var4;
|
||||||
int var8;
|
int var8;
|
||||||
|
|
|
@ -3,6 +3,8 @@ package com.mojang.minecraft;
|
||||||
import com.mojang.minecraft.Minecraft;
|
import com.mojang.minecraft.Minecraft;
|
||||||
import com.mojang.minecraft.StopGameException;
|
import com.mojang.minecraft.StopGameException;
|
||||||
import com.mojang.minecraft.render.ShapeRenderer;
|
import com.mojang.minecraft.render.ShapeRenderer;
|
||||||
|
import com.mojang.minecraft.render.TextureLocation;
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
public final class ProgressBarDisplay {
|
public final class ProgressBarDisplay {
|
||||||
|
@ -54,8 +56,7 @@ public final class ProgressBarDisplay {
|
||||||
int var5 = this.minecraft.height * 240 / this.minecraft.height;
|
int var5 = this.minecraft.height * 240 / this.minecraft.height;
|
||||||
GL11.glClear(16640);
|
GL11.glClear(16640);
|
||||||
ShapeRenderer var6 = ShapeRenderer.instance;
|
ShapeRenderer var6 = ShapeRenderer.instance;
|
||||||
int var7 = this.minecraft.textureManager.load("/dirt.png");
|
int var7 = new TextureLocation("/dirt.png").bindTexture();
|
||||||
GL11.glBindTexture(3553, var7);
|
|
||||||
float var10 = 32.0F;
|
float var10 = 32.0F;
|
||||||
var6.begin();
|
var6.begin();
|
||||||
var6.color(4210752);
|
var6.color(4210752);
|
||||||
|
@ -83,8 +84,8 @@ public final class ProgressBarDisplay {
|
||||||
GL11.glEnable(3553);
|
GL11.glEnable(3553);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.minecraft.fontRenderer.render(this.title, (var4 - this.minecraft.fontRenderer.getWidth(this.title)) / 2, var5 / 2 - 4 - 16, 16777215);
|
this.minecraft.fontRenderer.drawString(this.title, (var4 - this.minecraft.fontRenderer.getStringWidth(this.title)) / 2, var5 / 2 - 4 - 16, 16777215);
|
||||||
this.minecraft.fontRenderer.render(this.text, (var4 - this.minecraft.fontRenderer.getWidth(this.text)) / 2, var5 / 2 - 4 + 8, 16777215);
|
this.minecraft.fontRenderer.drawString(this.text, (var4 - this.minecraft.fontRenderer.getStringWidth(this.text)) / 2, var5 / 2 - 4 + 8, 16777215);
|
||||||
GL11.updateDisplay();
|
GL11.updateDisplay();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -1,51 +0,0 @@
|
||||||
package com.mojang.minecraft;
|
|
||||||
|
|
||||||
import com.mojang.minecraft.player.Player;
|
|
||||||
import java.net.HttpURLConnection;
|
|
||||||
import java.net.URL;
|
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
|
|
||||||
public class SkinDownloadThread extends Thread
|
|
||||||
{
|
|
||||||
public SkinDownloadThread(Minecraft minecraft)
|
|
||||||
{
|
|
||||||
super();
|
|
||||||
|
|
||||||
this.minecraft = minecraft;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
if(minecraft.session != null)
|
|
||||||
{
|
|
||||||
HttpURLConnection connection = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
connection = (HttpURLConnection)new URL("http://www.minecraft.net/skin/" + minecraft.session.username + ".png").openConnection();
|
|
||||||
|
|
||||||
connection.setDoInput(true);
|
|
||||||
connection.setDoOutput(false);
|
|
||||||
|
|
||||||
connection.connect();
|
|
||||||
|
|
||||||
if(connection.getResponseCode() != 404)
|
|
||||||
{
|
|
||||||
Player.newTexture = ImageIO.read(connection.getInputStream());
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} catch (Exception var4) {
|
|
||||||
var4.printStackTrace();
|
|
||||||
} finally {
|
|
||||||
if(connection != null)
|
|
||||||
{
|
|
||||||
connection.disconnect();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Minecraft minecraft;
|
|
||||||
}
|
|
|
@ -4,7 +4,7 @@ import com.mojang.minecraft.SessionData;
|
||||||
import com.mojang.minecraft.gui.GuiScreen;
|
import com.mojang.minecraft.gui.GuiScreen;
|
||||||
import com.mojang.minecraft.level.tile.Block;
|
import com.mojang.minecraft.level.tile.Block;
|
||||||
import com.mojang.minecraft.render.ShapeRenderer;
|
import com.mojang.minecraft.render.ShapeRenderer;
|
||||||
import com.mojang.minecraft.render.TextureManager;
|
import com.mojang.minecraft.render.TextureLocation;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
public final class BlockSelectScreen extends GuiScreen {
|
public final class BlockSelectScreen extends GuiScreen {
|
||||||
|
@ -35,9 +35,8 @@ public final class BlockSelectScreen extends GuiScreen {
|
||||||
}
|
}
|
||||||
|
|
||||||
drawCenteredString(this.fontRenderer, "Select block", this.width / 2, 40, 16777215);
|
drawCenteredString(this.fontRenderer, "Select block", this.width / 2, 40, 16777215);
|
||||||
TextureManager var7 = this.minecraft.textureManager;
|
|
||||||
ShapeRenderer var8 = ShapeRenderer.instance;
|
ShapeRenderer var8 = ShapeRenderer.instance;
|
||||||
var2 = var7.load("/terrain.png");
|
var2 = new TextureLocation("/terrain.png").bindTexture();
|
||||||
GL11.glBindTexture(3553, var2);
|
GL11.glBindTexture(3553, var2);
|
||||||
|
|
||||||
for(var2 = 0; var2 < SessionData.allowedBlocks.size(); ++var2) {
|
for(var2 = 0; var2 < SessionData.allowedBlocks.size(); ++var2) {
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
package com.mojang.minecraft.gui;
|
||||||
|
|
||||||
|
public class FontAllowedCharacters {
|
||||||
|
|
||||||
|
public static int isAllowed(char c) {
|
||||||
|
int cc = (int) c;
|
||||||
|
for(int i = 0; i < allowedChars.length; ++i) {
|
||||||
|
if(cc == allowedChars[i]) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final int[] allowedChars = new int[]{
|
||||||
|
32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,
|
||||||
|
59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,
|
||||||
|
86,87,88,89,90,91,92,93,94,95,39,97,98,99,100,101,102,103,104,105,106,107,108,109,
|
||||||
|
110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,8962,199,252,
|
||||||
|
233,226,228,224,229,231,234,235,232,239,238,236,196,197,201,230,198,244,246,242,
|
||||||
|
251,249,255,214,220,248,163,216,215,402,225,237,243,250,241,209,170,186,191,174,
|
||||||
|
172,189,188,161,171,187
|
||||||
|
};
|
||||||
|
|
||||||
|
public static final char field_22286_b[] = { '/', '\n', '\r', '\t', '\0', '\f', '`', '?', '*', '\\', '<', '>', '|', '"', ':' };
|
||||||
|
|
||||||
|
}
|
|
@ -1,158 +1,178 @@
|
||||||
package com.mojang.minecraft.gui;
|
package com.mojang.minecraft.gui;
|
||||||
|
|
||||||
import com.mojang.minecraft.GameSettings;
|
import java.nio.IntBuffer;
|
||||||
import com.mojang.minecraft.render.ShapeRenderer;
|
|
||||||
import com.mojang.minecraft.render.TextureManager;
|
|
||||||
import java.awt.image.BufferedImage;
|
|
||||||
import java.io.IOException;
|
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
public final class FontRenderer {
|
import com.mojang.minecraft.GameSettings;
|
||||||
|
import com.mojang.minecraft.render.RenderEngine;
|
||||||
|
import net.lax1dude.eaglercraft.EaglerImage;
|
||||||
|
import net.lax1dude.eaglercraft.GLAllocation;
|
||||||
|
import net.lax1dude.eaglercraft.adapter.Tessellator;
|
||||||
|
|
||||||
private int[] widthmap = new int[256];
|
public class FontRenderer {
|
||||||
private int fontTexture = 0;
|
|
||||||
private GameSettings settings;
|
|
||||||
|
|
||||||
|
public FontRenderer(GameSettings gamesettings, String s) {
|
||||||
|
RenderEngine r = new RenderEngine();
|
||||||
|
charWidth = new int[256];
|
||||||
|
fontTextureName = 0;
|
||||||
|
EaglerImage bufferedimage = GL11.loadPNG(GL11.loadResourceBytes(s));
|
||||||
|
int i = bufferedimage.w;
|
||||||
|
int j = bufferedimage.h;
|
||||||
|
int ai[] = bufferedimage.data;
|
||||||
|
for (int k = 0; k < 256; k++) {
|
||||||
|
int l = k % 16;
|
||||||
|
int k1 = k / 16;
|
||||||
|
int j2 = 7;
|
||||||
|
do {
|
||||||
|
if (j2 < 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
int i3 = l * 8 + j2;
|
||||||
|
boolean flag = true;
|
||||||
|
for (int l3 = 0; l3 < 8 && flag; l3++) {
|
||||||
|
int i4 = (k1 * 8 + l3) * i;
|
||||||
|
int k4 = ai[i3 + i4] & 0xff;
|
||||||
|
if (k4 > 0) {
|
||||||
|
flag = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public FontRenderer(GameSettings var1, String var2, TextureManager var3) {
|
if (!flag) {
|
||||||
this.settings = var1;
|
break;
|
||||||
|
}
|
||||||
|
j2--;
|
||||||
|
} while (true);
|
||||||
|
if (k == 32) {
|
||||||
|
j2 = 2;
|
||||||
|
}
|
||||||
|
charWidth[k] = j2 + 2;
|
||||||
|
}
|
||||||
|
|
||||||
BufferedImage var14;
|
fontTextureName = r.allocateAndSetupTexture(bufferedimage);
|
||||||
try {
|
fontDisplayLists = GLAllocation.generateDisplayLists(288);
|
||||||
var14 = ImageIO.read(TextureManager.class.getResourceAsStream(var2));
|
Tessellator tessellator = Tessellator.instance;
|
||||||
} catch (IOException var13) {
|
for (int i1 = 0; i1 < 256; i1++) {
|
||||||
throw new RuntimeException(var13);
|
GL11.glNewList(fontDisplayLists + i1, 4864 /* GL_COMPILE */);
|
||||||
}
|
tessellator.startDrawingQuads();
|
||||||
|
int l1 = (i1 % 16) * 8;
|
||||||
|
int k2 = (i1 / 16) * 8;
|
||||||
|
float f = 7.99F;
|
||||||
|
float f1 = 0.0F;
|
||||||
|
float f2 = 0.0F;
|
||||||
|
tessellator.addVertexWithUV(0.0D, 0.0F + f, 0.0D, (float) l1 / 128F + f1, ((float) k2 + f) / 128F + f2);
|
||||||
|
tessellator.addVertexWithUV(0.0F + f, 0.0F + f, 0.0D, ((float) l1 + f) / 128F + f1,
|
||||||
|
((float) k2 + f) / 128F + f2);
|
||||||
|
tessellator.addVertexWithUV(0.0F + f, 0.0D, 0.0D, ((float) l1 + f) / 128F + f1, (float) k2 / 128F + f2);
|
||||||
|
tessellator.addVertexWithUV(0.0D, 0.0D, 0.0D, (float) l1 / 128F + f1, (float) k2 / 128F + f2);
|
||||||
|
tessellator.draw();
|
||||||
|
GL11.glEndList();
|
||||||
|
}
|
||||||
|
|
||||||
int var4 = var14.getWidth();
|
for (int j1 = 0; j1 < 32; j1++) {
|
||||||
int var5 = var14.getHeight();
|
int i2 = (j1 >> 3 & 1) * 85;
|
||||||
int[] var6 = new int[var4 * var5];
|
int l2 = (j1 >> 2 & 1) * 170 + i2;
|
||||||
var14.getRGB(0, 0, var4, var5, var6, 0, var4);
|
int j3 = (j1 >> 1 & 1) * 170 + i2;
|
||||||
|
int k3 = (j1 >> 0 & 1) * 170 + i2;
|
||||||
|
if (j1 == 6) {
|
||||||
|
l2 += 85;
|
||||||
|
}
|
||||||
|
boolean flag1 = j1 >= 16;
|
||||||
|
if (gamesettings.anaglyph) {
|
||||||
|
int j4 = (l2 * 30 + j3 * 59 + k3 * 11) / 100;
|
||||||
|
int l4 = (l2 * 30 + j3 * 70) / 100;
|
||||||
|
int i5 = (l2 * 30 + k3 * 70) / 100;
|
||||||
|
l2 = j4;
|
||||||
|
j3 = l4;
|
||||||
|
k3 = i5;
|
||||||
|
}
|
||||||
|
if (flag1) {
|
||||||
|
l2 /= 4;
|
||||||
|
j3 /= 4;
|
||||||
|
k3 /= 4;
|
||||||
|
}
|
||||||
|
GL11.glNewList(fontDisplayLists + 256 + j1, 4864 /* GL_COMPILE */);
|
||||||
|
GL11.glColor3f((float) l2 / 255F, (float) j3 / 255F, (float) k3 / 255F);
|
||||||
|
GL11.glEndList();
|
||||||
|
}
|
||||||
|
|
||||||
for(int var15 = 0; var15 < 128; ++var15) {
|
}
|
||||||
var5 = var15 % 16;
|
|
||||||
int var7 = var15 / 16;
|
|
||||||
int var8 = 0;
|
|
||||||
|
|
||||||
for(boolean var9 = false; var8 < 8 && !var9; ++var8) {
|
public void drawStringWithShadow(String s, int i, int j, int k) {
|
||||||
int var10 = (var5 << 3) + var8;
|
renderString(s, i + 1, j + 1, k, true);
|
||||||
var9 = true;
|
drawString(s, i, j, k);
|
||||||
|
}
|
||||||
|
|
||||||
for(int var11 = 0; var11 < 8 && var9; ++var11) {
|
public void drawString(String s, int i, int j, int k) {
|
||||||
int var12 = ((var7 << 3) + var11) * var4;
|
renderString(s, i, j, k, false);
|
||||||
if((var6[var10 + var12] & 255) > 128) {
|
}
|
||||||
var9 = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(var15 == 32) {
|
public void renderString(String s, int i, int j, int k, boolean flag) {
|
||||||
var8 = 4;
|
if (s == null) {
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
if (flag) {
|
||||||
|
int l = k & 0xff000000;
|
||||||
|
k = (k & 0xfcfcfc) >> 2;
|
||||||
|
k += l;
|
||||||
|
}
|
||||||
|
GL11.glBindTexture(3553 /* GL_TEXTURE_2D */, fontTextureName);
|
||||||
|
float f = (float) (k >> 16 & 0xff) / 255F;
|
||||||
|
float f1 = (float) (k >> 8 & 0xff) / 255F;
|
||||||
|
float f2 = (float) (k & 0xff) / 255F;
|
||||||
|
float f3 = (float) (k >> 24 & 0xff) / 255F;
|
||||||
|
if (f3 == 0.0F) {
|
||||||
|
f3 = 1.0F;
|
||||||
|
}
|
||||||
|
GL11.glColor4f(f, f1, f2, f3);
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
GL11.glTranslatef(i, j, 0.0F);
|
||||||
|
for (int i1 = 0; i1 < s.length(); i1++) {
|
||||||
|
for (; s.length() > i1 + 1 && s.charAt(i1) == '\247'; i1 += 2) {
|
||||||
|
int j1 = "0123456789abcdef".indexOf(s.toLowerCase().charAt(i1 + 1));
|
||||||
|
if (j1 < 0 || j1 > 15) {
|
||||||
|
j1 = 15;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
//EaglerAdapter.glCallList(fontDisplayLists + 256 + j1 + (flag ? 16 : 0));
|
||||||
|
//EaglerAdapter.glTranslatef(charWidth[256 + j1 + (flag ? 16 : 0)] * 0.5f, 0.0F, 0.0F);
|
||||||
|
}
|
||||||
|
|
||||||
this.widthmap[var15] = var8;
|
if (i1 < s.length()) {
|
||||||
}
|
int k1 = FontAllowedCharacters.isAllowed(s.charAt(i1));
|
||||||
|
if (k1 >= 0) {
|
||||||
|
GL11.glCallList(fontDisplayLists + k1 + 32);
|
||||||
|
GL11.glTranslatef(charWidth[k1 + 32], 0.0F, 0.0F);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
this.fontTexture = var3.load(var2);
|
public int getStringWidth(String s) {
|
||||||
}
|
if (s == null) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
int i = 0;
|
||||||
|
for (int j = 0; j < s.length(); j++) {
|
||||||
|
if (s.charAt(j) == '\247') {
|
||||||
|
j++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
int k = FontAllowedCharacters.isAllowed(s.charAt(j));
|
||||||
|
if (k >= 0) {
|
||||||
|
i += charWidth[k + 32];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public final void render(String var1, int var2, int var3, int var4) {
|
return i;
|
||||||
this.render(var1, var2 + 1, var3 + 1, var4, true);
|
}
|
||||||
this.renderNoShadow(var1, var2, var3, var4);
|
|
||||||
}
|
|
||||||
|
|
||||||
public final void renderNoShadow(String var1, int var2, int var3, int var4) {
|
private int charWidth[];
|
||||||
this.render(var1, var2, var3, var4, false);
|
public int fontTextureName;
|
||||||
}
|
private int fontDisplayLists;
|
||||||
|
private IntBuffer buffer;
|
||||||
private void render(String var1, int var2, int var3, int var4, boolean var5) {
|
|
||||||
if(var1 != null) {
|
public static final char formatChar = '\247';
|
||||||
char[] var12 = var1.toCharArray();
|
}
|
||||||
if(var5) {
|
|
||||||
var4 = (var4 & 16579836) >> 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
GL11.glBindTexture(3553, this.fontTexture);
|
|
||||||
ShapeRenderer var6 = ShapeRenderer.instance;
|
|
||||||
ShapeRenderer.instance.begin();
|
|
||||||
var6.color(var4);
|
|
||||||
int var7 = 0;
|
|
||||||
|
|
||||||
for(int var8 = 0; var8 < var12.length; ++var8) {
|
|
||||||
int var9;
|
|
||||||
if(var12[var8] == 38 && var12.length > var8 + 1) {
|
|
||||||
if((var4 = "0123456789abcdef".indexOf(var12[var8 + 1])) < 0) {
|
|
||||||
var4 = 15;
|
|
||||||
}
|
|
||||||
|
|
||||||
var9 = (var4 & 8) << 3;
|
|
||||||
int var10 = (var4 & 1) * 191 + var9;
|
|
||||||
int var11 = ((var4 & 2) >> 1) * 191 + var9;
|
|
||||||
var4 = ((var4 & 4) >> 2) * 191 + var9;
|
|
||||||
if(this.settings.anaglyph) {
|
|
||||||
var9 = (var4 * 30 + var11 * 59 + var10 * 11) / 100;
|
|
||||||
var11 = (var4 * 30 + var11 * 70) / 100;
|
|
||||||
var10 = (var4 * 30 + var10 * 70) / 100;
|
|
||||||
var4 = var9;
|
|
||||||
var11 = var11;
|
|
||||||
var10 = var10;
|
|
||||||
}
|
|
||||||
|
|
||||||
var4 = var4 << 16 | var11 << 8 | var10;
|
|
||||||
var8 += 2;
|
|
||||||
if(var5) {
|
|
||||||
var4 = (var4 & 16579836) >> 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
var6.color(var4);
|
|
||||||
}
|
|
||||||
|
|
||||||
var4 = var12[var8] % 16 << 3;
|
|
||||||
var9 = var12[var8] / 16 << 3;
|
|
||||||
float var13 = 7.99F;
|
|
||||||
var6.vertexUV((float)(var2 + var7), (float)var3 + var13, 0.0F, (float)var4 / 128.0F, ((float)var9 + var13) / 128.0F);
|
|
||||||
var6.vertexUV((float)(var2 + var7) + var13, (float)var3 + var13, 0.0F, ((float)var4 + var13) / 128.0F, ((float)var9 + var13) / 128.0F);
|
|
||||||
var6.vertexUV((float)(var2 + var7) + var13, (float)var3, 0.0F, ((float)var4 + var13) / 128.0F, (float)var9 / 128.0F);
|
|
||||||
var6.vertexUV((float)(var2 + var7), (float)var3, 0.0F, (float)var4 / 128.0F, (float)var9 / 128.0F);
|
|
||||||
var7 += this.widthmap[var12[var8]];
|
|
||||||
}
|
|
||||||
|
|
||||||
var6.end();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public final int getWidth(String var1) {
|
|
||||||
if(var1 == null) {
|
|
||||||
return 0;
|
|
||||||
} else {
|
|
||||||
char[] var4 = var1.toCharArray();
|
|
||||||
int var2 = 0;
|
|
||||||
|
|
||||||
for(int var3 = 0; var3 < var4.length; ++var3) {
|
|
||||||
if(var4[var3] == 38) {
|
|
||||||
++var3;
|
|
||||||
} else {
|
|
||||||
var2 += this.widthmap[var4[var3]];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return var2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String stripColor(String var0) {
|
|
||||||
char[] var3 = var0.toCharArray();
|
|
||||||
String var1 = "";
|
|
||||||
|
|
||||||
for(int var2 = 0; var2 < var3.length; ++var2) {
|
|
||||||
if(var3[var2] == 38) {
|
|
||||||
++var2;
|
|
||||||
} else {
|
|
||||||
var1 = var1 + var3[var2];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return var1;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -4,6 +4,8 @@ import com.mojang.minecraft.Minecraft;
|
||||||
import com.mojang.minecraft.gui.Button;
|
import com.mojang.minecraft.gui.Button;
|
||||||
import com.mojang.minecraft.gui.FontRenderer;
|
import com.mojang.minecraft.gui.FontRenderer;
|
||||||
import com.mojang.minecraft.gui.Screen;
|
import com.mojang.minecraft.gui.Screen;
|
||||||
|
import com.mojang.minecraft.render.TextureLocation;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
@ -25,7 +27,7 @@ public class GuiScreen extends Screen {
|
||||||
Button var4 = var10000;
|
Button var4 = var10000;
|
||||||
if(var10000.visible) {
|
if(var10000.visible) {
|
||||||
FontRenderer var8 = var7.fontRenderer;
|
FontRenderer var8 = var7.fontRenderer;
|
||||||
GL11.glBindTexture(3553, var7.textureManager.load("/gui/gui.png"));
|
new TextureLocation("/gui/gui.png").bindTexture();
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
byte var9 = 1;
|
byte var9 = 1;
|
||||||
boolean var6 = var1 >= var4.x && var2 >= var4.y && var1 < var4.x + var4.width && var2 < var4.y + var4.height;
|
boolean var6 = var1 >= var4.x && var2 >= var4.y && var1 < var4.x + var4.width && var2 < var4.y + var4.height;
|
||||||
|
|
|
@ -3,13 +3,10 @@ package com.mojang.minecraft.gui;
|
||||||
import com.mojang.minecraft.ChatLine;
|
import com.mojang.minecraft.ChatLine;
|
||||||
import com.mojang.minecraft.Minecraft;
|
import com.mojang.minecraft.Minecraft;
|
||||||
import com.mojang.minecraft.gamemode.SurvivalGameMode;
|
import com.mojang.minecraft.gamemode.SurvivalGameMode;
|
||||||
import com.mojang.minecraft.gui.ChatInputScreen;
|
|
||||||
import com.mojang.minecraft.gui.FontRenderer;
|
|
||||||
import com.mojang.minecraft.gui.Screen;
|
|
||||||
import com.mojang.minecraft.level.tile.Block;
|
import com.mojang.minecraft.level.tile.Block;
|
||||||
import com.mojang.minecraft.player.Inventory;
|
import com.mojang.minecraft.player.Inventory;
|
||||||
import com.mojang.minecraft.render.ShapeRenderer;
|
import com.mojang.minecraft.render.ShapeRenderer;
|
||||||
import com.mojang.minecraft.render.TextureManager;
|
import com.mojang.minecraft.render.TextureLocation;
|
||||||
import net.PeytonPlayz585.math.MathHelper;
|
import net.PeytonPlayz585.math.MathHelper;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -18,7 +15,7 @@ import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
public final class HUDScreen extends Screen {
|
public final class HUDScreen extends Screen {
|
||||||
|
|
||||||
public List chat = new ArrayList();
|
public List<ChatLine> chat = new ArrayList<ChatLine>();
|
||||||
private Random random = new Random();
|
private Random random = new Random();
|
||||||
private Minecraft mc;
|
private Minecraft mc;
|
||||||
private int width;
|
private int width;
|
||||||
|
@ -36,8 +33,7 @@ public final class HUDScreen extends Screen {
|
||||||
public final void render(float var1, boolean var2, int var3, int var4) {
|
public final void render(float var1, boolean var2, int var3, int var4) {
|
||||||
FontRenderer var5 = this.mc.fontRenderer;
|
FontRenderer var5 = this.mc.fontRenderer;
|
||||||
this.mc.renderer.enableGuiMode();
|
this.mc.renderer.enableGuiMode();
|
||||||
TextureManager var6 = this.mc.textureManager;
|
new TextureLocation("/gui/gui.png.png").bindTexture();
|
||||||
GL11.glBindTexture(3553, this.mc.textureManager.load("/gui/gui.png"));
|
|
||||||
ShapeRenderer var7 = ShapeRenderer.instance;
|
ShapeRenderer var7 = ShapeRenderer.instance;
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
GL11.glEnable(3042);
|
GL11.glEnable(3042);
|
||||||
|
@ -45,7 +41,7 @@ public final class HUDScreen extends Screen {
|
||||||
this.imgZ = -90.0F;
|
this.imgZ = -90.0F;
|
||||||
this.drawImage(this.width / 2 - 91, this.height - 22, 0, 0, 182, 22);
|
this.drawImage(this.width / 2 - 91, this.height - 22, 0, 0, 182, 22);
|
||||||
this.drawImage(this.width / 2 - 91 - 1 + var8.selected * 20, this.height - 22 - 1, 0, 22, 24, 22);
|
this.drawImage(this.width / 2 - 91 - 1 + var8.selected * 20, this.height - 22 - 1, 0, 22, 24, 22);
|
||||||
GL11.glBindTexture(3553, this.mc.textureManager.load("/gui/icons.png"));
|
new TextureLocation("/gui/icons.png").bindTexture();
|
||||||
this.drawImage(this.width / 2 - 7, this.height / 2 - 7, 0, 0, 16, 16);
|
this.drawImage(this.width / 2 - 7, this.height / 2 - 7, 0, 0, 16, 16);
|
||||||
boolean var9 = this.mc.player.invulnerableTime / 3 % 2 == 1;
|
boolean var9 = this.mc.player.invulnerableTime / 3 % 2 == 1;
|
||||||
if(this.mc.player.invulnerableTime < 10) {
|
if(this.mc.player.invulnerableTime < 10) {
|
||||||
|
@ -131,28 +127,27 @@ public final class HUDScreen extends Screen {
|
||||||
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
|
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
|
||||||
GL11.glTranslatef(-1.5F, 0.5F, 0.5F);
|
GL11.glTranslatef(-1.5F, 0.5F, 0.5F);
|
||||||
GL11.glScalef(-1.0F, -1.0F, -1.0F);
|
GL11.glScalef(-1.0F, -1.0F, -1.0F);
|
||||||
int var20 = var6.load("/terrain.png");
|
new TextureLocation("/terrain.png").bindTexture();
|
||||||
GL11.glBindTexture(3553, var20);
|
|
||||||
var7.begin();
|
var7.begin();
|
||||||
Block.blocks[var15].renderFullbright(var7);
|
Block.blocks[var15].renderFullbright(var7);
|
||||||
var7.end();
|
var7.end();
|
||||||
GL11.glPopMatrix();
|
GL11.glPopMatrix();
|
||||||
if(var8.count[var12] > 1) {
|
if(var8.count[var12] > 1) {
|
||||||
var23 = "" + var8.count[var12];
|
var23 = "" + var8.count[var12];
|
||||||
var5.render(var23, var26 + 19 - var5.getWidth(var23), var14 + 6, 16777215);
|
var5.drawString(var23, var26 + 19 - var5.getStringWidth(var23), var14 + 6, 16777215);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var5.render("0.30", 2, 2, 16777215);
|
var5.drawString("Minecraft Classic (Modified) Webport", 2, 2, 16777215);
|
||||||
if(this.mc.settings.showFrameRate) {
|
if(this.mc.settings.showFrameRate) {
|
||||||
var5.render(this.mc.debug, 2, 12, 16777215);
|
var5.drawString(this.mc.debug, 2, 12, 16777215);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.mc.gamemode instanceof SurvivalGameMode) {
|
if(this.mc.gamemode instanceof SurvivalGameMode) {
|
||||||
String var24 = "Score: &e" + this.mc.player.getScore();
|
String var24 = "Score: &e" + this.mc.player.getScore();
|
||||||
var5.render(var24, this.width - var5.getWidth(var24) - 2, 2, 16777215);
|
var5.drawString(var24, this.width - var5.getStringWidth(var24) - 2, 2, 16777215);
|
||||||
var5.render("Arrows: " + this.mc.player.arrows, this.width / 2 + 8, this.height - 33, 16777215);
|
var5.drawString("Arrows: " + this.mc.player.arrows, this.width / 2 + 8, this.height - 33, 16777215);
|
||||||
}
|
}
|
||||||
|
|
||||||
byte var25 = 10;
|
byte var25 = 10;
|
||||||
|
@ -164,7 +159,7 @@ public final class HUDScreen extends Screen {
|
||||||
|
|
||||||
for(var14 = 0; var14 < this.chat.size() && var14 < var25; ++var14) {
|
for(var14 = 0; var14 < this.chat.size() && var14 < var25; ++var14) {
|
||||||
if(((ChatLine)this.chat.get(var14)).time < 200 || var27) {
|
if(((ChatLine)this.chat.get(var14)).time < 200 || var27) {
|
||||||
var5.render(((ChatLine)this.chat.get(var14)).message, 2, this.height - 8 - var14 * 9 - 20, 16777215);
|
var5.drawString(((ChatLine)this.chat.get(var14)).message, 2, this.height - 8 - var14 * 9 - 20, 16777215);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,11 +56,11 @@ public class Screen {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void drawCenteredString(FontRenderer var0, String var1, int var2, int var3, int var4) {
|
public static void drawCenteredString(FontRenderer var0, String var1, int var2, int var3, int var4) {
|
||||||
var0.render(var1, var2 - var0.getWidth(var1) / 2, var3, var4);
|
var0.drawString(var1, var2 - var0.getStringWidth(var1) / 2, var3, var4);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void drawString(FontRenderer var0, String var1, int var2, int var3, int var4) {
|
public static void drawString(FontRenderer var0, String var1, int var2, int var3, int var4) {
|
||||||
var0.render(var1, var2, var3, var4);
|
var0.drawString(var1, var2, var3, var4);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void drawImage(int var1, int var2, int var3, int var4, int var5, int var6) {
|
public final void drawImage(int var1, int var2, int var3, int var4, int var5, int var6) {
|
||||||
|
|
|
@ -5,7 +5,7 @@ import com.mojang.minecraft.level.Level;
|
||||||
import com.mojang.minecraft.phys.AABB;
|
import com.mojang.minecraft.phys.AABB;
|
||||||
import com.mojang.minecraft.player.Player;
|
import com.mojang.minecraft.player.Player;
|
||||||
import com.mojang.minecraft.render.ShapeRenderer;
|
import com.mojang.minecraft.render.ShapeRenderer;
|
||||||
import com.mojang.minecraft.render.TextureManager;
|
import com.mojang.minecraft.render.TextureLocation;
|
||||||
import net.PeytonPlayz585.math.MathHelper;
|
import net.PeytonPlayz585.math.MathHelper;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
@ -176,11 +176,9 @@ public class Arrow extends Entity
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(TextureManager textureManager, float unknown0)
|
public void render(float unknown0)
|
||||||
{
|
{
|
||||||
textureId = textureManager.load("/item/arrows.png");
|
textureId = new TextureLocation("/item/arrows.png").bindTexture();
|
||||||
|
|
||||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureId);
|
|
||||||
|
|
||||||
float brightness = level.getBrightness((int)x, (int)y, (int)z);
|
float brightness = level.getBrightness((int)x, (int)y, (int)z);
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import com.mojang.minecraft.Entity;
|
||||||
import com.mojang.minecraft.level.Level;
|
import com.mojang.minecraft.level.Level;
|
||||||
import com.mojang.minecraft.level.tile.Block;
|
import com.mojang.minecraft.level.tile.Block;
|
||||||
import com.mojang.minecraft.player.Player;
|
import com.mojang.minecraft.player.Player;
|
||||||
import com.mojang.minecraft.render.TextureManager;
|
import com.mojang.minecraft.render.TextureLocation;
|
||||||
import net.PeytonPlayz585.math.MathHelper;
|
import net.PeytonPlayz585.math.MathHelper;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
@ -64,11 +64,9 @@ public class Item extends Entity
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(TextureManager textureManager, float unknown0)
|
public void render(float unknown0)
|
||||||
{
|
{
|
||||||
textureId = textureManager.load("/terrain.png");
|
textureId = new TextureLocation("/terrain.png").bindTexture();
|
||||||
|
|
||||||
GL11.glBindTexture(3553, this.textureId);
|
|
||||||
|
|
||||||
float brightness = level.getBrightness((int)x, (int)y, (int)z);
|
float brightness = level.getBrightness((int)x, (int)y, (int)z);
|
||||||
float unknown1 = rot + ((float)tickCount + unknown0) * 3.0F;
|
float unknown1 = rot + ((float)tickCount + unknown0) * 3.0F;
|
||||||
|
|
|
@ -7,7 +7,7 @@ import com.mojang.minecraft.particle.SmokeParticle;
|
||||||
import com.mojang.minecraft.particle.TerrainParticle;
|
import com.mojang.minecraft.particle.TerrainParticle;
|
||||||
import com.mojang.minecraft.player.Player;
|
import com.mojang.minecraft.player.Player;
|
||||||
import com.mojang.minecraft.render.ShapeRenderer;
|
import com.mojang.minecraft.render.ShapeRenderer;
|
||||||
import com.mojang.minecraft.render.TextureManager;
|
import com.mojang.minecraft.render.TextureLocation;
|
||||||
import net.PeytonPlayz585.math.MathHelper;
|
import net.PeytonPlayz585.math.MathHelper;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
@ -97,11 +97,9 @@ public class PrimedTnt extends Entity
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(TextureManager textureManager, float unknown0)
|
public void render(float unknown0)
|
||||||
{
|
{
|
||||||
int textureID = textureManager.load("/terrain.png");
|
int textureID = new TextureLocation("/terrain.png").bindTexture();
|
||||||
|
|
||||||
GL11.glBindTexture(3553, textureID);
|
|
||||||
|
|
||||||
float brightness = level.getBrightness((int)x, (int)y, (int)z);
|
float brightness = level.getBrightness((int)x, (int)y, (int)z);
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ package com.mojang.minecraft.item;
|
||||||
|
|
||||||
import com.mojang.minecraft.Entity;
|
import com.mojang.minecraft.Entity;
|
||||||
import com.mojang.minecraft.level.Level;
|
import com.mojang.minecraft.level.Level;
|
||||||
import com.mojang.minecraft.render.TextureManager;
|
|
||||||
|
|
||||||
public class TakeEntityAnim extends Entity
|
public class TakeEntityAnim extends Entity
|
||||||
{
|
{
|
||||||
|
@ -45,9 +44,9 @@ public class TakeEntityAnim extends Entity
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(TextureManager textureManager, float unknown0)
|
public void render(float unknown0)
|
||||||
{
|
{
|
||||||
item.render(textureManager, unknown0);
|
item.render(unknown0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
|
@ -6,7 +6,6 @@ import com.mojang.minecraft.level.SyntheticClass;
|
||||||
import com.mojang.minecraft.model.Vec3D;
|
import com.mojang.minecraft.model.Vec3D;
|
||||||
import com.mojang.minecraft.phys.AABB;
|
import com.mojang.minecraft.phys.AABB;
|
||||||
import com.mojang.minecraft.render.Frustrum;
|
import com.mojang.minecraft.render.Frustrum;
|
||||||
import com.mojang.minecraft.render.TextureManager;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -166,7 +165,7 @@ public class BlockMap implements Serializable {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void render(Vec3D var1, Frustrum var2, TextureManager var3, float var4) {
|
public void render(Vec3D var1, Frustrum var2, float var4) {
|
||||||
for(int var5 = 0; var5 < this.width; ++var5) {
|
for(int var5 = 0; var5 < this.width; ++var5) {
|
||||||
float var6 = (float)((var5 << 4) - 2);
|
float var6 = (float)((var5 << 4) - 2);
|
||||||
float var7 = (float)((var5 + 1 << 4) + 2);
|
float var7 = (float)((var5 + 1 << 4) + 2);
|
||||||
|
@ -252,7 +251,7 @@ public class BlockMap implements Serializable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var22.render(var3, var4);
|
var22.render(var4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import com.mojang.minecraft.level.Level;
|
||||||
import com.mojang.minecraft.mob.Mob;
|
import com.mojang.minecraft.mob.Mob;
|
||||||
import com.mojang.minecraft.model.HumanoidModel;
|
import com.mojang.minecraft.model.HumanoidModel;
|
||||||
import com.mojang.minecraft.model.Model;
|
import com.mojang.minecraft.model.Model;
|
||||||
import com.mojang.minecraft.render.TextureManager;
|
import com.mojang.minecraft.render.TextureLocation;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
public class HumanoidMob extends Mob {
|
public class HumanoidMob extends Mob {
|
||||||
|
@ -20,8 +20,8 @@ public class HumanoidMob extends Mob {
|
||||||
this.setPos(var2, var3, var4);
|
this.setPos(var2, var3, var4);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void renderModel(TextureManager var1, float var2, float var3, float var4, float var5, float var6, float var7) {
|
public void renderModel(float var2, float var3, float var4, float var5, float var6, float var7) {
|
||||||
super.renderModel(var1, var2, var3, var4, var5, var6, var7);
|
super.renderModel(var2, var3, var4, var5, var6, var7);
|
||||||
Model var9 = modelCache.getModel(this.modelName);
|
Model var9 = modelCache.getModel(this.modelName);
|
||||||
GL11.glEnable(3008);
|
GL11.glEnable(3008);
|
||||||
if(this.allowAlpha) {
|
if(this.allowAlpha) {
|
||||||
|
@ -38,7 +38,7 @@ public class HumanoidMob extends Mob {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.armor || this.helmet) {
|
if(this.armor || this.helmet) {
|
||||||
GL11.glBindTexture(3553, var1.load("/armor/plate.png"));
|
new TextureLocation("/armor/plate.png").bindTexture();
|
||||||
GL11.glDisable(2884);
|
GL11.glDisable(2884);
|
||||||
HumanoidModel var8;
|
HumanoidModel var8;
|
||||||
(var8 = (HumanoidModel)modelCache.getModel("humanoid.armor")).head.render = this.helmet;
|
(var8 = (HumanoidModel)modelCache.getModel("humanoid.armor")).head.render = this.helmet;
|
||||||
|
|
|
@ -5,7 +5,9 @@ import com.mojang.minecraft.level.Level;
|
||||||
import com.mojang.minecraft.mob.ai.AI;
|
import com.mojang.minecraft.mob.ai.AI;
|
||||||
import com.mojang.minecraft.mob.ai.BasicAI;
|
import com.mojang.minecraft.mob.ai.BasicAI;
|
||||||
import com.mojang.minecraft.model.ModelManager;
|
import com.mojang.minecraft.model.ModelManager;
|
||||||
import com.mojang.minecraft.render.TextureManager;
|
import com.mojang.minecraft.render.RenderEngine;
|
||||||
|
import com.mojang.minecraft.render.TextureLocation;
|
||||||
|
|
||||||
import net.PeytonPlayz585.math.MathHelper;
|
import net.PeytonPlayz585.math.MathHelper;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
@ -204,12 +206,11 @@ public class Mob extends Entity {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void bindTexture(TextureManager var1) {
|
protected void bindTexture() {
|
||||||
this.textureId = var1.load(this.textureName);
|
this.textureId = new TextureLocation(textureName).bindTexture();
|
||||||
GL11.glBindTexture(3553, this.textureId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void render(TextureManager var1, float var2) {
|
public void render(float var2) {
|
||||||
if(this.modelName != null) {
|
if(this.modelName != null) {
|
||||||
float var3;
|
float var3;
|
||||||
if((var3 = (float)this.attackTime - var2) < 0.0F) {
|
if((var3 = (float)this.attackTime - var2) < 0.0F) {
|
||||||
|
@ -288,14 +289,14 @@ public class Mob extends Entity {
|
||||||
|
|
||||||
GL11.glScalef(-1.0F, 1.0F, 1.0F);
|
GL11.glScalef(-1.0F, 1.0F, 1.0F);
|
||||||
modelCache.getModel(this.modelName).attackOffset = var3 / 5.0F;
|
modelCache.getModel(this.modelName).attackOffset = var3 / 5.0F;
|
||||||
this.bindTexture(var1);
|
this.bindTexture();
|
||||||
this.renderModel(var1, var8, var2, var5, var6, var7, var9);
|
this.renderModel(var8, var2, var5, var6, var7, var9);
|
||||||
if(this.invulnerableTime > this.invulnerableDuration - 10) {
|
if(this.invulnerableTime > this.invulnerableDuration - 10) {
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.75F);
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.75F);
|
||||||
GL11.glEnable(3042);
|
GL11.glEnable(3042);
|
||||||
GL11.glBlendFunc(770, 1);
|
GL11.glBlendFunc(770, 1);
|
||||||
this.bindTexture(var1);
|
this.bindTexture();
|
||||||
this.renderModel(var1, var8, var2, var5, var6, var7, var9);
|
this.renderModel(var8, var2, var5, var6, var7, var9);
|
||||||
GL11.glDisable(3042);
|
GL11.glDisable(3042);
|
||||||
GL11.glBlendFunc(770, 771);
|
GL11.glBlendFunc(770, 771);
|
||||||
}
|
}
|
||||||
|
@ -310,7 +311,7 @@ public class Mob extends Entity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void renderModel(TextureManager var1, float var2, float var3, float var4, float var5, float var6, float var7) {
|
public void renderModel(float var2, float var3, float var4, float var5, float var6, float var7) {
|
||||||
modelCache.getModel(this.modelName).render(var2, var4, (float)this.tickCount + var3, var5, var6, var7);
|
modelCache.getModel(this.modelName).render(var2, var4, (float)this.tickCount + var3, var5, var6, var7);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ import com.mojang.minecraft.mob.QuadrupedMob;
|
||||||
import com.mojang.minecraft.mob.Sheep$1;
|
import com.mojang.minecraft.mob.Sheep$1;
|
||||||
import com.mojang.minecraft.model.AnimalModel;
|
import com.mojang.minecraft.model.AnimalModel;
|
||||||
import com.mojang.minecraft.player.Player;
|
import com.mojang.minecraft.player.Player;
|
||||||
import com.mojang.minecraft.render.TextureManager;
|
import com.mojang.minecraft.render.TextureLocation;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
public class Sheep extends QuadrupedMob {
|
public class Sheep extends QuadrupedMob {
|
||||||
|
@ -78,15 +78,15 @@ public class Sheep extends QuadrupedMob {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void renderModel(TextureManager var1, float var2, float var3, float var4, float var5, float var6, float var7) {
|
public void renderModel(float var2, float var3, float var4, float var5, float var6, float var7) {
|
||||||
AnimalModel var8;
|
AnimalModel var8;
|
||||||
float var9 = (var8 = (AnimalModel)modelCache.getModel(this.modelName)).head.y;
|
float var9 = (var8 = (AnimalModel)modelCache.getModel(this.modelName)).head.y;
|
||||||
float var10 = var8.head.z;
|
float var10 = var8.head.z;
|
||||||
var8.head.y += (this.grazeO + (this.graze - this.grazeO) * var3) * 8.0F;
|
var8.head.y += (this.grazeO + (this.graze - this.grazeO) * var3) * 8.0F;
|
||||||
var8.head.z -= this.grazeO + (this.graze - this.grazeO) * var3;
|
var8.head.z -= this.grazeO + (this.graze - this.grazeO) * var3;
|
||||||
super.renderModel(var1, var2, var3, var4, var5, var6, var7);
|
super.renderModel(var2, var3, var4, var5, var6, var7);
|
||||||
if(this.hasFur) {
|
if(this.hasFur) {
|
||||||
GL11.glBindTexture(3553, var1.load("/mob/sheep_fur.png"));
|
new TextureLocation("/mob/sheep_fur.png").bindTexture();
|
||||||
GL11.glDisable(2884);
|
GL11.glDisable(2884);
|
||||||
AnimalModel var11;
|
AnimalModel var11;
|
||||||
(var11 = (AnimalModel)modelCache.getModel("sheep.fur")).head.yaw = var8.head.yaw;
|
(var11 = (AnimalModel)modelCache.getModel("sheep.fur")).head.yaw = var8.head.yaw;
|
||||||
|
|
|
@ -1,235 +0,0 @@
|
||||||
package com.mojang.minecraft.net;
|
|
||||||
|
|
||||||
import com.mojang.minecraft.Minecraft;
|
|
||||||
import com.mojang.minecraft.gui.FontRenderer;
|
|
||||||
import com.mojang.minecraft.mob.HumanoidMob;
|
|
||||||
import com.mojang.minecraft.net.PositionUpdate;
|
|
||||||
import com.mojang.minecraft.net.SkinDownloadThread;
|
|
||||||
import com.mojang.minecraft.render.TextureManager;
|
|
||||||
import java.awt.image.BufferedImage;
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
import org.lwjgl.opengl.GL11;
|
|
||||||
|
|
||||||
public class NetworkPlayer extends HumanoidMob {
|
|
||||||
|
|
||||||
public static final long serialVersionUID = 77479605454997290L;
|
|
||||||
private List moveQueue = new LinkedList();
|
|
||||||
private Minecraft minecraft;
|
|
||||||
private int xp;
|
|
||||||
private int yp;
|
|
||||||
private int zp;
|
|
||||||
private transient int a = -1;
|
|
||||||
public transient BufferedImage newTexture = null;
|
|
||||||
public String name;
|
|
||||||
public String displayName;
|
|
||||||
int tickCount = 0;
|
|
||||||
private TextureManager textures;
|
|
||||||
|
|
||||||
|
|
||||||
public NetworkPlayer(Minecraft var1, int var2, String var3, int var4, int var5, int var6, float var7, float var8) {
|
|
||||||
super(var1.level, (float)var4, (float)var5, (float)var6);
|
|
||||||
this.minecraft = var1;
|
|
||||||
this.displayName = var3;
|
|
||||||
var3 = FontRenderer.stripColor(var3);
|
|
||||||
this.name = var3;
|
|
||||||
this.xp = var4;
|
|
||||||
this.yp = var5;
|
|
||||||
this.zp = var6;
|
|
||||||
this.heightOffset = 0.0F;
|
|
||||||
this.pushthrough = 0.8F;
|
|
||||||
this.setPos((float)var4 / 32.0F, (float)var5 / 32.0F, (float)var6 / 32.0F);
|
|
||||||
this.xRot = var8;
|
|
||||||
this.yRot = var7;
|
|
||||||
this.armor = this.helmet = false;
|
|
||||||
this.renderOffset = 0.6875F;
|
|
||||||
(new SkinDownloadThread(this)).start();
|
|
||||||
this.allowAlpha = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void aiStep() {
|
|
||||||
int var1 = 5;
|
|
||||||
|
|
||||||
do {
|
|
||||||
if(this.moveQueue.size() > 0) {
|
|
||||||
this.setPos((PositionUpdate)this.moveQueue.remove(0));
|
|
||||||
}
|
|
||||||
} while(var1-- > 0 && this.moveQueue.size() > 10);
|
|
||||||
|
|
||||||
this.onGround = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void bindTexture(TextureManager var1) {
|
|
||||||
this.textures = var1;
|
|
||||||
if(this.newTexture != null) {
|
|
||||||
BufferedImage var2 = this.newTexture;
|
|
||||||
int[] var3 = new int[512];
|
|
||||||
var2.getRGB(32, 0, 32, 16, var3, 0, 32);
|
|
||||||
int var5 = 0;
|
|
||||||
|
|
||||||
boolean var10001;
|
|
||||||
while(true) {
|
|
||||||
if(var5 >= var3.length) {
|
|
||||||
var10001 = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(var3[var5] >>> 24 < 128) {
|
|
||||||
var10001 = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
++var5;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.hasHair = var10001;
|
|
||||||
this.a = var1.load(this.newTexture);
|
|
||||||
this.newTexture = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(this.a < 0) {
|
|
||||||
GL11.glBindTexture(3553, var1.load("/char.png"));
|
|
||||||
} else {
|
|
||||||
GL11.glBindTexture(3553, this.a);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void renderHover(TextureManager var1, float var2) {
|
|
||||||
FontRenderer var3 = this.minecraft.fontRenderer;
|
|
||||||
GL11.glPushMatrix();
|
|
||||||
GL11.glTranslatef(this.xo + (this.x - this.xo) * var2, this.yo + (this.y - this.yo) * var2 + 0.8F + this.renderOffset, this.zo + (this.z - this.zo) * var2);
|
|
||||||
GL11.glRotatef(-this.minecraft.player.yRot, 0.0F, 1.0F, 0.0F);
|
|
||||||
var2 = 0.05F;
|
|
||||||
GL11.glScalef(0.05F, -var2, var2);
|
|
||||||
GL11.glTranslatef((float)(-var3.getWidth(this.displayName)) / 2.0F, 0.0F, 0.0F);
|
|
||||||
GL11.glNormal3f(1.0F, -1.0F, 1.0F);
|
|
||||||
GL11.glDisable(2896);
|
|
||||||
GL11.glDisable(16384);
|
|
||||||
if(this.name.equalsIgnoreCase("Notch")) {
|
|
||||||
var3.renderNoShadow(this.displayName, 0, 0, 16776960);
|
|
||||||
} else {
|
|
||||||
var3.renderNoShadow(this.displayName, 0, 0, 16777215);
|
|
||||||
}
|
|
||||||
|
|
||||||
GL11.glDepthFunc(516);
|
|
||||||
GL11.glDepthMask(false);
|
|
||||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.8F);
|
|
||||||
GL11.glEnable(3042);
|
|
||||||
GL11.glBlendFunc(770, 771);
|
|
||||||
var3.renderNoShadow(this.displayName, 0, 0, 16777215);
|
|
||||||
GL11.glDisable(3042);
|
|
||||||
GL11.glDepthMask(true);
|
|
||||||
GL11.glDepthFunc(515);
|
|
||||||
GL11.glTranslatef(1.0F, 1.0F, -0.05F);
|
|
||||||
var3.renderNoShadow(this.name, 0, 0, 5263440);
|
|
||||||
GL11.glEnable(16384);
|
|
||||||
GL11.glEnable(2896);
|
|
||||||
GL11.glPopMatrix();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void queue(byte var1, byte var2, byte var3, float var4, float var5) {
|
|
||||||
float var6 = var4 - this.yRot;
|
|
||||||
|
|
||||||
float var7;
|
|
||||||
for(var7 = var5 - this.xRot; var6 >= 180.0F; var6 -= 360.0F) {
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
while(var6 < -180.0F) {
|
|
||||||
var6 += 360.0F;
|
|
||||||
}
|
|
||||||
|
|
||||||
while(var7 >= 180.0F) {
|
|
||||||
var7 -= 360.0F;
|
|
||||||
}
|
|
||||||
|
|
||||||
while(var7 < -180.0F) {
|
|
||||||
var7 += 360.0F;
|
|
||||||
}
|
|
||||||
|
|
||||||
var6 = this.yRot + var6 * 0.5F;
|
|
||||||
var7 = this.xRot + var7 * 0.5F;
|
|
||||||
this.moveQueue.add(new PositionUpdate(((float)this.xp + (float)var1 / 2.0F) / 32.0F, ((float)this.yp + (float)var2 / 2.0F) / 32.0F, ((float)this.zp + (float)var3 / 2.0F) / 32.0F, var6, var7));
|
|
||||||
this.xp += var1;
|
|
||||||
this.yp += var2;
|
|
||||||
this.zp += var3;
|
|
||||||
this.moveQueue.add(new PositionUpdate((float)this.xp / 32.0F, (float)this.yp / 32.0F, (float)this.zp / 32.0F, var4, var5));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void teleport(short var1, short var2, short var3, float var4, float var5) {
|
|
||||||
float var6 = var4 - this.yRot;
|
|
||||||
|
|
||||||
float var7;
|
|
||||||
for(var7 = var5 - this.xRot; var6 >= 180.0F; var6 -= 360.0F) {
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
while(var6 < -180.0F) {
|
|
||||||
var6 += 360.0F;
|
|
||||||
}
|
|
||||||
|
|
||||||
while(var7 >= 180.0F) {
|
|
||||||
var7 -= 360.0F;
|
|
||||||
}
|
|
||||||
|
|
||||||
while(var7 < -180.0F) {
|
|
||||||
var7 += 360.0F;
|
|
||||||
}
|
|
||||||
|
|
||||||
var6 = this.yRot + var6 * 0.5F;
|
|
||||||
var7 = this.xRot + var7 * 0.5F;
|
|
||||||
this.moveQueue.add(new PositionUpdate((float)(this.xp + var1) / 64.0F, (float)(this.yp + var2) / 64.0F, (float)(this.zp + var3) / 64.0F, var6, var7));
|
|
||||||
this.xp = var1;
|
|
||||||
this.yp = var2;
|
|
||||||
this.zp = var3;
|
|
||||||
this.moveQueue.add(new PositionUpdate((float)this.xp / 32.0F, (float)this.yp / 32.0F, (float)this.zp / 32.0F, var4, var5));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void queue(byte var1, byte var2, byte var3) {
|
|
||||||
this.moveQueue.add(new PositionUpdate(((float)this.xp + (float)var1 / 2.0F) / 32.0F, ((float)this.yp + (float)var2 / 2.0F) / 32.0F, ((float)this.zp + (float)var3 / 2.0F) / 32.0F));
|
|
||||||
this.xp += var1;
|
|
||||||
this.yp += var2;
|
|
||||||
this.zp += var3;
|
|
||||||
this.moveQueue.add(new PositionUpdate((float)this.xp / 32.0F, (float)this.yp / 32.0F, (float)this.zp / 32.0F));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void queue(float var1, float var2) {
|
|
||||||
float var3 = var1 - this.yRot;
|
|
||||||
|
|
||||||
float var4;
|
|
||||||
for(var4 = var2 - this.xRot; var3 >= 180.0F; var3 -= 360.0F) {
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
while(var3 < -180.0F) {
|
|
||||||
var3 += 360.0F;
|
|
||||||
}
|
|
||||||
|
|
||||||
while(var4 >= 180.0F) {
|
|
||||||
var4 -= 360.0F;
|
|
||||||
}
|
|
||||||
|
|
||||||
while(var4 < -180.0F) {
|
|
||||||
var4 += 360.0F;
|
|
||||||
}
|
|
||||||
|
|
||||||
var3 = this.yRot + var3 * 0.5F;
|
|
||||||
var4 = this.xRot + var4 * 0.5F;
|
|
||||||
this.moveQueue.add(new PositionUpdate(var3, var4));
|
|
||||||
this.moveQueue.add(new PositionUpdate(var1, var2));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void clear() {
|
|
||||||
if(this.a >= 0 && this.textures != null) {
|
|
||||||
TextureManager var10000 = this.textures;
|
|
||||||
int var1 = this.a;
|
|
||||||
TextureManager var2 = this.textures;
|
|
||||||
var10000.textureImages.remove(Integer.valueOf(var1));
|
|
||||||
var2.idBuffer.clear();
|
|
||||||
var2.idBuffer.put(var1);
|
|
||||||
var2.idBuffer.flip();
|
|
||||||
GL11.glDeleteTextures(var2.idBuffer.get());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,45 +0,0 @@
|
||||||
package com.mojang.minecraft.net;
|
|
||||||
|
|
||||||
public class PositionUpdate
|
|
||||||
{
|
|
||||||
public PositionUpdate(float x, float y, float z, float yaw, float pitch)
|
|
||||||
{
|
|
||||||
this.x = x;
|
|
||||||
this.y = y;
|
|
||||||
this.z = z;
|
|
||||||
this.yaw = yaw;
|
|
||||||
this.pitch = pitch;
|
|
||||||
|
|
||||||
rotation = true;
|
|
||||||
position = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PositionUpdate(float x, float y, float z)
|
|
||||||
{
|
|
||||||
this.x = x;
|
|
||||||
this.y = y;
|
|
||||||
this.z = z;
|
|
||||||
|
|
||||||
position = true;
|
|
||||||
rotation = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PositionUpdate(float yaw, float pitch)
|
|
||||||
{
|
|
||||||
this.yaw = yaw;
|
|
||||||
this.pitch = pitch;
|
|
||||||
|
|
||||||
rotation = true;
|
|
||||||
position = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float x;
|
|
||||||
public float y;
|
|
||||||
public float z;
|
|
||||||
|
|
||||||
public float yaw;
|
|
||||||
public float pitch;
|
|
||||||
|
|
||||||
public boolean rotation = false;
|
|
||||||
public boolean position = false;
|
|
||||||
}
|
|
|
@ -1,46 +0,0 @@
|
||||||
package com.mojang.minecraft.net;
|
|
||||||
|
|
||||||
import java.net.HttpURLConnection;
|
|
||||||
import java.net.URL;
|
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
|
|
||||||
public class SkinDownloadThread extends Thread
|
|
||||||
{
|
|
||||||
public SkinDownloadThread(NetworkPlayer networkPlayer)
|
|
||||||
{
|
|
||||||
super();
|
|
||||||
|
|
||||||
this.player = networkPlayer;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
HttpURLConnection connection = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
connection = (HttpURLConnection)new URL("http://www.minecraft.net/skin/" + player.name + ".png").openConnection();
|
|
||||||
|
|
||||||
connection.setDoInput(true);
|
|
||||||
connection.setDoOutput(false);
|
|
||||||
|
|
||||||
connection.connect();
|
|
||||||
|
|
||||||
if(connection.getResponseCode() == 404)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
player.newTexture = ImageIO.read(connection.getInputStream());
|
|
||||||
} catch(Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} finally {
|
|
||||||
if(connection != null)
|
|
||||||
{
|
|
||||||
connection.disconnect();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private NetworkPlayer player;
|
|
||||||
}
|
|
|
@ -3,23 +3,19 @@ package com.mojang.minecraft.particle;
|
||||||
import com.mojang.minecraft.Entity;
|
import com.mojang.minecraft.Entity;
|
||||||
import com.mojang.minecraft.level.Level;
|
import com.mojang.minecraft.level.Level;
|
||||||
import com.mojang.minecraft.particle.Particle;
|
import com.mojang.minecraft.particle.Particle;
|
||||||
import com.mojang.minecraft.render.TextureManager;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public final class ParticleManager {
|
public final class ParticleManager {
|
||||||
|
|
||||||
public List[] particles = new List[2];
|
public List[] particles = new List[2];
|
||||||
public TextureManager textureManager;
|
|
||||||
|
|
||||||
|
|
||||||
public ParticleManager(Level var1, TextureManager var2) {
|
public ParticleManager(Level var1) {
|
||||||
if(var1 != null) {
|
if(var1 != null) {
|
||||||
var1.particleEngine = this;
|
var1.particleEngine = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.textureManager = var2;
|
|
||||||
|
|
||||||
for(int var3 = 0; var3 < 2; ++var3) {
|
for(int var3 = 0; var3 < 2; ++var3) {
|
||||||
this.particles[var3] = new ArrayList();
|
this.particles[var3] = new ArrayList();
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,9 +7,9 @@ import com.mojang.minecraft.model.HumanoidModel;
|
||||||
import com.mojang.minecraft.player.InputHandler;
|
import com.mojang.minecraft.player.InputHandler;
|
||||||
import com.mojang.minecraft.player.Inventory;
|
import com.mojang.minecraft.player.Inventory;
|
||||||
import com.mojang.minecraft.player.Player$1;
|
import com.mojang.minecraft.player.Player$1;
|
||||||
import com.mojang.minecraft.render.TextureManager;
|
import com.mojang.minecraft.render.TextureLocation;
|
||||||
|
|
||||||
import net.PeytonPlayz585.math.MathHelper;
|
import net.PeytonPlayz585.math.MathHelper;
|
||||||
import java.awt.image.BufferedImage;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
@ -26,8 +26,6 @@ public class Player extends Mob {
|
||||||
public int score = 0;
|
public int score = 0;
|
||||||
public int arrows = 20;
|
public int arrows = 20;
|
||||||
private static int newTextureId = -1;
|
private static int newTextureId = -1;
|
||||||
public static BufferedImage newTexture;
|
|
||||||
|
|
||||||
|
|
||||||
public Player(Level var1) {
|
public Player(Level var1) {
|
||||||
super(var1);
|
super(var1);
|
||||||
|
@ -86,7 +84,7 @@ public class Player extends Mob {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void render(TextureManager var1, float var2) {}
|
public void render(float var2) {}
|
||||||
|
|
||||||
public void releaseAllKeys() {
|
public void releaseAllKeys() {
|
||||||
this.input.resetKeys();
|
this.input.resetKeys();
|
||||||
|
@ -132,20 +130,8 @@ public class Player extends Mob {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void bindTexture(TextureManager var1) {
|
public void bindTexture() {
|
||||||
if(newTexture != null) {
|
new TextureLocation("/char.png").bindTexture();
|
||||||
newTextureId = var1.load(newTexture);
|
|
||||||
newTexture = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
int var2;
|
|
||||||
if(newTextureId < 0) {
|
|
||||||
var2 = var1.load("/char.png");
|
|
||||||
GL11.glBindTexture(3553, var2);
|
|
||||||
} else {
|
|
||||||
var2 = newTextureId;
|
|
||||||
GL11.glBindTexture(3553, var2);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void hurt(Entity var1, int var2) {
|
public void hurt(Entity var1, int var2) {
|
||||||
|
|
|
@ -3,10 +3,6 @@ package com.mojang.minecraft.render;
|
||||||
import com.mojang.minecraft.Minecraft;
|
import com.mojang.minecraft.Minecraft;
|
||||||
import com.mojang.minecraft.level.Level;
|
import com.mojang.minecraft.level.Level;
|
||||||
import com.mojang.minecraft.player.Player;
|
import com.mojang.minecraft.player.Player;
|
||||||
import com.mojang.minecraft.render.Chunk;
|
|
||||||
import com.mojang.minecraft.render.ChunkDistanceComparator;
|
|
||||||
import com.mojang.minecraft.render.ShapeRenderer;
|
|
||||||
import com.mojang.minecraft.render.TextureManager;
|
|
||||||
|
|
||||||
import net.lax1dude.eaglercraft.GLAllocation;
|
import net.lax1dude.eaglercraft.GLAllocation;
|
||||||
|
|
||||||
|
@ -19,10 +15,9 @@ import org.lwjgl.opengl.GL11;
|
||||||
public final class LevelRenderer {
|
public final class LevelRenderer {
|
||||||
|
|
||||||
public Level level;
|
public Level level;
|
||||||
public TextureManager textureManager;
|
|
||||||
public int listId;
|
public int listId;
|
||||||
public IntBuffer buffer = GLAllocation.createDirectIntBuffer(4096);
|
public IntBuffer buffer = GLAllocation.createDirectIntBuffer(4096);
|
||||||
public List chunks = new ArrayList();
|
public List<Chunk> chunks = new ArrayList<Chunk>();
|
||||||
private Chunk[] loadQueue;
|
private Chunk[] loadQueue;
|
||||||
public Chunk[] chunkCache;
|
public Chunk[] chunkCache;
|
||||||
private int xChunks;
|
private int xChunks;
|
||||||
|
@ -38,9 +33,8 @@ public final class LevelRenderer {
|
||||||
public float cracks;
|
public float cracks;
|
||||||
|
|
||||||
|
|
||||||
public LevelRenderer(Minecraft var1, TextureManager var2) {
|
public LevelRenderer(Minecraft var1) {
|
||||||
this.minecraft = var1;
|
this.minecraft = var1;
|
||||||
this.textureManager = var2;
|
|
||||||
this.listId = GL11.glGenLists(2);
|
this.listId = GL11.glGenLists(2);
|
||||||
this.baseListId = GL11.glGenLists(4096 << 6 << 1);
|
this.baseListId = GL11.glGenLists(4096 << 6 << 1);
|
||||||
}
|
}
|
||||||
|
@ -201,7 +195,7 @@ public final class LevelRenderer {
|
||||||
this.buffer.put(this.chunkDataCache, 0, var6);
|
this.buffer.put(this.chunkDataCache, 0, var6);
|
||||||
this.buffer.flip();
|
this.buffer.flip();
|
||||||
if(this.buffer.remaining() > 0) {
|
if(this.buffer.remaining() > 0) {
|
||||||
GL11.glBindTexture(3553, this.textureManager.load("/terrain.png"));
|
new TextureLocation("/terrain.png").bindTexture();
|
||||||
GL11.glCallLists(this.buffer);
|
GL11.glCallLists(this.buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
142
src/teavm/java/com/mojang/minecraft/render/RenderEngine.java
Normal file
142
src/teavm/java/com/mojang/minecraft/render/RenderEngine.java
Normal file
|
@ -0,0 +1,142 @@
|
||||||
|
package com.mojang.minecraft.render;
|
||||||
|
|
||||||
|
import java.nio.ByteBuffer;
|
||||||
|
import java.nio.IntBuffer;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import com.mojang.minecraft.GameSettings;
|
||||||
|
import com.mojang.minecraft.Minecraft;
|
||||||
|
|
||||||
|
import net.lax1dude.eaglercraft.EaglerImage;
|
||||||
|
import net.lax1dude.eaglercraft.GLAllocation;
|
||||||
|
|
||||||
|
public class RenderEngine {
|
||||||
|
|
||||||
|
public RenderEngine() {
|
||||||
|
textureMap = new HashMap<String, Integer>();
|
||||||
|
textureNameToImageMap = new HashMap();
|
||||||
|
singleIntBuffer = GLAllocation.createDirectIntBuffer(1);
|
||||||
|
imageDataB1 = GLAllocation.createDirectByteBuffer(0x100000);
|
||||||
|
imageDataB2 = GLAllocation.createDirectByteBuffer(0x100000);
|
||||||
|
options = Minecraft.settings;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTexture(String s) {
|
||||||
|
//TextureBase texturepackbase = new TextureBase();
|
||||||
|
Integer integer = (Integer) textureMap.get(s);
|
||||||
|
if (integer != null) {
|
||||||
|
return integer.intValue();
|
||||||
|
}
|
||||||
|
singleIntBuffer.clear();
|
||||||
|
GLAllocation.generateTextureNames(singleIntBuffer);
|
||||||
|
int i = singleIntBuffer.get(0);
|
||||||
|
if(s.equals("/terrain.png")) {
|
||||||
|
useMipmaps = true;
|
||||||
|
}
|
||||||
|
setupTexture(GL11.loadPNG(GL11.loadResourceBytes(s)), i);
|
||||||
|
useMipmaps = false;
|
||||||
|
textureMap.put(s, Integer.valueOf(i));
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setupTexture(EaglerImage bufferedimage, int i) {
|
||||||
|
bindTexture(i);
|
||||||
|
if (useMipmaps) {
|
||||||
|
GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10241 /* GL_TEXTURE_MIN_FILTER */, GL11.GL_NEAREST_MIPMAP_LINEAR);
|
||||||
|
GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10240 /* GL_TEXTURE_MAG_FILTER */, GL11.GL_NEAREST /* GL_LINEAR */);
|
||||||
|
GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, GL11.GL_TEXTURE_MAX_LEVEL, 4);
|
||||||
|
} else {
|
||||||
|
GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10241 /* GL_TEXTURE_MIN_FILTER */, 9728 /* GL_NEAREST */);
|
||||||
|
GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10240 /* GL_TEXTURE_MAG_FILTER */, 9728 /* GL_NEAREST */);
|
||||||
|
}
|
||||||
|
GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10242 /* GL_TEXTURE_WRAP_S */, 10497 /* GL_REPEAT */);
|
||||||
|
GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10243 /* GL_TEXTURE_WRAP_T */, 10497 /* GL_REPEAT */);
|
||||||
|
int j = bufferedimage.w;
|
||||||
|
int k = bufferedimage.h;
|
||||||
|
int ai[] = bufferedimage.data;
|
||||||
|
byte abyte0[] = new byte[j * k * 4];
|
||||||
|
for (int l = 0; l < ai.length; l++) {
|
||||||
|
int j1 = ai[l] >> 24 & 0xff;
|
||||||
|
int l1 = ai[l] >> 16 & 0xff;
|
||||||
|
int j2 = ai[l] >> 8 & 0xff;
|
||||||
|
int l2 = ai[l] >> 0 & 0xff;
|
||||||
|
if (options != null && options.anaglyph) {
|
||||||
|
int j3 = (l1 * 30 + j2 * 59 + l2 * 11) / 100;
|
||||||
|
int l3 = (l1 * 30 + j2 * 70) / 100;
|
||||||
|
int j4 = (l1 * 30 + l2 * 70) / 100;
|
||||||
|
l1 = j3;
|
||||||
|
j2 = l3;
|
||||||
|
l2 = j4;
|
||||||
|
}
|
||||||
|
abyte0[l * 4 + 0] = (byte) l1;
|
||||||
|
abyte0[l * 4 + 1] = (byte) j2;
|
||||||
|
abyte0[l * 4 + 2] = (byte) l2;
|
||||||
|
abyte0[l * 4 + 3] = (byte) j1;
|
||||||
|
}
|
||||||
|
imageDataB1.clear();
|
||||||
|
imageDataB1.put(abyte0);
|
||||||
|
imageDataB1.position(0).limit(abyte0.length);
|
||||||
|
GL11.glTexImage2D(3553 /* GL_TEXTURE_2D */, 0, 6408 /* GL_RGBA */, j, k, 0, 6408 /* GL_RGBA */,
|
||||||
|
5121 /* GL_UNSIGNED_BYTE */, imageDataB1);
|
||||||
|
if (useMipmaps) {
|
||||||
|
for (int i1 = 1; i1 <= 4; i1++) {
|
||||||
|
int k1 = j >> i1 - 1;
|
||||||
|
int i2 = j >> i1;
|
||||||
|
int k2 = k >> i1;
|
||||||
|
imageDataB2.clear();
|
||||||
|
for (int i3 = 0; i3 < i2; i3++) {
|
||||||
|
for (int k3 = 0; k3 < k2; k3++) {
|
||||||
|
int i4 = imageDataB1.getInt((i3 * 2 + 0 + (k3 * 2 + 0) * k1) * 4);
|
||||||
|
int k4 = imageDataB1.getInt((i3 * 2 + 1 + (k3 * 2 + 0) * k1) * 4);
|
||||||
|
int l4 = imageDataB1.getInt((i3 * 2 + 1 + (k3 * 2 + 1) * k1) * 4);
|
||||||
|
int i5 = imageDataB1.getInt((i3 * 2 + 0 + (k3 * 2 + 1) * k1) * 4);
|
||||||
|
int j5 = averageColor(averageColor(i4, k4), averageColor(l4, i5));
|
||||||
|
imageDataB2.putInt((i3 + k3 * i2) * 4, j5);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
GL11.glTexImage2D(3553 /* GL_TEXTURE_2D */, i1, 6408 /* GL_RGBA */, i2, k2, 0, 6408 /* GL_RGBA */,
|
||||||
|
5121 /* GL_UNSIGNED_BYTE */, imageDataB2);
|
||||||
|
ByteBuffer tmp = imageDataB1;
|
||||||
|
imageDataB1 = imageDataB2;
|
||||||
|
imageDataB2 = tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private int averageColor(int i, int j) {
|
||||||
|
int k = (i & 0xff000000) >> 24 & 0xff;
|
||||||
|
int l = (j & 0xff000000) >> 24 & 0xff;
|
||||||
|
return ((k + l >> 1) << 24) + ((i & 0xfefefe) + (j & 0xfefefe) >> 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void bindTexture(int i) {
|
||||||
|
if (i < 0) {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
GL11.glBindTexture(3553 /* GL_TEXTURE_2D */, i);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int allocateAndSetupTexture(EaglerImage bufferedimage) {
|
||||||
|
singleIntBuffer.clear();
|
||||||
|
GLAllocation.generateTextureNames(singleIntBuffer);
|
||||||
|
int i = singleIntBuffer.get(0);
|
||||||
|
setupTexture(bufferedimage, i);
|
||||||
|
textureNameToImageMap.put(Integer.valueOf(i), bufferedimage);
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean useMipmaps = false;
|
||||||
|
private HashMap<String, Integer> textureMap;
|
||||||
|
private IntBuffer singleIntBuffer;
|
||||||
|
private ByteBuffer imageDataB1;
|
||||||
|
private ByteBuffer imageDataB2;
|
||||||
|
private GameSettings options;
|
||||||
|
private HashMap<Integer, EaglerImage> textureNameToImageMap;
|
||||||
|
}
|
|
@ -0,0 +1,44 @@
|
||||||
|
package com.mojang.minecraft.render;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class TextureLocation {
|
||||||
|
|
||||||
|
private String path;
|
||||||
|
private int glObject;
|
||||||
|
|
||||||
|
public TextureLocation(String path) {
|
||||||
|
this.path = path;
|
||||||
|
this.glObject = -1;
|
||||||
|
locations.add(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void freeTextures() {
|
||||||
|
for (TextureLocation l : locations) {
|
||||||
|
l.glObject = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTexturePointer() {
|
||||||
|
RenderEngine r = new RenderEngine();
|
||||||
|
if (glObject == -1) {
|
||||||
|
glObject = r.getTexture(path);
|
||||||
|
if (glObject == -1) {
|
||||||
|
System.err.println("could not load: " + path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return glObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int bindTexture() {
|
||||||
|
RenderEngine r = new RenderEngine();
|
||||||
|
int i = getTexturePointer();
|
||||||
|
if(i != -1) {
|
||||||
|
r.bindTexture(i);
|
||||||
|
}
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final ArrayList<TextureLocation> locations = new ArrayList();
|
||||||
|
|
||||||
|
}
|
|
@ -1,117 +0,0 @@
|
||||||
package com.mojang.minecraft.render;
|
|
||||||
|
|
||||||
import com.mojang.minecraft.GameSettings;
|
|
||||||
import com.mojang.minecraft.render.texture.TextureFX;
|
|
||||||
import java.awt.Graphics;
|
|
||||||
import java.awt.image.BufferedImage;
|
|
||||||
import java.awt.image.ImageObserver;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.nio.ByteBuffer;
|
|
||||||
import java.nio.IntBuffer;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
import org.lwjgl.BufferUtils;
|
|
||||||
import org.lwjgl.opengl.GL11;
|
|
||||||
|
|
||||||
public class TextureManager {
|
|
||||||
|
|
||||||
public HashMap textures = new HashMap();
|
|
||||||
public HashMap textureImages = new HashMap();
|
|
||||||
public IntBuffer idBuffer = BufferUtils.createIntBuffer(1);
|
|
||||||
public ByteBuffer textureBuffer = BufferUtils.createByteBuffer(262144);
|
|
||||||
public List animations = new ArrayList();
|
|
||||||
public GameSettings settings;
|
|
||||||
|
|
||||||
|
|
||||||
public TextureManager(GameSettings var1) {
|
|
||||||
this.settings = var1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public final int load(String var1) {
|
|
||||||
Integer var2;
|
|
||||||
if((var2 = (Integer)this.textures.get(var1)) != null) {
|
|
||||||
return var2.intValue();
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
this.idBuffer.clear();
|
|
||||||
GL11.glGenTextures(this.idBuffer);
|
|
||||||
int var4 = this.idBuffer.get(0);
|
|
||||||
if(var1.startsWith("##")) {
|
|
||||||
this.load(load1(ImageIO.read(TextureManager.class.getResourceAsStream(var1.substring(2)))), var4);
|
|
||||||
} else {
|
|
||||||
this.load(ImageIO.read(TextureManager.class.getResourceAsStream(var1)), var4);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.textures.put(var1, Integer.valueOf(var4));
|
|
||||||
return var4;
|
|
||||||
} catch (IOException var3) {
|
|
||||||
throw new RuntimeException("!!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static BufferedImage load1(BufferedImage var0) {
|
|
||||||
int var1 = var0.getWidth() / 16;
|
|
||||||
BufferedImage var2;
|
|
||||||
Graphics var3 = (var2 = new BufferedImage(16, var0.getHeight() * var1, 2)).getGraphics();
|
|
||||||
|
|
||||||
for(int var4 = 0; var4 < var1; ++var4) {
|
|
||||||
var3.drawImage(var0, -var4 << 4, var4 * var0.getHeight(), (ImageObserver)null);
|
|
||||||
}
|
|
||||||
|
|
||||||
var3.dispose();
|
|
||||||
return var2;
|
|
||||||
}
|
|
||||||
|
|
||||||
public final int load(BufferedImage var1) {
|
|
||||||
this.idBuffer.clear();
|
|
||||||
GL11.glGenTextures(this.idBuffer);
|
|
||||||
int var2 = this.idBuffer.get(0);
|
|
||||||
this.load(var1, var2);
|
|
||||||
this.textureImages.put(Integer.valueOf(var2), var1);
|
|
||||||
return var2;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void load(BufferedImage var1, int var2) {
|
|
||||||
GL11.glBindTexture(3553, var2);
|
|
||||||
GL11.glTexParameteri(3553, 10241, 9728);
|
|
||||||
GL11.glTexParameteri(3553, 10240, 9728);
|
|
||||||
var2 = var1.getWidth();
|
|
||||||
int var3 = var1.getHeight();
|
|
||||||
int[] var4 = new int[var2 * var3];
|
|
||||||
byte[] var5 = new byte[var2 * var3 << 2];
|
|
||||||
var1.getRGB(0, 0, var2, var3, var4, 0, var2);
|
|
||||||
|
|
||||||
for(int var11 = 0; var11 < var4.length; ++var11) {
|
|
||||||
int var6 = var4[var11] >>> 24;
|
|
||||||
int var7 = var4[var11] >> 16 & 255;
|
|
||||||
int var8 = var4[var11] >> 8 & 255;
|
|
||||||
int var9 = var4[var11] & 255;
|
|
||||||
if(this.settings.anaglyph) {
|
|
||||||
int var10 = (var7 * 30 + var8 * 59 + var9 * 11) / 100;
|
|
||||||
var8 = (var7 * 30 + var8 * 70) / 100;
|
|
||||||
var9 = (var7 * 30 + var9 * 70) / 100;
|
|
||||||
var7 = var10;
|
|
||||||
var8 = var8;
|
|
||||||
var9 = var9;
|
|
||||||
}
|
|
||||||
|
|
||||||
var5[var11 << 2] = (byte)var7;
|
|
||||||
var5[(var11 << 2) + 1] = (byte)var8;
|
|
||||||
var5[(var11 << 2) + 2] = (byte)var9;
|
|
||||||
var5[(var11 << 2) + 3] = (byte)var6;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.textureBuffer.clear();
|
|
||||||
this.textureBuffer.put(var5);
|
|
||||||
this.textureBuffer.position(0).limit(var5.length);
|
|
||||||
GL11.glTexImage2D(3553, 0, 6408, var2, var3, 0, 6408, 5121, this.textureBuffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
public final void registerAnimation(TextureFX var1) {
|
|
||||||
this.animations.add(var1);
|
|
||||||
var1.animate();
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user