forked from TAIGA/TAIGA
first 1.11.1 attempt
This commit is contained in:
@@ -5,15 +5,19 @@ import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.living.LivingDropsEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import slimeknights.mantle.util.RecipeMatch;
|
||||
import slimeknights.tconstruct.library.traits.AbstractTrait;
|
||||
import slimeknights.tconstruct.library.utils.TagUtil;
|
||||
import slimeknights.tconstruct.library.utils.TinkerUtil;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public class TraitSlaughtering extends AbstractTrait {
|
||||
|
||||
public TraitSlaughtering() {
|
||||
@@ -25,12 +29,17 @@ public class TraitSlaughtering extends AbstractTrait {
|
||||
@SubscribeEvent
|
||||
public void onMobDrops(LivingDropsEvent event) {
|
||||
World w = event.getEntity().getEntityWorld();
|
||||
if (event.getSource().getEntity() instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) event.getSource().getEntity();
|
||||
if (event.getSource().getTrueSource() instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) event.getSource().getTrueSource();
|
||||
if (!w.isRemote && event.getEntity() instanceof EntityLiving && !(event.getEntity() instanceof EntityPlayer) && TinkerUtil.hasTrait(TagUtil.getTagSafe(player.getHeldItemMainhand()), identifier)) {
|
||||
Item i = event.getDrops().get(random.nextInt(event.getDrops().size())).getEntityItem().getItem();
|
||||
Item i = event.getDrops().get(random.nextInt(event.getDrops().size())).getItem().getItem();
|
||||
event.getDrops().add(new EntityItem(event.getEntity().getEntityWorld(), event.getEntity().posX, event.getEntity().posY, event.getEntity().posZ, new ItemStack(i, random.nextInt(4) + 1)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<RecipeMatch.Match> matches(NonNullList<ItemStack> stacks) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user