Search in sources :

Example 6 with AABBFactory

use of mods.railcraft.common.util.misc.AABBFactory in project Railcraft by Railcraft.

the class TokenRing method tick.

public void tick(World world) {
    if (!signals.isEmpty()) {
        BlockPos origin = signals.stream().findAny().orElse(BlockPos.ORIGIN);
        AABBFactory aabbFactory = AABBFactory.start().createBoxForTileAt(origin);
        for (BlockPos pos : signals) {
            aabbFactory.expandToCoordinate(pos);
        }
        aabbFactory.grow(16).clampToWorld();
        List<EntityMinecart> carts = EntitySearcher.findMinecarts().around(aabbFactory.build()).in(world);
        trackedCarts.retainAll(carts.stream().map(Entity::getUniqueID).collect(Collectors.toSet()));
    }
}
Also used : Entity(net.minecraft.entity.Entity) TileEntity(net.minecraft.tileentity.TileEntity) AABBFactory(mods.railcraft.common.util.misc.AABBFactory) BlockPos(net.minecraft.util.math.BlockPos) EntityMinecart(net.minecraft.entity.item.EntityMinecart)

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