48
48
* Represents the LambDynamicLights mod.
49
49
*
50
50
* @author LambdAurora
51
- * @version 1.3.0
51
+ * @version 1.3.1
52
52
* @since 1.0.0
53
53
*/
54
54
public class LambDynLights implements ClientModInitializer
@@ -129,7 +129,7 @@ public void updateAll(@NotNull WorldRenderer renderer)
129
129
*/
130
130
public int getLightmapWithDynamicLight (@ NotNull BlockPos pos , int lightmap )
131
131
{
132
- return this .getLightmapWithDynamicLight (this .getDynamicLuminance (pos ), lightmap );
132
+ return this .getLightmapWithDynamicLight (this .getDynamicLightLevel (pos ), lightmap );
133
133
}
134
134
135
135
/**
@@ -141,29 +141,29 @@ public int getLightmapWithDynamicLight(@NotNull BlockPos pos, int lightmap)
141
141
*/
142
142
public int getLightmapWithDynamicLight (@ NotNull Entity entity , int lightmap )
143
143
{
144
- int posLuminance = (int ) this .getDynamicLuminance (entity .getBlockPos ());
144
+ int posLightLevel = (int ) this .getDynamicLightLevel (entity .getBlockPos ());
145
145
int entityLuminance = ((DynamicLightSource ) entity ).getLuminance ();
146
146
147
- return this .getLightmapWithDynamicLight (Math .max (posLuminance , entityLuminance ), lightmap );
147
+ return this .getLightmapWithDynamicLight (Math .max (posLightLevel , entityLuminance ), lightmap );
148
148
}
149
149
150
150
/**
151
151
* Returns the lightmap with combined light levels.
152
152
*
153
- * @param dynamicLuminance The dynamic light level.
154
- * @param lightmap The vanilla lightmap.
153
+ * @param dynamicLightLevel The dynamic light level.
154
+ * @param lightmap The vanilla lightmap.
155
155
* @return The modified lightmap.
156
156
*/
157
- public int getLightmapWithDynamicLight (double dynamicLuminance , int lightmap )
157
+ public int getLightmapWithDynamicLight (double dynamicLightLevel , int lightmap )
158
158
{
159
- if (dynamicLuminance > 0 ) {
159
+ if (dynamicLightLevel > 0 ) {
160
160
// lightmap is (skyLevel << 20 | blockLevel << 4)
161
161
162
162
// Get vanilla block light level.
163
163
int blockLevel = LightmapTextureManager .getBlockLightCoordinates (lightmap );
164
- if (dynamicLuminance > blockLevel ) {
164
+ if (dynamicLightLevel > blockLevel ) {
165
165
// Equivalent to a << 4 bitshift with a little quirk: this one ensure more precision (more decimals are saved).
166
- int luminance = (int ) (dynamicLuminance * 16.0 );
166
+ int luminance = (int ) (dynamicLightLevel * 16.0 );
167
167
lightmap &= 0xfff00000 ;
168
168
lightmap |= luminance & 0x000fffff ;
169
169
}
@@ -178,11 +178,11 @@ public int getLightmapWithDynamicLight(double dynamicLuminance, int lightmap)
178
178
* @param pos The position.
179
179
* @return The dynamic light level at the spec
180
180
*/
181
- public double getDynamicLuminance (@ NotNull BlockPos pos )
181
+ public double getDynamicLightLevel (@ NotNull BlockPos pos )
182
182
{
183
183
double result = 0 ;
184
184
for (DynamicLightSource lightSource : this .dynamicLightSources ) {
185
- result = maxDynamicLuminance (pos , lightSource , result );
185
+ result = maxDynamicLightLevel (pos , lightSource , result );
186
186
}
187
187
188
188
return MathHelper .clamp (result , 0 , 15 );
@@ -191,12 +191,12 @@ public double getDynamicLuminance(@NotNull BlockPos pos)
191
191
/**
192
192
* Returns the dynamic light level generated by the light source at the specified position.
193
193
*
194
- * @param pos The position.
195
- * @param lightSource The light source.
196
- * @param currentLuminance The current surrounding dynamic luminance .
194
+ * @param pos The position.
195
+ * @param lightSource The light source.
196
+ * @param currentLightLevel The current surrounding dynamic light level .
197
197
* @return The dynamic light level.
198
198
*/
199
- public static double maxDynamicLuminance (@ NotNull BlockPos pos , @ NotNull DynamicLightSource lightSource , double currentLuminance )
199
+ public static double maxDynamicLightLevel (@ NotNull BlockPos pos , @ NotNull DynamicLightSource lightSource , double currentLightLevel )
200
200
{
201
201
int luminance = lightSource .getLuminance ();
202
202
if (luminance > 0 ) {
@@ -211,12 +211,12 @@ public static double maxDynamicLuminance(@NotNull BlockPos pos, @NotNull Dynamic
211
211
if (distance <= MAX_RADIUS ) {
212
212
double multiplier = 1.0 - distance / MAX_RADIUS ;
213
213
double lightLevel = multiplier * (double ) luminance ;
214
- if (lightLevel > currentLuminance ) {
215
- currentLuminance = lightLevel ;
214
+ if (lightLevel > currentLightLevel ) {
215
+ currentLightLevel = lightLevel ;
216
216
}
217
217
}
218
218
}
219
- return currentLuminance ;
219
+ return currentLightLevel ;
220
220
}
221
221
222
222
/**
0 commit comments