Finish off the rendering for the upgrades.

This commit is contained in:
modmuss50 2017-04-11 21:10:48 +01:00
parent e05c132c3a
commit 5487584f04
No known key found for this signature in database
GPG key ID: 773D17BE8BF49C82
6 changed files with 23 additions and 4 deletions

View file

@ -119,7 +119,7 @@ public class ContainerTileInventoryBuilder {
private ContainerTileInventoryBuilder upgradeSlots(IUpgradeable upgradeable){
if(upgradeable.canBeUpgraded()){
for (int i = 0; i < upgradeable.getUpgradeSlotCount(); i++) {
this.parent.slots.add(new FilteredSlot(upgradeable.getUpgradeInvetory(), i, -22, i * 22 + 5)
this.parent.slots.add(new FilteredSlot(upgradeable.getUpgradeInvetory(), i, -19, i * 18 + 12, 1)
.setFilter(stack -> stack.getItem() instanceof IUpgrade));
}
}

View file

@ -33,11 +33,17 @@ import java.util.function.Predicate;
public class FilteredSlot extends Slot {
private Predicate<ItemStack> filter;
private int stackLimit = 64;
public FilteredSlot(final IInventory inventory, final int index, final int xPosition, final int yPosition) {
super(inventory, index, xPosition, yPosition);
}
public FilteredSlot(final IInventory inventory, final int index, final int xPosition, final int yPosition, int stackLimit) {
super(inventory, index, xPosition, yPosition);
this.stackLimit = stackLimit;
}
public FilteredSlot setFilter(final Predicate<ItemStack> filter) {
this.filter = filter;
return this;
@ -51,4 +57,9 @@ public class FilteredSlot extends Slot {
return true;
}
}
@Override
public int getSlotStackLimit() {
return stackLimit;
}
}