Empty mod that loads cleanly on client + dedicated server. Sets up the
package layout and milestone TODOs for the BNS in-game UI work.
- uk.sijbers.bnstoolkit.{BnsToolkit, BnsToolkitClient} mod entries
- 5 placeholder screens extending a shared BaseBnsScreen
(TierUpgrade, BountyBoard, QuestLog, PlotPurchase, ShopBrowser)
- 3 key bindings (T/B/P) registered, handlers TODO M1+
- SpurHud overlay placeholder for M4
- Network: payload registrar + one smoke-test C2S/S2C pair
(RequestTierState / TierStateUpdate)
- en_us.json for screen + keybind labels
- neoforge.mods.toml pinned to neo_version 21.1.228 (live server match)
Build verified: ./gradlew build -> bnstoolkit-0.1.0.jar (15.6 KB).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
package uk.sijbers.bnstoolkit;
|
||||
|
||||
import net.neoforged.bus.api.IEventBus;
|
||||
import net.neoforged.fml.common.Mod;
|
||||
import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||
import net.neoforged.neoforge.common.NeoForge;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import uk.sijbers.bnstoolkit.network.BnsNetwork;
|
||||
|
||||
/**
|
||||
* Brass and Sigil Toolkit — common (client+server) mod entry.
|
||||
*
|
||||
* Mod ID matches {@link #MOD_ID}. The matching value lives in
|
||||
* gradle.properties (mod_id=bnstoolkit) and is interpolated into
|
||||
* src/main/templates/META-INF/neoforge.mods.toml at build time.
|
||||
*
|
||||
* Scope (M0): empty scaffold. Registers no items, blocks, or screens yet.
|
||||
* Just loads cleanly on client and dedicated server so the deploy pipeline
|
||||
* works end-to-end before we start adding real surface area.
|
||||
*/
|
||||
@Mod(BnsToolkit.MOD_ID)
|
||||
public final class BnsToolkit {
|
||||
public static final String MOD_ID = "bnstoolkit";
|
||||
public static final Logger LOG = LoggerFactory.getLogger(MOD_ID);
|
||||
|
||||
public BnsToolkit(IEventBus modBus) {
|
||||
LOG.info("[bnstoolkit] mod entry constructed");
|
||||
|
||||
BnsNetwork.register(modBus);
|
||||
|
||||
modBus.addListener(this::onCommonSetup);
|
||||
NeoForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
private void onCommonSetup(final FMLCommonSetupEvent event) {
|
||||
LOG.info("[bnstoolkit] common setup complete (M0 scaffold — no surface yet)");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package uk.sijbers.bnstoolkit;
|
||||
|
||||
import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.bus.api.IEventBus;
|
||||
import net.neoforged.fml.common.Mod;
|
||||
import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent;
|
||||
import uk.sijbers.bnstoolkit.client.BnsKeyBindings;
|
||||
|
||||
/**
|
||||
* Client-only mod entry. Hosts key bindings + screen registration so the
|
||||
* dedicated server never loads them.
|
||||
*
|
||||
* Activated via the {@code dist = Dist.CLIENT} parameter on the @Mod
|
||||
* annotation — NeoForge will skip this class entirely on the server side.
|
||||
*/
|
||||
@Mod(value = BnsToolkit.MOD_ID, dist = Dist.CLIENT)
|
||||
public final class BnsToolkitClient {
|
||||
|
||||
public BnsToolkitClient(IEventBus modBus) {
|
||||
BnsToolkit.LOG.info("[bnstoolkit] client entry constructed");
|
||||
modBus.addListener(this::onClientSetup);
|
||||
modBus.addListener(BnsKeyBindings::onRegisterKeyMappings);
|
||||
}
|
||||
|
||||
private void onClientSetup(final FMLClientSetupEvent event) {
|
||||
// TODO(matt M1): register screens here when bnstoolkit ships its first GUI.
|
||||
// MenuScreens.register(BnsMenus.TIER_UPGRADE.get(), TierUpgradeScreen::new);
|
||||
BnsToolkit.LOG.info("[bnstoolkit] client setup complete");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package uk.sijbers.bnstoolkit.client;
|
||||
|
||||
import com.mojang.blaze3d.platform.InputConstants;
|
||||
import net.minecraft.client.KeyMapping;
|
||||
import net.neoforged.neoforge.client.event.RegisterKeyMappingsEvent;
|
||||
import net.neoforged.neoforge.client.settings.KeyConflictContext;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
import uk.sijbers.bnstoolkit.BnsToolkit;
|
||||
|
||||
/**
|
||||
* Key bindings for the toolkit screens. All keys are CLIENT-only and live
|
||||
* under a "Brass and Sigil" category in the controls menu.
|
||||
*
|
||||
* Default assignments are placeholders — picked to avoid known FTB
|
||||
* Library / FTB Chunks / Numismatics defaults. Players can rebind in the
|
||||
* vanilla controls menu like any other mod.
|
||||
*
|
||||
* Wiring: each binding gets polled in a {@code ClientTickEvent} handler
|
||||
* once the corresponding screen is implemented; M0 keeps them inert.
|
||||
*/
|
||||
public final class BnsKeyBindings {
|
||||
private BnsKeyBindings() {}
|
||||
|
||||
private static final String CATEGORY = "key.category." + BnsToolkit.MOD_ID;
|
||||
|
||||
public static final KeyMapping OPEN_TIER = new KeyMapping(
|
||||
"key." + BnsToolkit.MOD_ID + ".tier",
|
||||
KeyConflictContext.IN_GAME,
|
||||
InputConstants.Type.KEYSYM.getOrCreate(GLFW.GLFW_KEY_T),
|
||||
CATEGORY);
|
||||
|
||||
public static final KeyMapping OPEN_BOUNTIES = new KeyMapping(
|
||||
"key." + BnsToolkit.MOD_ID + ".bounties",
|
||||
KeyConflictContext.IN_GAME,
|
||||
InputConstants.Type.KEYSYM.getOrCreate(GLFW.GLFW_KEY_B),
|
||||
CATEGORY);
|
||||
|
||||
public static final KeyMapping OPEN_PLOTS = new KeyMapping(
|
||||
"key." + BnsToolkit.MOD_ID + ".plots",
|
||||
KeyConflictContext.IN_GAME,
|
||||
InputConstants.Type.KEYSYM.getOrCreate(GLFW.GLFW_KEY_P),
|
||||
CATEGORY);
|
||||
|
||||
public static void onRegisterKeyMappings(RegisterKeyMappingsEvent event) {
|
||||
event.register(OPEN_TIER);
|
||||
event.register(OPEN_BOUNTIES);
|
||||
event.register(OPEN_PLOTS);
|
||||
BnsToolkit.LOG.info("[bnstoolkit] registered 3 key bindings under {}", CATEGORY);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package uk.sijbers.bnstoolkit.client.hud;
|
||||
|
||||
import net.minecraft.client.DeltaTracker;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
|
||||
/**
|
||||
* Tiny on-screen overlay showing the player's spurs balance + civic tier.
|
||||
*
|
||||
* Spec ref: docs/bnstoolkit-architecture.md §4.6 (HUD overlay)
|
||||
*
|
||||
* TODO(matt M4): wire this up via {@code RegisterGuiLayersEvent} when the
|
||||
* NeoForge gui-layer registration lands. The signature here matches the
|
||||
* {@code LayeredDraw.Layer} contract (a render method taking GuiGraphics +
|
||||
* DeltaTracker), so the eventual implementation only has to add the
|
||||
* "implements" clause and the registration call.
|
||||
*
|
||||
* Position default: top-left, below buff icons. Player can disable in mod
|
||||
* settings (no settings screen yet — comes with the FTB Library swap).
|
||||
*/
|
||||
public final class SpurHud {
|
||||
public static final SpurHud INSTANCE = new SpurHud();
|
||||
|
||||
private SpurHud() {}
|
||||
|
||||
public void render(GuiGraphics graphics, DeltaTracker delta) {
|
||||
// TODO(matt M4): draw "<tier-icon> <tier-name> <spurs> spurs"
|
||||
// Data source: client-side cache populated by S2C TierStateUpdate
|
||||
// packets the server emits whenever balance or tier changes.
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package uk.sijbers.bnstoolkit.client.screens;
|
||||
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.network.chat.Component;
|
||||
|
||||
/**
|
||||
* Shared base for all toolkit screens.
|
||||
*
|
||||
* TODO(matt M1): swap parent to {@code dev.ftb.mods.ftblibrary.ui.BaseScreen}
|
||||
* once the FTB Library compileOnly dependency is wired in build.gradle. The
|
||||
* vanilla {@link Screen} parent is a stand-in so M0 compiles without FTB
|
||||
* Library on the classpath and we can ship a "loads cleanly" mod first.
|
||||
*
|
||||
* When the swap lands, each subclass moves from
|
||||
* {@code render(GuiGraphics, ...)} -> the FTB Lib panel/widget tree
|
||||
* Visual styling (background tile, title bar, close button) comes for
|
||||
* free from FTB Library, matching FTB Quests / FTB Chunks look-and-feel.
|
||||
*/
|
||||
public abstract class BaseBnsScreen extends Screen {
|
||||
protected BaseBnsScreen(Component title) {
|
||||
super(title);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(GuiGraphics graphics, int mouseX, int mouseY, float partialTick) {
|
||||
this.renderBackground(graphics, mouseX, mouseY, partialTick);
|
||||
super.render(graphics, mouseX, mouseY, partialTick);
|
||||
// Centred title — placeholder styling.
|
||||
graphics.drawCenteredString(this.font, this.title, this.width / 2, 16, 0xFFFFFFFF);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPauseScreen() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package uk.sijbers.bnstoolkit.client.screens;
|
||||
|
||||
import net.minecraft.network.chat.Component;
|
||||
|
||||
/**
|
||||
* Bounty board screen — replaces /bns bounty list / accept / turnin.
|
||||
*
|
||||
* Spec ref: docs/bnstoolkit-architecture.md §4.3 (BountyBoardScreen)
|
||||
*
|
||||
* TODO(matt M3): Layout to confirm tomorrow:
|
||||
* - Left pane: list of 5 available bounties for today (refreshes every 24h
|
||||
* server-side; the screen just renders what the server sent)
|
||||
* - Right pane: detail for the highlighted bounty — target entity, count,
|
||||
* payout, state (AVAILABLE / ACTIVE / READY / COOLDOWN)
|
||||
* - Bottom row: ACCEPT / CANCEL / TURN IN buttons (enable based on state)
|
||||
* - Slot indicator: "Active bounties: 2/5" using the player's tier cap
|
||||
*
|
||||
* Two C2S packets drive it:
|
||||
* - RequestBountyList (board open / refresh)
|
||||
* - RequestBountyAction (accept | cancel | turnin)
|
||||
* One S2C: BountyBoardSnapshot.
|
||||
*/
|
||||
public final class BountyBoardScreen extends BaseBnsScreen {
|
||||
public BountyBoardScreen() {
|
||||
super(Component.translatable("screen.bnstoolkit.bounty_board"));
|
||||
}
|
||||
|
||||
// TODO(matt M3): init() + widgets
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package uk.sijbers.bnstoolkit.client.screens;
|
||||
|
||||
import net.minecraft.network.chat.Component;
|
||||
|
||||
/**
|
||||
* Plot purchase + management screen — replaces /bns plot list / buy / release.
|
||||
*
|
||||
* Spec ref: docs/bnstoolkit-architecture.md §4.4 (PlotPurchaseScreen)
|
||||
*
|
||||
* TODO(matt M3): Layout to confirm tomorrow:
|
||||
* - Top-down minimap of the spawn plot region, plots coloured by state
|
||||
* (OWN / AVAILABLE / TAKEN_BY_OTHER), hover for owner + price
|
||||
* - Right pane: highlighted plot details — id, chunk bounds, price,
|
||||
* owner, release refund preview
|
||||
* - Bottom: BUY / RELEASE buttons (price + refund displayed inline)
|
||||
* - Slot indicator: "Plots owned: 1/2" using the player's tier cap
|
||||
*
|
||||
* Two C2S packets:
|
||||
* - RequestPlotMap (open / refresh)
|
||||
* - RequestPlotAction (buy | release, with plot id)
|
||||
* One S2C: PlotMapSnapshot.
|
||||
*
|
||||
* Open trigger options (decide tomorrow): keybind P, an in-game block at
|
||||
* the spawn building, or both. Both is easy — they're not exclusive.
|
||||
*/
|
||||
public final class PlotPurchaseScreen extends BaseBnsScreen {
|
||||
public PlotPurchaseScreen() {
|
||||
super(Component.translatable("screen.bnstoolkit.plot_purchase"));
|
||||
}
|
||||
|
||||
// TODO(matt M3): init() + map widget + action buttons
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package uk.sijbers.bnstoolkit.client.screens;
|
||||
|
||||
import net.minecraft.network.chat.Component;
|
||||
|
||||
/**
|
||||
* Quest log — the "What am I doing right now?" pane.
|
||||
*
|
||||
* Spec ref: docs/bnstoolkit-architecture.md §4.2 (QuestLogScreen)
|
||||
*
|
||||
* TODO(matt M2): Layout to confirm tomorrow:
|
||||
* - Tab bar at top: ACTIVE BOUNTIES | FTB QUESTS | PLOT TIMERS
|
||||
* - Active Bounties tab: same data as Bounty Board's right pane but
|
||||
* filtered to ACTIVE state, with kill-progress bars
|
||||
* - FTB Quests tab: read-only mirror of the player's current chapter,
|
||||
* showing in-progress quests + reward previews
|
||||
* - Plot Timers tab: list of owned plots with any pending refund/release
|
||||
* timers (when implemented)
|
||||
*
|
||||
* Refresh model: server pushes a QuestLogSnapshot whenever any tracked
|
||||
* counter changes (kill count, quest reward, plot ownership). Screen re-
|
||||
* renders from the latest snapshot.
|
||||
*/
|
||||
public final class QuestLogScreen extends BaseBnsScreen {
|
||||
public QuestLogScreen() {
|
||||
super(Component.translatable("screen.bnstoolkit.quest_log"));
|
||||
}
|
||||
|
||||
// TODO(matt M2): init() + tab widgets
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package uk.sijbers.bnstoolkit.client.screens;
|
||||
|
||||
import net.minecraft.network.chat.Component;
|
||||
|
||||
/**
|
||||
* Bazaar shop browser — replaces /bns sell list / sell <item> [count].
|
||||
*
|
||||
* Spec ref: docs/bnstoolkit-architecture.md §4.5 (ShopBrowserScreen)
|
||||
*
|
||||
* TODO(matt M2): Layout to confirm tomorrow:
|
||||
* - Grid of sell-list items (9 in the current catalogue)
|
||||
* - Per cell: item icon, base price, effective price after DR + tier fee,
|
||||
* "you've sold X" counter
|
||||
* - Click cell -> count slider (1 / 16 / 64 / max-in-inventory) and SELL button
|
||||
* - Header: current spurs + effective fee%
|
||||
* - Future: BUY tab when buy-prices land (Phase 7 dynamic exchange)
|
||||
*
|
||||
* Two C2S packets:
|
||||
* - RequestShopCatalogue (open / refresh)
|
||||
* - RequestShopSell (item id, count)
|
||||
* One S2C: ShopCatalogueSnapshot, plus per-sale ShopSellResult.
|
||||
*
|
||||
* Open trigger options: keybind, a Numismatics-style shop block at the
|
||||
* Bazaar building, or both.
|
||||
*/
|
||||
public final class ShopBrowserScreen extends BaseBnsScreen {
|
||||
public ShopBrowserScreen() {
|
||||
super(Component.translatable("screen.bnstoolkit.shop_browser"));
|
||||
}
|
||||
|
||||
// TODO(matt M2): init() + item grid + sell widget
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package uk.sijbers.bnstoolkit.client.screens;
|
||||
|
||||
import net.minecraft.network.chat.Component;
|
||||
|
||||
/**
|
||||
* Tier ladder + upgrade screen.
|
||||
*
|
||||
* Spec ref: docs/bnstoolkit-architecture.md §4.1 (TierUpgradeScreen)
|
||||
*
|
||||
* TODO(matt M1): Visual layout to confirm with you tomorrow:
|
||||
* - 13 rows, one per civic tier (Peasant -> Sovereign)
|
||||
* - Current tier row highlighted
|
||||
* - Each row: rank colour name, cost in spurs, perks summary
|
||||
* (chunks / plot-slots / bounty-slots / shop-fee)
|
||||
* - "Upgrade to <next>" button bottom-right (only enabled if affordable)
|
||||
* - Click pre-confirms cost + shows current balance, second click commits
|
||||
*
|
||||
* Backend wiring: button click sends a C2S RequestTierUpgrade packet.
|
||||
* Server replies with TierUpgradeResult (success/failure + new tier + new
|
||||
* balance). Same backend the /bns tier upgrade chat command already uses.
|
||||
*/
|
||||
public final class TierUpgradeScreen extends BaseBnsScreen {
|
||||
public TierUpgradeScreen() {
|
||||
super(Component.translatable("screen.bnstoolkit.tier_upgrade"));
|
||||
}
|
||||
|
||||
// TODO(matt M1): override init() to lay out rows + button widgets.
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package uk.sijbers.bnstoolkit.network;
|
||||
|
||||
import net.neoforged.bus.api.IEventBus;
|
||||
import net.neoforged.neoforge.network.event.RegisterPayloadHandlersEvent;
|
||||
import net.neoforged.neoforge.network.registration.PayloadRegistrar;
|
||||
import uk.sijbers.bnstoolkit.BnsToolkit;
|
||||
import uk.sijbers.bnstoolkit.network.c2s.RequestTierStatePacket;
|
||||
import uk.sijbers.bnstoolkit.network.s2c.TierStateUpdatePacket;
|
||||
|
||||
/**
|
||||
* Central registration for the toolkit's S2C and C2S packets.
|
||||
*
|
||||
* Spec ref: docs/bnstoolkit-architecture.md §5 (network contract).
|
||||
*
|
||||
* M0 ships one round-trip pair as a smoke-test of the wiring:
|
||||
* - C2S {@link RequestTierStatePacket} ("hey server, what's my tier+balance?")
|
||||
* - S2C {@link TierStateUpdatePacket} (answer + future push channel)
|
||||
*
|
||||
* The rest of the contract (bounty / plot / shop / quest log) will land in
|
||||
* M1..M4 — each milestone adds its own packet pair under the matching
|
||||
* sub-package.
|
||||
*
|
||||
* Versioning: bumped via the version() call below whenever the wire format
|
||||
* changes incompatibly. Same protocol pattern FTB uses.
|
||||
*/
|
||||
public final class BnsNetwork {
|
||||
private BnsNetwork() {}
|
||||
|
||||
public static final String VERSION = "0.1";
|
||||
|
||||
public static void register(IEventBus modBus) {
|
||||
modBus.addListener(BnsNetwork::onRegisterPayloads);
|
||||
}
|
||||
|
||||
private static void onRegisterPayloads(RegisterPayloadHandlersEvent event) {
|
||||
final PayloadRegistrar reg = event.registrar(BnsToolkit.MOD_ID).versioned(VERSION);
|
||||
|
||||
// C2S: request my current tier + balance.
|
||||
reg.playToServer(
|
||||
RequestTierStatePacket.TYPE,
|
||||
RequestTierStatePacket.STREAM_CODEC,
|
||||
RequestTierStatePacket::handle);
|
||||
|
||||
// S2C: server pushes tier + balance (either in response to a request
|
||||
// or unsolicited when something changes).
|
||||
reg.playToClient(
|
||||
TierStateUpdatePacket.TYPE,
|
||||
TierStateUpdatePacket.STREAM_CODEC,
|
||||
TierStateUpdatePacket::handle);
|
||||
|
||||
BnsToolkit.LOG.info("[bnstoolkit/net] registered payloads v{}", VERSION);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package uk.sijbers.bnstoolkit.network.c2s;
|
||||
|
||||
import net.minecraft.network.RegistryFriendlyByteBuf;
|
||||
import net.minecraft.network.codec.StreamCodec;
|
||||
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.neoforged.neoforge.network.handling.IPayloadContext;
|
||||
import uk.sijbers.bnstoolkit.BnsToolkit;
|
||||
|
||||
/**
|
||||
* Client -> server: "Send me my tier + balance."
|
||||
*
|
||||
* Empty payload (no fields). The server identifies the player from
|
||||
* {@link IPayloadContext#player()}. The response is a S2C
|
||||
* {@code TierStateUpdatePacket}.
|
||||
*
|
||||
* TODO(matt M1): once the KubeJS bridge ships, the handler will:
|
||||
* 1. Read player.persistentData.bnsTier (the KubeJS-owned NBT)
|
||||
* 2. Sum Numismatics coin slots into a spurs total
|
||||
* 3. Send a TierStateUpdatePacket back to the same player
|
||||
*
|
||||
* For now the handler just logs the request — proves the wire works.
|
||||
*/
|
||||
public record RequestTierStatePacket() implements CustomPacketPayload {
|
||||
public static final Type<RequestTierStatePacket> TYPE = new Type<>(
|
||||
ResourceLocation.fromNamespaceAndPath(BnsToolkit.MOD_ID, "request_tier_state"));
|
||||
|
||||
public static final StreamCodec<RegistryFriendlyByteBuf, RequestTierStatePacket> STREAM_CODEC =
|
||||
StreamCodec.unit(new RequestTierStatePacket());
|
||||
|
||||
@Override
|
||||
public Type<? extends CustomPacketPayload> type() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public static void handle(RequestTierStatePacket pkt, IPayloadContext ctx) {
|
||||
ctx.enqueueWork(() -> {
|
||||
// TODO(matt M1): read NBT + Numismatics balance, reply with TierStateUpdatePacket
|
||||
BnsToolkit.LOG.info("[bnstoolkit/net] RequestTierState from {}", ctx.player().getName().getString());
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package uk.sijbers.bnstoolkit.network.s2c;
|
||||
|
||||
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.minecraft.resources.ResourceLocation;
|
||||
import net.neoforged.neoforge.network.handling.IPayloadContext;
|
||||
import uk.sijbers.bnstoolkit.BnsToolkit;
|
||||
|
||||
/**
|
||||
* Server -> client: pushes the player's current civic tier (1..13) and
|
||||
* spurs balance.
|
||||
*
|
||||
* Sent in response to {@code RequestTierStatePacket} AND unsolicited
|
||||
* whenever either value changes server-side (so the HUD updates in real
|
||||
* time without polling).
|
||||
*
|
||||
* TODO(matt M1): client handler will cache the values in a static slot
|
||||
* read by {@link uk.sijbers.bnstoolkit.client.hud.SpurHud} and any open
|
||||
* screen.
|
||||
*/
|
||||
public record TierStateUpdatePacket(int tier, long spurs) implements CustomPacketPayload {
|
||||
public static final Type<TierStateUpdatePacket> TYPE = new Type<>(
|
||||
ResourceLocation.fromNamespaceAndPath(BnsToolkit.MOD_ID, "tier_state_update"));
|
||||
|
||||
public static final StreamCodec<RegistryFriendlyByteBuf, TierStateUpdatePacket> STREAM_CODEC =
|
||||
StreamCodec.composite(
|
||||
ByteBufCodecs.VAR_INT, TierStateUpdatePacket::tier,
|
||||
ByteBufCodecs.VAR_LONG, TierStateUpdatePacket::spurs,
|
||||
TierStateUpdatePacket::new);
|
||||
|
||||
@Override
|
||||
public Type<? extends CustomPacketPayload> type() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public static void handle(TierStateUpdatePacket pkt, IPayloadContext ctx) {
|
||||
ctx.enqueueWork(() -> {
|
||||
// TODO(matt M1): stash in a client-side state holder for HUD + screens.
|
||||
BnsToolkit.LOG.debug("[bnstoolkit/net] TierStateUpdate tier={} spurs={}", pkt.tier, pkt.spurs);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"key.category.bnstoolkit": "Brass and Sigil",
|
||||
"key.bnstoolkit.tier": "Open Tier Ladder",
|
||||
"key.bnstoolkit.bounties": "Open Bounty Board",
|
||||
"key.bnstoolkit.plots": "Open Plot Map",
|
||||
|
||||
"screen.bnstoolkit.tier_upgrade": "Civic Tier",
|
||||
"screen.bnstoolkit.bounty_board": "Bounty Board",
|
||||
"screen.bnstoolkit.quest_log": "Quest Log",
|
||||
"screen.bnstoolkit.plot_purchase": "Plots",
|
||||
"screen.bnstoolkit.shop_browser": "Bazaar"
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"pack": {
|
||||
"description": "Brass and Sigil Toolkit resources",
|
||||
"pack_format": 34
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
modLoader="javafml"
|
||||
loaderVersion="${loader_version_range}"
|
||||
license="${mod_license}"
|
||||
issueTrackerURL="http://10.16.5.102:3000/minecraft/bnstoolkit/issues"
|
||||
|
||||
[[mods]]
|
||||
modId="${mod_id}"
|
||||
version="${mod_version}"
|
||||
displayName="${mod_name}"
|
||||
authors="matt (sijbers.uk)"
|
||||
description='''
|
||||
Brass and Sigil Toolkit — companion mod for the BNS modpack. Provides
|
||||
in-game UI for the KubeJS-driven civic tier, bounty, plot, and shop
|
||||
systems. Pure client visuals + thin C2S/S2C bridge over the existing
|
||||
server-side state.
|
||||
'''
|
||||
|
||||
[[dependencies.${mod_id}]]
|
||||
modId="neoforge"
|
||||
type="required"
|
||||
versionRange="[${neo_version},)"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
||||
|
||||
[[dependencies.${mod_id}]]
|
||||
modId="minecraft"
|
||||
type="required"
|
||||
versionRange="${minecraft_version_range}"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
||||
Reference in New Issue
Block a user