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

ForgeGradle

Help and support for the new ForgeGradle system of building mods.


1157 topics in this forum

  1. [REQUEST] Building

    • 4 replies
    • 23k views
    • 2 replies
    • 22.5k views
    • 3 replies
    • 22.3k views
    • 3 replies
    • 21.5k views
    • 60 replies
    • 21.4k views
    • 1 reply
    • 21.4k views
    • 2 replies
    • 20.7k views
    • 3 replies
    • 20.2k views
    • 3 replies
    • 20.1k views
    • 1 reply
    • 18.8k views
    • 3 replies
    • 18.7k views
    • 2 replies
    • 18.6k views
    • 9 replies
    • 18.4k views
  2. Problem with textures

    • 4 replies
    • 18.3k views
    • 8 replies
    • 17.9k views
    • 18 replies
    • 17.9k views
    • 4 replies
    • 17.8k views
    • 1 reply
    • 17.7k views
    • 19 replies
    • 17.7k views
    • 2 replies
    • 17.6k views
    • 6 replies
    • 17.5k views
    • 1 reply
    • 17.4k views
    • 6 replies
    • 17.1k views
  3. NO SUPPORT REQUESTS

    • 0 replies
    • 17.1k views
    • 3 replies
    • 17k views


  • Posts

    • In 1.16, LootModifierManager#deserializeModifier read: private IGlobalLootModifier deserializeModifier(ResourceLocation location, JsonElement element) { if (!element.isJsonObject()) return null; JsonObject object = element.getAsJsonObject(); ILootCondition[] lootConditions = GSON_INSTANCE.fromJson(object.get("conditions"), ILootCondition[].class); // For backward compatibility with the initial implementation, fall back to using the location as the type. // TODO: Remove fallback in 1.16 ResourceLocation serializer = location; if (object.has("type")) { serializer = new ResourceLocation(JSONUtils.getAsString(object, "type")); } return ForgeRegistries.LOOT_MODIFIER_SERIALIZERS.getValue(serializer).read(location, object, lootConditions); } Note the if(object.has(type")){} block, which is lacking from the 1.18 version of the class: private IGlobalLootModifier deserializeModifier(ResourceLocation location, JsonElement element) { if (!element.isJsonObject()) return null; JsonObject object = element.getAsJsonObject(); LootItemCondition[] lootConditions = GSON_INSTANCE.fromJson(object.get("conditions"), LootItemCondition[].class); ResourceLocation serializer = new ResourceLocation(GsonHelper.getAsString(object, "type")); return ForgeRegistries.LOOT_MODIFIER_SERIALIZERS.getValue(serializer).read(location, object, lootConditions); } So, the "value" tag is required now for loot modifiers... fine. I added this to my loot modifer json files when I kept getting NullPointerExceptions. But when I use a valid "value" tag I get: [15:27:02] [Render thread/ERROR]: Couldn't parse loot modifier examplemod:add_structure_loot java.lang.NullPointerException: Cannot invoke "net.minecraftforge.common.loot.GlobalLootModifierSerializer.read(net.minecraft.resources.ResourceLocation, com.google.gson.JsonObject, net.minecraft.world.level.storage.loot.predicates.LootItemCondition[])" because the return value of "net.minecraftforge.registries.IForgeRegistry.getValue(net.minecraft.resources.ResourceLocation)" is null at net.minecraftforge.common.loot.LootModifierManager.deserializeModifier(LootModifierManager.java:133) ~[forge-1.18-38.0.14_mapped_official_1.18-recomp.jar%2376%2382!:?] at net.minecraftforge.common.loot.LootModifierManager.lambda$apply$0(LootModifierManager.java:115) ~[forge-1.18-38.0.14_mapped_official_1.18-recomp.jar%2376%2382!:?] at java.util.ArrayList.forEach(ArrayList.java:1511) ~[?:?] at net.minecraftforge.common.loot.LootModifierManager.apply(LootModifierManager.java:113) ~[forge-1.18-38.0.14_mapped_official_1.18-recomp.jar%2376%2382!:?] at net.minecraftforge.common.loot.LootModifierManager.apply(LootModifierManager.java:54) ~[forge-1.18-38.0.14_mapped_official_1.18-recomp.jar%2376%2382!:?] My json file is: { "type": "chest", "conditions": [ { "condition": "forge:loot_table_id", "loot_table_id": "examplemod:chests/modstructure" } ] } I tried printing the contents of ForgeRegistries.LOOT_MODIFIER_SERIALIZERS to know which keys I can use, but got: [15:26:13] [modloading-worker-0/INFO]: Printing LOOT_MODIFER_SERIALIZERS [15:26:13] [modloading-worker-0/INFO]: Printed LOOT_MODIFER_SERIALIZERS Is this a bug, given 1.18 is new, or am I not using these classes right?
    • https://forge.gemwire.uk/wiki/Capabilities#Attaching_a_Capability do the same thing but with LevelChunk
    • Yeah never figured that one out. Going to look into that a little deeper now.
    • So I just need to attach my code (I posted above) to chunks?
    • Capabilities all work the same regardless of their attached type (except ItemStack ones which are a little special).
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.