use of net.minecraft.screen.slot.Slot in project isometric-renders by gliscowo.
the class HandledScreenMixin method renderInventory.
@Inject(method = "keyPressed", at = @At("HEAD"), cancellable = true)
public void renderInventory(int keyCode, int scanCode, int modifiers, CallbackInfoReturnable<Boolean> cir) {
if (keyCode == GLFW.GLFW_KEY_F12) {
if (Screen.hasControlDown()) {
client.openScreen(new BatchIsometricBlockRenderScreen(IsometricRenderHelper.extractBlocks(handler.slots.stream().map(Slot::getStack).collect(Collectors.toList())), "inventory"));
cir.cancel();
} else if (Screen.hasAltDown()) {
client.openScreen(new BatchIsometricItemRenderScreen(handler.slots.stream().map(Slot::getStack).iterator(), "inventory"));
cir.cancel();
} else if (Screen.hasShiftDown()) {
IsometricRenderHelper.renderItemAtlas("inventory", handler.slots.stream().map(Slot::getStack).filter(itemStack -> !itemStack.isEmpty()).collect(Collectors.toList()), true);
cir.cancel();
}
}
}
use of net.minecraft.screen.slot.Slot in project Client by MatHax.
the class InventorySorter method generateActions.
private void generateActions() {
// Find all slots and sort them
List<MySlot> slots = new ArrayList<>();
for (Slot slot : screen.getScreenHandler().slots) {
if (getInvPart(slot) == originInvPart)
slots.add(new MySlot(((ISlot) slot).getId(), slot.getStack()));
}
slots.sort(Comparator.comparingInt(value -> value.id));
// Generate actions
generateStackingActions(slots);
generateSortingActions(slots);
}
use of net.minecraft.screen.slot.Slot in project CopperEquipment by Redy1aye.
the class DrayerScreenHandler 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 LittleMaidReBirth-Fabric by SistrScarlet.
the class LittleMaidScreenHandler method transferSlot.
// 18 + 2 + 4 = 24、24 + 4 * 9 = 60
// 0~17メイドインベントリ、18~19メインサブ、20~23防具、24~59プレイヤーインベントリ
@Override
public ItemStack transferSlot(PlayerEntity player, int invSlot) {
ItemStack newStack = ItemStack.EMPTY;
Slot slot = this.slots.get(invSlot);
if (slot == null || !slot.hasStack()) {
return newStack;
}
ItemStack originalStack = slot.getStack();
newStack = originalStack.copy();
if (invSlot < 18) {
// メイド->プレイヤー
if (!this.insertItem(originalStack, 24, 60, false)) {
return ItemStack.EMPTY;
}
} else if (invSlot < 24) {
// ハンド、防具->メイド
if (!this.insertItem(originalStack, 0, 18, true)) {
return ItemStack.EMPTY;
}
} else {
// プレイヤー->メイド
if (!this.insertItem(originalStack, 0, 18, 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 SinoCate by EverlastSino.
the class StoneMillScreenHandler method transferSlot.
@Override
public ItemStack transferSlot(PlayerEntity player, int invSlot) {
ItemStack newStack = ItemStack.EMPTY;
Slot slot = this.slots.get(invSlot);
if (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;
}
Aggregations