package mnm.mods.pushshove;

import java.util.List;

import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

@Mod(modid = "PushShove", name = "Push and Shove", version = "@VERSION@")
public class PushShove {

    @EventHandler
    public void init(FMLInitializationEvent event) {
        MinecraftForge.EVENT_BUS.register(this);
    }

    @SubscribeEvent
    public void onMove(LivingUpdateEvent living) {
        Entity entity = living.entity;

        if (!entity.isDead) {

            final double radius = 0.20000000298023224D;
            AxisAlignedBB bounds = entity.getEntityBoundingBox().expand(radius, 0, radius);
            List<Entity> list = entity.worldObj.getEntitiesWithinAABBExcludingEntity(entity, bounds);

            if (list != null) {
                for (Entity entity1 : list) {
                    if (!entity1.isDead && entity1 instanceof EntityPlayer) {
                        entity.applyEntityCollision(entity1);
                    }
                }
            }
        }
    }
}

@@ -82,16 +82,62 @@
 Entity;%0A
+import net.minecraft.entity.EntityLivingBase;%0A
 import n
@@ -218,16 +218,56 @@
 gnedBB;%0A
+import net.minecraft.util.DamageSource;%0A
 import n
@@ -380,24 +380,87 @@
 pdateEvent;%0A
+import net.minecraftforge.event.entity.living.LivingHurtEvent;%0A
 import net.m
@@ -1063,94 +1063,202 @@
     
-final double radius = 0.20000000298023224D;%0A            AxisAlignedBB bounds =
+List%3CEntity%3E list = getCollidingEntities(entity);%0A%0A            for (Entity entity1 : list) %7B%0A                if (!entity1.isDead && entity1 instanceof EntityPlayer) %7B%0A                   
  entity.
 getE
@@ -1257,161 +1257,271 @@
 ity.
-get
+apply
 Entity
-BoundingBox().expand(radius, 0, radius);%0A            List%3CEntity%3E list = entity.worldObj.getEntitiesWithinAABBExcludingEntity(entity, bounds
+Collision(entity1);%0A                %7D%0A            %7D%0A%0A        %7D%0A    %7D%0A%0A    @SubscribeEvent%0A    public void onFall(LivingHurtEvent hurt) %7B%0A        if (hurt.source == DamageSource.fall) %7B%0A            List%3CEntity%3E list = getCollidingEntities(hurt.entity
 );%0A
-%0A
     
@@ -1532,29 +1532,32 @@
     
-if (list != null) %7B%0A 
+boolean cancel = false;%0A
     
@@ -1556,35 +1556,32 @@
 se;%0A            
-   
 for (Entity enti
@@ -1574,33 +1574,32 @@
 r (Entity entity
-1
  : list) %7B%0A     
@@ -1585,36 +1585,32 @@
 ntity : list) %7B%0A
-    
                 
@@ -1617,34 +1617,48 @@
 if (
-!
 entity
-1.isDead &&
+ instanceof EntityPlayer %7C%7C
  entity
-1
  ins
@@ -1667,38 +1667,42 @@
 nceof Entity
-Player
+LivingBase
 ) %7B%0A    
             
@@ -1681,32 +1681,63 @@
 vingBase) %7B%0A    
+                cancel = true;%0A
                 
@@ -1752,35 +1752,88 @@
 ty.a
-pply
+ttack
 Entity
-Collision(entity1
+From(DamageSource.causeMobDamage(hurt.entityLiving), hurt.ammount * 3
 );%0A 
@@ -1843,34 +1843,69 @@
             
-    
 %7D
+%0A
 %0A    
+            hurt.setCanceled(cancel);%0A
             
@@ -1918,23 +1918,304 @@
     
+%7D%0A
     %7D%0A
+%0A
     
-    %7D
+private List%3CEntity%3E getCollidingEntities(Entity entity) %7B%0A        final double radius = 0.20000000298023224D;%0A        AxisAlignedBB bounds = entity.getEntityBoundingBox().expand(radius, 0, radius);%0A        return entity.worldObj.getEntitiesWithinAABBExcludingEntity(entity, bounds);
 %0A   

Add landing/stomping on other entities. When stomping, all fall damage x3 is transfered to the other entity.