mirror of
https://github.com/Ellpeck/PrettyPipes.git
synced 2024-11-25 13:08:34 +01:00
Compare commits
No commits in common. "ae182423c1ada365fb289d4e70d0bce291f8306b" and "58e0eaa336f706f4cff4bdec6496ef65f56c947a" have entirely different histories.
ae182423c1
...
58e0eaa336
4 changed files with 10 additions and 12 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.9.6'
|
version = '1.9.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'
|
||||||
|
|
||||||
|
|
|
@ -175,7 +175,7 @@ public class ItemTerminalTileEntity extends TileEntity implements INamedContaine
|
||||||
return stack.getCount() - ret.getRight().getCount();
|
return stack.getCount() - ret.getRight().getCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlayerEntity[] getLookingPlayers() {
|
protected PlayerEntity[] getLookingPlayers() {
|
||||||
return this.world.getPlayers().stream()
|
return this.world.getPlayers().stream()
|
||||||
.filter(p -> p.openContainer instanceof ItemTerminalContainer)
|
.filter(p -> p.openContainer instanceof ItemTerminalContainer)
|
||||||
.filter(p -> ((ItemTerminalContainer) p.openContainer).tile == this)
|
.filter(p -> ((ItemTerminalContainer) p.openContainer).tile == this)
|
||||||
|
|
|
@ -39,8 +39,7 @@ public class CraftingTerminalContainer extends ItemTerminalContainer {
|
||||||
this.craftResult = new CraftResultInventory() {
|
this.craftResult = new CraftResultInventory() {
|
||||||
@Override
|
@Override
|
||||||
public void markDirty() {
|
public void markDirty() {
|
||||||
for (PlayerEntity player : CraftingTerminalContainer.this.getTile().getLookingPlayers())
|
CraftingTerminalContainer.this.onCraftMatrixChanged(this);
|
||||||
player.openContainer.onCraftMatrixChanged(this);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
this.addSlot(new CraftingResultSlot(player, this.craftInventory, this.craftResult, 0, 25, 77));
|
this.addSlot(new CraftingResultSlot(player, this.craftInventory, this.craftResult, 0, 25, 77));
|
||||||
|
|
|
@ -2,6 +2,8 @@ package de.ellpeck.prettypipes.terminal.containers;
|
||||||
|
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.inventory.CraftingInventory;
|
import net.minecraft.inventory.CraftingInventory;
|
||||||
|
import net.minecraft.inventory.ItemStackHelper;
|
||||||
|
import net.minecraft.inventory.container.Container;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.crafting.RecipeItemHelper;
|
import net.minecraft.item.crafting.RecipeItemHelper;
|
||||||
import net.minecraftforge.items.ItemStackHandler;
|
import net.minecraftforge.items.ItemStackHandler;
|
||||||
|
@ -9,9 +11,9 @@ import net.minecraftforge.items.ItemStackHandler;
|
||||||
public class WrappedCraftingInventory extends CraftingInventory {
|
public class WrappedCraftingInventory extends CraftingInventory {
|
||||||
|
|
||||||
private final ItemStackHandler items;
|
private final ItemStackHandler items;
|
||||||
private final CraftingTerminalContainer eventHandler;
|
private final Container eventHandler;
|
||||||
|
|
||||||
public WrappedCraftingInventory(ItemStackHandler items, CraftingTerminalContainer eventHandlerIn, int width, int height) {
|
public WrappedCraftingInventory(ItemStackHandler items, Container 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,18 +49,15 @@ public class WrappedCraftingInventory extends CraftingInventory {
|
||||||
public ItemStack decrStackSize(int index, int count) {
|
public ItemStack decrStackSize(int index, int count) {
|
||||||
ItemStack slotStack = this.items.getStackInSlot(index);
|
ItemStack slotStack = this.items.getStackInSlot(index);
|
||||||
ItemStack ret = !slotStack.isEmpty() && count > 0 ? slotStack.split(count) : ItemStack.EMPTY;
|
ItemStack ret = !slotStack.isEmpty() && count > 0 ? slotStack.split(count) : ItemStack.EMPTY;
|
||||||
if (!ret.isEmpty()) {
|
if (!ret.isEmpty())
|
||||||
for (PlayerEntity player : this.eventHandler.getTile().getLookingPlayers())
|
this.eventHandler.onCraftMatrixChanged(this);
|
||||||
player.openContainer.onCraftMatrixChanged(this);
|
|
||||||
}
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setInventorySlotContents(int index, ItemStack stack) {
|
public void setInventorySlotContents(int index, ItemStack stack) {
|
||||||
this.items.setStackInSlot(index, stack);
|
this.items.setStackInSlot(index, stack);
|
||||||
for (PlayerEntity player : this.eventHandler.getTile().getLookingPlayers())
|
this.eventHandler.onCraftMatrixChanged(this);
|
||||||
player.openContainer.onCraftMatrixChanged(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue