Skip to content

Commit

Permalink
Fix crash due to Mixin plugin (#239).
Browse files Browse the repository at this point in the history
  • Loading branch information
LambdAurora committed Oct 9, 2024
1 parent 8facd0f commit c4984f4
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 13 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@
- This may be re-introduced if a valid use-case is found.
- Switched license to [Lambda License](https://github.com/LambdAurora/LambDynamicLights/blob/bbefb8860bca2e797f8a2ba8a59d1120b6e1c7b4/LICENSE).

### 3.0.1

- Fixed crash due to Mixin plugin ([#239](https://github.com/LambdAurora/LambDynamicLights/issues/239)).

[SpruceUI]: https://github.com/LambdAurora/SpruceUI "SpruceUI page"
[pridelib]: https://github.com/Queerbric/pridelib "Pridelib page"
[Sodium]: https://modrinth.com/mod/sodium "Sodium Modrinth page"
Expand Down
2 changes: 1 addition & 1 deletion build_logic/src/main/kotlin/lambdynamiclights/Constants.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import org.gradle.accessors.dm.LibrariesForLibs
object Constants {
const val GROUP = "dev.lambdaurora"
const val NAME = "lambdynamiclights"
const val VERSION = "3.0.0"
const val VERSION = "3.0.1"
const val JAVA_VERSION = 21

private var minecraftVersion: String? = null
Expand Down
13 changes: 3 additions & 10 deletions src/main/java/dev/lambdaurora/lambdynlights/LambDynLights.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,14 @@
* Represents the LambDynamicLights mod.
*
* @author LambdAurora
* @version 3.0.0
* @version 3.0.1
* @since 1.0.0
*/
public class LambDynLights implements ClientModInitializer {
public static final String NAMESPACE = "lambdynlights";
private static final Logger LOGGER = LoggerFactory.getLogger("LambDynamicLights");
private static final double MAX_RADIUS = 7.75;
private static final double MAX_RADIUS_SQUARED = MAX_RADIUS * MAX_RADIUS;
public static final EventManager<Identifier> EVENT_MANAGER = new EventManager<>(Identifier.of(NAMESPACE, "default"), Identifier::parse);
public static final EventManager<Identifier> EVENT_MANAGER = new EventManager<>(Identifier.of(LambDynLightsConstants.NAMESPACE, "default"), Identifier::parse);
private static LambDynLights INSTANCE;
public final DynamicLightsConfig config = new DynamicLightsConfig(this);
public final ItemLightSources itemLightSources = new ItemLightSources();
Expand All @@ -81,7 +80,7 @@ public void onInitializeClient() {
ResourceManagerHelper.get(ResourceType.CLIENT_RESOURCES).registerReloadListener(new SimpleSynchronousResourceReloadListener() {
@Override
public Identifier getFabricId() {
return Identifier.of(NAMESPACE, "dynamiclights_resources");
return Identifier.of(LambDynLightsConstants.NAMESPACE, "dynamiclights_resources");
}

@Override
Expand All @@ -98,12 +97,6 @@ public void reload(ResourceManager manager) {
DynamicLightHandlers.registerDefaultHandlers();
}

public static boolean isDevMode() {
return FabricLoader.getInstance().getModContainer(NAMESPACE)
.map(modContainer -> modContainer.getMetadata().getVersion().getFriendlyString().endsWith("-local"))
.orElse(true);
}

/**
* Updates all light sources.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright © 2024 LambdAurora <[email protected]>
*
* This file is part of LambDynamicLights.
*
* Licensed under the Lambda License. For more information,
* see the LICENSE file.
*/

package dev.lambdaurora.lambdynlights;

import net.fabricmc.loader.api.FabricLoader;

/**
* Contains constants about LambDynamicLights.
*
* @author LambdAurora
* @version 3.0.1
* @since 3.0.1
*/
public final class LambDynLightsConstants {
/**
* The namespace of this mod, whose value is {@value}.
*/
public static final String NAMESPACE = "lambdynlights";

/**
* {@return {@code true} if this mod is in development mode, or {@code false} otherwise}
*/
public static boolean isDevMode() {
return FabricLoader.getInstance().getModContainer(NAMESPACE)
.map(modContainer -> modContainer.getMetadata().getVersion().getFriendlyString().endsWith("-local"))
.orElse(true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* LambDynamicLights mixin plugin for conditional mixins.
*
* @author LambdAurora
* @version 3.0.0
* @version 3.0.1
* @since 1.0.0
*/
public class LambDynLightsMixinPlugin implements IMixinConfigPlugin {
Expand All @@ -34,7 +34,7 @@ public LambDynLightsMixinPlugin() {
this.conditionalMixins.put("dev.lambdaurora.lambdynlights.mixin.sodium.FlatLightPipelineMixin", sodium05XInstalled);
this.conditionalMixins.put("dev.lambdaurora.lambdynlights.mixin.sodium.LightDataAccessMixin", sodium05XInstalled);

this.conditionalMixins.put("dev.lambdaurora.lambdynlights.mixin.DevModeMixin", LambDynLights.isDevMode());
this.conditionalMixins.put("dev.lambdaurora.lambdynlights.mixin.DevModeMixin", LambDynLightsConstants.isDevMode());
}

@Override
Expand Down

0 comments on commit c4984f4

Please sign in to comment.