PrettyPipes/src/main/java/de/ellpeck/prettypipes/pressurizer/PressurizerContainer.java

38 lines
1.3 KiB
Java
Raw Normal View History

2020-10-13 18:11:40 +02:00
package de.ellpeck.prettypipes.pressurizer;
import de.ellpeck.prettypipes.Utility;
2021-12-02 12:31:04 +01:00
import net.minecraft.core.BlockPos;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.inventory.MenuType;
import net.minecraft.world.inventory.Slot;
import net.minecraft.world.item.ItemStack;
2020-10-13 18:11:40 +02:00
import javax.annotation.Nullable;
2021-12-02 12:31:04 +01:00
public class PressurizerContainer extends AbstractContainerMenu {
2021-12-02 15:25:46 +01:00
2021-12-02 12:31:04 +01:00
public final PressurizerBlockEntity tile;
2020-10-13 18:11:40 +02:00
2021-12-02 12:31:04 +01:00
public PressurizerContainer(@Nullable MenuType<?> type, int id, Player player, BlockPos pos) {
2020-10-13 18:11:40 +02:00
super(type, id);
2023-07-07 19:54:52 +02:00
this.tile = Utility.getBlockEntity(PressurizerBlockEntity.class, player.level(), pos);
2020-10-13 18:11:40 +02:00
2021-12-02 15:25:46 +01:00
for (var l = 0; l < 3; ++l)
for (var j1 = 0; j1 < 9; ++j1)
2021-12-02 12:31:04 +01:00
this.addSlot(new Slot(player.getInventory(), j1 + l * 9 + 9, 8 + j1 * 18, 55 + l * 18));
2021-12-02 15:25:46 +01:00
for (var i1 = 0; i1 < 9; ++i1)
2021-12-02 12:31:04 +01:00
this.addSlot(new Slot(player.getInventory(), i1, 8 + i1 * 18, 113));
2020-10-13 18:11:40 +02:00
}
@Override
2021-12-02 15:25:46 +01:00
public ItemStack quickMoveStack(Player player, int slotIndex) {
return Utility.transferStackInSlot(this, this::moveItemStackTo, player, slotIndex, stack -> null);
2020-10-13 18:11:40 +02:00
}
@Override
2021-12-02 15:25:46 +01:00
public boolean stillValid(Player player) {
2020-10-13 18:11:40 +02:00
return true;
}
}