From 91b3b3f2e0a1b4a9f6bc74b0bb85cba59e6a13f8 Mon Sep 17 00:00:00 2001 From: khjxiaogu <54445543+khjxiaogu@users.noreply.github.com> Date: Sat, 18 Jan 2025 17:57:42 +0800 Subject: [PATCH] add private nw ctor access and init after research init --- src/main/java/com/teammoeg/frostedheart/FHNetwork.java | 3 ++- .../content/research/network/FHResearchDataSyncPacket.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/teammoeg/frostedheart/FHNetwork.java b/src/main/java/com/teammoeg/frostedheart/FHNetwork.java index 6bb759f64..5e35b92e2 100644 --- a/src/main/java/com/teammoeg/frostedheart/FHNetwork.java +++ b/src/main/java/com/teammoeg/frostedheart/FHNetwork.java @@ -98,7 +98,8 @@ public static SimpleChannel get() { public static synchronized void registerMessage(String name, Class msg) { classesId.put(msg, FHMain.rl(name)); try { - Constructor ctor = msg.getConstructor(FriendlyByteBuf.class); + Constructor ctor = msg.getDeclaredConstructor(FriendlyByteBuf.class); + ctor.setAccessible(true); CHANNEL.registerMessage(++iid, msg, CMessage::encode, pb -> { try { return ctor.newInstance(pb); diff --git a/src/main/java/com/teammoeg/frostedheart/content/research/network/FHResearchDataSyncPacket.java b/src/main/java/com/teammoeg/frostedheart/content/research/network/FHResearchDataSyncPacket.java index 4545a0e7e..19f19a004 100644 --- a/src/main/java/com/teammoeg/frostedheart/content/research/network/FHResearchDataSyncPacket.java +++ b/src/main/java/com/teammoeg/frostedheart/content/research/network/FHResearchDataSyncPacket.java @@ -61,7 +61,7 @@ public void handle(Supplier context) { // Grant Effects on Client // TODO: Why not just sync the UnlockLists through TeamResearchData.Codec, so that the above line is all we need? TeamDataClosure closure = CClientTeamDataManager.INSTANCE.getInstance().getDataHolder(FHSpecialDataTypes.RESEARCH_DATA); - closure.get().grantAllEffects(closure.team()); + closure.get().initResearch(closure.team()); } catch (Exception e) { FHMain.LOGGER.error("Failed to load data when syncing research data", e); }