Jump to content

[1.15.2] How do I set multiple match_tool conditions in .json file


calviebihhh

Recommended Posts

I'm trying to figure out how I setup a loot table json file for a block to drop a different type of block if the player breaks it with any of the swords (stone, diamond, etc) however it seems I'm only limited to testing if 1 type of item for example a stone sword specifically is being used and I've been struggling to figure out how to do it for all the tiers of swords I can tell this is really simple to do but information is hard to find.

Any help or ideas would be much appreciated

Here's the code:

{
  "type": "minecraft:block",
  "pools": [
    {
	  "name": "pool1",
      "rolls": 1,
      "entries": [
        {
          "type": "minecraft:alternatives",
          "children": [
            {
              "type": "minecraft:item",
              "conditions": [
                {
                  "condition": "minecraft:match_tool",
                  "predicate": {
                    "item": "minecraft:wooden_sword",
					"item": "minecraft:stone_sword"
                  }
                }
              ],
              "name": "candyworld:cakegrass_block"
            },
            {
              "type": "minecraft:item",
              "conditions": [
                {
                  "condition": "minecraft:survives_explosion"
                }
              ],
              "name": "candyworld:cakemud_block"
            }
          ]
        }
      ]
    }
  ]
}

 

Edited by calviebihhh
Link to comment
Share on other sites

Well, for one, you can't have two objects with the same key. So your attempt to name two items doesn't make any sense.

For two, conditions is an array.

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

Yes.

However, be aware that the default is that all conditions must be true in order for the check to pass. If you want an OR logic operator, you need to declare that too.

Edited by Draco18s

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

I've been trying to figure out how to declare an OR logic operator in a loot table online but there's no info about it on any json syntax sites or minecraft/forge documentations and nothing I can find in the source files to reference

 

Edit: I've figured out a way of getting the mod to do what I want though still not sure about the OR logic operator you mentioned but it seems to be working now thank you here's some code for anyone who might be confused about the same problem 

 

          "type": "minecraft:alternatives",
          "children": [
            {
              "type": "minecraft:item",
              "conditions": [
                {
                  "condition": "minecraft:match_tool",
                  "predicate": {
    				"item": "minecraft:stone_sword"
						
                  }		  
                }
              ],
              "name": "candyworld:cakegrass_block"
            },
			{
              "type": "minecraft:item",
              "conditions": [
                {
                  "condition": "minecraft:match_tool",
                  "predicate": {
    				"item": "minecraft:diamond_sword"
						
                  }		  
                }
              ],
              "name": "candyworld:cakegrass_block"
            }

 

Edited by calviebihhh
Solved issue
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
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.



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Issue with giacomos_foundry, check you have the latest version then contact the mod author.
    • Heya, so i was running atm8 through curseforge end of last year and connecting to servers fine, i have recently returned to it and now i cant login into the authentication servers no matter what i try. everything is updated and running fine i just cant login to authenticate.  i can run normal vanilla minecraft and go into servers fine with no issues it just seems to be the atm8 auth issue.  here is my latest log file im hoping someone can help me figure out what is causing this issue or give me some things to try as ive tried multiple things on several sites but nothing has fixed the issue. my internet connect is fine i have no issues with anything apart from this game, my friend who lives 15mins drive from me in the same state of Australia can get it working on his pc but i cant seem to. any advice would be great this has frustrated me greatly. i can provide more of the logs if required 19:42:23.342 [19:42:23] [Render thread/INFO] [mojang/YggdrasilAuthenticationService]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', servicesHost='https://api.minecraftservices.com', name='PROD' 19:42:28.554 [19:42:28] [Render thread/ERROR] [minecraft/Minecraft]: Failed to verify authentication 19:42:28.554 com.mojang.authlib.exceptions.AuthenticationException: com.mojang.authlib.exceptions.MinecraftClientException: Failed to read from https://api.minecraftservices.com/player/attributes due to Connect timed out 19:42:28.554 at com.mojang.authlib.exceptions.MinecraftClientException.toAuthenticationException(MinecraftClientException.java:28) ~[authlib-3.11.49.jar%23122!/:?] {} 19:42:28.554 at com.mojang.authlib.yggdrasil.YggdrasilUserApiService.fetchProperties(YggdrasilUserApiService.java:159) ~[authlib-3.11.49.jar%23122!/:?] {} 19:42:28.554 at com.mojang.authlib.yggdrasil.YggdrasilUserApiService.<init>(YggdrasilUserApiService.java:55) ~[authlib-3.11.49.jar%23122!/:?] {} 19:42:28.554 at com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService.createUserApiService(YggdrasilAuthenticationService.java:161) ~[authlib-3.11.49.jar%23122!/:?] {} 19:42:28.555 Caused by: com.mojang.authlib.exceptions.MinecraftClientException: Failed to read from https://api.minecraftservices.com/player/attributes due to Connect timed out 19:42:28.555 at com.mojang.authlib.minecraft.client.MinecraftClient.readInputStream(MinecraftClient.java:93) ~[authlib-3.11.49.jar%23122!/:?] {} 19:42:28.555 at com.mojang.authlib.minecraft.client.MinecraftClient.get(MinecraftClient.java:48) ~[authlib-3.11.49.jar%23122!/:?] {} 19:42:28.555 at com.mojang.authlib.yggdrasil.YggdrasilUserApiService.fetchProperties(YggdrasilUserApiService.java:129) ~[authlib-3.11.49.jar%23122!/:?] {}
    • i dont really know what happened pls help the report is in the spoiler
    • Quick update on this. I tried to setup Forge locally to made the change myself, but ran into some issues described here (which I hope to fix, so any help would be much appreciated). So I did something different: I cloned the MutableHashedLinkedMap inside my project and then "clone" the vanilla map entries to my object. Inside my object I removed the null assignments and that seems to fix the issue. If I remove all paintings and then iterate over the leftover entries the breakpoint inside the check for a painting is never hit, which is what I expect. If I apply a filter to exclude only the modded variants, the breakpoint is hit only for the vanilla ones. So it seems that is just that null assignments on both previous and next that breaks the iterator. This is how I debugged using my own local class   if(tab.equals(CreativeModeTabs.FUNCTIONAL_BLOCKS)) { org.blazers.MutableHashedLinkedMap<ItemStack, CreativeModeTab.TabVisibility> test = new org.blazers.MutableHashedLinkedMap<ItemStack, CreativeModeTab.TabVisibility>(ItemStackLinkedSet.TYPE_AND_TAG); event.getEntries().forEach(entry -> test.put(entry.getKey(), entry.getValue())); var iterator = test.iterator(); ArrayList<ItemStack> itemsToRemove = new ArrayList<>(); while (iterator.hasNext()) { ItemStack stack = iterator.next().getKey(); if(stack.is(Items.PAINTING)) { itemsToRemove.add(stack); } } itemsToRemove.forEach(test::remove); var iterator2 = test.iterator(); while (iterator2.hasNext()) { ItemStack stack = iterator2.next().getKey(); if(stack.is(Items.PAINTING)) { LOG.info(stack + " " + stack.getOrCreateTag()); } } } I'm submitting a PR now that I know that removing those null assignments fixes this, hopefully that's really what it needs to solve it
    • i created a modpack for 1.12.2 with about 60 mods and im using the same forge 1.12.2 and optifine. I only have this problem that every time I start the game with optifine in the loading stage "Loading Initializing Minecraft Engine (3/7)" "Rendering Setup - Loading Model Manager (3/5) 1/1) "the game simply freezes and continues the loading process extremely slowly, taking 40 minutes to finish and return the normal loading process and if I interact with anything else or click on the game it stops responding and does not load anymore. I have tried reinstalling forge, reinstalling java, reinstalling minecraft itself and nothing has seemed to fix this issue. my pc specs are: Intel Core i5-4210U Intel HD Graphics 4400 12GB DDR3 Memory HDD 256GB Please help as i want to play with this modpack Latest log: https://pastebin.com/D61sVWGU
  • Topics

×
×
  • Create New...

Important Information

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