-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reworked item tooltip event, removed chanced item
- Loading branch information
1 parent
7f88b8e
commit dca1a11
Showing
43 changed files
with
710 additions
and
327 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
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
37 changes: 37 additions & 0 deletions
37
src/main/java/dev/latvian/mods/kubejs/client/KubeSessionData.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,37 @@ | ||
package dev.latvian.mods.kubejs.client; | ||
|
||
import dev.latvian.mods.kubejs.core.ClientPacketListenerKJS; | ||
import dev.latvian.mods.kubejs.net.KubeServerData; | ||
import dev.latvian.mods.kubejs.recipe.viewer.server.RecipeViewerData; | ||
import dev.latvian.mods.kubejs.recipe.viewer.server.RemoteRecipeViewerDataUpdatedEvent; | ||
import dev.latvian.mods.kubejs.tooltip.ItemTooltipData; | ||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.multiplayer.ClientPacketListener; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.neoforged.neoforge.common.NeoForge; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import java.util.List; | ||
|
||
public class KubeSessionData { | ||
@Nullable | ||
public static KubeSessionData of(ClientPacketListener listener) { | ||
return listener == null ? null : ((ClientPacketListenerKJS) listener).kjs$sessionData(); | ||
} | ||
|
||
@Nullable | ||
public static KubeSessionData of(Minecraft mc) { | ||
return mc == null ? null : of(mc.getConnection()); | ||
} | ||
|
||
public ResourceLocation activePostShader = null; | ||
public RecipeViewerData recipeViewerData = null; | ||
public List<ItemTooltipData> itemTooltips = List.of(); | ||
|
||
public void sync(KubeServerData data) { | ||
recipeViewerData = data.recipeViewerData().orElse(null); | ||
itemTooltips = List.copyOf(data.itemTooltipData()); | ||
|
||
NeoForge.EVENT_BUS.post(new RemoteRecipeViewerDataUpdatedEvent(recipeViewerData)); | ||
} | ||
} |
5 changes: 2 additions & 3 deletions
5
src/main/java/dev/latvian/mods/kubejs/core/ClientPacketListenerKJS.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,10 +1,9 @@ | ||
package dev.latvian.mods.kubejs.core; | ||
|
||
import net.minecraft.resources.ResourceLocation; | ||
import org.apache.commons.lang3.mutable.Mutable; | ||
import dev.latvian.mods.kubejs.client.KubeSessionData; | ||
|
||
public interface ClientPacketListenerKJS { | ||
default Mutable<ResourceLocation> kjs$activePostShader() { | ||
default KubeSessionData kjs$sessionData() { | ||
throw new NoMixinException(); | ||
} | ||
} |
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.