stuff and things

This commit is contained in:
HoosierTransfer 2024-06-13 17:30:23 -04:00
parent e19b260b8c
commit a192b7b5b7
123 changed files with 48599 additions and 45491 deletions

File diff suppressed because one or more lines are too long

BIN
javascript/v0.4.0web.zip Normal file

Binary file not shown.

View File

@ -33,8 +33,8 @@ out vec4 v_color4f;
uniform mat4 u_matrixTransform;
uniform vec3 u_texCoordSize2f_particleSize1f;
uniform vec4 u_transformParam_1_2_3_4_f;
uniform float u_transformParam_5_f;
uniform vec3 u_transformParam_1_2_5_f;
uniform vec2 u_transformParam_3_4_f;
uniform vec4 u_color4f;
uniform sampler2D u_lightmapTexture;
@ -51,11 +51,8 @@ void main() {
vec3 pos3f = p_position3f;
vec2 spos2f = a_position2f * particleSize;
pos3f.x += u_transformParam_1_2_3_4_f.x * spos2f.x;
pos3f.x += u_transformParam_1_2_3_4_f.w * spos2f.y;
pos3f.y += u_transformParam_1_2_3_4_f.y * spos2f.y;
pos3f.z += u_transformParam_1_2_3_4_f.z * spos2f.x;
pos3f.z += u_transformParam_5_f * spos2f.y;
pos3f += u_transformParam_1_2_5_f * spos2f.xyy;
pos3f.zx += u_transformParam_3_4_f * spos2f;
gl_Position = u_matrixTransform * vec4(pos3f, 1.0);
}

View File

@ -43,8 +43,8 @@ uniform mat4 u_matrixTransform;
#endif
uniform vec3 u_texCoordSize2f_particleSize1f;
uniform vec4 u_transformParam_1_2_3_4_f;
uniform float u_transformParam_5_f;
uniform vec3 u_transformParam_1_2_5_f;
uniform vec2 u_transformParam_3_4_f;
void main() {
v_color4f = p_color4f.bgra;
@ -59,11 +59,8 @@ void main() {
vec3 pos3f = p_position3f;
vec2 spos2f = a_position2f * particleSize;
pos3f.x += u_transformParam_1_2_3_4_f.x * spos2f.x;
pos3f.x += u_transformParam_1_2_3_4_f.w * spos2f.y;
pos3f.y += u_transformParam_1_2_3_4_f.y * spos2f.y;
pos3f.z += u_transformParam_1_2_3_4_f.z * spos2f.x;
pos3f.z += u_transformParam_5_f * spos2f.y;
pos3f += u_transformParam_1_2_5_f * spos2f.xyy;
pos3f.zx += u_transformParam_3_4_f * spos2f;
#ifdef COMPILE_GBUFFER_VSH
gl_Position = u_matrixTransform * vec4(pos3f, 1.0);

View File

@ -7,3 +7,4 @@ minecraft:redstone_torch,0,1.0000,0.1578,0.0000,4.0
minecraft:sea_lantern,0,0.5530,0.6468,1.0000,10.0,
minecraft:lava_bucket,0,1.0000,0.4461,0.1054,6.0,
minecraft:nether_star,0,0.5711,0.6611,1.0000,6.0
minecraft:ender_eye,0,0.1990,0.7750,0.4130,4.0
1 item,damage,red,green,blue,intensity
7 minecraft:sea_lantern,0,0.5530,0.6468,1.0000,10.0,
8 minecraft:lava_bucket,0,1.0000,0.4461,0.1054,6.0,
9 minecraft:nether_star,0,0.5711,0.6611,1.0000,6.0
10 minecraft:ender_eye,0,0.1990,0.7750,0.4130,4.0

View File

@ -1,7 +1,7 @@
{
"name": "§eHigh Performance PBR",
"desc": "Pack made from scratch specifically for this client, designed to give what I call the best balance between quality and performance possible in a browser but obviously that's just my opinion",
"vers": "1.1.0",
"vers": "1.2.0",
"author": "lax1dude",
"api_vers": 1,
"features": [

View File

@ -0,0 +1,67 @@
#line 2
/*
* Copyright (c) 2024 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
precision lowp int;
precision mediump float;
precision mediump sampler2D;
in vec4 v_position4f;
in vec2 v_texCoord2f;
in vec4 v_color4f;
in vec2 v_lightmap2f;
layout(location = 0) out vec4 output4f;
uniform sampler2D u_inputTexture;
uniform sampler2D u_lightmapTexture;
uniform mat4 u_inverseViewMatrix4f;
layout(std140) uniform u_chunkLightingData {
mediump int u_dynamicLightCount1i;
mediump int _paddingA_;
mediump int _paddingB_;
mediump int _paddingC_;
mediump vec4 u_dynamicLightArray[12];
};
void main() {
vec4 color = texture(u_inputTexture, v_texCoord2f) * v_color4f;
if(color.a < 0.004) {
discard;
}
vec4 light;
float diffuse = 0.0;
if(u_dynamicLightCount1i > 0) {
vec4 worldPosition4f = u_inverseViewMatrix4f * v_position4f;
worldPosition4f.xyz /= worldPosition4f.w;
vec3 normalVector3f = normalize(u_inverseViewMatrix4f[2].xyz);
int safeLightCount = u_dynamicLightCount1i > 12 ? 0 : u_dynamicLightCount1i;
for(int i = 0; i < safeLightCount; ++i) {
light = u_dynamicLightArray[i];
light.xyz = light.xyz - worldPosition4f.xyz;
diffuse += max(dot(normalize(light.xyz), normalVector3f) * 0.8 + 0.2, 0.0) * max(light.w - sqrt(dot(light.xyz, light.xyz)), 0.0);
}
}
color *= texture(u_lightmapTexture, vec2(min(v_lightmap2f.x + diffuse * 0.066667, 1.0), v_lightmap2f.y));
output4f = color;
}

View File

@ -0,0 +1,61 @@
#line 2
/*
* Copyright (c) 2024 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
precision lowp int;
precision highp float;
precision mediump sampler2D;
layout(location = 0) in vec2 a_position2f;
layout(location = 1) in vec3 p_position3f;
layout(location = 2) in vec2 p_texCoords2i;
layout(location = 3) in vec2 p_lightMap2f;
layout(location = 4) in vec2 p_particleSize_texCoordsSize_2i;
layout(location = 5) in vec4 p_color4f;
out vec4 v_position4f;
out vec2 v_texCoord2f;
out vec4 v_color4f;
out vec2 v_lightmap2f;
uniform mat4 u_modelViewMatrix4f;
uniform mat4 u_projectionMatrix4f;
uniform vec3 u_texCoordSize2f_particleSize1f;
uniform vec3 u_transformParam_1_2_5_f;
uniform vec2 u_transformParam_3_4_f;
uniform vec4 u_color4f;
void main() {
v_color4f = u_color4f * p_color4f.bgra;
v_lightmap2f = p_lightMap2f;
vec2 tex2f = a_position2f * 0.5 + 0.5;
tex2f.y = 1.0 - tex2f.y;
tex2f = p_texCoords2i + tex2f * p_particleSize_texCoordsSize_2i.y;
v_texCoord2f = tex2f * u_texCoordSize2f_particleSize1f.xy;
float particleSize = u_texCoordSize2f_particleSize1f.z * p_particleSize_texCoordsSize_2i.x;
vec3 pos3f = p_position3f;
vec2 spos2f = a_position2f * particleSize;
pos3f += u_transformParam_1_2_5_f * spos2f.xyy;
pos3f.zx += u_transformParam_3_4_f * spos2f;
v_position4f = u_modelViewMatrix4f * vec4(pos3f, 1.0);
gl_Position = u_projectionMatrix4f * v_position4f;
}

View File

@ -0,0 +1,210 @@
#line 2
/*
* Copyright (c) 2022-2024 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
in vec4 v_position4f;
#ifdef COMPILE_TEXTURE_ATTRIB
in vec2 v_texture2f;
#endif
uniform vec4 u_color4f;
#ifdef COMPILE_BLEND_ADD
uniform vec4 u_colorBlendSrc4f;
uniform vec4 u_colorBlendAdd4f;
#endif
#ifdef COMPILE_COLOR_ATTRIB
in vec4 v_color4f;
#endif
#ifdef COMPILE_NORMAL_ATTRIB
in vec3 v_normal3f;
#endif
#ifdef COMPILE_LIGHTMAP_ATTRIB
in vec2 v_lightmap2f;
#endif
#ifdef COMPILE_ENABLE_TEXTURE2D
uniform sampler2D u_samplerTexture;
#if !defined(COMPILE_TEXTURE_ATTRIB) && !defined(COMPILE_ENABLE_TEX_GEN)
uniform vec2 u_textureCoords01;
#endif
#endif
#ifdef COMPILE_ENABLE_LIGHTMAP
uniform sampler2D u_samplerLightmap;
#ifndef COMPILE_LIGHTMAP_ATTRIB
uniform vec2 u_textureCoords02;
#endif
#endif
#ifdef COMPILE_ENABLE_ALPHA_TEST
uniform float u_alphaTestRef1f;
#endif
#ifdef COMPILE_ENABLE_MC_LIGHTING
uniform int u_lightsEnabled1i;
uniform vec4 u_lightsDirections4fv[4];
uniform vec3 u_lightsAmbient3f;
#endif
#ifndef COMPILE_NORMAL_ATTRIB
uniform vec3 u_uniformNormal3f;
#endif
#ifdef COMPILE_ENABLE_FOG
uniform vec4 u_fogParameters4f;
uniform vec4 u_fogColor4f;
#endif
#ifdef COMPILE_ENABLE_TEX_GEN
in vec3 v_objectPosition3f;
uniform ivec4 u_texGenPlane4i;
uniform vec4 u_texGenS4f;
uniform vec4 u_texGenT4f;
uniform vec4 u_texGenR4f;
uniform vec4 u_texGenQ4f;
uniform mat4 u_textureMat4f01;
#endif
#ifdef COMPILE_ENABLE_ANISOTROPIC_FIX
uniform vec2 u_textureAnisotropicFix;
#endif
uniform mat4 u_inverseViewMatrix4f;
layout(std140) uniform u_chunkLightingData {
mediump int u_dynamicLightCount1i;
mediump int _paddingA_;
mediump int _paddingB_;
mediump int _paddingC_;
mediump vec4 u_dynamicLightArray[12];
};
layout(location = 0) out vec4 output4f;
void main() {
#ifdef COMPILE_COLOR_ATTRIB
vec4 color = v_color4f * u_color4f;
#else
vec4 color = u_color4f;
#endif
#ifdef COMPILE_ENABLE_TEX_GEN
vec4 texGenVector;
vec4 texGenPosSrc[2];
texGenPosSrc[0] = vec4(v_objectPosition3f, 1.0);
texGenPosSrc[1] = v_position4f;
texGenVector.x = dot(texGenPosSrc[u_texGenPlane4i.x], u_texGenS4f);
texGenVector.y = dot(texGenPosSrc[u_texGenPlane4i.y], u_texGenT4f);
texGenVector.z = dot(texGenPosSrc[u_texGenPlane4i.z], u_texGenR4f);
texGenVector.w = dot(texGenPosSrc[u_texGenPlane4i.w], u_texGenQ4f);
texGenVector = u_textureMat4f01 * texGenVector;
color *= texture(u_samplerTexture, texGenVector.xy / texGenVector.w);
#ifdef COMPILE_ENABLE_ALPHA_TEST
if(color.a < u_alphaTestRef1f) discard;
#endif
#else
#ifdef COMPILE_ENABLE_TEXTURE2D
#ifdef COMPILE_TEXTURE_ATTRIB
#ifdef COMPILE_ENABLE_ANISOTROPIC_FIX
// d3d11 doesn't support GL_NEAREST upscaling with anisotropic
// filtering enabled, so it needs this stupid fix to 'work'
vec2 uv = floor(v_texture2f * u_textureAnisotropicFix) + 0.5;
color *= texture(u_samplerTexture, uv / u_textureAnisotropicFix);
#else
color *= texture(u_samplerTexture, v_texture2f);
#endif
#else
color *= texture(u_samplerTexture, u_textureCoords01);
#endif
#endif
#ifdef COMPILE_NORMAL_ATTRIB
vec3 normal = normalize(v_normal3f);
#else
vec3 normal = u_uniformNormal3f;
#endif
#ifdef COMPILE_ENABLE_LIGHTMAP
float diffuse = 0.0;
vec4 light;
if(u_dynamicLightCount1i > 0) {
vec4 worldPosition4f = u_inverseViewMatrix4f * v_position4f;
worldPosition4f.xyz /= worldPosition4f.w;
vec3 normalVector3f = normalize(mat3(u_inverseViewMatrix4f) * normal);
int safeLightCount = u_dynamicLightCount1i > 12 ? 0 : u_dynamicLightCount1i;
for(int i = 0; i < safeLightCount; ++i) {
light = u_dynamicLightArray[i];
light.xyz = light.xyz - worldPosition4f.xyz;
diffuse += max(dot(normalize(light.xyz), normalVector3f) * 0.8 + 0.2, 0.0) * max(light.w - sqrt(dot(light.xyz, light.xyz)), 0.0);
}
}
#ifdef COMPILE_LIGHTMAP_ATTRIB
color *= texture(u_samplerLightmap, vec2(min(v_lightmap2f.x + diffuse * 0.066667, 1.0), v_lightmap2f.y));
#else
color *= texture(u_samplerLightmap, vec2(min(u_textureCoords02.x + diffuse * 0.066667, 1.0), u_textureCoords02.y));
#endif
#endif
#ifdef COMPILE_BLEND_ADD
color = color * u_colorBlendSrc4f + u_colorBlendAdd4f;
#endif
#ifdef COMPILE_ENABLE_ALPHA_TEST
if(color.a < u_alphaTestRef1f) discard;
#endif
#endif
#ifdef COMPILE_ENABLE_MC_LIGHTING
#ifndef COMPILE_ENABLE_LIGHTMAP
vec4 light;
float diffuse = 0.0;
#else
diffuse = 0.0;
#endif
for(int i = 0; i < u_lightsEnabled1i; ++i) {
light = u_lightsDirections4fv[i];
diffuse += max(dot(light.xyz, normal), 0.0) * light.w;
}
color.rgb *= min(u_lightsAmbient3f + vec3(diffuse), 1.0);
#endif
#ifdef COMPILE_ENABLE_FOG
vec3 fogPos = v_position4f.xyz / v_position4f.w;
float dist = sqrt(dot(fogPos, fogPos));
float fogDensity = u_fogParameters4f.y;
float fogStart = u_fogParameters4f.z;
float fogEnd = u_fogParameters4f.w;
float f = u_fogParameters4f.x > 0.0 ? 1.0 - exp(-fogDensity * dist) :
(dist - fogStart) / (fogEnd - fogStart);
color.rgb = mix(color.rgb, u_fogColor4f.rgb, clamp(f, 0.0, 1.0) * u_fogColor4f.a);
#endif
output4f = color;
}

View File

@ -0,0 +1,80 @@
#line 2
/*
* Copyright (c) 2022-2024 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
in vec3 a_position3f;
out vec4 v_position4f;
#ifdef COMPILE_ENABLE_TEX_GEN
out vec3 v_objectPosition3f;
#endif
#ifdef COMPILE_TEXTURE_ATTRIB
in vec2 a_texture2f;
out vec2 v_texture2f;
uniform mat4 u_textureMat4f01;
#endif
#ifdef COMPILE_COLOR_ATTRIB
in vec4 a_color4f;
out vec4 v_color4f;
#endif
#ifdef COMPILE_NORMAL_ATTRIB
in vec4 a_normal4f;
out vec3 v_normal3f;
#endif
#ifdef COMPILE_LIGHTMAP_ATTRIB
in vec2 a_lightmap2f;
out vec2 v_lightmap2f;
uniform mat4 u_textureMat4f02;
#endif
uniform mat4 u_modelviewMat4f;
uniform mat4 u_projectionMat4f;
#define TEX_MAT3(mat4In) mat3(mat4In[0].xyw,mat4In[1].xyw,mat4In[3].xyw)
void main() {
#ifdef COMPILE_ENABLE_TEX_GEN
v_objectPosition3f = a_position3f;
#endif
v_position4f = u_modelviewMat4f * vec4(a_position3f, 1.0);
#ifdef COMPILE_TEXTURE_ATTRIB
vec3 v_textureTmp3f = TEX_MAT3(u_textureMat4f01) * vec3(a_texture2f, 1.0);
v_texture2f = v_textureTmp3f.xy / v_textureTmp3f.z;
#endif
#ifdef COMPILE_COLOR_ATTRIB
v_color4f = a_color4f;
#endif
#ifdef COMPILE_NORMAL_ATTRIB
v_normal3f = normalize(mat3(u_modelviewMat4f) * a_normal4f.xyz);
#endif
#ifdef COMPILE_LIGHTMAP_ATTRIB
vec3 v_lightmapTmp3f = TEX_MAT3(u_textureMat4f02) * vec3(a_lightmap2f, 1.0);
v_lightmap2f = v_lightmapTmp3f.xy / v_lightmapTmp3f.z;
#endif
gl_Position = u_projectionMat4f * v_position4f;
}

View File

@ -0,0 +1,9 @@
THESE ARE NOT DOOM/GMOD MODELS!
The FNAW skins are stored in a proprietary format created by lax1dude.
The format is a container for raw OpenGL vertex buffer and index buffer data intended to be copied directly into the GPU's memory, along with a small amount of metadata.
Data is rendered in GL_TRIANGLES mode using glDrawElements.
See "net/lax1dude/eaglercraft/v1_8/opengl/EaglerMeshLoader.java" and "net/lax1dude/eaglercraft/v1_8/opengl/HighPolyMesh.java" for more details.

View File

@ -0,0 +1,10 @@
{
"variants": {
"facing=up": { "model": "end_rod" },
"facing=down": { "model": "end_rod", "x": 180 },
"facing=east": { "model": "end_rod", "y": 90, "x": 90 },
"facing=south": { "model": "end_rod", "y": 180, "x": 90 },
"facing=west": { "model": "end_rod", "y": 270, "x": 90 },
"facing=north": { "model": "end_rod", "y": 0, "x": 90 }
}
}

View File

@ -0,0 +1,5 @@
{
"variants": {
"normal": { "model": "grass_path" }
}
}

View File

@ -129,6 +129,7 @@ eaglercraft.options.fastMath=Fast Math
eaglercraft.options.fastMath.0=OFF
eaglercraft.options.fastMath.1=Low
eaglercraft.options.fastMath.2=High
eaglercraft.options.dynamicLights=Dynamic Lights
eaglercraft.key.function=Function
eaglercraft.key.zoomCamera=Zoom Camera
@ -576,7 +577,12 @@ eaglercraft.singleplayer.demo.create.create.tooltip=Play the Minecraft 1.8 demo
eaglercraft.singleplayer.demo.create.join=Join Shared World
eaglercraft.singleplayer.demo.create.join.tooltip=Join someone else's world and play multiplayer
eaglercraft.createWorld.seedNote=Note: Vanilla seeds do not work!
eaglercraft.createWorld.seedNote=Note: Vanilla seeds now work!
eaglercraft.singleplayer.oldseedwarning.title=Old World Detected!
eaglercraft.singleplayer.oldseedwarning.msg1=Please use EaglercraftX u32 or older to "Re-Create" this world
eaglercraft.singleplayer.oldseedwarning.msg2=The world's seed will not be the same otherwise :(
eaglercraft.singleplayer.oldseedwarning.ok=OK
eaglercraft.singleplayer.outdatedLANServerKick=This is a 1.5.2 LAN world!
@ -3158,6 +3164,9 @@ tile.purpurPillar.name=Purpur Pillar
tile.purpurStairs.name=Purpur Stairs
tile.purpurSlab.name=Purpur Slab
tile.purpurSlab.default.name=Purpur Slab
tile.purpurStairs.name=Purpur Stairs
tile.endRod.name=End Rod
tile.grassPath.name=Grass Path
tile.endBricks.name=End Stone Bricks
item.chorusFruit.name=Chorus Fruit

View File

@ -0,0 +1,44 @@
{
"display": {
"head": {
"rotation": [ -60, 0, 0 ],
"translation": [ 0, 5, -9],
"scale":[ 1, 1, 1]
},
"thirdperson": {
"rotation": [ 0, 0, 0 ],
"translation": [ 0, 0, 0],
"scale": [ 0.375, 0.375, 0.375 ]
}
},
"ambientocclusion": false,
"textures": {
"end_rod": "blocks/end_rod"
},
"elements": [
{
"from": [ 6, 0, 6 ],
"to": [ 10, 1, 10 ],
"faces": {
"down": { "uv": [ 6, 6, 2, 2 ], "texture": "#end_rod" },
"up": { "uv": [ 2, 2, 6, 6 ], "texture": "#end_rod" },
"north": { "uv": [ 2, 6, 6, 7 ], "texture": "#end_rod" },
"south": { "uv": [ 2, 6, 6, 7 ], "texture": "#end_rod" },
"west": { "uv": [ 2, 6, 6, 7 ], "texture": "#end_rod" },
"east": { "uv": [ 2, 6, 6, 7 ], "texture": "#end_rod" }
}
},
{
"from": [ 7, 1, 7 ],
"to": [ 9, 16, 9 ],
"faces": {
"down": { "uv": [ 4, 2, 2, 0 ], "texture": "#end_rod" },
"up": { "uv": [ 2, 0, 4, 2 ], "texture": "#end_rod" },
"north": { "uv": [ 0, 0, 2, 15 ], "texture": "#end_rod" },
"south": { "uv": [ 0, 0, 2, 15 ], "texture": "#end_rod" },
"west": { "uv": [ 0, 0, 2, 15 ], "texture": "#end_rod" },
"east": { "uv": [ 0, 0, 2, 15 ], "texture": "#end_rod" }
}
}
]
}

View File

@ -0,0 +1,21 @@
{
"textures": {
"particle": "blocks/dirt",
"top": "blocks/grass_path_top",
"side": "blocks/grass_path_side",
"bottom": "blocks/dirt"
},
"elements": [
{ "from": [ 0, 0, 0 ],
"to": [ 16, 15, 16 ],
"faces": {
"down": { "uv": [ 0, 0, 16, 16 ], "texture": "#bottom", "cullface": "down" },
"up": { "uv": [ 0, 0, 16, 16 ], "texture": "#top" },
"north": { "uv": [ 0, 1, 16, 16 ], "texture": "#side", "cullface": "north" },
"south": { "uv": [ 0, 1, 16, 16 ], "texture": "#side", "cullface": "south" },
"west": { "uv": [ 0, 1, 16, 16 ], "texture": "#side", "cullface": "west" },
"east": { "uv": [ 0, 1, 16, 16 ], "texture": "#side", "cullface": "east" }
}
}
]
}

View File

@ -0,0 +1,13 @@
{
"parent": "block/end_rod",
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
},
"textures": {
"layer0": "blocks/end_rod"
}
}

View File

@ -0,0 +1,10 @@
{
"parent": "block/grass_path",
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 626 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 397 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@ -3,16 +3,23 @@ package net.lax1dude.eaglercraft.v1_8;
import net.lax1dude.eaglercraft.v1_8.internal.PlatformRuntime;
/**
* Copyright (c) 2022 lax1dude. All Rights Reserved.
* Copyright (c) 2022-2024 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
@ -25,20 +32,47 @@ public class EaglercraftRandom {
private static final double DOUBLE_UNIT = 0x1.0p-53;
private long seed = 69;
private static int yee = 0;
private final boolean enableScramble;
public EaglercraftRandom() {
this(PlatformRuntime.randomSeed());
}
public EaglercraftRandom(long seed) {
this(seed, true);
}
public EaglercraftRandom(boolean scramble) {
this(PlatformRuntime.randomSeed(), scramble);
}
/**
* Older versions of EaglercraftX (and Eaglercraft) are missing the
* "initialScramble" function from their setSeed function, which was what caused
* world generation to not match vanilla. The "enableScramble" boolean is used
* when players play on an old world created before the bug was fixed.
*/
public EaglercraftRandom(long seed, boolean scramble) {
enableScramble = scramble;
setSeed(seed);
}
private static long initialScramble(long seed) {
return (seed ^ multiplier) & mask;
}
public void setSeed(long yeed) {
if (enableScramble) {
seed = initialScramble(yeed);
} else {
seed = yeed;
}
haveNextNextGaussian = true;
}
public boolean isScramble() {
return enableScramble;
}
protected int next(int bits) {
seed = (seed * multiplier + addend) & mask;

View File

@ -9,7 +9,7 @@ public class EaglercraftVersion {
/// Customize these to fit your fork:
public static final String projectForkName = "Eaglercraft Lambda";
public static final String projectForkVersion = "0.3.5";
public static final String projectForkVersion = "0.4.0";
public static final String projectForkVendor = "HoosierTransfer";
public static final String projectForkURL = "https://gitlab.com/lax1dude/eaglercraftx-1.8";
@ -19,7 +19,7 @@ public class EaglercraftVersion {
public static final String projectOriginName = "EaglercraftX";
public static final String projectOriginAuthor = "lax1dude";
public static final String projectOriginRevision = "1.9.4";
public static final String projectOriginVersion = "u30";
public static final String projectOriginVersion = "u34";
public static final String projectOriginURL = "https://gitlab.com/lax1dude/eaglercraftx-1.8"; // rest in peace
@ -28,7 +28,7 @@ public class EaglercraftVersion {
public static final boolean enableUpdateService = false;
public static final String updateBundlePackageName = "net.lax1dude.eaglercraft.v1_8.client";
public static final int updateBundlePackageVersionInt = 30;
public static final int updateBundlePackageVersionInt = 34;
public static final String updateLatestLocalStorageKey = "latestUpdate_" + updateBundlePackageName;

View File

@ -19,6 +19,7 @@ import net.lax1dude.eaglercraft.v1_8.internal.PlatformRuntime;
import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
import net.lax1dude.eaglercraft.v1_8.log4j.Logger;
import net.lax1dude.eaglercraft.v1_8.opengl.StreamBuffer.StreamBufferInstance;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.DynamicLightsStateManager;
import net.lax1dude.eaglercraft.v1_8.vector.Matrix4f;
import net.lax1dude.eaglercraft.v1_8.vector.Vector4f;
import net.minecraft.util.MathHelper;
@ -29,14 +30,21 @@ import static net.lax1dude.eaglercraft.v1_8.opengl.FixedFunctionShader.FixedFunc
/**
* Copyright (c) 2022-2023 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
@ -50,12 +58,18 @@ public class FixedFunctionPipeline {
(GlStateManager.stateTexture[1] ? STATE_ENABLE_LIGHTMAP : 0) |
(GlStateManager.stateAlphaTest ? STATE_ENABLE_ALPHA_TEST : 0) |
((GlStateManager.stateLighting && GlStateManager.stateMaterial)
? STATE_ENABLE_MC_LIGHTING : 0) |
? STATE_ENABLE_MC_LIGHTING
: 0)
|
((GlStateManager.stateTexture[0] && GlStateManager.stateTexGen)
? STATE_ENABLE_END_PORTAL : 0) |
? STATE_ENABLE_END_PORTAL
: 0)
|
/* TODO: (GlStateManager.??? ? STATE_ENABLE_ANISOTROPIC_FIX : 0) | */
((GlStateManager.stateFog && GlStateManager.stateFogDensity > 0.0f)
? STATE_ENABLE_FOG : 0) |
? STATE_ENABLE_FOG
: 0)
|
(GlStateManager.stateEnableShaderBlendColor ? STATE_ENABLE_BLEND_ADD : 0);
}
@ -189,8 +203,10 @@ public class FixedFunctionPipeline {
extensionProvider = provider;
}
private static final FixedFunctionPipeline[] pipelineStateCache = new FixedFunctionPipeline[fixedFunctionStatesBits + 1];
private static final FixedFunctionPipeline[][] pipelineExtStateCache = new FixedFunctionPipeline[fixedFunctionStatesBits + 1][];
private static final FixedFunctionPipeline[] pipelineStateCache = new FixedFunctionPipeline[fixedFunctionStatesBits
+ 1];
private static final FixedFunctionPipeline[][] pipelineExtStateCache = new FixedFunctionPipeline[fixedFunctionStatesBits
+ 1][];
private static final List<FixedFunctionPipeline> pipelineListTracker = new ArrayList(1024);
private static String shaderSourceCacheVSH = null;
@ -208,7 +224,8 @@ public class FixedFunctionPipeline {
coreBits &= (15 | extensionProvider.getCoreStateMask(extBits));
FixedFunctionPipeline[] pp = pipelineExtStateCache[coreBits];
if (pp == null) {
pipelineExtStateCache[coreBits] = pp = new FixedFunctionPipeline[1 << extensionProvider.getExtensionStatesCount()];
pipelineExtStateCache[coreBits] = pp = new FixedFunctionPipeline[1 << extensionProvider
.getExtensionStatesCount()];
return pp[extBits] = makeNewPipeline(coreBits, extBits, true);
} else {
FixedFunctionPipeline ppp = pp[extBits];
@ -294,7 +311,8 @@ public class FixedFunctionPipeline {
_wglCompileShader(vsh);
if (_wglGetShaderi(vsh, GL_COMPILE_STATUS) != GL_TRUE) {
LOGGER.error("Failed to compile GL_VERTEX_SHADER for state {} !", (visualizeBits(coreBits) + (enableExt && extBits != 0 ? " ext " + visualizeBits(extBits) : "")));
LOGGER.error("Failed to compile GL_VERTEX_SHADER for state {} !",
(visualizeBits(coreBits) + (enableExt && extBits != 0 ? " ext " + visualizeBits(extBits) : "")));
String log = _wglGetShaderInfoLog(vsh);
if (log != null) {
String[] lines = log.split("(\\r\\n|\\r|\\n)");
@ -312,7 +330,8 @@ public class FixedFunctionPipeline {
_wglCompileShader(fsh);
if (_wglGetShaderi(fsh, GL_COMPILE_STATUS) != GL_TRUE) {
LOGGER.error("Failed to compile GL_FRAGMENT_SHADER for state {} !", (visualizeBits(coreBits) + (enableExt && extBits != 0 ? " ext " + visualizeBits(extBits) : "")));
LOGGER.error("Failed to compile GL_FRAGMENT_SHADER for state {} !",
(visualizeBits(coreBits) + (enableExt && extBits != 0 ? " ext " + visualizeBits(extBits) : "")));
String log = _wglGetShaderInfoLog(fsh);
if (log != null) {
String[] lines = log.split("(\\r\\n|\\r|\\n)");
@ -566,7 +585,8 @@ public class FixedFunctionPipeline {
_wglLinkProgram(compiledProg);
if (_wglGetProgrami(compiledProg, GL_LINK_STATUS) != GL_TRUE) {
LOGGER.error("Program could not be linked for state {} !", (visualizeBits(bits) + (extensionProvider != null && extBits != 0 ? " ext " + visualizeBits(extBits) : "")));
LOGGER.error("Program could not be linked for state {} !", (visualizeBits(bits)
+ (extensionProvider != null && extBits != 0 ? " ext " + visualizeBits(extBits) : "")));
String log = _wglGetProgramInfoLog(compiledProg);
if (log != null) {
String[] lines = log.split("(\\r\\n|\\r|\\n)");
@ -680,8 +700,10 @@ public class FixedFunctionPipeline {
stateModelProjectionMatrixUniformMat4f = _wglGetUniformLocation(compiledProg,
UNIFORM_MODEL_PROJECTION_MATRIX_NAME);
stateTextureMatrix01UniformMat4f = (stateEnableEndPortal || stateHasAttribTexture) ? _wglGetUniformLocation(compiledProg,
UNIFORM_TEXTURE_MATRIX_01_NAME) : null;
stateTextureMatrix01UniformMat4f = (stateEnableEndPortal || stateHasAttribTexture)
? _wglGetUniformLocation(compiledProg,
UNIFORM_TEXTURE_MATRIX_01_NAME)
: null;
stateTextureMatrix02UniformMat4f = stateHasAttribLightmap ? _wglGetUniformLocation(compiledProg,
UNIFORM_TEXTURE_MATRIX_02_NAME) : null;
@ -773,7 +795,8 @@ public class FixedFunctionPipeline {
matrixCopyBuffer.flip();
_wglUniformMatrix4fv(stateModelMatrixUniformMat4f, false, matrixCopyBuffer);
}
Matrix4f.mul(GlStateManager.projectionMatrixStack[ptr2], GlStateManager.modelMatrixStack[ptr], tmpMatrixForInv);
Matrix4f.mul(GlStateManager.projectionMatrixStack[ptr2], GlStateManager.modelMatrixStack[ptr],
tmpMatrixForInv);
matrixCopyBuffer.clear();
tmpMatrixForInv.store(matrixCopyBuffer);
matrixCopyBuffer.flip();
@ -904,7 +927,9 @@ public class FixedFunctionPipeline {
_wglUniform3f(stateLightingAmbientUniform3f, r, g, b);
}
}
}
if (stateEnableMCLighting || DynamicLightsStateManager.isInDynamicLightsPass()) {
if (!stateHasAttribNormal) {
serial = GlStateManager.stateNormalSerial;
if (stateNormalSerial != serial) {
@ -913,7 +938,9 @@ public class FixedFunctionPipeline {
float y = GlStateManager.stateNormalY;
float z = GlStateManager.stateNormalZ;
float c = MathHelper.Q_rsqrt(x * x + y * y + z * z);
x *= c; y *= c; z *= c;
x *= c;
y *= c;
z *= c;
if (stateNormalX != x || stateNormalY != y || stateNormalZ != z) {
stateNormalX = x;
stateNormalY = y;
@ -1090,7 +1117,8 @@ public class FixedFunctionPipeline {
if (pppp != null) {
pppp.destroy();
if (extensionProvider != null && pppp.extensionPointer != null) {
extensionProvider.destroyPipeline(pppp.shaderProgram, pppp.stateCoreBits, pppp.stateExtBits, pppp.extensionPointer);
extensionProvider.destroyPipeline(pppp.shaderProgram, pppp.stateCoreBits, pppp.stateExtBits,
pppp.extensionPointer);
}
}
}

View File

@ -814,6 +814,22 @@ public class GlStateManager {
}
}
public static final void getFloat(int pname, FloatBuffer params) {
switch (pname) {
case GL_MODELVIEW_MATRIX:
modelMatrixStack[modelMatrixStackPointer].store(params);
break;
case GL_PROJECTION_MATRIX:
projectionMatrixStack[projectionMatrixStackPointer].store(params);
break;
case GL_TEXTURE_MATRIX:
textureMatrixStack[activeTexture][textureMatrixStackPointer[activeTexture]].store(params);
break;
default:
throw new UnsupportedOperationException("glGetFloat can only be used to retrieve matricies!");
}
}
public static final void ortho(double left, double right, double bottom, double top, double zNear, double zFar) {
Matrix4f matrix;
switch (stateMatrixMode) {

View File

@ -19,14 +19,21 @@ import net.lax1dude.eaglercraft.v1_8.vector.Matrix4f;
/**
* Copyright (c) 2022 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
@ -49,8 +56,8 @@ public class InstancedParticleRenderer {
private static IUniformGL u_matrixTransform = null;
private static FloatBuffer matrixCopyBuffer = null;
private static IUniformGL u_texCoordSize2f_particleSize1f = null;
private static IUniformGL u_transformParam_1_2_3_4_f = null;
private static IUniformGL u_transformParam_5_f = null;
private static IUniformGL u_transformParam_1_2_5_f = null;
private static IUniformGL u_transformParam_3_4_f = null;
private static IUniformGL u_color4f = null;
private static IBufferArrayGL vertexArray = null;
@ -96,7 +103,8 @@ public class InstancedParticleRenderer {
_wglCompileShader(vert);
if (_wglGetShaderi(vert, GL_COMPILE_STATUS) != GL_TRUE) {
logger.error("Failed to compile GL_VERTEX_SHADER \"" + vertexShaderPath + "\" for InstancedParticleRenderer!");
logger.error(
"Failed to compile GL_VERTEX_SHADER \"" + vertexShaderPath + "\" for InstancedParticleRenderer!");
String log = _wglGetShaderInfoLog(vert);
if (log != null) {
String[] lines = log.split("(\\r\\n|\\r|\\n)");
@ -111,7 +119,8 @@ public class InstancedParticleRenderer {
_wglCompileShader(frag);
if (_wglGetShaderi(frag, GL_COMPILE_STATUS) != GL_TRUE) {
logger.error("Failed to compile GL_FRAGMENT_SHADER \"" + fragmentShaderPath + "\" for InstancedParticleRenderer!");
logger.error("Failed to compile GL_FRAGMENT_SHADER \"" + fragmentShaderPath
+ "\" for InstancedParticleRenderer!");
String log = _wglGetShaderInfoLog(frag);
if (log != null) {
String[] lines = log.split("(\\r\\n|\\r|\\n)");
@ -154,8 +163,8 @@ public class InstancedParticleRenderer {
u_matrixTransform = _wglGetUniformLocation(shaderProgram, "u_matrixTransform");
u_texCoordSize2f_particleSize1f = _wglGetUniformLocation(shaderProgram, "u_texCoordSize2f_particleSize1f");
u_transformParam_1_2_3_4_f = _wglGetUniformLocation(shaderProgram, "u_transformParam_1_2_3_4_f");
u_transformParam_5_f = _wglGetUniformLocation(shaderProgram, "u_transformParam_5_f");
u_transformParam_1_2_5_f = _wglGetUniformLocation(shaderProgram, "u_transformParam_1_2_5_f");
u_transformParam_3_4_f = _wglGetUniformLocation(shaderProgram, "u_transformParam_3_4_f");
u_color4f = _wglGetUniformLocation(shaderProgram, "u_color4f");
_wglUniform1i(_wglGetUniformLocation(shaderProgram, "u_inputTexture"), 0);
@ -216,8 +225,10 @@ public class InstancedParticleRenderer {
public static void appendParticle(float posX, float posY, float posZ, int particleTextureX, int particleTextureY,
int lightMapX, int lightMapY, int particleSize, int particleTexSize, float r, float g, float b, float a) {
int color = ((int)(a * 255.0f) << 24) | ((int)(r * 255.0f) << 16) | ((int)(g * 255.0f) << 8) | (int)(b * 255.0f);
appendParticle(posX, posY, posZ, particleTextureX, particleTextureY, lightMapX, lightMapY, particleSize, particleTexSize, color);
int color = ((int) (a * 255.0f) << 24) | ((int) (r * 255.0f) << 16) | ((int) (g * 255.0f) << 8)
| (int) (b * 255.0f);
appendParticle(posX, posY, posZ, particleTextureX, particleTextureY, lightMapX, lightMapY, particleSize,
particleTexSize, color);
}
public static void appendParticle(float posX, float posY, float posZ, int particleTextureX, int particleTextureY,
@ -227,7 +238,8 @@ public class InstancedParticleRenderer {
}
if (particleCount >= PARTICLE_LIMIT) {
particlesHasOverflowed = true;
logger.error("Particle buffer has overflowed! Exceeded {} particles, no more particles will be rendered.", PARTICLE_LIMIT);
logger.error("Particle buffer has overflowed! Exceeded {} particles, no more particles will be rendered.",
PARTICLE_LIMIT);
return;
}
++particleCount;
@ -260,17 +272,17 @@ public class InstancedParticleRenderer {
}
if (transformParam1 != stateTransformParam1 || transformParam2 != stateTransformParam2
|| transformParam3 != stateTransformParam3 || transformParam4 != stateTransformParam4) {
_wglUniform4f(u_transformParam_1_2_3_4_f, transformParam1, transformParam2, transformParam3, transformParam4);
|| transformParam5 != stateTransformParam5) {
_wglUniform3f(u_transformParam_1_2_5_f, transformParam1, transformParam2, transformParam5);
stateTransformParam1 = transformParam1;
stateTransformParam2 = transformParam2;
stateTransformParam3 = transformParam3;
stateTransformParam4 = transformParam4;
stateTransformParam5 = transformParam5;
}
if (transformParam5 != stateTransformParam5) {
_wglUniform1f(u_transformParam_5_f, transformParam5);
stateTransformParam5 = transformParam5;
if (transformParam3 != stateTransformParam3 || transformParam4 != stateTransformParam4) {
_wglUniform2f(u_transformParam_3_4_f, transformParam3, transformParam4);
stateTransformParam3 = transformParam3;
stateTransformParam4 = transformParam4;
}
int serial = GlStateManager.stateColorSerial;
@ -319,4 +331,9 @@ public class InstancedParticleRenderer {
_wglDrawArraysInstanced(GL_TRIANGLES, 0, 6, particleCount);
}
public static void stupidColorSetHack(IUniformGL color4f) {
_wglUniform4f(color4f, GlStateManager.stateColorR, GlStateManager.stateColorG, GlStateManager.stateColorB,
GlStateManager.stateColorA);
}
}

View File

@ -13,8 +13,7 @@ import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*;
import net.lax1dude.eaglercraft.v1_8.opengl.EaglercraftGPU;
/**
* Copyright (c) 2023 lax1dude, hoosiertransfer, ayunami2000. All Rights
* Reserved.
* Copyright (c) 2023 lax1dude, ayunami2000. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND
@ -115,7 +114,7 @@ public class DeferredStateManager {
}
public static final boolean isInDeferredPass() {
return GlStateManager.isExtensionPipeline();
return EaglerDeferredPipeline.instance != null && GlStateManager.isExtensionPipeline();
}
public static final boolean isInForwardPass() {
@ -162,13 +161,20 @@ public class DeferredStateManager {
}
public static final void reportForwardRenderObjectPosition2(float x, float y, float z) {
EaglerDeferredPipeline instance = EaglerDeferredPipeline.instance;
if (instance != null && enableForwardRender) {
EaglerDeferredConfig cfg = instance.config;
if (!cfg.is_rendering_dynamicLights || !cfg.shaderPackInfo.DYNAMIC_LIGHTS) {
return;
}
float posX = (float) ((x + TileEntityRendererDispatcher.staticPlayerX)
- (MathHelper.floor_double(TileEntityRendererDispatcher.staticPlayerX / 16.0) << 4));
float posY = (float) ((y + TileEntityRendererDispatcher.staticPlayerY)
- (MathHelper.floor_double(TileEntityRendererDispatcher.staticPlayerY / 16.0) << 4));
float posZ = (float) ((z + TileEntityRendererDispatcher.staticPlayerZ)
- (MathHelper.floor_double(TileEntityRendererDispatcher.staticPlayerZ / 16.0) << 4));
reportForwardRenderObjectPosition((int) posX, (int) posY, (int) posZ);
instance.loadLightSourceBucket((int) posX, (int) posY, (int) posZ);
}
}
public static final void setHDRTranslucentPassBlendFunc() {

View File

@ -20,14 +20,21 @@ import net.minecraft.util.MathHelper;
/**
* Copyright (c) 2023 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
@ -124,17 +131,25 @@ public class ForwardAcceleratedEffectRenderer extends AbstractAcceleratedEffectR
shaderProgram.useProgram();
_wglUniform3f(shaderProgram.uniforms.u_texCoordSize2f_particleSize1f, texCoordWidth, texCoordHeight, 0.0625f);
if (shaderProgram.uniforms.u_transformParam_1_2_5_f != null) {
_wglUniform3f(shaderProgram.uniforms.u_transformParam_1_2_5_f, f1, f5, f4);
_wglUniform2f(shaderProgram.uniforms.u_transformParam_3_4_f, f2, f3);
} else {
_wglUniform4f(shaderProgram.uniforms.u_transformParam_1_2_3_4_f, f1, f5, f2, f3);
_wglUniform1f(shaderProgram.uniforms.u_transformParam_5_f, f4);
}
if (isMaterialNormalTexture) {
_wglUniform2f(shaderProgram.uniforms.u_textureYScale2f, 0.5f, 0.5f);
} else {
_wglUniform2f(shaderProgram.uniforms.u_textureYScale2f, 1.0f, 0.0f);
}
EaglerDeferredPipeline.uniformMatrixHelper(shaderProgram.uniforms.u_modelViewMatrix4f, DeferredStateManager.passViewMatrix);
EaglerDeferredPipeline.uniformMatrixHelper(shaderProgram.uniforms.u_projectionMatrix4f, DeferredStateManager.passProjMatrix);
EaglerDeferredPipeline.uniformMatrixHelper(shaderProgram.uniforms.u_inverseViewMatrix4f, DeferredStateManager.passInverseViewMatrix);
EaglerDeferredPipeline.uniformMatrixHelper(shaderProgram.uniforms.u_modelViewMatrix4f,
DeferredStateManager.passViewMatrix);
EaglerDeferredPipeline.uniformMatrixHelper(shaderProgram.uniforms.u_projectionMatrix4f,
DeferredStateManager.passProjMatrix);
EaglerDeferredPipeline.uniformMatrixHelper(shaderProgram.uniforms.u_inverseViewMatrix4f,
DeferredStateManager.passInverseViewMatrix);
EaglercraftGPU.bindGLArrayBuffer(instancesBuffer);
EaglercraftGPU.bindGLBufferArray(vertexArray);
@ -177,7 +192,8 @@ public class ForwardAcceleratedEffectRenderer extends AbstractAcceleratedEffectR
}
if (particleCount >= PARTICLE_LIMIT) {
particlesHasOverflowed = true;
logger.error("Particle buffer has overflowed! Exceeded {} particles, no more particles will be rendered.", PARTICLE_LIMIT);
logger.error("Particle buffer has overflowed! Exceeded {} particles, no more particles will be rendered.",
PARTICLE_LIMIT);
return;
}
++particleCount;

View File

@ -20,14 +20,21 @@ import net.minecraft.util.MathHelper;
/**
* Copyright (c) 2023 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
@ -124,8 +131,13 @@ public class GBufferAcceleratedEffectRenderer extends AbstractAcceleratedEffectR
shaderProgram.useProgram();
_wglUniform3f(shaderProgram.uniforms.u_texCoordSize2f_particleSize1f, texCoordWidth, texCoordHeight, 0.0625f);
if (shaderProgram.uniforms.u_transformParam_1_2_5_f != null) {
_wglUniform3f(shaderProgram.uniforms.u_transformParam_1_2_5_f, f1, f5, f4);
_wglUniform2f(shaderProgram.uniforms.u_transformParam_3_4_f, f2, f3);
} else {
_wglUniform4f(shaderProgram.uniforms.u_transformParam_1_2_3_4_f, f1, f5, f2, f3);
_wglUniform1f(shaderProgram.uniforms.u_transformParam_5_f, f4);
}
if (isMaterialNormalTexture) {
_wglUniform2f(shaderProgram.uniforms.u_textureYScale2f, 0.5f, 0.5f);
} else {
@ -176,7 +188,8 @@ public class GBufferAcceleratedEffectRenderer extends AbstractAcceleratedEffectR
}
if (particleCount >= PARTICLE_LIMIT) {
particlesHasOverflowed = true;
logger.error("Particle buffer has overflowed! Exceeded {} particles, no more particles will be rendered.", PARTICLE_LIMIT);
logger.error("Particle buffer has overflowed! Exceeded {} particles, no more particles will be rendered.",
PARTICLE_LIMIT);
return;
}
++particleCount;

View File

@ -13,14 +13,21 @@ import net.lax1dude.eaglercraft.v1_8.internal.IUniformGL;
/**
* Copyright (c) 2023 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
@ -69,6 +76,8 @@ public class PipelineShaderAccelParticleForward extends ShaderProgram<PipelineSh
public IUniformGL u_texCoordSize2f_particleSize1f = null;
public IUniformGL u_transformParam_1_2_3_4_f = null;
public IUniformGL u_transformParam_5_f = null;
public IUniformGL u_transformParam_1_2_5_f = null;
public IUniformGL u_transformParam_3_4_f = null;
public IUniformGL u_textureYScale2f = null;
public int u_chunkLightingDataBlockBinding = -1;
@ -85,6 +94,8 @@ public class PipelineShaderAccelParticleForward extends ShaderProgram<PipelineSh
u_texCoordSize2f_particleSize1f = _wglGetUniformLocation(prog, "u_texCoordSize2f_particleSize1f");
u_transformParam_1_2_3_4_f = _wglGetUniformLocation(prog, "u_transformParam_1_2_3_4_f");
u_transformParam_5_f = _wglGetUniformLocation(prog, "u_transformParam_5_f");
u_transformParam_1_2_5_f = _wglGetUniformLocation(prog, "u_transformParam_1_2_5_f");
u_transformParam_3_4_f = _wglGetUniformLocation(prog, "u_transformParam_3_4_f");
u_textureYScale2f = _wglGetUniformLocation(prog, "u_textureYScale2f");
_wglUniform1i(_wglGetUniformLocation(prog, "u_diffuseTexture"), 0);
_wglUniform1i(_wglGetUniformLocation(prog, "u_samplerNormalMaterial"), 2);

View File

@ -10,14 +10,21 @@ import net.lax1dude.eaglercraft.v1_8.internal.IUniformGL;
/**
* Copyright (c) 2023 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
@ -53,6 +60,8 @@ public class PipelineShaderAccelParticleGBuffer extends ShaderProgram<PipelineSh
public IUniformGL u_texCoordSize2f_particleSize1f = null;
public IUniformGL u_transformParam_1_2_3_4_f = null;
public IUniformGL u_transformParam_5_f = null;
public IUniformGL u_transformParam_1_2_5_f = null;
public IUniformGL u_transformParam_3_4_f = null;
public IUniformGL u_textureYScale2f = null;
private Uniforms() {
@ -64,6 +73,8 @@ public class PipelineShaderAccelParticleGBuffer extends ShaderProgram<PipelineSh
u_texCoordSize2f_particleSize1f = _wglGetUniformLocation(prog, "u_texCoordSize2f_particleSize1f");
u_transformParam_1_2_3_4_f = _wglGetUniformLocation(prog, "u_transformParam_1_2_3_4_f");
u_transformParam_5_f = _wglGetUniformLocation(prog, "u_transformParam_5_f");
u_transformParam_1_2_5_f = _wglGetUniformLocation(prog, "u_transformParam_1_2_5_f");
u_transformParam_3_4_f = _wglGetUniformLocation(prog, "u_transformParam_3_4_f");
u_textureYScale2f = _wglGetUniformLocation(prog, "u_textureYScale2f");
_wglUniform1i(_wglGetUniformLocation(prog, "u_diffuseTexture"), 0);
_wglUniform1i(_wglGetUniformLocation(prog, "u_samplerNormalMaterial"), 2);

View File

@ -18,14 +18,21 @@ import net.minecraft.util.ResourceLocation;
/**
* Copyright (c) 2023 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
@ -34,63 +41,125 @@ public class ShaderSource {
private static final Logger logger = LogManager.getLogger("ShaderSource");
public static final ResourceLocation accel_particle_vsh = new ResourceLocation("eagler:glsl/deferred/accel_particle.vsh");
public static final ResourceLocation accel_particle_gbuffer_fsh = new ResourceLocation("eagler:glsl/deferred/accel_particle_gbuffer.fsh");
public static final ResourceLocation accel_particle_forward_fsh = new ResourceLocation("eagler:glsl/deferred/accel_particle_forward.fsh");
public static final ResourceLocation deferred_core_vsh = new ResourceLocation("eagler:glsl/deferred/deferred_core.vsh");
public static final ResourceLocation deferred_core_gbuffer_fsh = new ResourceLocation("eagler:glsl/deferred/deferred_core_gbuffer.fsh");
public static final ResourceLocation deferred_shadow_vsh = new ResourceLocation("eagler:glsl/deferred/deferred_shadow.vsh");
public static final ResourceLocation deferred_shadow_fsh = new ResourceLocation("eagler:glsl/deferred/deferred_shadow.fsh");
public static final ResourceLocation deferred_local_vsh = new ResourceLocation("eagler:glsl/deferred/deferred_local.vsh");
public static final ResourceLocation deferred_combine_fsh = new ResourceLocation("eagler:glsl/deferred/deferred_combine.fsh");
public static final ResourceLocation deferred_fog_fsh = new ResourceLocation("eagler:glsl/deferred/deferred_fog.fsh");
public static final ResourceLocation forward_core_vsh = new ResourceLocation("eagler:glsl/deferred/forward_core.vsh");
public static final ResourceLocation forward_core_fsh = new ResourceLocation("eagler:glsl/deferred/forward_core.fsh");
public static final ResourceLocation forward_glass_highlights_vsh = new ResourceLocation("eagler:glsl/deferred/forward_glass_highlights.vsh");
public static final ResourceLocation forward_glass_highlights_fsh = new ResourceLocation("eagler:glsl/deferred/forward_glass_highlights.fsh");
public static final ResourceLocation realistic_water_mask_vsh = new ResourceLocation("eagler:glsl/deferred/realistic_water_mask.vsh");
public static final ResourceLocation realistic_water_mask_fsh = new ResourceLocation("eagler:glsl/deferred/realistic_water_mask.fsh");
public static final ResourceLocation realistic_water_render_vsh = new ResourceLocation("eagler:glsl/deferred/realistic_water_render.vsh");
public static final ResourceLocation realistic_water_render_fsh = new ResourceLocation("eagler:glsl/deferred/realistic_water_render.fsh");
public static final ResourceLocation realistic_water_control_fsh = new ResourceLocation("eagler:glsl/deferred/realistic_water_control.fsh");
public static final ResourceLocation realistic_water_normals_fsh = new ResourceLocation("eagler:glsl/deferred/realistic_water_normals.fsh");
public static final ResourceLocation realistic_water_noise_fsh = new ResourceLocation("eagler:glsl/deferred/realistic_water_noise.fsh");
public static final ResourceLocation gbuffer_debug_view_fsh = new ResourceLocation("eagler:glsl/deferred/gbuffer_debug_view.fsh");
public static final ResourceLocation ssao_generate_fsh = new ResourceLocation("eagler:glsl/deferred/ssao_generate.fsh");
public static final ResourceLocation lighting_sun_fsh = new ResourceLocation("eagler:glsl/deferred/lighting_sun.fsh");
public static final ResourceLocation accel_particle_vsh = new ResourceLocation(
"eagler:glsl/deferred/accel_particle.vsh");
public static final ResourceLocation accel_particle_gbuffer_fsh = new ResourceLocation(
"eagler:glsl/deferred/accel_particle_gbuffer.fsh");
public static final ResourceLocation accel_particle_forward_fsh = new ResourceLocation(
"eagler:glsl/deferred/accel_particle_forward.fsh");
public static final ResourceLocation deferred_core_vsh = new ResourceLocation(
"eagler:glsl/deferred/deferred_core.vsh");
public static final ResourceLocation deferred_core_gbuffer_fsh = new ResourceLocation(
"eagler:glsl/deferred/deferred_core_gbuffer.fsh");
public static final ResourceLocation deferred_shadow_vsh = new ResourceLocation(
"eagler:glsl/deferred/deferred_shadow.vsh");
public static final ResourceLocation deferred_shadow_fsh = new ResourceLocation(
"eagler:glsl/deferred/deferred_shadow.fsh");
public static final ResourceLocation deferred_local_vsh = new ResourceLocation(
"eagler:glsl/deferred/deferred_local.vsh");
public static final ResourceLocation deferred_combine_fsh = new ResourceLocation(
"eagler:glsl/deferred/deferred_combine.fsh");
public static final ResourceLocation deferred_fog_fsh = new ResourceLocation(
"eagler:glsl/deferred/deferred_fog.fsh");
public static final ResourceLocation forward_core_vsh = new ResourceLocation(
"eagler:glsl/deferred/forward_core.vsh");
public static final ResourceLocation forward_core_fsh = new ResourceLocation(
"eagler:glsl/deferred/forward_core.fsh");
public static final ResourceLocation forward_glass_highlights_vsh = new ResourceLocation(
"eagler:glsl/deferred/forward_glass_highlights.vsh");
public static final ResourceLocation forward_glass_highlights_fsh = new ResourceLocation(
"eagler:glsl/deferred/forward_glass_highlights.fsh");
public static final ResourceLocation realistic_water_mask_vsh = new ResourceLocation(
"eagler:glsl/deferred/realistic_water_mask.vsh");
public static final ResourceLocation realistic_water_mask_fsh = new ResourceLocation(
"eagler:glsl/deferred/realistic_water_mask.fsh");
public static final ResourceLocation realistic_water_render_vsh = new ResourceLocation(
"eagler:glsl/deferred/realistic_water_render.vsh");
public static final ResourceLocation realistic_water_render_fsh = new ResourceLocation(
"eagler:glsl/deferred/realistic_water_render.fsh");
public static final ResourceLocation realistic_water_control_fsh = new ResourceLocation(
"eagler:glsl/deferred/realistic_water_control.fsh");
public static final ResourceLocation realistic_water_normals_fsh = new ResourceLocation(
"eagler:glsl/deferred/realistic_water_normals.fsh");
public static final ResourceLocation realistic_water_noise_fsh = new ResourceLocation(
"eagler:glsl/deferred/realistic_water_noise.fsh");
public static final ResourceLocation gbuffer_debug_view_fsh = new ResourceLocation(
"eagler:glsl/deferred/gbuffer_debug_view.fsh");
public static final ResourceLocation ssao_generate_fsh = new ResourceLocation(
"eagler:glsl/deferred/ssao_generate.fsh");
public static final ResourceLocation lighting_sun_fsh = new ResourceLocation(
"eagler:glsl/deferred/lighting_sun.fsh");
public static final ResourceLocation shadows_sun_fsh = new ResourceLocation("eagler:glsl/deferred/shadows_sun.fsh");
public static final ResourceLocation light_shafts_sample_fsh = new ResourceLocation("eagler:glsl/deferred/light_shafts_sample.fsh");
public static final ResourceLocation post_tonemap_fsh = new ResourceLocation("eagler:glsl/deferred/post_tonemap.fsh");
public static final ResourceLocation post_bloom_bright_fsh = new ResourceLocation("eagler:glsl/deferred/post_bloom_bright.fsh");
public static final ResourceLocation post_bloom_blur_fsh = new ResourceLocation("eagler:glsl/deferred/post_bloom_blur.fsh");
public static final ResourceLocation post_lens_distort_fsh = new ResourceLocation("eagler:glsl/deferred/post_lens_distort.fsh");
public static final ResourceLocation post_exposure_avg_fsh = new ResourceLocation("eagler:glsl/deferred/post_exposure_avg.fsh");
public static final ResourceLocation post_exposure_final_fsh = new ResourceLocation("eagler:glsl/deferred/post_exposure_final.fsh");
public static final ResourceLocation post_lens_streaks_vsh = new ResourceLocation("eagler:glsl/deferred/post_lens_streaks.vsh");
public static final ResourceLocation post_lens_streaks_fsh = new ResourceLocation("eagler:glsl/deferred/post_lens_streaks.fsh");
public static final ResourceLocation post_lens_ghosts_vsh = new ResourceLocation("eagler:glsl/deferred/post_lens_ghosts.vsh");
public static final ResourceLocation post_lens_ghosts_fsh = new ResourceLocation("eagler:glsl/deferred/post_lens_ghosts.fsh");
public static final ResourceLocation lens_sun_occlusion_fsh = new ResourceLocation("eagler:glsl/deferred/lens_sun_occlusion.fsh");
public static final ResourceLocation skybox_atmosphere_fsh = new ResourceLocation("eagler:glsl/deferred/skybox_atmosphere.fsh");
public static final ResourceLocation skybox_irradiance_fsh = new ResourceLocation("eagler:glsl/deferred/skybox_irradiance.fsh");
public static final ResourceLocation skybox_render_vsh = new ResourceLocation("eagler:glsl/deferred/skybox_render.vsh");
public static final ResourceLocation skybox_render_fsh = new ResourceLocation("eagler:glsl/deferred/skybox_render.fsh");
public static final ResourceLocation skybox_render_end_vsh = new ResourceLocation("eagler:glsl/deferred/skybox_render_end.vsh");
public static final ResourceLocation skybox_render_end_fsh = new ResourceLocation("eagler:glsl/deferred/skybox_render_end.fsh");
public static final ResourceLocation light_shafts_sample_fsh = new ResourceLocation(
"eagler:glsl/deferred/light_shafts_sample.fsh");
public static final ResourceLocation post_tonemap_fsh = new ResourceLocation(
"eagler:glsl/deferred/post_tonemap.fsh");
public static final ResourceLocation post_bloom_bright_fsh = new ResourceLocation(
"eagler:glsl/deferred/post_bloom_bright.fsh");
public static final ResourceLocation post_bloom_blur_fsh = new ResourceLocation(
"eagler:glsl/deferred/post_bloom_blur.fsh");
public static final ResourceLocation post_lens_distort_fsh = new ResourceLocation(
"eagler:glsl/deferred/post_lens_distort.fsh");
public static final ResourceLocation post_exposure_avg_fsh = new ResourceLocation(
"eagler:glsl/deferred/post_exposure_avg.fsh");
public static final ResourceLocation post_exposure_final_fsh = new ResourceLocation(
"eagler:glsl/deferred/post_exposure_final.fsh");
public static final ResourceLocation post_lens_streaks_vsh = new ResourceLocation(
"eagler:glsl/deferred/post_lens_streaks.vsh");
public static final ResourceLocation post_lens_streaks_fsh = new ResourceLocation(
"eagler:glsl/deferred/post_lens_streaks.fsh");
public static final ResourceLocation post_lens_ghosts_vsh = new ResourceLocation(
"eagler:glsl/deferred/post_lens_ghosts.vsh");
public static final ResourceLocation post_lens_ghosts_fsh = new ResourceLocation(
"eagler:glsl/deferred/post_lens_ghosts.fsh");
public static final ResourceLocation lens_sun_occlusion_fsh = new ResourceLocation(
"eagler:glsl/deferred/lens_sun_occlusion.fsh");
public static final ResourceLocation skybox_atmosphere_fsh = new ResourceLocation(
"eagler:glsl/deferred/skybox_atmosphere.fsh");
public static final ResourceLocation skybox_irradiance_fsh = new ResourceLocation(
"eagler:glsl/deferred/skybox_irradiance.fsh");
public static final ResourceLocation skybox_render_vsh = new ResourceLocation(
"eagler:glsl/deferred/skybox_render.vsh");
public static final ResourceLocation skybox_render_fsh = new ResourceLocation(
"eagler:glsl/deferred/skybox_render.fsh");
public static final ResourceLocation skybox_render_end_vsh = new ResourceLocation(
"eagler:glsl/deferred/skybox_render_end.vsh");
public static final ResourceLocation skybox_render_end_fsh = new ResourceLocation(
"eagler:glsl/deferred/skybox_render_end.fsh");
public static final ResourceLocation moon_render_vsh = new ResourceLocation("eagler:glsl/deferred/moon_render.vsh");
public static final ResourceLocation moon_render_fsh = new ResourceLocation("eagler:glsl/deferred/moon_render.fsh");
public static final ResourceLocation clouds_noise3d_fsh = new ResourceLocation("eagler:glsl/deferred/clouds_noise3d.fsh");
public static final ResourceLocation clouds_shapes_fsh = new ResourceLocation("eagler:glsl/deferred/clouds_shapes.fsh");
public static final ResourceLocation clouds_shapes_vsh = new ResourceLocation("eagler:glsl/deferred/clouds_shapes.vsh");
public static final ResourceLocation clouds_sample_fsh = new ResourceLocation("eagler:glsl/deferred/clouds_sample.fsh");
public static final ResourceLocation clouds_sun_occlusion_fsh = new ResourceLocation("eagler:glsl/deferred/clouds_sun_occlusion.fsh");
public static final ResourceLocation clouds_color_fsh = new ResourceLocation("eagler:glsl/deferred/clouds_color.fsh");
public static final ResourceLocation lighting_mesh_vsh = new ResourceLocation("eagler:glsl/deferred/lighting_mesh.vsh");
public static final ResourceLocation lighting_point_fsh = new ResourceLocation("eagler:glsl/deferred/lighting_point.fsh");
public static final ResourceLocation reproject_control_fsh = new ResourceLocation("eagler:glsl/deferred/reproject_control.fsh");
public static final ResourceLocation reproject_ssr_fsh = new ResourceLocation("eagler:glsl/deferred/reproject_ssr.fsh");
public static final ResourceLocation clouds_noise3d_fsh = new ResourceLocation(
"eagler:glsl/deferred/clouds_noise3d.fsh");
public static final ResourceLocation clouds_shapes_fsh = new ResourceLocation(
"eagler:glsl/deferred/clouds_shapes.fsh");
public static final ResourceLocation clouds_shapes_vsh = new ResourceLocation(
"eagler:glsl/deferred/clouds_shapes.vsh");
public static final ResourceLocation clouds_sample_fsh = new ResourceLocation(
"eagler:glsl/deferred/clouds_sample.fsh");
public static final ResourceLocation clouds_sun_occlusion_fsh = new ResourceLocation(
"eagler:glsl/deferred/clouds_sun_occlusion.fsh");
public static final ResourceLocation clouds_color_fsh = new ResourceLocation(
"eagler:glsl/deferred/clouds_color.fsh");
public static final ResourceLocation lighting_mesh_vsh = new ResourceLocation(
"eagler:glsl/deferred/lighting_mesh.vsh");
public static final ResourceLocation lighting_point_fsh = new ResourceLocation(
"eagler:glsl/deferred/lighting_point.fsh");
public static final ResourceLocation reproject_control_fsh = new ResourceLocation(
"eagler:glsl/deferred/reproject_control.fsh");
public static final ResourceLocation reproject_ssr_fsh = new ResourceLocation(
"eagler:glsl/deferred/reproject_ssr.fsh");
public static final ResourceLocation post_fxaa_fsh = new ResourceLocation("eagler:glsl/deferred/post_fxaa.fsh");
public static final ResourceLocation hand_depth_mask_fsh = new ResourceLocation("eagler:glsl/deferred/hand_depth_mask.fsh");
public static final ResourceLocation hand_depth_mask_fsh = new ResourceLocation(
"eagler:glsl/deferred/hand_depth_mask.fsh");
public static final ResourceLocation core_dynamiclights_vsh = new ResourceLocation(
"eagler:glsl/dynamiclights/core_dynamiclights.vsh");
public static final ResourceLocation core_dynamiclights_fsh = new ResourceLocation(
"eagler:glsl/dynamiclights/core_dynamiclights.fsh");
public static final ResourceLocation accel_particle_dynamiclights_vsh = new ResourceLocation(
"eagler:glsl/dynamiclights/accel_particle_dynamiclights.vsh");
public static final ResourceLocation accel_particle_dynamiclights_fsh = new ResourceLocation(
"eagler:glsl/dynamiclights/accel_particle_dynamiclights.fsh");
private static final Map<ResourceLocation, String> sourceCache = new HashMap();
@ -118,7 +187,8 @@ public class ShaderSource {
private static String loadSource(ResourceLocation resourceLocation, int fileID) throws IOException {
StringBuilder ret = new StringBuilder();
try(InputStream is = Minecraft.getMinecraft().getResourceManager().getResource(resourceLocation).getInputStream()) {
try (InputStream is = Minecraft.getMinecraft().getResourceManager().getResource(resourceLocation)
.getInputStream()) {
int lineCounter = 1;
BufferedReader lineReader = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8));
String line;
@ -140,7 +210,8 @@ public class ShaderSource {
String p1 = tokenizer.next();
if (p1.equals("INCLUDE") && tokenizer.hasNext()) {
String fileIDStr = tokenizer.next();
if(tokenizer.hasNext() && fileIDStr.charAt(0) == '(' && fileIDStr.charAt(fileIDStr.length() - 1) == ')') {
if (tokenizer.hasNext() && fileIDStr.charAt(0) == '('
&& fileIDStr.charAt(fileIDStr.length() - 1) == ')') {
String includePath = tokenizer.next();
if (!tokenizer.hasNext()) { // ignore if there are extra arguments
int newFileId = -1;
@ -150,12 +221,18 @@ public class ShaderSource {
}
if (newFileId != -1) {
newFileId += fileID * 100;
ret.append('\n').append("////////////////////////////////////////////////////////////////////").append('\n');
ret.append('\n').append(
"////////////////////////////////////////////////////////////////////")
.append('\n');
ret.append("//" + line).append('\n');
ret.append("#line 1 ").append(newFileId).append('\n');
ret.append(getSourceFor(new ResourceLocation(includePath), newFileId)).append('\n');
ret.append("////////////////////////////////////////////////////////////////////").append('\n');
ret.append("#line ").append(lineCounter - 1).append(' ').append(fileID).append('\n').append('\n');
ret.append(getSourceFor(new ResourceLocation(includePath), newFileId))
.append('\n');
ret.append(
"////////////////////////////////////////////////////////////////////")
.append('\n');
ret.append("#line ").append(lineCounter - 1).append(' ').append(fileID)
.append('\n').append('\n');
++lineCounter;
continue;
}

View File

@ -0,0 +1,295 @@
package net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights;
import static net.lax1dude.eaglercraft.v1_8.internal.PlatformOpenGL.*;
import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*;
import static net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.ExtGLEnums.*;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
import net.lax1dude.eaglercraft.v1_8.internal.IBufferGL;
import net.lax1dude.eaglercraft.v1_8.internal.buffer.ByteBuffer;
import net.lax1dude.eaglercraft.v1_8.opengl.EaglercraftGPU;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.ArrayListSerial;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.EaglerDeferredPipeline;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.ListSerial;
import net.minecraft.util.MathHelper;
/**
* Copyright (c) 2023-2024 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
public class DynamicLightBucketLoader {
public IBufferGL buffer_chunkLightingData;
private ByteBuffer chunkLightingDataCopyBuffer;
private boolean isChunkLightingEnabled = false;
public ListSerial<DynamicLightInstance> currentBoundLightSourceBucket;
public final ListSerial<DynamicLightInstance>[] lightSourceBuckets;
public ListSerial<DynamicLightInstance> currentLightSourceBucket;
public static final int MAX_LIGHTS_PER_CHUNK = 12;
private final int lightSourceBucketsWidth;
private final int lightSourceBucketsHeight;
private double currentRenderX = 0.0;
private double currentRenderY = 0.0;
private double currentRenderZ = 0.0;
public DynamicLightBucketLoader() {
this.lightSourceBucketsWidth = 5;
this.lightSourceBucketsHeight = 3;
int cnt = 5 * 3 * 5;
this.lightSourceBuckets = new ListSerial[cnt];
}
public void initialize() {
destroy();
buffer_chunkLightingData = _wglGenBuffers();
EaglercraftGPU.bindGLUniformBuffer(buffer_chunkLightingData);
int lightingDataLength = 4 * MAX_LIGHTS_PER_CHUNK + 4;
chunkLightingDataCopyBuffer = EagRuntime.allocateByteBuffer(lightingDataLength << 2);
for (int i = 0; i < lightingDataLength; ++i) {
chunkLightingDataCopyBuffer.putInt(0);
}
chunkLightingDataCopyBuffer.flip();
_wglBufferData(_GL_UNIFORM_BUFFER, chunkLightingDataCopyBuffer, GL_DYNAMIC_DRAW);
for (int i = 0; i < this.lightSourceBuckets.length; ++i) {
this.lightSourceBuckets[i] = new ArrayListSerial(16);
}
}
public void clearBuckets() {
for (int i = 0; i < this.lightSourceBuckets.length; ++i) {
this.lightSourceBuckets[i].clear();
}
}
public void loadLightSourceBucket(int relativeBlockX, int relativeBlockY, int relativeBlockZ) {
int hw = lightSourceBucketsWidth / 2;
int hh = lightSourceBucketsHeight / 2;
int bucketX = (relativeBlockX >> 4) + hw;
int bucketY = (relativeBlockY >> 4) + hh;
int bucketZ = (relativeBlockZ >> 4) + hw;
if (bucketX >= 0 && bucketY >= 0 && bucketZ >= 0 && bucketX < lightSourceBucketsWidth
&& bucketY < lightSourceBucketsHeight && bucketZ < lightSourceBucketsWidth) {
currentLightSourceBucket = lightSourceBuckets[bucketY * lightSourceBucketsWidth * lightSourceBucketsWidth
+ bucketZ * lightSourceBucketsWidth + bucketX];
} else {
currentLightSourceBucket = null;
}
updateLightSourceUBO();
}
public ListSerial<DynamicLightInstance> getLightSourceBucketRelativeChunkCoords(int cx, int cy, int cz) {
int hw = lightSourceBucketsWidth / 2;
int hh = lightSourceBucketsHeight / 2;
cx += hw;
cy += hh;
cz += hw;
if (cx < 0 || cx >= lightSourceBucketsWidth || cy < 0 || cy >= lightSourceBucketsHeight || cz < 0
|| cz >= lightSourceBucketsWidth) {
return null;
} else {
return lightSourceBuckets[cy * lightSourceBucketsWidth * lightSourceBucketsWidth
+ cz * lightSourceBucketsWidth + cx];
}
}
public void addLightSourceToBucket(int cx, int cy, int cz, DynamicLightInstance dl) {
ListSerial<DynamicLightInstance> lst = getLightSourceBucketRelativeChunkCoords(cx, cy, cz);
if (lst != null) {
lst.add(dl);
}
}
public void bucketLightSource(float x, float y, float z, DynamicLightInstance dl) {
int bucketX = MathHelper.floor_float(x / 16.0f);
int bucketY = MathHelper.floor_float(y / 16.0f);
int bucketZ = MathHelper.floor_float(z / 16.0f);
addLightSourceToBucket(bucketX, bucketY, bucketZ, dl);
int minX = bucketX, maxX = bucketX;
int minY = bucketY, maxY = bucketY;
int minZ = bucketZ, maxZ = bucketZ;
float lightLocalX = x - (bucketX << 4);
float lightLocalY = y - (bucketY << 4);
float lightLocalZ = z - (bucketZ << 4);
float radius = dl.radius;
boolean outOfBounds = false;
if (lightLocalX - radius < 0.0f) {
minX -= 1;
outOfBounds = true;
addLightSourceToBucket(bucketX - 1, bucketY, bucketZ, dl);
}
if (lightLocalY - radius < 0.0f) {
minY -= 1;
outOfBounds = true;
addLightSourceToBucket(bucketX, bucketY - 1, bucketZ, dl);
}
if (lightLocalZ - radius < 0.0f) {
minZ -= 1;
outOfBounds = true;
addLightSourceToBucket(bucketX, bucketY, bucketZ - 1, dl);
}
if (lightLocalX + radius >= 16.0f) {
maxX += 1;
outOfBounds = true;
addLightSourceToBucket(bucketX + 1, bucketY, bucketZ, dl);
}
if (lightLocalY + radius >= 16.0f) {
maxY += 1;
outOfBounds = true;
addLightSourceToBucket(bucketX, bucketY + 1, bucketZ, dl);
}
if (lightLocalZ + radius >= 16.0f) {
maxZ += 1;
outOfBounds = true;
addLightSourceToBucket(bucketX, bucketY, bucketZ + 1, dl);
}
if (!outOfBounds) {
return;
}
radius *= radius;
for (int yy = minY; yy <= maxY; ++yy) {
for (int zz = minZ; zz <= maxZ; ++zz) {
for (int xx = minX; xx <= maxX; ++xx) {
if ((xx == bucketX ? 1 : 0) + (yy == bucketY ? 1 : 0) + (zz == bucketZ ? 1 : 0) > 1) {
continue;
}
List<DynamicLightInstance> lst = getLightSourceBucketRelativeChunkCoords(xx, yy, zz);
if (lst != null) {
int bucketBoundsX = xx << 4;
int bucketBoundsY = yy << 4;
int bucketBoundsZ = zz << 4;
if (EaglerDeferredPipeline.testAabSphere(bucketBoundsX, bucketBoundsY, bucketBoundsZ,
bucketBoundsX + 16, bucketBoundsY + 16, bucketBoundsZ + 16, x, y, z, radius)) {
lst.add(dl);
}
}
}
}
}
}
public void truncateOverflowingBuffers() {
for (int i = 0; i < this.lightSourceBuckets.length; ++i) {
List<DynamicLightInstance> lst = this.lightSourceBuckets[i];
int k = lst.size();
if (k > MAX_LIGHTS_PER_CHUNK) {
lst.sort(comparatorLightRadius);
for (int l = MAX_LIGHTS_PER_CHUNK - 1; l >= MAX_LIGHTS_PER_CHUNK; --l) {
lst.remove(l);
}
}
}
}
public void updateLightSourceUBO() {
if (currentLightSourceBucket == null) {
currentBoundLightSourceBucket = null;
if (isChunkLightingEnabled) {
isChunkLightingEnabled = false;
EaglercraftGPU.bindGLUniformBuffer(buffer_chunkLightingData);
chunkLightingDataCopyBuffer.clear();
chunkLightingDataCopyBuffer.putInt(0);
chunkLightingDataCopyBuffer.flip();
_wglBufferSubData(_GL_UNIFORM_BUFFER, 0, chunkLightingDataCopyBuffer);
}
} else {
boolean isNew;
if (!isChunkLightingEnabled) {
isChunkLightingEnabled = true;
isNew = true;
} else {
isNew = currentLightSourceBucket != currentBoundLightSourceBucket;
}
currentBoundLightSourceBucket = currentLightSourceBucket;
if (isNew || currentBoundLightSourceBucket.eaglerCheck()) {
populateLightSourceUBOFromBucket(currentBoundLightSourceBucket);
currentBoundLightSourceBucket.eaglerResetCheck();
}
}
}
private static final Comparator<DynamicLightInstance> comparatorLightRadius = (l1, l2) -> {
return l1.radius < l2.radius ? 1 : -1;
};
private void populateLightSourceUBOFromBucket(List<DynamicLightInstance> lights) {
int max = lights.size();
if (max > MAX_LIGHTS_PER_CHUNK) {
// tmpListLights.clear();
// tmpListLights.addAll(lights);
// lights = tmpListLights;
// lights.sort(comparatorLightRadius);
max = MAX_LIGHTS_PER_CHUNK;
}
chunkLightingDataCopyBuffer.clear();
chunkLightingDataCopyBuffer.putInt(max);
if (max > 0) {
chunkLightingDataCopyBuffer.putInt(0); // padding
chunkLightingDataCopyBuffer.putInt(0); // padding
chunkLightingDataCopyBuffer.putInt(0); // padding
for (int i = 0; i < max; ++i) {
DynamicLightInstance dl = lights.get(i);
chunkLightingDataCopyBuffer.putFloat((float) (dl.posX - currentRenderX));
chunkLightingDataCopyBuffer.putFloat((float) (dl.posY - currentRenderY));
chunkLightingDataCopyBuffer.putFloat((float) (dl.posZ - currentRenderZ));
chunkLightingDataCopyBuffer.putFloat(dl.radius);
}
}
chunkLightingDataCopyBuffer.flip();
EaglercraftGPU.bindGLUniformBuffer(buffer_chunkLightingData);
_wglBufferSubData(_GL_UNIFORM_BUFFER, 0, chunkLightingDataCopyBuffer);
}
public void setRenderPos(double currentRenderX, double currentRenderY, double currentRenderZ) {
this.currentRenderX = currentRenderX;
this.currentRenderY = currentRenderY;
this.currentRenderZ = currentRenderZ;
}
public void bindUniformBuffer(int index) {
EaglercraftGPU.bindGLUniformBuffer(buffer_chunkLightingData);
EaglercraftGPU.bindUniformBufferRange(index, buffer_chunkLightingData, 0,
chunkLightingDataCopyBuffer.capacity());
}
public void destroy() {
if (chunkLightingDataCopyBuffer != null) {
EagRuntime.freeByteBuffer(chunkLightingDataCopyBuffer);
chunkLightingDataCopyBuffer = null;
}
if (buffer_chunkLightingData != null) {
_wglDeleteBuffers(buffer_chunkLightingData);
buffer_chunkLightingData = null;
}
for (int i = 0; i < this.lightSourceBuckets.length; ++i) {
this.lightSourceBuckets[i] = null;
}
}
}

View File

@ -0,0 +1,55 @@
package net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights;
/**
* Copyright (c) 2024 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
class DynamicLightInstance {
public final String lightName;
long lastCacheHit = 0l;
double posX;
double posY;
double posZ;
float radius;
public DynamicLightInstance(String lightName) {
this.lightName = lightName;
}
public void updateLight(double posX, double posY, double posZ, float radius) {
this.lastCacheHit = System.currentTimeMillis();
this.posX = posX;
this.posY = posY;
this.posZ = posZ;
this.radius = radius;
}
public void destroy() {
}
public float getRadiusInWorld() {
return radius;
}
}

View File

@ -0,0 +1,238 @@
package net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights;
import static net.lax1dude.eaglercraft.v1_8.internal.PlatformOpenGL.*;
import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*;
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
import net.lax1dude.eaglercraft.v1_8.internal.IBufferArrayGL;
import net.lax1dude.eaglercraft.v1_8.internal.IBufferGL;
import net.lax1dude.eaglercraft.v1_8.internal.buffer.ByteBuffer;
import net.lax1dude.eaglercraft.v1_8.internal.buffer.FloatBuffer;
import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
import net.lax1dude.eaglercraft.v1_8.log4j.Logger;
import net.lax1dude.eaglercraft.v1_8.opengl.EaglercraftGPU;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.lax1dude.eaglercraft.v1_8.opengl.InstancedParticleRenderer;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.AbstractAcceleratedEffectRenderer;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.program.DynamicLightsAccelParticleShader;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GLAllocation;
import net.minecraft.entity.Entity;
import net.minecraft.util.MathHelper;
/**
* Copyright (c) 2024 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
public class DynamicLightsAcceleratedEffectRenderer extends AbstractAcceleratedEffectRenderer {
private static final Logger logger = LogManager.getLogger("DynamicLightsAcceleratedEffectRenderer");
private ByteBuffer particleBuffer = null;
private int particleCount = 0;
private boolean particlesHasOverflowed = false;
private static final int BYTES_PER_PARTICLE = 24;
private static final int PARTICLE_LIMIT = 5461;
private DynamicLightsAccelParticleShader shaderProgram = null;
private IBufferArrayGL vertexArray = null;
private IBufferGL vertexBuffer = null;
private IBufferGL instancesBuffer = null;
private float f1;
private float f2;
private float f3;
private float f4;
private float f5;
public static boolean isMaterialNormalTexture = false;
public void initialize() {
destroy();
if (DynamicLightsPipelineCompiler.matrixCopyBuffer == null) {
DynamicLightsPipelineCompiler.matrixCopyBuffer = GLAllocation.createDirectFloatBuffer(16);
}
shaderProgram = DynamicLightsAccelParticleShader.compile();
shaderProgram.loadUniforms();
particleBuffer = EagRuntime.allocateByteBuffer(PARTICLE_LIMIT * BYTES_PER_PARTICLE);
vertexArray = _wglGenVertexArrays();
vertexBuffer = _wglGenBuffers();
instancesBuffer = _wglGenBuffers();
FloatBuffer verts = EagRuntime.allocateFloatBuffer(12);
verts.put(new float[] {
-1.0f, -1.0f, -1.0f, 1.0f, 1.0f, -1.0f,
-1.0f, 1.0f, 1.0f, 1.0f, 1.0f, -1.0f
});
verts.flip();
EaglercraftGPU.bindGLBufferArray(vertexArray);
EaglercraftGPU.bindGLArrayBuffer(vertexBuffer);
_wglBufferData(GL_ARRAY_BUFFER, verts, GL_STATIC_DRAW);
EagRuntime.freeFloatBuffer(verts);
_wglEnableVertexAttribArray(0);
_wglVertexAttribPointer(0, 2, GL_FLOAT, false, 8, 0);
_wglVertexAttribDivisor(0, 0);
EaglercraftGPU.bindGLArrayBuffer(instancesBuffer);
_wglBufferData(GL_ARRAY_BUFFER, particleBuffer.remaining(), GL_STREAM_DRAW);
_wglEnableVertexAttribArray(1);
_wglVertexAttribPointer(1, 3, GL_FLOAT, false, 24, 0);
_wglVertexAttribDivisor(1, 1);
_wglEnableVertexAttribArray(2);
_wglVertexAttribPointer(2, 2, GL_UNSIGNED_SHORT, false, 24, 12);
_wglVertexAttribDivisor(2, 1);
_wglEnableVertexAttribArray(3);
_wglVertexAttribPointer(3, 2, GL_UNSIGNED_BYTE, true, 24, 16);
_wglVertexAttribDivisor(3, 1);
_wglEnableVertexAttribArray(4);
_wglVertexAttribPointer(4, 2, GL_UNSIGNED_BYTE, false, 24, 18);
_wglVertexAttribDivisor(4, 1);
_wglEnableVertexAttribArray(5);
_wglVertexAttribPointer(5, 4, GL_UNSIGNED_BYTE, true, 24, 20);
_wglVertexAttribDivisor(5, 1);
}
@Override
public void draw(float texCoordWidth, float texCoordHeight) {
if (particleCount == 0) {
return;
}
shaderProgram.useProgram();
_wglUniform3f(shaderProgram.uniforms.u_texCoordSize2f_particleSize1f, texCoordWidth, texCoordHeight, 0.0625f);
_wglUniform3f(shaderProgram.uniforms.u_transformParam_1_2_5_f, f1, f5, f4);
_wglUniform2f(shaderProgram.uniforms.u_transformParam_3_4_f, f2, f3);
InstancedParticleRenderer.stupidColorSetHack(shaderProgram.uniforms.u_color4f);
FloatBuffer buf = DynamicLightsPipelineCompiler.matrixCopyBuffer;
buf.clear();
GlStateManager.getFloat(GL_MODELVIEW_MATRIX, buf);
buf.flip();
_wglUniformMatrix4fv(shaderProgram.uniforms.u_modelViewMatrix4f, false, buf);
buf.clear();
GlStateManager.getFloat(GL_PROJECTION_MATRIX, buf);
buf.flip();
_wglUniformMatrix4fv(shaderProgram.uniforms.u_projectionMatrix4f, false, buf);
buf.clear();
DynamicLightsStateManager.inverseViewMatrix.store(buf);
buf.flip();
_wglUniformMatrix4fv(shaderProgram.uniforms.u_inverseViewMatrix4f, false, buf);
EaglercraftGPU.bindGLArrayBuffer(instancesBuffer);
EaglercraftGPU.bindGLBufferArray(vertexArray);
int p = particleBuffer.position();
int l = particleBuffer.limit();
particleBuffer.flip();
_wglBufferSubData(GL_ARRAY_BUFFER, 0, particleBuffer);
particleBuffer.position(p);
particleBuffer.limit(l);
_wglDrawArraysInstanced(GL_TRIANGLES, 0, 6, particleCount);
}
@Override
public void begin(float partialTicks) {
this.partialTicks = partialTicks;
particleBuffer.clear();
particleCount = 0;
particlesHasOverflowed = false;
Entity et = Minecraft.getMinecraft().getRenderViewEntity();
if (et != null) {
f1 = MathHelper.cos(et.rotationYaw * 0.017453292F);
f2 = MathHelper.sin(et.rotationYaw * 0.017453292F);
f3 = -f2 * MathHelper.sin(et.rotationPitch * 0.017453292F);
f4 = f1 * MathHelper.sin(et.rotationPitch * 0.017453292F);
f5 = MathHelper.cos(et.rotationPitch * 0.017453292F);
}
}
@Override
public void drawParticle(float posX, float posY, float posZ, int particleIndexX, int particleIndexY,
int lightMapData, int texSize, float particleSize, int rgba) {
if (particlesHasOverflowed) {
return;
}
if (particleCount >= PARTICLE_LIMIT) {
particlesHasOverflowed = true;
logger.error("Particle buffer has overflowed! Exceeded {} particles, no more particles will be rendered.",
PARTICLE_LIMIT);
return;
}
++particleCount;
ByteBuffer buf = particleBuffer;
buf.putFloat(posX);
buf.putFloat(posY);
buf.putFloat(posZ);
buf.putShort((short) particleIndexX);
buf.putShort((short) particleIndexY);
buf.put((byte) (lightMapData & 0xFF));
buf.put((byte) ((lightMapData >> 16) & 0xFF));
buf.put((byte) (particleSize * 16.0f));
buf.put((byte) texSize);
buf.putInt(rgba);
}
public void destroy() {
if (particleBuffer != null) {
EagRuntime.freeByteBuffer(particleBuffer);
particleBuffer = null;
}
if (shaderProgram != null) {
shaderProgram.destroy();
shaderProgram = null;
}
if (vertexArray != null) {
_wglDeleteVertexArrays(vertexArray);
vertexArray = null;
}
if (vertexBuffer != null) {
_wglDeleteBuffers(vertexBuffer);
vertexBuffer = null;
}
if (instancesBuffer != null) {
_wglDeleteBuffers(instancesBuffer);
instancesBuffer = null;
}
}
}

View File

@ -0,0 +1,112 @@
package net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights;
import static net.lax1dude.eaglercraft.v1_8.internal.PlatformOpenGL.*;
import net.lax1dude.eaglercraft.v1_8.internal.IProgramGL;
import net.lax1dude.eaglercraft.v1_8.internal.buffer.FloatBuffer;
import net.lax1dude.eaglercraft.v1_8.opengl.FixedFunctionShader.FixedFunctionState;
import net.lax1dude.eaglercraft.v1_8.opengl.IExtPipelineCompiler;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.program.ShaderSource;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.program.DynamicLightsExtPipelineShader;
import net.lax1dude.eaglercraft.v1_8.vector.Matrix4f;
import net.minecraft.client.renderer.GLAllocation;
/**
* Copyright (c) 2024 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
public class DynamicLightsPipelineCompiler implements IExtPipelineCompiler {
static FloatBuffer matrixCopyBuffer = null;
private static class PipelineInstance {
private final int coreBits;
private final int extBits;
private DynamicLightsExtPipelineShader shader;
public PipelineInstance(int coreBits, int extBits) {
this.coreBits = coreBits;
this.extBits = extBits;
}
}
@Override
public String[] getShaderSource(int stateCoreBits, int stateExtBits, Object[] userPointer) {
if (matrixCopyBuffer == null) {
matrixCopyBuffer = GLAllocation.createDirectFloatBuffer(16);
}
userPointer[0] = new PipelineInstance(stateCoreBits, stateExtBits);
return new String[] {
ShaderSource.getSourceFor(ShaderSource.core_dynamiclights_vsh),
ShaderSource.getSourceFor(ShaderSource.core_dynamiclights_fsh)
};
}
@Override
public int getExtensionStatesCount() {
return 0;
}
@Override
public int getCurrentExtensionStateBits(int stateCoreBits) {
return 0;
}
@Override
public int getCoreStateMask(int stateExtBits) {
return 0xFFFFFFFF;
}
@Override
public void initializeNewShader(IProgramGL compiledProg, int stateCoreBits, int stateExtBits,
Object[] userPointer) {
DynamicLightsExtPipelineShader newShader = new DynamicLightsExtPipelineShader(compiledProg, stateCoreBits);
((PipelineInstance) userPointer[0]).shader = newShader;
newShader.loadUniforms();
}
@Override
public void updatePipeline(IProgramGL compiledProg, int stateCoreBits, int stateExtBits, Object[] userPointer) {
if ((stateCoreBits & FixedFunctionState.STATE_ENABLE_LIGHTMAP) != 0) {
DynamicLightsExtPipelineShader.Uniforms uniforms = ((PipelineInstance) userPointer[0]).shader.uniforms;
if (uniforms.u_inverseViewMatrix4f != null) {
int serial = DynamicLightsStateManager.inverseViewMatrixSerial;
if (uniforms.inverseViewMatrixSerial != serial) {
uniforms.inverseViewMatrixSerial = serial;
FloatBuffer buf = matrixCopyBuffer;
buf.clear();
DynamicLightsStateManager.inverseViewMatrix.store(buf);
buf.flip();
_wglUniformMatrix4fv(uniforms.u_inverseViewMatrix4f, false, buf);
}
}
}
}
@Override
public void destroyPipeline(IProgramGL shaderProgram, int stateCoreBits, int stateExtBits, Object[] userPointer) {
}
}

View File

@ -0,0 +1,179 @@
package net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import net.lax1dude.eaglercraft.v1_8.opengl.FixedFunctionPipeline;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.lax1dude.eaglercraft.v1_8.vector.Matrix4f;
import net.minecraft.client.particle.EffectRenderer;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.util.MathHelper;
/**
* Copyright (c) 2024 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
public class DynamicLightsStateManager {
static final DynamicLightsPipelineCompiler deferredExtPipeline = new DynamicLightsPipelineCompiler();
static final Map<String, DynamicLightInstance> lightRenderers = new HashMap();
static final List<DynamicLightInstance> lightRenderList = new LinkedList();
static final Matrix4f inverseViewMatrix = new Matrix4f();
static int inverseViewMatrixSerial = 0;
static DynamicLightBucketLoader bucketLoader = null;
static DynamicLightsAcceleratedEffectRenderer accelParticleRenderer = null;
static int lastTotal = 0;
static long renderTimeout = 5000l;
private static long lastTick = 0l;
public static final void enableDynamicLightsRender() {
if (bucketLoader == null) {
bucketLoader = new DynamicLightBucketLoader();
bucketLoader.initialize();
bucketLoader.bindUniformBuffer(0);
FixedFunctionPipeline.loadExtensionPipeline(deferredExtPipeline);
}
if (accelParticleRenderer == null) {
accelParticleRenderer = new DynamicLightsAcceleratedEffectRenderer();
accelParticleRenderer.initialize();
}
}
public static final void bindAcceleratedEffectRenderer(EffectRenderer renderer) {
renderer.acceleratedParticleRenderer = accelParticleRenderer;
}
public static final void disableDynamicLightsRender(boolean unloadPipeline) {
if (bucketLoader != null) {
bucketLoader.destroy();
bucketLoader = null;
if (unloadPipeline) {
FixedFunctionPipeline.loadExtensionPipeline(null);
}
}
if (accelParticleRenderer != null) {
accelParticleRenderer.destroy();
accelParticleRenderer = null;
}
destroyAll();
lightRenderList.clear();
}
public static final boolean isDynamicLightsRender() {
return bucketLoader != null;
}
public static final boolean isInDynamicLightsPass() {
return GlStateManager.isExtensionPipeline() && bucketLoader != null;
}
public static final void reportForwardRenderObjectPosition(int centerX, int centerY, int centerZ) {
if (bucketLoader != null) {
bucketLoader.loadLightSourceBucket(centerX, centerY, centerZ);
}
}
public static final void reportForwardRenderObjectPosition2(float x, float y, float z) {
if (bucketLoader != null) {
float posX = (float) ((x + TileEntityRendererDispatcher.staticPlayerX)
- (MathHelper.floor_double(TileEntityRendererDispatcher.staticPlayerX / 16.0) << 4));
float posY = (float) ((y + TileEntityRendererDispatcher.staticPlayerY)
- (MathHelper.floor_double(TileEntityRendererDispatcher.staticPlayerY / 16.0) << 4));
float posZ = (float) ((z + TileEntityRendererDispatcher.staticPlayerZ)
- (MathHelper.floor_double(TileEntityRendererDispatcher.staticPlayerZ / 16.0) << 4));
bucketLoader.loadLightSourceBucket((int) posX, (int) posY, (int) posZ);
}
}
public static final void renderDynamicLight(String lightName, double posX, double posY, double posZ, float radius) {
if (bucketLoader != null) {
DynamicLightInstance dl = lightRenderers.get(lightName);
if (dl == null) {
lightRenderers.put(lightName, dl = new DynamicLightInstance(lightName));
}
dl.updateLight(posX, posY, posZ, radius);
lightRenderList.add(dl);
}
}
public static final void clearRenderList() {
lightRenderList.clear();
}
public static final void commitLightSourceBuckets(double renderPosX, double renderPosY, double renderPosZ) {
updateTimers();
lastTotal = lightRenderList.size();
if (bucketLoader != null) {
bucketLoader.clearBuckets();
int entityChunkOriginX = MathHelper.floor_double(renderPosX / 16.0) << 4;
int entityChunkOriginY = MathHelper.floor_double(renderPosY / 16.0) << 4;
int entityChunkOriginZ = MathHelper.floor_double(renderPosZ / 16.0) << 4;
Iterator<DynamicLightInstance> itr = lightRenderList.iterator();
while (itr.hasNext()) {
DynamicLightInstance dl = itr.next();
float lightChunkPosX = (float) (dl.posX - entityChunkOriginX);
float lightChunkPosY = (float) (dl.posY - entityChunkOriginY);
float lightChunkPosZ = (float) (dl.posZ - entityChunkOriginZ);
bucketLoader.bucketLightSource(lightChunkPosX, lightChunkPosY, lightChunkPosZ, dl);
}
bucketLoader.setRenderPos(renderPosX, renderPosY, renderPosZ);
bucketLoader.truncateOverflowingBuffers();
}
lightRenderList.clear();
}
public static final void setupInverseViewMatrix() {
Matrix4f.invert(GlStateManager.getModelViewReference(), inverseViewMatrix);
inverseViewMatrixSerial = GlStateManager.getModelViewSerial();
}
private static final void updateTimers() {
long millis = System.currentTimeMillis();
if (millis - lastTick > 1000l) {
lastTick = millis;
Iterator<DynamicLightInstance> itr = lightRenderers.values().iterator();
while (itr.hasNext()) {
DynamicLightInstance dl = itr.next();
if (millis - dl.lastCacheHit > renderTimeout) {
dl.destroy();
itr.remove();
}
}
}
}
public static final void destroyAll() {
Iterator<DynamicLightInstance> itr = lightRenderers.values().iterator();
while (itr.hasNext()) {
itr.next().destroy();
}
lightRenderers.clear();
}
public static String getF3String() {
return "DynamicLightsTotal: " + lastTotal;
}
}

View File

@ -0,0 +1,103 @@
package net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.program;
import static net.lax1dude.eaglercraft.v1_8.internal.PlatformOpenGL.*;
import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.GL_FRAGMENT_SHADER;
import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.GL_VERTEX_SHADER;
import java.util.ArrayList;
import java.util.List;
import net.lax1dude.eaglercraft.v1_8.internal.IProgramGL;
import net.lax1dude.eaglercraft.v1_8.internal.IShaderGL;
import net.lax1dude.eaglercraft.v1_8.internal.IUniformGL;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.program.IProgramUniforms;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.program.ShaderCompiler;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.program.ShaderProgram;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.program.ShaderSource;
/**
* Copyright (c) 2024 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
public class DynamicLightsAccelParticleShader extends ShaderProgram<DynamicLightsAccelParticleShader.Uniforms> {
public static DynamicLightsAccelParticleShader compile() {
IShaderGL accelParticleVSH = ShaderCompiler.compileShader("accel_particle_dynamiclights", GL_VERTEX_SHADER,
ShaderSource.accel_particle_dynamiclights_vsh);
IShaderGL accelParticleFSH = null;
try {
accelParticleFSH = ShaderCompiler.compileShader("accel_particle_dynamiclights", GL_FRAGMENT_SHADER,
ShaderSource.accel_particle_dynamiclights_fsh);
IProgramGL prog = ShaderCompiler.linkProgram("accel_particle_dynamiclights", accelParticleVSH,
accelParticleFSH);
return new DynamicLightsAccelParticleShader(prog);
} finally {
if (accelParticleVSH != null) {
accelParticleVSH.free();
}
if (accelParticleFSH != null) {
accelParticleFSH.free();
}
}
}
private DynamicLightsAccelParticleShader(IProgramGL prog) {
super(prog, new Uniforms());
}
public static class Uniforms implements IProgramUniforms {
public IUniformGL u_color4f = null;
public IUniformGL u_modelViewMatrix4f = null;
public IUniformGL u_projectionMatrix4f = null;
public IUniformGL u_inverseViewMatrix4f = null;
public IUniformGL u_texCoordSize2f_particleSize1f = null;
public IUniformGL u_transformParam_1_2_5_f = null;
public IUniformGL u_transformParam_3_4_f = null;
public int u_chunkLightingDataBlockBinding = -1;
private Uniforms() {
}
@Override
public void loadUniforms(IProgramGL prog) {
u_modelViewMatrix4f = _wglGetUniformLocation(prog, "u_modelViewMatrix4f");
u_projectionMatrix4f = _wglGetUniformLocation(prog, "u_projectionMatrix4f");
u_inverseViewMatrix4f = _wglGetUniformLocation(prog, "u_inverseViewMatrix4f");
u_texCoordSize2f_particleSize1f = _wglGetUniformLocation(prog, "u_texCoordSize2f_particleSize1f");
u_transformParam_1_2_5_f = _wglGetUniformLocation(prog, "u_transformParam_1_2_5_f");
u_transformParam_3_4_f = _wglGetUniformLocation(prog, "u_transformParam_3_4_f");
u_color4f = _wglGetUniformLocation(prog, "u_color4f");
_wglUniform1i(_wglGetUniformLocation(prog, "u_inputTexture"), 0);
_wglUniform1i(_wglGetUniformLocation(prog, "u_lightmapTexture"), 1);
int blockIndex = _wglGetUniformBlockIndex(prog, "u_chunkLightingData");
if (blockIndex != -1) {
_wglUniformBlockBinding(prog, blockIndex, 0);
u_chunkLightingDataBlockBinding = 0;
} else {
u_chunkLightingDataBlockBinding = -1;
}
}
}
}

View File

@ -0,0 +1,65 @@
package net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.program;
import static net.lax1dude.eaglercraft.v1_8.internal.PlatformOpenGL.*;
import net.lax1dude.eaglercraft.v1_8.internal.IProgramGL;
import net.lax1dude.eaglercraft.v1_8.internal.IUniformGL;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.program.IProgramUniforms;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.program.ShaderProgram;
/**
* Copyright (c) 2024 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
public class DynamicLightsExtPipelineShader extends ShaderProgram<DynamicLightsExtPipelineShader.Uniforms> {
public final int coreState;
public DynamicLightsExtPipelineShader(IProgramGL program, int coreState) {
super(program, new Uniforms());
this.coreState = coreState;
}
public static class Uniforms implements IProgramUniforms {
public int u_chunkLightingDataBlockBinding = -1;
public int inverseViewMatrixSerial = -1;
public IUniformGL u_inverseViewMatrix4f = null;
Uniforms() {
}
@Override
public void loadUniforms(IProgramGL prog) {
u_inverseViewMatrix4f = _wglGetUniformLocation(prog, "u_inverseViewMatrix4f");
int blockIndex = _wglGetUniformBlockIndex(prog, "u_chunkLightingData");
if (blockIndex != -1) {
_wglUniformBlockBinding(prog, blockIndex, 0);
u_chunkLightingDataBlockBinding = 0;
} else {
u_chunkLightingDataBlockBinding = -1;
}
}
}
}

View File

@ -79,6 +79,8 @@ public class SingleplayerServerController implements ISaveFormat {
PLAYER_CHANNEL);
private static final List<String> openLANChannels = new ArrayList();
private static final IPCPacketManager packetManagerInstance = new IPCPacketManager();
private SingleplayerServerController() {
}
@ -263,7 +265,7 @@ public class SingleplayerServerController implements ISaveFormat {
if (packetData.channel.equals(SingleplayerServerController.IPC_CHANNEL)) {
IPCPacketBase ipc;
try {
ipc = IPCPacketManager.IPCDeserialize(packetData.contents);
ipc = packetManagerInstance.IPCDeserialize(packetData.contents);
} catch (IOException ex) {
throw new RuntimeException("Failed to deserialize IPC packet", ex);
}
@ -426,7 +428,7 @@ public class SingleplayerServerController implements ISaveFormat {
public static void sendIPCPacket(IPCPacketBase ipc) {
byte[] pkt;
try {
pkt = IPCPacketManager.IPCSerialize(ipc);
pkt = packetManagerInstance.IPCSerialize(ipc);
} catch (IOException ex) {
throw new RuntimeException("Failed to serialize IPC packet", ex);
}

View File

@ -11,11 +11,11 @@ import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.GuiYesNo;
import net.minecraft.client.resources.I18n;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.storage.WorldInfo;
/**
* Copyright (c) 2022-2024 lax1dude, hoosiertransfer, ayunami2000. All Rights
* Reserved.
* Copyright (c) 2022-2024 lax1dude, ayunami2000. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND
@ -46,6 +46,7 @@ public class GuiScreenBackupWorldSelection extends GuiScreen {
private GuiButton worldConvert = null;
private GuiButton worldBackup = null;
private long worldSeed;
private boolean oldRNG;
private NBTTagCompound levelDat;
private String worldName;
@ -55,6 +56,7 @@ public class GuiScreenBackupWorldSelection extends GuiScreen {
this.worldName = worldName;
this.levelDat = levelDat;
this.worldSeed = levelDat.getCompoundTag("Data").getLong("RandomSeed");
this.oldRNG = levelDat.getCompoundTag("Data").getInteger("eaglerVersionSerial") == 0;
}
public void initGui() {
@ -76,8 +78,13 @@ public class GuiScreenBackupWorldSelection extends GuiScreen {
this.drawCenteredString(this.fontRendererObj, I18n.format("singleplayer.backup.title", worldName),
this.width / 2, this.height / 5 - 35, 16777215);
if (oldRNG) {
this.drawCenteredString(this.fontRendererObj, I18n.format("singleplayer.backup.seed") + " " + worldSeed
+ " " + EnumChatFormatting.RED + "(pre-u34)", this.width / 2, this.height / 5 + 62, 0xAAAAFF);
} else {
this.drawCenteredString(this.fontRendererObj, I18n.format("singleplayer.backup.seed") + " " + worldSeed,
this.width / 2, this.height / 5 + 62, 0xAAAAFF);
}
int toolTipColor = 0xDDDDAA;
if (worldRecreate.isMouseOver()) {
@ -105,8 +112,13 @@ public class GuiScreenBackupWorldSelection extends GuiScreen {
this.mc.displayGuiScreen(selectWorld);
} else if (par1GuiButton.id == 1) {
GuiCreateWorld cw = new GuiCreateWorld(selectWorld);
cw.func_146318_a(new WorldInfo(this.levelDat.getCompoundTag("Data")));
WorldInfo inf = new WorldInfo(this.levelDat.getCompoundTag("Data"));
cw.func_146318_a(inf);
if (inf.isOldEaglercraftRandom()) {
this.mc.displayGuiScreen(new GuiScreenOldSeedWarning(cw));
} else {
this.mc.displayGuiScreen(cw);
}
} else if (par1GuiButton.id == 2) {
this.mc.displayGuiScreen(new GuiRenameWorld(this.selectWorld, this.worldName, true));
} else if (par1GuiButton.id == 3) {

View File

@ -0,0 +1,59 @@
package net.lax1dude.eaglercraft.v1_8.sp.gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.resources.I18n;
/**
* Copyright (c) 2024 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
public class GuiScreenOldSeedWarning extends GuiScreen {
private final GuiScreen cont;
public GuiScreenOldSeedWarning(GuiScreen cont) {
this.cont = cont;
}
public void initGui() {
this.buttonList.clear();
this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 6 + 96,
I18n.format("singleplayer.oldseedwarning.ok")));
}
public void drawScreen(int par1, int par2, float par3) {
this.drawDefaultBackground();
this.drawCenteredString(fontRendererObj, I18n.format("singleplayer.oldseedwarning.title"), this.width / 2, 70,
11184810);
this.drawCenteredString(fontRendererObj, I18n.format("singleplayer.oldseedwarning.msg1"), this.width / 2, 90,
16777215);
this.drawCenteredString(fontRendererObj, I18n.format("singleplayer.oldseedwarning.msg2"), this.width / 2, 105,
16777215);
super.drawScreen(par1, par2, par3);
}
protected void actionPerformed(GuiButton par1GuiButton) {
if (par1GuiButton.id == 0) {
this.mc.displayGuiScreen(cont);
}
}
}

View File

@ -9,14 +9,21 @@ import java.util.function.Supplier;
/**
* Copyright (c) 2023-2024 lax1dude. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
@ -25,11 +32,11 @@ public class IPCPacketManager {
public static final HashMap<Integer, Supplier<IPCPacketBase>> mappings = new HashMap();
public static final IPCInputStream IPC_INPUT_STREAM = new IPCInputStream();
public static final IPCOutputStream IPC_OUTPUT_STREAM = new IPCOutputStream();
public final IPCInputStream IPC_INPUT_STREAM = new IPCInputStream();
public final IPCOutputStream IPC_OUTPUT_STREAM = new IPCOutputStream();
public static final DataInputStream IPC_DATA_INPUT_STREAM = new DataInputStream(IPC_INPUT_STREAM);
public static final DataOutputStream IPC_DATA_OUTPUT_STREAM = new DataOutputStream(IPC_OUTPUT_STREAM);
public final DataInputStream IPC_DATA_INPUT_STREAM = new DataInputStream(IPC_INPUT_STREAM);
public final DataOutputStream IPC_DATA_OUTPUT_STREAM = new DataOutputStream(IPC_OUTPUT_STREAM);
static {
mappings.put(IPCPacket00StartServer.ID, IPCPacket00StartServer::new);
@ -60,7 +67,7 @@ public class IPCPacketManager {
mappings.put(IPCPacketFFProcessKeepAlive.ID, IPCPacketFFProcessKeepAlive::new);
}
public static byte[] IPCSerialize(IPCPacketBase pkt) throws IOException {
public byte[] IPCSerialize(IPCPacketBase pkt) throws IOException {
IPC_OUTPUT_STREAM.feedBuffer(new byte[pkt.size() + 1], pkt.getClass().getSimpleName());
IPC_OUTPUT_STREAM.write(pkt.id());
@ -69,7 +76,7 @@ public class IPCPacketManager {
return IPC_OUTPUT_STREAM.returnBuffer();
}
public static IPCPacketBase IPCDeserialize(byte[] pkt) throws IOException {
public IPCPacketBase IPCDeserialize(byte[] pkt) throws IOException {
IPC_INPUT_STREAM.feedBuffer(pkt);
int i = IPC_INPUT_STREAM.read();
@ -87,7 +94,8 @@ public class IPCPacketManager {
int lo = IPC_INPUT_STREAM.getLeftoverCount();
if (lo > 0) {
System.err.println("Packet type 0x" + Integer.toHexString(i) + " class '" + p.getClass().getSimpleName() + "' was size " + (pkt.length - 1) + " but only " + (pkt.length - 1 - lo) + " bytes were read");
System.err.println("Packet type 0x" + Integer.toHexString(i) + " class '" + p.getClass().getSimpleName()
+ "' was size " + (pkt.length - 1) + " but only " + (pkt.length - 1 - lo) + " bytes were read");
}
return p;

View File

@ -68,6 +68,8 @@ public class EaglerIntegratedServerWorker {
private static final Map<String, IntegratedServerPlayerNetworkManager> openChannels = new HashMap();
private static final IPCPacketManager packetManagerInstance = new IPCPacketManager();
private static void processAsyncMessageQueue() {
List<IPCPacketData> pktList = ServerPlatformSingleplayer.recieveAllPacket();
if (pktList != null) {
@ -77,7 +79,7 @@ public class EaglerIntegratedServerWorker {
if (packetData.channel.equals(SingleplayerServerController.IPC_CHANNEL)) {
IPCPacketBase ipc;
try {
ipc = IPCPacketManager.IPCDeserialize(packetData.contents);
ipc = packetManagerInstance.IPCDeserialize(packetData.contents);
} catch (IOException ex) {
throw new RuntimeException("Failed to deserialize IPC packet", ex);
}
@ -444,7 +446,7 @@ public class EaglerIntegratedServerWorker {
public static void sendIPCPacket(IPCPacketBase ipc) {
byte[] pkt;
try {
pkt = IPCPacketManager.IPCSerialize(ipc);
pkt = packetManagerInstance.IPCSerialize(ipc);
} catch (IOException ex) {
throw new RuntimeException("Failed to serialize IPC packet", ex);
}

View File

@ -12,6 +12,7 @@ import net.lax1dude.eaglercraft.v1_8.sp.server.EaglerIntegratedServerWorker;
import net.lax1dude.eaglercraft.v1_8.sp.server.EaglerSaveFormat;
import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.storage.WorldInfo;
/**
* Copyright (c) 2022-2024 lax1dude, ayunami2000. All Rights Reserved.
@ -73,6 +74,9 @@ public class WorldConverterEPK {
NBTTagCompound worldDatNBT = CompressedStreamTools.readCompressed(new EaglerInputStream(b));
worldDatNBT.getCompoundTag("Data").setString("LevelName", newName);
worldDatNBT.getCompoundTag("Data").setLong("LastPlayed", System.currentTimeMillis());
if (has152Format) {
WorldInfo.initEaglerVersion(worldDatNBT.getCompoundTag("Data"));
}
EaglerOutputStream tmp = new EaglerOutputStream();
CompressedStreamTools.writeCompressed(worldDatNBT, tmp);
b = tmp.toByteArray();

View File

@ -20,6 +20,7 @@ import net.lax1dude.eaglercraft.v1_8.sp.server.EaglerChunkLoader;
import net.lax1dude.eaglercraft.v1_8.sp.server.EaglerIntegratedServerWorker;
import net.lax1dude.eaglercraft.v1_8.sp.server.EaglerSaveFormat;
import net.minecraft.world.chunk.storage.RegionFile;
import net.minecraft.world.storage.WorldInfo;
import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTTagCompound;
@ -110,9 +111,9 @@ public class WorldConverterMCA {
gameRulesNBT.setString("colorCodes", s);
gameRulesNBT.setString("doSignEditing", s);
worldDatNBT.getCompoundTag("Data").setTag("GameRules", gameRulesNBT);
worldDatNBT.getCompoundTag("Data").setString("LevelName", newName);
worldDatNBT.getCompoundTag("Data").setLong("LastPlayed", System.currentTimeMillis());
WorldInfo.initEaglerVersion(worldDatNBT.getCompoundTag("Data"));
EaglerOutputStream bo = new EaglerOutputStream();
CompressedStreamTools.writeCompressed(worldDatNBT, bo);
b = bo.toByteArray();

View File

@ -1642,6 +1642,9 @@ public class Block implements ILitBlock {
registerBlock(197, (String) "dark_oak_door", (new BlockDoor(Material.wood)).setHardness(3.0F)
.setStepSound(soundTypeWood).setUnlocalizedName("doorDarkOak").disableStats());
registerEaglerBlock(198, "end_rod", (new BlockEndRod()).setHardness(0.0F).setLightLevel(0.9375F)
.setStepSound(soundTypeWood).setUnlocalizedName("endRod"));
Block purpurBlock = (new Block(Material.rock)).setHardness(1.5F).setResistance(10.0F)
.setStepSound(soundTypeStone).setCreativeTab(CreativeTabs.tabBlock).setUnlocalizedName("purpurBlock");
registerEaglerBlock(201, (String) "purpur_block", purpurBlock);
@ -1660,6 +1663,9 @@ public class Block implements ILitBlock {
registerEaglerBlock(206, "end_bricks", (new Block(Material.rock)).setStepSound(soundTypeStone).setHardness(0.8F)
.setCreativeTab(CreativeTabs.tabBlock).setUnlocalizedName("endBricks"));
registerEaglerBlock(207, "beetroots", (new BlockBeetroot()).setUnlocalizedName("beetroots"), false);
Block grassPath = (new BlockGrassPath()).setHardness(0.65F).setStepSound(soundTypeGrass)
.setUnlocalizedName("grassPath").disableStats();
registerEaglerBlock(208, "grass_path", grassPath);
blockRegistry.validateKey();
@ -1670,7 +1676,7 @@ public class Block implements ILitBlock {
boolean flag = false;
boolean flag1 = block13 instanceof BlockStairs;
boolean flag2 = block13 instanceof BlockSlab;
boolean flag3 = block13 == block6;
boolean flag3 = block13 == block6 || block13 == grassPath;
boolean flag4 = block13.translucent;
boolean flag5 = block13.lightOpacity == 0;
if (flag1 || flag2 || flag3 || flag4 || flag5) {

View File

@ -0,0 +1,136 @@
package net.minecraft.block;
import net.hoosiertransfer.EaglerItems;
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyDirection;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockEndRod extends Block {
public static final PropertyDirection FACING = PropertyDirection.create("facing");
protected BlockEndRod() {
super(Material.circuits);
this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.UP));
this.setCreativeTab(CreativeTabs.tabDecorations);
}
public AxisAlignedBB getCollisionBoundingBox(World world, BlockPos blockpos, IBlockState iblockstate) {
this.setBlockBoundsBasedOnState(world, blockpos);
return super.getCollisionBoundingBox(world, blockpos, iblockstate);
}
public AxisAlignedBB getSelectedBoundingBox(World world, BlockPos blockpos) {
this.setBlockBoundsBasedOnState(world, blockpos);
return super.getSelectedBoundingBox(world, blockpos);
}
public void setBlockBoundsBasedOnState(IBlockAccess iblockaccess, BlockPos blockpos) {
IBlockState iblockstate = iblockaccess.getBlockState(blockpos);
if (iblockstate.getBlock() != this) {
return;
}
EnumFacing enumfacing = (EnumFacing) iblockstate.getValue(FACING);
switch (enumfacing.getAxis()) {
case X:
default:
this.setBlockBounds(0.0F, 0.375F, 0.375F, 1.0F, 0.625F, 0.625F);
break;
case Z:
this.setBlockBounds(0.375F, 0.375F, 0.0F, 0.625F, 0.625F,
1.0F);
break;
case Y:
this.setBlockBounds(0.375F, 0.0F, 0.375F, 0.625F, 1.0F, 0.625F);
}
}
public boolean isOpaqueCube() {
return false;
}
public boolean isFullCube() {
return false;
}
public boolean canPlaceBlockAt(World worldIn, BlockPos pos) {
return true;
}
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ,
int meta, EntityLivingBase placer) {
IBlockState iblockstate = worldIn.getBlockState(pos.offset(facing.getOpposite()));
if (iblockstate.getBlock() == EaglerItems.getEaglerBlock("end_rod")) {
EnumFacing enumfacing = (EnumFacing) iblockstate.getValue(FACING);
if (enumfacing == facing) {
return this.getDefaultState().withProperty(FACING, facing.getOpposite());
}
}
return this.getDefaultState().withProperty(FACING, facing);
}
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) {
}
public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, EaglercraftRandom rand) {
EnumFacing enumfacing = (EnumFacing) stateIn.getValue(FACING);
double d0 = (double) pos.getX() + 0.55D - (double) (rand.nextFloat() * 0.1F);
double d1 = (double) pos.getY() + 0.55D - (double) (rand.nextFloat() * 0.1F);
double d2 = (double) pos.getZ() + 0.55D - (double) (rand.nextFloat() * 0.1F);
double d3 = (double) (0.4F - (rand.nextFloat() + rand.nextFloat()) * 0.4F);
if (rand.nextInt(5) == 0) {
// worldIn.spawnParticle(EnumParticleTypes.END_ROD, d0 + (double)
// enumfacing.getFrontOffsetX() * d3,
// d1 + (double) enumfacing.getFrontOffsetY() * d3, d2 + (double)
// enumfacing.getFrontOffsetZ() * d3,
// rand.nextGaussian() * 0.005D, rand.nextGaussian() * 0.005D,
// rand.nextGaussian() * 0.005D,
// new int[0]);
}
}
public EnumWorldBlockLayer getBlockLayer() {
return EnumWorldBlockLayer.CUTOUT;
}
/**
* Convert the given metadata into a BlockState for this Block
*/
public IBlockState getStateFromMeta(int meta) {
IBlockState iblockstate = this.getDefaultState();
iblockstate = iblockstate.withProperty(FACING, EnumFacing.getFront(meta));
return iblockstate;
}
/**
* Convert the BlockState into the correct metadata value
*/
public int getMetaFromState(IBlockState state) {
return ((EnumFacing) state.getValue(FACING)).getIndex();
}
protected BlockState createBlockState() {
return new BlockState(this, new IProperty[] { FACING });
}
public int getMobilityFlag(IBlockState state) {
return 0;
}
}

View File

@ -1,5 +1,6 @@
package net.minecraft.block;
import net.hoosiertransfer.EaglerItems;
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
import net.minecraft.block.material.Material;
@ -145,7 +146,8 @@ public class BlockFarmland extends Block {
case WEST:
case EAST:
Block block = iblockaccess.getBlockState(blockpos).getBlock();
return !block.isOpaqueCube() && block != Blocks.farmland;
return !block.isOpaqueCube() && block != Blocks.farmland
&& block != EaglerItems.getEaglerBlock("grass_path");
default:
return super.shouldSideBeRendered(iblockaccess, blockpos, enumfacing);
}

View File

@ -0,0 +1,90 @@
package net.minecraft.block;
import javax.annotation.Nullable;
import net.hoosiertransfer.EaglerItems;
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockGrassPath extends Block {
protected BlockGrassPath() {
super(Material.ground);
this.setLightOpacity(255);
}
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos,
EnumFacing side) {
switch (side) {
case UP:
return true;
case NORTH:
case SOUTH:
case WEST:
case EAST:
Block block = blockAccess.getBlockState(pos).getBlock();
return !block.isOpaqueCube() && block != Blocks.farmland
&& block != EaglerItems.getEaglerBlock("grass_path");
default:
return super.shouldSideBeRendered(blockAccess, pos, side);
}
}
public AxisAlignedBB getCollisionBoundingBox(World world, BlockPos blockpos, IBlockState iblockstate) {
this.setBlockBoundsBasedOnState(world, blockpos);
return super.getCollisionBoundingBox(world, blockpos, iblockstate);
}
public AxisAlignedBB getSelectedBoundingBox(World world, BlockPos blockpos) {
this.setBlockBoundsBasedOnState(world, blockpos);
return super.getSelectedBoundingBox(world, blockpos);
}
public void setBlockBoundsBasedOnState(IBlockAccess iblockaccess, BlockPos blockpos) {
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.9375F, 1.0F);
}
/**
* Used to determine ambient occlusion and culling when rebuilding chunks for
* render
*/
public boolean isOpaqueCube() {
return false;
}
public boolean isFullCube() {
return false;
}
@Nullable
/**
* Get the Item that this Block should drop when harvested.
*/
public Item getItemDropped(IBlockState state, EaglercraftRandom rand, int fortune) {
return Blocks.dirt.getItemDropped(
Blocks.dirt.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.DIRT), rand, fortune);
}
public ItemStack getItem(World worldIn, BlockPos pos, IBlockState state) {
return new ItemStack(this);
}
public void onNeighborBlockChange(World world, BlockPos blockpos, IBlockState iblockstate, Block var4) {
super.onNeighborBlockChange(world, blockpos, iblockstate, var4);
if (world.getBlockState(blockpos.up()).getBlock().getMaterial().isSolid()) {
world.setBlockState(blockpos, Blocks.dirt.getDefaultState());
}
}
}

View File

@ -780,7 +780,18 @@ public class Minecraft implements IThreadListener {
}
this.mcSoundHandler.unloadSounds();
if (SingleplayerServerController.isWorldRunning()) {
SingleplayerServerController.shutdownEaglercraftServer();
while (SingleplayerServerController.getStatusState() == IntegratedServerState.WORLD_UNLOADING) {
EagUtils.sleep(50l);
SingleplayerServerController.runTick();
}
}
if (SingleplayerServerController.isIntegratedServerWorkerAlive()
&& SingleplayerServerController.canKillWorker()) {
SingleplayerServerController.killWorker();
EagUtils.sleep(50l);
}
} finally {
EagRuntime.destroy();
if (!this.hasCrashed) {

View File

@ -22,6 +22,7 @@ import net.lax1dude.eaglercraft.v1_8.HString;
import net.lax1dude.eaglercraft.v1_8.internal.EnumPlatformType;
import net.lax1dude.eaglercraft.v1_8.opengl.EaglercraftGPU;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.DynamicLightsStateManager;
import net.lax1dude.eaglercraft.v1_8.sp.SingleplayerServerController;
import net.minecraft.block.Block;
import net.minecraft.block.properties.IProperty;
@ -405,6 +406,9 @@ public class GuiOverlayDebug extends Gui {
new Object[] { enumfacing, s,
Float.valueOf(MathHelper.wrapAngleTo180_float(entity.rotationYaw)),
Float.valueOf(MathHelper.wrapAngleTo180_float(entity.rotationPitch)) }) });
if (DynamicLightsStateManager.isDynamicLightsRender()) {
arraylist.add(6, DynamicLightsStateManager.getF3String());
}
if (this.mc.theWorld != null && this.mc.theWorld.isBlockLoaded(blockpos)) {
Chunk chunk = this.mc.theWorld.getChunkFromBlockCoords(blockpos);
arraylist.add("Biome: " + chunk.getBiome(blockpos, null).biomeName);

View File

@ -49,10 +49,10 @@ public class GuiVideoSettings extends GuiScreen {
GameSettings.Options.VIEW_BOBBING, GameSettings.Options.GUI_SCALE, GameSettings.Options.GAMMA,
GameSettings.Options.RENDER_CLOUDS, GameSettings.Options.PARTICLES, GameSettings.Options.FXAA,
GameSettings.Options.MIPMAP_LEVELS, GameSettings.Options.BLOCK_ALTERNATIVES,
GameSettings.Options.ENTITY_SHADOWS, GameSettings.Options.FOG, GameSettings.Options.FULLSCREEN,
GameSettings.Options.FNAW_SKINS, GameSettings.Options.HUD_FPS, GameSettings.Options.HUD_COORDS,
GameSettings.Options.HUD_PLAYER, GameSettings.Options.HUD_STATS, GameSettings.Options.HUD_WORLD,
GameSettings.Options.HUD_24H, GameSettings.Options.CHUNK_FIX };
GameSettings.Options.ENTITY_SHADOWS, GameSettings.Options.FOG, GameSettings.Options.EAGLER_DYNAMIC_LIGHTS,
GameSettings.Options.FULLSCREEN, GameSettings.Options.FNAW_SKINS, GameSettings.Options.HUD_FPS,
GameSettings.Options.HUD_COORDS, GameSettings.Options.HUD_PLAYER, GameSettings.Options.HUD_STATS,
GameSettings.Options.HUD_WORLD, GameSettings.Options.HUD_24H, GameSettings.Options.CHUNK_FIX };
public GuiVideoSettings(GuiScreen parentScreenIn, GameSettings gameSettingsIn) {
this.parentGuiScreen = parentScreenIn;

View File

@ -298,4 +298,8 @@ public class EntityFX extends Entity {
+ this.particleRed + "," + this.particleGreen + "," + this.particleBlue + "," + this.particleAlpha
+ "), Age " + this.particleAge;
}
protected float getEaglerDynamicLightsValueSimple(float partialTicks) {
return 0.0f;
}
}

View File

@ -4,6 +4,7 @@ import net.lax1dude.eaglercraft.v1_8.minecraft.EaglerTextureAtlasSprite;
import net.lax1dude.eaglercraft.v1_8.opengl.WorldRenderer;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.BlockVertexIDs;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.DeferredStateManager;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.DynamicLightsStateManager;
import net.minecraft.block.Block;
import net.minecraft.block.BlockLiquid;
import net.minecraft.block.material.Material;
@ -64,6 +65,7 @@ public class BlockFluidRenderer {
WorldRenderer worldRendererIn) {
BlockPos tmp = new BlockPos(0, 0, 0);
boolean deferred = DeferredStateManager.isDeferredRenderer();
boolean isDynamicLights = deferred || DynamicLightsStateManager.isDynamicLightsRender();
BlockLiquid blockliquid = (BlockLiquid) blockStateIn.getBlock();
boolean lava = blockliquid.getMaterial() == Material.lava;
boolean realistic = !lava && DeferredStateManager.isRenderingRealisticWater();
@ -162,7 +164,7 @@ public class BlockFluidRenderer {
.tex((double) f15, (double) f19).lightmap(l2, i3).endVertex();
worldRendererIn.pos(d0 + 1.0D, d1 + (double) f10, d2 + 0.0D).color(f24, f25, f26, 1.0F)
.tex((double) f16, (double) f20).lightmap(l2, i3).endVertex();
if (deferred)
if (isDynamicLights)
worldRendererIn.genNormals(true, f12 <= -999.0F ? BlockVertexIDs.builtin_water_still_vertex_id
: BlockVertexIDs.builtin_water_flow_vertex_id);
@ -175,7 +177,7 @@ public class BlockFluidRenderer {
.tex((double) f15, (double) f19).lightmap(l2, i3).endVertex();
worldRendererIn.pos(d0 + 0.0D, d1 + (double) f8, d2 + 1.0D).color(f24, f25, f26, 1.0F)
.tex((double) f14, (double) f18).lightmap(l2, i3).endVertex();
if (deferred)
if (isDynamicLights)
worldRendererIn.genNormals(true, f12 <= -999.0F ? BlockVertexIDs.builtin_water_still_vertex_id
: BlockVertexIDs.builtin_water_flow_vertex_id);
}
@ -197,7 +199,7 @@ public class BlockFluidRenderer {
.lightmap(i2, j2).endVertex();
worldRendererIn.pos(d0 + 1.0D, d1, d2 + 1.0D).color(f3, f3, f3, 1.0F).tex((double) f36, (double) f38)
.lightmap(i2, j2).endVertex();
if (deferred)
if (isDynamicLights)
worldRendererIn.putNormal(0.0f, -1.0f, 0.0f, BlockVertexIDs.builtin_water_still_vertex_id);
flag2 = true;
}
@ -283,7 +285,7 @@ public class BlockFluidRenderer {
.lightmap(k, l).endVertex();
worldRendererIn.pos(d3, d1 + 0.0D, d4).color(f32, f33, f34, 1.0F).tex((double) f41, (double) f30)
.lightmap(k, l).endVertex();
if (deferred)
if (isDynamicLights)
worldRendererIn.putNormal(j1, 0.0f, k1, BlockVertexIDs.builtin_water_flow_vertex_id);
if (!realistic) {
worldRendererIn.pos(d3, d1 + 0.0D, d4).color(f32, f33, f34, 1.0F)
@ -294,7 +296,7 @@ public class BlockFluidRenderer {
.tex((double) f27, (double) f29).lightmap(k, l).endVertex();
worldRendererIn.pos(d3, d1 + (double) f39, d4).color(f32, f33, f34, 1.0F)
.tex((double) f41, (double) f28).lightmap(k, l).endVertex();
if (deferred)
if (isDynamicLights)
worldRendererIn.putNormal(-j1, 0.0f, -k1, BlockVertexIDs.builtin_water_flow_vertex_id);
}
}

View File

@ -8,6 +8,7 @@ import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.lax1dude.eaglercraft.v1_8.opengl.WorldRenderer;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.DeferredStateManager;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.VertexMarkerState;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.DynamicLightsStateManager;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
@ -150,6 +151,7 @@ public class BlockModelRenderer {
WorldRenderer worldRendererIn, List<BakedQuad> listQuadsIn, float[] quadBounds, BitSet boundsFlags,
BlockModelRenderer.AmbientOcclusionFace aoFaceIn) {
boolean isDeferred = DeferredStateManager.isDeferredRenderer();
boolean isDynamicLights = isDeferred || DynamicLightsStateManager.isDynamicLightsRender();
double d0 = (double) blockPosIn.getX();
double d1 = (double) blockPosIn.getY();
double d2 = (double) blockPosIn.getZ();
@ -165,8 +167,9 @@ public class BlockModelRenderer {
for (int i = 0, l = listQuadsIn.size(); i < l; ++i) {
BakedQuad bakedquad = listQuadsIn.get(i);
int[] vertData = isDeferred ? bakedquad.getVertexDataWithNormals() : bakedquad.getVertexData();
this.fillQuadBounds(blockIn, vertData, bakedquad.getFace(), quadBounds, boundsFlags, isDeferred ? 8 : 7);
int[] vertData = isDynamicLights ? bakedquad.getVertexDataWithNormals() : bakedquad.getVertexData();
this.fillQuadBounds(blockIn, vertData, bakedquad.getFace(), quadBounds, boundsFlags,
isDynamicLights ? 8 : 7);
aoFaceIn.updateVertexBrightness(blockAccessIn, blockIn, blockPosIn, bakedquad.getFace(), quadBounds,
boundsFlags);
worldRendererIn.addVertexData(vertData);
@ -286,6 +289,7 @@ public class BlockModelRenderer {
double d0 = (double) blockPosIn.getX();
double d1 = (double) blockPosIn.getY();
double d2 = (double) blockPosIn.getZ();
boolean isDynamicLights = isDeferred || DynamicLightsStateManager.isDynamicLightsRender();
Block.EnumOffsetType block$enumoffsettype = blockIn.getOffsetType();
if (block$enumoffsettype != Block.EnumOffsetType.NONE) {
int i = blockPosIn.getX();
@ -302,9 +306,9 @@ public class BlockModelRenderer {
for (int m = 0, n = listQuadsIn.size(); m < n; ++m) {
BakedQuad bakedquad = listQuadsIn.get(m);
EnumFacing facingIn = bakedquad.getFace();
int[] vertData = isDeferred ? bakedquad.getVertexDataWithNormals() : bakedquad.getVertexData();
int[] vertData = isDynamicLights ? bakedquad.getVertexDataWithNormals() : bakedquad.getVertexData();
blockPosIn.offsetEvenFaster(facingIn, blockpos0);
this.fillQuadBounds(blockIn, vertData, facingIn, quadBounds, boundsFlags, isDeferred ? 8 : 7);
this.fillQuadBounds(blockIn, vertData, facingIn, quadBounds, boundsFlags, isDynamicLights ? 8 : 7);
boolean boundsFlags0 = boundsFlags.get(0);
if (ownBrightness) {
brightnessIn = boundsFlags0 ? blockIn.getMixedBrightnessForBlock(blockAccessIn, blockpos0)

View File

@ -6,6 +6,7 @@ import com.google.common.collect.Lists;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.DeferredStateManager;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.DynamicLightsStateManager;
import net.minecraft.client.renderer.chunk.RenderChunk;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumWorldBlockLayer;
@ -18,8 +19,8 @@ import net.minecraft.util.MathHelper;
* Minecraft 1.8.8 bytecode is (c) 2015 Mojang AB. "Do not distribute!"
* Mod Coder Pack v9.18 deobfuscation configs are (c) Copyright by the MCP Team
*
* EaglercraftX 1.8 patch files (c) 2022-2024 lax1dude, hoosiertransfer,
* ayunami2000. All Rights Reserved.
* EaglercraftX 1.8 patch files (c) 2022-2024 lax1dude, ayunami2000. All Rights
* Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND
@ -62,10 +63,15 @@ public abstract class ChunkRenderContainer {
float posZ = (float) ((double) blockpos.getZ() - this.viewEntityZ);
GlStateManager.translate(posX, posY, posZ);
if (DeferredStateManager.isInForwardPass()) {
posX = (float) (blockpos.getX() - (MathHelper.floor_double(this.viewEntityX / 16.0) << 4)); // TODO
posX = (float) (blockpos.getX() - (MathHelper.floor_double(this.viewEntityX / 16.0) << 4));
posY = (float) (blockpos.getY() - (MathHelper.floor_double(this.viewEntityY / 16.0) << 4));
posZ = (float) (blockpos.getZ() - (MathHelper.floor_double(this.viewEntityZ / 16.0) << 4));
DeferredStateManager.reportForwardRenderObjectPosition((int) posX, (int) posY, (int) posZ);
} else if (DynamicLightsStateManager.isInDynamicLightsPass()) {
posX = (float) (blockpos.getX() - (MathHelper.floor_double(this.viewEntityX / 16.0) << 4));
posY = (float) (blockpos.getY() - (MathHelper.floor_double(this.viewEntityY / 16.0) << 4));
posZ = (float) (blockpos.getZ() - (MathHelper.floor_double(this.viewEntityZ / 16.0) << 4));
DynamicLightsStateManager.reportForwardRenderObjectPosition((int) posX, (int) posY, (int) posZ);
}
}

View File

@ -34,6 +34,7 @@ import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.NameTagRenderer;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.ShadersRenderPassFuture;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.gui.GuiShaderConfig;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.texture.EmissiveItems;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.DynamicLightsStateManager;
import net.lax1dude.eaglercraft.v1_8.voice.VoiceTagRenderer;
import net.lax1dude.eaglercraft.v1_8.vector.Vector4f;
import net.lax1dude.eaglercraft.v1_8.vector.Matrix4f;
@ -672,6 +673,9 @@ public class EntityRenderer implements IResourceManagerReloadListener {
*/
private void renderHand(float partialTicks, int xOffset) {
if (!this.debugView) {
if (DynamicLightsStateManager.isInDynamicLightsPass()) {
DynamicLightsStateManager.reportForwardRenderObjectPosition2(0.0f, 0.0f, 0.0f);
}
GlStateManager.matrixMode(GL_PROJECTION);
GlStateManager.loadIdentity();
float f = 0.07F;
@ -868,7 +872,8 @@ public class EntityRenderer implements IResourceManagerReloadListener {
GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit);
this.mc.getTextureManager().bindTexture(this.locationLightMap);
if (mc.gameSettings.fancyGraphics || mc.gameSettings.ambientOcclusion > 0) {
if (mc.gameSettings.fancyGraphics || mc.gameSettings.ambientOcclusion > 0
|| DynamicLightsStateManager.isDynamicLightsRender()) {
EaglercraftGPU.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
EaglercraftGPU.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
} else {
@ -1123,7 +1128,15 @@ public class EntityRenderer implements IResourceManagerReloadListener {
GlStateManager.alphaFunc(GL_GREATER, 0.5F);
}
this.mc.mcProfiler.startSection("center");
boolean dlights = DynamicLightsStateManager.isDynamicLightsRender();
if (dlights) {
updateDynamicLightListEagler(partialTicks);
}
if (this.mc.gameSettings.anaglyph && !this.mc.gameSettings.shaders) {
if (dlights) {
GlStateManager.enableExtensionPipeline();
}
try {
anaglyphField = 0;
GlStateManager.colorMask(false, true, true, false);
this.renderWorldPass(0, partialTicks, finishTimeNano);
@ -1131,6 +1144,11 @@ public class EntityRenderer implements IResourceManagerReloadListener {
GlStateManager.colorMask(true, false, false, false);
this.renderWorldPass(1, partialTicks, finishTimeNano);
GlStateManager.colorMask(true, true, true, false);
} finally {
if (dlights) {
GlStateManager.disableExtensionPipeline();
}
}
} else {
if (this.mc.gameSettings.shaders) {
try {
@ -1146,7 +1164,16 @@ public class EntityRenderer implements IResourceManagerReloadListener {
mc.effectRenderer.acceleratedParticleRenderer = EffectRenderer.vanillaAcceleratedParticleRenderer;
} else {
mc.effectRenderer.acceleratedParticleRenderer = EffectRenderer.vanillaAcceleratedParticleRenderer;
if (dlights) {
GlStateManager.enableExtensionPipeline();
}
try {
this.renderWorldPass(2, partialTicks, finishTimeNano);
} finally {
if (dlights) {
GlStateManager.disableExtensionPipeline();
}
}
}
}
@ -1168,6 +1195,10 @@ public class EntityRenderer implements IResourceManagerReloadListener {
GlStateManager.clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
this.mc.mcProfiler.endStartSection("camera");
this.setupCameraTransform(partialTicks, pass);
boolean isDynamicLights = DynamicLightsStateManager.isDynamicLightsRender();
if (isDynamicLights) {
DynamicLightsStateManager.setupInverseViewMatrix();
}
ActiveRenderInfo.updateRenderInfo(this.mc.thePlayer, this.mc.gameSettings.thirdPersonView == 2);
this.mc.mcProfiler.endStartSection("culling");
Frustum frustum = new Frustum();
@ -1175,6 +1206,9 @@ public class EntityRenderer implements IResourceManagerReloadListener {
double d0 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double) partialTicks;
double d1 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double) partialTicks;
double d2 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double) partialTicks;
TileEntityRendererDispatcher.staticPlayerX = d0; // hack, needed for some eagler stuff
TileEntityRendererDispatcher.staticPlayerY = d1;
TileEntityRendererDispatcher.staticPlayerZ = d2;
frustum.setPosition(d0, d1, d2);
if (this.mc.gameSettings.renderDistanceChunks >= 4) {
this.setupFog(-1, partialTicks);
@ -1240,8 +1274,14 @@ public class EntityRenderer implements IResourceManagerReloadListener {
EntityPlayer entityplayer = (EntityPlayer) entity;
GlStateManager.disableAlpha();
this.mc.mcProfiler.endStartSection("outline");
if (isDynamicLights) {
GlStateManager.disableExtensionPipeline();
}
renderglobal.drawSelectionBox(entityplayer, this.mc.objectMouseOver, 0, partialTicks);
GlStateManager.enableAlpha();
if (isDynamicLights) {
GlStateManager.enableExtensionPipeline();
}
}
}
@ -1250,9 +1290,15 @@ public class EntityRenderer implements IResourceManagerReloadListener {
if (flag && this.mc.objectMouseOver != null && !entity.isInsideOfMaterial(Material.water)) {
EntityPlayer entityplayer1 = (EntityPlayer) entity;
GlStateManager.disableAlpha();
if (isDynamicLights) {
GlStateManager.disableExtensionPipeline();
}
this.mc.mcProfiler.endStartSection("outline");
renderglobal.drawSelectionBox(entityplayer1, this.mc.objectMouseOver, 0, partialTicks);
GlStateManager.enableAlpha();
if (isDynamicLights) {
GlStateManager.enableExtensionPipeline();
}
}
this.mc.mcProfiler.endStartSection("destroyProgress");
@ -1270,7 +1316,14 @@ public class EntityRenderer implements IResourceManagerReloadListener {
RenderHelper.disableStandardItemLighting();
this.setupFog(0, partialTicks);
this.mc.mcProfiler.endStartSection("particles");
if (isDynamicLights) {
DynamicLightsStateManager.bindAcceleratedEffectRenderer(effectrenderer);
DynamicLightsStateManager.reportForwardRenderObjectPosition2(0.0f, 0.0f, 0.0f);
}
effectrenderer.renderParticles(entity, partialTicks, 2);
if (isDynamicLights) {
effectrenderer.acceleratedParticleRenderer = null;
}
this.disableLightmap();
}
@ -1315,6 +1368,20 @@ public class EntityRenderer implements IResourceManagerReloadListener {
}
private void updateDynamicLightListEagler(float partialTicks) {
DynamicLightsStateManager.clearRenderList();
Entity entity = this.mc.getRenderViewEntity();
double d0 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double) partialTicks;
double d1 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double) partialTicks;
double d2 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double) partialTicks;
AxisAlignedBB entityAABB = new AxisAlignedBB(d0 - 48.0, d1 - 32.0, d2 - 48.0, d0 + 48.0, d1 + 32.0, d2 + 48.0);
List<Entity> entities = this.mc.theWorld.getEntitiesWithinAABB(Entity.class, entityAABB);
for (int i = 0, l = entities.size(); i < l; ++i) {
entities.get(i).renderDynamicLightsEaglerSimple(partialTicks);
}
DynamicLightsStateManager.commitLightSourceBuckets(d0, d1, d2);
}
private void renderCloudsCheck(RenderGlobal renderGlobalIn, float partialTicks, int pass) {
if (this.mc.gameSettings.func_181147_e() != 0) {
this.mc.mcProfiler.endStartSection("clouds");
@ -1429,6 +1496,9 @@ public class EntityRenderer implements IResourceManagerReloadListener {
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, 1, 0);
GlStateManager.alphaFunc(GL_GREATER, 0.1F);
if (DynamicLightsStateManager.isInDynamicLightsPass()) {
DynamicLightsStateManager.reportForwardRenderObjectPosition2(0.0f, 0.0f, 0.0f);
}
} else {
GlStateManager.enableAlpha();
DeferredStateManager.setHDRTranslucentPassBlendFunc();

View File

@ -34,6 +34,7 @@ import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.DynamicLightManager;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.EaglerDeferredConfig;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.EaglerDeferredPipeline;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.program.SharedPipelineShaders;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.DynamicLightsStateManager;
import net.lax1dude.eaglercraft.v1_8.vector.Vector3f;
import net.lax1dude.eaglercraft.v1_8.vector.Vector4f;
import net.minecraft.block.Block;
@ -487,6 +488,16 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene
}
SharedPipelineShaders.free();
}
if (DeferredStateManager.isDeferredRenderer()) {
DynamicLightsStateManager.disableDynamicLightsRender(false);
} else {
if (mc.gameSettings.enableDynamicLights) {
DynamicLightsStateManager.enableDynamicLightsRender();
} else {
DynamicLightsStateManager.disableDynamicLightsRender(true);
}
}
}
}
@ -806,6 +817,21 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene
}
}
private boolean isOutlineActive(Entity p_184383_1_, Entity p_184383_2_, ICamera p_184383_3_) {
boolean flag = p_184383_2_ instanceof EntityLivingBase && ((EntityLivingBase) p_184383_2_).isPlayerSleeping();
return p_184383_1_ == p_184383_2_ && this.mc.gameSettings.thirdPersonView == 0 && !flag ? false
: (p_184383_1_.isGlowing() ? true
: (this.mc.thePlayer.isSpectator() && false
// : (this.mc.thePlayer.isSpectator() &&
// this.mc.gameSettings.keyBindSpectatorOutlines.isKeyDown() // TODO: add this
&& p_184383_1_ instanceof EntityPlayer
? p_184383_1_.ignoreFrustumCheck
|| p_184383_3_
.isBoundingBoxInFrustum(p_184383_1_.getEntityBoundingBox())
|| p_184383_1_.riddenByEntity == this.mc.thePlayer
: false));
}
/**
* +
* Gets the render info for use on the Debug screen
@ -1973,7 +1999,9 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene
if (!this.damagedBlocks.isEmpty()) {
this.renderEngine.bindTexture(TextureMap.locationBlocksTexture);
this.preRenderDamagedBlocks();
worldRendererIn.begin(7, DeferredStateManager.isDeferredRenderer() ? VertexFormat.BLOCK_SHADERS
worldRendererIn.begin(7,
(DeferredStateManager.isDeferredRenderer() || DynamicLightsStateManager.isDynamicLightsRender())
? VertexFormat.BLOCK_SHADERS
: DefaultVertexFormats.BLOCK);
worldRendererIn.setTranslation(-d0, -d1, -d2);
worldRendererIn.markDirty();
@ -1996,6 +2024,10 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene
int i = destroyblockprogress.getPartialBlockDamage();
EaglerTextureAtlasSprite textureatlassprite = this.destroyBlockIcons[i];
BlockRendererDispatcher blockrendererdispatcher = this.mc.getBlockRendererDispatcher();
if (DynamicLightsStateManager.isInDynamicLightsPass()) {
DynamicLightsStateManager.reportForwardRenderObjectPosition2(blockpos.x, blockpos.y,
blockpos.z);
}
blockrendererdispatcher.renderBlockDamage(iblockstate, blockpos, textureatlassprite,
this.theWorld);
}

View File

@ -5,6 +5,7 @@ import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.VertexMarkerState;
import net.lax1dude.eaglercraft.v1_8.vector.Matrix4f;
import net.lax1dude.eaglercraft.v1_8.vector.Vector3f;
import net.lax1dude.eaglercraft.v1_8.vector.Vector4f;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.EnumFaceDirection;
import net.minecraft.client.resources.model.ModelRotation;
import net.minecraft.util.EnumFacing;
@ -128,7 +129,9 @@ public class FaceBakery {
float[] sprite, EaglerTextureAtlasSprite modelRotationIn, ModelRotation partRotation,
BlockPartRotation uvLocked, boolean shade, boolean parFlag2, Vector3f calcNormal) {
EnumFacing enumfacing = partRotation.rotateFace(facing);
int i = (parFlag2 && stride != 8) ? this.getFaceShadeColor(enumfacing) : -1;
int i = (parFlag2 && (stride != 8 || !Minecraft.getMinecraft().gameSettings.shaders))
? this.getFaceShadeColor(enumfacing)
: -1;
EnumFaceDirection.VertexInformation enumfacedirection$vertexinformation = EnumFaceDirection.getFacing(facing)
.func_179025_a(vertexIndex);
Vector3f vector3f = new Vector3f(sprite[enumfacedirection$vertexinformation.field_179184_a],
@ -148,9 +151,15 @@ public class FaceBakery {
faceData[i + 4 + 1] = Float
.floatToRawIntBits(sprite.getInterpolatedV((double) faceUV.func_178346_b(vertexIndex)));
if (stride == 8) {
if (!Minecraft.getMinecraft().gameSettings.shaders) {
faceData[i] = Float.floatToRawIntBits(position.x);
faceData[i + 1] = Float.floatToRawIntBits(position.y);
faceData[i + 2] = Float.floatToRawIntBits(position.z);
} else {
faceData[i] = Float.floatToRawIntBits(position.x * VertexMarkerState.localCoordDeriveHackX);
faceData[i + 1] = Float.floatToRawIntBits(position.y * VertexMarkerState.localCoordDeriveHackY);
faceData[i + 2] = Float.floatToRawIntBits(position.z * VertexMarkerState.localCoordDeriveHackZ);
}
if (calcNormal != null) {
int x = (byte) ((int) (calcNormal.x * 127.0F)) & 255;
int y = (byte) ((int) (calcNormal.y * 127.0F)) & 255;

View File

@ -13,6 +13,7 @@ import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.lax1dude.eaglercraft.v1_8.opengl.VertexFormat;
import net.lax1dude.eaglercraft.v1_8.opengl.WorldRenderer;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.DeferredStateManager;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.DynamicLightsStateManager;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
@ -255,7 +256,9 @@ public class RenderChunk {
private void preRenderBlocks(WorldRenderer worldRendererIn, BlockPos pos) {
worldRendererIn.begin(7,
DeferredStateManager.isDeferredRenderer() ? VertexFormat.BLOCK_SHADERS : DefaultVertexFormats.BLOCK);
(DeferredStateManager.isDeferredRenderer() || DynamicLightsStateManager.isDynamicLightsRender())
? VertexFormat.BLOCK_SHADERS
: DefaultVertexFormats.BLOCK);
worldRendererIn.setTranslation((double) (-pos.getX()), (double) (-pos.getY()), (double) (-pos.getZ()));
}

View File

@ -4,6 +4,7 @@ import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.lax1dude.eaglercraft.v1_8.opengl.VertexFormat;
import net.lax1dude.eaglercraft.v1_8.opengl.WorldRenderer;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.DeferredStateManager;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.DynamicLightsStateManager;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
@ -24,8 +25,8 @@ import net.minecraft.world.World;
* Minecraft 1.8.8 bytecode is (c) 2015 Mojang AB. "Do not distribute!"
* Mod Coder Pack v9.18 deobfuscation configs are (c) Copyright by the MCP Team
*
* EaglercraftX 1.8 patch files (c) 2022-2024 lax1dude, hoosiertransfer,
* ayunami2000. All Rights Reserved.
* EaglercraftX 1.8 patch files (c) 2022-2024 lax1dude, ayunami2000. All Rights
* Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND
@ -76,7 +77,9 @@ public class RenderFallingBlock extends Render<EntityFallingBlock> {
GlStateManager.disableLighting();
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
worldrenderer.begin(7, DeferredStateManager.isDeferredRenderer() ? VertexFormat.BLOCK_SHADERS
worldrenderer.begin(7,
(DeferredStateManager.isDeferredRenderer()
|| DynamicLightsStateManager.isDynamicLightsRender()) ? VertexFormat.BLOCK_SHADERS
: DefaultVertexFormats.BLOCK);
int i = blockpos.getX();
int j = blockpos.getY();

View File

@ -11,6 +11,7 @@ import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.lax1dude.eaglercraft.v1_8.opengl.OpenGlHelper;
import net.lax1dude.eaglercraft.v1_8.opengl.WorldRenderer;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.DeferredStateManager;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.DynamicLightsStateManager;
import net.lax1dude.eaglercraft.v1_8.profile.RenderHighPoly;
import net.minecraft.block.Block;
import net.minecraft.block.BlockBed;
@ -346,6 +347,10 @@ public class RenderManager {
double d0 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double) partialTicks;
double d1 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double) partialTicks;
double d2 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double) partialTicks;
if (DynamicLightsStateManager.isInDynamicLightsPass()) {
DynamicLightsStateManager.reportForwardRenderObjectPosition2((float) (d0 - viewerPosX),
(float) (d1 - viewerPosY), (float) (d2 - viewerPosZ));
}
float f = entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks;
int i = entity.getBrightnessForRender(partialTicks);
if (entity.isBurning()) {

View File

@ -20,8 +20,8 @@ import net.minecraft.util.ResourceLocation;
* Minecraft 1.8.8 bytecode is (c) 2015 Mojang AB. "Do not distribute!"
* Mod Coder Pack v9.18 deobfuscation configs are (c) Copyright by the MCP Team
*
* EaglercraftX 1.8 patch files (c) 2022-2024 lax1dude, hoosiertransfer,
* ayunami2000. All Rights Reserved.
* EaglercraftX 1.8 patch files (c) 2022-2024 lax1dude, ayunami2000. All Rights
* Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND
@ -102,6 +102,8 @@ public class LayerSpiderEyes implements LayerRenderer<EntitySpider> {
this.spiderRenderer.bindTexture(SPIDER_EYES);
GlStateManager.enableBlend();
GlStateManager.disableAlpha();
GlStateManager.enablePolygonOffset();
GlStateManager.doPolygonOffset(-0.025f, 1.0f);
GlStateManager.blendFunc(GL_ONE, GL_ONE);
if (entityspider.isInvisible()) {
GlStateManager.depthMask(false);
@ -122,6 +124,7 @@ public class LayerSpiderEyes implements LayerRenderer<EntitySpider> {
this.spiderRenderer.func_177105_a(entityspider, f2);
GlStateManager.disableBlend();
GlStateManager.enableAlpha();
GlStateManager.disablePolygonOffset();
}
public boolean shouldCombineTextures() {

View File

@ -7,6 +7,7 @@ import com.google.common.collect.Maps;
import net.hoosiertransfer.CullingMod;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.lax1dude.eaglercraft.v1_8.opengl.OpenGlHelper;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.DynamicLightsStateManager;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.crash.CrashReport;
@ -164,6 +165,9 @@ public class TileEntityRendererDispatcher {
TileEntitySpecialRenderer tileentityspecialrenderer = this.getSpecialRenderer(tileEntityIn);
if (tileentityspecialrenderer != null) {
try {
if (DynamicLightsStateManager.isInDynamicLightsPass()) {
DynamicLightsStateManager.reportForwardRenderObjectPosition2((float) x, (float) y, (float) z);
}
tileentityspecialrenderer.renderTileEntityAt(tileEntityIn, x, y, z, partialTicks, destroyStage);
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Rendering Block Entity");

View File

@ -217,6 +217,7 @@ public class GameSettings {
public EaglerDeferredConfig deferredShaderConf = new EaglerDeferredConfig();
public boolean enableUpdateSvc = true;
public boolean enableFNAWSkins = false;
public boolean enableDynamicLights = false;
public int voiceListenRadius = 16;
public float voiceListenVolume = 0.5f;
@ -480,6 +481,11 @@ public class GameSettings {
this.enableVsync = !this.enableVsync;
}
if (parOptions == GameSettings.Options.EAGLER_DYNAMIC_LIGHTS) {
this.enableDynamicLights = !this.enableDynamicLights;
this.mc.renderGlobal.loadRenderers();
}
if (parOptions == GameSettings.Options.HUD_PLAYER) {
this.hudPlayer = !this.hudPlayer;
}
@ -551,6 +557,8 @@ public class GameSettings {
return this.enableFNAWSkins;
case EAGLER_VSYNC:
return this.enableVsync;
case EAGLER_DYNAMIC_LIGHTS:
return this.enableDynamicLights;
case INVERT_MOUSE:
return this.invertMouse;
case VIEW_BOBBING:
@ -1080,6 +1088,10 @@ public class GameSettings {
this.enableFNAWSkins = astring[1].equals("true");
}
if (astring[0].equals("enableDynamicLights")) {
this.enableDynamicLights = astring[1].equals("true");
}
deferredShaderConf.readOption(astring[0], astring[1]);
} catch (Exception var8) {
logger.warn("Skipping bad option: " + s);
@ -1204,6 +1216,7 @@ public class GameSettings {
printwriter.println("voiceSpeakVolume:" + this.voiceSpeakVolume);
printwriter.println("voicePTTKey:" + this.voicePTTKey);
printwriter.println("enableFNAWSkins:" + this.enableFNAWSkins);
printwriter.println("enableDynamicLights:" + this.enableDynamicLights);
for (KeyBinding keybinding : this.keyBindings) {
printwriter.println("key_" + keybinding.getKeyDescription() + ":" + keybinding.getKeyCode());
@ -1315,7 +1328,7 @@ public class GameSettings {
RENDER_SCALE("options.renderScale", true, false, 40.0F, 100.0F, 1.0F),
HIDE_PASSWORD("options.hidePassword", false, true),
ENABLE_SOUND("options.sound", false, true),
RENDER_DISTANCE("options.renderDistance", true, false, 1.0F, 16.0F, 1.0F),
RENDER_DISTANCE("options.renderDistance", true, false, 1.0F, 18.0F, 1.0F),
VIEW_BOBBING("options.viewBobbing", false, true), ANAGLYPH("options.anaglyph", false, true),
FRAMERATE_LIMIT("options.framerateLimit", true, false, 10.0F, 260.0F, 10.0F),
FBO_ENABLE("options.fboEnable", false, true), RENDER_CLOUDS("options.renderClouds", false, false),
@ -1347,7 +1360,7 @@ public class GameSettings {
FOG("options.fog", false, true), FXAA("options.fxaa", false, false),
FULLSCREEN("options.fullscreen", false, true),
FNAW_SKINS("options.skinCustomisation.enableFNAWSkins", false, true),
EAGLER_VSYNC("options.vsync", false, true);
EAGLER_VSYNC("options.vsync", false, true), EAGLER_DYNAMIC_LIGHTS("options.dynamicLights", false, true);
private final boolean enumFloat;
private final boolean enumBoolean;

View File

@ -143,6 +143,7 @@ public abstract class Enchantment {
2, EnumEnchantmentType.FISHING_ROD);
public static final Enchantment lure = new EnchantmentFishingSpeed(62, new ResourceLocation("lure"), 2,
EnumEnchantmentType.FISHING_ROD);
public static final Enchantment mending = new EnchantmentMending(70, new ResourceLocation("mending"), 2);
public final int effectId;
private final int weight;
public EnumEnchantmentType type;
@ -306,6 +307,10 @@ public abstract class Enchantment {
public void onUserHurt(EntityLivingBase user, Entity attacker, int level) {
}
public boolean isTreasureEnchantment() {
return false;
}
static {
ArrayList arraylist = Lists.newArrayList();

View File

@ -434,8 +434,9 @@ public class EnchantmentHelper {
* Adds a random enchantment to the specified item. Args:
* random, itemStack, enchantabilityLevel
*/
public static ItemStack addRandomEnchantment(EaglercraftRandom parRandom, ItemStack parItemStack, int parInt1) {
List<EnchantmentData> list = buildEnchantmentList(parRandom, parItemStack, parInt1);
public static ItemStack addRandomEnchantment(EaglercraftRandom parRandom, ItemStack parItemStack, int parInt1,
boolean allowTreasure) {
List<EnchantmentData> list = buildEnchantmentList(parRandom, parItemStack, parInt1, allowTreasure);
boolean flag = parItemStack.getItem() == Items.book;
if (flag) {
parItemStack.setItem(Items.enchanted_book);
@ -462,7 +463,7 @@ public class EnchantmentHelper {
* the total enchantability level.
*/
public static List<EnchantmentData> buildEnchantmentList(EaglercraftRandom randomIn, ItemStack itemStackIn,
int parInt1) {
int parInt1, boolean allowTreasure) {
Item item = itemStackIn.getItem();
int i = item.getItemEnchantability();
if (i <= 0) {
@ -478,7 +479,7 @@ public class EnchantmentHelper {
}
ArrayList<EnchantmentData> arraylist = null;
Map map = mapEnchantmentData(k, itemStackIn);
Map map = mapEnchantmentData(k, itemStackIn, allowTreasure);
if (map != null && !map.isEmpty()) {
EnchantmentData enchantmentdata = (EnchantmentData) WeightedRandom.getRandomItem(randomIn,
map.values());
@ -520,14 +521,16 @@ public class EnchantmentHelper {
}
}
public static Map<Integer, EnchantmentData> mapEnchantmentData(int parInt1, ItemStack parItemStack) {
public static Map<Integer, EnchantmentData> mapEnchantmentData(int parInt1, ItemStack parItemStack,
boolean allowTreasure) {
Item item = parItemStack.getItem();
HashMap hashmap = null;
boolean flag = parItemStack.getItem() == Items.book;
for (int j = 0; j < Enchantment.enchantmentsBookList.length; ++j) {
Enchantment enchantment = Enchantment.enchantmentsBookList[j];
if (enchantment != null && (enchantment.type.canEnchantItem(item) || flag)) {
if ((!enchantment.isTreasureEnchantment() || allowTreasure) && enchantment != null
&& (enchantment.type.canEnchantItem(item) || flag)) {
for (int i = enchantment.getMinLevel(); i <= enchantment.getMaxLevel(); ++i) {
if (parInt1 >= enchantment.getMinEnchantability(i)
&& parInt1 <= enchantment.getMaxEnchantability(i)) {

View File

@ -0,0 +1,37 @@
package net.minecraft.enchantment;
import net.minecraft.util.ResourceLocation;
public class EnchantmentMending extends Enchantment {
public EnchantmentMending(int parInt1, ResourceLocation parResourceLocation, int parInt2) {
super(parInt1, parResourceLocation, parInt2, EnumEnchantmentType.BREAKABLE);
this.setName("mending");
}
/**
* Returns the minimal value of enchantability needed on the enchantment level
* passed.
*/
public int getMinEnchantability(int enchantmentLevel) {
return enchantmentLevel * 25;
}
/**
* Returns the maximum value of enchantability nedded on the enchantment level
* passed.
*/
public int getMaxEnchantability(int enchantmentLevel) {
return this.getMinEnchantability(enchantmentLevel) + 50;
}
public boolean isTreasureEnchantment() {
return true;
}
/**
* Returns the maximum level that the enchantment can have.
*/
public int getMaxLevel() {
return 1;
}
}

View File

@ -7,6 +7,7 @@ import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID;
import net.lax1dude.eaglercraft.v1_8.HString;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.DynamicLightManager;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.DynamicLightsStateManager;
import java.util.concurrent.Callable;
@ -167,6 +168,8 @@ public abstract class Entity implements ICommandSender {
private long displayNameCachedAt;
private IChatComponent cachedDisplayName;
protected boolean glowing;
public void setTimeout() {
lastTime = System.currentTimeMillis() + 1000;
}
@ -352,6 +355,10 @@ public abstract class Entity implements ICommandSender {
* Called to update the entity's position/logic.
*/
public void onUpdate() {
if (!this.worldObj.isRemote) {
this.setFlag(6, this.isGlowing());
}
this.onEntityUpdate();
}
@ -1094,7 +1101,12 @@ public abstract class Entity implements ICommandSender {
public int getBrightnessForRender(float var1) {
BlockPos blockpos = new BlockPos(this.posX, this.posY + (double) this.getEyeHeight(), this.posZ);
return this.worldObj.isBlockLoaded(blockpos) ? this.worldObj.getCombinedLight(blockpos, 0) : 0;
int i = 0;
if (DynamicLightsStateManager.isDynamicLightsRender()) {
i += (int) (getEaglerDynamicLightsValueSimple(var1) * 15.0f);
}
return this.worldObj.isBlockLoaded(blockpos) ? this.worldObj.getCombinedLight(blockpos, -i)
: (i > 15 ? 240 : (i << 4));
}
/**
@ -1103,7 +1115,11 @@ public abstract class Entity implements ICommandSender {
*/
public float getBrightness(float var1) {
BlockPos blockpos = new BlockPos(this.posX, this.posY + (double) this.getEyeHeight(), this.posZ);
return this.worldObj.isBlockLoaded(blockpos) ? this.worldObj.getLightBrightness(blockpos) : 0.0F;
float f = this.worldObj.isBlockLoaded(blockpos) ? this.worldObj.getLightBrightness(blockpos) : 0.0F;
if (DynamicLightsStateManager.isDynamicLightsRender()) {
f = Math.min(f + getEaglerDynamicLightsValueSimple(var1), 1.0f);
}
return f;
}
/**
@ -1451,6 +1467,10 @@ public abstract class Entity implements ICommandSender {
tagCompund.setBoolean("Silent", this.isSilent());
}
if (this.glowing) {
tagCompund.setBoolean("Glowing", this.glowing);
}
this.writeEntityToNBT(tagCompund);
if (this.ridingEntity != null) {
NBTTagCompound nbttagcompound = new NBTTagCompound();
@ -1522,6 +1542,8 @@ public abstract class Entity implements ICommandSender {
this.setAlwaysRenderNameTag(tagCompund.getBoolean("CustomNameVisible"));
this.cmdResultStats.readStatsFromNBT(tagCompund);
this.setSilent(tagCompund.getBoolean("Silent"));
this.setGlowing(tagCompund.getBoolean("Glowing"));
this.readEntityFromNBT(tagCompund);
if (this.shouldSetPosAfterLoading()) {
this.setPosition(this.posX, this.posY, this.posZ);
@ -1942,6 +1964,18 @@ public abstract class Entity implements ICommandSender {
this.setFlag(3, flag);
}
public boolean isGlowing() {
return this.glowing || this.worldObj.isRemote && this.getFlag(6);
}
public void setGlowing(boolean glowingIn) {
this.glowing = glowingIn;
if (!this.worldObj.isRemote) {
this.setFlag(6, this.glowing);
}
}
public boolean isInvisible() {
return this.getFlag(5);
}
@ -2547,7 +2581,8 @@ public abstract class Entity implements ICommandSender {
double entityX2 = entityX - TileEntityRendererDispatcher.staticPlayerX;
double entityY2 = entityY - TileEntityRendererDispatcher.staticPlayerY;
double entityZ2 = entityZ - TileEntityRendererDispatcher.staticPlayerZ;
if (Math.sqrt(entityX2 * entityX2 + entityY2 * entityY2 + entityZ2 * entityZ2) < 48.0 * 48.0) {
if (entityX2 * entityX2 + entityY2 * entityY2
+ entityZ2 * entityZ2 < (isInFrustum ? (64.0 * 64.0) : (24.0 * 24.0))) {
renderDynamicLightsEaglerAt(entityX, entityY, entityZ, entityX2, entityY2, entityZ2, partialTicks,
isInFrustum);
}
@ -2555,14 +2590,41 @@ public abstract class Entity implements ICommandSender {
protected void renderDynamicLightsEaglerAt(double entityX, double entityY, double entityZ, double renderX,
double renderY, double renderZ, float partialTicks, boolean isInFrustum) {
if (this.isBurning()) {
float size = Math.max(width, height);
if (size < 1.0f && !isInFrustum) {
return;
}
if (this.isBurning()) {
float mag = 5.0f * size;
DynamicLightManager.renderDynamicLight("entity_" + entityId + "_fire", entityX, entityY + height * 0.75,
entityZ, mag, 0.487f * mag, 0.1411f * mag, false);
}
}
public void renderDynamicLightsEaglerSimple(float partialTicks) {
double entityX = prevPosX + (posX - prevPosX) * (double) partialTicks;
double entityY = prevPosY + (posY - prevPosY) * (double) partialTicks;
double entityZ = prevPosZ + (posZ - prevPosZ) * (double) partialTicks;
renderDynamicLightsEaglerSimpleAt(entityX, entityY, entityZ, partialTicks);
}
protected void renderDynamicLightsEaglerSimpleAt(double entityX, double entityY, double entityZ,
float partialTicks) {
float renderBrightness = this.getEaglerDynamicLightsValueSimple(partialTicks);
if (renderBrightness > 0.1f) {
DynamicLightsStateManager.renderDynamicLight("entity_" + entityId + "_lightmap", entityX,
entityY + height * 0.85, entityZ, renderBrightness * 13.0f);
}
}
protected float getEaglerDynamicLightsValueSimple(float partialTicks) {
float size = Math.max(width, height);
if (size < 1.0f) {
return 0.0f;
}
if (this.isBurning()) {
return size / 2.0f;
}
return 0.0f;
}
}

View File

@ -946,14 +946,14 @@ public abstract class EntityLiving extends EntityLivingBase {
float f = difficulty.getClampedAdditionalDifficulty();
if (this.getHeldItem() != null && this.rand.nextFloat() < 0.25F * f) {
EnchantmentHelper.addRandomEnchantment(this.rand, this.getHeldItem(),
(int) (5.0F + f * (float) this.rand.nextInt(18)));
(int) (5.0F + f * (float) this.rand.nextInt(18)), false);
}
for (int i = 0; i < 4; ++i) {
ItemStack itemstack = this.getCurrentArmor(i);
if (itemstack != null && this.rand.nextFloat() < 0.5F * f) {
EnchantmentHelper.addRandomEnchantment(this.rand, itemstack,
(int) (5.0F + f * (float) this.rand.nextInt(18)));
(int) (5.0F + f * (float) this.rand.nextInt(18)), false);
}
}

View File

@ -1517,7 +1517,11 @@ public abstract class EntityLivingBase extends Entity {
if (this.isCollidedHorizontally && this.isOnLadder()) {
this.motionY = 0.2D;
}
if (this.isPotionActive(Potion.levitation)) {
this.motionY += (0.05D
* (double) (this.getActivePotionEffect(Potion.levitation).getAmplifier() + 1)
- this.motionY) * 0.2D;
} else {
if (this.worldObj.isRemote
&& (!this.worldObj.isBlockLoaded(new BlockPos((int) this.posX, 0, (int) this.posZ))
|| !this.worldObj
@ -1532,6 +1536,7 @@ public abstract class EntityLivingBase extends Entity {
} else {
this.motionY -= 0.08D;
}
}
this.motionY *= 0.9800000190734863D;
this.motionX *= (double) f6;
@ -1663,6 +1668,14 @@ public abstract class EntityLivingBase extends Entity {
if (this.ticksExisted % 20 == 0) {
this.getCombatTracker().reset();
}
if (!this.glowing) {
boolean flag = this.isPotionActive(Potion.glowing);
if (this.getFlag(6) != flag) {
this.setFlag(6, flag);
}
}
}
this.onLivingUpdate();
@ -2178,4 +2191,17 @@ public abstract class EntityLivingBase extends Entity {
return true;
}
}
protected float getEaglerDynamicLightsValueSimple(float partialTicks) {
float f = super.getEaglerDynamicLightsValueSimple(partialTicks);
ItemStack itm = this.getHeldItem();
if (itm != null && itm.stackSize > 0) {
Item item = itm.getItem();
if (item != null) {
float f2 = item.getHeldItemBrightnessEagler();
f = Math.min(f + f2 * 0.5f, 1.0f) + f2 * 0.5f;
}
}
return f;
}
}

View File

@ -543,6 +543,10 @@ public class EntityWither extends EntityMob implements IBossDisplayData, IRanged
return 15728880;
}
protected float getEaglerDynamicLightsValueSimple(float partialTicks) {
return 1.0f;
}
public void fall(float var1, float var2) {
}

View File

@ -1,5 +1,6 @@
package net.minecraft.entity.item;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.DynamicLightManager;
import net.minecraft.entity.Entity;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
@ -226,6 +227,21 @@ public class EntityEnderEye extends Entity {
return 1.0F;
}
protected float getEaglerDynamicLightsValueSimple(float partialTicks) {
return 0.5f;
}
protected void renderDynamicLightsEaglerAt(double entityX, double entityY, double entityZ, double renderX,
double renderY, double renderZ, float partialTicks, boolean isInFrustum) {
super.renderDynamicLightsEaglerAt(entityX, entityY, entityZ, renderX, renderY, renderZ, partialTicks,
isInFrustum);
if (isInFrustum && renderX * renderX + renderY * renderY + renderZ * renderZ < 150.0) {
float mag = 0.5f;
DynamicLightManager.renderDynamicLight("entity_" + getEntityId() + "_endereye", entityX, entityY + 0.2,
entityZ, mag * 0.1990f, mag * 0.7750f, mag * 0.4130f, false);
}
}
public int getBrightnessForRender(float var1) {
return 15728880;
}

View File

@ -248,6 +248,10 @@ public class EntityFireworkRocket extends Entity {
return super.getBrightness(f);
}
protected float getEaglerDynamicLightsValueSimple(float partialTicks) {
return 1.0f;
}
public int getBrightnessForRender(float f) {
return super.getBrightnessForRender(f);
}

View File

@ -500,4 +500,17 @@ public class EntityItem extends Entity {
isInFrustum);
eaglerEmissiveFlag = Minecraft.getMinecraft().entityRenderer.renderItemEntityLight(this, 0.1f);
}
protected float getEaglerDynamicLightsValueSimple(float partialTicks) {
float f = super.getEaglerDynamicLightsValueSimple(partialTicks);
ItemStack itm = this.getEntityItem();
if (itm != null && itm.stackSize > 0) {
Item item = itm.getItem();
if (item != null) {
float f2 = item.getHeldItemBrightnessEagler() * 0.75f;
f = Math.min(f + f2 * 0.5f, 1.0f) + f2 * 0.5f;
}
}
return f;
}
}

View File

@ -6,6 +6,7 @@ import net.minecraft.entity.EntityHanging;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemMap;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@ -270,4 +271,17 @@ public class EntityItemFrame extends EntityHanging {
isInFrustum);
eaglerEmissiveFlag = Minecraft.getMinecraft().entityRenderer.renderItemEntityLight(this, 0.1f);
}
protected float getEaglerDynamicLightsValueSimple(float partialTicks) {
float f = super.getEaglerDynamicLightsValueSimple(partialTicks);
ItemStack itm = this.getDisplayedItem();
if (itm != null && itm.stackSize > 0) {
Item item = itm.getItem();
if (item != null) {
float f2 = item.getHeldItemBrightnessEagler() * 0.75f;
f = Math.min(f + f2 * 0.5f, 1.0f) + f2 * 0.5f;
}
}
return f;
}
}

View File

@ -246,4 +246,12 @@ public class EntityMinecartTNT extends EntityMinecart {
entityZ, dynamicLightMag, dynamicLightMag * 0.7792f, dynamicLightMag * 0.618f, false);
}
}
protected float getEaglerDynamicLightsValueSimple(float partialTicks) {
float f = super.getEaglerDynamicLightsValueSimple(partialTicks);
if (minecartTNTFuse > -1 && minecartTNTFuse / 5 % 2 == 0) {
f = Math.min(f + 0.75f, 1.25f);
}
return f;
}
}

View File

@ -160,4 +160,12 @@ public class EntityTNTPrimed extends Entity {
entityZ, dynamicLightMag, dynamicLightMag * 0.7792f, dynamicLightMag * 0.618f, false);
}
}
protected float getEaglerDynamicLightsValueSimple(float partialTicks) {
float f = super.getEaglerDynamicLightsValueSimple(partialTicks);
if (fuse / 5 % 2 == 0) {
f = Math.min(f + 0.75f, 1.25f);
}
return f;
}
}

View File

@ -2,8 +2,11 @@ package net.minecraft.entity.item;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.DynamicLightManager;
import net.minecraft.block.material.Material;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.BlockPos;
import net.minecraft.util.DamageSource;
@ -95,6 +98,10 @@ public class EntityXPOrb extends Entity {
return j | k << 16;
}
protected float getEaglerDynamicLightsValueSimple(float partialTicks) {
return 0.25f;
}
/**
* +
* Called to update the entity's position/logic.
@ -237,13 +244,31 @@ public class EntityXPOrb extends Entity {
this.worldObj.playSoundAtEntity(entityplayer, "random.orb", 0.1F,
0.5F * ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.8F));
entityplayer.onItemPickup(this, 1);
ItemStack itemstack = EnchantmentHelper.getEnchantedItem(Enchantment.mending, entityplayer);
if (itemstack != null && itemstack.isItemDamaged()) {
int i = Math.min(this.xpToDurability(this.xpValue), itemstack.getItemDamage());
this.xpValue -= this.durabilityToXp(i);
itemstack.setItemDamage(itemstack.getItemDamage() - i);
}
if (this.xpValue > 0) {
entityplayer.addExperience(this.xpValue);
}
this.setDead();
}
}
}
private int durabilityToXp(int durability) {
return durability / 2;
}
private int xpToDurability(int xp) {
return xp * 2;
}
/**
* +
* Returns the XP value of this XP orb.

View File

@ -118,6 +118,10 @@ public class EntityBlaze extends EntityMob {
return 1.0F;
}
protected float getEaglerDynamicLightsValueSimple(float partialTicks) {
return 1.0f;
}
/**
* +
* Called frequently so the entity can update its state every

View File

@ -331,4 +331,13 @@ public class EntityCreeper extends EntityMob {
DeferredStateManager.setEmissionConstant(1.0f);
}
}
protected float getEaglerDynamicLightsValueSimple(float partialTicks) {
float f = super.getEaglerDynamicLightsValueSimple(partialTicks);
float ff = getCreeperFlashIntensity(partialTicks);
if ((int) (ff * 10.0F) % 2 != 0) {
f = Math.min(f + 0.5f, 1.15f);
}
return f;
}
}

View File

@ -192,4 +192,8 @@ public class EntityMagmaCube extends EntitySlime {
protected boolean makesSoundOnLand() {
return true;
}
protected float getEaglerDynamicLightsValueSimple(float partialTicks) {
return 1.0f;
}
}

View File

@ -14,6 +14,7 @@ import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.pathfinding.PathNavigateGround;
import net.minecraft.potion.Potion;
import net.minecraft.util.BlockPos;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumParticleTypes;
@ -461,7 +462,8 @@ public class EntitySlime extends EntityLiving implements IMob {
public boolean shouldExecute() {
return this.slime.getAttackTarget() == null
&& (this.slime.onGround || this.slime.isInWater() || this.slime.isInLava());
&& (this.slime.onGround || this.slime.isInWater() || this.slime.isInLava()
|| this.slime.isPotionActive(Potion.levitation));
}
public void updateTask() {

View File

@ -7,6 +7,7 @@ import net.minecraft.init.Items;
import net.minecraft.item.EnumDyeColor;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
@ -200,9 +201,16 @@ public class EntitySquid extends EntityWaterMob {
this.tentacleAngle = MathHelper.abs(MathHelper.sin(this.squidRotation)) * 3.1415927F * 0.25F;
if (!this.worldObj.isRemote) {
this.motionX = 0.0D;
this.motionY -= 0.08D;
this.motionY *= 0.9800000190734863D;
this.motionZ = 0.0D;
if (this.isPotionActive(Potion.levitation)) {
this.motionY += 0.05D
* (double) (this.getActivePotionEffect(Potion.levitation).getAmplifier() + 1)
- this.motionY;
} else {
this.motionY -= 0.08D;
}
this.motionY *= 0.9800000190734863D;
}
this.squidPitch = (float) ((double) this.squidPitch + (double) (-90.0F - this.squidPitch) * 0.02D);

View File

@ -1064,6 +1064,11 @@ public class EntityVillager extends EntityAgeable implements IMerchant, INpc {
int i = MathHelper.getRandomIntegerInRange(random, enchantment.getMinLevel(), enchantment.getMaxLevel());
ItemStack itemstack = Items.enchanted_book.getEnchantedItemStack(new EnchantmentData(enchantment, i));
int j = 2 + random.nextInt(5 + i * 10) + 3 * i;
if (enchantment.isTreasureEnchantment()) {
j *= 2;
}
if (j > 64) {
j = 64;
}
@ -1090,7 +1095,7 @@ public class EntityVillager extends EntityAgeable implements IMerchant, INpc {
ItemStack itemstack = new ItemStack(Items.emerald, i, 0);
ItemStack itemstack1 = new ItemStack(this.field_179407_a.getItem(), 1, this.field_179407_a.getMetadata());
itemstack1 = EnchantmentHelper.addRandomEnchantment(random, itemstack1, 5 + random.nextInt(15));
itemstack1 = EnchantmentHelper.addRandomEnchantment(random, itemstack1, 5 + random.nextInt(15), false);
merchantrecipelist.add(new MerchantRecipe(itemstack, itemstack1));
}
}

View File

@ -348,6 +348,10 @@ public abstract class EntityFireball extends Entity {
return 1.0F;
}
protected float getEaglerDynamicLightsValueSimple(float partialTicks) {
return 1.0f;
}
public int getBrightnessForRender(float var1) {
return 15728880;
}

View File

@ -285,7 +285,7 @@ public class ContainerEnchantment extends Container {
private List<EnchantmentData> func_178148_a(ItemStack stack, int parInt1, int parInt2) {
this.rand.setSeed((long) (this.xpSeed + parInt1));
List list = EnchantmentHelper.buildEnchantmentList(this.rand, stack, parInt2);
List list = EnchantmentHelper.buildEnchantmentList(this.rand, stack, parInt2, false);
if (stack.getItem() == Items.book && list != null && list.size() > 1) {
list.remove(this.rand.nextInt(list.size()));
}

View File

@ -1190,4 +1190,8 @@ public class Item {
: (this == IRON ? Items.iron_ingot : (this == EMERALD ? Items.diamond : null))));
}
}
public float getHeldItemBrightnessEagler() {
return 0.0f;
}
}

View File

@ -182,4 +182,8 @@ public class ItemBlock extends Item {
public Block getBlock() {
return this.block;
}
public float getHeldItemBrightnessEagler() {
return this.block.getLightValue() * 0.06667f;
}
}

View File

@ -146,7 +146,7 @@ public class ItemEnchantedBook extends Item {
public WeightedRandomChestContent getRandom(EaglercraftRandom rand, int minChance, int maxChance, int weight) {
ItemStack itemstack = new ItemStack(Items.book, 1, 0);
EnchantmentHelper.addRandomEnchantment(rand, itemstack, 30);
EnchantmentHelper.addRandomEnchantment(rand, itemstack, 30, false);
return new WeightedRandomChestContent(itemstack, minChance, maxChance, weight);
}
}

View File

@ -1,5 +1,6 @@
package net.minecraft.item;
import net.hoosiertransfer.EaglerItems;
import net.minecraft.block.Block;
import net.minecraft.block.BlockDirt;
import net.minecraft.block.material.Material;
@ -63,7 +64,7 @@ public class ItemHoe extends Item {
Block block = iblockstate.getBlock();
if (enumfacing != EnumFacing.DOWN
&& world.getBlockState(blockpos.up()).getBlock().getMaterial() == Material.air) {
if (block == Blocks.grass) {
if (block == Blocks.grass || block == EaglerItems.getEaglerBlock("grass_path")) {
return this.useHoe(itemstack, entityplayer, world, blockpos, Blocks.farmland.getDefaultState());
}

View File

@ -4,8 +4,17 @@ import java.util.Set;
import com.google.common.collect.Sets;
import net.hoosiertransfer.EaglerItems;
import net.minecraft.block.Block;
import net.minecraft.block.BlockDirt;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.audio.SoundCategory;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
/**
* +
@ -41,7 +50,8 @@ public class ItemSpade extends ItemTool {
public static void bootstrap() {
EFFECTIVE_ON = Sets.newHashSet(new Block[] { Blocks.clay, Blocks.dirt, Blocks.farmland, Blocks.grass,
Blocks.gravel, Blocks.mycelium, Blocks.sand, Blocks.snow, Blocks.snow_layer, Blocks.soul_sand });
Blocks.gravel, Blocks.mycelium, Blocks.sand, Blocks.snow, Blocks.snow_layer, Blocks.soul_sand,
EaglerItems.getEaglerBlock("grass_path") });
}
public ItemSpade(Item.ToolMaterial material) {
@ -55,4 +65,31 @@ public class ItemSpade extends ItemTool {
public boolean canHarvestBlock(Block block) {
return block == Blocks.snow_layer ? true : block == Blocks.snow;
}
public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing facing,
float hitX, float hitY, float hitZ) {
if (!playerIn.canPlayerEdit(pos.offset(facing), facing, stack)) {
return false;
} else {
IBlockState iblockstate = worldIn.getBlockState(pos);
Block block = iblockstate.getBlock();
if (facing != EnumFacing.DOWN && worldIn.getBlockState(pos.up()).getBlock().getMaterial() == Material.air
&& block == Blocks.grass) {
IBlockState iblockstate1 = EaglerItems.getEaglerBlock("grass_path").getDefaultState();
// worldIn.playSound(playerIn, pos, "item.shovel.flatten", SoundCategory.BLOCKS,
// 1.0F,
// 1.0F);
if (!worldIn.isRemote) {
worldIn.setBlockState(pos, iblockstate1, 11);
stack.damageItem(1, playerIn);
}
return true;
} else {
return false;
}
}
}
}

View File

@ -161,6 +161,18 @@ public class Potion {
*/
public static final Potion saturation = (new PotionHealth(23, new ResourceLocation("saturation"), false, 16262179))
.setPotionName("potion.saturation");
public static final Potion glowing = (new Potion(24, new ResourceLocation("glowing"), false, 9740385))
.setPotionName("potion.glowing").setIconIndex(4, 2);
public static final Potion levitation = (new Potion(25, new ResourceLocation("levitation"), true, 13565951))
.setPotionName("potion.levitation").setIconIndex(3, 2);
public static final Potion luck = (new Potion(26, new ResourceLocation("luck"), false, 3381504))
.setPotionName("potion.luck").setIconIndex(5, 2);
public static final Potion unluck = (new Potion(27, new ResourceLocation("unluck"), true, 12624973))
.setPotionName("potion.unluck").setIconIndex(6, 2);
public static final Potion field_180153_z = null;
public static final Potion field_180147_A = null;
public static final Potion field_180148_B = null;

View File

@ -184,6 +184,11 @@ public abstract class MinecraftServer implements Runnable, ICommandSender, IThre
worldsettings = new WorldSettings(worldinfo);
}
if (worldinfo.isOldEaglercraftRandom()) {
LogManager.getLogger("EaglerMinecraftServer")
.info("Detected a pre-u34 world, using old EaglercraftRandom implementation for world generation");
}
for (int j = 0; j < this.worldServers.length; ++j) {
byte b0 = 0;
if (j == 1) {

View File

@ -120,7 +120,7 @@ public abstract class ServerConfigurationManager {
public ServerConfigurationManager(MinecraftServer server) {
this.playerStatFiles = Maps.newHashMap();
this.mcServer = server;
this.maxPlayers = 8;
this.maxPlayers = 100;
}
public void initializeConnectionToPlayer(IntegratedServerPlayerNetworkManager netManager, EntityPlayerMP playerIn) {
@ -382,11 +382,9 @@ public abstract class ServerConfigurationManager {
* server. Returns null on success, or an error message
*/
public String allowUserToConnect(GameProfile gameprofile) {
return this.playerEntityList.size() >= this.maxPlayers && !this.func_183023_f(gameprofile)
? "The server is full!"
: (doesPlayerAlreadyExist(gameprofile)
return doesPlayerAlreadyExist(gameprofile)
? "\"" + gameprofile.getName() + "\" is already playing on this world!"
: null);
: null;
}
private boolean doesPlayerAlreadyExist(GameProfile gameprofile) {

View File

@ -61,7 +61,7 @@ public class WeightedRandomFishable extends WeightedRandom.Item {
}
if (this.enchantable) {
EnchantmentHelper.addRandomEnchantment(random, itemstack, 30);
EnchantmentHelper.addRandomEnchantment(random, itemstack, 30, false);
}
return itemstack;

View File

@ -61,7 +61,7 @@ public class Teleporter {
public Teleporter(WorldServer worldIn) {
this.worldServerInstance = worldIn;
this.random = new EaglercraftRandom(worldIn.getSeed());
this.random = new EaglercraftRandom(worldIn.getSeed(), !worldIn.getWorldInfo().isOldEaglercraftRandom());
}
public void placeInPortal(Entity entityIn, float rotationYaw) {

Some files were not shown because too many files have changed in this diff Show More