Skip to content

Commit

Permalink
The mod can now launch when using a dedicated server
Browse files Browse the repository at this point in the history
  • Loading branch information
B1n-ry committed Aug 24, 2024
1 parent c41e9bb commit 69cd270
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 11 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# You're in Grave Danger 2.0.3

### Fixes
* The mod can now launch when using a dedicated server

---

# You're in Grave Danger 2.0.2

### Fixes
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ mod_name=You're in Grave Danger
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=MIT
# The mod version. See https://semver.org/
mod_version=2.0.2
mod_version=2.0.3
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
# This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
Expand Down
1 change: 0 additions & 1 deletion src/main/java/com/b1n_ry/yigd/client/YigdClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import net.neoforged.neoforge.client.event.ClientPlayerNetworkEvent;
import net.neoforged.neoforge.client.gui.IConfigScreenFactory;
import net.neoforged.neoforge.common.NeoForge;
import net.neoforged.neoforge.event.entity.EntityJoinLevelEvent;
import net.neoforged.neoforge.network.PacketDistributor;

@Mod(value = Yigd.MOD_ID, dist = Dist.CLIENT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,4 +351,11 @@ public void renderButtons(GuiGraphics graphics, int mouseX, int mouseY, float pa
}
}
}

public static void openScreen(GraveOverviewS2CPacket payload) {
Minecraft client = Minecraft.getInstance();
client.execute(() -> client.setScreen(new GraveOverviewScreen(payload.component(), client.screen,
payload.canRestore(), payload.canRob(), payload.canDelete(), payload.canUnlock(),
payload.obtainableKeys(), payload.obtainableCompass())));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.b1n_ry.yigd.Yigd;
import com.b1n_ry.yigd.networking.LightGraveData;
import com.b1n_ry.yigd.networking.packets.GraveOverviewRequestC2SPacket;
import com.b1n_ry.yigd.networking.packets.GraveSelectionS2CPacket;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Font;
import net.minecraft.client.gui.GuiGraphics;
Expand Down Expand Up @@ -256,4 +257,9 @@ private void renderToggleButtons(GuiGraphics graphics, int mouseX, int mouseY, f
this.overlayToggle.render(graphics, mouseX, mouseY, partialTick);
graphics.blitSprite(this.overlayColors ? SHOW_STATUS : HIDE_STATUS, x + 2, y + 74, 16, 16);
}

public static void openScreen(GraveSelectionS2CPacket payload) {
Minecraft client = Minecraft.getInstance();
client.execute(() -> client.setScreen(new GraveSelectionScreen(payload.data(), payload.profile(), client.screen)));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.b1n_ry.yigd.Yigd;
import com.b1n_ry.yigd.networking.LightPlayerData;
import com.b1n_ry.yigd.networking.packets.GraveSelectionRequestC2SPacket;
import com.b1n_ry.yigd.networking.packets.PlayerSelectionS2CPacket;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Font;
import net.minecraft.client.gui.GuiGraphics;
Expand Down Expand Up @@ -247,4 +248,9 @@ private void renderScrollbar(GuiGraphics graphics, int mouseX, int mouseY, float
private enum FilterButtonValue {
WITH_GRAVES, WITH_CLAIMED, WITH_UNCLAIMED, WITH_DESTROYED
}

public static void openScreen(PlayerSelectionS2CPacket payload) {
Minecraft client = Minecraft.getInstance();
client.execute(() -> client.setScreen(new PlayerSelectionScreen(payload.data(), client.screen)));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,16 @@
import com.b1n_ry.yigd.networking.packets.GraveOverviewS2CPacket;
import com.b1n_ry.yigd.networking.packets.GraveSelectionS2CPacket;
import com.b1n_ry.yigd.networking.packets.PlayerSelectionS2CPacket;
import net.minecraft.client.Minecraft;
import net.neoforged.neoforge.network.handling.IPayloadContext;

public class ClientPacketHandler {
public static void graveOverview(GraveOverviewS2CPacket payload, IPayloadContext context) {
Minecraft client = Minecraft.getInstance();
client.execute(() -> client.setScreen(new GraveOverviewScreen(payload.component(), client.screen,
payload.canRestore(), payload.canRob(), payload.canDelete(), payload.canUnlock(),
payload.obtainableKeys(), payload.obtainableCompass())));
GraveOverviewScreen.openScreen(payload);
}
public static void graveSelection(GraveSelectionS2CPacket payload, IPayloadContext context) {
Minecraft client = Minecraft.getInstance();
client.execute(() -> client.setScreen(new GraveSelectionScreen(payload.data(), payload.profile(), client.screen)));
GraveSelectionScreen.openScreen(payload);
}
public static void playerSelection(PlayerSelectionS2CPacket payload, IPayloadContext context) {
Minecraft client = Minecraft.getInstance();
client.execute(() -> client.setScreen(new PlayerSelectionScreen(payload.data(), client.screen)));
PlayerSelectionScreen.openScreen(payload);
}
}

0 comments on commit 69cd270

Please sign in to comment.