Got the upgrades working, just need the textures.

This commit is contained in:
modmuss50 2017-04-11 13:21:23 +01:00
parent cda60c7b8f
commit 4f05367f52
No known key found for this signature in database
GPG key ID: 773D17BE8BF49C82
3 changed files with 21 additions and 1 deletions

View file

@ -38,6 +38,7 @@ import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import reborncore.api.power.IEnergyInterfaceItem;
import reborncore.api.recipe.IRecipeCrafterProvider;
import reborncore.api.tile.IUpgrade;
import reborncore.api.tile.IUpgradeable;
import reborncore.client.gui.slots.BaseSlot;
import reborncore.client.gui.slots.SlotFake;
import reborncore.client.gui.slots.SlotOutput;
@ -61,6 +62,9 @@ public class ContainerTileInventoryBuilder {
this.tile = tile;
this.parent = parent;
this.rangeStart = parent.slots.size();
if(tile instanceof IUpgradeable){
upgradeSlots((IUpgradeable) tile);
}
}
public ContainerTileInventoryBuilder slot(final int index, final int x, final int y) {
@ -105,12 +109,23 @@ public class ContainerTileInventoryBuilder {
return this;
}
@Deprecated
public ContainerTileInventoryBuilder upgradeSlot(final int index, final int x, final int y) {
this.parent.slots.add(new FilteredSlot(this.tile, index, x, y)
.setFilter(stack -> stack.getItem() instanceof IUpgrade));
return this;
}
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, 0, i * 22)
.setFilter(stack -> stack.getItem() instanceof IUpgrade));
}
}
return this;
}
/**
*
* @param supplier

View file

@ -101,7 +101,7 @@ public class ItemUpgrades extends ItemTRNoDestroy implements IUpgrade {
ItemStack stack) {
if(crafter != null){
if (stack.getItemDamage() == 0) {
crafter.addSpeedMulti(0.2);
crafter.addSpeedMulti(0.25);
crafter.addPowerMulti(0.5);
}
}

View file

@ -185,4 +185,9 @@ implements IWrenchable, IInventoryProvider, IRecipeCrafterProvider, IContainerPr
.tile(this).slot(0, 55, 45).outputSlot(1, 101, 45).syncEnergyValue().syncCrafterValue().addInventory()
.create();
}
@Override
public boolean canBeUpgraded() {
return true;
}
}