use of net.minecraft.entity.player.InventoryPlayer in project Railcraft by Railcraft.
the class RailcraftContainer method slotClickPhantom.
protected ItemStack slotClickPhantom(SlotRailcraft slot, int mouseButton, ClickType clickType, EntityPlayer player) {
ItemStack stack = InvTools.emptyStack();
if (mouseButton == 2) {
if (slot.canAdjustPhantom())
slot.putStack(ItemStack.EMPTY);
} else if (mouseButton == 0 || mouseButton == 1) {
InventoryPlayer playerInv = player.inventory;
slot.onSlotChanged();
ItemStack stackSlot = slot.getStack();
ItemStack stackHeld = playerInv.getItemStack();
if (!InvTools.isEmpty(stackSlot))
stack = stackSlot.copy();
if (InvTools.isEmpty(stackSlot)) {
if (!InvTools.isEmpty(stackHeld) && slot.isItemValid(stackHeld))
fillPhantomSlot(slot, stackHeld, mouseButton);
} else if (InvTools.isEmpty(stackHeld)) {
adjustPhantomSlot(slot, mouseButton, clickType);
slot.onTake(player, playerInv.getItemStack());
} else if (slot.isItemValid(stackHeld))
if (InvTools.isItemEqual(stackSlot, stackHeld))
adjustPhantomSlot(slot, mouseButton, clickType);
else
fillPhantomSlot(slot, stackHeld, mouseButton);
}
return stack;
}
use of net.minecraft.entity.player.InventoryPlayer in project PneumaticCraft by MineMaarten.
the class ContainerPneumaticBase method slotClickPhantom.
private ItemStack slotClickPhantom(Slot slot, int mouseButton, int modifier, EntityPlayer player) {
ItemStack stack = null;
if (mouseButton == 2) {
if (((IPhantomSlot) slot).canAdjust()) {
slot.putStack(null);
}
} else if (mouseButton == 0 || mouseButton == 1) {
InventoryPlayer playerInv = player.inventory;
slot.onSlotChanged();
ItemStack stackSlot = slot.getStack();
ItemStack stackHeld = playerInv.getItemStack();
if (stackSlot != null) {
stack = stackSlot.copy();
}
if (stackSlot == null) {
if (stackHeld != null && slot.isItemValid(stackHeld)) {
fillPhantomSlot(slot, stackHeld, mouseButton, modifier);
}
} else if (stackHeld == null) {
adjustPhantomSlot(slot, mouseButton, modifier);
slot.onPickupFromSlot(player, playerInv.getItemStack());
} else if (slot.isItemValid(stackHeld)) {
if (canStacksMerge(stackSlot, stackHeld)) {
adjustPhantomSlot(slot, mouseButton, modifier);
} else {
fillPhantomSlot(slot, stackHeld, mouseButton, modifier);
}
}
}
return stack;
}
use of net.minecraft.entity.player.InventoryPlayer in project ForestryMC by ForestryMC.
the class ContainerForestry method slotClickPhantom.
private ItemStack slotClickPhantom(Slot slot, int mouseButton, int modifier, EntityPlayer player) {
ItemStack stack = null;
ItemStack stackSlot = slot.getStack();
if (stackSlot != null) {
stack = stackSlot.copy();
}
if (mouseButton == 2) {
fillPhantomSlot(slot, null, mouseButton, modifier);
} else if (mouseButton == 0 || mouseButton == 1) {
InventoryPlayer playerInv = player.inventory;
ItemStack stackHeld = playerInv.getItemStack();
if (stackSlot == null) {
if (stackHeld != null && slot.isItemValid(stackHeld)) {
fillPhantomSlot(slot, stackHeld, mouseButton, modifier);
}
} else if (stackHeld == null) {
adjustPhantomSlot(slot, mouseButton, modifier);
} else if (slot.isItemValid(stackHeld)) {
if (StackUtils.isIdenticalItem(stackSlot, stackHeld)) {
adjustPhantomSlot(slot, mouseButton, modifier);
} else {
fillPhantomSlot(slot, stackHeld, mouseButton, modifier);
}
}
} else if (mouseButton == 5) {
InventoryPlayer playerInv = player.inventory;
ItemStack stackHeld = playerInv.getItemStack();
if (!slot.getHasStack()) {
fillPhantomSlot(slot, stackHeld, mouseButton, modifier);
}
}
return stack;
}
Aggregations