Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

2 hours ago, MineModder2000 said:

Well anyways this didn't work as iron golems still drop iron ingots :

That's because the ResourceLocation given by getName has a folder in the path IE entities/iron_golem. Also the namespace is the file name not the item it drops. You'll have to look at the LootTable/LootPool(s).

Edited by Animefan8888

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.

  • Replies 138
  • Views 94.2k
  • Created
  • Last Reply

Top Posters In This Topic

Most Popular Posts

  • Animefan8888
    Animefan8888

    Oops my bad. Use ItemStack#isEmpty so event.getEntityPlayer().getHeldItem(Hand.MAIN_HAND).isEmpty()

  • Animefan8888
    Animefan8888

    Use the PlayerEvent.BreakSpeed event and if the player isn't holding an item set the break speed to 0.

  • Animefan8888
    Animefan8888

    It's an event read about them here.

Posted Images

  • Author
52 minutes ago, Animefan8888 said:

That's because the ResourceLocation given by getName has a folder in the namespace IE entities/iron_golem. Also the namespace is the file name not the item it drops. You'll have to look at the LootTable/LootPool(s).

 

The below code isn't cancelling the loot. 

 

 	if (event.getName().getNamespace().equals("entities/iron_golem")) {
    			
    		event.setCanceled(true);
    	}

 

8 minutes ago, MineModder2000 said:

.getNamespace()

This returns the modid(both of our mistakes). You need to use getPath. Also just canceling the event will cause all of the drops for the iron_golem to not drop. So maybe try to remove the pool for the iron ingots instead.

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.

  • Author
1 hour ago, Animefan8888 said:

This returns the modid(both of our mistakes). You need to use getPath. Also just canceling the event will cause all of the drops for the iron_golem to not drop. So maybe try to remove the pool for the iron ingots instead.

 

I tried this, with and without the "item" before "leather", to no avail. 
    

 @SubscribeEvent
    public void lootTableLoadEvent(LootTableLoadEvent event) {
    	
    	if (event.getName().getPath().equals("entities/horse")) {
    			
    		event.getTable().removePool("item/leather");
    	}
    }
    
16 minutes ago, MineModder2000 said:

event.getTable().removePool("item/leather");

There is only one pool in entity loot tables it's called "main" and you need to remove an entry in that pool. Not the pool itself.

Edited by Animefan8888

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.

  • Author
7 minutes ago, Animefan8888 said:

There is only one pool in entity loot tables it's called "main" and you need to remove an entry in that pool. Not the pool itself.

 

Not seeing any methods beyond this that allow for specific entry removal.....

 

event.getTable().getPool("main")

If you want to remove an item from a pool knowing only the item:

 

https://github.com/Draco18s/ReasonableRealism/blob/1.14.4/src/main/java/com/draco18s/hardlib/util/LootUtils.java#L34

 

You need reflection.

(Note: that removes it from all pools, you may wish to only remove from the main pool, from a pool by name, or...)

Edited by Draco18s

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.

5 minutes ago, MineModder2000 said:

Not seeing any methods beyond this that allow for specific entry removal.....

That's because they haven't been implemented in 1.14 forge , yet(I assume). They are currently commented out in the source code under the forge section. You'll have to use Reflection like Draco18s has so helpfully provided an example for.

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.

  • Author
9 minutes ago, Draco18s said:

If you want to remove an item from a pool knowing only the item:

 

https://github.com/Draco18s/ReasonableRealism/blob/1.14.4/src/main/java/com/draco18s/hardlib/util/LootUtils.java#L34

 

You need reflection.

(Note: that removes it from all pools, you may wish to only remove from the main pool, from a pool by name, or...)

 

7 minutes ago, Animefan8888 said:

That's because they haven't been implemented in 1.14 forge , yet(I assume). They are currently commented out in the source code under the forge section. You'll have to use Reflection like Draco18s has so helpfully provided an example for.

 

Thanks guys, I will consider if this is what I want to do, else I will do the json overriding technique instead. 

Probably. Have you tried looking at the code that handles it?

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.

Literally knowing fuckall about where to look, let me see...

 

oh hey, there's a net.minecraft.entity.merchant package. I wonder what's in here.

 

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.

  • Author
2 hours ago, Draco18s said:

Literally knowing fuckall about where to look, let me see...

 

oh hey, there's a net.minecraft.entity.merchant package. I wonder what's in here.

 

My dreams of becoming a ballerina? I see the public field that I can change in VillagerTrades, I'll take a crack at it. 

Edited by MineModder2000

9 hours ago, MineModder2000 said:

My dreams of becoming a ballerina?

?

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.

  • Author

I'm stoked that I got this to work, my test of farmers offering diamond axes was successful. I just realized that whatever trades the villagers load with, that's it, you can't change it retroactively, important note for testing. 

 

 

 

Edited by MineModder2000

  • Author

Is it possible to disable right click on interaction blocks such as furnace, smoker, etc.?

Edited by MineModder2000

23 hours ago, MineModder2000 said:

Is it possible to disable right click on interaction blocks such as furnace, smoker, etc.?

Of course it is.

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.

58 minutes ago, MineModder2000 said:

HOW

Several ways. Why not take a look at the net.minecraftforge.event package and sub-packages? There is definitely an event for what you want.

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.

  • Author
10 minutes ago, Animefan8888 said:

Several ways. Why not take a look at the net.minecraftforge.event package and sub-packages? There is definitely an event for what you want.

Ah, I did this before asking but I missed it. It has the literal name : RightClickBlock, doh! 

Edited by MineModder2000

  • Author

Hmm, i tried both of the following, no cigar : 

 

    @SubscribeEvent
    public void rightClickBlock(RightClickBlock event) {

    		event.setCanceled(true); 
    }
    
    @SubscribeEvent
    public void entityInteract(EntityInteract event) {

    		event.setCanceled(true); 
    }

 

PlayerInteractEvent is where these are located. 

13 hours ago, MineModder2000 said:

Hmm, i tried both of the following, no cigar :

Read the javadoc above the class.

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.

  • Author
9 hours ago, diesieben07 said:

Are you using the latest version of Forge for 1.14.4? I recall the interaction events were not fully working in the earlier versions.

Also, did you try using the debugger to see if your event handlers are called at all?

 

I am using 28.0.27. I can't run from Eclipse, I get errors. Updating may solve the problem. 

 

3 hours ago, Animefan8888 said:

Read the javadoc above the class.

 

I did, it just goes over how it fires and what not. 

 

    /**
     * This event is fired on both sides whenever the player right clicks while targeting a block.
     * This event controls which of {@link net.minecraft.block.Block#onBlockActivated} and/or {@link net.minecraft.item.Item#onItemUse}
     * will be called after {@link net.minecraft.item.Item#onItemUseFirst} is called.
     * Canceling the event will cause none of the above three to be called
     *
     * Let result be a return value of the above three methods, or {@link #cancellationResult} if the event is cancelled.
     * If we are on the client and result is not {@link EnumActionResult#SUCCESS}, the client will then try {@link RightClickItem}.
     *
     * There are various results to this event, see the getters below.
     * Note that handling things differently on the client vs server may cause desynchronizations!
     */

 

Canceling the event will cause none of the above three to be called, so it should work.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.