use of mods.railcraft.common.util.misc.AABBFactory in project Railcraft by Railcraft.
the class BlockRailcraftSlab method getBoundingBox.
@SuppressWarnings("deprecation")
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
TileSlab slab = getSlabTile(source, pos);
AABBFactory boxFactory = AABBFactory.start().box();
if (slab != null)
if (slab.isBottomSlab())
boxFactory.raiseCeiling(-0.5);
else if (slab.isTopSlab())
boxFactory.raiseFloor(0.5);
return boxFactory.build();
}
use of mods.railcraft.common.util.misc.AABBFactory in project Railcraft by Railcraft.
the class BlockTrackElevator method isPathEmpty.
private boolean isPathEmpty(IBlockState state, EntityMinecart cart, BlockPos pos, boolean up) {
if (WorldPlugin.getBlockMaterial(cart.world, pos).isSolid())
return false;
EnumFacing.Axis axis = getAxis(state);
AABBFactory factory = AABBFactory.start().createBoxForTileAt(pos).expandAxis(axis, 1.0);
if (up) {
factory.raiseCeiling(0.5);
factory.raiseFloor(0.2);
} else {
factory.raiseCeiling(-0.2);
factory.raiseFloor(-0.5);
}
return EntitySearcher.findMinecarts().around(factory.build()).except(cart).in(cart.world).isEmpty();
}
use of mods.railcraft.common.util.misc.AABBFactory in project Railcraft by Railcraft.
the class TradeStationLogic method absorbExperience.
private void absorbExperience() {
double x = getX();
double y = getY();
double z = getZ();
AABBFactory area = AABBFactory.start().setBounds(x, y - 3, z, x + 1, y + 3, z + 1).expandHorizontally(10);
List<EntityXPOrb> orbs = EntitySearcher.find(EntityXPOrb.class).around(area).in(theWorldAsserted());
xpCollected += orbs.stream().mapToInt(EntityXPOrb::getXpValue).sum();
for (EntityXPOrb orb : orbs) {
SoundHelper.playSoundForEntity(orb, SoundEvents.ENTITY_EXPERIENCE_ORB_PICKUP, 1f, 1f);
orb.setDead();
}
}
use of mods.railcraft.common.util.misc.AABBFactory in project Railcraft by Railcraft.
the class TradeStationLogic method findNearbyVillagers.
protected List<EntityVillager> findNearbyVillagers(int range) {
double x = getX();
double y = getY();
double z = getZ();
AABBFactory area = AABBFactory.start().setBounds(x, y - 1, z, x + 1, y + 3, z + 1).expandHorizontally(range);
return EntitySearcher.find(EntityVillager.class).and(v -> v.getProfessionForge() == getProfession() && VillagerPlugin.getCareer(v).equals(getCareer())).around(area).in(theWorldAsserted());
}
use of mods.railcraft.common.util.misc.AABBFactory in project Railcraft by Railcraft.
the class TileFluidLoader method getCart.
@Override
@Nullable
public EntityMinecart getCart() {
AABBFactory factory = AABBFactory.start().createBoxForTileAt(getPos().down(2)).raiseCeiling(1).grow(-0.1f);
EntityMinecart cart = EntitySearcher.findMinecarts().around(factory).in(world).any();
needsPipe = cart != null && getPos().getY() - cart.posY > 1D;
return cart;
}
Aggregations