List of usage examples for net.minecraftforge.event.world GetCollisionBoxesEvent getAabb
public AxisAlignedBB getAabb()
From source file:de.sanandrew.mods.turretmod.client.event.CollisionEventHandler.java
License:Creative Commons License
@SubscribeEvent public void onCollision(GetCollisionBoxesEvent event) { Entity entityIn = event.getEntity(); AxisAlignedBB aabb = event.getAabb(); if (entityIn instanceof EntityPlayer) { List<EntityTurret> turrets = entityIn.world.getEntitiesWithinAABB(EntityTurret.class, aabb.grow(0.25D)); for (EntityTurret turret : turrets) { if (!entityIn.isRidingSameEntity(turret)) { AxisAlignedBB entityBB = turret.getEntityBoundingBox(); if (entityBB.intersects(aabb)) { event.getCollisionBoxesList().add(entityBB); }/* w w w. j ava 2 s. c o m*/ } } } }
From source file:jayavery.geomastery.main.EntityEvents.java
License:Open Source License
/** Allows falling trunks to pass through leaves. */ @SubscribeEvent//from w w w .j a v a 2s .co m public void getCollisionBoxes(GetCollisionBoxesEvent event) { if (event.getEntity() instanceof FallingTreeBlock.Trunk) { ((FallingTreeBlock.Trunk) event.getEntity()).getCollisionBoxes(event.getWorld(), event.getAabb(), event.getCollisionBoxesList()); } }