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