Jump to content

[1.7.10] Help me develop my mod: Inventory Rules


caramba2654

Recommended Posts

Hello!

 

I'm coding my first mod, and I'd like some help to code it.

 

Here's what the mod is about:

 

INVENTORY RULES

 

Get random rules tagged to your player. If you follow them, you are rewarded. If you don't follow them... Let's say your life will become harder.

 

I'm developing this mod because I think it should be fun trying to follow rules like "Have 10 sticks in your inventory" or "Don;t have any items in the top row".

 

Anyways, as I said before, I need help coding it, because I'm a beginner programmer and I'm still getting the hang of things. I started following Pahimar's LetsModReboot tutorials, but I'm too impatient to wait and let him finish it. :v

 

So here's the source code: https://github.com/caramba2654/Inventory-Rules

 

What I need to do to get this thing going is:

 

1. Setup a keybind that opens the "Player Active Rules" PAR menu.

2. Have two items.

    a. Rule Card: Contains the rule. GUI explaining the rule (just like written books sorta)

    b. Rule Creator: Creates rules. May be used for debugging only, but it's needed. Would be nice if it had a GUI.

3. Be able to put a Rule Card inside the PAR and activate a potion effect (for now, crazier stuff is coming in the future)

 

I'm stuck on the "create rule" part. I want to be able to create a rule and assign it to a Rule Card using NBT, which will be read to determine the events that will happen to the player. The things I need as Rules components are:

 

1. Rule Type

2. Rule Creator

3. Rule Array of ItemStacks (can be a single ItemStack for now)

4. A random number [1;64]

5. A random number [1;4]

6. A random number [1;9]

7. Rule Good Consequences

8. Rule Bad Consequences

 

For now I'm just working with 1,2,3,4,5,6 because I think it's easier. I need to get Rules working before I can get them to do something, right?

 

So, can anyone help me on that? I'll answer any questions you might have about this.

Link to comment
Share on other sites

Unfortunately we don't write mods for you here.

This is a forum to help people with coding problem that find their origin in forge/minecraft related code.

In fact, seeing things like this makes me even more reluctant to post any bits of code I would normally do.

 

I started following Pahimar's LetsModReboot tutorials, but I'm too impatient to wait and let him finish it. :v

 

I realise it is a long tutorial but there are plenty of other tutorials on video, text or forums about all sorts of topics.

 

To answer your question you posted below this but without writing code:

I'd suggest dividing your 'rules'(or item that contains the rules) in to several subrules.

1. Rules that have application to having items in inventory -> you can just check the players inventory for that

2. Rules that have to do with crafting items -> you can just use a craftinghandler for that.

3. Rules to do with breaking or placing blocks -> check what is in front of player or something like that

4. Etc.

 

As for your little list. Just check when the item is actived and whether an item is allready assigned to someone or not.

E.g. You really don't know how to make a (semi) random number? This is not a java class. Go to google and type Random number between two values

 

And I have already given you a lot more than you deserve for that kind of post.

 

EDIT: I realise I sound, inadvertent, a bit rude here but I hope you understand writing a mod isn't so simple as having someone write

the mod for you. The people here are all people working on or having their own mods or working on forge itself. People here just offer help because of various reasons such as wanting to help people, return the favour etc.

 

Let me clarify a bit what you're trying to do with a simple example. You're walking in the middle of NY of a hot summer day and you come across times square. It is jampacked with people but you need to know the way to some place. What someone here would do is ask that person politely how to get there. And yes, sometimes that person would have to explain us how to walk(because not everyone  asking here knows java, sadly). But you are walking to a random person you don't know and say, "Please guide me to this location. You won't get anything from it and you'll waste a lot of time but guide me anyway."

 

So next time, think a bit about a logical problem before you give up on it. And don't even start with the "help developing with".

Link to comment
Share on other sites

Well, first of all, I didn't ask for you guys to code the mod for me. And I'm sorry if I sounded like it.

 

What I wanted was just some tips that would help me structure my code better because, as I explained before, I'm a beginner modder and, therefore, I need to know if the practices I'm doing are good practices or not. I wouldn't want to become a known modder like KingLemming, cpw, or others, and have bad habits in coding. And I think neither would other people.

 

I'd suggest dividing your 'rules'(or item that contains the rules) in to several subrules.

1. Rules that have application to having items in inventory -> you can just check the players inventory for that

2. Rules that have to do with crafting items -> you can just use a craftinghandler for that.

3. Rules to do with breaking or placing blocks -> check what is in front of player or something like that

4. Etc.

 

That bit of you post was exactly what I was expecting to read. I didn't want (or need) code because I can simply look up tutorials online. I'm after the concepts rather than the hard code. If I had any problems with, say, checking the block in front of the player, THEN I'd ask for hard code. But for now, all I need is some feedback on whether my coding is going in the right direction or not.

 

And, again, I apologize if I sounded like I wanted people to code my mod for me.  Because of personal reasons, I kinda have a hard time expressing my opinions and thought processes. It's okay,  though. I didn't tell you that before, so I think I have a little bit of fault in this, eh?

Link to comment
Share on other sites

Well, I do sound quite harsh in a lot of cases so ... I guess I'm partly at fault as well.

 

In any case, do you know the newly 'hot topic' Hard Mode Questing mod?

It does just about what you want to do except it doesn't set the rules in game but rather before hand.

The quests there are divided in:

 

1. Craft an item or number of certain items or liquids

2. Have a number of certain items in your inventory

3. Submit, e.g. it gets deleted from the inventory, a certain item or liquid.

 

So I suggest having a look around in that mod.

Link to comment
Share on other sites

Well, I do sound quite harsh in a lot of cases so ... I guess I'm partly at fault as well.

 

In any case, do you know the newly 'hot topic' Hard Mode Questing mod?

It does just about what you want to do except it doesn't set the rules in game but rather before hand.

The quests there are divided in:

 

1. Craft an item or number of certain items or liquids

2. Have a number of certain items in your inventory

3. Submit, e.g. it gets deleted from the inventory, a certain item or liquid.

 

So I suggest having a look around in that mod.

 

Hm... That is a good idea. Thanks for the suggestion!

 

 

Now I just need to figure out why my block GUI isn't working so that I can continue to implement the Rule system. :v

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.