I made a loot table through a class, code is here:
package com.dmh10s.morethingsmod.events;
import java.util.Random;
import com.dmh10s.morethingsmod.entity.EntityTurkey;
import com.dmh10s.morethingsmod.init.ModItems;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DamageSource;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
public class LootTableEvent
{
@SubscribeEvent
public void customLootTableDrop(LivingDropsEvent event)
{
Random rand = new Random();
if(event.getEntityLiving() instanceof EntityTurkey)
{
event.getEntityLiving().entityDropItem(new ItemStack(ModItems.RAW_TURKEY_BREAST), 0.0F);
event.getEntityLiving().entityDropItem(new ItemStack(ModItems.RAW_TURKEY_DRUMSTICK, rand.nextInt(3)), 0.0F);
}
}
}
I tried to make a JSON file, but it didn't work. I made sure to follow the tutorial step by step, but it must be outdated. What I want to do is, when a turkey burns to death, I would like the drops to switch to cooked turkey breast and cooked turkey drumsticks. I tried to import a DamageSource variable, but it said a @SubscribeEvent can only import one variable, so I couldn't do that. I am working on Forge 1.12.2. Thanks
Rollback Post to RevisionRollBack
Minecraft Expansion
Mod for 1.12.2. Adding onto Minecraft while staying close to vanilla.
I think the correct way to do this is through jsons. However, if copying one from minecraft but replacing the items with the items in your mod doesn't work this is probably because 1.12 wasn't set up to have custom furnace recipes. There is a different way to make it work then.
Here is the cow json for reference (it includes dropping cooked beef)
I tried to import a DamageSource variable, but it said a @SubscribeEvent can only import one variable, so I couldn't do that.
?
The @SubscribeEvent marks this method for being fired whenever the hook that corresponds to the type of event that it is is fired. I'm guessing that you were trying to find the damage source corresponding to the event? You can get that with getSource().
Thank you for the JSON files, I’ll try those out. I tried getSource(), but it said it only gave an Entity. I saw that Zombies use it to see if a Creeper killed them, and if so, to drop the Zombie Head. I don’t think it works for burning to death.
Rollback Post to RevisionRollBack
Minecraft Expansion
Mod for 1.12.2. Adding onto Minecraft while staying close to vanilla.
I want one breast and 0-2 drumsticks to drop 100% of the time. This file is saved under assets.mtm.loot_tables as turkey.json. Here is my loot table handler class:
public class LootTableHandler
{
public static final ResourceLocation TURKEY = LootTableList.register(new ResourceLocation(Reference.MOD_ID, "turkey"));
}
I made a loot table through a class, code is here:
I tried to make a JSON file, but it didn't work. I made sure to follow the tutorial step by step, but it must be outdated. What I want to do is, when a turkey burns to death, I would like the drops to switch to cooked turkey breast and cooked turkey drumsticks. I tried to import a DamageSource variable, but it said a @SubscribeEvent can only import one variable, so I couldn't do that. I am working on Forge 1.12.2. Thanks
Minecraft Expansion
Mod for 1.12.2. Adding onto Minecraft while staying close to vanilla.
Download here
I think the correct way to do this is through jsons. However, if copying one from minecraft but replacing the items with the items in your mod doesn't work this is probably because 1.12 wasn't set up to have custom furnace recipes. There is a different way to make it work then.
Here is the cow json for reference (it includes dropping cooked beef)
If this doesn't work then use the following condition:
for the pools containing the cooked meat, and use "on_fire" : false for the ones without cooked meat.
?
The @SubscribeEvent marks this method for being fired whenever the hook that corresponds to the type of event that it is is fired. I'm guessing that you were trying to find the damage source corresponding to the event? You can get that with getSource().
Uncrafting Table (1.15.2): https://www.minecraftforum.net/forums/mapping-and-modding-java-edition/minecraft-mods/wip-mods/3032965-uncrafting-table
Ruins of Humanity (mod, no longer being developed): https://www.minecraftforum.net/forums/mapping-and-modding-java-edition/minecraft-mods/wip-mods/2898701-1-12-2-wip-early-alpha-ruins-of-humanity
Thank you for the JSON files, I’ll try those out. I tried getSource(), but it said it only gave an Entity. I saw that Zombies use it to see if a Creeper killed them, and if so, to drop the Zombie Head. I don’t think it works for burning to death.
Minecraft Expansion
Mod for 1.12.2. Adding onto Minecraft while staying close to vanilla.
Download here
Am I doing this right? I've tried to make my own loot table JSON file based on the cow one you provided. Here it is:
I want one breast and 0-2 drumsticks to drop 100% of the time. This file is saved under assets.mtm.loot_tables as turkey.json. Here is my loot table handler class:
And I have this in my EntityTurkey class:
And the turkey doesn't drop anything when I kill it, whether it is on fire or not.
Minecraft Expansion
Mod for 1.12.2. Adding onto Minecraft while staying close to vanilla.
Download here
The condition needs to be on the pool.
So like
This should cause a mob to drop cooked beef when on fire and raw beef when not on fire.
Uncrafting Table (1.15.2): https://www.minecraftforum.net/forums/mapping-and-modding-java-edition/minecraft-mods/wip-mods/3032965-uncrafting-table
Ruins of Humanity (mod, no longer being developed): https://www.minecraftforum.net/forums/mapping-and-modding-java-edition/minecraft-mods/wip-mods/2898701-1-12-2-wip-early-alpha-ruins-of-humanity
It still does the same thing. Is there something else I could be doing wrong?
Minecraft Expansion
Mod for 1.12.2. Adding onto Minecraft while staying close to vanilla.
Download here