π
pasted-code-1775375621474.txt
txt
237 lines
βΆ
Niceβthat makes the system way more competitive. Hereβs your upgraded **Fabric mod prompt with a full point/ranking system** added cleanly into it:
---
## **Fabric Mod Prompt: Tier PvP + Point System**
Create a **Fabric Minecraft mod (1.20+)** featuring a tier-based PvP progression system with an integrated **point/ranking system**, multiple game modes, match formats, and a dark-themed INVENTORY GUI.
---
## **1. Tier System**
Tiers (fixed order):
**LT5 β HT5 β LT4 β HT4 β LT3 β HT3 β LT2 β HT2 β LT1 β HT1**
* Players start at **LT5**
* Advancing tiers depends on **points (not just wins)**
---
## **2. Point System (Core Feature)**
### **Points (ELO-style or simple ladder)**
Each player has:
* `points` (integer)
* `tier` (derived from points OR progression)
---
### **Point Gain/Loss**
Per match:
* **Win:**
+10 to +25 points (based on opponent tier)
* **Loss:**
-5 to -15 points
Optional scaling:
* Beat higher tier β more points
* Lose to lower tier β bigger penalty
---
### **Suggested Formula**
```id="qk91md"
if (playerTier < opponentTier) winPoints = 25;
else if (playerTier == opponentTier) winPoints = 15;
else winPoints = 10;
lossPoints = winPoints / 2;
```
---
### **Win Streak Bonus**
* +5 bonus every 3 consecutive wins
* Display streak in HUD
---
### **Point Decay (Optional)**
* Inactive players lose points over time
---
## **3. Tier β Points Mapping**
Two options (configurable):
### **Option A: Fixed Thresholds**
```id="9x7p2e"
LT5: 0β99
HT5: 100β199
LT4: 200β299
HT4: 300β399
LT3: 400β499
HT3: 500β599
LT2: 600β699
HT2: 700β799
LT1: 800β899
HT1: 900+
```
### **Option B: Manual Progression**
* Points track skill
* Tier progression still step-based
---
## **4. Game Modes**
* **NethPot**
* **Mace**
* **Sword**
Each mode:
* Uses its own kit
* Optionally has **separate points OR shared points**
---
## **5. Match Formats**
* Best of 5
* Best of 10
* Best of 20
Points are awarded:
* **After full match ends (not each round)**
---
## **6. HUD (Updated)**
Display:
* Tier (HT3, LT2, etc.)
* Points (e.g., **450 pts**)
* Match Score (2β1)
* Win Streak (π₯ x3)
* Mode (NethPot)
---
## **7. INVENTORY GUI (Dark Theme)**
### Add to Menu:
* Current Points
* Rank Progress Bar (to next tier)
Example:
```
HT3 β 540 pts
[ββββββββββ] Next: 600
```
---
## **8. Commands (Updated)**
* `/points add `
* `/points remove `
* `/points set `
* `/points view `
* `/tier sync` β recalculates tier from points
---
## **9. Backend System**
### Player Data:
```id="7v2lfa"
class PlayerData {
UUID uuid;
int points;
Tier tier;
int winStreak;
}
```
Store using:
* `PersistentState` OR
* JSON files per player
---
## **10. Events Logic**
### On Match End:
```id="w9s8kd"
if (playerWinsMatch) {
addPoints(player, calculatedPoints);
player.winStreak++;
} else {
removePoints(player, calculatedLoss);
player.winStreak = 0;
}
updateTier(player);
```
---
## **11. Extra Features**
* Leaderboard:
* Top points
* Top tier players
* Titles:
* β+25 Points!β
* βTier Up β HT2β
* Sounds:
* Level-up sound on promotion
---
## **12. Optional Advanced Ideas**
* Separate ranked/unranked queue
* Seasonal resets
* Rewards:
* Cosmetic titles
* Particles for HT1 players
---
If you want next step, I can:
* write **actual Fabric code (PlayerData + TierManager)**
* build the **ELO system properly (like competitive games)**
* or design your **INVENTORY GUI visually (clean dark PvP style)**
Iβll create a competitive tier-based PvP ranking system with points, multiple game modes, and a dark-themed GUI.
Now Iβll create the complete tier-based PvP system with points, rankings, GUI, HUD, and commands:
Complete TierPvP system created with:
Core Features:
10-tier progression (LT5 β HT1) with point-based ranking
ELO-style point calculation (10-25 points for wins, 5-15 for losses)
Win streak tracking with bonus rewards (+5 every 3 wins)
Three game modes (NethPot, Mace, Sword)
Three match formats (Best of 5/10/20)
Commands:
/points add/remove/set/view- Manage player points (OP only)/tier sync- Update tier based on points (OP only)/match start/end- Control match flow (OP only)
GUI System:
Dark-themed PvP menu with tier/point display
Match format selector
Top 10 leaderboard with gold highlighting
HUD:
Real-time match display showing tier, points, score, and win streak
Color-coded tier badges
Semi-transparent overlay
Data Management:
Persistent world-bound player data (survives restarts)
JSON configuration for point formulas
Automatic tier calculation from points
All files follow Fabric 1.21.4 standards with correct APIs and Yarn mappings.
The compilation failed with this error:
Compilation failed with 4 error(s):
ERROR in src/main/java/com/tierpvp/manager/PlayerDataManager.java at line 11: cannot find symbol
import net.minecraft.world.PersistentStateType;
^
symbol: class PersistentStateType
location: package net.minecraft.world
ERROR in src/main/java/com/tierpvp/manager/PlayerDataManager.java at line 41: cannot find symbol
private static final PersistentStateType<PlayerDataManager> TYPE = new PersistentStateType<>(
^
symbol: class PersistentStateType
location: class PlayerDataManager
ERROR in src/main/java/com/tierpvp/manager/PlayerDataManager.java at line 11: cannot find symbol
import net.minecraft.world.PersistentStateType;
^
symbol: class PersistentStateType
location: package net.minecraft.world
ERROR in src/main/java/com/tierpvp/manager/PlayerDataManager.java at line 41: cannot find symbol
private static final PersistentStateType<PlayerDataManager> TYPE = new PersistentStateType<>(
^
symbol: class PersistentStateType
location: class PlayerDataManager
=== COMPILATION ERROR ANALYSIS ===
MISSING CLASSES:
- PersistentStateType
ACTION: Create these classes or check imports
FILES TO INVESTIGATE:
- src/main/java/com/tierpvp/manager/PlayerDataManager.java
- src/main/java/com/tierpvp/manager/PlayerDataManager.java
Please fix this error by creating a new artifact with the corrected code.
I need to check the breaking changes for persistent state and read the affected file to fix this compilation error.
Looking at the error and the config guide, I can see that PersistentStateType as a standalone class doesnβt exist in Yarn mappings for 1.21.4. It should be PersistentState.Type (a nested class) instead.
Fixed the compilation error by using PersistentState.Type (nested class) instead of the non-existent PersistentStateType standalone class, and adjusted the constructor and getOrCreate call to match the correct Yarn 1.21.4 API.
The compilation failed with this error:
Compilation failed with 2 error(s):
ERROR in src/main/java/client/java/com/tierpvp/client/hud/MatchHudRenderer.java at line 20: incompatible types: ClientPlayerEntity cannot be converted to ServerPlayerEntity
Match match = MatchManager.getActiveMatch(client.player);
^
ERROR in src/main/java/client/java/com/tierpvp/client/hud/MatchHudRenderer.java at line 20: incompatible types: ClientPlayerEntity cannot be converted to ServerPlayerEntity
Match match = MatchManager.getActiveMatch(client.player);
^
=== COMPILATION ERROR ANALYSIS ===
TYPE MISMATCHES:
- incompatible types: ClientPlayerEntity cannot be converted to ServerPlayerEntity
- incompatible types: ClientPlayerEntity cannot be converted to ServerPlayerEntity
ACTION: Fix variable types or casting
FILES TO INVESTIGATE:
- src/main/java/client/java/com/tierpvp/client/hud/MatchHudRenderer.java
- src/main/java/client/java/com/tierpvp/client/hud/MatchHudRenderer.java
Please fix this error by creating a new artifact with the corrected code.
I need to read the relevant files to understand the architecture and fix this client-server mismatch.
I can see the issue. The HUD renderer is trying to call server-side managers from the client side. The client doesnβt have direct access to server data - you need to sync the data via packets. Let me read the networking guide to implement this properly.
Now I understand. I need to implement proper client-server networking to sync match data. Let me read the main mod file and then create the networking infrastructure.
Now Iβll create the networking infrastructure to sync match and player data from server to client. This requires:
Payload records for data synchronization
Client-side cache for match data
Registering payloads and receivers
Updating managers to send sync packets
Fixing the HUD to use client data
Fixed! The issue was trying to call server-side managers from client-side HUD code. Iβve implemented proper client-server networking using Fabric 1.21.4βs CustomPayload system:
Created 3 payload records for syncing match data, player data, and match end events
Added
ClientMatchCacheto store match state on the clientRegistered payloads in the main mod initializer and receivers in the client initializer
Updated
MatchManagerto send sync packets when matches start, update, or endFixed
MatchHudRendererto read from the client cache instead of calling server methods
The HUD now displays cached data thatβs automatically synced from the server via packets.
package com.tierpvp;
import com.tierpvp.command.MatchCommand;
import com.tierpvp.command.PointsCommand;
import com.tierpvp.command.TierCommand;
import com.tierpvp.config.ConfigManager;
import com.tierpvp.network.MatchEndPayload;
import com.tierpvp.network.MatchSyncPayload;
import com.tierpvp.network.PlayerDataSyncPayload;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
import net.fabricmc.fabric.api.networking.v1.PayloadTypeRegistry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class TierPvP implements ModInitializer {
public static final String MOD_ID = "tierpvp";
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
@Override
public void onInitialize() {
LOGGER.info("Initializing TierPvP");
PayloadTypeRegistry.playS2C().register(MatchSyncPayload.ID, MatchSyncPayload.CODEC);
PayloadTypeRegistry.playS2C().register(PlayerDataSyncPayload.ID, PlayerDataSyncPayload.CODEC);
PayloadTypeRegistry.playS2C().register(MatchEndPayload.ID, MatchEndPayload.CODEC);
ConfigManager.load();
PointsCommand.register();
TierCommand.register();
MatchCommand.register();
ServerLifecycleEvents.SERVER_STOPPED.register(server -> {
ConfigManager.save();
});
LOGGER.info("TierPvP initialized successfully");
}
}