mirror of
https://github.com/GTNewHorizons/ModTweaker.git
synced 2026-11-15 09:34:55 +00:00
Also changes like all packages inb4 "jared changes a package name in ModTweaker2 breaking compatability with everything" drama tweet.
This commit is contained in:
1 parent
4fd2551072
commit
ec562b62ea
187 files changed
+977
-991
No files matched your search
@@ -0,0 +1,35 @@
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user