Jump to content

[1.10.2] Loot table not working


Egietje

Recommended Posts

I have a mob, but his / her loot table isn't working

Loot table class:

package com.Egietje.degeweldigemod.mobs;

import java.util.Set;

import net.minecraft.world.storage.loot.LootTableList;

import com.Egietje.degeweldigemod.Reference;
import com.google.common.collect.Sets;

import net.minecraft.util.ResourceLocation;

public class LootTables extends LootTableList {
public static final ResourceLocation ENTITIES_CHEESE_COW = register("cheese_cow");

private static ResourceLocation register(String id) {
        return register(new ResourceLocation(Reference.MODID, id));
    }
}

Loot table json:

{
{
"pools":
	[
		{
			"rolls":1,
			"entries":
			[
				{
					"type": "item",
					"name":"dgm:cheese",
					"weight":1,
					"functions":
					[
						{
							"function":"set_count",
							"count":
							{
								"min":1,"max":5
							}
						},
						{
							"function":"furnace_smelt",
							"conditions":
							[
								{
									"condition":"entity_properties",
									"entity":"this",
									"properties":
									{
										"on_fire":true
									}
								}
							]
						}
					]
				},
				{
					"type":"item",
					"name":"dgm:cheese_apple",
					"weight":1,
					"functions":
					[
						{
						"function":"set_data",
						"data":0
						},
						{
							"function":"set_count",
							"count":1,
							"conditions":
							[
								{
									"condition":"random_chance_with_looting",
									"chance":0.01,"
									looting_multiplier":0.02
								}
							]
						}
					]
				}
			]
		}
	]
}
}

Eclipse console:

[server thread/ERROR]: Couldn't load loot table dgm:cheese_cow from file:/C:/Users/Thomas/Desktop/Coding/DeGeweldigeMod%201.10.2/bin/assets/dgm/loot_tables/cheese_cow.json
com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Expected name at line 2 column 2
at com.google.gson.internal.Streams.parse(Streams.java:56) ~[streams.class:?]
at com.google.gson.TreeTypeAdapter.read(TreeTypeAdapter.java:54) ~[TreeTypeAdapter.class:?]
at com.google.gson.Gson.fromJson(Gson.java:803) ~[Gson.class:?]
at com.google.gson.Gson.fromJson(Gson.java:768) ~[Gson.class:?]
at com.google.gson.Gson.fromJson(Gson.java:717) ~[Gson.class:?]
at com.google.gson.Gson.fromJson(Gson.java:689) ~[Gson.class:?]
at net.minecraftforge.common.ForgeHooks.loadLootTable(ForgeHooks.java:1029) ~[ForgeHooks.class:?]
at net.minecraft.world.storage.loot.LootTableManager$Loader.loadBuiltinLootTable(LootTableManager.java:148) [LootTableManager$Loader.class:?]
at net.minecraft.world.storage.loot.LootTableManager$Loader.load(LootTableManager.java:71) [LootTableManager$Loader.class:?]
at net.minecraft.world.storage.loot.LootTableManager$Loader.load(LootTableManager.java:52) [LootTableManager$Loader.class:?]
at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3524) [guava-17.0.jar:?]
at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2317) [guava-17.0.jar:?]
at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2280) [guava-17.0.jar:?]
at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2195) [guava-17.0.jar:?]
at com.google.common.cache.LocalCache.get(LocalCache.java:3934) [guava-17.0.jar:?]
at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3938) [guava-17.0.jar:?]
at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4821) [guava-17.0.jar:?]
at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4827) [guava-17.0.jar:?]
at net.minecraft.world.storage.loot.LootTableManager.getLootTableFromLocation(LootTableManager.java:39) [LootTableManager.class:?]
at net.minecraft.entity.EntityLiving.dropLoot(EntityLiving.java:596) [EntityLiving.class:?]
at net.minecraft.entity.EntityLivingBase.onDeath(EntityLivingBase.java:1191) [EntityLivingBase.class:?]
at net.minecraft.entity.EntityLivingBase.attackEntityFrom(EntityLivingBase.java:1066) [EntityLivingBase.class:?]
at net.minecraft.entity.passive.EntityAnimal.attackEntityFrom(EntityAnimal.java:80) [EntityAnimal.class:?]
at net.minecraft.entity.projectile.EntityArrow.onHit(EntityArrow.java:390) [EntityArrow.class:?]
at net.minecraft.entity.projectile.EntityArrow.onUpdate(EntityArrow.java:285) [EntityArrow.class:?]
at net.minecraft.entity.projectile.EntityTippedArrow.onUpdate(EntityTippedArrow.java:88) [EntityTippedArrow.class:?]
at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2106) [World.class:?]
at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:872) [WorldServer.class:?]
at net.minecraft.world.World.updateEntity(World.java:2073) [World.class:?]
at net.minecraft.world.World.updateEntities(World.java:1886) [World.class:?]
at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:644) [WorldServer.class:?]
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:783) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:687) [MinecraftServer.class:?]
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:156) [integratedServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:536) [MinecraftServer.class:?]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_77]
Caused by: com.google.gson.stream.MalformedJsonException: Expected name at line 2 column 2
at com.google.gson.stream.JsonReader.syntaxError(JsonReader.java:1505) ~[JsonReader.class:?]
at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:502) ~[JsonReader.class:?]
at com.google.gson.stream.JsonReader.hasNext(JsonReader.java:403) ~[JsonReader.class:?]
at com.google.gson.internal.bind.TypeAdapters$25.read(TypeAdapters.java:666) ~[TypeAdapters$25.class:?]
at com.google.gson.internal.bind.TypeAdapters$25.read(TypeAdapters.java:642) ~[TypeAdapters$25.class:?]
at com.google.gson.internal.Streams.parse(Streams.java:44) ~[streams.class:?]
... 35 more

 

Link to comment
Share on other sites

It looks to me like you have an extra set of curly braces around everything.

Try removing 1 set from the top/bottom and see if that helps.

 

This is the loot json for a mob I made when I was tinkering around with stuff, and it worked:

{
    "pools": [
        {
            "rolls": {
                "min": 1,
                "max": 2
            },
            "entries": [
                {
                    "type": "item",
                    "name": "minecraft:feather",
                    "weight": 1,
                    "functions": [
                        {
                            "function": "minecraft:set_count",
                            "count": {
                                "min": 1,
                                "max": 2
                            }
                        }
                    ]
                }
            ]
        }
    ]
}

Link to comment
Share on other sites

{
"pools":
	[
		{
			"rolls":1,
			"entries":
			[
				{
					"type": "item",
					"name":"dgm:cheese",
					"weight":1,
					"functions":
					[
						{
							"function":"set_count",
							"count":
							{
								"min":1,"max":5
							}
						},
						{
							"function":"furnace_smelt",
							"conditions":
							[
								{
									"condition":"entity_properties",
									"entity":"this",
									"properties":
									{
										"on_fire":true
									}
								}
							]
						}
					]
				},
				{
					"type":"item",
					"name":"dgm:cheese_apple",
					"weight":1,
					"functions":
					[
						{
						"function":"set_data",
						"data":0
						},
						{
							"function":"set_count",
							"count":1,
							"conditions":
							[
								{
									"condition":"random_chance_with_looting",
									"chance":0.01,"
									looting_multiplier":0.02
								}
							]
						}
					]
				}
			]
		}
	]
}

[pool-2-thread-1/WARN]: Couldn't look up profile properties for com.mojang.authlib.GameProfile@7ee547dc[id=dc4e436a-deac-3fcd-b3ce-7013be63ef4d,name=Player830,properties={},legacy=false]
com.mojang.authlib.exceptions.AuthenticationException: The client has sent too many requests within a certain amount of time
at com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService.makeRequest(YggdrasilAuthenticationService.java:65) ~[YggdrasilAuthenticationService.class:?]
at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService.fillGameProfile(YggdrasilMinecraftSessionService.java:175) [YggdrasilMinecraftSessionService.class:?]
at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService$1.load(YggdrasilMinecraftSessionService.java:59) [YggdrasilMinecraftSessionService$1.class:?]
at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService$1.load(YggdrasilMinecraftSessionService.java:56) [YggdrasilMinecraftSessionService$1.class:?]
at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3524) [guava-17.0.jar:?]
at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2317) [guava-17.0.jar:?]
at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2280) [guava-17.0.jar:?]
at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2195) [guava-17.0.jar:?]
at com.google.common.cache.LocalCache.get(LocalCache.java:3934) [guava-17.0.jar:?]
at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3938) [guava-17.0.jar:?]
at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4821) [guava-17.0.jar:?]
at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4827) [guava-17.0.jar:?]
at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService.fillProfileProperties(YggdrasilMinecraftSessionService.java:165) [YggdrasilMinecraftSessionService.class:?]
at net.minecraft.client.Minecraft.getProfileProperties(Minecraft.java:3060) [Minecraft.class:?]
at net.minecraft.client.resources.SkinManager$3.run(SkinManager.java:131) [skinManager$3.class:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_77]
at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_77]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:1.8.0_77]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:1.8.0_77]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_77]
[13:30:07] [server thread/ERROR]: Couldn't load loot table dgm:cheese_cow from file:/C:/Users/Thomas/Desktop/Coding/DeGeweldigeMod%201.10.2/bin/assets/dgm/loot_tables/cheese_cow.json
com.google.gson.JsonParseException: Loot Table "dgm:cheese_cow" Missing `name` entry for pool #0
at net.minecraftforge.common.ForgeHooks.readPoolName(ForgeHooks.java:1105) ~[ForgeHooks.class:?]
at net.minecraft.world.storage.loot.LootPool$Serializer.deserialize(LootPool.java:152) ~[LootPool$Serializer.class:?]
at net.minecraft.world.storage.loot.LootPool$Serializer.deserialize(LootPool.java:147) ~[LootPool$Serializer.class:?]
at com.google.gson.TreeTypeAdapter.read(TreeTypeAdapter.java:58) ~[TreeTypeAdapter.class:?]
at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:40) ~[TypeAdapterRuntimeTypeWrapper.class:?]
at com.google.gson.internal.bind.ArrayTypeAdapter.read(ArrayTypeAdapter.java:72) ~[ArrayTypeAdapter.class:?]
at com.google.gson.Gson.fromJson(Gson.java:803) ~[Gson.class:?]
at com.google.gson.Gson.fromJson(Gson.java:868) ~[Gson.class:?]
at com.google.gson.Gson$1.deserialize(Gson.java:126) ~[Gson$1.class:?]
at net.minecraft.util.JsonUtils.deserializeClass(JsonUtils.java:378) ~[JsonUtils.class:?]
at net.minecraft.util.JsonUtils.deserializeClass(JsonUtils.java:400) ~[JsonUtils.class:?]
at net.minecraft.world.storage.loot.LootTable$Serializer.deserialize(LootTable.java:209) ~[LootTable$Serializer.class:?]
at net.minecraft.world.storage.loot.LootTable$Serializer.deserialize(LootTable.java:204) ~[LootTable$Serializer.class:?]
at com.google.gson.TreeTypeAdapter.read(TreeTypeAdapter.java:58) ~[TreeTypeAdapter.class:?]
at com.google.gson.Gson.fromJson(Gson.java:803) ~[Gson.class:?]
at com.google.gson.Gson.fromJson(Gson.java:768) ~[Gson.class:?]
at com.google.gson.Gson.fromJson(Gson.java:717) ~[Gson.class:?]
at com.google.gson.Gson.fromJson(Gson.java:689) ~[Gson.class:?]
at net.minecraftforge.common.ForgeHooks.loadLootTable(ForgeHooks.java:1029) ~[ForgeHooks.class:?]
at net.minecraft.world.storage.loot.LootTableManager$Loader.loadBuiltinLootTable(LootTableManager.java:148) [LootTableManager$Loader.class:?]
at net.minecraft.world.storage.loot.LootTableManager$Loader.load(LootTableManager.java:71) [LootTableManager$Loader.class:?]
at net.minecraft.world.storage.loot.LootTableManager$Loader.load(LootTableManager.java:52) [LootTableManager$Loader.class:?]
at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3524) [guava-17.0.jar:?]
at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2317) [guava-17.0.jar:?]
at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2280) [guava-17.0.jar:?]
at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2195) [guava-17.0.jar:?]
at com.google.common.cache.LocalCache.get(LocalCache.java:3934) [guava-17.0.jar:?]
at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3938) [guava-17.0.jar:?]
at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4821) [guava-17.0.jar:?]
at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4827) [guava-17.0.jar:?]
at net.minecraft.world.storage.loot.LootTableManager.getLootTableFromLocation(LootTableManager.java:39) [LootTableManager.class:?]
at net.minecraft.entity.EntityLiving.dropLoot(EntityLiving.java:596) [EntityLiving.class:?]
at net.minecraft.entity.EntityLivingBase.onDeath(EntityLivingBase.java:1191) [EntityLivingBase.class:?]
at net.minecraft.entity.EntityLivingBase.attackEntityFrom(EntityLivingBase.java:1066) [EntityLivingBase.class:?]
at net.minecraft.entity.passive.EntityAnimal.attackEntityFrom(EntityAnimal.java:80) [EntityAnimal.class:?]
at net.minecraft.entity.projectile.EntityArrow.onHit(EntityArrow.java:390) [EntityArrow.class:?]
at net.minecraft.entity.projectile.EntityArrow.onUpdate(EntityArrow.java:285) [EntityArrow.class:?]
at net.minecraft.entity.projectile.EntityTippedArrow.onUpdate(EntityTippedArrow.java:88) [EntityTippedArrow.class:?]
at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2106) [World.class:?]
at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:872) [WorldServer.class:?]
at net.minecraft.world.World.updateEntity(World.java:2073) [World.class:?]
at net.minecraft.world.World.updateEntities(World.java:1886) [World.class:?]
at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:644) [WorldServer.class:?]
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:783) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:687) [MinecraftServer.class:?]
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:156) [integratedServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:536) [MinecraftServer.class:?]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_77]

Link to comment
Share on other sites

/bin/assets/dgm/loot_tables/cheese_cow.json
com.google.gson.JsonParseException: Loot Table "dgm:cheese_cow" Missing `name` entry for pool #0

 

That's the error, but I honestly don't know where you went wrong.

My loot table is in assets\newmod\loot_tables\entities, called "DeathJaw.json".

I never extended the LootTable class, I just have this line in a basic class that I planned to use for storing all my loot table registrations:

public static final ResourceLocation ENTITIES_DEATHJAW = LootTableList.register(new ResourceLocation("newmod","entities/DeathJaw"));

 

The only thing I can think to give a try based on what I see is try changing dgm:cheese to dgm:cheese_cow in your loot table json.

*edit: but that doesn't even make sense, since name as far as I can tell is what you want to drop. What is the name of your loot table json, and where is it located?

Link to comment
Share on other sites

I honestly have no idea; my advice would be to trim down your loot table so that it only drops 1 simple item, then slowly build up from there.

 

Also, where you have set_count, I have "minecraft:set_count", not sure if that makes a difference or not, but might be worth a try if it keeps giving you trouble.

Link to comment
Share on other sites

Didn't help

 

Did you try trimming down your loot table to make it simple, to see if it works with just dropping 1 single simple item? For example, try using the loot table I posted that just drops a feather or 2. If that works, start changing 1 small thing at a time and testing.

Link to comment
Share on other sites

[13:30:07] [server thread/ERROR]: Couldn't load loot table dgm:cheese_cow from file:/C:/Users/Thomas/Desktop/Coding/DeGeweldigeMod%201.10.2/bin/assets/dgm/loot_tables/cheese_cow.json

com.google.gson.JsonParseException: Loot Table "dgm:cheese_cow" Missing `name` entry for pool #0

at net.minecraftforge.common.ForgeHooks.readPoolName(ForgeHooks.java:1105) ~[ForgeHooks.class:?]

 

Forge requires non-vanilla loot tables to provide a

"name"

entry for each loot pool. You can see a working loot table here.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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