MCPcopy Index your code
hub / github.com/GregTech6/gregtech6 / put

Method put

src/main/java/gregapi/util/ST.java:702–774  ·  view source on GitHub ↗
(DelegatorTileEntity<IInventory> aFrom, int[] aSlotsFrom, @SuppressWarnings("rawtypes") DelegatorTileEntity aTo, ItemStackSet<ItemStackContainer> aFilter, boolean aIgnoreSideFrom, boolean aInvertFilter, boolean aEjectItems, int aMaxMove, int aMinMove)

Source from the content-addressed store, hash-verified

700
701
702 public static int put(DelegatorTileEntity<IInventory> aFrom, int[] aSlotsFrom, @SuppressWarnings("rawtypes") DelegatorTileEntity aTo, ItemStackSet<ItemStackContainer> aFilter, boolean aIgnoreSideFrom, boolean aInvertFilter, boolean aEjectItems, int aMaxMove, int aMinMove) {
703 if (aTo.mTileEntity != null) {
704 if (TE_PIPES && aTo.mTileEntity instanceof cofh.api.transport.IItemDuct) {
705 for (int aSlotFrom : aSlotsFrom) {
706 ItemStack aStackFrom = aFrom.mTileEntity.getStackInSlot(aSlotFrom);
707 if (aStackFrom != null && aMinMove <= aStackFrom.stackSize && (aFilter == null || aFilter.contains(aStackFrom, T) != aInvertFilter) && canTake(aFrom.mTileEntity, aIgnoreSideFrom ? SIDE_ANY : aFrom.mSideOfTileEntity, aFrom.mSideOfTileEntity, aSlotFrom, aStackFrom)) {
708 // Actually Moving the Stack
709 ItemStack tStackMoved = amount(Math.min(aStackFrom.stackSize, aMaxMove), aStackFrom);
710 ItemStack rStackMoved = ((cofh.api.transport.IItemDuct)aTo.mTileEntity).insertItem(aTo.getForgeSideOfTileEntity(), copy(tStackMoved));
711 int rMoved = (tStackMoved.stackSize - (rStackMoved == null ? 0 : rStackMoved.stackSize));
712 if (rMoved > 0) {
713 aFrom.mTileEntity.decrStackSize(aSlotFrom, rMoved);
714 aFrom.mTileEntity.markDirty();
715 WD.mark(aFrom);
716 WD.mark(aTo);
717 return rMoved;
718 }
719 }
720 }
721 return 0;
722 }
723 if (BC_PIPES && aTo.mTileEntity instanceof buildcraft.api.transport.IInjectable) {
724 for (int aSlotFrom : aSlotsFrom) {
725 ItemStack aStackFrom = aFrom.mTileEntity.getStackInSlot(aSlotFrom);
726 if (aStackFrom != null && aMinMove <= aStackFrom.stackSize && (aFilter == null || aFilter.contains(aStackFrom, T) != aInvertFilter) && canTake(aFrom.mTileEntity, aIgnoreSideFrom ? SIDE_ANY : aFrom.mSideOfTileEntity, aFrom.mSideOfTileEntity, aSlotFrom, aStackFrom)) {
727 // Actually Moving the Stack
728 ItemStack tStackMoved = amount(Math.min(aStackFrom.stackSize, aMaxMove), aStackFrom);
729 int rMoved = ((buildcraft.api.transport.IInjectable)aTo.mTileEntity).injectItem(copy(tStackMoved), F, aTo.getForgeSideOfTileEntity(), null);
730 if (rMoved >= aMinMove) {
731 rMoved = (((buildcraft.api.transport.IInjectable)aTo.mTileEntity).injectItem(amount(rMoved, tStackMoved), T, aTo.getForgeSideOfTileEntity(), null));
732 aFrom.mTileEntity.decrStackSize(aSlotFrom, rMoved);
733 aFrom.mTileEntity.markDirty();
734 WD.mark(aFrom);
735 WD.mark(aTo);
736 return rMoved;
737 }
738 }
739 }
740 return 0;
741 }
742 }
743
744 Block aBlock = aTo.getBlock();
745 if (aBlock instanceof BlockRailBase) {
746 // Do not eject shit onto Rails directly.
747 } else if (aBlock.getMaterial() == Material.lava || aBlock instanceof BlockFire || (invalid(aBlock) && aTo.mY < 1)) {
748 for (int aSlotFrom : aSlotsFrom) {
749 ItemStack aStackFrom = aFrom.mTileEntity.getStackInSlot(aSlotFrom);
750 if (aStackFrom != null && aMinMove <= aStackFrom.stackSize && (aFilter == null || aFilter.contains(aStackFrom, T) != aInvertFilter) && canTake(aFrom.mTileEntity, aIgnoreSideFrom ? SIDE_ANY : aFrom.mSideOfTileEntity, aFrom.mSideOfTileEntity, aSlotFrom, aStackFrom)) {
751 // Actually Moving the Stack
752 int rMoved = GarbageGT.trash(amount(Math.min(aStackFrom.stackSize, aMaxMove), aStackFrom));
753 aFrom.mTileEntity.decrStackSize(aSlotFrom, rMoved);
754 aFrom.mTileEntity.markDirty();
755 WD.mark(aFrom);
756 return rMoved;
757 }
758 }
759 } else if (!WD.hasCollide(aTo.mWorld, aTo.mX, aTo.mY, aTo.mZ, aBlock)) {

Callers 15

moveMethod · 0.95
moveAllMethod · 0.95
moveFromMethod · 0.95
moveToMethod · 0.95
onPlayerInteractionMethod · 0.45
doExplosionAMethod · 0.45
setFoodBehaviorMethod · 0.45
setBurnValueMethod · 0.45
setElectricStatsMethod · 0.45
addItemBehaviorMethod · 0.45
addToolMethod · 0.45

Calls 15

canTakeMethod · 0.95
amountMethod · 0.95
copyMethod · 0.95
markMethod · 0.95
invalidMethod · 0.95
trashMethod · 0.95
hasCollideMethod · 0.95
placeMethod · 0.95
getStackInSlotMethod · 0.65
containsMethod · 0.65
decrStackSizeMethod · 0.65

Tested by

no test coverage detected