minecraft-renderer 0.1.85 → 0.1.87

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "minecraft-renderer",
3
- "version": "0.1.85",
3
+ "version": "0.1.87",
4
4
  "description": "The most Modular Minecraft world renderer with Three.js WebGL backend",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -147,27 +147,27 @@ export class WalkingGeneralSwing extends PlayerAnimation {
147
147
  }
148
148
 
149
149
  if (this.isRunning) {
150
- player.skin.leftLeg.rotation.x = Math.cos(t + Math.PI) * 1.3
151
- player.skin.rightLeg.rotation.x = Math.cos(t) * 1.3
150
+ player.skin.leftLeg.rotation.x += Math.cos(t + Math.PI) * 1.3 * this._moveBlend
151
+ player.skin.rightLeg.rotation.x += Math.cos(t) * 1.3 * this._moveBlend
152
152
  } else {
153
- player.skin.leftLeg.rotation.x = Math.sin(t) * 0.5
154
- player.skin.rightLeg.rotation.x = Math.sin(t + Math.PI) * 0.5
153
+ player.skin.leftLeg.rotation.x += Math.sin(t) * 0.5 * this._moveBlend
154
+ player.skin.rightLeg.rotation.x += Math.sin(t + Math.PI) * 0.5 * this._moveBlend
155
155
  }
156
156
 
157
157
  if (this.isRunning) {
158
- player.skin.leftArm.rotation.x = Math.cos(t) * 1.5
159
- player.skin.rightArm.rotation.x = Math.cos(t + Math.PI) * 1.5
158
+ player.skin.leftArm.rotation.x += Math.cos(t) * 1.5 * this._moveBlend
159
+ player.skin.rightArm.rotation.x += Math.cos(t + Math.PI) * 1.5 * this._moveBlend
160
160
 
161
161
  const basicArmRotationZ = Math.PI * 0.1
162
- player.skin.leftArm.rotation.z = Math.cos(t) * 0.1 + basicArmRotationZ
163
- player.skin.rightArm.rotation.z = Math.cos(t + Math.PI) * 0.1 - basicArmRotationZ
162
+ player.skin.leftArm.rotation.z += (Math.cos(t) * 0.1 + basicArmRotationZ) * this._moveBlend
163
+ player.skin.rightArm.rotation.z += (Math.cos(t + Math.PI) * 0.1 - basicArmRotationZ) * this._moveBlend
164
164
  } else {
165
- player.skin.leftArm.rotation.x = Math.sin(t + Math.PI) * 0.5
166
- player.skin.rightArm.rotation.x = Math.sin(t) * 0.5
165
+ player.skin.leftArm.rotation.x += Math.sin(t + Math.PI) * 0.5 * this._moveBlend
166
+ player.skin.rightArm.rotation.x += Math.sin(t) * 0.5 * this._moveBlend
167
167
 
168
168
  const basicArmRotationZ = Math.PI * 0.02
169
- player.skin.leftArm.rotation.z = Math.cos(t) * 0.03 + basicArmRotationZ
170
- player.skin.rightArm.rotation.z = Math.cos(t + Math.PI) * 0.03 - basicArmRotationZ
169
+ player.skin.leftArm.rotation.z += (Math.cos(t) * 0.03 + basicArmRotationZ) * this._moveBlend
170
+ player.skin.rightArm.rotation.z += (Math.cos(t + Math.PI) * 0.03 - basicArmRotationZ) * this._moveBlend
171
171
  }
172
172
 
173
173
  if (this._swingTime !== null) {
@@ -178,15 +178,15 @@ export class WalkingGeneralSwing extends PlayerAnimation {
178
178
  }
179
179
 
180
180
  if (this.isRunning) {
181
- player.rotation.z = Math.cos(t + Math.PI) * 0.01
181
+ player.rotation.z = Math.cos(t + Math.PI) * 0.01 * this._moveBlend
182
182
  }
183
183
 
184
184
  if (this.isRunning) {
185
185
  const basicCapeRotationX = Math.PI * 0.3
186
- player.cape.rotation.x = Math.sin(t * 2) * 0.1 + basicCapeRotationX
186
+ player.cape.rotation.x += (Math.sin(t * 2) * 0.1 + basicCapeRotationX) * this._moveBlend
187
187
  } else {
188
188
  const basicCapeRotationX = Math.PI * 0.06
189
- player.cape.rotation.x = Math.sin(t / 1.5) * 0.06 + basicCapeRotationX
189
+ player.cape.rotation.x += (Math.sin(t / 1.5) * 0.06 + basicCapeRotationX) * this._moveBlend
190
190
  }
191
191
 
192
192
  if (reset) {
@@ -9,7 +9,7 @@ const threeVersion = parseInt(THREE.REVISION.replaceAll(/\D+/g, ''), 10)
9
9
  class StarfieldMaterial extends THREE.ShaderMaterial {
10
10
  constructor() {
11
11
  super({
12
- uniforms: { time: { value: 0 }, fade: { value: 1 } },
12
+ uniforms: { time: { value: 0 } },
13
13
  vertexShader: /* glsl */ `
14
14
  uniform float time;
15
15
  attribute float size;
@@ -23,13 +23,9 @@ class StarfieldMaterial extends THREE.ShaderMaterial {
23
23
  }`,
24
24
  fragmentShader: /* glsl */ `
25
25
  uniform sampler2D pointTexture;
26
- uniform float fade;
27
26
  varying vec3 vColor;
28
27
  void main() {
29
- // fade scales star brightness (0 = invisible). With additive blending this is
30
- // the only way to dim stars — scene fog never reaches this shader. Driven by the
31
- // rain state so stars disappear in rain like in vanilla.
32
- gl_FragColor = vec4(vColor * fade, 1.0);
28
+ gl_FragColor = vec4(vColor, 1.0);
33
29
 
34
30
  #include <tonemapping_fragment>
35
31
  #include <${threeVersion >= 154 ? 'colorspace_fragment' : 'encodings_fragment'}>
@@ -43,8 +39,6 @@ export class StarfieldModule implements RendererModuleController {
43
39
  private timer = new THREE.Timer()
44
40
  private enabled = false
45
41
  private currentTime?: number
46
- /** Current star brightness multiplier; lerps toward 0 while raining, 1 otherwise. */
47
- private fade = 1
48
42
 
49
43
  constructor(private readonly worldRenderer: WorldRendererThree) {}
50
44
 
@@ -76,20 +70,13 @@ export class StarfieldModule implements RendererModuleController {
76
70
  return this.currentTime > nightTime && this.currentTime < morningStart
77
71
  }
78
72
 
79
- render?: (deltaTime: number) => void = deltaTime => {
73
+ render?: (deltaTime: number) => void = () => {
80
74
  if (!this.points) return
81
75
  this.points.position.set(0, 0, 0)
82
76
 
83
77
  const material = this.points.material as StarfieldMaterial
84
78
  this.timer.update(performance.now())
85
79
  material.uniforms.time.value = this.timer.getElapsed() * 0.2
86
-
87
- // Fade stars out while raining (vanilla scales star brightness by 1 - rainLevel).
88
- // isRaining is a boolean here, so ease toward the target instead of snapping.
89
- const target = this.worldRenderer.worldRendererConfig.isRaining ? 0 : 1
90
- const t = Math.min(1, deltaTime * 2)
91
- this.fade += (target - this.fade) * t
92
- material.uniforms.fade.value = this.fade
93
80
  }
94
81
 
95
82
  /**