Search in sources :

Example 1 with UpgradeSlot

use of logisticspipes.utils.gui.UpgradeSlot in project LogisticsPipes by RS485.

the class OpenUpgradePacket method processPacket.

@Override
public void processPacket(EntityPlayer player) {
    UpgradeSlot slot = getSlot(player, UpgradeSlot.class);
    IPipeUpgrade upgrade = slot.getUpgrade();
    if (upgrade instanceof IConfigPipeUpgrade) {
        UpgradeCoordinatesGuiProvider gui = ((IConfigPipeUpgrade) upgrade).getGUI();
        if (gui != null) {
            gui.setSlot(slot).setLPPos(slot.getManager().getPipePosition()).open(player);
        }
    }
}
Also used : UpgradeCoordinatesGuiProvider(logisticspipes.network.abstractguis.UpgradeCoordinatesGuiProvider) IPipeUpgrade(logisticspipes.pipes.upgrades.IPipeUpgrade) IConfigPipeUpgrade(logisticspipes.pipes.upgrades.IConfigPipeUpgrade) UpgradeSlot(logisticspipes.utils.gui.UpgradeSlot)

Example 2 with UpgradeSlot

use of logisticspipes.utils.gui.UpgradeSlot in project LogisticsPipes by RS485.

the class ToogleDisconnectionUpgradeSidePacket method processPacket.

@Override
public void processPacket(EntityPlayer player) {
    UpgradeSlot slot = getSlot(player, UpgradeSlot.class);
    ItemStack stack = slot.getStack();
    if (stack.isEmpty())
        return;
    if (!stack.hasTagCompound()) {
        stack.setTagCompound(new NBTTagCompound());
    }
    NBTTagCompound tag = Objects.requireNonNull(stack.getTagCompound());
    String sideName = ConnectionUpgradeConfig.Sides.getNameForDirection(side);
    tag.setBoolean(sideName, !tag.getBoolean(sideName));
    stack.setTagCompound(tag);
    slot.putStack(stack);
}
Also used : NBTTagCompound(net.minecraft.nbt.NBTTagCompound) ItemStack(net.minecraft.item.ItemStack) UpgradeSlot(logisticspipes.utils.gui.UpgradeSlot)

Example 3 with UpgradeSlot

use of logisticspipes.utils.gui.UpgradeSlot in project LogisticsPipes by RS485.

the class SneakyUpgradeSidePacket method processPacket.

@Override
public void processPacket(EntityPlayer player) {
    UpgradeSlot slot = getSlot(player, UpgradeSlot.class);
    ItemStack stack = slot.getStack();
    if (stack.isEmpty())
        return;
    if (!stack.hasTagCompound()) {
        stack.setTagCompound(new NBTTagCompound());
    }
    final NBTTagCompound tag = Objects.requireNonNull(stack.getTagCompound());
    tag.setString(SneakyUpgradeConfig.SIDE_KEY, SneakyUpgradeConfig.Sides.getNameForDirection(side));
    slot.putStack(stack);
}
Also used : NBTTagCompound(net.minecraft.nbt.NBTTagCompound) ItemStack(net.minecraft.item.ItemStack) UpgradeSlot(logisticspipes.utils.gui.UpgradeSlot)

Aggregations

UpgradeSlot (logisticspipes.utils.gui.UpgradeSlot)3 ItemStack (net.minecraft.item.ItemStack)2 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)2 UpgradeCoordinatesGuiProvider (logisticspipes.network.abstractguis.UpgradeCoordinatesGuiProvider)1 IConfigPipeUpgrade (logisticspipes.pipes.upgrades.IConfigPipeUpgrade)1 IPipeUpgrade (logisticspipes.pipes.upgrades.IPipeUpgrade)1