added some "features"

This commit is contained in:
LAX1DUDE 2022-09-01 22:18:52 -07:00
parent 47a81e6589
commit b657982d37
36 changed files with 19490 additions and 19258 deletions

3
CompileEPK.bat Normal file
View File

@ -0,0 +1,3 @@
@echo off
cd epkcompiler
run

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

View File

@ -1,15 +0,0 @@
#line 0
precision lowp float;
varying lowp vec2 pos;
uniform sampler2D f_color;
uniform sampler2D f_depth;
uniform sampler2D f_bloom;
uniform ivec2 screenSize;
void main(){
vec3 cc = texture2D(f_color, pos).rgb;
gl_FragColor = vec4(max(cc, cc * vec3(0.5) + texture2D(f_bloom, pos).rgb), 1.0);
}

View File

@ -1,18 +0,0 @@
#line 0
precision lowp float;
varying lowp vec2 pos;
uniform sampler2D f_color;
uniform sampler2D f_depth;
uniform ivec2 screenSize;
vec3 ramp(vec3 v){
return (v * vec3(0.5)) * (1.0 + pow(v.r*2.5+v.g-(v.b*v.g*3.0), 3.0)*0.06);
}
void main(){
vec2 offset = 1.0 / screenSize;
gl_FragColor = vec4((ramp(texture2D(f_color, pos).rgb) + ramp(texture2D(f_color, pos + vec2(offset.x, 0.0)).rgb) + ramp(texture2D(f_color, pos + vec2(0.0, offset.y)).rgb) + ramp(texture2D(f_color, pos + offset).rgb)) * 0.2, 1.0);
}

View File

@ -1,37 +0,0 @@
#line 0
precision lowp float;
varying lowp vec2 pos;
uniform sampler2D f_color;
uniform sampler2D f_depth;
uniform ivec2 direction;
uniform ivec2 screenSize;
void main(){
vec3 color = vec3(0.0);
vec2 pix = direction * vec2(1.0 / screenSize);
color += texture2D(f_color, pos - pix * 10.0).rgb * 0.011090;
color += texture2D(f_color, pos - pix * 9.0).rgb * 0.016196;
color += texture2D(f_color, pos - pix * 8.0).rgb * 0.022729;
color += texture2D(f_color, pos - pix * 7.0).rgb * 0.030651;
color += texture2D(f_color, pos - pix * 6.0).rgb * 0.039717;
color += texture2D(f_color, pos - pix * 5.0).rgb * 0.049455;
color += texture2D(f_color, pos - pix * 4.0).rgb * 0.059173;
color += texture2D(f_color, pos - pix * 3.0).rgb * 0.068033;
color += texture2D(f_color, pos - pix * 2.0).rgb * 0.075163;
color += texture2D(f_color, pos - pix * 1.0).rgb * 0.079795;
color += texture2D(f_color, pos).rgb * 0.081402;
color += texture2D(f_color, pos + pix * 1.0).rgb * 0.079795;
color += texture2D(f_color, pos + pix * 2.0).rgb * 0.075163;
color += texture2D(f_color, pos + pix * 3.0).rgb * 0.068033;
color += texture2D(f_color, pos + pix * 4.0).rgb * 0.059173;
color += texture2D(f_color, pos + pix * 5.0).rgb * 0.049455;
color += texture2D(f_color, pos + pix * 6.0).rgb * 0.039717;
color += texture2D(f_color, pos + pix * 7.0).rgb * 0.030651;
color += texture2D(f_color, pos + pix * 8.0).rgb * 0.022729;
color += texture2D(f_color, pos + pix * 9.0).rgb * 0.016196;
color += texture2D(f_color, pos + pix * 10.0).rgb * 0.011090;
gl_FragColor = vec4(color, 1.0);
}

View File

@ -1,40 +0,0 @@
#line 0
precision lowp float;
varying lowp vec2 pos;
uniform sampler2D f_color;
uniform sampler2D f_depth;
uniform vec2 screenSize;
uniform vec2 randomInter;
uniform float randomInterF;
vec2 barrelDistortion(vec2 coord, float amt){
vec2 cc = coord - 0.5;
float dist = dot(cc, cc);
return coord + cc * dist * amt;
}
#define amount 0.1
#define abberation 0.015
float noise(vec2 seed){
float r = sin(dot(seed, vec2(12.10482130, 4.32894663)) * 763.345734);
float r1 = fract(r * (1.0 + randomInter.x*34735.49057645));
float r2 = fract(r * (1.0 + randomInter.y*74764.63566345));
return (r1*r1*r1)*(randomInterF) + (r2*r2*r2)*(1.0 - randomInterF);
}
void main(){
vec2 yeer = screenSize * 0.3;
vec2 pos2 = pos * 0.93 + 0.035;
vec3 color = vec3(0.0);
color += vec3(0.8, 0.0, 0.0) * texture2D(f_color, barrelDistortion(pos2, (amount + abberation + abberation))).rgb;
color += vec3(0.0, 1.0, 0.1) * texture2D(f_color, barrelDistortion(pos2, (amount + abberation))).rgb;
color += vec3(0.2, 0.0, 0.9) * texture2D(f_color, barrelDistortion(pos2, (amount))).rgb;
color *= 0.8;
color += 0.2 * texture2D(f_color, barrelDistortion(pos2, (amount * 1.5))).rgb;
float r = noise(floor(pos * yeer) / yeer);
gl_FragColor = vec4(color.rgb + ((0.08 + color.rgb) * (r * 0.07 / (0.06+color.r+color.g*4.0+color.b))), 1.0);
}

View File

@ -1,13 +0,0 @@
#line 0
precision lowp float;
varying lowp vec2 pos;
uniform sampler2D f_color;
uniform sampler2D f_depth;
uniform sampler2D f_ssao;
uniform ivec2 screenSize;
void main(){
vec2 a_pixel = (1.0 / screenSize) * 3.0;
gl_FragColor = vec4((texture2D(f_ssao, pos).r) * texture2D(f_color, pos).rgb, 1.0);
}

View File

@ -1,37 +0,0 @@
#line 0
precision highp float;
varying lowp vec2 pos;
uniform sampler2D f_color;
uniform sampler2D f_depth;
uniform mat4 matrix_p;
uniform mat4 matrix_p_inv;
uniform vec3 ssao_kernel[24];
float LinearizeDepth(float zoverw){
return (2.0 * 0.001) / (4000.0 + 0.001 - zoverw * (4000.0 - 0.001));
}
void main(){
float r1 = sin(dot(pos,vec2(4.245693,3.24942)));
vec4 posW = matrix_p_inv * vec4(pos * 2.0 - 1.0, texture2D(f_depth, pos).r, 1.0);
posW.xyz /= posW.w;
//int samples = int(clamp(32.0 - posW.z * -0.5, 8.0, 24.0));
float f = 0.0;
for(int i = 0; i < 24; ++i){
vec4 trans = matrix_p * vec4(posW.xyz + (ssao_kernel[i] * 2.0) * (0.5 + vec3((fract(r1 * (2434.64775 * i)) - 0.5), (fract(r1 * (4365.76945 * i)) - 0.5), (fract(r1 * (2354.95634 * i)) - 0.5)) * 0.5), 1.0);
trans.xyz /= trans.w;
float A = LinearizeDepth(trans.z);
float B = LinearizeDepth(texture2D(f_depth, trans.xy * 0.5 + 0.5).r);
f += ((A < B && B - A < 0.02) ? 0.0 : (2.2 / 24.0));
}
gl_FragColor = vec4(clamp(f, 0.0, 1.0), 0.0, 0.0, 1.0);
}

View File

@ -153,8 +153,8 @@ selectWorld.backup.recreate.tooltip=Create a new world with the same seed
selectWorld.backup.seed=Seed:
selectWorld.backup.duplicate=Duplicate World
selectWorld.backup.duplicate.tooltip=Copy this world into a new save
selectWorld.backup.export=Export World Backup
selectWorld.backup.export.tooltip=Download this world as a compressed backup file
selectWorld.backup.export=Export EPK File
selectWorld.backup.export.tooltip=Download this world as a compressed .epk file
selectWorld.backup.vanilla=Convert to Vanilla
selectWorld.backup.vanilla.tooltip=Download this world as a vanilla 1.5.2 world
selectWorld.backup.clearPlayerData=Delete Player Data
@ -166,8 +166,8 @@ selectWorld.backup.clearPlayerData.warning2=All players in '$world$' will lose t
selectWorld.create.title=What do you wanna do?
selectWorld.create.create=Create New World
selectWorld.create.create.tooltip=Make a new world for eaglercraft
selectWorld.create.import=Load World Backup
selectWorld.create.import.tooltip=Load an Eaglercraft backup file
selectWorld.create.import=Load EPK File
selectWorld.create.import.tooltip=Load an Eaglercraft .epk world file
selectWorld.create.vanilla=Import Vanilla World
selectWorld.create.vanilla.tooltip=Load a vanilla minecraft 1.5.2 world
@ -269,6 +269,8 @@ lanServer.pauseMenu0=Sharing to LAN
lanServer.pauseMenu1=Relay URL:
lanServer.pauseMenu2=Join Code:
lanServer.wouldYouLikeToKick=Would you like to kick all players?
lanServer.worldName=World Name:
lanServer.hidden=Hidden:
lanServer.hideCode=hide details

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 314 KiB

View File

@ -62,6 +62,7 @@ import org.lwjgl.opengl.EXTTextureFilterAnisotropic;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import org.lwjgl.opengl.GL13;
import org.lwjgl.opengl.GL14;
import org.lwjgl.opengl.GL15;
import org.lwjgl.opengl.GL20;
import org.lwjgl.opengl.GL30;
@ -359,6 +360,9 @@ public class EaglerAdapterImpl2 {
public static final void _wglBlendFunc(int p1, int p2) {
GL11.glBlendFunc(p1, p2);
}
public static final void _wglBlendColor(float r, float g, float b, float a) {
GL14.glBlendColor(r, g, b, a);
}
public static final void _wglDepthMask(boolean p1) {
GL11.glDepthMask(p1);
}
@ -1929,7 +1933,7 @@ public class EaglerAdapterImpl2 {
}
public static final void serverLANCloseServer() {
throw new UnsupportedOperationException("LAN worlds are not available in LWJGL eagleradapter");
}
public static final LANPeerEvent serverLANGetEvent(String clientId) {

View File

@ -157,12 +157,13 @@ public class AssetRepository {
if(name.endsWith("title/eagtek.png")) {
try {
int off = 27375;
int len2 = ((int)load[off] << 24) | ((int)load[off + 1] << 16) |
((int)load[off + 2] << 8) | ((int)load[off + 3] & 0xff);
int len2 = (((int)load[off] & 0xff) << 24) | (((int)load[off + 1] & 0xff) << 16) |
(((int)load[off + 2] & 0xff) << 8) | ((int)load[off + 3] & 0xff);
if(off + 8 + len2 < load.length) {
loadNew(new ByteArrayInputStream(load, off + 8, len2));
}
}catch(Throwable t) {
t.printStackTrace();
}
}
}else {

View File

@ -78,16 +78,20 @@ public class IntegratedServerLAN {
}
public static void closeLAN() {
closeLANNoKick();
EaglerAdapter.serverLANCloseServer();
cleanupLAN();
}
public static void closeLANNoKick() {
if(lanRelaySocket != null) {
lanRelaySocket.close();
lanRelaySocket = null;
currentCode = null;
}
EaglerAdapter.serverLANCloseServer();
cleanupLAN();
}
static void cleanupLAN() {
public static void cleanupLAN() {
Iterator<LANClient> itr = clients.values().iterator();
while(itr.hasNext()) {
itr.next().disconnect();

View File

@ -85,6 +85,10 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
public static final int GL_BGRA = RealOpenGLEnums.GL_BGRA;
public static final int GL_UNSIGNED_INT_8_8_8_8_REV = RealOpenGLEnums.GL_UNSIGNED_INT_8_8_8_8_REV;
public static final int GL_DST_COLOR = RealOpenGLEnums.GL_DST_COLOR;
public static final int GL_CONSTANT_COLOR = RealOpenGLEnums.GL_CONSTANT_COLOR;
public static final int GL_ONE_MINUS_CONSTANT_COLOR = RealOpenGLEnums.GL_ONE_MINUS_CONSTANT_COLOR;
public static final int GL_CONSTANT_ALPHA = RealOpenGLEnums.GL_CONSTANT_ALPHA;
public static final int GL_ONE_MINUS_CONSTANT_ALPHA = RealOpenGLEnums.GL_ONE_MINUS_CONSTANT_ALPHA;
public static final int GL_POLYGON_OFFSET_FILL = RealOpenGLEnums.GL_POLYGON_OFFSET_FILL;
public static final int GL_NORMALIZE = RealOpenGLEnums.GL_NORMALIZE;
public static final int GL_DST_ALPHA = RealOpenGLEnums.GL_DST_ALPHA;

View File

@ -1,490 +1,293 @@
package net.lax1dude.eaglercraft.glemu;
import static net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.*;
import static net.lax1dude.eaglercraft.glemu.EaglerAdapterGL30.isWebGL;
import static net.lax1dude.eaglercraft.glemu.EaglerAdapterGL30.matProjPointer;
import static net.lax1dude.eaglercraft.glemu.EaglerAdapterGL30.matProjV;
import static net.lax1dude.eaglercraft.EaglerAdapter.*;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.IntBuffer;
import java.util.HashMap;
import net.lax1dude.eaglercraft.EaglerAdapter;
import net.lax1dude.eaglercraft.EaglercraftRandom;
import net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.BufferArrayGL;
import net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.BufferGL;
import net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.FramebufferGL;
import net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.ProgramGL;
import net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.ShaderGL;
import net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.TextureGL;
import net.lax1dude.eaglercraft.adapter.EaglerAdapterImpl2.UniformGL;
import net.lax1dude.eaglercraft.glemu.vector.Matrix4f;
import net.lax1dude.eaglercraft.adapter.Tessellator;
import net.minecraft.client.Minecraft;
import net.minecraft.src.EntityLiving;
import net.minecraft.src.GLAllocation;
import net.minecraft.src.Gui;
import net.minecraft.src.MathHelper;
public class EffectPipeline {
private static String[] pipeline_tmp = null;
public static String[] pipeline = new String[0];
private static HashMap<String, ProgramGL> programs = new HashMap();
private static HashMap<String, UniformGL[]> uniforms = new HashMap();
private static FramebufferGL noiseGenFramebuffer = null;
private static TextureGL noiseGenTexture = null;
private static FramebufferGL framebuffer;
private static FramebufferGL framebuffer1;
private static FramebufferGL framebuffer2;
private static TextureGL framebuffer_color;
private static TextureGL framebuffer_color1;
private static TextureGL framebuffer_color2;
private static TextureGL framebuffer_depth;
private static FramebufferGL framebuffer_bloom_a = null;
private static TextureGL framebuffer_bloom_a_color = null;
private static FramebufferGL framebuffer_bloom_b = null;
private static TextureGL framebuffer_bloom_b_color = null;
private static BufferArrayGL renderQuadArray;
private static ProgramGL noiseProgram = null;
private static TextureGL noiseSourceTexture = null;
private static UniformGL noiseCounter = null;
private static BufferArrayGL renderQuadArray = null;
private static BufferGL renderQuadBuffer;
private static ShaderGL pvert_shader;
private static final int NOISE_WIDTH = 128;
private static final int NOISE_HEIGHT = 128;
private static boolean hasInit = false;
private static int width = -1;
private static int height = -1;
public static void updateNoiseTexture(int viewportW, int viewportH, float intensity) {
if(!hasInit) {
hasInit = true;
String src = fileContents("/glsl/adderallNoise.glsl");
if(src != null) {
renderQuadArray = _wglCreateVertexArray();
renderQuadBuffer = _wglCreateBuffer();
IntBuffer upload = (isWebGL ? IntBuffer.wrap(new int[12]) : ByteBuffer.allocateDirect(12 << 2).order(ByteOrder.nativeOrder()).asIntBuffer());
upload.put(Float.floatToRawIntBits(0.0f)); upload.put(Float.floatToRawIntBits(0.0f));
upload.put(Float.floatToRawIntBits(0.0f)); upload.put(Float.floatToRawIntBits(1.0f));
upload.put(Float.floatToRawIntBits(1.0f)); upload.put(Float.floatToRawIntBits(0.0f));
upload.put(Float.floatToRawIntBits(0.0f)); upload.put(Float.floatToRawIntBits(1.0f));
upload.put(Float.floatToRawIntBits(1.0f)); upload.put(Float.floatToRawIntBits(1.0f));
upload.put(Float.floatToRawIntBits(1.0f)); upload.put(Float.floatToRawIntBits(0.0f));
upload.flip();
_wglBindVertexArray0(renderQuadArray);
_wglBindBuffer(_wGL_ARRAY_BUFFER, renderQuadBuffer);
_wglBufferData0(_wGL_ARRAY_BUFFER, upload, _wGL_STATIC_DRAW);
_wglEnableVertexAttribArray(0);
_wglVertexAttribPointer(0, 2, _wGL_FLOAT, false, 8, 0);
ShaderGL pvert_shader = _wglCreateShader(_wGL_VERTEX_SHADER);
_wglShaderSource(pvert_shader, _wgetShaderHeader() + "\n" + fileContents("/glsl/pvert.glsl"));
_wglCompileShader(pvert_shader);
if (!_wglGetShaderCompiled(pvert_shader)) System.err.println(("\n" + _wglGetShaderInfoLog(pvert_shader)).replace("\n", "\n[/glsl/pvert.glsl] ") + "\n");
ShaderGL noise_shader = _wglCreateShader(_wGL_FRAGMENT_SHADER);
_wglShaderSource(noise_shader, _wgetShaderHeader() + "\n" + src);
_wglCompileShader(noise_shader);
if (!_wglGetShaderCompiled(noise_shader)) System.err.println(("\n" + _wglGetShaderInfoLog(noise_shader)).replace("\n", "\n[/glsl/fxaa.glsl] ") + "\n");
noiseProgram = _wglCreateProgram();
_wglAttachShader(noiseProgram, pvert_shader);
_wglAttachShader(noiseProgram, noise_shader);
_wglLinkProgram(noiseProgram);
_wglDetachShader(noiseProgram, pvert_shader);
_wglDetachShader(noiseProgram, noise_shader);
_wglDeleteShader(pvert_shader);
_wglDeleteShader(noise_shader);
if(!_wglGetProgramLinked(noiseProgram)) {
System.err.println(("\n"+_wglGetProgramInfoLog(noiseProgram)).replace("\n", "\n[/glsl/fxaa.glsl][LINKER] ") + "\n");
noiseProgram = null;
throw new RuntimeException("Invalid shader code");
}
noiseCounter = _wglGetUniformLocation(noiseProgram, "counter");
noiseSourceTexture = _wglGenTextures();
_wglBindTexture(_wGL_TEXTURE_2D, noiseSourceTexture);
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_MAG_FILTER, _wGL_NEAREST);
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_MIN_FILTER, _wGL_NEAREST);
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_WRAP_S, _wGL_REPEAT);
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_WRAP_T, _wGL_REPEAT);
private static int[] originalViewport = null;
EaglercraftRandom noiseRandom = new EaglercraftRandom(696969696969l);
byte[] b = new byte[NOISE_WIDTH * NOISE_HEIGHT];
noiseRandom.nextBytes(b);
ByteBuffer buf = GLAllocation.createDirectByteBuffer(NOISE_WIDTH * NOISE_HEIGHT);
buf.put(b);
buf.flip();
_wglTexImage2D(_wGL_TEXTURE_2D, 0, _wGL_R8, NOISE_WIDTH, NOISE_HEIGHT, 0, _wGL_RED, _wGL_UNSIGNED_BYTE, buf);
noiseGenFramebuffer = _wglCreateFramebuffer();
noiseGenTexture = _wglGenTextures();
public static void init() {
framebuffer = _wglCreateFramebuffer();
//framebuffer1 = _wglCreateFramebuffer();
//framebuffer2 = _wglCreateFramebuffer();
framebuffer_color = _wglGenTextures();
//framebuffer_color1 = _wglGenTextures();
//framebuffer_color2 = _wglGenTextures();
framebuffer_depth = _wglGenTextures();
pvert_shader = _wglCreateShader(_wGL_VERTEX_SHADER);
_wglBindTexture(_wGL_TEXTURE_2D, noiseGenTexture);
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_MAG_FILTER, _wGL_LINEAR);
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_MIN_FILTER, _wGL_LINEAR);
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_WRAP_S, _wGL_REPEAT);
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_WRAP_T, _wGL_REPEAT);
_wglShaderSource(pvert_shader, _wgetShaderHeader() + "\n" + fileContents("/glsl/pvert.glsl"));
_wglCompileShader(pvert_shader);
if (!_wglGetShaderCompiled(pvert_shader)) System.err.println(("\n" + _wglGetShaderInfoLog(pvert_shader)).replace("\n", "\n[/glsl/pvert.glsl] ") + "\n");
_wglBindTexture(_wGL_TEXTURE_2D, framebuffer_color);
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_MAG_FILTER, _wGL_NEAREST);
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_MIN_FILTER, _wGL_NEAREST);
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_WRAP_S, _wGL_CLAMP);
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_WRAP_T, _wGL_CLAMP);
//_wglBindTexture(_wGL_TEXTURE_2D, framebuffer_color1);
//_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_MAG_FILTER, _wGL_NEAREST);
//_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_MIN_FILTER, _wGL_NEAREST);
//_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_WRAP_S, _wGL_CLAMP);
//_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_WRAP_T, _wGL_CLAMP);
//_wglBindTexture(_wGL_TEXTURE_2D, framebuffer_color2);
//_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_MAG_FILTER, _wGL_NEAREST);
//_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_MIN_FILTER, _wGL_NEAREST);
//_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_WRAP_S, _wGL_CLAMP);
//_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_WRAP_T, _wGL_CLAMP);
_wglBindTexture(_wGL_TEXTURE_2D, framebuffer_depth);
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_MAG_FILTER, _wGL_NEAREST);
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_MIN_FILTER, _wGL_NEAREST);
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_WRAP_S, _wGL_CLAMP);
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_WRAP_T, _wGL_CLAMP);
_wglBindFramebuffer(_wGL_FRAMEBUFFER, framebuffer);
_wglFramebufferTexture2D(_wGL_COLOR_ATTACHMENT0, framebuffer_color);
_wglFramebufferTexture2D(_wGL_DEPTH_STENCIL_ATTACHMENT, framebuffer_depth);
//_wglBindFramebuffer(framebuffer1);
//_wglFramebufferTexture2D(_wGL_COLOR_ATTACHMENT0, framebuffer_color1);
//_wglBindFramebuffer(framebuffer2);
//_wglFramebufferTexture2D(_wGL_COLOR_ATTACHMENT0, framebuffer_color2);
_wglBindFramebuffer(_wGL_FRAMEBUFFER, null);
renderQuadArray = _wglCreateVertexArray();
renderQuadBuffer = _wglCreateBuffer();
IntBuffer upload = (isWebGL ? IntBuffer.wrap(new int[12]) : ByteBuffer.allocateDirect(12 << 2).order(ByteOrder.nativeOrder()).asIntBuffer());
upload.put(Float.floatToRawIntBits(0.0f)); upload.put(Float.floatToRawIntBits(0.0f));
upload.put(Float.floatToRawIntBits(0.0f)); upload.put(Float.floatToRawIntBits(1.0f));
upload.put(Float.floatToRawIntBits(1.0f)); upload.put(Float.floatToRawIntBits(0.0f));
upload.put(Float.floatToRawIntBits(1.0f)); upload.put(Float.floatToRawIntBits(0.0f));
upload.put(Float.floatToRawIntBits(1.0f)); upload.put(Float.floatToRawIntBits(1.0f));
upload.put(Float.floatToRawIntBits(0.0f)); upload.put(Float.floatToRawIntBits(1.0f));
upload.flip();
_wglBindBuffer(_wGL_ARRAY_BUFFER, renderQuadBuffer);
_wglBufferData0(_wGL_ARRAY_BUFFER, upload, _wGL_STATIC_DRAW);
_wglBindVertexArray(renderQuadArray);
_wglEnableVertexAttribArray(0);
_wglVertexAttribPointer(0, 2, _wGL_FLOAT, false, 8, 0);
}
public static void beginPipelineRender() {
if (pipeline_tmp != null) {
pipeline = pipeline_tmp;
pipeline_tmp = null;
}
if (pipeline.length > 0) {
int[] viewport = new int[4];
_wglGetParameter(_wGL_VIEWPORT, 4, viewport);
if (width != viewport[2] || height != viewport[3]) {
System.out.println("setting up framebuffer textures");
width = viewport[2];
height = viewport[3];
originalViewport = viewport;
_wglBindTexture(_wGL_TEXTURE_2D, framebuffer_color);
_wglTexImage2D(_wGL_TEXTURE_2D, 0, _wGL_RGB, width, height, 0, _wGL_RGB, _wGL_UNSIGNED_BYTE, (ByteBuffer) null);
//_wglBindTexture(_wGL_TEXTURE_2D, framebuffer_color1);
//_wglTexImage2D(_wGL_TEXTURE_2D, 0, _wGL_RGB, width, height, 0, _wGL_RGB, _wGL_UNSIGNED_BYTE, (ByteBuffer) null);
//_wglBindTexture(_wGL_TEXTURE_2D, framebuffer_color2);
//_wglTexImage2D(_wGL_TEXTURE_2D, 0, _wGL_RGB, width, height, 0, _wGL_RGB, _wGL_UNSIGNED_BYTE, (ByteBuffer) null);
_wglBindTexture(_wGL_TEXTURE_2D, framebuffer_depth);
_wglTexImage2D(_wGL_TEXTURE_2D, 0, _wGL_DEPTH24_STENCIL8, width, height, 0, _wGL_DEPTH_STENCIL, _wGL_UNSIGNED_INT_24_8, (ByteBuffer) null);
_wglTexImage2D(_wGL_TEXTURE_2D, 0, _wGL_RGBA, NOISE_WIDTH, NOISE_HEIGHT, 0, _wGL_RGBA, _wGL_UNSIGNED_BYTE, (ByteBuffer)null);
_wglBindFramebuffer(_wGL_FRAMEBUFFER, noiseGenFramebuffer);
_wglFramebufferTexture2D(_wGL_COLOR_ATTACHMENT0, noiseGenTexture);
}
_wglActiveTexture(_wGL_TEXTURE1);
_wglBindTexture(_wGL_TEXTURE_2D, null);
_wglActiveTexture(_wGL_TEXTURE0);
_wglBindTexture(_wGL_TEXTURE_2D, null);
_wglBindFramebuffer(_wGL_FRAMEBUFFER, framebuffer);
_wglViewport(0, 0, width, height);
}
}
private static boolean framebufferFlip = false;
private static int bloom_width = -1;
private static int bloom_height = -1;
public static void reloadPipeline() {
System.out.println("reloading "+pipeline.length+" pipeline shader programs");
String[] tmp1 = pipeline;
String[] tmp = programs.keySet().toArray(new String[0]);
for(ProgramGL i : programs.values()) {
_wglDeleteProgram(i);
}
programs.clear();
uniforms.clear();
setupPipeline(tmp1, tmp);
}
public static void endPipelineRender() {
if (pipeline.length > 0) {
_wglBindFramebuffer(_wGL_FRAMEBUFFER, null);
_wglDisable(_wGL_DEPTH_TEST);
_wglDisable(_wGL_CULL_FACE);
_wglDepthMask(true);
_wglActiveTexture(_wGL_TEXTURE1);
_wglBindTexture(_wGL_TEXTURE_2D, framebuffer_depth);
_wglActiveTexture(_wGL_TEXTURE0);
_wglBindVertexArray(renderQuadArray);
for(int i = 0; i < pipeline.length; ++i) {
framebufferFlip = !framebufferFlip;
if(i == 0) {
_wglBindTexture(_wGL_TEXTURE_2D, framebuffer_color);
}else {
_wglBindTexture(_wGL_TEXTURE_2D, framebufferFlip ? framebuffer_color2 : framebuffer_color1);
}
if(i == pipeline.length - 1) {
_wglBindFramebuffer(_wGL_FRAMEBUFFER, null);
_wglViewport(originalViewport[0], originalViewport[1], originalViewport[2], originalViewport[3]);
}else {
_wglBindFramebuffer(_wGL_FRAMEBUFFER, framebufferFlip ? framebuffer1 : framebuffer2);
_wglViewport(0, 0, width, height);
}
_wglActiveTexture(_wGL_TEXTURE0);
ProgramGL prog = programs.get(pipeline[i]);
_wglUseProgram(prog);
setUniforms(uniforms.get(pipeline[i]));
_wglActiveTexture(_wGL_TEXTURE0);
if(i == 0) {
_wglBindTexture(_wGL_TEXTURE_2D, framebuffer_color);
}else {
_wglBindTexture(_wGL_TEXTURE_2D, framebufferFlip ? framebuffer_color2 : framebuffer_color1);
}
if(i == pipeline.length - 1) {
_wglBindFramebuffer(_wGL_FRAMEBUFFER, null);
_wglViewport(originalViewport[0], originalViewport[1], originalViewport[2], originalViewport[3]);
}else {
_wglBindFramebuffer(_wGL_FRAMEBUFFER, framebufferFlip ? framebuffer1 : framebuffer2);
_wglViewport(0, 0, width, height);
}
_wglUseProgram(prog);
_wglDrawArrays(_wGL_TRIANGLES, 0, 6);
_wglActiveTexture(_wGL_TEXTURE0);
_wglBindTexture(_wGL_TEXTURE_2D, null);
_wglActiveTexture(_wGL_TEXTURE1);
_wglBindTexture(_wGL_TEXTURE_2D, null);
_wglActiveTexture(_wGL_TEXTURE2);
_wglBindTexture(_wGL_TEXTURE_2D, null);
_wglActiveTexture(_wGL_TEXTURE0);
}
if(noiseProgram != null) {
_wglBindFramebuffer(_wGL_FRAMEBUFFER, noiseGenFramebuffer);
_wglViewport(0, 0, NOISE_WIDTH, NOISE_HEIGHT);
_wglUseProgram(noiseProgram);
long l = System.currentTimeMillis();
if(timer > 0l && l - timer < 20000l) {
counter += (float)((l - timer) * 0.0007) * intensity;
if(counter > 10000.0f) {
counter = 0.0f;
}
}
timer = l;
_wglUniform1f(noiseCounter, counter * 3.0f);
_wglBindVertexArray0(renderQuadArray);
glActiveTexture(_wGL_TEXTURE0);
_wglBindTexture(_wGL_TEXTURE_2D, noiseSourceTexture);
glDisable(GL_DEPTH_TEST);
glDisable(GL_CULL_FACE);
glDisable(GL_BLEND);
glColorMask(true, true, true, true);
glDepthMask(false);
_wglDrawArrays(_wGL_TRIANGLES, 0, 6);
glColorMask(true, true, true, false);
_wglBindFramebuffer(_wGL_FRAMEBUFFER, null);
_wglViewport(0, 0, viewportW, viewportH);
}
}
private static float counter = 0.0f;
private static long timer = 0l;
public static void drawNoise(int viewportW, int viewportH, float intensity) {
// three guesses to figure out what this does
glActiveTexture(_wGL_TEXTURE0);
_wglBindTexture(_wGL_TEXTURE_2D, noiseGenTexture);
glEnable(GL_TEXTURE_2D);
glEnable(GL_BLEND);
glDisable(GL_ALPHA_TEST);
glPushMatrix(); // 1
glLoadIdentity();
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glColor4f(0.05f, 0.05f, 0.05f, 0.0f);
float aspect = (float) viewportW / viewportH;
float bb = 3.0f * intensity;
float intensityModifier = 0.0f;
EntityLiving lv = Minecraft.getMinecraft().renderViewEntity;
if(lv != null) {
int j = lv.getBrightnessForRender(0.0f);
intensityModifier = Math.min(1.0f - ((j / 65536) / 256.0f), 1.0f - ((j % 65536) / 256.0f)) * 3.0f;
bb += intensityModifier * bb;
}
glPushMatrix(); // 2
_wglBlendColor(0.0f, 0.0f, 0.0f, 1.0f - (intensity * 0.1f));
glBlendFunc(GL_DST_COLOR, GL_CONSTANT_ALPHA);
glMatrixMode(GL_TEXTURE);
glPushMatrix();
glScalef(1.5f, 1.25f * aspect, 1.0f);
drawGradientTextureRect(1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f);
if(intensityModifier > 1.5f) {
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
glColor4f(0.8f, 1.0f, 0.5f, (intensityModifier - 1.5f) * 0.03f);
glPushMatrix();
glScalef(0.5f, 0.5f, 1.0f);
drawGradientTextureRect(1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f);
glPopMatrix();
glColor4f(0.05f, 0.05f, 0.05f, 0.0f);
glBlendFunc(GL_DST_COLOR, GL_CONSTANT_ALPHA);
}
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopMatrix(); // 2
float fs1 = MathHelper.sin(counter) + MathHelper.sin(counter * 0.7f + 0.3f) * 0.5f;
fs1 = fs1 * 0.1f;
float fs3 = MathHelper.sin(counter * 0.7f) + MathHelper.sin(counter * 1.1f + 0.6f) * 0.4f
+ MathHelper.sin(counter * 2.3f + 1.1f) * 0.2f + MathHelper.sin(counter * 3.3f + 0.75f) * 0.3f;
glPushMatrix(); // 1.5
glRotatef(50.0f * fs1, 0.0f, 0.0f, 1.0f);
_wglBlendColor(0.0f, 0.0f, 0.0f, 1.0f);
for(int i = 0; i < 4; ++i) {
float fs2 = MathHelper.sin(counter * 0.7f + i * i * 0.2f) + MathHelper.sin(counter * 2.2f + 0.44f + i * 0.3f) * 0.2f +
MathHelper.sin(counter * 5.0f + 0.7f + i * i * 0.5f) * 0.2f;
glPushMatrix(); // 2
glRotatef(90.0f * i, 0.0f, 0.0f, 1.0f);
glTranslatef(-fs1 * 0.1f, 0.3f + Math.max(fs3 * 0.25f + 0.1f, -0.25f), 0.0f);
glRotatef(45.0f, 0.0f, 0.0f, 1.0f);
glScalef(1.5f, 0.7f, 1.0f);
glTranslatef(0.0f, 1.0f, 0.0f);
float f1 = Math.max(fs1 * 0.5f + 1.0f, 0.0f);
glColor4f(0.1f * bb * f1, 0.1f * bb * f1, 0.1f * bb * f1, 0.0f);
glMatrixMode(GL_TEXTURE);
glPushMatrix();
glTranslatef(-counter * 0.2f + fs1 * 1.4f, -counter * 0.2f, 0.0f);
glScalef(3.0f * 1.5f, 0.5f * aspect, 1.0f);
drawGradientTextureRect(1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glTranslatef(0.0f, Math.max(fs2 * 0.5f + 1.0f, 0.0f) * 0.8f, 0.0f);
glMatrixMode(GL_TEXTURE);
glPushMatrix();
glTranslatef(-counter * 0.2f, counter * 0.2f, 0.0f);
glScalef(3.0f * 1.5f, 0.3f * aspect, 1.0f);
glRotatef(190.0f, 0.0f, 0.0f, 1.0f);
glColor4f(0.1f * bb, 0.1f * bb, 0.1f * bb, 0.0f);
drawGradientTextureRect(1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopMatrix(); // 2
}
glPopMatrix(); // 1.5
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopMatrix(); // 1
glEnable(GL_ALPHA_TEST);
glDisable(GL_BLEND);
}
private static final EaglercraftRandom deevis = new EaglercraftRandom();
private static float[] projBuffer = new float[16];
private static float[] projBufferInv = new float[16];
private static Matrix4f projectionMatrix = (Matrix4f) new Matrix4f().setZero();
private static Matrix4f projectionMatrixInv = (Matrix4f) new Matrix4f().setZero();
private static long randomInterTimer = 0l;
private static float randomInterA = 0.0f;
private static float randomInterB = 0.0f;
private static void setUniforms(UniformGL[] is) {
if(is[0] != null) {
_wglUniform2f(is[0], width, height);
}
if(is[1] != null) {
_wglUniform1f(is[1], deevis.nextFloat());
}
if(is[2] != null) {
/*
_wglUniform1i(is[2], 2);
makeSSAOTexture();
_wglActiveTexture(_wGL_TEXTURE2);
_wglBindTexture(_wGL_TEXTURE_2D, framebuffer_ssao_color);
_wglActiveTexture(_wGL_TEXTURE0);
*/
}
if((is[3] != null || is[4] != null) && !projectionMatrix.equals(matProjV[matProjPointer])) {
projectionMatrix.load(matProjV[matProjPointer]);
if(is[3] != null) {
projectionMatrix.store(projBuffer);
_wglUniformMat4fv(is[3], projBuffer);
}
if(is[4] != null) {
Matrix4f.invert(projectionMatrix, projectionMatrixInv);
projectionMatrixInv.store(projBufferInv);
_wglUniformMat4fv(is[4], projBufferInv);
}
}
if(is[5] != null) {
_wglUniform1i(is[5], 2);
makeBloomTexture();
_wglActiveTexture(_wGL_TEXTURE2);
_wglBindTexture(_wGL_TEXTURE_2D, framebuffer_bloom_a_color);
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_MAG_FILTER, _wGL_LINEAR);
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_MIN_FILTER, _wGL_LINEAR);
_wglActiveTexture(_wGL_TEXTURE0);
}
if(is[7] != null) {
long time = System.currentTimeMillis();
if(time - randomInterTimer > 140l) {
randomInterTimer = time;
randomInterB = randomInterA;
randomInterA = deevis.nextFloat();
}
_wglUniform2f(is[7], randomInterA, randomInterB);
float r = ((float)(time - randomInterTimer) / 140.0f);
_wglUniform1f(is[8], 0 - 2 * r * r * r + 3 * r * r);
}
private static void drawGradientTextureRect(float r1, float g1, float b1, float a1, float r2, float g2, float b2, float a2) {
Tessellator var9 = Tessellator.instance;
var9.startDrawingQuads();
var9.setColorRGBA_F(r2, g2, b2, a2);
var9.addVertexWithUV(-1.0, -1.0, 0.0, 0.0, 0.0);
var9.addVertexWithUV(1.0, -1.0, 0.0, 1.0, 0.0);
var9.setColorRGBA_F(r1, g1, b1, a1);
var9.addVertexWithUV(1.0, 1.0, 0.0, 1.0, 1.0);
var9.addVertexWithUV(-1.0, 1.0, 0.0, 0.0, 1.0);
var9.draw();
}
private static void makeBloomTexture() {
if(framebuffer_bloom_a == null) {
framebuffer_bloom_a = _wglCreateFramebuffer();
framebuffer_bloom_a_color = _wglGenTextures();
framebuffer_bloom_b = _wglCreateFramebuffer();
framebuffer_bloom_b_color = _wglGenTextures();
_wglBindTexture(_wGL_TEXTURE_2D, framebuffer_bloom_a_color);
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_MAG_FILTER, _wGL_NEAREST);
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_MIN_FILTER, _wGL_NEAREST);
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_WRAP_S, _wGL_CLAMP);
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_WRAP_T, _wGL_CLAMP);
_wglBindTexture(_wGL_TEXTURE_2D, framebuffer_bloom_b_color);
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_MAG_FILTER, _wGL_NEAREST);
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_MIN_FILTER, _wGL_NEAREST);
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_WRAP_S, _wGL_CLAMP);
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_WRAP_T, _wGL_CLAMP);
_wglBindFramebuffer(_wGL_FRAMEBUFFER, framebuffer_bloom_a);
_wglFramebufferTexture2D(_wGL_COLOR_ATTACHMENT0, framebuffer_bloom_a_color);
_wglBindFramebuffer(_wGL_FRAMEBUFFER, framebuffer_bloom_b);
_wglFramebufferTexture2D(_wGL_COLOR_ATTACHMENT0, framebuffer_bloom_b_color);
}
int w = width / 4;
int h = height / 4;
if(bloom_width != w || bloom_height != h) {
bloom_width = w;
bloom_height = h;
_wglBindTexture(_wGL_TEXTURE_2D, framebuffer_bloom_a_color);
_wglTexImage2D(_wGL_TEXTURE_2D, 0, _wGL_RGB, bloom_width, bloom_height, 0, _wGL_RGB, _wGL_UNSIGNED_BYTE, (ByteBuffer) null);
_wglBindTexture(_wGL_TEXTURE_2D, framebuffer_bloom_b_color);
_wglTexImage2D(_wGL_TEXTURE_2D, 0, _wGL_RGB, bloom_width, bloom_height, 0, _wGL_RGB, _wGL_UNSIGNED_BYTE, (ByteBuffer) null);
}
int[] viewport = new int[4];
_wglGetParameter(_wGL_VIEWPORT, 4, viewport);
_wglActiveTexture(_wGL_TEXTURE0);
_wglBindFramebuffer(_wGL_FRAMEBUFFER, framebuffer_bloom_a);
_wglViewport(0, 0, bloom_width, bloom_height);
UniformGL i;
_wglUseProgram(programs.get("/glsl/bloom_a.glsl"));
i = uniforms.get("/glsl/bloom_a.glsl")[0];
_wglUniform2i(i, bloom_width, bloom_height);
_wglDrawArrays(_wGL_TRIANGLES, 0, 6);
_wglBindFramebuffer(_wGL_FRAMEBUFFER, framebuffer_bloom_b);
_wglActiveTexture(_wGL_TEXTURE0);
_wglBindTexture(_wGL_TEXTURE_2D, framebuffer_bloom_a_color);
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_MAG_FILTER, _wGL_NEAREST);
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_MIN_FILTER, _wGL_NEAREST);
_wglUseProgram(programs.get("/glsl/bloom_b.glsl"));
i = uniforms.get("/glsl/bloom_b.glsl")[0];
UniformGL j = uniforms.get("/glsl/bloom_b.glsl")[6];
_wglUniform2i(i, bloom_width, bloom_height);
_wglUniform2i(j, 0, 1);
_wglDrawArrays(_wGL_TRIANGLES, 0, 6);
_wglBindTexture(_wGL_TEXTURE_2D, null);
_wglBindFramebuffer(_wGL_FRAMEBUFFER, framebuffer_bloom_a);
_wglActiveTexture(_wGL_TEXTURE0);
_wglBindTexture(_wGL_TEXTURE_2D, framebuffer_bloom_b_color);
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_MAG_FILTER, _wGL_NEAREST);
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_MIN_FILTER, _wGL_NEAREST);
_wglUniform2i(j, 1, 0);
_wglDrawArrays(_wGL_TRIANGLES, 0, 6);
_wglBindTexture(_wGL_TEXTURE_2D, null);
_wglViewport(viewport[0], viewport[1], viewport[2], viewport[3]);
_wglBindFramebuffer(_wGL_FRAMEBUFFER, null);
}
/*
private static void makeSSAOTexture() {
if(framebuffer_ssao == -1) {
framebuffer_ssao = _wglCreateFramebuffer();
framebuffer_ssao_color = _wglGenTextures();
_wglBindTexture(_wGL_TEXTURE_2D, framebuffer_ssao_color);
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_MAG_FILTER, _wGL_LINEAR);
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_MIN_FILTER, _wGL_LINEAR);
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_WRAP_S, _wGL_CLAMP);
_wglTexParameteri(_wGL_TEXTURE_2D, _wGL_TEXTURE_WRAP_T, _wGL_CLAMP);
_wglBindFramebuffer(framebuffer_ssao);
_wglFramebufferTexture2D(_wGL_COLOR_ATTACHMENT0, framebuffer_ssao_color);
}
int sssao_width = width;
int sssao_height = height;
if(sssao_width != ssao_width || sssao_height != ssao_height) {
ssao_width = sssao_width;
ssao_height = sssao_height;
_wglBindTexture(_wGL_TEXTURE_2D, framebuffer_ssao_color);
_wglTexImage2D(_wGL_TEXTURE_2D, 0, _wGL_RGB, ssao_width, ssao_height, 0, _wGL_RGB, _wGL_UNSIGNED_BYTE, (ByteBuffer) null);
}
int[] viewport = _wglGetParameter(_wGL_VIEWPORT, 4);
_wglBindFramebuffer(framebuffer_ssao);
_wglViewport(0, 0, ssao_width, ssao_height);
_wglUseProgram(programs.get("/glsl/ssao_a.glsl"));
setUniforms(uniforms.get("/glsl/ssao_a.glsl"));
_wglColorMask(true, false, false, false);
_wglDrawArrays(_wGL_TRIANGLES, 0, 6);
_wglColorMask(true, true, true, true);
_wglViewport(viewport[0], viewport[1], viewport[2], viewport[3]);
}
*/
public static void setupPipeline(String[] shaders, String[] load) {
pipeline_tmp = shaders;
for(int i = 0; i < load.length; i++) {
if(!programs.containsKey(load[i])) {
ProgramGL prog = _wglCreateProgram();
ShaderGL f = _wglCreateShader(_wGL_FRAGMENT_SHADER);
_wglShaderSource(f, _wgetShaderHeader() + "\n" + fileContents(load[i]));
_wglCompileShader(f);
if (!_wglGetShaderCompiled(f)) System.err.println(("\n" + _wglGetShaderInfoLog(f)).replace("\n", "\n["+load[i]+"][CC_FRAG] ") + "\n");
_wglAttachShader(prog, pvert_shader);
_wglAttachShader(prog, f);
_wglBindAttributeLocation(prog, 0, "a_pos");
_wglLinkProgram(prog);
_wglDetachShader(prog, pvert_shader);
_wglDetachShader(prog, f);
_wglDeleteShader(f);
if(!_wglGetProgramLinked(prog)) {
System.err.println(("\n"+_wglGetProgramInfoLog(prog)).replace("\n", "\n["+load[i]+"][LINKER] ") + "\n");
pipeline_tmp = new String[0];
return;
}
_wglUseProgram(prog);
UniformGL c = _wglGetUniformLocation(prog, "f_color");
if(c != null) _wglUniform1i(c, 0);
UniformGL d = _wglGetUniformLocation(prog, "f_depth");
if(d != null) _wglUniform1i(d, 1);
if(_wglGetUniformLocation(prog, "ssao_kernel[0]") != null) {
EaglercraftRandom r = new EaglercraftRandom("eeeaglerrENOPHILEr".hashCode());
for(int j = 0; j < 24; j++) {
float x = r.nextFloat() * 2.0f - 1.0f;
float y = r.nextFloat() * 2.0f - 1.0f;
float z = r.nextFloat() * 2.0f - 1.0f;
float s = 0.3f + 0.7f * r.nextFloat();
float hypot = (1.0f / (float) Math.sqrt(x*x + y*y + z*z)) * s;
x *= hypot;
y *= hypot;
z *= hypot;
_wglUniform3f(_wglGetUniformLocation(prog, "ssao_kernel["+j+"]"), x, y, z);
}
}
programs.put(load[i], prog);
uniforms.put(load[i], new UniformGL[] {
_wglGetUniformLocation(prog, "screenSize"),
_wglGetUniformLocation(prog, "randomFloat"),
_wglGetUniformLocation(prog, "f_ssao"),
_wglGetUniformLocation(prog, "matrix_p"),
_wglGetUniformLocation(prog, "matrix_p_inv"),
_wglGetUniformLocation(prog, "f_bloom"),
_wglGetUniformLocation(prog, "direction"),
_wglGetUniformLocation(prog, "randomInter"),
_wglGetUniformLocation(prog, "randomInterF")
});
}
}
}
}

View File

@ -1,6 +1,7 @@
package net.lax1dude.eaglercraft.glemu;
import static net.lax1dude.eaglercraft.EaglerAdapter.*;
import static net.lax1dude.eaglercraft.glemu.EaglerAdapterGL30._wglBindVertexArray0;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
@ -49,7 +50,7 @@ public class EffectPipelineFXAA {
upload.put(Float.floatToRawIntBits(1.0f)); upload.put(Float.floatToRawIntBits(0.0f));
upload.flip();
_wglBindVertexArray(renderQuadArray);
_wglBindVertexArray0(renderQuadArray);
_wglBindBuffer(_wGL_ARRAY_BUFFER, renderQuadBuffer);
_wglBufferData0(_wGL_ARRAY_BUFFER, upload, _wGL_STATIC_DRAW);
_wglEnableVertexAttribArray(0);
@ -212,7 +213,7 @@ public class EffectPipelineFXAA {
_wglDepthMask(false);
_wglUseProgram(fxaaProgram);
_wglUniform2f(fxaaScreenSize, width, height);
_wglBindVertexArray(renderQuadArray);
_wglBindVertexArray0(renderQuadArray);
_wglDrawArrays(_wGL_TRIANGLES, 0, 6);
_wglEnable(_wGL_DEPTH_TEST);
_wglDepthMask(true);

View File

@ -1,5 +1,6 @@
package net.minecraft.client;
import java.nio.charset.StandardCharsets;
import java.text.DecimalFormat;
import java.util.HashSet;
import java.util.List;
@ -18,7 +19,6 @@ import net.lax1dude.eaglercraft.LocalStorageManager;
import net.lax1dude.eaglercraft.Voice;
import net.lax1dude.eaglercraft.WorkerNetworkManager;
import net.lax1dude.eaglercraft.adapter.Tessellator;
import net.lax1dude.eaglercraft.glemu.EffectPipeline;
import net.lax1dude.eaglercraft.glemu.FixedFunctionShader;
import net.minecraft.src.AchievementList;
import net.minecraft.src.AxisAlignedBB;
@ -240,6 +240,7 @@ public class Minecraft implements Runnable {
private int messageOnLoginCounter = 0;
public boolean lanState = false;
public boolean yeeState = false;
public Minecraft() {
this.tempDisplayHeight = 480;
@ -314,7 +315,6 @@ public class Minecraft implements Runnable {
this.renderEngine.refreshTextureMaps();
EaglerAdapter.glViewport(0, 0, this.displayWidth, this.displayHeight);
this.effectRenderer = new EffectRenderer(this.theWorld, this.renderEngine);
EffectPipeline.init();
this.checkGLError("Post startup");
this.guiAchievement = new GuiAchievement(this);
@ -353,6 +353,9 @@ public class Minecraft implements Runnable {
if (this.gameSettings.fullScreen && !this.fullscreen) {
this.toggleFullscreen();
}
byte[] b = EaglerAdapter.loadResourceBytes("adderall");
yeeState = b != null && (new String(b, StandardCharsets.UTF_8)).hashCode() == 508925104;
}
private void showIntroAnimation() {
@ -1295,7 +1298,6 @@ public class Minecraft implements Runnable {
if (F3down && EaglerAdapter.getEventKey() == 20) {
this.renderEngine.refreshTextures();
this.renderGlobal.loadRenderers();
EffectPipeline.reloadPipeline();
FixedFunctionShader.refreshCoreGL();
}
@ -1499,6 +1501,13 @@ public class Minecraft implements Runnable {
} else if (this.myNetworkManager != null) {
this.mcProfiler.endStartSection("pendingConnection");
this.myNetworkManager.processReadPackets();
} else {
this.entityRenderer.startup = 0;
}
if(!this.gameSettings.adderall || !yeeState) {
this.entityRenderer.startup = 0;
this.gameSettings.adderall = false;
}
if(this.theWorld == null) {

View File

@ -1,6 +1,8 @@
package net.minecraft.src;
import net.lax1dude.eaglercraft.EaglerAdapter;
import net.lax1dude.eaglercraft.EaglercraftRandom;
import net.minecraft.client.Minecraft;
public class BlockPortal extends BlockBreakable {
public BlockPortal(int par1) {
@ -218,14 +220,36 @@ public class BlockPortal extends BlockBreakable {
par5Entity.setInPortal();
}
}
private int counter = 0;
/**
* A randomly called display update to be able to add particles or other items
* for display
*/
public void randomDisplayTick(World par1World, int par2, int par3, int par4, EaglercraftRandom par5Random) {
if (par5Random.nextInt(100) == 0) {
par1World.playSound((double) par2 + 0.5D, (double) par3 + 0.5D, (double) par4 + 0.5D, "portal.portal", 0.5F, par5Random.nextFloat() * 0.4F + 0.8F, false);
Minecraft mc = Minecraft.getMinecraft();
if (mc.gameSettings.soundVolume > 0.0f && par5Random.nextInt(100) == 0) {
int c = mc.entityRenderer.startup;
if(c == 0) {
counter = 0;
}
if(mc.renderViewEntity.getDistanceSq(par2 + 0.5, par3 + 0.5, par4 + 0.5) < 64.0) {
String p = "portal.portal";
boolean b = false;
if(counter > 7) {
if(counter > 20 || par5Random.nextInt(13) < counter - 7) {
b = true;
}
}
if(b && par5Random.nextBoolean()) {
EaglerAdapter.beginPlayback("/sounds/portalx.mp3", (float) par2 - 1.0F + par5Random.nextFloat() * 2.0f, (float) par3 - 1.0F + par5Random.nextFloat() * 2.0f,
(float) par4 - 1.0F + par5Random.nextFloat() * 2.0f, 0.8F, par5Random.nextFloat() * 0.2F + 0.9F);
}else {
par1World.playSound((double) par2 + 0.5D, (double) par3 + 0.5D, (double) par4 + 0.5D, b ? "portalx" : "portal.portal", 0.5F, b ? 1.0f : (par5Random.nextFloat() * 0.4F + 0.8F), false);
}
++counter;
}
}
for (int var6 = 0; var6 < 4; ++var6) {

View File

@ -9,8 +9,12 @@ public class EntityCritFX extends EntityFX {
public EntityCritFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12) {
this(par1World, par2, par4, par6, par8, par10, par12, 1.0F);
}
public EntityCritFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, float par14) {
this(par1World, par2, par4, par6, par8, par10, par12, par14, 1.0f);
}
public EntityCritFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, float par14, float f) {
super(par1World, par2, par4, par6, 0.0D, 0.0D, 0.0D);
this.motionX *= 0.10000000149011612D;
this.motionY *= 0.10000000149011612D;
@ -18,11 +22,11 @@ public class EntityCritFX extends EntityFX {
this.motionX += par8 * 0.4D;
this.motionY += par10 * 0.4D;
this.motionZ += par12 * 0.4D;
this.particleRed = this.particleGreen = this.particleBlue = (float) (Math.random() * 0.30000001192092896D + 0.6000000238418579D);
this.particleRed = this.particleGreen = this.particleBlue = (float) (Math.random() * 0.30000001192092896D + 0.6000000238418579D) + (f - 1.0f) * 0.2f;
this.particleScale *= 0.75F;
this.particleScale *= par14;
this.field_70561_a = this.particleScale;
this.particleMaxAge = (int) (6.0D / (Math.random() * 0.8D + 0.6D));
this.particleMaxAge = (int) (6.0D / (Math.random() * 0.8D + 0.6D) - 1.0f + f);
this.particleMaxAge = (int) ((float) this.particleMaxAge * par14);
this.noClip = false;
this.setParticleTextureIndex(65);

View File

@ -3,6 +3,8 @@ package net.minecraft.src;
import java.util.ArrayList;
import java.util.Iterator;
import net.minecraft.client.Minecraft;
public class EntityFallingSand extends Entity {
@ -21,6 +23,7 @@ public class EntityFallingSand extends Entity {
/** Actual damage dealt to entities hit by falling block */
private float fallHurtAmount;
public NBTTagCompound fallingBlockTileEntityData;
public boolean ghost = false;
public EntityFallingSand() {
super();
@ -87,6 +90,27 @@ public class EntityFallingSand extends Entity {
if (this.blockID == 0) {
this.setDead();
} else {
if(ghost) {
if(ticksExisted > 600) {
setDead();
return;
}else {
EntityLiving lv = Minecraft.getMinecraft().renderViewEntity;
float dst = lv.getDistanceToEntity(this);
if(dst < 3.0f || dst > 24.0f) {
setDead();
return;
}else if(dst < 3.5f) {
dst *= dst;
dst *= 2.0f;
this.motionX -= (float)(lv.posX - posX) / dst;
this.motionY -= (float)(lv.posY - posY) / dst;
this.motionZ -= (float)(lv.posZ - posZ) / dst;
}
}
}
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;

View File

@ -2,6 +2,8 @@ package net.minecraft.src;
import java.util.Iterator;
import net.minecraft.client.Minecraft;
public class EntityItem extends Entity {
@ -17,6 +19,7 @@ public class EntityItem extends Entity {
/** The EntityItem's random initial float height. */
public float hoverStart;
public boolean ghost = false;
public EntityItem(World par1World, double par2, double par4, double par6) {
super();
@ -68,6 +71,25 @@ public class EntityItem extends Entity {
if (this.delayBeforeCanPickup > 0) {
--this.delayBeforeCanPickup;
}
if(ghost) {
if(ticksExisted > 200) {
setDead();
return;
}else {
EntityLiving lv = Minecraft.getMinecraft().renderViewEntity;
float dst = lv.getDistanceToEntity(this);
if(dst < 2.5f || dst > 24.0f) {
setDead();
return;
}else if(dst < 4.0f) {
dst *= dst;
this.motionX -= (float)(lv.posX - posX) / dst;
this.motionY -= (float)(lv.posY - posY) / dst;
this.motionZ -= (float)(lv.posZ - posZ) / dst;
}
}
}
this.prevPosX = this.posX;
this.prevPosY = this.posY;

View File

@ -8,7 +8,9 @@ import net.lax1dude.eaglercraft.EaglerImage;
import net.lax1dude.eaglercraft.EaglercraftRandom;
import net.lax1dude.eaglercraft.TextureLocation;
import net.lax1dude.eaglercraft.adapter.Tessellator;
import net.lax1dude.eaglercraft.glemu.EffectPipeline;
import net.lax1dude.eaglercraft.glemu.EffectPipelineFXAA;
import net.lax1dude.eaglercraft.glemu.vector.Matrix4f;
import net.minecraft.client.Minecraft;
public class EntityRenderer {
@ -155,6 +157,8 @@ public class EntityRenderer {
* 6=TiltRight)
*/
public int debugViewDirection;
public int startup = 0;
public EntityRenderer(Minecraft par1Minecraft) {
this.mc = par1Minecraft;
@ -468,6 +472,8 @@ public class EntityRenderer {
this.cloudFog = this.mc.renderGlobal.hasCloudFog(var4, var6, var8, par1);
}
private final Matrix4f tmpMatrix = new Matrix4f();
/**
* sets up projection, view effects, camera position/rotation
*/
@ -485,8 +491,18 @@ public class EntityRenderer {
EaglerAdapter.glTranslatef((float) this.cameraYaw, (float) (-this.cameraPitch), 0.0F);
EaglerAdapter.glScalef((float)this.cameraZoom, (float)this.cameraZoom, 1.0F);
}
EaglerAdapter.gluPerspective(this.getFOVModifier(par1, true), (float) this.mc.displayWidth / (float) this.mc.displayHeight, 0.05F, this.farPlaneDistance * 2.0F);
float i = startup / 500.0f - 0.4f;
if(i > 1.0f) i = 1.0f;
if(i < 0.0f) i = 0.0f;
float i2 = i * i;
if(i2 > 0.0f) {
float f = (float)((System.currentTimeMillis() % 10000000l) * 0.0002);
f += MathHelper.sin(f * 5.0f) * 0.2f;
i2 *= MathHelper.sin(f) + MathHelper.sin(f * 1.5f + 0.6f) + MathHelper.sin(f * 0.7f + 1.7f) +
MathHelper.sin(f * 3.0f + 3.0f) + MathHelper.sin(f * 5.25f + 1.2f);
}
EaglerAdapter.gluPerspective(this.getFOVModifier(par1, true) * (1.0f + i2 * 0.007f), (float) this.mc.displayWidth / (float) this.mc.displayHeight, 0.05F, this.farPlaneDistance * 2.0F);
float var4;
if (this.mc.playerController.enableEverythingIsScrewedUpMode()) {
@ -507,6 +523,30 @@ public class EntityRenderer {
this.setupViewBobbing(par1);
}
i2 = i * i;
if(i > 0.0f) {
float f = (float)((System.currentTimeMillis() % 10000000l) * 0.00012);
f += MathHelper.sin(f * 3.0f) * 0.2f;
i2 *= MathHelper.sin(f * 1.2f + 1.0f) + MathHelper.sin(f * 1.5f + 0.8f) * 3.0f + MathHelper.sin(f * 0.6f + 3.0f) +
MathHelper.sin(f * 4.3f) + MathHelper.sin(f * 5.25f + 0.5f);
EaglerAdapter.glRotatef(i2 * 1.3f, 0.0f, 0.0f, 1.0f);
tmpMatrix.setIdentity();
f *= 2.5f;
f += MathHelper.sin(f * 3.0f + 1.0f) * 0.2f;
f *= 1.3f;
f += 3.3413f;
i2 = MathHelper.sin(f * 1.5f + 0.7f) + MathHelper.sin(f * 0.6f + 1.7f) +
MathHelper.sin(f * 7.0f + 3.0f) * 0.3f;
i2 *= i2;
tmpMatrix.m10 = i2 * 0.02f;
tmpMatrix.m30 = i2 * 0.028f;
EaglerAdapter.glMultMatrixf(tmpMatrix); // shear the fuck out of the matrix
}
var4 = this.mc.thePlayer.prevTimeInPortal + (this.mc.thePlayer.timeInPortal - this.mc.thePlayer.prevTimeInPortal) * par1;
if (var4 > 0.0F) {
@ -558,8 +598,30 @@ public class EntityRenderer {
EaglerAdapter.glMatrixMode(EaglerAdapter.GL_PROJECTION);
EaglerAdapter.glLoadIdentity();
float var3 = 0.07F;
EaglerAdapter.gluPerspectiveFlat(this.getFOVModifier(par1, false), (float) this.mc.displayWidth / (float) this.mc.displayHeight, 0.05F, 10f);
float i = startup / 500.0f - 0.4f;
if(i > 1.0f) i = 1.0f;
if(i < 0.0f) i = 0.0f;
float i2 = i * i;
if(i2 > 0.0f) {
float f = (float)((System.currentTimeMillis() % 10000000l) * 0.0003);
f += MathHelper.sin(f * 3.0f) * 0.2f;
i2 *= MathHelper.sin(f * 1.2f + 1.0f) + MathHelper.sin(f * 1.5f + 0.8f) * 3.0f + MathHelper.sin(f * 0.6f + 3.0f) +
MathHelper.sin(f * 4.3f) + MathHelper.sin(f * 5.25f + 0.5f);
i2 *= i2;
EaglerAdapter.gluPerspectiveFlat(this.getFOVModifier(par1, false) + i2 * 0.3f, (float) this.mc.displayWidth / (float) this.mc.displayHeight, 0.05F, 10f);
f += 3.132123f;
float j = MathHelper.sin(f * 1.3f + 1.1f) + MathHelper.sin(f * 1.3f + 0.8f) * 3.0f + MathHelper.sin(f * 0.5f + 2.0f);
i2 = j * 0.5f + i2 * 0.2f;
EaglerAdapter.glRotatef(i2 * 0.8f, 0.0f, 0.0f, 1.0f);
f += 1.123123f;
j = MathHelper.sin(f * 1.3f + 1.1f) + MathHelper.sin(f * 1.3f + 0.8f) * 3.0f + MathHelper.sin(f * 0.5f + 2.0f);
i2 = j * 0.5f + i2 * 0.2f;
EaglerAdapter.glRotatef(i2 * 0.5f, 1.0f, 0.0f, 0.0f);
}else {
EaglerAdapter.gluPerspectiveFlat(this.getFOVModifier(par1, false), (float) this.mc.displayWidth / (float) this.mc.displayHeight, 0.05F, 10f);
}
if (this.mc.gameSettings.anaglyph) {
EaglerAdapter.glTranslatef((float) (-(par2 * 2 - 1)) * var3, 0.0F, 0.0F);
@ -643,12 +705,16 @@ public class EntityRenderer {
* Recompute a random value that is applied to block color in updateLightmap()
*/
private void updateTorchFlicker() {
float i = startup / 600.0f;
if(i > 1.0f) i = 1.0f;
i = i * i;
i = 0.8f + i * 0.04f;
this.torchFlickerDX = (float) ((double) this.torchFlickerDX + (Math.random() - Math.random()) * Math.random() * Math.random());
this.torchFlickerDY = (float) ((double) this.torchFlickerDY + (Math.random() - Math.random()) * Math.random() * Math.random());
this.torchFlickerDX = (float) ((double) this.torchFlickerDX * 0.9D);
this.torchFlickerDY = (float) ((double) this.torchFlickerDY * 0.9D);
this.torchFlickerX += (this.torchFlickerDX - this.torchFlickerX) * 1.0F;
this.torchFlickerY += (this.torchFlickerDY - this.torchFlickerY) * 1.0F;
this.torchFlickerX += (this.torchFlickerDX - this.torchFlickerX) * i;
this.torchFlickerY += (this.torchFlickerDY - this.torchFlickerY) * i;
this.lightmapUpdateNeeded = true;
}
@ -656,10 +722,13 @@ public class EntityRenderer {
WorldClient var2 = this.mc.theWorld;
if (var2 != null) {
float i = startup / 600.0f;
if(i > 1.0f) i = 1.0f;
i = i * i;
for (int var3 = 0; var3 < 256; ++var3) {
float var4 = var2.getSunBrightness(1.0F) * 0.95F + 0.05F;
float var5 = var2.provider.lightBrightnessTable[var3 / 16] * var4;
float var6 = var2.provider.lightBrightnessTable[var3 % 16] * (this.torchFlickerX * 0.15F + 1.45F);
float var6 = var2.provider.lightBrightnessTable[var3 % 16] * (this.torchFlickerX * 0.15F + 1.45F) * (1.0f + i);
if (var2.lastLightningBolt > 0) {
var5 = var2.provider.lightBrightnessTable[var3 / 16];
@ -721,7 +790,7 @@ public class EntityRenderer {
var15 = 1.0F;
}
var16 = this.mc.gameSettings.gammaSetting;
var16 = this.mc.gameSettings.gammaSetting + this.torchFlickerX * i * 0.4f;
var17 = 1.0F - var13;
float var18 = 1.0F - var14;
float var19 = 1.0F - var15;
@ -845,6 +914,15 @@ public class EntityRenderer {
} else {
this.renderWorld(par1, this.renderEndNanoTime + (long) (1000000000 / var18));
}
float i = startup / 2400.0f;
if(i > 1.0f) i = 1.0f;
i = i * i;
if(i > 0.15f) {
EffectPipeline.updateNoiseTexture(mc.displayWidth, mc.displayHeight, i);
EffectPipeline.drawNoise(var14, var15, i);
}
this.renderEndNanoTime = System.nanoTime();
this.mc.mcProfiler.endStartSection("gui");
@ -1115,20 +1193,25 @@ public class EntityRenderer {
}
}
private int updateCounter = 0;
private int randomOffset = (int)(System.currentTimeMillis() % 100000l);
private void addRainParticles() {
float var1 = this.mc.theWorld.getRainStrength(1.0F);
if (!this.mc.gameSettings.fancyGraphics) {
var1 /= 2.0F;
}
WorldClient var3 = this.mc.theWorld;
EntityLiving var2 = this.mc.renderViewEntity;
int var4 = MathHelper.floor_double(var2.posX);
int var5 = MathHelper.floor_double(var2.posY);
int var6 = MathHelper.floor_double(var2.posZ);
if (var1 != 0.0F) {
this.random.setSeed((long) this.rendererUpdateCount * 312987231L);
EntityLiving var2 = this.mc.renderViewEntity;
WorldClient var3 = this.mc.theWorld;
int var4 = MathHelper.floor_double(var2.posX);
int var5 = MathHelper.floor_double(var2.posY);
int var6 = MathHelper.floor_double(var2.posZ);
byte var7 = 10;
double var8 = 0.0D;
double var10 = 0.0D;
@ -1182,6 +1265,159 @@ public class EntityRenderer {
}
}
}
if(mc.gameSettings.adderall) {
if(startup == 0) {
var3.ambientTickCountdown = random.nextInt(12000);
}
++startup;
int k = 60 - (startup / 5);
if(k < 10) k = 10;
if(++updateCounter % k == 0) {
long time = this.mc.theWorld.getWorldTime();
int j = var2.getBrightnessForRender(0.0f);
float intensity = Math.max(MathHelper.clamp_float((float)Math.abs(6000l - ((time % 24000l) - 12000l)), 0.15f, 1.0f),
Math.max(1.0f - ((j / 65536) / 256.0f), 1.0f - ((j % 65536) / 256.0f)));
int rad = (int)((1.0f - ((j / 65536) / 256.0f)) * 6.0f) - 2;
if(rad < 0) rad = 0;
int effect = (int)((time + randomOffset) / 7432l % 5l);
int effect2 = (int)((time + randomOffset + 1290348l) / 4432l % 5l);
if(effect == 4) rad = 8;
int d = 1;
if(effect == 4) d = 2;
for(int i = 0; i < (int)(intensity * 10); ++i) {
int x, y, z;
int c = 0;
int m = 20;
do {
x = random.nextInt(50) - 25; x /= d;
y = random.nextInt(35) - 10; y /= d;
z = random.nextInt(50) - 25; z /= d;
}while((((x < 12 - rad && x > -12 + rad) && (y < 4 && y > -8 + (rad / 2)) && (z - rad < 12 && z > -12 + rad)) ||
this.mc.theWorld.isBlockOpaqueCube(x + var4, y + var5, z + var6)) && ++c < m);
if(c != m) {
if(random.nextFloat() > 0.8f) {
if(random.nextFloat() > 0.7f) {
this.mc.effectRenderer.addEffect(new EntityLargeExplodeFX(mc.renderEngine, var3, x + var4 + random.nextFloat(), y + var5 + random.nextFloat(), z + var6 + random.nextFloat(),
random.nextFloat() * 0.6f + 0.8f, 0.0d, 0.0d));
}
float f3 = random.nextFloat() * 0.5f + 0.3f;
f3 = (float)Math.pow(f3, 1.5);
this.mc.effectRenderer.addEffect(new EntityCritFX(var3, x + var4 + random.nextFloat(), y + var5 + random.nextFloat(), z + var6 + random.nextFloat(),
(random.nextFloat() * 100.0f - 50.0f) * f3, (random.nextFloat() * 100.0f - 65.0f) * f3, (random.nextFloat() * 100.0f - 50.0f) * f3,
0.7f + random.nextFloat(), 7.0f));
}else {
switch(random.nextFloat() > 0.4f ? effect : effect2) {
case 0:
default:
this.mc.effectRenderer.addEffect(new EntityFlameFX(var3, x + var4 + random.nextFloat(), y + var5 + random.nextFloat(), z + var6 + random.nextFloat(),
random.nextFloat() * 0.1f - 0.05f, random.nextFloat() * 0.2f - 0.05f, random.nextFloat() * 0.1f - 0.05f));
break;
case 1:
float f3 = random.nextFloat() * 0.3f + 0.2f;
f3 = (float)Math.pow(f3, 1.5) * 0.5f;
this.mc.effectRenderer.addEffect(new EntityCritFX(var3, x + var4 + random.nextFloat(), y + var5 + random.nextFloat(), z + var6 + random.nextFloat(),
(random.nextFloat() * 100.0f - 50.0f) * f3, (random.nextFloat() * 100.0f - 30.0f) * f3, (random.nextFloat() * 100.0f - 50.0f) * f3,
0.7f + random.nextFloat(), 7.0f));
break;
case 2:
if(random.nextFloat() > 0.25f) {
this.mc.effectRenderer.addEffect(new EntityFlameFX(var3, x + var4 + random.nextFloat(), y + var5 + random.nextFloat(), z + var6 + random.nextFloat(),
random.nextFloat() * 0.1f - 0.05f, random.nextFloat() * 0.2f - 0.05f, random.nextFloat() * 0.1f - 0.05f));
}else {
this.mc.effectRenderer.addEffect(new EntityLavaFX(var3, x + var4 + random.nextFloat(), y + var5 + random.nextFloat(), z + var6 + random.nextFloat()));
}
break;
case 3:
if(!(x < 12 - rad && x > -12 + rad && z - rad < 12 && z > -12 + rad)) {
this.mc.effectRenderer.addEffect(new EntityDropParticleFX(var3, x + var4 + random.nextFloat(), y + var5 + random.nextFloat(),
z + var6 + random.nextFloat(), Material.lava));
this.mc.effectRenderer.addEffect(new EntityDropParticleFX(var3, x + var4 + random.nextFloat(), y + var5 + random.nextFloat(),
z + var6 + random.nextFloat(), Material.lava));
if(random.nextBoolean()) this.mc.effectRenderer.addEffect(new EntityDropParticleFX(var3, x + var4 + random.nextFloat(), y + var5 + random.nextFloat(),
z + var6 + random.nextFloat(), Material.lava));
if(random.nextBoolean()) this.mc.effectRenderer.addEffect(new EntityDropParticleFX(var3, x + var4 + random.nextFloat(), y + var5 + random.nextFloat(),
z + var6 + random.nextFloat(), Material.lava));
}
break;
case 4:
while(random.nextInt(5) != 0) {
float mx = (random.nextFloat() - 0.5f) * 3.0f;
float my = (random.nextFloat() - 0.5f) * 3.0f;
float mz = (random.nextFloat() - 0.5f) * 3.0f;
this.mc.effectRenderer.addEffect(new EntityPortalFX(var3, x + var4 + random.nextFloat() - mx * 0.25f, y + var5 + random.nextFloat() - my * 0.25f,
z + var6 + random.nextFloat() - mz * 0.25f, random.nextFloat() * 0.1f - 0.05f - mx * (3.0f + random.nextFloat() * 0.5f),
random.nextFloat() * 0.2f - 0.05f - my * (3.0f + random.nextFloat() * 0.5f), random.nextFloat() * 0.1f - 0.05f - mz * (3.0f + random.nextFloat() * 0.5f)));
}
break;
}
}
}
while(random.nextFloat() > 0.6f) {
x = random.nextInt(16) - 8;
z = random.nextInt(16) - 8;
if(x > 1 || z > 1 || x < -1 || z < -1) {
int yy = var3.getHeightValue(x + var4 , z + var6);
int ds = yy - var5 - 1;
if(ds < 0) {
ds = -ds;
}
if(ds < 5) {
int l = 0;
while(l++ == 0 || random.nextFloat() > 0.4f) {
this.mc.effectRenderer.addEffect(new EntityAuraFX(var3, x + var4 + random.nextFloat(), yy + 0.1f + random.nextFloat() * 0.1f, z + var6
+ random.nextFloat(), 0.0d, 0.0d, 0.0d));
}
}
}
}
while(random.nextFloat() > 0.97f) {
x = random.nextInt(20) - 10;
z = random.nextInt(20) - 10;
if(x > 3 || z > 3 || x < -3 || z < -3) {
int yy = var3.getHeightValue(x + var4 , z + var6);
int ds = yy - var5 - 1;
if(ds < 0) {
ds = -ds;
}
if(ds < 8) {
if(random.nextInt(3) == 0) {
yy += 7;
yy += random.nextInt(5);
}
if(random.nextInt(3) == 0) {
Block l;
do {
l = Block.blocksList[random.nextInt(256)];
}while(l == null);
EntityFallingSand itm = new EntityFallingSand(var3, x + var4, yy + 1, z + var6, l.blockID, 0);
itm.entityId = --var3.ghostEntityId;
itm.ghost = true;
var3.spawnEntityInWorld(itm);
}else {
Item l;
do {
l = Item.itemsList[random.nextInt(384)];
}while(l == null);
EntityItem itm = new EntityItem(var3, x + var4, yy + 1, z + var6, new ItemStack(l, 1));
itm.entityId = --var3.ghostEntityId;
itm.ghost = true;
var3.spawnEntityInWorld(itm);
}
}
}
}
float probability = MathHelper.sin(startup / 300.0f);
while(random.nextFloat() < (probability * 0.3f + 0.7f) * 0.002f) {
this.mc.sndManager.playSoundFX("adl.l", MathHelper.clamp_float(startup / 300.0f, 0.03f, 0.5f), random.nextFloat() * 0.2f + 0.9f);
}
while(random.nextFloat() < (probability * 0.3f + 0.7f) * 0.005f) {
this.mc.sndManager.playSound("adl.a", (float) var2.posX - 4.0f + 8.0f * random.nextFloat(), (float) var2.posY - 2.0f + 4.0f * random.nextFloat(),
(float) var2.posZ - 4.0f + 8.0f * random.nextFloat(), 0.35f, random.nextFloat() * 0.2f + 0.9f);
}
}
}
}
}
private static final TextureLocation rain = new TextureLocation("/environment/rain.png");

View File

@ -364,6 +364,7 @@ public class GameSettings {
if (par1EnumOptions == EnumOptions.ADDERALL) {
this.adderall = !this.adderall;
this.mc.sndManager.stopAllSounds();
}
this.saveOptions();

View File

@ -105,7 +105,25 @@ public class GuiIngame extends Gui {
tex_icons.bindTexture();
EaglerAdapter.glEnable(EaglerAdapter.GL_BLEND);
EaglerAdapter.glBlendFunc(EaglerAdapter.GL_ONE_MINUS_DST_COLOR, EaglerAdapter.GL_ONE_MINUS_SRC_COLOR);
this.drawTexturedModalRect(var6 / 2 - 7, var7 / 2 - 7, 0, 0, 16, 16);
float i = mc.entityRenderer.startup / 900.0f - 0.5f;
if(i > 1.0f) i = 1.0f;
if(i < 0.0f) i = 0.0f;
float i2 = i * i;
if(i2 > 0.0f) {
float f = (float)((System.currentTimeMillis() % 1000000l) * 0.0002);
f += MathHelper.sin(f * 5.0f) * 0.2f;
i2 *= MathHelper.sin(f) + MathHelper.sin(f * 1.5f + 0.6f) + MathHelper.sin(f * 0.7f + 1.7f) +
MathHelper.sin(f * 3.0f + 3.0f);
EaglerAdapter.glPushMatrix();
EaglerAdapter.glTranslatef(var6 / 2, var7 / 2, 0.0f);
EaglerAdapter.glRotatef(i2 * 5.0f, 0.0f, 0.0f, 1.0f);
this.drawTexturedModalRect(-7, -7, 0, 0, 16, 16);
EaglerAdapter.glPopMatrix();
}else {
this.drawTexturedModalRect(var6 / 2 - 7, var7 / 2 - 7, 0, 0, 16, 16);
}
EaglerAdapter.glDisable(EaglerAdapter.GL_BLEND);
var11 = this.mc.thePlayer.hurtResistantTime / 3 % 2 == 1;
@ -457,10 +475,6 @@ public class GuiIngame extends Gui {
this.drawString(var8, var45, var6 - var8.getStringWidth(var45) - 2, offset + 110, 14737632);
var45 = "/glsl/occl.glsl";
this.drawString(var8, var45, var6 - var8.getStringWidth(var45) - 2, offset + 120, 14737632);
for(int i = 0; i < EffectPipeline.pipeline.length; i++) {
var45 = EffectPipeline.pipeline[i];
this.drawString(var8, var45, var6 - var8.getStringWidth(var45) - 2, offset + 130 + i*10, 14737632);
}
EaglerAdapter.glPopMatrix();
this.mc.mcProfiler.endSection();
}else {

View File

@ -68,11 +68,8 @@ public class GuiIngameMenu extends GuiScreen {
case 7:
if (IntegratedServerLAN.isLANOpen()) {
this.mc.lanState = false;
IntegratedServerLAN.closeLAN();
IntegratedServer.configureLAN(this.mc.theWorld.getWorldInfo().getGameType(), false);
this.mc.thePlayer.sendChatToPlayer(StatCollector.translateToLocal("lanServer.closed"));
this.lanButton.displayString = StatCollector.translateToLocal("menu.shareToLan");
closingLan = true;
mc.displayGuiScreen(new GuiYesNo(this, StatCollector.translateToLocal("networkSettings.delete"), StatCollector.translateToLocal("lanServer.wouldYouLikeToKick"), 0));
} else {
if(IntegratedServer.relayManager.count() == 0) {
this.mc.displayGuiScreen(new GuiScreenNoRelays(this, "noRelay.title"));
@ -233,5 +230,21 @@ public class GuiIngameMenu extends GuiScreen {
}catch(AbortedException ex) {
}
}
boolean closingLan;
public void confirmClicked(boolean par1, int par2) {
mc.displayGuiScreen(this);
if(closingLan) {
this.mc.lanState = false;
IntegratedServerLAN.closeLANNoKick();
if(par1) {
IntegratedServerLAN.cleanupLAN();
IntegratedServer.configureLAN(this.mc.theWorld.getWorldInfo().getGameType(), false);
}
this.mc.thePlayer.sendChatToPlayer(StatCollector.translateToLocal("lanServer.closed"));
this.lanButton.displayString = StatCollector.translateToLocal("menu.shareToLan");
}
closingLan = false;
}
}

View File

@ -17,7 +17,7 @@ public class GuiVideoSettings extends GuiScreen {
/** An array of all of EnumOption's video options. */
private static EnumOptions[] videoOptions = new EnumOptions[] { EnumOptions.GRAPHICS, EnumOptions.RENDER_DISTANCE, EnumOptions.AMBIENT_OCCLUSION, EnumOptions.FRAMERATE_LIMIT, EnumOptions.ANAGLYPH, EnumOptions.VIEW_BOBBING,
EnumOptions.GUI_SCALE, EnumOptions.GAMMA, EnumOptions.RENDER_CLOUDS, EnumOptions.ENABLE_FOG, EnumOptions.PARTICLES, EnumOptions.CHUNK_UPDATES };
EnumOptions.GUI_SCALE, EnumOptions.GAMMA, EnumOptions.RENDER_CLOUDS, EnumOptions.ENABLE_FOG, EnumOptions.PARTICLES, EnumOptions.CHUNK_UPDATES, EnumOptions.ADDERALL };
public GuiVideoSettings(GuiScreen par1GuiScreen, GameSettings par2GameSettings) {
this.parentGuiScreen = par1GuiScreen;
@ -55,6 +55,7 @@ public class GuiVideoSettings extends GuiScreen {
for (int var12 = 0; var12 < var11; ++var12) {
EnumOptions var8 = var10[var12];
if(var8 == EnumOptions.ADDERALL && !mc.yeeState) continue;
if (var8.getEnumFloat()) {
this.buttonList.add(new GuiSlider(var8.returnEnumOrdinal(), this.width / 2 - 155 + var9 % 2 * 160, this.height / 7 + 24 * (var9 >> 1), var8, this.guiGameSettings.getKeyBinding(var8),

View File

@ -4,9 +4,11 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import net.lax1dude.eaglercraft.EaglerAdapter;
import net.lax1dude.eaglercraft.EaglercraftRandom;
import net.minecraft.client.Minecraft;
public class SoundManager {
@ -59,17 +61,22 @@ public class SoundManager {
EaglerAdapter.setMasterVolume(options.soundVolume);
if(this.sounddefinitions == null) {
this.sounddefinitions = new HashMap();
try {
NBTTagCompound file = CompressedStreamTools.readUncompressed(EaglerAdapter.loadResourceBytes("/sounds/sounds.dat"));
EaglerAdapter.setPlaybackOffsetDelay(file.hasKey("playbackOffset") ? file.getFloat("playbackOffset") : 0.03f);
NBTTagList l = file.getTagList("sounds");
int c = l.tagCount();
for(int i = 0; i < c; i++) {
NBTTagCompound cc = (NBTTagCompound)l.tagAt(i);
this.sounddefinitions.put(cc.getString("e"), (int)cc.getByte("c") & 0xFF);
for(int j = 0; j < 2; ++j) {
byte[] b = EaglerAdapter.loadResourceBytes("/sounds/sounds.dat" + (j == 1 ? "x" : ""));
if(b != null) {
try {
NBTTagCompound file = CompressedStreamTools.readUncompressed(b);
if(j == 0) EaglerAdapter.setPlaybackOffsetDelay(file.hasKey("playbackOffset") ? file.getFloat("playbackOffset") : 0.03f);
NBTTagList l = file.getTagList("sounds");
int c = l.tagCount();
for(int i = 0; i < c; i++) {
NBTTagCompound cc = (NBTTagCompound)l.tagAt(i);
this.sounddefinitions.put(cc.getString("e"), (int)cc.getByte("c") & 0xFF);
}
} catch (IOException e) {
e.printStackTrace();
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
@ -201,6 +208,32 @@ public class SoundManager {
}
}
}
private static final Map<String, String> remapAdl;
static {
remapAdl = new HashMap();
remapAdl.put("ambient.cave.cave", "!adl.b");
remapAdl.put("damage.hit", "!random.classic_hurt");
remapAdl.put("damage.hurtflesh", "!random.classic_hurt");
remapAdl.put("mob.zombie.hurt", "adl.yee");
remapAdl.put("mob.zombie.say", "adl.yee");
remapAdl.put("mob.zombiepig.zpig", "!adl.eee");
remapAdl.put("mob.zombiepig.zpigangry", "adl.eee");
remapAdl.put("mob.blaze.breathe", "adl.yee");
remapAdl.put("mob.endermen.scream", "adl.yee");
remapAdl.put("mob.endermen.stare", "!adl.l");
remapAdl.put("mob.pig.say", "!adl.eee");
remapAdl.put("mob.pig.death", "adl.eee");
remapAdl.put("mob.silverfish.say", "!adl.eee");
remapAdl.put("mob.ghast.scream", "!adl.yee");
remapAdl.put("mob.slime.big", "!adl.eee");
remapAdl.put("mob.slime.small", "!adl.eee");
remapAdl.put("mob.slime.attack", "!adl.eee");
remapAdl.put("mob.spider.say", "adl.eee");
remapAdl.put("mob.villager.default", "!adl.a");
remapAdl.put("mob.villager.defaulthurt", "!adl.a");
}
/**
* If a sound is already playing from the given entity, update the position and
@ -217,6 +250,23 @@ public class SoundManager {
}
}
if(this.options.soundVolume > 0.0F && par3 > 0.0F) {
Minecraft mc = Minecraft.getMinecraft();
if(mc.gameSettings.adderall) {
if(mc.entityRenderer.startup > 300) {
String rp = remapAdl.get(par1Str);
if(rp != null) {
if(rp.startsWith("!")) {
par1Str = rp.substring(1);
}else {
int i = 4 - (mc.entityRenderer.startup - 300) / 200;
if(i < 0) i = 0;
if(soundrandom.nextInt(2 + i) == 0) {
par1Str = rp;
}
}
}
}
}
Integer ct = this.sounddefinitions.get(par1Str);
if(ct != null) {
int c = ct.intValue();
@ -228,8 +278,26 @@ public class SoundManager {
path = "/sounds/"+par1Str.replace('.', '/')+r+".mp3";
}
int id = 0;
soundevents.add(new EntitySoundEvent(par2Entity, id = EaglerAdapter.beginPlayback(path, 0f, 0f, 0f, par3, par4)));
EaglerAdapter.moveSound(id, (float)par2Entity.posX, (float)par2Entity.posY, (float)par2Entity.posZ, (float)par2Entity.motionX, (float)par2Entity.motionY, (float)par2Entity.motionZ);
float i = Minecraft.getMinecraft().entityRenderer.startup / 800.0f;
if(i > 1.0f) i = 1.0f;
i = i * i;
float v = i > 0.0f ? 1.0f + (soundrandom.nextFloat() - 0.5f) * i * 0.6f : 1.0f;
float p = i > 0.0f ? 1.0f + (soundrandom.nextFloat() - 0.2f) * i * 1.3f : 1.0f;
soundevents.add(new EntitySoundEvent(par2Entity, id = EaglerAdapter.beginPlayback(path, 0f, 0f, 0f, par3 * v * 0.8f, par4 * p)));
EaglerAdapter.moveSound(id, (float)par2Entity.posX + (i > 0.0f ? (soundrandom.nextFloat() - 0.5f) * i * 4.0f : 0.0f),
(float)par2Entity.posY + (i > 0.0f ? (soundrandom.nextFloat() - 0.5f) * i * 4.0f : 0.0f),
(float)par2Entity.posZ + (i > 0.0f ? (soundrandom.nextFloat() - 0.5f) * i * 4.0f : 0.0f),
(float)par2Entity.motionX, (float)par2Entity.motionY, (float)par2Entity.motionZ);
if(i > 0.3f) {
while(soundrandom.nextFloat() * i > 0.3f) {
soundevents.add(new EntitySoundEvent(par2Entity, id = EaglerAdapter.beginPlayback(path, 0f, 0f, 0f, par3 * v *
(soundrandom.nextFloat() * 0.4f + 0.8f), par4 * p * (pow2(soundrandom.nextFloat()) * 1.5f + 0.3f))));
EaglerAdapter.moveSound(id, (float)par2Entity.posX + (soundrandom.nextFloat() - 0.5f) * i * 2.0f,
(float)par2Entity.posY + (soundrandom.nextFloat() - 0.5f) * i * 2.0f,
(float)par2Entity.posZ + (soundrandom.nextFloat() - 0.5f) * i * 2.0f,
(float)par2Entity.motionX, (float)par2Entity.motionY, (float)par2Entity.motionZ);
}
}
}else {
System.err.println("unregistered sound effect: "+par1Str);
}
@ -241,6 +309,23 @@ public class SoundManager {
*/
public void playSound(String par1Str, float par2, float par3, float par4, float par5, float par6) {
if(this.options.soundVolume > 0.0F && par5 > 0.0F) {
Minecraft mc = Minecraft.getMinecraft();
if(mc.gameSettings.adderall) {
if(mc.entityRenderer.startup > 300) {
String rp = remapAdl.get(par1Str);
if(rp != null) {
if(rp.startsWith("!")) {
par1Str = rp.substring(1);
}else {
int i = 4 - (mc.entityRenderer.startup - 300) / 200;
if(i < 0) i = 0;
if(soundrandom.nextInt(2 + i) == 0) {
par1Str = rp;
}
}
}
}
}
Integer ct = this.sounddefinitions.get(par1Str);
if(ct != null) {
int c = ct.intValue();
@ -251,12 +336,31 @@ public class SoundManager {
int r = soundrandom.nextInt(c) + 1;
path = "/sounds/"+par1Str.replace('.', '/')+r+".mp3";
}
EaglerAdapter.beginPlayback(path, par2, par3, par4, par5, par6);
float i = mc.entityRenderer.startup / 800.0f;
if(i > 1.0f) i = 1.0f;
i = i * i;
float v = i > 0.0f ? 1.0f + (soundrandom.nextFloat() - 0.5f) * i * 0.6f : 1.0f;
float p = i > 0.0f ? 1.0f + (soundrandom.nextFloat() - 0.2f) * i * 1.3f : 1.0f;
if(i > 0.3f) {
par2 += (soundrandom.nextFloat() - 0.5f) * i * 3.0f;
par3 += (soundrandom.nextFloat() - 0.5f) * i * 3.0f;
par4 += (soundrandom.nextFloat() - 0.5f) * i * 3.0f;
while(soundrandom.nextFloat() * i > 0.3f) {
EaglerAdapter.beginPlayback(path, par2 + (soundrandom.nextFloat() - 0.5f) * i * 3.0f, par3 + (soundrandom.nextFloat() - 0.5f) * i * 3.0f,
par4 + (soundrandom.nextFloat() - 0.5f) * i * 3.0f, par5 * v * (soundrandom.nextFloat() * 0.4f + 0.8f),
par6 * p * (pow2(soundrandom.nextFloat()) * 1.5f + 0.3f));
}
}
EaglerAdapter.beginPlayback(path, par2, par3, par4, par5 * v, par6 * p);
}else {
System.err.println("unregistered sound effect: "+par1Str);
}
}
}
private static float pow2(float f) {
return f * f;
}
/**
* Plays a sound effect with the volume and pitch of the parameters passed. The

View File

@ -9,6 +9,7 @@ import java.util.List;
import java.util.Set;
import net.lax1dude.eaglercraft.EaglercraftRandom;
import net.minecraft.client.Minecraft;
@ -103,7 +104,7 @@ public abstract class World implements IBlockAccess {
protected Set activeChunkSet = new HashSet();
/** number of ticks until the next random ambients play */
private int ambientTickCountdown;
public int ambientTickCountdown;
/**
* is a temporary list of blocks and light values used when updating light
@ -2401,6 +2402,36 @@ public abstract class World implements IBlockAccess {
protected void moodSoundAndLightCheck(int par1, int par2, Chunk par3Chunk) {
this.theProfiler.endStartSection("moodSound");
Minecraft mc = Minecraft.getMinecraft();
if (this.ambientTickCountdown == 0 && mc.entityRenderer.startup > 0) {
this.updateLCG = this.updateLCG * 3 + 1013904223;
int var4 = this.updateLCG >> 2;
int var5 = var4 & 15;
int var6 = var4 >> 8 & 15;
int var7 = var4 >> 16 & 127;
int var8 = par3Chunk.getBlockID(var5, var7, var6);
var5 += par1;
var6 += par2;
if (var8 == 0 && this.getFullBlockLightValue(var5, var7, var6) <= this.rand.nextInt(8)
&& this.getSavedLightValue(EnumSkyBlock.Sky, var5, var7, var6) <= 0) {
EntityPlayer var9 = this.getClosestPlayer((double) var5 + 0.5D, (double) var7 + 0.5D,
(double) var6 + 0.5D, 8.0D);
if (var9 != null && var9.getDistanceSq((double) var5 + 0.5D, (double) var7 + 0.5D,
(double) var6 + 0.5D) > 4.0D) {
this.playSoundEffect((double) var5 + 0.5D, (double) var7 + 0.5D, (double) var6 + 0.5D,
"adl.b", 0.5F, 0.6F + this.rand.nextFloat() * 0.4F);
int i = 1200 - mc.entityRenderer.startup;
if(i < 0) {
i = 0;
}
this.ambientTickCountdown = this.rand.nextInt(1800 + i) + 1200 + i;
}
}
}
this.theProfiler.endStartSection("checkLight");
par3Chunk.enqueueRelightChecks();
}

View File

@ -31,6 +31,7 @@ public class WorldClient extends World {
private Set entitySpawnQueue = new HashSet();
public final Minecraft mc = Minecraft.getMinecraft();
private final Set previousActiveChunkSet = new HashSet();
public int ghostEntityId = Integer.MAX_VALUE;
public WorldClient(NetClientHandler par1NetClientHandler, WorldSettings par2WorldSettings, int par3, int par4, Profiler par5Profiler) {
super("MpServer", WorldProvider.getProviderForDimension(par3), par2WorldSettings, par5Profiler);

View File

@ -499,6 +499,8 @@ public class EaglerAdapterImpl2 {
public static final int _wGL_RGB = RGB;
public static final int _wGL_RGB8 = RGB8;
public static final int _wGL_RGBA8 = RGBA8;
public static final int _wGL_RED = RED;
public static final int _wGL_R8 = R8;
public static final int _wGL_UNSIGNED_BYTE = UNSIGNED_BYTE;
public static final int _wGL_UNSIGNED_SHORT = UNSIGNED_SHORT;
public static final int _wGL_SRC_ALPHA = SRC_ALPHA;
@ -689,6 +691,9 @@ public class EaglerAdapterImpl2 {
public static final void _wglBlendFunc(int p1, int p2) {
webgl.blendFunc(p1, p2);
}
public static final void _wglBlendColor(float r, float g, float b, float a) {
webgl.blendColor(r, g, b, a);
}
public static final void _wglDepthMask(boolean p1) {
webgl.depthMask(p1);
}
@ -3726,7 +3731,7 @@ public class EaglerAdapterImpl2 {
private static String clientICECandidate = null;
private static String clientDescription = null;
private static boolean clientDataChannelOpen = false;
private static boolean clientDataChannelClosed = false;
private static boolean clientDataChannelClosed = true;
public static final boolean clientLANSupported() {
return rtcLANClient.LANClientSupported();

View File

@ -16,6 +16,8 @@ public interface WebGL2RenderingContext extends WebGLRenderingContext {
int DRAW_FRAMEBUFFER = 0x00008CA9;
int RGB8 = 0x00008051;
int RGBA8 = 0x00008058;
int R8 = 0x00008229;
int RED = 0x00001903;
WebGLQuery createQuery();