Fix lighting (Mostly)

This commit is contained in:
PeytonPlayz595 2023-12-17 09:31:22 -05:00
parent 8250da4ba0
commit 106c876660
13 changed files with 400 additions and 326 deletions

View File

@ -6,12 +6,7 @@
<attribute name="gradle_used_by_scope" value="main,test"/>
</attributes>
</classpathentry>
<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.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
<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"/>
</classpath>

View File

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

BIN
jars/jzliib/jzlib-1.1.3.jar Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

659
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>
<html>
<head>
<title>Main page</title>
<title>Indev</title>
<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>

View File

@ -1,5 +1,6 @@
package net.minecraft.client;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import net.PeytonPlayz585.storage.LevelStorageManager;
@ -35,9 +36,11 @@ import net.minecraft.game.level.World;
import net.minecraft.game.level.block.Block;
import net.minecraft.game.level.generator.LevelGenerator;
import net.minecraft.game.physics.MovingObjectPosition;
import net.minecraft.game.physics.Vec3D;
import util.IProgressUpdate;
import org.lwjgl.BufferUtils;
import org.lwjgl.GLAllocation;
import org.lwjgl.opengl.GL11;
public final class Minecraft implements Runnable {
@ -697,4 +700,32 @@ public final class Minecraft implements Runnable {
public static Minecraft getMinecraft() {
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

@ -2,14 +2,19 @@ package net.minecraft.client.render;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.util.HashMap;
import org.lwjgl.BufferUtils;
import org.lwjgl.GLAllocation;
import org.lwjgl.opengl.GL11;
import net.minecraft.game.physics.Vec3D;
import net.PeytonPlayz585.minecraft.MinecraftImage;
import net.minecraft.client.GameSettings;
import net.minecraft.client.Minecraft;
public class RenderEngine {
@ -131,14 +136,16 @@ public class RenderEngine {
}
public static void bindTexture(int i) {
Minecraft.getMinecraft().setLighting(true);
if (i < 0) {
Minecraft.getMinecraft().setLighting(false);
return;
} else {
GL11.glBindTexture(3553 /* GL_TEXTURE_2D */, i);
Minecraft.getMinecraft().setLighting(false);
return;
}
}
private HashMap<String, Integer> textureMap;
private HashMap<Integer, MinecraftImage> textureNameToImageMap;
private IntBuffer singleIntBuffer;

View File

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

View File

@ -1,5 +1,11 @@
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.game.entity.Entity;
import net.minecraft.game.entity.EntityLiving;
@ -8,6 +14,7 @@ import net.minecraft.game.entity.player.InventoryPlayer;
import net.minecraft.game.item.Item;
import net.minecraft.game.item.ItemArmor;
import net.minecraft.game.item.ItemStack;
import net.minecraft.game.physics.Vec3D;
public final class RenderPlayer extends RenderLiving {
private ModelBiped modelBipedMain = (ModelBiped)this.mainModel;
@ -20,7 +27,9 @@ public final class RenderPlayer extends RenderLiving {
}
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);
Minecraft.getMinecraft().setLighting(false);
}
public final void drawFirstPersonHand() {