Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Hi, I need some help with the mod that im making,


I am making a Team system mod for my serrver, and i want it to make a team and save it to the servers world.

I'm still a beginner with writing mods, so i read the docs, but those were quite unclear for me....

Here is whatt i have:

Team.java

package austizz.ultimate_team_mod;

import net.minecraft.world.entity.player.Player;

import java.util.List;
import java.util.UUID;

public class Team {
private UUID id;
private String teamName;
private Player teamLeader;
private List<Player> teamMembers;
private List<UUID> teamEnemy;
private List<UUID> teamAlly;


public Team(String teamName, Player teamLeader, List <Player> teamMembers, List<UUID> teamEnemy, List<UUID> teamAlly) {
this.id = UUID.randomUUID();
this.teamName = teamName;
this.teamLeader = teamLeader;
this.teamMembers = teamMembers;
this.teamEnemy = teamEnemy;
this.teamAlly = teamAlly;
}

public UUID getId() {
return id;
}
public String getTeamName() {
return teamName;
}

public Player getTeamLeader() {
return teamLeader;
}

public List<Player> getTeamMembers() {
return teamMembers;
}

public List<UUID> getTeamEnemy() {
return teamEnemy;
}

public List<UUID> getTeamAlly() {
return teamAlly;
}
}

SaveData.java

package austizz.ultimate_team_mod;

import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.entity.player.Player;

import java.util.List;
import java.util.UUID;

public class SaveData {

public Team create(String teamName, Player teamLeader, List <Player> teamMembers, List <UUID> teamEnemy, List <UUID> teamAlly) {
return new Team( teamName, teamLeader, teamMembers, teamEnemy, teamAlly);
}

public Team load(CompoundTag tag) {
Team data = this.create();
// Load saved data
return data;
}

// In some method within the class
Team.computeIfAbsent(this::load, this::create, "example");
}


Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.