Jump to content

how do i make a ID list in a text file and how do i make an other file to log in


dark2222

Recommended Posts

my first question is how do i make a ID list in a text file players can go in and change? (adding or removing ID's)

 

my second question is how do i make an other file my mod can write stuff in? (like the FML log)

 

EDIT-

maybe can a bit more info of my mod idea help.

 

my mod idea is to have a server-side (or universal that depends on if im gonna need some client info) and what the mod is checking if any blocks placed match a ID list (that's where the first question come in) and if the block match it will write/log time, player name, what block, maybe cords.

Link to comment
Share on other sites

It's called a config file.

 

Configuration config = new Configuration(event.getSuggestedConfigurationFile());
        config.load();
        int fogID = config.getBlock("Fog", 1549).getInt();
    config.save();

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

It's called a config file.

 

Configuration config = new Configuration(event.getSuggestedConfigurationFile());
        config.load();
        int fogID = config.getBlock("Fog", 1549).getInt();
    config.save();

 

for the ID list?

EDIT-

sorry are new to config files :|

EDIT-

just tried add that code but i can't find  event.getSuggestedConfigurationFile()

Link to comment
Share on other sites

event

has to be your

FMLPreInitializationEvent

.

thanks the config file works but do you now how i can make a ID list of in-game stuff that i don't add?

 

example if i want to now when players place a quarry from buildcraft i want just to put the quarry ID in a file (maybe make a id list in the config file?) 

Link to comment
Share on other sites

what do you mean?

You can't store information about a world in your config file as the config file is for general stuff like block ids. These don't change between worlds.

But the quarry id is an information which is bound to the world, so you can't store it in the config (there is only ever ONE config file, not one per world).

 

So you have to use the WorldSavedData class, which allows you to save additional arbitrary data to the world save.

so with a WorldSavedData class can i make a ID List that is changeable for server host's and maybe ops using commands?

EDIT-

Sorry if i sound like a big noob never made a mod that did this before

Link to comment
Share on other sites

No, that is not the purpose of that class.

Please explain in more detail what you want to do.

what i want to do is make a mod that can say/log when a player place a specific block.

i don't now else how to explain it more so i am gonna tell how i got the mod idea.

 

I was in a teamspeak server one day and they had some tps/server lag and they found out that 2 quarry's what overflowing  and the admin didn't now who's quarry's it was so i though that it cud be allot easier if he cud type a command and see who place it, where he placed it (cords), when he placed and what he placed.

that's about it i don't now how else to say it :)

Link to comment
Share on other sites

That is not an easy task as there

a) are a lot of blocks being placed => Thats a shit-ton of data

b) no BlockPlaceEvents in forge

 

And also: there are already Bukkit plugins which do this far better than anything you can quickly create in forge (LogBlock of the top of my head, not sure if thats still accurate, i havent had a bukkit server in ages).

a) if i made it universal cud i not then make the client sync with a ID List that the server have so instead of checking all blocks being placed the client will send a package when it place a block that match one of the ID's from the list?

 

b) i searched a bit around before posting this and i found PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK i may be able to detect it with that some way

 

and i now there are is bukkit plugins that are far betta then i can quickly make but who said it shall be a quick and easy mod? not all mods works on bukkit (if they even do, don't now).

and i wanna make a more advanced mods most bekos my last mod is alot basic stuff (just adding alot of stuff)

Link to comment
Share on other sites

a) if i made it universal cud i not then make the client sync with a ID List that the server have so instead of checking all blocks being placed the client will send a package when it place a block that match one of the ID's from the list?

It will still be a lot of data. And you shouldn't do stuff like that on the client, or your mod will be easily exploitable.

 

how can a mod that only log player name, when it happen, where it happen(cord maybe also dim) and what got placed be exploitable?

 

the only way i can see it as exploitable is that is tells the players cord for ops/admins

Link to comment
Share on other sites

how can a mod that only log player name, when it happen, where it happen(cord maybe also dim) and what got placed be exploitable?

I was talking about your intention of doing something on the client. The client can always be hacked, the server can't. Do as much as you can on the server.

ok that's nice to now but i actually set this project on pause until i now a bit more java and forge coding

 

so i am working on another mod and i have some problems with that (gui problems) and probably gonna make a post in modder support here for that soon :) (never added a GUI/tile entitiy/container before so having small problems)

 

EDIT-

never mind about that with making a new post found and fixed the problem

Link to comment
Share on other sites

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

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