ericgrandt / TotalEconomy

All in one economy plugin for Minecraft.
https://ericgrandt.github.io/TotalEconomy/
31 stars 33 forks source link

Trying to add material to jobset #347

Closed SeaDonkey81 closed 5 years ago

SeaDonkey81 commented 5 years ago

Sponge Version: 1.12.2-2768-7.1.5 Forge Version: 14.23.5.2814 Total Economy Version: 1.8.1

Description of issue

I am trying to add materials from other mods to the jobsets and i know i'm not doing it right. I tried using idtraits, and name:item _type, but nothing seems to be working on my end. Coud y'all give me some tips?

The mods I am using that add materials:

BaseMetals-1.12-2.5.0-beta5.214.jar DungeonTactics-1.12.2-0.15.9.jar NetherEx-1.12.2-2.0.8.jar rustic-1.1.0.jar TConstruct-1.12.2-2.12.0.135.jar

Related Configuration Files

https://gist.github.com/SeaDonkey81/be8135b00b7e0c095733c3f5be423460

MarkL4YG commented 5 years ago

Hey there :wave:

For breaking blocks, the steps would be:

  1. Determine the block id of the ore/block
  2. Determine whether or not multiple blocks exist with the same id. 2.1 If so, determine the id-traits of the blocks that should issue rewards (can be skipped if all of them should issue the same reward) (You can use the debug toggle command for this)
  3. Write them down! (It's good practice to have some place that is not a configuration file for oversight)
  4. Add the blocks without traits into the job sets
  5. Add the blocks with traits into the job sets but do not set a reward for them 5.1 Set the id-trait settings for those blocks 5.2 With the trait name as the configuration key, set the rewards.

You can see how this should look like with some vanilla blocks that are configured in the default sets.

I hope this helps you in a way.
If not, feel free to ask :slightly_smiling_face:

SeaDonkey81 commented 5 years ago

Would you mind giving me a visual example of the id-triats format? I tried using the idtriats and id-traits from another comment I had came across {I think you made it} a while back to someone else, but it kept throwing a closing error at the end of the entire config file when I never changed anything that far down.

SeaDonkey81 commented 5 years ago

I think I have the mining portion done correctly. It's the lumberjack part that was giving me issues when using idtraits.

MarkL4YG commented 5 years ago

Nowadays, both idTrait and "id-trait" should be accepted by TE due to some confusion during an earlier update.
However, if HOCON gives you issues about syntax, that's not up to us. You can use sites like HOCONLint to check your syntax before starting the server.
If you attach an updated gist, I can check it for errors too.

SeaDonkey81 commented 5 years ago

I updated the gist. It's the idtriat under lumberjack

MarkL4YG commented 5 years ago

Indentation really help you with these issues. At the moment, your configuration basically looks like this:

    lumberjackset {
        break {
            "minecraft:log2" {
                "id-trait"="variant"
                "variant" {
                    Acacia_Wood {
                        exp="20"
                        money=""
                    }
                    spruce_wood {
                        exp="15"
                        money=""
                    }
                    birch_wood {
                        exp="15"
                        money=""
                    }
                    jungle_wood {
                        exp="25"
                        money=""
                    }
                    acacia_wood {
                        exp="55"
                        money=""
                    }
                    dark_oak_wood {
                        exp="35"
                        money=""
                    }
                }
            } // <-- This is missing in your configuration.
        } // <-- This is missing too
        place {
            "minecraft:sapling" {
                exp="1"
                money=""
            }
        }
    }
...

If you try this with your configuration, it should be easier to spot missing braces.

SeaDonkey81 commented 5 years ago

I'm so confused right now. I don't see anything missing.

This works. (No errors) https://gist.github.com/SeaDonkey81/8004d855e0efad442e83320340a52d04

but this doesn't (String: 68: Expecting close brace } or a comma, got end of file) Some of the lines jumped out of wack when i made the git. https://gist.github.com/SeaDonkey81/04706bb1e82e2bfb7adb36e43fbbdc36

MarkL4YG commented 5 years ago

In the second one, you use the opening braces to open this path lumberjackset > break > minecraft:log2 > variant > acacia_Wood. And then close one brace which leaves the following second entry of minecraft:log2 in the variant context of the first entry because you are missing the closing brace of the variant and minecraft:log2 context. This is not what you want to do.
You want to add all variants of the block into the variant context of that block.

However, HOCON completely accepts this nesting as it is syntactically okay but fails to parse your file at the end when it notices the missing closing braces.

MarkL4YG commented 5 years ago

Think of each pair of { and } as a single context.

Contextually, the job sets configuration should look like this:

Each time you use { you go one level to the right (into) and each time you use } you go one level to the left (out of).

SeaDonkey81 commented 5 years ago

Thanks for all your help. It's working now.

MarkL4YG commented 5 years ago

Glad to hear that :+1:

SeaDonkey81 commented 5 years ago

I am having issues with jobsets for mining. Everything works like it's supposed to except the last entry for minecraft:stone. Is it still seeing that as part of the geolosys:ore variant? If so how do i break it up?

https://gist.github.com/SeaDonkey81/be8135b00b7e0c095733c3f5be423460

MarkL4YG commented 5 years ago

Yes, it is still seeing your entry of stone as a variant entry.
The entries are associated according to their position within the { and }s.
That means, you'll have to move the entry for stone within the pair of braces corresponding to the break key.
Also: A similar thing goes for the place action of your lumberjack set which needs to be next to - not inside - the break action.

SeaDonkey81 commented 5 years ago

Thank you, that fixed it.

MarkL4YG commented 5 years ago

@SeaDonkey81 You're welcome, glad to hear that 🙂

SeaDonkey81 commented 5 years ago

Added a new jobset "Digger", gaining exp and money was working fine until i tried to type /job, it then threw a null error and disconnected me with a timeout. I got the timing out fixed. I was missing a bracket, but i am still get the null error whenever i type /job. This only happens when i join the new digger job i added.

https://gist.github.com/SeaDonkey81/5604736487c25972deb2e37b9c8f1046

SeaDonkey81 commented 5 years ago

Farming only works on naturally spawn crops. I tried planting them myself, but I'm not receiving any exp or money.

MarkL4YG commented 5 years ago

That's because the current implementation of database support does not automatically adapt to new jobs. You'll need to alter the experience tables and add a column for that new job.

I'm very sorry for that. We have been planning on changing this for a while now but things always got in the way of a proper review and merge every time. I'm hoping that will change though..

SeaDonkey81 commented 5 years ago

What about the farming job and not gaining exp or money from planted crops? Is that just how it works?

MarkL4YG commented 5 years ago

Planted crops that grow should yield money and exp for harvests when a growth-trait is set.

Otherwise, they will be ignored by the exploit-protection for repeated placement and breaking of blocks.

SeaDonkey81 commented 5 years ago

Do i need to put a stage next to "age" in the script?

MarkL4YG commented 5 years ago

Euhh.. can you re-word that, please? I don't think I understand what you mean there 😅

SeaDonkey81 commented 5 years ago

"growthTrait": "age". Crops grow in stages. I was asking if i needed to put the stage of the growth for example "age_7". if that would even work.

MarkL4YG commented 4 years ago

No you don't need to. When the trait is called age you put age into the config. TotalEconomy will check what the maximum, current and minimum values are for the broken block and apply rewards based on the percentage of growth given.