Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Add Items in Vanilla LootTables in 1.14


DevTech
 Share

Recommended Posts

See this thread:

 

 

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

 

 

This is my simple_dungeon.json:

{
  "type": "minecraft:chest",
  "pools": [
    {
      "rolls": {
        "min": 1.0,
        "max": 3.0,
        "type": "minecraft:uniform"
      },
      "entries": [
        {
          "type": "minecraft:item",
          "weight": 20,
          "name": "element:magicessence"
        },
        {
          "type": "minecraft:item",
          "weight": 15,
          "name": "minecraft:golden_apple"
        },
        {
          "type": "minecraft:item",
          "weight": 2,
          "name": "minecraft:enchanted_golden_apple"
        },
        {
          "type": "minecraft:item",
          "weight": 15,
          "name": "minecraft:music_disc_13"
        },
        {
          "type": "minecraft:item",
          "weight": 15,
          "name": "minecraft:music_disc_cat"
        },
        {
          "type": "minecraft:item",
          "weight": 20,
          "name": "minecraft:name_tag"
        },
        {
          "type": "minecraft:item",
          "weight": 10,
          "name": "minecraft:golden_horse_armor"
        },
        {
          "type": "minecraft:item",
          "weight": 15,
          "name": "minecraft:iron_horse_armor"
        },
        {
          "type": "minecraft:item",
          "weight": 5,
          "name": "minecraft:diamond_horse_armor"
        },
        {
          "type": "minecraft:item",
          "weight": 10,
          "functions": [
            {
              "function": "minecraft:enchant_randomly"
            }
          ],
          "name": "minecraft:book"
        }
      ]
    },
    {
      "rolls": {
        "min": 1.0,
        "max": 4.0,
        "type": "minecraft:uniform"
      },
      "entries": [
        {
          "type": "minecraft:item",
          "weight": 10,
          "functions": [
            {
              "function": "minecraft:set_count",
              "count": {
                "min": 1.0,
                "max": 4.0,
                "type": "minecraft:uniform"
              }
            }
          ],
          "name": "minecraft:iron_ingot"
        },
        {
          "type": "minecraft:item",
          "weight": 5,
          "functions": [
            {
              "function": "minecraft:set_count",
              "count": {
                "min": 1.0,
                "max": 4.0,
                "type": "minecraft:uniform"
              }
            }
          ],
          "name": "minecraft:gold_ingot"
        },
        {
          "type": "minecraft:item",
          "weight": 20,
          "name": "minecraft:bread"
        },
        {
          "type": "minecraft:item",
          "weight": 20,
          "functions": [
            {
              "function": "minecraft:set_count",
              "count": {
                "min": 1.0,
                "max": 4.0,
                "type": "minecraft:uniform"
              }
            }
          ],
          "name": "minecraft:wheat"
        },
        {
          "type": "minecraft:item",
          "weight": 10,
          "name": "minecraft:bucket"
        },
        {
          "type": "minecraft:item",
          "weight": 15,
          "functions": [
            {
              "function": "minecraft:set_count",
              "count": {
                "min": 1.0,
                "max": 4.0,
                "type": "minecraft:uniform"
              }
            }
          ],
          "name": "minecraft:redstone"
        },
        {
          "type": "minecraft:item",
          "weight": 15,
          "functions": [
            {
              "function": "minecraft:set_count",
              "count": {
                "min": 1.0,
                "max": 4.0,
                "type": "minecraft:uniform"
              }
            }
          ],
          "name": "minecraft:coal"
        },
        {
          "type": "minecraft:item",
          "weight": 10,
          "functions": [
            {
              "function": "minecraft:set_count",
              "count": {
                "min": 2.0,
                "max": 4.0,
                "type": "minecraft:uniform"
              }
            }
          ],
          "name": "minecraft:melon_seeds"
        },
        {
          "type": "minecraft:item",
          "weight": 10,
          "functions": [
            {
              "function": "minecraft:set_count",
              "count": {
                "min": 2.0,
                "max": 4.0,
                "type": "minecraft:uniform"
              }
            }
          ],
          "name": "minecraft:pumpkin_seeds"
        },
        {
          "type": "minecraft:item",
          "weight": 10,
          "functions": [
            {
              "function": "minecraft:set_count",
              "count": {
                "min": 2.0,
                "max": 4.0,
                "type": "minecraft:uniform"
              }
            }
          ],
          "name": "minecraft:beetroot_seeds"
        }
      ]
    },
    {
      "rolls": 3,
      "entries": [
        {
          "type": "minecraft:item",
          "weight": 10,
          "functions": [
            {
              "function": "minecraft:set_count",
              "count": {
                "min": 1.0,
                "max": 8.0,
                "type": "minecraft:uniform"
              }
            }
          ],
          "name": "minecraft:bone"
        },
        {
          "type": "minecraft:item",
          "weight": 10,
          "functions": [
            {
              "function": "minecraft:set_count",
              "count": {
                "min": 1.0,
                "max": 8.0,
                "type": "minecraft:uniform"
              }
            }
          ],
          "name": "minecraft:gunpowder"
        },
        {
          "type": "minecraft:item",
          "weight": 10,
          "functions": [
            {
              "function": "minecraft:set_count",
              "count": {
                "min": 1.0,
                "max": 8.0,
                "type": "minecraft:uniform"
              }
            }
          ],
          "name": "minecraft:rotten_flesh"
        },
        {
          "type": "minecraft:item",
          "weight": 10,
          "functions": [
            {
              "function": "minecraft:set_count",
              "count": {
                "min": 1.0,
                "max": 8.0,
                "type": "minecraft:uniform"
              }
            }
          ],
          "name": "minecraft:string"
        }
      ]
    }
  ]
}

 

Edited by DevTech
Link to comment
Share on other sites

42 minutes ago, DevTech said:

How can i add Mod items in a LootTable, when i it do then is nothing in the chest :C 

Is there anything in the log? Probably about it not being able to find an item called "element:magicessence"

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

[Server-Worker-12/ERROR] [net.minecraft.client.resources.JsonReloadListener/]: Couldn't parse data file element:chests/simple_dungeons from element:loot_tables/chests/simple_dungeons.json
com.google.gson.JsonParseException: com.google.gson.stream.MalformedJsonException: Expected value at line 33 column 17 path $.pools[0].entries[0].functions[1].conditions[0].chance
    at net.minecraft.util.JSONUtils.fromJson(JSONUtils.java:359) ~[?:?]
    at net.minecraft.util.JSONUtils.fromJson(JSONUtils.java:398) ~[?:?]
    at net.minecraft.client.resources.JsonReloadListener.prepare(JsonReloadListener.java:51) ~[?:?]
    at net.minecraft.client.resources.JsonReloadListener.prepare(JsonReloadListener.java:22) ~[?:?]
    at net.minecraft.client.resources.ReloadListener.lambda$reload$0(ReloadListener.java:12) ~[?:?]
    at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1590) [?:1.8.0_221]
    at java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1582) [?:1.8.0_221]
    at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) [?:1.8.0_221]
    at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056) [?:1.8.0_221]
    at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692) [?:1.8.0_221]
    at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157) [?:1.8.0_221]
Caused by: com.google.gson.stream.MalformedJsonException: Expected value at line 33 column 17 path $.pools[0].entries[0].functions[1].conditions[0].chance
    at com.google.gson.stream.JsonReader.syntaxError(JsonReader.java:1559) ~[gson-2.8.0.jar:?]
    at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:590) ~[gson-2.8.0.jar:?]
    at com.google.gson.stream.JsonReader.peek(JsonReader.java:425) ~[gson-2.8.0.jar:?]
    at com.google.gson.internal.bind.TypeAdapters$29.read(TypeAdapters.java:716) ~[gson-2.8.0.jar:?]
    at com.google.gson.internal.bind.TypeAdapters$29.read(TypeAdapters.java:739) ~[gson-2.8.0.jar:?]
    at com.google.gson.internal.bind.TypeAdapters$29.read(TypeAdapters.java:731) ~[gson-2.8.0.jar:?]
    at com.google.gson.internal.bind.TypeAdapters$29.read(TypeAdapters.java:739) ~[gson-2.8.0.jar:?]
    at com.google.gson.internal.bind.TypeAdapters$29.read(TypeAdapters.java:731) ~[gson-2.8.0.jar:?]
    at com.google.gson.internal.bind.TypeAdapters$29.read(TypeAdapters.java:739) ~[gson-2.8.0.jar:?]
    at com.google.gson.internal.bind.TypeAdapters$29.read(TypeAdapters.java:731) ~[gson-2.8.0.jar:?]
    at com.google.gson.internal.bind.TypeAdapters$29.read(TypeAdapters.java:739) ~[gson-2.8.0.jar:?]
    at com.google.gson.internal.bind.TypeAdapters$29.read(TypeAdapters.java:731) ~[gson-2.8.0.jar:?]
    at com.google.gson.internal.bind.TypeAdapters$29.read(TypeAdapters.java:739) ~[gson-2.8.0.jar:?]
    at com.google.gson.internal.bind.TypeAdapters$29.read(TypeAdapters.java:714) ~[gson-2.8.0.jar:?]
    at com.google.gson.internal.bind.TypeAdapters$35$1.read(TypeAdapters.java:910) ~[gson-2.8.0.jar:?]
    at net.minecraft.util.JSONUtils.fromJson(JSONUtils.java:357) ~[?:?]
    ... 10 more

 

Link to comment
Share on other sites

2 minutes ago, DevTech said:

Caused by: com.google.gson.stream.MalformedJsonException: Expected value at line 33 column 17 path $.pools[0].entries[0].functions[1].conditions[0].chance

I feel like this tells you exactly what is wrong.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

but in the simple dungeon loot table chest havent my items :C

 

 @SubscribeEvent
        public static void onLootLoad(LootTableLoadEvent event) {
        	
            if (event.getName().equals(new ResourceLocation("minecraft", "simple_dungeon"))) {
               event.getTable().addPool(LootPool.builder().addEntry(TableLootEntry.builder(new ResourceLocation("element","simple_dungeon"))).build());
              
            }
        }

 

Link to comment
Share on other sites

11 minutes ago, DevTech said:

but in the simple dungeon loot table chest havent my items :C

What?

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

1 minute ago, DevTech said:

My mod items are not in the chest with the loot table "simple_dungeon"

How do you know? Have you checked the console for another error?

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

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.

 Share



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • accidentally knocked a cord loose while loading in better minecraft and now when i launch i get an error saying 3 mods have failed to load correctly.
    • 2b2t is the king of anarchy servers in the eyes of many in the Minecraft community. The server is synonymous with the culture at this point and almost defines the genre altogether. There are absolutely zero rules in what is often humorously described as the "oldest anarchy server in Minecraft" by the community. The server also features a huge selection of some serious YouTube names who have claimed 2b2t as their home, including the likes of FitMC and Salc1. 2b2t is an absolute must-try for any players wanting to get their feet wet in the ruthlessly intense world of pure anarchy servers. The only slight downside to this server is the ridiculously long queue times in place due to its unparalleled recent success and popularity.
    • I'm trying to make a block that is slippery in one direction: its friction depends on the angle of your motion. I've got it to work perfectly for nonplayer entities, but (once again), the player poses a different issue because of siding. My testing indicates that calling getDeltaMovement is giving (0, -1, 0) on serverside when it shouldn't be, and this screws up the calculation. How can I get accurate information here? @Override public float getFriction(BlockState state, LevelReader level, BlockPos pos, @org.jetbrains.annotations.Nullable Entity entity) { if (entity == null) { return 0.7F; } //Get a unit vector in the appropriate direction Vec3 axisUnitVector = Vec3.ZERO; if (state.getValue(AXIS) == Direction.Axis.X) { axisUnitVector = new Vec3(1, 0, 0); } else if (state.getValue(AXIS) == Direction.Axis.Z) { axisUnitVector = new Vec3(0, 0, 1); } //The block can't be placed vertically //Take the dot product of that vector with a unit vector in the direction of the entity's movement //This effectively just returns the cosine of the angle between the entity's vector and the chosen axis //i.e. 0 when perpendicular, 1 when parallel, etc. Vec3 normalizedMovement = entity.getDeltaMovement().normalize(); double dotProduct = Math.abs(normalizedMovement.dot(axisUnitVector)); //Produce a string for reporting String vectorString = "(" + StringUtils.truncate(String.valueOf(normalizedMovement.x), 4) + "," + StringUtils.truncate(String.valueOf(normalizedMovement.y), 4) + "," + StringUtils.truncate(String.valueOf(normalizedMovement.z), 4) + ")"; //Friction ranges from 0.6 to 1 depending on that cosine double finalMultiplier = Mth.lerp(dotProduct, 0.6, 1); chatPrint("Friction: " + StringUtils.truncate(String.valueOf(finalMultiplier), 5) + ", dot:" + StringUtils.truncate(String.valueOf(dotProduct), 5) + ", vector:" + vectorString + (level.isClientSide() ? "clientside" : "serverside"), (Level) level); return (float) finalMultiplier; } Walking on the block in the slippery direction produces this output: [CHAT] Friction: 0.6, dot:0.0, vector:(0.0,-1.0,0.0) serverside [CHAT] Friction: 0.981, dot:0.953, vector:(-0.0,-0.3,-0.9) clientside [CHAT] Friction: 0.6, dot:0.0, vector:(0.0,-1.0,0.0) serverside [CHAT] Friction: 0.981, dot:0.952, vector:(-0.0,-0.3,-0.9) clientside [CHAT] Friction: 0.6, dot:0.0, vector:(0.0,-1.0,0.0) serverside [CHAT] Friction: 0.981, dot:0.952, vector:(-0.0,-0.3,-0.9) clientside [CHAT] Friction: 0.6, dot:0.0, vector:(0.0,-1.0,0.0) serverside [CHAT] Friction: 0.981, dot:0.952, vector:(-0.0,-0.3,-0.9) clientside [CHAT] Friction: 0.6, dot:0.0, vector:(0.0,-1.0,0.0) serverside [CHAT] Friction: 0.980, dot:0.952, vector:(-0.0,-0.3,-0.9) clientside [CHAT] Friction: 0.6, dot:0.0, vector:(0.0,-1.0,0.0) serverside [CHAT] Friction: 0.980, dot:0.952, vector:(-0.0,-0.3,-0.9) clientside [CHAT] Friction: 0.6, dot:0.0, vector:(0.0,-1.0,0.0) serverside [CHAT] Friction: 0.980, dot:0.952, vector:(-0.0,-0.3,-0.9) clientside  
    • The 1.19 optifine previews are not compatible with forge, see the release notes: https://optifine.net/changelog?f=preview_OptiFine_1.19_HD_U_H8_pre2.jar
  • Topics

×
×
  • Create New...

Important Information

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