Skip to content

Commit d9ab2ca

Browse files
committed
Second Initial Commit
Hooray!
1 parent 91e287c commit d9ab2ca

6 files changed

Lines changed: 129 additions & 0 deletions

File tree

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"parent": "minecraft:item/handheld",
3+
"textures": {
4+
"layer0": "minecraft:item/netherite_sword"
5+
},
6+
"display": {
7+
"thirdperson_righthand": {
8+
"rotation": [ 0, -90, 55 ],
9+
"translation": [ 0, 12.0, -1 ],
10+
"scale": [ 2, 2, 0.85 ]
11+
},
12+
"firstperson_righthand": {
13+
"rotation": [ 0, -90, 25 ],
14+
"translation": [ 1.13, 4.2, 0.13 ],
15+
"scale": [ 1.5, 1.5, 0.68 ]
16+
},
17+
"thirdperson_lefthand": {
18+
"rotation": [ 0, 90, -55 ],
19+
"translation": [ 0, 12.0, -1 ],
20+
"scale": [ 2, 2, 0.85 ]
21+
},
22+
"firstperson_lefthand": {
23+
"rotation": [ 0, 90, -25 ],
24+
"translation": [ 1.13, 4.2, 0.13 ],
25+
"scale": [ 1.5, 1.5, 0.68 ]
26+
},
27+
"gui": {
28+
"rotation": [ 0, 0, 0 ],
29+
"translation": [ -8, 8, 0 ],
30+
"scale": [ 2, 2, 2 ]
31+
},
32+
"ground": {
33+
"rotation": [ 0, 0, 0 ],
34+
"translation": [ 0, 8, 0],
35+
"scale":[ 1.5, 1.5, 1 ]
36+
}
37+
}
38+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#version 150
2+
3+
#moj_import <fog.glsl>
4+
5+
uniform sampler2D Sampler0;
6+
7+
uniform vec4 ColorModulator;
8+
uniform float FogStart;
9+
uniform float FogEnd;
10+
uniform vec4 FogColor;
11+
12+
in float zpos;
13+
in float vertexDistance;
14+
in vec4 vertexColor;
15+
in vec2 texCoord0;
16+
in vec2 texCoord1;
17+
in vec4 normal;
18+
19+
out vec4 fragColor;
20+
21+
bool check_alpha(float textureAlpha, float targetAlpha) {
22+
23+
float targetLess = targetAlpha - 0.01;
24+
float targetMore = targetAlpha + 0.01;
25+
return (textureAlpha > targetLess && textureAlpha < targetMore);
26+
27+
}
28+
29+
void main() {
30+
vec4 color = texture(Sampler0, texCoord0) * vertexColor * ColorModulator;
31+
float alpha = textureLod(Sampler0, texCoord0, 0.0).a * 255.0; // Take the alpha from the texture's LOD so it doesn't have any issues (this has hurt me before with VDE)
32+
if (color.a < 0.1) discard; // This is vanilla, I just shorten it because big
33+
34+
if (check_alpha(alpha, 253.0) && vertexDistance < 800) discard; // If it's inside the normal world space, it's always going to want to be the hand texture.
35+
36+
if (vertexDistance >= 800) { // If it's in a GUI, figure out if it's the paper doll or an inventory slot.
37+
38+
if (check_alpha(alpha, 254.0) && zpos < 2.0) discard; // If it's far back enough on the z-axis, it's usually in the paper doll's hand. Max set to 2 because nothing should be bigger than that.
39+
else if (check_alpha(alpha, 253.0) && zpos >= 2.0) discard; // If it's close enough on the z-axis, it's usually in an inventory slot.
40+
41+
}
42+
43+
fragColor = linear_fog(color, vertexDistance, FogStart, FogEnd, FogColor);
44+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#version 150
2+
3+
#moj_import <light.glsl>
4+
#moj_import <fog.glsl>
5+
6+
in vec3 Position;
7+
in vec4 Color;
8+
in vec2 UV0;
9+
in vec2 UV1;
10+
in ivec2 UV2;
11+
in vec3 Normal;
12+
13+
uniform sampler2D Sampler2;
14+
15+
uniform mat4 ModelViewMat;
16+
uniform mat4 ProjMat;
17+
uniform mat3 IViewRotMat;
18+
19+
uniform vec3 Light0_Direction;
20+
uniform vec3 Light1_Direction;
21+
22+
out float zpos;
23+
out float vertexDistance;
24+
out vec4 vertexColor;
25+
out vec2 texCoord0;
26+
out vec2 texCoord1;
27+
out vec2 texCoord2;
28+
out vec4 normal;
29+
30+
void main() {
31+
zpos = Position.z;
32+
gl_Position = ProjMat * ModelViewMat * vec4(Position, 1.0);
33+
34+
vertexDistance = cylindrical_distance(ModelViewMat, IViewRotMat * Position);
35+
vec4 lightColor = vertexDistance <= 800 ? minecraft_sample_lightmap(Sampler2, UV2) : texelFetch(Sampler2, UV2 / 16, 0); // Added this simply for better compat with light-altering packs.
36+
vertexColor = minecraft_mix_light(Light0_Direction, Light1_Direction, Normal, Color) * lightColor;
37+
texCoord0 = UV0;
38+
texCoord1 = UV1;
39+
texCoord2 = UV2;
40+
normal = ProjMat * ModelViewMat * vec4(Normal, 0.0);
41+
}
954 Bytes
Loading

pack.mcmeta

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"pack": {
3+
"pack_format": 8,
4+
"description": "Adds a way to have different items in the hand and the GUI."
5+
}
6+
}

pack.png

16.1 KB
Loading

0 commit comments

Comments
 (0)