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.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • While living in Copenhagen, I became deeply involved in a vibrant local crypto community. The energy was palpable; people were passionate about the potential of blockchain technology and the myriad of opportunities it offered. I was initially skeptical but soon found myself captivated by the discussions surrounding various cryptocurrencies. After much deliberation, I decided to invest 4,000 DKK in Dogecoin, motivated by both the community's enthusiasm and the coin’s unique charm as a meme-driven currency. To my astonishment, my investment blossomed into a staggering 100,000 DKK within a few months. The thrill of watching my investment grow was exhilarating, and I felt a sense of belonging and achievement among my peers. However, as the community grew, so did the differences in opinion about the direction of our projects and investments. I found myself caught in a heated disagreement with a prominent member regarding strategic decisions, which escalated tensions within the group. Things took a turn for the worse when, following this disagreement, I was locked out of my email account. This was more than just a mere inconvenience; it felt like a nightmare unfolding. My email was the gateway to my crypto assets and exchanges, and without access, I was paralyzed. I frantically attempted to regain control but found myself hitting dead ends. The thought of losing my investment sent waves of anxiety through me. Desperate for a solution, I reached out to friends in the community, hoping they could offer guidance. To my relief, several members were sympathetic to my plight and shared their experiences of similar challenges. One name kept surfacing: ADRIAN LAMO HACKER. I Consult ADRIAN LAMO HACKER Via email: Adrianlamo@ consultant. com / Telegram: @ADRIANLAMOHACKERTECH they also have an active Whats App: ‪+1 (90 9) 73 9‑0 2 69‬ It was touted as a reliable service for recovering compromised accounts, and I was eager to give it a try. With their swift assistance, I provided the necessary information, and the team quickly went to work. They were professional and responsive, keeping me updated throughout the process. Within a short period, I received the long-awaited notification that my email account had been restored. A wave of relief washed over me; I could finally access my assets and continue participating in the community. Regaining control not only allowed me to protect my investment but also reinforced the importance of security in the crypto space. It served as a valuable lesson about the risks and challenges inherent in this rapidly evolving world. With newfound confidence, I re-engaged with the community, more vigilant than ever about safeguarding my digital assets.
    • As the title says, I'm trying to install Forge on Linux. Whenever I load up the installer, and let it run, I end up getting an error that says: "Processor failed, invalid outputs:" Then, it shows the .jar file I used for the installer, and some codes that don't make any sense to my pea-sized brain. All I can tell however, is that they're different and they aren't supposed to be. (Mostly because it tells me.) I don't know how to fix this, and I've encountered this for every file I've tried so far.
    • Descargo un mod y luego, en archivo jar, lo mando a la carpeta "mods" en minecraft, pero al entrar a minecraft forge no me aparecen los mods por ningun lado, si pongo un mod incompatible me sale un error pero no me aparecen los demas mods, ¿Que puedo hacer?  
    • Descargo un mod y luego, en archivo jar, lo mando a la carpeta "mods" en minecraft, pero al entrar a minecraft forge no me aparecen los mods por ningun lado, si pongo un mod incompatible me sale un error pero no me aparecen los demas mods, ¿Que puedo hacer?  
  • Topics

×
×
  • Create New...

Important Information

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