forked from LambdAurora/LambDynamicLights
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
53 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,2 @@ | ||
## Changelog | ||
- remove the mixin for embeddium (only forge) | ||
- remove architectury dependency | ||
- add keybind (press and hold the key) | ||
- code clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,2 @@ | ||
## Changelog | ||
- remove the mixin for embeddium (only forge) | ||
- remove architectury dependency | ||
- add keybind (press and hold the key) | ||
- code clean |
14 changes: 14 additions & 0 deletions
14
fabric/src/main/java/org/thinkingstudio/ryoamiclights/fabric/FabricEventHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package org.thinkingstudio.ryoamiclights.fabric; | ||
|
||
import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents; | ||
import net.minecraft.client.MinecraftClient; | ||
import org.thinkingstudio.ryoamiclights.RyoamicLights; | ||
|
||
public class FabricEventHandler { | ||
public static void registerEvents() { | ||
WorldRenderEvents.START.register(context -> { | ||
MinecraftClient.getInstance().getProfiler().swap("dynamic_lighting"); | ||
RyoamicLights.get().updateAll(context.worldRenderer()); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,2 @@ | ||
## Changelog | ||
- remove the mixin for embeddium (only forge) | ||
- remove architectury dependency | ||
- add keybind (press and hold the key) | ||
- code clean |
32 changes: 32 additions & 0 deletions
32
forge/src/main/java/org/thinkingstudio/ryoamiclights/forge/ForgeEventHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package org.thinkingstudio.ryoamiclights.forge; | ||
|
||
import net.minecraft.client.MinecraftClient; | ||
import net.minecraft.resource.SynchronousResourceReloader; | ||
import net.minecraftforge.client.event.RegisterClientReloadListenersEvent; | ||
import net.minecraftforge.client.event.RenderLevelStageEvent; | ||
import net.minecraftforge.common.MinecraftForge; | ||
import net.minecraftforge.eventbus.api.EventPriority; | ||
import net.minecraftforge.eventbus.api.IEventBus; | ||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; | ||
import org.thinkingstudio.ryoamiclights.RyoamicLights; | ||
import org.thinkingstudio.ryoamiclights.api.item.ItemLightSources; | ||
import org.thinkingstudio.ryoamiclights.forge.api.DynamicLightsInitializerEvent; | ||
|
||
public class ForgeEventHandler { | ||
public static void registerEvents() { | ||
IEventBus forgeEventBus = MinecraftForge.EVENT_BUS; | ||
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); | ||
|
||
forgeEventBus.<RenderLevelStageEvent>addListener(EventPriority.HIGHEST, event -> { | ||
if (event.getStage() == RenderLevelStageEvent.Stage.AFTER_TRIPWIRE_BLOCKS) { | ||
MinecraftClient.getInstance().getProfiler().swap("dynamic_lighting"); | ||
RyoamicLights.get().updateAll(event.getLevelRenderer()); | ||
} | ||
}); | ||
modEventBus.<RegisterClientReloadListenersEvent>addListener(EventPriority.HIGHEST, event -> { | ||
event.registerReloadListener((SynchronousResourceReloader) ItemLightSources::load); | ||
}); | ||
|
||
forgeEventBus.post(new DynamicLightsInitializerEvent()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters