Search in sources :

Example 6 with ModDependentMethod

use of logisticspipes.asm.ModDependentMethod in project LogisticsPipes by RS485.

the class PipeTransportLogistics method injectItem.

/**
	 * Accept items from BC
	 */
@ModDependentMethod(modId = "BuildCraft|Transport")
public void injectItem(TravelingItem item, ForgeDirection inputOrientation) {
    if (MainProxy.isServer(getWorld())) {
        if (item instanceof LPRoutedBCTravelingItem) {
            ItemRoutingInformation info = ((LPRoutedBCTravelingItem) item).getRoutingInformation();
            info.setItem(ItemIdentifierStack.getFromStack(item.getItemStack()));
            LPTravelingItemServer lpItem = new LPTravelingItemServer(info);
            lpItem.setSpeed(item.getSpeed());
            this.injectItem(lpItem, inputOrientation);
        } else {
            ItemRoutingInformation info = LPRoutedBCTravelingItem.restoreFromExtraNBTData(item);
            if (info != null) {
                info.setItem(ItemIdentifierStack.getFromStack(item.getItemStack()));
                LPTravelingItemServer lpItem = new LPTravelingItemServer(info);
                lpItem.setSpeed(item.getSpeed());
                this.injectItem(lpItem, inputOrientation);
            } else {
                LPTravelingItemServer lpItem = SimpleServiceLocator.routedItemHelper.createNewTravelItem(item.getItemStack());
                lpItem.setSpeed(item.getSpeed());
                this.injectItem(lpItem, inputOrientation);
            }
        }
    }
}
Also used : ItemRoutingInformation(logisticspipes.routing.ItemRoutingInformation) LPRoutedBCTravelingItem(logisticspipes.proxy.buildcraft.LPRoutedBCTravelingItem) LPTravelingItemServer(logisticspipes.transport.LPTravelingItem.LPTravelingItemServer) ModDependentMethod(logisticspipes.asm.ModDependentMethod)

Example 7 with ModDependentMethod

use of logisticspipes.asm.ModDependentMethod in project LogisticsPipes by RS485.

the class LogisticsBaseGuiScreen method handleDragNDrop.

@Override
@ModDependentMethod(modId = LPConstants.neiModID)
public boolean handleDragNDrop(GuiContainer gui, int mouseX, int mouseY, @Nonnull ItemStack stack, int button) {
    if (gui instanceof LogisticsBaseGuiScreen && gui.inventorySlots instanceof DummyContainer && !stack.isEmpty()) {
        Slot result = null;
        int pos = -1;
        for (int k = 0; k < inventorySlots.inventorySlots.size(); ++k) {
            Slot slot = inventorySlots.inventorySlots.get(k);
            if (isMouseOverSlot(slot, mouseX, mouseY)) {
                result = slot;
                pos = k;
                break;
            }
        }
        if (result != null) {
            if (result instanceof DummySlot || result instanceof ColorSlot || result instanceof FluidSlot) {
                ((DummyContainer) gui.inventorySlots).handleDummyClick(result, pos, stack, button, ClickType.PICKUP, mc.player);
                MainProxy.sendPacketToServer(PacketHandler.getPacket(DummyContainerSlotClick.class).setSlotId(pos).setStack(stack).setButton(button));
                return true;
            }
        }
    }
    return false;
}
Also used : IFuzzySlot(logisticspipes.interfaces.IFuzzySlot) Slot(net.minecraft.inventory.Slot) ModDependentMethod(logisticspipes.asm.ModDependentMethod)

Example 8 with ModDependentMethod

use of logisticspipes.asm.ModDependentMethod in project LogisticsPipes by RS485.

the class LogisticsSolidTileEntity method invoke.

@Override
@ModDependentMethod(modId = LPConstants.openComputersModID)
public Object[] invoke(String s, Context context, Arguments arguments) {
    BaseWrapperClass object = (BaseWrapperClass) CCObjectWrapper.getWrappedObject(this, BaseWrapperClass.WRAPPER);
    object.isDirectCall = true;
    return CCObjectWrapper.createArray(object);
}
Also used : BaseWrapperClass(logisticspipes.proxy.opencomputers.asm.BaseWrapperClass) ModDependentMethod(logisticspipes.asm.ModDependentMethod)

Example 9 with ModDependentMethod

use of logisticspipes.asm.ModDependentMethod in project LogisticsPipes by RS485.

the class CoreRoutedPipe method getPipeForUUID.

@CCCommand(description = "Returns the access to the pipe of the given router UUID")
@ModDependentMethod(modId = LPConstants.computerCraftModID)
@CCDirectCall
public Object getPipeForUUID(String sUuid) throws PermissionException {
    if (!getUpgradeManager().hasCCRemoteControlUpgrade()) {
        throw new PermissionException();
    }
    UUID uuid = UUID.fromString(sUuid);
    int id = SimpleServiceLocator.routerManager.getIDforUUID(uuid);
    IRouter router = SimpleServiceLocator.routerManager.getRouter(id);
    if (router == null) {
        return null;
    }
    return router.getPipe();
}
Also used : PermissionException(logisticspipes.security.PermissionException) IRouter(logisticspipes.routing.IRouter) UUID(java.util.UUID) ModDependentMethod(logisticspipes.asm.ModDependentMethod) CCCommand(logisticspipes.proxy.computers.interfaces.CCCommand) CCDirectCall(logisticspipes.proxy.computers.interfaces.CCDirectCall)

Example 10 with ModDependentMethod

use of logisticspipes.asm.ModDependentMethod in project LogisticsPipes by RS485.

the class LogisticsTileGenericPipe method invoke.

@Override
@ModDependentMethod(modId = LPConstants.openComputersModID)
public Object[] invoke(String s, Context context, Arguments arguments) {
    BaseWrapperClass object = (BaseWrapperClass) Objects.requireNonNull(CCObjectWrapper.getWrappedObject(pipe, BaseWrapperClass.WRAPPER), "wrapped object returned null in " + toString());
    object.isDirectCall = true;
    return CCObjectWrapper.createArray(object);
}
Also used : BaseWrapperClass(logisticspipes.proxy.opencomputers.asm.BaseWrapperClass) ModDependentMethod(logisticspipes.asm.ModDependentMethod)

Aggregations

ModDependentMethod (logisticspipes.asm.ModDependentMethod)13 IPartInfo (mcmultipart.api.container.IPartInfo)6 ParticleDigging (net.minecraft.client.particle.ParticleDigging)6 RayTraceResult (net.minecraft.util.math.RayTraceResult)6 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)6 Nonnull (javax.annotation.Nonnull)5 IBlockState (net.minecraft.block.state.IBlockState)5 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)5 BlockPos (net.minecraft.util.math.BlockPos)5 Vec3d (net.minecraft.util.math.Vec3d)5 Optional (java.util.Optional)4 Random (java.util.Random)4 LPConstants (logisticspipes.LPConstants)4 ModDependentInterface (logisticspipes.asm.ModDependentInterface)4 SimpleServiceLocator (logisticspipes.proxy.SimpleServiceLocator)4 MCMultiPart (mcmultipart.MCMultiPart)4 RayTraceHelper (mcmultipart.RayTraceHelper)4 IMultipartContainerBlock (mcmultipart.api.container.IMultipartContainerBlock)4 IPartSlot (mcmultipart.api.slot.IPartSlot)4 BlockMultipartContainer.getTile (mcmultipart.block.BlockMultipartContainer.getTile)4