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");
}
By
Austizz_TDS · Posted