use of net.minecraft.screen.slot.Slot in project Fabric-Course-118 by Kaupenjoe.
the class OrichalcumBlasterScreenHandler method transferSlot.
@Override
public ItemStack transferSlot(PlayerEntity player, int invSlot) {
ItemStack newStack = ItemStack.EMPTY;
Slot slot = this.slots.get(invSlot);
if (slot != null && slot.hasStack()) {
ItemStack originalStack = slot.getStack();
newStack = originalStack.copy();
if (invSlot < this.inventory.size()) {
if (!this.insertItem(originalStack, this.inventory.size(), this.slots.size(), true)) {
return ItemStack.EMPTY;
}
} else if (!this.insertItem(originalStack, 0, this.inventory.size(), false)) {
return ItemStack.EMPTY;
}
if (originalStack.isEmpty()) {
slot.setStack(ItemStack.EMPTY);
} else {
slot.markDirty();
}
}
return newStack;
}
use of net.minecraft.screen.slot.Slot in project Hypnotic-Client by Hypnotic-Development.
the class InventoryScreenMixin method dupe.
// Credits to Duper Trooper for publishing the dupe
// Original video https://www.youtube.com/watch?v=8Xd7DcApFbM
private void dupe() {
Slot outputSlot = (Slot) ((PlayerScreenHandler) this.handler).slots.get(0);
this.onMouseClick(outputSlot, outputSlot.id, 0, SlotActionType.THROW);
}
use of net.minecraft.screen.slot.Slot in project LittleMaidReBirth-Fabric by SistrScarlet.
the class LittleMaidScreenHandler method addSlotRange.
private int addSlotRange(Inventory inventory, int index, int x, int y, int amount, int dx) {
for (int i = 0; i < amount; i++) {
addSlot(new Slot(inventory, index, x, y));
x += dx;
index++;
}
return index;
}
use of net.minecraft.screen.slot.Slot in project LittleMaidReBirth-Fabric by SistrScarlet.
the class LittleMaidScreenHandler method layoutMaidInventorySlots.
private void layoutMaidInventorySlots() {
// index 0~17
addSlotBox(maidInventory, 1, 8, 76, 9, 18, 2, 18);
// 18~19
addSlot(new Slot(maidInventory, 0, 116, 44));
addSlot(new Slot(maidInventory, 1 + 18 + 4, 152, 44));
// 20~23
addSlot(new Slot(maidInventory, 1 + 18 + EquipmentSlot.HEAD.getEntitySlotId(), 8, 8) {
@Override
public boolean canInsert(ItemStack stack) {
return MobEntity.getPreferredEquipmentSlot(stack) == EquipmentSlot.HEAD;
}
});
addSlot(new Slot(maidInventory, 1 + 18 + EquipmentSlot.CHEST.getEntitySlotId(), 8, 44) {
@Override
public boolean canInsert(ItemStack stack) {
return MobEntity.getPreferredEquipmentSlot(stack) == EquipmentSlot.CHEST;
}
});
addSlot(new Slot(maidInventory, 1 + 18 + EquipmentSlot.LEGS.getEntitySlotId(), 80, 8) {
@Override
public boolean canInsert(ItemStack stack) {
return MobEntity.getPreferredEquipmentSlot(stack) == EquipmentSlot.LEGS;
}
});
addSlot(new Slot(maidInventory, 1 + 18 + EquipmentSlot.FEET.getEntitySlotId(), 80, 44) {
@Override
public boolean canInsert(ItemStack stack) {
return MobEntity.getPreferredEquipmentSlot(stack) == EquipmentSlot.FEET;
}
});
}
Aggregations