Finish off the rendering for the upgrades.
This commit is contained in:
parent
e05c132c3a
commit
5487584f04
6 changed files with 23 additions and 4 deletions
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,9 +100,10 @@ public class GuiBase extends GuiContainer {
|
|||
if(tile instanceof IUpgradeable){
|
||||
IUpgradeable upgradeable = (IUpgradeable) tile;
|
||||
if(upgradeable.canBeUpgraded()){
|
||||
for (int i = 0; i < upgradeable.getUpgradeSlotCount(); i++) {
|
||||
drawSlot(-22, i * 22 + 5, Layer.BACKGROUND);
|
||||
}
|
||||
// for (int i = 0; i < upgradeable.getUpgradeSlotCount(); i++) {
|
||||
// drawSlot(-22, i * 22 + 5, Layer.BACKGROUND);
|
||||
// }
|
||||
builder.drawUpgrades(this, upgradeable, guiLeft, guiTop);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ import net.minecraft.util.text.translation.I18n;
|
|||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fml.client.config.GuiUtils;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
import reborncore.api.tile.IUpgradeable;
|
||||
import reborncore.client.guibuilder.GuiBuilder;
|
||||
import reborncore.common.powerSystem.PowerSystem;
|
||||
import techreborn.lib.ModInfo;
|
||||
|
@ -330,6 +331,11 @@ public class TRBuilder extends GuiBuilder {
|
|||
gui.drawTexturedModalRect(posX, posY, 150, 0, 18, 18);
|
||||
}
|
||||
|
||||
public void drawUpgrades(GuiScreen gui, IUpgradeable upgradeable, int posX, int posY) {
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(GUI_SHEET);
|
||||
gui.drawTexturedModalRect(posX -27, posY + 4, 126, 151, 30, 87);
|
||||
}
|
||||
|
||||
public void drawOutputSlot(GuiScreen gui, int posX, int posY) {
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(GUI_SHEET);
|
||||
gui.drawTexturedModalRect(posX, posY, 150, 18, 26, 26);
|
||||
|
|
|
@ -57,6 +57,7 @@ public class ItemUpgrades extends ItemTRNoDestroy implements IUpgrade {
|
|||
setUnlocalizedName("techreborn.upgrade");
|
||||
setHasSubtypes(true);
|
||||
setCreativeTab(TechRebornCreativeTabMisc.instance);
|
||||
setMaxStackSize(1);
|
||||
}
|
||||
|
||||
public static ItemStack getUpgradeByName(String name, int count) {
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 25 KiB |
Loading…
Reference in a new issue