Search in sources :

Example 1 with AABBFactory

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();
}
Also used : AABBFactory(mods.railcraft.common.util.misc.AABBFactory)

Example 2 with AABBFactory

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();
}
Also used : EnumFacing(net.minecraft.util.EnumFacing) AABBFactory(mods.railcraft.common.util.misc.AABBFactory)

Example 3 with AABBFactory

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();
    }
}
Also used : AABBFactory(mods.railcraft.common.util.misc.AABBFactory) EntityXPOrb(net.minecraft.entity.item.EntityXPOrb)

Example 4 with AABBFactory

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());
}
Also used : AABBFactory(mods.railcraft.common.util.misc.AABBFactory) EntityVillager(net.minecraft.entity.passive.EntityVillager)

Example 5 with AABBFactory

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;
}
Also used : AABBFactory(mods.railcraft.common.util.misc.AABBFactory) EntityMinecart(net.minecraft.entity.item.EntityMinecart) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

AABBFactory (mods.railcraft.common.util.misc.AABBFactory)6 EntityMinecart (net.minecraft.entity.item.EntityMinecart)2 Entity (net.minecraft.entity.Entity)1 EntityXPOrb (net.minecraft.entity.item.EntityXPOrb)1 EntityVillager (net.minecraft.entity.passive.EntityVillager)1 TileEntity (net.minecraft.tileentity.TileEntity)1 EnumFacing (net.minecraft.util.EnumFacing)1 BlockPos (net.minecraft.util.math.BlockPos)1 Nullable (org.jetbrains.annotations.Nullable)1