mirror of
https://github.com/Ellpeck/PrettyPipes.git
synced 2024-11-25 04:58:34 +01:00
Compare commits
No commits in common. "bdd507885e780831d2d7e90e0e321f7922ff99c4" and "219bf0e00a9c95a4ef3d42d787656474d1582c92" have entirely different histories.
bdd507885e
...
219bf0e00a
4 changed files with 9 additions and 12 deletions
|
@ -13,7 +13,7 @@ apply plugin: 'net.minecraftforge.gradle'
|
|||
apply plugin: 'eclipse'
|
||||
apply plugin: 'maven-publish'
|
||||
|
||||
version = '1.10.5'
|
||||
version = '1.10.4'
|
||||
group = 'de.ellpeck.prettypipes' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
archivesBaseName = 'PrettyPipes'
|
||||
|
||||
|
|
|
@ -172,7 +172,7 @@ public class ItemTerminalBlockEntity extends BlockEntity implements IPipeConnect
|
|||
return stack.getCount() - ret.getRight().getCount();
|
||||
}
|
||||
|
||||
public Player[] getLookingPlayers() {
|
||||
protected Player[] getLookingPlayers() {
|
||||
return this.level.players().stream().filter(p -> p.containerMenu instanceof ItemTerminalContainer container && container.tile == this).toArray(Player[]::new);
|
||||
}
|
||||
|
||||
|
|
|
@ -32,8 +32,7 @@ public class CraftingTerminalContainer extends ItemTerminalContainer {
|
|||
this.craftResult = new ResultContainer() {
|
||||
@Override
|
||||
public void setChanged() {
|
||||
for (var player : CraftingTerminalContainer.this.getTile().getLookingPlayers())
|
||||
player.containerMenu.slotsChanged(this);
|
||||
CraftingTerminalContainer.this.slotsChanged(this);
|
||||
}
|
||||
};
|
||||
this.addSlot(new ResultSlot(player, this.craftInventory, this.craftResult, 0, 25, 77));
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package de.ellpeck.prettypipes.terminal.containers;
|
||||
|
||||
import net.minecraft.world.entity.player.StackedContents;
|
||||
import net.minecraft.world.inventory.AbstractContainerMenu;
|
||||
import net.minecraft.world.inventory.CraftingContainer;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraftforge.items.ItemStackHandler;
|
||||
|
@ -8,9 +9,9 @@ import net.minecraftforge.items.ItemStackHandler;
|
|||
public class WrappedCraftingInventory extends CraftingContainer {
|
||||
|
||||
private final ItemStackHandler items;
|
||||
private final CraftingTerminalContainer eventHandler;
|
||||
private final AbstractContainerMenu eventHandler;
|
||||
|
||||
public WrappedCraftingInventory(ItemStackHandler items, CraftingTerminalContainer eventHandlerIn, int width, int height) {
|
||||
public WrappedCraftingInventory(ItemStackHandler items, AbstractContainerMenu eventHandlerIn, int width, int height) {
|
||||
super(eventHandlerIn, width, height);
|
||||
this.eventHandler = eventHandlerIn;
|
||||
this.items = items;
|
||||
|
@ -46,18 +47,15 @@ public class WrappedCraftingInventory extends CraftingContainer {
|
|||
public ItemStack removeItem(int index, int count) {
|
||||
var slotStack = this.items.getStackInSlot(index);
|
||||
var ret = !slotStack.isEmpty() && count > 0 ? slotStack.split(count) : ItemStack.EMPTY;
|
||||
if (!ret.isEmpty()) {
|
||||
for (var player : this.eventHandler.getTile().getLookingPlayers())
|
||||
player.containerMenu.slotsChanged(this);
|
||||
}
|
||||
if (!ret.isEmpty())
|
||||
this.eventHandler.slotsChanged(this);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setItem(int index, ItemStack stack) {
|
||||
this.items.setStackInSlot(index, stack);
|
||||
for (var player : this.eventHandler.getTile().getLookingPlayers())
|
||||
player.containerMenu.slotsChanged(this);
|
||||
this.eventHandler.slotsChanged(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue