Hiya. I'm trying to make my own version of one of those, server Land claiming mods.
I'm using forge. do I need to say that?
Right now I'm trying to think of how to assign X amount of land to X player so the game (mostly in the form of forge events) can setup reactions for the owner and other players.
I thought about how you can save info to items NBT and maybe I could do that with pre placed blocks and Chunks but apparently NBT is a thing that needs to be built into a thing and you can't add it after the fact? I'm not sure I find it very confusing.
So now the best idea I have is to make a lit of owned areas and pull up that list and check it during an event but that doesn't feel very optimal.....
So guess my question is, is the info I put in this post accurate? Is their no forge supported way to save some kin of "owner variable" to a chink or block. and is using a list checking system asking for lag?
Conceptually there are several ways to do this. Basically you need a way to mark locations and map them to players. It would be easiest of course if the areas were square as they could then be defined simply by two BlockPos locations.
Some obvious alternatives are:
1) create a map of players to areas and store that in world data
2) create area classes that include the owner as data and create a list of those areas and store that in world data
3) attach areas that include reference to the world/dimension and associate that to each player (maybe as capability) and store that with player data.
4) create some sort of marker block with tile entity, and have tile entity store the owner. Maybe everything within a certain range of the marker defines the area.
I'd probably do it the first way, especially if you wanted to mark the owned areas for other players even if they are signed out.
So imagine making a class called Area that takes in two BlockPos locations and stores them. Then create a map of player UUID to those area objects. Add areas with owners to the map as needed. Make sure that it saves and loads with the world data.
Thanks so much for the ideas! I might mediate on them and try and find the best combination of them to make the most effect use of them (plus what I can actually accomplish with my current skill level >_>)
I was doing research on tile entities while this post cooked and really like the claim block idea now that I understand it XD