Files
ModTweaker/src/main/java/modtweaker2/TweakEventHandler.java
T
jaredlll08 ec562b62ea This closes #17 and closes #58, I tested and it worked using the script given
Also changes like all packages
inb4 "jared changes a package name in ModTweaker2 breaking compatability
with everything" drama tweet.
2015-02-20 23:57:32 +02:00

36 lines
1.2 KiB
Java

package modtweaker2;
import java.util.ArrayList;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
import org.apache.commons.lang3.tuple.MutablePair;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
public class TweakEventHandler {
public static ArrayList<MutablePair<EntityLivingBase, ArrayList<ItemStack>>> drops = new ArrayList<MutablePair<EntityLivingBase, ArrayList<ItemStack>>>();
public static ArrayList<EntityLiving> cancleDrops = new ArrayList<EntityLiving>();
@SubscribeEvent
public void handleDrops(LivingDropsEvent event) {
if (cancleDrops.contains(event.entityLiving)) {
event.setCanceled(true);
}
for (MutablePair<EntityLivingBase, ArrayList<ItemStack>> ent : drops) {
if (ent.left.isEntityEqual(event.entityLiving)) {
for (ItemStack stack : ent.right) {
event.drops.add(new EntityItem(event.entityLiving.worldObj, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, stack));
}
}
}
}
}