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

[1.14.4] Injecting into Existing Loot Tables, Blocks


Oliviafrostpaw
 Share

Recommended Posts

Couldn't find what I was doing wrong so apologies for wasting anyone's time if its stupid and simple, when trying to add an item to the existing grass block (the one that drops seeds) I got it to work originally, and then continued working on my mod and then it inexplicably stopped working. Item is in the game so I know that its just not due to the item being registered. Current Forge version being 28.1.87

 

 

Please see code below, thank you for assistance in advance.

Spoiler

Code inside of main Java Class


@Mod("untitledmess")
public class UntitledMess
{
	//.... - Unrelated Code Here
	@Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD)
	public static class RegistryEvents
	{
		//... Unrelated Code Here
			@SubscribeEvent
            public static void onLootLoad(LootTableLoadEvent event) 
            {
            	if (event.getName().equals(new ResourceLocation("minecraft","blocks/grass"))) 
                {
                       event.getTable().addPool(LootPool.builder().addEntry(TableLootEntry.builder(new ResourceLocation(modid,"blocks/grass"))).build());
                }
			}
		
	}
}

Json in data.untitledmess.loot_tables.blocks


{
	"pools":
	[
		{
			"name": "main",
			"rolls": 1,
			"entries": 
			[
				{
					"type": "minecraft:item",
					"name": "untitledmess:grass_fiber",
					"conditions": [
		                {
		                  "condition": "minecraft:random_chance",
		                  "chance": 0.25
		                }
		             ],
					"functions":
						[
							{
								"function": "minecraft:set_count",
								"count":
								{
									"min": 1,
									"max": 2
								}
							}
						]
				}
			]
		}
	]
}

 

 

Link to comment
Share on other sites

Question:

Do recipes and loot tables in general still work, or are all of them broken too?

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

10 hours ago, RaphGamingz said:

are there any console errors?

The only error in the logs I can find is a warning on looking up profile properties, Logs gathered from the console posted in 

 

Spoiler

<==[18:20:57] [pool-3-thread-1/WARN] [mojang/YggdrasilMinecraftSessionService]: Couldn't look up profile properties for com.mojang.authlib.GameProfile@44c4268d[id=380df991-f603-344c-a090-369bad2a924a,name=Dev,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:79) ~[authlib-1.5.25.jar:?] {}
        at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService.fillGameProfile(YggdrasilMinecraftSessionService.java:180) ~[authlib-1.5.25.jar:?] {}
        at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService$1.load(YggdrasilMinecraftSessionService.java:60) ~[authlib-1.5.25.jar:?] {}
        at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService$1.load(YggdrasilMinecraftSessionService.java:57) ~[authlib-1.5.25.jar:?] {}
        at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3716) ~[guava-21.0.jar:?] {}
        at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2424) ~[guava-21.0.jar:?] {}
        at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2298) ~[guava-21.0.jar:?] {}
        at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2211) ~[guava-21.0.jar:?] {}
        at com.google.common.cache.LocalCache.get(LocalCache.java:4154) ~[guava-21.0.jar:?] {}
        at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:4158) ~[guava-21.0.jar:?] {}
        at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:5147) ~[guava-21.0.jar:?] {}
        at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:5153) ~[guava-21.0.jar:?] {}
        at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService.fillProfileProperties(YggdrasilMinecraftSessionService.java:170) ~[authlib-1.5.25.jar:?] {}
        at net.minecraft.client.Minecraft.getProfileProperties(Minecraft.java:1953) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
        at net.minecraft.client.resources.SkinManager.lambda$loadProfileTextures$1(SkinManager.java:111) ~[?:?] {re:classloading,pl:runtimedistcleaner:A}
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_231] {}
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_231] {}
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_231] {}
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_231] {}
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_231] {}

 

 

Logs Post Game Load - During world load.txt Logs During Game load.txt

Link to comment
Share on other sites

@Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD)

 

That is not the correct bus for that event.

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

35 minutes ago, Draco18s said:

@Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD)

 

That is not the correct bus for that event.

Ah, thank you very very much. Having attempted to look and find the correct bus/subscriber and or examples for its usage I found no instance of @Mod.EventBusSubscriber on the classes, is this necessary or am I just looking in the wrong places?

Any Guidance would be appreciated 

Link to comment
Share on other sites

There's only two options: FORGE and MOD. You're using the wrong one.

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

1 hour ago, Draco18s said:

There's only two options: FORGE and MOD. You're using the wrong one.

So, I have attempted with changing the whole class EventBusSubscriber to being Forge, which didnt trigger the event, I attempted creating a new class inside of the main class that has the Forge Subscriber, tried with having no conditions on the Mod.EventBusSubscriber, and finally tried with a whole new class, InjectionHandler.java, that has Mod.EventBusSubscriber with and without Mod.EventBusSubscriber.Bus.FORGE as a condition and just the onLootLoad function inside and still didnt trigger So Im about as lost as before. Once again, apologies for my lack of knowledge about the EventBus Intricacies.

Spent the time the last few days and few hours searching for examples and other peoples questions on the topic and never came up with much conclusive

Link to comment
Share on other sites

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 dont know how Im having this much trouble either haha

So, implementing the code as a new class and it still does nothing

 

package com.oliviafrostpaw.untitledmess;

import java.io.IOException;

import net.minecraft.util.ResourceLocation;
import net.minecraft.world.storage.loot.LootPool;
import net.minecraft.world.storage.loot.TableLootEntry;
import net.minecraftforge.event.LootTableLoadEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;

@Mod.EventBusSubscriber(modid = UntitledMess.modid)
public class EventHandlers 
{
	
	private static ResourceLocation grass = new ResourceLocation("minecraft", "blocks/grass");

    @SubscribeEvent
    public static void onLootLoad(LootTableLoadEvent event) throws IOException 
    {
        if (event.getName().equals(grass)) 
        {
            event.getTable().addPool(LootPool.builder().addEntry(TableLootEntry.builder(new ResourceLocation(UntitledMess.modid, "blocks/grass"))).build());
        }
    }
}

 

Link to comment
Share on other sites

5 minutes ago, Oliviafrostpaw said:

throws IOException 

Why do you have this?

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

1 hour ago, Oliviafrostpaw said:

because I was attempting to log any movement inside of the function  to a separate file

Christ, use the given-to-you-logger. It does all that for you.

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

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



×
×
  • Create New...

Important Information

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