Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added SodiumDynamicLights(New DynamicLightsReforged ) support #36

Open
wants to merge 1 commit into
base: 1.20.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public RadiantGearForgeMod() {
isDLReforgedLoaded = modList.isLoaded("dynamiclightsreforged");
isArsNouveauLoaded = modList.isLoaded("ars_nouveau");
isRyoamicLoaded = modList.isLoaded("ryoamiclights");
isSodiumDynamicLights = modList.isLoaded("sodiumdynamiclights");
// Embeddium++ removed their dynamic lighting in 1.2.4 but this mod should still be able to load
if (modList.isLoaded("embeddiumplus")) {
DefaultArtifactVersion maxVersion = new DefaultArtifactVersion("1.2.4");
Expand Down Expand Up @@ -90,6 +91,10 @@ private void clientSetup(final FMLClientSetupEvent evt) {
if (isArsNouveauLoaded) {
ArsNouveauModule.setup();
}

if (isSodiumDynamicLights) {
SDLModule.setup();
}
}

private String getRemoteVersion(ModLoadingContext context) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.illusivesoulworks.radiantgear.integration.sodiumdynamiclights;

import com.illusivesoulworks.radiantgear.client.BaseLambDynLightsModule;
import toni.sodiumdynamiclights.SodiumDynamicLights;
import dev.lambdaurora.lambdynlights.api.DynamicLightHandlers;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.item.ItemStack;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.EntityJoinLevelEvent;

import java.util.function.Function;

public class SDLModule extends BaseLambDynLightsModule {
public static void setup() {
SDLModule module = new SDLModule();
MinecraftForge.EVENT_BUS.addListener(module::entityJoin);
}

private void entityJoin(final EntityJoinLevelEvent evt) {
this.registerEntity(evt.getEntity(), evt.getLevel());
}

@Override
protected int getLuminance(ItemStack stack, boolean isInWater) {
return SodiumDynamicLights.getLuminanceFromItemStack(stack, isInWater);
}

@Override
protected void registerDynamicLightHandler(EntityType<?> type,
Function<Entity, Integer> handler) {
DynamicLightHandlers.registerDynamicLightHandler(type, handler::apply);
}
}