Compare commits

..

No commits in common. "3f9ff320b87796c650244466d0b3efa90587d90b" and "f82f9a67586437bbb57c85b1d26638c8f0ad4a6f" have entirely different histories.

24 changed files with 59781 additions and 10277 deletions

View File

@ -6,7 +6,12 @@
<attribute name="gradle_used_by_scope" value="main,test"/> <attribute name="gradle_used_by_scope" value="main,test"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/> <classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/TeaVM"/>
<classpathentry kind="output" path="bin/default"/> <classpathentry kind="output" path="bin/default"/>
</classpath> </classpath>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<projectDescription> <projectDescription>
<name>Indev</name> <name>Alpha v1.2.6</name>
<comment>Project Indev created by Buildship.</comment> <comment>Project Alpha v1.2.6 created by Buildship.</comment>
<projects> <projects>
</projects> </projects>
<buildSpec> <buildSpec>

4994
Indev.html

File diff suppressed because one or more lines are too long

View File

@ -1,31 +0,0 @@
<html>
<head>
<title>Minecraft Indev</title>
<script type="text/javascript">
window.addEventListener("load", function() {
window.classicConfig = [
"game_frame",createAssetURI("assets"),
]; main();
});
</script>
<script type="text/javascript">
function createAssetURI(el) {
var eee = document.getElementById(el);
var str = eee.innerText;
eee.remove();
return "data:application/octet-stream;base64," + str.trim();
}
</script>
<script type="text/javascript">
//app.js
</script>
<body style="margin:0px;width:100vw;height:100vh;" id="game_frame">
<div style="display:none;" id="assets">
//Base64 encoded resources
</div>
</body>
</html>

View File

@ -1,29 +1 @@
# Minecraft Indev WebGL # Minecraft-Indev-WebGL
This project aims to be a 1:1 replica of Minecraft Indev 20100223 made using TeaVM and WebGL. This project can be played on almost any device and can be played in the web browser on low-end devices like Chromebooks.
# Project Takedown
This project is just for fun, If this project has to be taken down for any legal reasons please email me at PeytonPlayz585@gmail.com
# Playing in the Web Browser
To play in the web browser please [click here](https://peytonplayz595.github.io/Minecraft-Indev-WebGL/js/). If for some reason it doesn't work please open an issue [here](https://github.com/PeytonPlayz595/Minecraft-Indev-WebGL/issues).
Here are a few reasons that it might not work:
- Your browser doesn't support [HTML5](https://developer.mozilla.org/en-US/docs/Glossary/HTML5), at this point there is no valid excuses...
- Your browser doesn't support [WebGL 2.0](https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API)
- Your browser doesn't support [Pointer Lock API](https://developer.mozilla.org/en-US/docs/Web/API/Pointer_Lock_API)
- Your browser doesn't support [IndexedDB](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API)
Try using the latest versions of Chrome, Edge, Opera, or Safari to see if it will work, if it doesn't it might be a driver glitch so just open an issue.
# Pros and Cons
Pros:
- No download, it's playable in your Web Browser for free
- Get's decant FPS on low-end devices like Chromebooks
Cons:
- It's technically a pirated version of the game
- There will be unexpected bugs and glitches
- Probably will be removed due to a DMCA
# Screenshots

View File

@ -37,7 +37,7 @@ dependencies {
teavm { teavm {
compileScopes = null; compileScopes = null;
minifying = true; minifying = false;
maxTopLevelNames = 10000; maxTopLevelNames = 10000;
properties = null; properties = null;
debugInformationGenerated = false; debugInformationGenerated = false;

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

64559
js/app.js

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>Indev</title> <title>Main page</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"> <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<script type="text/javascript" charset="utf-8" src="app.js"></script> <script type="text/javascript" charset="utf-8" src="app.js"></script>
<script type = text/javascript> <script type = text/javascript>

View File

@ -1,55 +1,40 @@
package net.PeytonPlayz585.minecraft; package net.PeytonPlayz585.minecraft;
import java.nio.IntBuffer;
public class MinecraftImage { public class MinecraftImage {
public final IntBuffer data; public final int[] data;
public final int w; public final int w;
public final int h; public final int h;
public final boolean alpha; public final boolean alpha;
private final int wh;
public MinecraftImage(int pw, int ph, boolean palpha) { public MinecraftImage(int pw, int ph, boolean palpha) {
this.w = pw; this.w = pw;
this.h = ph; this.h = ph;
this.alpha = palpha; this.alpha = palpha;
this.data = IntBuffer.allocate(pw * ph); this.data = new int[pw * ph];
this.wh = pw * ph;
} }
public MinecraftImage(IntBuffer pdata, int pw, int ph, boolean palpha) { public MinecraftImage(int[] pdata, int pw, int ph, boolean palpha) {
if (pdata.capacity() != pw * ph) { if (pdata.length != pw * ph) {
throw new IllegalArgumentException("buffer capacity does not equal image size"); throw new IllegalArgumentException("array size does not equal image size");
} }
w = pw; this.w = pw;
h = ph; this.h = ph;
alpha = palpha; this.alpha = palpha;
wh = pw * ph; if (!palpha) {
if (!alpha) { for (int i = 0; i < pdata.length; ++i) {
for (int i = 0; i < wh; ++i) { pdata[i] = pdata[i] | 0xFF000000;
pdata.put(i, pdata.get(i) | 0xFF000000);
} }
pdata.rewind();
} }
data = pdata; this.data = pdata;
} }
public MinecraftImage getSubImage(int x, int y, int pw, int ph) { public MinecraftImage getSubImage(int x, int y, int pw, int ph) {
int start = y * w + x; int[] img = new int[pw * ph];
IntBuffer subBuffer = data.slice(); for (int i = 0; i < ph; ++i) {
subBuffer.position(start); System.arraycopy(data, (i + y) * this.w + x, img, i * pw, pw);
subBuffer.limit(start + pw * ph); }
int[] temp = new int[pw * ph]; return new MinecraftImage(img, pw, ph, alpha);
subBuffer.get(temp);
IntBuffer newBuffer = IntBuffer.wrap(temp);
return new MinecraftImage(newBuffer, pw, ph, alpha);
} }
public int[] data() {
int[] array = new int[wh];
data.rewind();
data.get(array);
return array;
}
} }

View File

@ -1,6 +1,5 @@
package net.minecraft.client; package net.minecraft.client;
import java.nio.FloatBuffer;
import java.nio.IntBuffer; import java.nio.IntBuffer;
import net.PeytonPlayz585.storage.LevelStorageManager; import net.PeytonPlayz585.storage.LevelStorageManager;
@ -36,11 +35,9 @@ import net.minecraft.game.level.World;
import net.minecraft.game.level.block.Block; import net.minecraft.game.level.block.Block;
import net.minecraft.game.level.generator.LevelGenerator; import net.minecraft.game.level.generator.LevelGenerator;
import net.minecraft.game.physics.MovingObjectPosition; import net.minecraft.game.physics.MovingObjectPosition;
import net.minecraft.game.physics.Vec3D;
import util.IProgressUpdate; import util.IProgressUpdate;
import org.lwjgl.BufferUtils; import org.lwjgl.BufferUtils;
import org.lwjgl.GLAllocation;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
public final class Minecraft implements Runnable { public final class Minecraft implements Runnable {
@ -700,32 +697,4 @@ public final class Minecraft implements Runnable {
public static Minecraft getMinecraft() { public static Minecraft getMinecraft() {
return mc; return mc;
} }
public final void setLighting(boolean var1) {
if(!var1) {
GL11.glDisable(2896);
GL11.glDisable(16384);
} else {
GL11.glEnable(2896);
GL11.glEnable(16384);
GL11.glEnable(2903);
GL11.glColorMaterial(1032, 5634);
float var4 = 0.7F;
float var2 = 0.3F;
Vec3D var3 = (new Vec3D(0.0F, -1.0F, 0.5F)).normalize();
GL11.glLight(16384, 4611, this.createBuffer(var3.xCoord, var3.yCoord, var3.zCoord, 0.0F));
GL11.glLight(16384, 4609, this.createBuffer(var2, var2, var2, 1.0F));
GL11.glLight(16384, 4608, this.createBuffer(0.0F, 0.0F, 0.0F, 1.0F));
GL11.glLightModel(2899, this.createBuffer(var4, var4, var4, 1.0F));
}
}
private FloatBuffer createBuffer(float var1, float var2, float var3, float var4) {
buffer.clear();
buffer.put(var1).put(var2).put(var3).put(var4);
buffer.flip();
return buffer;
}
private FloatBuffer buffer = GLAllocation.createDirectFloatBuffer(16);
} }

View File

@ -18,7 +18,7 @@ public class FontRenderer {
MinecraftImage bufferedimage = GL11.loadPNG(GL11.loadResourceBytes(s)); MinecraftImage bufferedimage = GL11.loadPNG(GL11.loadResourceBytes(s));
int i = bufferedimage.w; int i = bufferedimage.w;
int j = bufferedimage.h; int j = bufferedimage.h;
int ai[] = bufferedimage.data(); int ai[] = bufferedimage.data;
for (int k = 0; k < 256; k++) { for (int k = 0; k < 256; k++) {
int l = k % 16; int l = k % 16;
int k1 = k / 16; int k1 = k / 16;

View File

@ -211,6 +211,39 @@ public final class ItemRenderer {
Tessellator var3; Tessellator var3;
float var7; float var7;
float var9; float var9;
if(this.mc.thePlayer.fire > 0) {
var2 = this.mc.renderEngine.getTexture("/terrain.png");
GL11.glBindTexture(GL11.GL_TEXTURE_2D, var2);
var3 = Tessellator.instance;
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.9F);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
for(var2 = 0; var2 < 2; ++var2) {
GL11.glPushMatrix();
int var4 = Block.fire.blockIndexInTexture + (var2 << 4);
int var5 = (var4 & 15) << 4;
var4 &= 240;
float var6 = (float)var5 / 256.0F;
float var10 = ((float)var5 + 15.99F) / 256.0F;
var7 = (float)var4 / 256.0F;
var9 = ((float)var4 + 15.99F) / 256.0F;
GL11.glTranslatef((float)(-((var2 << 1) - 1)) * 0.24F, -0.3F, 0.0F);
GL11.glRotatef((float)((var2 << 1) - 1) * 10.0F, 0.0F, 1.0F, 0.0F);
var3.startDrawingQuads();
var3.addVertexWithUV(-0.5F, -0.5F, -0.5F, var10, var9);
var3.addVertexWithUV(0.5F, -0.5F, -0.5F, var6, var9);
var3.addVertexWithUV(0.5F, 0.5F, -0.5F, var6, var7);
var3.addVertexWithUV(-0.5F, 0.5F, -0.5F, var10, var7);
GL11.flipLightMatrix();
var3.draw();
GL11.flipLightMatrix();
GL11.glPopMatrix();
}
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glDisable(GL11.GL_BLEND);
}
if(this.mc.thePlayer.isInsideOfWater()) { if(this.mc.thePlayer.isInsideOfWater()) {
var2 = this.mc.renderEngine.getTexture("/water.png"); var2 = this.mc.renderEngine.getTexture("/water.png");

View File

@ -2,19 +2,14 @@ package net.minecraft.client.render;
import java.io.IOException; import java.io.IOException;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.FloatBuffer;
import java.nio.IntBuffer; import java.nio.IntBuffer;
import java.util.HashMap; import java.util.HashMap;
import org.lwjgl.BufferUtils; import org.lwjgl.BufferUtils;
import org.lwjgl.GLAllocation;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import net.minecraft.game.physics.Vec3D;
import net.PeytonPlayz585.minecraft.MinecraftImage; import net.PeytonPlayz585.minecraft.MinecraftImage;
import net.minecraft.client.GameSettings; import net.minecraft.client.GameSettings;
import net.minecraft.client.Minecraft;
public class RenderEngine { public class RenderEngine {
@ -23,7 +18,6 @@ public class RenderEngine {
textureNameToImageMap = new HashMap<Integer, MinecraftImage>(); textureNameToImageMap = new HashMap<Integer, MinecraftImage>();
singleIntBuffer = BufferUtils.createIntBuffer(1); singleIntBuffer = BufferUtils.createIntBuffer(1);
imageDataB1 = BufferUtils.createByteBuffer(0x100000); imageDataB1 = BufferUtils.createByteBuffer(0x100000);
imageDataB2 = BufferUtils.createByteBuffer(0x100000);
clampTexture = false; clampTexture = false;
blurTexture = false; blurTexture = false;
options = gamesettings; options = gamesettings;
@ -82,9 +76,8 @@ public class RenderEngine {
public void setupTexture(MinecraftImage bufferedimage, int i) { public void setupTexture(MinecraftImage bufferedimage, int i) {
bindTexture(i); bindTexture(i);
GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10241 /* GL_TEXTURE_MIN_FILTER */, GL11.GL_NEAREST_MIPMAP_LINEAR); 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 */, GL11.GL_NEAREST /* GL_LINEAR */); GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10240 /* GL_TEXTURE_MAG_FILTER */, 9728 /* GL_NEAREST */);
GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, GL11.GL_TEXTURE_MAX_LEVEL, 4);
if (blurTexture) { if (blurTexture) {
GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10241 /* GL_TEXTURE_MIN_FILTER */, 9729 /* GL_LINEAR */); GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10241 /* GL_TEXTURE_MIN_FILTER */, 9729 /* GL_LINEAR */);
GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10240 /* GL_TEXTURE_MAG_FILTER */, 9729 /* GL_LINEAR */); GL11.glTexParameteri(3553 /* GL_TEXTURE_2D */, 10240 /* GL_TEXTURE_MAG_FILTER */, 9729 /* GL_LINEAR */);
@ -98,7 +91,7 @@ public class RenderEngine {
} }
int j = bufferedimage.w; int j = bufferedimage.w;
int k = bufferedimage.h; int k = bufferedimage.h;
int ai[] = bufferedimage.data(); int ai[] = bufferedimage.data;
byte abyte0[] = new byte[j * k * 4]; byte abyte0[] = new byte[j * k * 4];
for (int l = 0; l < ai.length; l++) { for (int l = 0; l < ai.length; l++) {
int j1 = ai[l] >> 24 & 0xff; int j1 = ai[l] >> 24 & 0xff;
@ -123,28 +116,6 @@ public class RenderEngine {
imageDataB1.position(0).limit(abyte0.length); imageDataB1.position(0).limit(abyte0.length);
GL11.glTexImage2D(3553 /* GL_TEXTURE_2D */, 0, 6408 /* GL_RGBA */, j, k, 0, 6408 /* GL_RGBA */, GL11.glTexImage2D(3553 /* GL_TEXTURE_2D */, 0, 6408 /* GL_RGBA */, j, k, 0, 6408 /* GL_RGBA */,
5121 /* GL_UNSIGNED_BYTE */, imageDataB1); 5121 /* GL_UNSIGNED_BYTE */, imageDataB1);
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;
}
} }
public void deleteTexture(int i) { public void deleteTexture(int i) {
@ -159,28 +130,19 @@ public class RenderEngine {
return GL11.loadPNG(inputstream); return GL11.loadPNG(inputstream);
} }
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 static void bindTexture(int i) { public static void bindTexture(int i) {
Minecraft.getMinecraft().setLighting(true);
if (i < 0) { if (i < 0) {
Minecraft.getMinecraft().setLighting(false);
return; return;
} else { } else {
GL11.glBindTexture(3553 /* GL_TEXTURE_2D */, i); GL11.glBindTexture(3553 /* GL_TEXTURE_2D */, i);
Minecraft.getMinecraft().setLighting(false);
return; return;
} }
} }
private HashMap<String, Integer> textureMap; private HashMap<String, Integer> textureMap;
private HashMap<Integer, MinecraftImage> textureNameToImageMap; private HashMap<Integer, MinecraftImage> textureNameToImageMap;
private IntBuffer singleIntBuffer; private IntBuffer singleIntBuffer;
private ByteBuffer imageDataB1; private ByteBuffer imageDataB1;
private ByteBuffer imageDataB2;
private GameSettings options; private GameSettings options;
private boolean clampTexture; private boolean clampTexture;
private boolean blurTexture; private boolean blurTexture;

View File

@ -265,6 +265,5 @@ public class Tessellator {
int var5 = (int)((par2 / len) * 125.0F) + 125; int var5 = (int)((par2 / len) * 125.0F) + 125;
int var6 = (int)((par3 / len) * 125.0F) + 125; int var6 = (int)((par3 / len) * 125.0F) + 125;
this.normal = var4 & 255 | (var5 & 255) << 8 | (var6 & 255) << 16; this.normal = var4 & 255 | (var5 & 255) << 8 | (var6 & 255) << 16;
GL11.glNormal3f(par1, par2, par3);
} }
} }

View File

@ -1,7 +1,5 @@
package net.minecraft.client.render.entity; package net.minecraft.client.render.entity;
import net.PeytonPlayz585.math.MathHelper;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelBiped; import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.render.RenderBlocks; import net.minecraft.client.render.RenderBlocks;
import net.minecraft.client.render.RenderEngine; import net.minecraft.client.render.RenderEngine;
@ -79,128 +77,105 @@ public abstract class Render {
this.renderManager = var1; this.renderManager = var1;
} }
private void renderEntityOnFire(Entity var1, double var2, double var4, double var6, float var8) { public final void renderShadow(Entity var1, float var2, float var3, float var4, float var5) {
GL11.glDisable(GL11.GL_LIGHTING); float var12;
int var9 = Block.fire.blockIndexInTexture; float var18;
int var10 = (var9 & 15) << 4; float var19;
int var11 = var9 & 240; int var29;
float var12 = (float)var10 / 256.0F; float var34;
float var13 = ((float)var10 + 15.99F) / 256.0F; float var36;
float var14 = (float)var11 / 256.0F; if(this.shadowSize > 0.0F) {
float var15 = ((float)var11 + 15.99F) / 256.0F; var5 = this.renderManager.getDistanceToCamera(var2, var3, var4);
GL11.glPushMatrix(); var5 = (1.0F - var5 / 256.0F) * this.shadowOpaque;
GL11.glTranslatef((float)var2, (float)var4, (float)var6); if(var5 > 0.0F) {
float var16 = var1.width * 1.4F; float var9 = var5;
GL11.glScalef(var16, var16, var16); float var8 = var4;
this.loadTexture("/terrain.png"); float var7 = var3;
Tessellator var17 = Tessellator.instance; float var6 = var2;
float var18 = 1.0F; Render var27 = this;
float var19 = 0.5F; GL11.glAlphaFunc(516, 0.1F);
float var20 = 0.0F;
float var21 = var1.height / var1.width;
GL11.glRotatef(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
GL11.glTranslatef(0.0F, 0.0F, 0.4F + (float)((int)var21) * 0.02F);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
var17.startDrawingQuads();
while(var21 > 0.0F) {
var17.addVertexWithUV((double)(var18 - var19), (double)(0.0F - var20), 0.0D, (double)var13, (double)var15);
var17.addVertexWithUV((double)(0.0F - var19), (double)(0.0F - var20), 0.0D, (double)var12, (double)var15);
var17.addVertexWithUV((double)(0.0F - var19), (double)(1.4F - var20), 0.0D, (double)var12, (double)var14);
var17.addVertexWithUV((double)(var18 - var19), (double)(1.4F - var20), 0.0D, (double)var13, (double)var14);
--var21;
--var20;
var18 *= 0.9F;
GL11.glTranslatef(0.0F, 0.0F, -0.04F);
}
var17.draw();
GL11.glPopMatrix();
GL11.glEnable(GL11.GL_LIGHTING);
}
private void renderShadow(Entity var1, float var2, float var4, float var6, float var8, float var9) {
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
RenderEngine var10 = this.renderManager.renderEngine; RenderEngine var10 = this.renderManager.renderEngine;
var10.bindTexture(var10.getTexture("%clamp%/shadow.png")); RenderEngine.bindTexture(var10.getTexture("%clamp%/shadow.png"));
World var11 = this.getWorldFromRenderManager(); World var11 = this.renderManager.worldObj;
GL11.glDepthMask(false); GL11.glDepthMask(false);
float var12 = this.shadowSize; var12 = this.shadowSize;
double var13 = var1.lastTickPosX + (var1.posX - var1.lastTickPosX) * (double)var9;
double var15 = var1.lastTickPosY + (var1.posY - var1.lastTickPosY) * (double)var9;
double var17 = var1.lastTickPosZ + (var1.posZ - var1.lastTickPosZ) * (double)var9;
int var19 = MathHelper.floor_double(var13 - (double)var12);
int var20 = MathHelper.floor_double(var13 + (double)var12);
int var21 = MathHelper.floor_double(var15 - (double)var12);
int var22 = MathHelper.floor_double(var15);
int var23 = MathHelper.floor_double(var17 - (double)var12);
int var24 = MathHelper.floor_double(var17 + (double)var12);
double var25 = var2 - var13;
double var27 = var4 - var15;
double var29 = var6 - var17;
Tessellator var31 = Tessellator.instance;
var31.startDrawingQuads();
for(int var32 = var19; var32 <= var20; ++var32) { for(var29 = (int)(var2 - var12); var29 <= (int)(var6 + var12); ++var29) {
for(int var33 = var21; var33 <= var22; ++var33) { for(int var13 = (int)(var7 - 2.0F); var13 <= (int)var7; ++var13) {
for(int var34 = var23; var34 <= var24; ++var34) { for(int var14 = (int)(var8 - var12); var14 <= (int)(var8 + var12); ++var14) {
int var35 = var11.getBlockId(var32, var33 - 1, var34); int var15 = var11.getBlockId(var29, var13 - 1, var14);
if(var35 > 0 && var11.getBlockLightValue(var32, var33, var34) > 3) { if(var15 > 0 && var11.getBlockLightValue(var29, var13, var14) > 3) {
this.renderShadowOnBlock(Block.blocksList[var35], var2, var4, var6, var32, var33, var34, var8, var12, var25, var27, var29); Block var16 = Block.blocksList[var15];
Tessellator var25 = Tessellator.instance;
var34 = (var9 - (var7 - (float)var13) / 2.0F) * 0.5F * var27.renderManager.worldObj.getLightBrightness(var29, var13, var14);
if(var34 >= 0.0F) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, var34);
var25.startDrawingQuads();
var34 = (float)var29 + var16.minX;
var18 = (float)var29 + var16.maxX;
float var20 = (float)var13 + var16.minY;
float var21 = (float)var14 + var16.minZ;
var36 = (float)var14 + var16.maxZ;
float var22 = (var6 - var34) / 2.0F / var12 + 0.5F;
float var17 = (var6 - var18) / 2.0F / var12 + 0.5F;
float var23 = (var8 - var21) / 2.0F / var12 + 0.5F;
var19 = (var8 - var36) / 2.0F / var12 + 0.5F;
var25.addVertexWithUV(var34, var20, var21, var22, var23);
var25.addVertexWithUV(var34, var20, var36, var22, var19);
var25.addVertexWithUV(var18, var20, var36, var17, var19);
var25.addVertexWithUV(var18, var20, var21, var17, var23);
var25.draw();
}
} }
} }
} }
} }
var31.draw();
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_BLEND);
GL11.glDepthMask(true); GL11.glDepthMask(true);
} }
private World getWorldFromRenderManager() {
return this.renderManager.worldObj;
}
private void renderShadowOnBlock(Block var1, double var2, double var4, double var6, int var8, int var9, int var10, float var11, float var12, double var13, double var15, double var17) {
Tessellator var19 = Tessellator.instance;
if(var1.renderAsNormalBlock()) {
double var20 = ((double)var11 - (var4 - ((double)var9 + var15)) / 2.0D) * 0.5D * (double)this.getWorldFromRenderManager().getLightBrightness(var8, var9, var10);
if(var20 >= 0.0D) {
if(var20 > 1.0D) {
var20 = 1.0D;
}
var19.setColorRGBA_F(1.0F, 1.0F, 1.0F, (float)var20);
double var22 = (double)var8 + var1.minX + var13;
double var24 = (double)var8 + var1.maxX + var13;
double var26 = (double)var9 + var1.minY + var15 + 1.0D / 64.0D;
double var28 = (double)var10 + var1.minZ + var17;
double var30 = (double)var10 + var1.maxZ + var17;
float var32 = (float)((var2 - var22) / 2.0D / (double)var12 + 0.5D);
float var33 = (float)((var2 - var24) / 2.0D / (double)var12 + 0.5D);
float var34 = (float)((var6 - var28) / 2.0D / (double)var12 + 0.5D);
float var35 = (float)((var6 - var30) / 2.0D / (double)var12 + 0.5D);
var19.addVertexWithUV(var22, var26, var28, (double)var32, (double)var34);
var19.addVertexWithUV(var22, var26, var30, (double)var32, (double)var35);
var19.addVertexWithUV(var24, var26, var30, (double)var33, (double)var35);
var19.addVertexWithUV(var24, var26, var28, (double)var33, (double)var34);
}
}
}
public void doRenderShadowAndFire(Entity var1, float var2, float var4, float var6, float var8, float var9) {
if(Minecraft.getMinecraft().options.fancyGraphics && this.shadowSize > 0.0F) {
double var10 = this.renderManager.getDistanceToCamera(var1.posX, var1.posY, var1.posZ);
float var12 = (float)((1.0D - var10 / 256.0D) * (double)this.shadowOpaque);
if(var12 > 0.0F) {
this.renderShadow(var1, var2, var4, var6, var12, var9);
}
} }
if(var1.fire > 0) { if(var1.fire > 0) {
this.renderEntityOnFire(var1, var2, var4, var6, var9); GL11.glDisable(GL11.GL_LIGHTING);
int var26 = Block.fire.blockIndexInTexture;
var29 = (var26 & 15) << 4;
int var30 = var26 & 240;
var12 = (float)var29 / 256.0F;
float var31 = ((float)var29 + 15.99F) / 256.0F;
float var32 = (float)var30 / 256.0F;
float var33 = ((float)var30 + 15.99F) / 256.0F;
GL11.glPushMatrix();
GL11.glTranslatef(var2, var3, var4);
var34 = var1.width * 1.4F;
GL11.glScalef(var34, var34, var34);
this.loadTexture("/terrain.png");
Tessellator var35 = Tessellator.instance;
var36 = 1.0F;
var18 = 0.0F;
var19 = var1.height / var1.width;
GL11.glRotatef(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
GL11.glTranslatef(0.0F, 0.0F, 0.4F + (float)((int)var19) * 0.02F);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
var35.startDrawingQuads();
while(var19 > 0.0F) {
var35.addVertexWithUV(var36 - 0.5F, 0.0F - var18, 0.0F, var31, var33);
var35.addVertexWithUV(-0.5F, 0.0F - var18, 0.0F, var12, var33);
var35.addVertexWithUV(-0.5F, 1.4F - var18, 0.0F, var12, var32);
var35.addVertexWithUV(var36 - 0.5F, 1.4F - var18, 0.0F, var31, var32);
--var19;
--var18;
var36 *= 0.9F;
GL11.glTranslatef(0.0F, 0.0F, -0.04F);
}
var35.draw();
GL11.flipLightMatrix();
GL11.glPopMatrix();
GL11.flipLightMatrix();
GL11.glEnable(GL11.GL_LIGHTING);
} }
} }

View File

@ -91,11 +91,11 @@ public final class RenderManager {
this.renderEntityWithPosYaw(var1, var3, var4, var5, var6, var2); this.renderEntityWithPosYaw(var1, var3, var4, var5, var6, var2);
} }
public void renderEntityWithPosYaw(Entity var1, float var2, float var4, float var6, float var8, float var9) { public final void renderEntityWithPosYaw(Entity var1, float var2, float var3, float var4, float var5, float var6) {
Render var10 = this.getEntityRenderObject(var1); Render var7 = this.getEntityRenderObject(var1);
if(var10 != null) { if(var7 != null) {
var10.doRender(var1, var2, var4, var6, var8, var9); var7.doRender(var1, var2, var3, var4, var5, var6);
var10.doRenderShadowAndFire(var1, var2, var4, var6, var8, var9); var7.renderShadow(var1, var2, var3, var4, var6);
} }
} }

View File

@ -1,11 +1,5 @@
package net.minecraft.client.render.entity; package net.minecraft.client.render.entity;
import java.nio.FloatBuffer;
import org.lwjgl.GLAllocation;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelBiped; import net.minecraft.client.model.ModelBiped;
import net.minecraft.game.entity.Entity; import net.minecraft.game.entity.Entity;
import net.minecraft.game.entity.EntityLiving; import net.minecraft.game.entity.EntityLiving;
@ -14,7 +8,6 @@ import net.minecraft.game.entity.player.InventoryPlayer;
import net.minecraft.game.item.Item; import net.minecraft.game.item.Item;
import net.minecraft.game.item.ItemArmor; import net.minecraft.game.item.ItemArmor;
import net.minecraft.game.item.ItemStack; import net.minecraft.game.item.ItemStack;
import net.minecraft.game.physics.Vec3D;
public final class RenderPlayer extends RenderLiving { public final class RenderPlayer extends RenderLiving {
private ModelBiped modelBipedMain = (ModelBiped)this.mainModel; private ModelBiped modelBipedMain = (ModelBiped)this.mainModel;
@ -27,9 +20,7 @@ public final class RenderPlayer extends RenderLiving {
} }
private void renderPlayer(EntityPlayer var1, float var2, float var3, float var4, float var5, float var6) { private void renderPlayer(EntityPlayer var1, float var2, float var3, float var4, float var5, float var6) {
Minecraft.getMinecraft().setLighting(true);
super.a(var1, var2, var3 - var1.yOffset, var4, var5, var6); super.a(var1, var2, var3 - var1.yOffset, var4, var5, var6);
Minecraft.getMinecraft().setLighting(false);
} }
public final void drawFirstPersonHand() { public final void drawFirstPersonHand() {

View File

@ -27,7 +27,9 @@ import net.minecraft.game.level.block.tileentity.TileEntityFurnace;
public class LevelLoader { public class LevelLoader {
public final World load() { public final World load() {
String[] randomText = new String[]{"Hi from PeytonPlayz585", "You Eagler!", "Setting up World", ":)", "Isn't Indev the best version?", "I hate Microsoft!", "Notch is the best!", "PeytonPlayz585!", "Random text lol...", "Spam ping Winix!", "Ghost ping Winix!", "DM Winix for no reason!", "Spam ping Winix lol!", "Ghost ping Winix!", "DM Winix for no reason!", "PeytonPlayz585's Birthday is 10/11", "Yee!", "WebGL 2.0!", "ShadowCraft!"};
Minecraft.getMinecraft().loadingScreen.displayProgressMessage("Loading level"); Minecraft.getMinecraft().loadingScreen.displayProgressMessage("Loading level");
Minecraft.getMinecraft().loadingScreen.displayLoadingString(randomText[(int)(Math.random() * (double)randomText.length)]);
Minecraft.getMinecraft().loadingScreen.setLoadingProgress(25); Minecraft.getMinecraft().loadingScreen.setLoadingProgress(25);
try { try {

View File

@ -937,8 +937,7 @@ public class WebGL {
for(int i = 0; i < pixels.length; ++i) { for(int i = 0; i < pixels.length; ++i) {
pixels[i] = (pxls.get(i * 4) << 16) | (pxls.get(i * 4 + 1) << 8) | pxls.get(i * 4 + 2) | (pxls.get(i * 4 + 3) << 24); pixels[i] = (pxls.get(i * 4) << 16) | (pxls.get(i * 4 + 1) << 8) | pxls.get(i * 4 + 2) | (pxls.get(i * 4 + 3) << 24);
} }
IntBuffer buffer = IntBuffer.wrap(pixels); ret.complete(new MinecraftImage(pixels, pxlsDat.getWidth(), pxlsDat.getHeight(), true));
ret.complete(new MinecraftImage(buffer, pxlsDat.getWidth(), pxlsDat.getHeight(), true));
} }
}); });
toLoad.addEventListener("error", new EventListener<Event>() { toLoad.addEventListener("error", new EventListener<Event>() {