use of net.minecraft.entity.item.EntityMinecart in project Trains-In-Motion-1.7.10 by EternalBlueFlame.
the class CartTools method getMinecartsOnAllSides.
public static List<EntityMinecart> getMinecartsOnAllSides(World world, int i, int j, int k, float sensitivity, Class<? extends EntityMinecart> type, boolean subclass) {
List<EntityMinecart> list = new ArrayList<EntityMinecart>();
List<EntityMinecart> carts = new ArrayList<EntityMinecart>();
for (int side = 0; side < 6; side++) {
list.addAll(getMinecartsOnSide(world, i, j, k, sensitivity, ForgeDirection.getOrientation(side)));
}
for (EntityMinecart cart : list) {
if ((subclass && type.isInstance(cart)) || cart.getClass() == type)
carts.add(cart);
}
return carts;
}
use of net.minecraft.entity.item.EntityMinecart in project Trains-In-Motion-1.7.10 by EternalBlueFlame.
the class CartTools method getMinecartsAt.
/**
* @param world
* @param i
* @param j
* @param k
* @param sensitivity Controls the size of the search box, ranges from
* (-inf, 0.49].
* @return
*/
public static List<EntityMinecart> getMinecartsAt(World world, int i, int j, int k, float sensitivity) {
sensitivity = Math.min(sensitivity, 0.49f);
List entities = world.getEntitiesWithinAABB(EntityMinecart.class, AxisAlignedBB.getBoundingBox(i + sensitivity, j + sensitivity, k + sensitivity, i + 1 - sensitivity, j + 1 - sensitivity, k + 1 - sensitivity));
List<EntityMinecart> carts = new ArrayList<EntityMinecart>();
for (Object o : entities) {
EntityMinecart cart = (EntityMinecart) o;
if (!cart.isDead)
carts.add((EntityMinecart) o);
}
return carts;
}
use of net.minecraft.entity.item.EntityMinecart in project ImmersiveEngineering by BluSunrize.
the class EventHandler method onCapabilitiesAttach.
@SubscribeEvent
public void onCapabilitiesAttach(AttachCapabilitiesEvent.Entity event) {
if (event.getEntity() instanceof EntityMinecart) {
EntityMinecart entityMinecart = (EntityMinecart) event.getEntity();
event.addCapability(new ResourceLocation("immersiveengineering:shader"), new ShaderWrapper_Direct("immersiveengineering:minecart"));
}
}
use of net.minecraft.entity.item.EntityMinecart in project Railcraft by Railcraft.
the class TileDispenserTrain method spawnNextCart.
private boolean spawnNextCart() {
ItemStack spawn = getPattern().getStackInSlot(patternIndex);
if (InvTools.isEmpty(spawn)) {
resetSpawnSequence();
return false;
}
Predicate<ItemStack> filter = new MinecartItemType(spawn);
if (InvTools.countItems(invStock, filter) == 0) {
resetSpawnSequence();
return false;
}
BlockPos offset = getPos().offset(facing);
if ((spawn.getItem() instanceof ItemMinecart || spawn.getItem() instanceof IMinecartItem) && CartToolsAPI.getMinecartOnSide(worldObj, getPos(), 0, facing) == null) {
ItemStack cartItem = InvTools.removeOneItem(invStock, filter);
if (!InvTools.isEmpty(cartItem)) {
EntityMinecart cartPlaced = CartTools.placeCart(getOwner(), cartItem, (WorldServer) worldObj, offset);
if (cartPlaced != null) {
CartToolsAPI.getLinkageManager(worldObj).createLink(cartPlaced, lastCart);
lastCart = cartPlaced;
patternIndex++;
if (patternIndex >= getPattern().getSizeInventory())
resetSpawnSequence();
return true;
} else
InvTools.moveItemStack(cartItem, invStock);
}
}
return false;
}
use of net.minecraft.entity.item.EntityMinecart in project Railcraft by Railcraft.
the class TileFluidLoader method getCart.
@Nullable
@Override
public EntityMinecart getCart() {
needsPipe = false;
EntityMinecart cart = super.getCart();
if (cart == null) {
cart = CartToolsAPI.getMinecartOnSide(worldObj, getPos().down(), 0.2f, EnumFacing.DOWN);
needsPipe = true;
}
return cart;
}
Aggregations