Jump to content

Recommended Posts

Posted

Hi (I am kinda new to this)

 

Simply my answer is: How do I make that my custom block* drops "itself" (BlockItem) when I mine it. Block and BlockItem are registered and they works in game (by "works" I mean they can exists).

 

*My custom block doesn't have anything. It can be placed, it can be dropped from inventory, it can be destroyed, it can be found in tab in creative mode - basically it acts as cobblestone except the fact, it doesn't drop itself when it is destroyed*

 

I found out that I need some "loot tables".

So I created "chopping_block_loot_table.json" in src/main/resources/assets/automation/loot_tables/blocks/

and filled it with (my custom block has "chopping_block" as register name and my MODID is "automation"):

"pools": [
	{
		"rolls": 1,
		"entries": [
			{
				"type": "minecraft:item",
				"name": "automation:chopping_block"
			}
		]
	}
]

and it doesn't work - It doesn't even detect that it was loaded when I did this:

@EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.FORGE)
    public static class RegistryEventsForge {
        @SubscribeEvent
        public static void onLootTableLoad(LootTableLoadEvent evt) {
            System.out.println(evt.getName());
        }
    }

It shows all loot tables except my own.

 

I couldn't find where I make mistake. I think I have to somehow register my loot table, but I don't know where should I do this in this 1.15.1 version. Probably I have to put somewhere "  new ResourceLocation("automation:chopping_block_loot_table")  ", but I don't know where :D (MODID = automation, chopping_block_loot_table is name of that json file)

Posted

isn't there a data directory for server side stuff like loot tables? change

src/main/resources/assets/automation/loot_tables/blocks to src/main/resources/data/automation/loot_tables/blocks and it should work

Posted

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.

Posted

Thank you! It works.

Just one more thing you missed so I will write it here for others who has the problem.

The json file that I named "chopping_block_loot_table.json" I had to rename to "chopping_block.json" because that is my register name for my custom block. There is no registration for loot tables that you need to have in your code.

That's it :D thx you guys! :D

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

Announcements



×
×
  • Create New...

Important Information

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