-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Re-added JEI integration, removed JEIEvents, improved highlight shade…
…r, started working on server-sided RecipeViewerEvents
- Loading branch information
1 parent
c70d756
commit 49cf941
Showing
22 changed files
with
348 additions
and
97 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
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
16 changes: 16 additions & 0 deletions
16
src/main/java/dev/latvian/mods/kubejs/integration/jei/JEIIntegrationEventHandler.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,16 @@ | ||
package dev.latvian.mods.kubejs.integration.jei; | ||
|
||
import dev.latvian.mods.kubejs.recipe.viewer.server.RecipeViewerData; | ||
import dev.latvian.mods.kubejs.recipe.viewer.server.RecipeViewerDataUpdatedEvent; | ||
import net.neoforged.bus.api.SubscribeEvent; | ||
import net.neoforged.fml.common.EventBusSubscriber; | ||
|
||
@EventBusSubscriber(modid = "jei") | ||
public class JEIIntegrationEventHandler { | ||
public static RecipeViewerData remote = null; | ||
|
||
@SubscribeEvent | ||
public static void loadRemote(RecipeViewerDataUpdatedEvent event) { | ||
remote = event.data; | ||
} | ||
} |
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
11 changes: 7 additions & 4 deletions
11
src/main/java/dev/latvian/mods/kubejs/net/SyncRecipeViewerDataPayload.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 |
---|---|---|
@@ -1,22 +1,25 @@ | ||
package dev.latvian.mods.kubejs.net; | ||
|
||
import dev.latvian.mods.kubejs.recipe.viewer.server.RecipeViewerData; | ||
import dev.latvian.mods.kubejs.recipe.viewer.server.RecipeViewerDataSyncedEvent; | ||
import dev.latvian.mods.kubejs.recipe.viewer.server.RecipeViewerDataUpdatedEvent; | ||
import net.minecraft.network.RegistryFriendlyByteBuf; | ||
import net.minecraft.network.codec.ByteBufCodecs; | ||
import net.minecraft.network.codec.StreamCodec; | ||
import net.minecraft.network.protocol.common.custom.CustomPacketPayload; | ||
import net.neoforged.neoforge.common.NeoForge; | ||
import net.neoforged.neoforge.network.handling.IPayloadContext; | ||
|
||
public record SyncRecipeViewerDataPayload(RecipeViewerData data) implements CustomPacketPayload { | ||
public static final StreamCodec<RegistryFriendlyByteBuf, SyncRecipeViewerDataPayload> STREAM_CODEC = RecipeViewerData.STREAM_CODEC.map(SyncRecipeViewerDataPayload::new, SyncRecipeViewerDataPayload::data); | ||
import java.util.Optional; | ||
|
||
public record SyncRecipeViewerDataPayload(Optional<RecipeViewerData> data) implements CustomPacketPayload { | ||
public static final StreamCodec<RegistryFriendlyByteBuf, SyncRecipeViewerDataPayload> STREAM_CODEC = ByteBufCodecs.optional(RecipeViewerData.STREAM_CODEC).map(SyncRecipeViewerDataPayload::new, SyncRecipeViewerDataPayload::data); | ||
|
||
@Override | ||
public Type<?> type() { | ||
return KubeJSNet.SYNC_RECIPE_VIEWER; | ||
} | ||
|
||
public void handle(IPayloadContext ctx) { | ||
ctx.enqueueWork(() -> NeoForge.EVENT_BUS.post(new RecipeViewerDataSyncedEvent(data))); | ||
ctx.enqueueWork(() -> NeoForge.EVENT_BUS.post(new RecipeViewerDataUpdatedEvent(data.orElse(null)))); | ||
} | ||
} |
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
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
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
Oops, something went wrong.