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

[1.14.4] Modifying Vanilla Content


MineModder2000
 Share

Recommended Posts

1 minute ago, MineModder2000 said:

Why in the world would this severely affect other mods?

LootTableLoadEvent fires for every loot table even blocks. And all chest structures that the mod generates. What if a mod has a loot_table for a block that drops iron_ingots?

30 minutes ago, MineModder2000 said:

if (event.getName().getNamespace() == "iron_ingot") {

The reason why this wouldn't affect any vanilla loot tables is because "iron_ingot" == "iron_ingot" will never be true. You need to use String#equals.

 

7 minutes ago, MineModder2000 said:

I just did it without the if statement check and it worked

Cool you tested a piece of code without the necessary if statement to make it work how you want it to.

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.

Link to comment
Share on other sites

7 minutes ago, Animefan8888 said:

LootTableLoadEvent fires for every loot table even blocks. And all chest structures that the mod generates. What if a mod has a loot_table for a block that drops iron_ingots?

The reason why this wouldn't affect any vanilla loot tables is because "iron_ingot" == "iron_ingot" will never be true. You need to use String#equals.

 

Cool you tested a piece of code without the necessary if statement to make it work how you want it to.

You don't get it, my mod isn't going to have any iron ingots and some other things from vanilla, if somebody wanted such they wouldn't play my mod. Why would I remove a loot item from vanilla only to have it appear in other mods? I am getting rid of it for a reason. You are helpful but you really don't have to be snide / snarky, I thought you meant this procedure wouldn't work in general, hence my test. I forgot about using the method instead of == operator, I am used to comparing object types in my mod. Well anyways this didn't work as iron golems still drop iron ingots :

 

  @SubscribeEvent
    public void lootTableLoadEvent(LootTableLoadEvent event) {
    	
    	if (event.getName().getNamespace().equals("iron_ingot")) {
    			
    		event.setCanceled(true);
    	}
    }

 

Assuming this applies to entities.....

Link to comment
Share on other sites

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
  • Thanks 1

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.

Link to comment
Share on other sites

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);
    	}

 

Link to comment
Share on other sites

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.

  • Thanks 1

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.

Link to comment
Share on other sites

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");
    	}
    }
    
Link to comment
Share on other sites

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
  • Thanks 1

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.

Link to comment
Share on other sites

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
  • Thanks 1

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

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.

  • Thanks 1

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.

Link to comment
Share on other sites

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. 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

9 hours ago, MineModder2000 said:

My dreams of becoming a ballerina?

?

  • Haha 1

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

23 hours ago, MineModder2000 said:

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

Of course it is.

  • Thanks 1

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.

Link to comment
Share on other sites

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.

  • Thanks 1

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.

Link to comment
Share on other sites

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