mirror of
https://github.com/Ellpeck/PrettyPipes.git
synced 2024-11-24 20:48:34 +01:00
Compare commits
3 commits
27e6fa7f79
...
5dfeb8ad48
Author | SHA1 | Date | |
---|---|---|---|
5dfeb8ad48 | |||
416e5ced97 | |||
87a3c2aed6 |
4 changed files with 13 additions and 18 deletions
|
@ -13,7 +13,7 @@ apply plugin: 'net.minecraftforge.gradle'
|
|||
apply plugin: 'eclipse'
|
||||
apply plugin: 'maven-publish'
|
||||
|
||||
version = '1.10.1'
|
||||
version = '1.10.2'
|
||||
group = 'de.ellpeck.prettypipes' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
archivesBaseName = 'PrettyPipes'
|
||||
|
||||
|
|
|
@ -16,28 +16,28 @@ public class FilterSlot extends SlotItemHandler {
|
|||
this.onlyOneItem = onlyOneItem;
|
||||
}
|
||||
|
||||
public static boolean checkFilter(AbstractContainerMenu container, int slotId, Player player) {
|
||||
if (slotId >= 0 && slotId < container.slots.size()) {
|
||||
var slot = container.getSlot(slotId);
|
||||
public static boolean checkFilter(AbstractContainerMenu menu, int slotId) {
|
||||
if (slotId >= 0 && slotId < menu.slots.size()) {
|
||||
var slot = menu.getSlot(slotId);
|
||||
if (slot instanceof FilterSlot) {
|
||||
((FilterSlot) slot).slotClick(player);
|
||||
((FilterSlot) slot).slotClick(menu);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void slotClick(Player player) {
|
||||
var heldStack = player.inventoryMenu.getCarried();
|
||||
private void slotClick(AbstractContainerMenu menu) {
|
||||
var heldStack = menu.getCarried();
|
||||
var stackInSlot = this.getItem();
|
||||
|
||||
if (!stackInSlot.isEmpty() && heldStack.isEmpty()) {
|
||||
this.safeInsert(ItemStack.EMPTY);
|
||||
this.set(ItemStack.EMPTY);
|
||||
} else if (!heldStack.isEmpty()) {
|
||||
var s = heldStack.copy();
|
||||
if (this.onlyOneItem)
|
||||
s.setCount(1);
|
||||
this.safeInsert(s);
|
||||
this.set(s);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -46,11 +46,6 @@ public class FilterSlot extends SlotItemHandler {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack safeInsert(ItemStack stack) {
|
||||
return super.safeInsert(stack.copy());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mayPickup(Player playerIn) {
|
||||
return false;
|
||||
|
|
|
@ -52,7 +52,7 @@ public abstract class AbstractPipeContainer<T extends IModule> extends AbstractC
|
|||
|
||||
@Override
|
||||
public void clicked(int slotId, int dragType, ClickType clickTypeIn, Player player) {
|
||||
if (FilterSlot.checkFilter(this, slotId, player))
|
||||
if (FilterSlot.checkFilter(this, slotId))
|
||||
return;
|
||||
super.clicked(slotId, dragType, clickTypeIn, player);
|
||||
}
|
||||
|
|
|
@ -27,14 +27,14 @@ public class CraftingTerminalContainer extends ItemTerminalContainer {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void addDataSlots(ContainerData data) {
|
||||
protected void addOwnSlots(Player player) {
|
||||
this.craftInventory = new WrappedCraftingInventory(this.getTile().craftItems, this, 3, 3);
|
||||
this.craftResult = new ResultContainer();
|
||||
this.addSlot(new ResultSlot(this.player, this.craftInventory, this.craftResult, 0, 25, 77));
|
||||
this.addSlot(new ResultSlot(player, this.craftInventory, this.craftResult, 0, 25, 77));
|
||||
for (var i = 0; i < 3; i++)
|
||||
for (var j = 0; j < 3; j++)
|
||||
this.addSlot(new Slot(this.craftInventory, j + i * 3, 7 + j * 18, 18 + i * 18));
|
||||
super.addDataSlots(data);
|
||||
super.addOwnSlots(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue