Skip to content

Commit

Permalink
Clean up stuff.
Browse files Browse the repository at this point in the history
  • Loading branch information
LambdAurora committed Aug 17, 2023
1 parent 4d49a19 commit f0f67f8
Show file tree
Hide file tree
Showing 8 changed files with 160 additions and 148 deletions.
192 changes: 98 additions & 94 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,154 +2,158 @@

## 1.0.0

- Initial release.
- Added dynamic lighting to the game.
- Initial release.
- Added dynamic lighting to the game.

## 1.1.0

- Added item frame dynamic lighting.
- Added API.
- Added more options.
- Added entities dynamic lighting toggle.
- Added block entities dynamic lighting toggle.
- Added block entity dynamic lighting.
- Allow dynamic lighting for block entities without block states.
- Should not be used in cases where block states can be used.
- Added compatibility with [Lil Tater Reloaded](https://github.com/Yoghurt4C/LilTaterReloaded).
- Lil taters will light up the area if they hold an item emitting light.
- Fixed light not moving when light source was moving too slow.
- Fixed lighting errors with Sodium.
- Added item frame dynamic lighting.
- Added API.
- Added more options.
- Added entities dynamic lighting toggle.
- Added block entities dynamic lighting toggle.
- Added block entity dynamic lighting.
- Allow dynamic lighting for block entities without block states.
- Should not be used in cases where block states can be used.
- Added compatibility with [Lil Tater Reloaded](https://github.com/Yoghurt4C/LilTaterReloaded).
- Lil taters will light up the area if they hold an item emitting light.
- Fixed light not moving when light source was moving too slow.
- Fixed lighting errors with Sodium.

## 1.2.0

- Added water-sensitive check for items and light sources.
- Added data item tag `#lambdynlights:water_sensitive` which lists every item which can't light up in the water.
- Added an option to enable/disable the feature
- Updated [SpruceUI] to 1.5.6 to fix latest snapshots issues.
- Added "early/WIP" compatibility with [Canvas Renderer].
- Added a warning message about performance issues.
- Fixed a crash with [Sodium] rc7 with smooth lighting set to HIGH.
- Added water-sensitive check for items and light sources.
- Added data item tag `#lambdynlights:water_sensitive` which lists every item which can't light up in the water.
- Added an option to enable/disable the feature
- Updated [SpruceUI] to 1.5.6 to fix latest snapshots issues.
- Added "early/WIP" compatibility with [Canvas Renderer].
- Added a warning message about performance issues.
- Fixed a crash with [Sodium] rc7 with smooth lighting set to HIGH.

### 1.2.1

- Added TNT dynamic lighting.
- Added lighting options for TNT and Creepers.
- Added luminance value to Fire charge item.
- Updated [SpruceUI] to 1.5.8
- Fixed player dynamic lighting not getting tracked when changing dimensions.
- Added TNT dynamic lighting.
- Added lighting options for TNT and Creepers.
- Added luminance value to Fire charge item.
- Updated [SpruceUI] to 1.5.8
- Fixed player dynamic lighting not getting tracked when changing dimensions.

### 1.2.2

- Changed video options dynamic lighting button to redirect to LambDynamicLights settings.
- Fixed random crash.
- Changed video options dynamic lighting button to redirect to LambDynamicLights settings.
- Fixed random crash.

## 1.3.0

- Added Simplified Chinese translations.
- Added German translations.
- Added Mexican Spanish translations ([#13](https://github.com/LambdAurora/LambDynamicLights/pull/13)).
- Added Polish translations ([#15](https://github.com/LambdAurora/LambDynamicLights/pull/15)).
- Added Russian translations ([#9](https://github.com/LambdAurora/LambDynamicLights/pull/9)).
- Added spectral arrow as item emitting light ([#17](https://github.com/LambdAurora/LambDynamicLights/pull/17)).
- Added dynamic lighting on glowing entities ([#17](https://github.com/LambdAurora/LambDynamicLights/pull/17)).
- Updated to Minecraft 1.16.2
- Updated [SpruceUI] to 1.6.2.
- Fixed dynamic lighting update issues at chunk borders ([#12](https://github.com/LambdAurora/LambDynamicLights/issues/12)).
- Fixed water-sensitive items lighting up in water on dedicated servers. ([#3](https://github.com/LambdAurora/LambDynamicLights/issues/3))
- Added new JSON API to add item luminance and water-sensitivity through resource packs.
- Added `DynamicLightHandler#isWaterSensitive` to make some entities water-sensitive like the blaze.
- Fixed incompatibility with future [Sodium] versions. ([#6](https://github.com/LambdAurora/LambDynamicLights/issues/6))
- Added Simplified Chinese translations.
- Added German translations.
- Added Mexican Spanish translations ([#13](https://github.com/LambdAurora/LambDynamicLights/pull/13)).
- Added Polish translations ([#15](https://github.com/LambdAurora/LambDynamicLights/pull/15)).
- Added Russian translations ([#9](https://github.com/LambdAurora/LambDynamicLights/pull/9)).
- Added spectral arrow as item emitting light ([#17](https://github.com/LambdAurora/LambDynamicLights/pull/17)).
- Added dynamic lighting on glowing entities ([#17](https://github.com/LambdAurora/LambDynamicLights/pull/17)).
- Updated to Minecraft 1.16.2
- Updated [SpruceUI] to 1.6.2.
- Fixed dynamic lighting update issues at chunk borders ([#12](https://github.com/LambdAurora/LambDynamicLights/issues/12)).
- Fixed water-sensitive items lighting up in water on dedicated servers. ([#3](https://github.com/LambdAurora/LambDynamicLights/issues/3))
- Added new JSON API to add item luminance and water-sensitivity through resource packs.
- Added `DynamicLightHandler#isWaterSensitive` to make some entities water-sensitive like the blaze.
- Fixed incompatibility with future [Sodium] versions. ([#6](https://github.com/LambdAurora/LambDynamicLights/issues/6))

### 1.3.1

- Fixed entity lighting issue with [Sodium] 0.1.0. ([#23](https://github.com/LambdAurora/LambDynamicLights/issues/23))
- Fixed entity lighting issue with [Sodium] 0.1.0. ([#23](https://github.com/LambdAurora/LambDynamicLights/issues/23))

### 1.3.2

- Added entity lighting capabilities to minecarts.
- Added `DynamicLightsInitializer` and `dynamiclights` entrypoint.
- Added Brazilian Portuguese translations.
- Added Estonian translations.
- Added Hindi translations.
- Added Turkish translations.
- Updated French translations.
- Fixed memory leak in dynamic light source tracking. ([#30](https://github.com/LambdAurora/LambDynamicLights/issues/30))
- Added entity lighting capabilities to minecarts.
- Added `DynamicLightsInitializer` and `dynamiclights` entrypoint.
- Added Brazilian Portuguese translations.
- Added Estonian translations.
- Added Hindi translations.
- Added Turkish translations.
- Updated French translations.
- Fixed memory leak in dynamic light source tracking. ([#30](https://github.com/LambdAurora/LambDynamicLights/issues/30))

### 1.3.3

- Added Italian translations ([#40](https://github.com/LambdAurora/LambDynamicLights/pull/40)).
- Optimized dynamic lighting update methods.
- Fixed crash when leaving world with some minimaps mods. ([#37](https://github.com/LambdAurora/LambDynamicLights/issues/37), [#41](https://github.com/LambdAurora/LambDynamicLights/issues/41))
- Fixed crash with Immersive Portals ([#39](https://github.com/LambdAurora/LambDynamicLights/issues/39)).
- Updated [SpruceUI], and Fabric API dependencies.
- Added Italian translations ([#40](https://github.com/LambdAurora/LambDynamicLights/pull/40)).
- Optimized dynamic lighting update methods.
- Fixed crash when leaving world with some minimaps mods. ([#37](https://github.com/LambdAurora/LambDynamicLights/issues/37), [#41](https://github.com/LambdAurora/LambDynamicLights/issues/41))
- Fixed crash with Immersive Portals ([#39](https://github.com/LambdAurora/LambDynamicLights/issues/39)).
- Updated [SpruceUI], and Fabric API dependencies.

### 1.3.4

- Fix ghost dynamic light source ([#47](https://github.com/LambdAurora/LambDynamicLights/issues/47)).
- Fix missing background in settings screen.
- Updated [SpruceUI].
- Fix ghost dynamic light source ([#47](https://github.com/LambdAurora/LambDynamicLights/issues/47)).
- Fix missing background in settings screen.
- Updated [SpruceUI].

## 2.0.0

- Updated to Minecraft 1.17.
- Updated to Java 16.
- Added dynamic lighting to the Glow Squid.
- And more.
- Updated to Minecraft 1.17.
- Updated to Java 16.
- Added dynamic lighting to the Glow Squid.
- And more.

### 2.0.1

- Fixed mixin warnings ([#65](https://github.com/LambdAurora/LambDynamicLights/issues/65)).
- Removed any usage of a library.
- Updated [SpruceUI].
- Fixed mixin warnings ([#65](https://github.com/LambdAurora/LambDynamicLights/issues/65)).
- Removed any usage of a library.
- Updated [SpruceUI].

### 2.0.2

- Added Swedish translations ([#68](https://github.com/LambdAurora/LambDynamicLights/pull/68)).
- Block items now respect the `BlockStateTag` in item's NBT ([#71](https://github.com/LambdAurora/LambDynamicLights/issues/71)).
- Fixed glow item frames not emitting light ([#63](https://github.com/LambdAurora/LambDynamicLights/issues/63)).
- Fixed minecart not emitting light when holding a light source ([#70](https://github.com/LambdAurora/LambDynamicLights/issues/70)).
- Fixed glow berries not emitting light ([#72](https://github.com/LambdAurora/LambDynamicLights/issues/72)).
- Fixed glow squids not dimming when attacked ([#75](https://github.com/LambdAurora/LambDynamicLights/issues/75)).
- Fixed LambDynamicLights not rebuilding the correct chunks when at Y -18 or Y -50 ([#76](https://github.com/LambdAurora/LambDynamicLights/issues/76)).
- Added Swedish translations ([#68](https://github.com/LambdAurora/LambDynamicLights/pull/68)).
- Block items now respect the `BlockStateTag` in item's NBT ([#71](https://github.com/LambdAurora/LambDynamicLights/issues/71)).
- Fixed glow item frames not emitting light ([#63](https://github.com/LambdAurora/LambDynamicLights/issues/63)).
- Fixed minecart not emitting light when holding a light source ([#70](https://github.com/LambdAurora/LambDynamicLights/issues/70)).
- Fixed glow berries not emitting light ([#72](https://github.com/LambdAurora/LambDynamicLights/issues/72)).
- Fixed glow squids not dimming when attacked ([#75](https://github.com/LambdAurora/LambDynamicLights/issues/75)).
- Fixed LambDynamicLights not rebuilding the correct chunks when at Y -18 or Y -50 ([#76](https://github.com/LambdAurora/LambDynamicLights/issues/76)).

## 2.1.0

- Added individual entity toggles ([#64](https://github.com/LambdAurora/LambDynamicLights/issues/64), [#79](https://github.com/LambdAurora/LambDynamicLights/issues/79)).
- Optimized hot methods `maxDynamicLightLevel` and `updateTracking` ([#84](https://github.com/LambdAurora/LambDynamicLights/pull/84)).
- Use `HashSet` for `dynamicLightSources` ([#85](https://github.com/LambdAurora/LambDynamicLights/pull/85)).
- Cache config values for better performances ([#80](https://github.com/LambdAurora/LambDynamicLights/issues/80)).
- Added individual entity toggles ([#64](https://github.com/LambdAurora/LambDynamicLights/issues/64), [#79](https://github.com/LambdAurora/LambDynamicLights/issues/79)).
- Optimized hot methods `maxDynamicLightLevel` and `updateTracking` ([#84](https://github.com/LambdAurora/LambDynamicLights/pull/84)).
- Use `HashSet` for `dynamicLightSources` ([#85](https://github.com/LambdAurora/LambDynamicLights/pull/85)).
- Cache config values for better performances ([#80](https://github.com/LambdAurora/LambDynamicLights/issues/80)).

### 2.1.1

- Updated to Minecraft 1.19.
- Updated [SpruceUI].
- Updated [pridelib].
- Updated to Minecraft 1.19.
- Updated [SpruceUI].
- Updated [pridelib].

### 2.1.2

- Fixed dependencies declaration.
- Fixed dependencies declaration.

## 2.2.0

- Added option to disable self dynamic lighting.
- Updated Russian translations ([#116](https://github.com/LambdAurora/LambDynamicLights/pull/116), [#121](https://github.com/LambdAurora/LambDynamicLights/pull/121)).
- Added Ukrainian translations ([#120](https://github.com/LambdAurora/LambDynamicLights/pull/120)).
- Added option to disable self dynamic lighting.
- Updated Russian translations ([#116](https://github.com/LambdAurora/LambDynamicLights/pull/116), [#121](https://github.com/LambdAurora/LambDynamicLights/pull/121)).
- Added Ukrainian translations ([#120](https://github.com/LambdAurora/LambDynamicLights/pull/120)).

## 2.3.0

- Added Traditional Chinese translations ([#142](https://github.com/LambdAurora/LambDynamicLights/pull/142)).
- Updated Brazilian Portuguese translations ([#135](https://github.com/LambdAurora/LambDynamicLights/pull/135)).
- Updated Simplified Chinese translations ([#133](https://github.com/LambdAurora/LambDynamicLights/pull/133)).
- Updated to Minecraft 1.19.4 ([#144](https://github.com/LambdAurora/LambDynamicLights/pull/144)).
- Updated [SpruceUI].
- Updated [pridelib].
- Added Traditional Chinese translations ([#142](https://github.com/LambdAurora/LambDynamicLights/pull/142)).
- Updated Brazilian Portuguese translations ([#135](https://github.com/LambdAurora/LambDynamicLights/pull/135)).
- Updated Simplified Chinese translations ([#133](https://github.com/LambdAurora/LambDynamicLights/pull/133)).
- Updated to Minecraft 1.19.4 ([#144](https://github.com/LambdAurora/LambDynamicLights/pull/144)).
- Updated [SpruceUI].
- Updated [pridelib].

### 2.3.1

- Fixed ATLauncher configuration somehow ([#152](https://github.com/LambdAurora/LambDynamicLights/pull/152)).
- Updated to Minecraft 1.20 ([#156](https://github.com/LambdAurora/LambDynamicLights/pull/156))
- Updated [SpruceUI].
- Updated night config.
- Fixed ATLauncher configuration somehow ([#152](https://github.com/LambdAurora/LambDynamicLights/pull/152)).
- Updated to Minecraft 1.20 ([#156](https://github.com/LambdAurora/LambDynamicLights/pull/156))
- Updated [SpruceUI].
- Updated night config.

### 2.3.2

- Cleaned up some item light source code.

[SpruceUI]: https://github.com/LambdAurora/SpruceUI "SpruceUI page"
[pridelib]: https://github.com/Queerbric/pridelib "Pridelib page"
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ org.gradle.jvmargs=-Xmx2G
# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version=1.20.1
quilt_mappings=1
quilt_mappings=23
loader_version=0.14.21
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
fabric_api_version=0.83.1+1.20.1

# Mod Properties
mod_version = 2.3.1
mod_version = 2.3.2
maven_group = dev.lambdaurora
archives_base_name = lambdynamiclights
modrinth_id=yBW8D80W
Expand Down
24 changes: 23 additions & 1 deletion src/main/java/dev/lambdaurora/lambdynlights/LambDynLights.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import net.minecraft.client.render.LightmapTextureManager;
import net.minecraft.client.render.WorldRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.TntEntity;
import net.minecraft.entity.mob.CreeperEntity;
import net.minecraft.entity.player.PlayerEntity;
Expand All @@ -48,7 +49,7 @@
* Represents the LambDynamicLights mod.
*
* @author LambdAurora
* @version 2.1.0
* @version 2.3.2
* @since 1.0.0
*/
public class LambDynLights implements ClientModInitializer {
Expand Down Expand Up @@ -444,6 +445,27 @@ public static void updateTracking(@NotNull DynamicLightSource lightSource) {
}
}

private static boolean isEyeSubmergedInFluid(LivingEntity entity) {
if (!LambDynLights.get().config.getWaterSensitiveCheck().get()) {
return false;
}

var eyePos = BlockPos.create(entity.getX(), entity.getEyeY(), entity.getZ());
return !entity.getWorld().getFluidState(eyePos).isEmpty();
}

public static int getLivingEntityLuminanceFromItems(LivingEntity entity) {
boolean submergedInFluid = isEyeSubmergedInFluid(entity);
int luminance = 0;

for (var equipped : entity.getItemsEquipped()) {
if (!equipped.isEmpty())
luminance = Math.max(luminance, LambDynLights.getLuminanceFromItemStack(equipped, submergedInFluid));
}

return luminance;
}

/**
* Returns the luminance from an item stack.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ public int getLuminance(ItemStack stack) {

static int getLuminance(ItemStack stack, BlockState state) {
var nbt = stack.getNbt();

if (nbt != null) {
var blockStateTag = nbt.getCompound("BlockStateTag");
var stateManager = state.getBlock().getStateManager();
Expand All @@ -175,6 +176,7 @@ static int getLuminance(ItemStack stack, BlockState state) {
}
}
}

return state.getLuminance();
}

Expand Down
Loading

0 comments on commit f0f67f8

Please sign in to comment.