Eliminated the deprecated "getSpeedMultiplier()" and "getEnergyMultiplier()" methods
This commit is contained in:
parent
523ec21467
commit
52efdac614
|
@ -1,44 +0,0 @@
|
|||
package mekanism.common;
|
||||
|
||||
/**
|
||||
* Implement this if your block or item can store Mekanism-based upgrades.
|
||||
* @author AidanBrady
|
||||
*
|
||||
*/
|
||||
public interface IUpgradeManagement
|
||||
{
|
||||
/**
|
||||
* Gets the energy multiplier from an item or block.
|
||||
* @param data - ItemStack parameter if getting from an item
|
||||
* @return energy multiplier
|
||||
*/
|
||||
public int getEnergyMultiplier(Object... data);
|
||||
|
||||
/**
|
||||
* Sets the energy multiplier of an item or block.
|
||||
* @param multiplier - new multiplier
|
||||
* @param data - ItemStack parameter if getting from an item
|
||||
*/
|
||||
public void setEnergyMultiplier(int multiplier, Object... data);
|
||||
|
||||
/**
|
||||
* Gets the speed multiplier from an item or block.
|
||||
* @param data - ItemStack parameter if getting from an item
|
||||
* @return speed multiplier
|
||||
*/
|
||||
public int getSpeedMultiplier(Object... data);
|
||||
|
||||
/**
|
||||
* Sets the speed multiplier of an item or block.
|
||||
* @param multiplier - new multiplier
|
||||
* @param data - ItemStack parameter if getting from an item
|
||||
*/
|
||||
public void setSpeedMultiplier(int multiplier, Object... data);
|
||||
|
||||
/**
|
||||
* Whether or not this item or block supports upgrades.
|
||||
* @param data - ItemStack parameter if getting from an item
|
||||
* @return if the item or block supports upgrades
|
||||
*/
|
||||
public boolean supportsUpgrades(Object... data);
|
||||
}
|
|
@ -2,7 +2,7 @@ package mekanism.common;
|
|||
|
||||
import mekanism.common.tile.component.TileComponentUpgrade;
|
||||
|
||||
public interface IUpgradeTile extends IUpgradeManagement
|
||||
public interface IUpgradeTile
|
||||
{
|
||||
public TileComponentUpgrade getComponent();
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ public enum Upgrade
|
|||
{
|
||||
Map<Upgrade, Integer> upgrades = new HashMap<Upgrade, Integer>();
|
||||
|
||||
if(nbtTags.hasKey("upgrades"))
|
||||
if(nbtTags != null && nbtTags.hasKey("upgrades"))
|
||||
{
|
||||
NBTTagList list = nbtTags.getTagList("upgrades", NBT.TAG_COMPOUND);
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@ import mekanism.common.IRedstoneControl;
|
|||
import mekanism.common.ISpecialBounds;
|
||||
import mekanism.common.ISustainedInventory;
|
||||
import mekanism.common.ISustainedTank;
|
||||
import mekanism.common.IUpgradeManagement;
|
||||
import mekanism.common.IUpgradeTile;
|
||||
import mekanism.common.ItemAttacher;
|
||||
import mekanism.common.Mekanism;
|
||||
|
@ -1013,7 +1012,7 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IPer
|
|||
itemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
if(((IUpgradeManagement)itemStack.getItem()).supportsUpgrades(itemStack))
|
||||
if(tileEntity instanceof IUpgradeTile)
|
||||
{
|
||||
((IUpgradeTile)tileEntity).getComponent().write(itemStack.stackTagCompound);
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@ import mekanism.common.IRedstoneControl;
|
|||
import mekanism.common.IRedstoneControl.RedstoneControl;
|
||||
import mekanism.common.ISustainedInventory;
|
||||
import mekanism.common.ISustainedTank;
|
||||
import mekanism.common.IUpgradeManagement;
|
||||
import mekanism.common.IUpgradeTile;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.Upgrade;
|
||||
|
@ -112,7 +111,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
@Interface(iface = "cofh.api.energy.IEnergyContainerItem", modid = "CoFHAPI|energy"),
|
||||
@Interface(iface = "ic2.api.item.ISpecialElectricItem", modid = "IC2API")
|
||||
})
|
||||
public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpecialElectricItem, IUpgradeManagement, IFactory, ISustainedInventory, ISustainedTank, IElectricChest, IEnergyContainerItem, IFluidContainerItem
|
||||
public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpecialElectricItem, IFactory, ISustainedInventory, ISustainedTank, IElectricChest, IEnergyContainerItem, IFluidContainerItem
|
||||
{
|
||||
public Block metaBlock;
|
||||
|
||||
|
@ -189,7 +188,7 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
|
|||
list.add(EnumColor.AQUA + MekanismUtils.localize("tooltip.inventory") + ": " + EnumColor.GREY + LangUtils.transYesNo(getInventory(itemstack) != null && getInventory(itemstack).tagCount() != 0));
|
||||
}
|
||||
|
||||
if(supportsUpgrades(itemstack) && itemstack.stackTagCompound != null && itemstack.stackTagCompound.hasKey("upgrades"))
|
||||
if(type.supportsUpgrades && itemstack.stackTagCompound != null && itemstack.stackTagCompound.hasKey("upgrades"))
|
||||
{
|
||||
Map<Upgrade, Integer> upgrades = Upgrade.buildMap(itemstack.stackTagCompound);
|
||||
|
||||
|
@ -498,87 +497,6 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyMultiplier(Object... data)
|
||||
{
|
||||
if(data[0] instanceof ItemStack)
|
||||
{
|
||||
ItemStack itemStack = (ItemStack)data[0];
|
||||
|
||||
if(itemStack.stackTagCompound == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return itemStack.stackTagCompound.getInteger("energyMultiplier");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnergyMultiplier(int multiplier, Object... data)
|
||||
{
|
||||
if(data[0] instanceof ItemStack)
|
||||
{
|
||||
ItemStack itemStack = (ItemStack)data[0];
|
||||
|
||||
if(itemStack.stackTagCompound == null)
|
||||
{
|
||||
itemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
itemStack.stackTagCompound.setInteger("energyMultiplier", multiplier);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSpeedMultiplier(Object... data)
|
||||
{
|
||||
if(data[0] instanceof ItemStack)
|
||||
{
|
||||
ItemStack itemStack = (ItemStack)data[0];
|
||||
|
||||
if(itemStack.stackTagCompound == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return itemStack.stackTagCompound.getInteger("speedMultiplier");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSpeedMultiplier(int multiplier, Object... data)
|
||||
{
|
||||
if(data[0] instanceof ItemStack)
|
||||
{
|
||||
ItemStack itemStack = (ItemStack)data[0];
|
||||
|
||||
if(itemStack.stackTagCompound == null)
|
||||
{
|
||||
itemStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
itemStack.stackTagCompound.setInteger("speedMultiplier", multiplier);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsUpgrades(Object... data)
|
||||
{
|
||||
if(data[0] instanceof ItemStack)
|
||||
{
|
||||
MachineType type = MachineType.get((ItemStack)data[0]);
|
||||
|
||||
return type.supportsUpgrades;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean tryPlaceContainedLiquid(World world, ItemStack itemstack, int x, int y, int z)
|
||||
{
|
||||
if(getFluidStack(itemstack) == null || !getFluidStack(itemstack).getFluid().canBePlacedInWorld())
|
||||
|
@ -993,7 +911,7 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
|
|||
@Override
|
||||
public double getMaxEnergy(ItemStack itemStack)
|
||||
{
|
||||
return MekanismUtils.getMaxEnergy(itemStack, this, MachineType.get(Block.getBlockFromItem(itemStack.getItem()), itemStack.getItemDamage()).baseEnergy);
|
||||
return MekanismUtils.getMaxEnergy(itemStack, MachineType.get(Block.getBlockFromItem(itemStack.getItem()), itemStack.getItemDamage()).baseEnergy);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -2,19 +2,21 @@ package mekanism.common.recipe;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import mekanism.api.energy.IEnergizedItem;
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.api.gas.IGasItem;
|
||||
import mekanism.common.IEnergyCube;
|
||||
import mekanism.common.IFactory;
|
||||
import mekanism.common.IUpgradeManagement;
|
||||
import mekanism.common.Upgrade;
|
||||
import mekanism.common.block.BlockMachine.MachineType;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
|
@ -201,27 +203,31 @@ public class MekanismRecipe implements IRecipe
|
|||
}
|
||||
}
|
||||
|
||||
if(toReturn.getItem() instanceof IUpgradeManagement && ((IUpgradeManagement)toReturn.getItem()).supportsUpgrades(toReturn))
|
||||
if(MachineType.get(toReturn).supportsUpgrades)
|
||||
{
|
||||
int speedUpgrades = 0;
|
||||
int energyUpgrades = 0;
|
||||
Map<Upgrade, Integer> upgrades = new HashMap<Upgrade, Integer>();
|
||||
|
||||
for(int i = 0; i < 9; i++)
|
||||
{
|
||||
ItemStack itemstack = inv.getStackInSlot(i);
|
||||
|
||||
if(itemstack != null)
|
||||
if(itemstack != null && MachineType.get(itemstack).supportsUpgrades)
|
||||
{
|
||||
if(itemstack.getItem() instanceof IUpgradeManagement && ((IUpgradeManagement)itemstack.getItem()).supportsUpgrades(toReturn))
|
||||
Map<Upgrade, Integer> stackMap = Upgrade.buildMap(itemstack.stackTagCompound);
|
||||
|
||||
for(Map.Entry<Upgrade, Integer> entry : stackMap.entrySet())
|
||||
{
|
||||
speedUpgrades = Math.min(8, speedUpgrades + ((IUpgradeManagement)itemstack.getItem()).getSpeedMultiplier(itemstack));
|
||||
energyUpgrades = Math.min(8, energyUpgrades + ((IUpgradeManagement)itemstack.getItem()).getEnergyMultiplier(itemstack));
|
||||
upgrades.put(entry.getKey(), Math.min(entry.getKey().getMax(), upgrades.get(entry.getKey()) + entry.getValue()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
((IUpgradeManagement)toReturn.getItem()).setSpeedMultiplier(speedUpgrades, toReturn);
|
||||
((IUpgradeManagement)toReturn.getItem()).setEnergyMultiplier(energyUpgrades, toReturn);
|
||||
if(toReturn.stackTagCompound == null)
|
||||
{
|
||||
toReturn.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
Upgrade.saveMap(upgrades, toReturn.stackTagCompound);
|
||||
}
|
||||
|
||||
return toReturn;
|
||||
|
|
|
@ -5,7 +5,6 @@ import io.netty.buffer.ByteBuf;
|
|||
import java.util.ArrayList;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.client.gui.GuiProgress.ProgressBar;
|
||||
import mekanism.client.sound.IHasSound;
|
||||
import mekanism.common.IActiveState;
|
||||
import mekanism.common.IEjector;
|
||||
|
@ -15,7 +14,6 @@ import mekanism.common.IRedstoneControl;
|
|||
import mekanism.common.IUpgradeTile;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.SideData;
|
||||
import mekanism.common.Upgrade;
|
||||
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
|
||||
import mekanism.common.tile.component.TileComponentEjector;
|
||||
import mekanism.common.tile.component.TileComponentUpgrade;
|
||||
|
@ -291,38 +289,6 @@ public abstract class TileEntityBasicMachine extends TileEntityElectricBlock imp
|
|||
return facing;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyMultiplier(Object... data)
|
||||
{
|
||||
return upgradeComponent.getUpgrades(Upgrade.ENERGY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnergyMultiplier(int multiplier, Object... data)
|
||||
{
|
||||
upgradeComponent.setUpgrades(Upgrade.ENERGY, multiplier);
|
||||
MekanismUtils.saveChunk(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSpeedMultiplier(Object... data)
|
||||
{
|
||||
return upgradeComponent.getUpgrades(Upgrade.SPEED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSpeedMultiplier(int multiplier, Object... data)
|
||||
{
|
||||
upgradeComponent.setUpgrades(Upgrade.SPEED, multiplier);
|
||||
MekanismUtils.saveChunk(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsUpgrades(Object... data)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSoundPath()
|
||||
{
|
||||
|
|
|
@ -22,7 +22,6 @@ import mekanism.common.IRedstoneControl;
|
|||
import mekanism.common.IUpgradeTile;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.SideData;
|
||||
import mekanism.common.Upgrade;
|
||||
import mekanism.common.block.BlockMachine.MachineType;
|
||||
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
|
||||
import mekanism.common.recipe.RecipeHandler;
|
||||
|
@ -503,38 +502,6 @@ public class TileEntityChemicalCrystallizer extends TileEntityElectricBlock impl
|
|||
return ejectorComponent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyMultiplier(Object... data)
|
||||
{
|
||||
return upgradeComponent.getUpgrades(Upgrade.ENERGY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnergyMultiplier(int multiplier, Object... data)
|
||||
{
|
||||
upgradeComponent.setUpgrades(Upgrade.ENERGY, multiplier);
|
||||
MekanismUtils.saveChunk(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSpeedMultiplier(Object... data)
|
||||
{
|
||||
return upgradeComponent.getUpgrades(Upgrade.SPEED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSpeedMultiplier(int multiplier, Object... data)
|
||||
{
|
||||
upgradeComponent.setUpgrades(Upgrade.SPEED, multiplier);
|
||||
MekanismUtils.saveChunk(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsUpgrades(Object... data)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileComponentUpgrade getComponent()
|
||||
{
|
||||
|
|
|
@ -18,7 +18,6 @@ import mekanism.common.IActiveState;
|
|||
import mekanism.common.IRedstoneControl;
|
||||
import mekanism.common.IUpgradeTile;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.Upgrade;
|
||||
import mekanism.common.block.BlockMachine.MachineType;
|
||||
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
|
||||
import mekanism.common.recipe.RecipeHandler;
|
||||
|
@ -435,38 +434,6 @@ public class TileEntityChemicalDissolutionChamber extends TileEntityElectricBloc
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyMultiplier(Object... data)
|
||||
{
|
||||
return upgradeComponent.getUpgrades(Upgrade.ENERGY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnergyMultiplier(int multiplier, Object... data)
|
||||
{
|
||||
upgradeComponent.setUpgrades(Upgrade.ENERGY, multiplier);
|
||||
MekanismUtils.saveChunk(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSpeedMultiplier(Object... data)
|
||||
{
|
||||
return upgradeComponent.getUpgrades(Upgrade.SPEED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSpeedMultiplier(int multiplier, Object... data)
|
||||
{
|
||||
upgradeComponent.setUpgrades(Upgrade.SPEED, multiplier);
|
||||
MekanismUtils.saveChunk(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsUpgrades(Object... data)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileComponentUpgrade getComponent()
|
||||
{
|
||||
|
|
|
@ -17,7 +17,6 @@ import mekanism.common.IActiveState;
|
|||
import mekanism.common.IRedstoneControl;
|
||||
import mekanism.common.IUpgradeTile;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.Upgrade;
|
||||
import mekanism.common.block.BlockMachine.MachineType;
|
||||
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
|
||||
import mekanism.common.recipe.RecipeHandler;
|
||||
|
@ -361,38 +360,6 @@ public class TileEntityChemicalOxidizer extends TileEntityElectricBlock implemen
|
|||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyMultiplier(Object... data)
|
||||
{
|
||||
return upgradeComponent.getUpgrades(Upgrade.ENERGY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnergyMultiplier(int multiplier, Object... data)
|
||||
{
|
||||
upgradeComponent.setUpgrades(Upgrade.ENERGY, multiplier);
|
||||
MekanismUtils.saveChunk(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSpeedMultiplier(Object... data)
|
||||
{
|
||||
return upgradeComponent.getUpgrades(Upgrade.SPEED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSpeedMultiplier(int multiplier, Object... data)
|
||||
{
|
||||
upgradeComponent.setUpgrades(Upgrade.SPEED, multiplier);
|
||||
MekanismUtils.saveChunk(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsUpgrades(Object... data)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileComponentUpgrade getComponent()
|
||||
{
|
||||
|
|
|
@ -19,7 +19,6 @@ import mekanism.common.ILogisticalTransporter;
|
|||
import mekanism.common.IRedstoneControl;
|
||||
import mekanism.common.IUpgradeTile;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.Upgrade;
|
||||
import mekanism.common.block.BlockMachine.MachineType;
|
||||
import mekanism.common.inventory.container.ContainerFilter;
|
||||
import mekanism.common.inventory.container.ContainerNull;
|
||||
|
@ -965,38 +964,6 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
|
|||
return upgradeComponent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyMultiplier(Object... data)
|
||||
{
|
||||
return upgradeComponent.getUpgrades(Upgrade.ENERGY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnergyMultiplier(int multiplier, Object... data)
|
||||
{
|
||||
upgradeComponent.setUpgrades(Upgrade.ENERGY, multiplier);
|
||||
MekanismUtils.saveChunk(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSpeedMultiplier(Object... data)
|
||||
{
|
||||
return upgradeComponent.getUpgrades(Upgrade.SPEED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSpeedMultiplier(int multiplier, Object... data)
|
||||
{
|
||||
upgradeComponent.setUpgrades(Upgrade.SPEED, multiplier);
|
||||
MekanismUtils.saveChunk(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsUpgrades(Object... data)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setActive(boolean active)
|
||||
{
|
||||
|
|
|
@ -20,11 +20,9 @@ import mekanism.common.IEjector;
|
|||
import mekanism.common.IFactory.RecipeType;
|
||||
import mekanism.common.IInvConfiguration;
|
||||
import mekanism.common.IRedstoneControl;
|
||||
import mekanism.common.IUpgradeManagement;
|
||||
import mekanism.common.IUpgradeTile;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.SideData;
|
||||
import mekanism.common.Upgrade;
|
||||
import mekanism.common.Tier.FactoryTier;
|
||||
import mekanism.common.block.BlockMachine.MachineType;
|
||||
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
|
||||
|
@ -189,10 +187,13 @@ public class TileEntityFactory extends TileEntityElectricBlock implements IPerip
|
|||
recipeTicks = 0;
|
||||
|
||||
ItemStack returnStack = getMachineStack();
|
||||
IUpgradeManagement mgmt = (IUpgradeManagement)inventory[2].getItem();
|
||||
|
||||
((IUpgradeManagement)returnStack.getItem()).setEnergyMultiplier(mgmt.getEnergyMultiplier(inventory[2]), returnStack);
|
||||
((IUpgradeManagement)returnStack.getItem()).setSpeedMultiplier(mgmt.getSpeedMultiplier(inventory[2]), returnStack);
|
||||
if(returnStack.stackTagCompound == null)
|
||||
{
|
||||
returnStack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
|
||||
upgradeComponent.write(returnStack.stackTagCompound);
|
||||
|
||||
inventory[2] = null;
|
||||
inventory[3] = returnStack;
|
||||
|
@ -823,38 +824,6 @@ public class TileEntityFactory extends TileEntityElectricBlock implements IPerip
|
|||
return facing;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyMultiplier(Object... data)
|
||||
{
|
||||
return upgradeComponent.getUpgrades(Upgrade.ENERGY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnergyMultiplier(int multiplier, Object... data)
|
||||
{
|
||||
upgradeComponent.setUpgrades(Upgrade.ENERGY, multiplier);
|
||||
MekanismUtils.saveChunk(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSpeedMultiplier(Object... data)
|
||||
{
|
||||
return upgradeComponent.getUpgrades(Upgrade.SPEED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSpeedMultiplier(int multiplier, Object... data)
|
||||
{
|
||||
upgradeComponent.setUpgrades(Upgrade.SPEED, multiplier);
|
||||
MekanismUtils.saveChunk(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsUpgrades(Object... data)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSoundPath()
|
||||
{
|
||||
|
|
|
@ -20,7 +20,6 @@ import mekanism.common.IUpgradeTile;
|
|||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.PacketHandler;
|
||||
import mekanism.common.SideData;
|
||||
import mekanism.common.Upgrade;
|
||||
import mekanism.common.block.BlockMachine.MachineType;
|
||||
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
|
||||
import mekanism.common.recipe.RecipeHandler;
|
||||
|
@ -545,38 +544,6 @@ public class TileEntityMetallurgicInfuser extends TileEntityElectricBlock implem
|
|||
return facing;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyMultiplier(Object... data)
|
||||
{
|
||||
return upgradeComponent.getUpgrades(Upgrade.ENERGY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnergyMultiplier(int multiplier, Object... data)
|
||||
{
|
||||
upgradeComponent.setUpgrades(Upgrade.ENERGY, multiplier);
|
||||
MekanismUtils.saveChunk(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSpeedMultiplier(Object... data)
|
||||
{
|
||||
return upgradeComponent.getUpgrades(Upgrade.SPEED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSpeedMultiplier(int multiplier, Object... data)
|
||||
{
|
||||
upgradeComponent.setUpgrades(Upgrade.SPEED, multiplier);
|
||||
MekanismUtils.saveChunk(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsUpgrades(Object... data)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSoundPath()
|
||||
{
|
||||
|
|
|
@ -11,6 +11,7 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import mekanism.api.Chunk3D;
|
||||
import mekanism.api.Coord4D;
|
||||
|
@ -26,12 +27,13 @@ import mekanism.common.IInvConfiguration;
|
|||
import mekanism.common.IModule;
|
||||
import mekanism.common.IRedstoneControl;
|
||||
import mekanism.common.IRedstoneControl.RedstoneControl;
|
||||
import mekanism.common.IUpgradeManagement;
|
||||
import mekanism.common.IUpgradeTile;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.OreDictCache;
|
||||
import mekanism.common.Teleporter;
|
||||
import mekanism.common.Tier.EnergyCubeTier;
|
||||
import mekanism.common.Tier.FactoryTier;
|
||||
import mekanism.common.Upgrade;
|
||||
import mekanism.common.Version;
|
||||
import mekanism.common.inventory.container.ContainerElectricChest;
|
||||
import mekanism.common.item.ItemBlockEnergyCube;
|
||||
|
@ -603,9 +605,9 @@ public final class MekanismUtils
|
|||
* @param def - the original, default ticks required
|
||||
* @return max operating ticks
|
||||
*/
|
||||
public static int getTicks(IUpgradeManagement mgmt, int def)
|
||||
public static int getTicks(IUpgradeTile mgmt, int def)
|
||||
{
|
||||
return (int)(def * Math.pow(Mekanism.maxUpgradeMultiplier, -mgmt.getSpeedMultiplier()/8.0));
|
||||
return (int)(def * Math.pow(Mekanism.maxUpgradeMultiplier, -mgmt.getComponent().getUpgrades(Upgrade.SPEED)/8.0));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -615,9 +617,9 @@ public final class MekanismUtils
|
|||
* @param def - the original, default energy required
|
||||
* @return max energy per tick
|
||||
*/
|
||||
public static double getEnergyPerTick(IUpgradeManagement mgmt, double def)
|
||||
public static double getEnergyPerTick(IUpgradeTile mgmt, double def)
|
||||
{
|
||||
return def * Math.pow(Mekanism.maxUpgradeMultiplier, (2*mgmt.getSpeedMultiplier()-mgmt.getEnergyMultiplier())/8.0);
|
||||
return def * Math.pow(Mekanism.maxUpgradeMultiplier, (2*mgmt.getComponent().getUpgrades(Upgrade.SPEED)-mgmt.getComponent().getUpgrades(Upgrade.ENERGY))/8.0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -626,9 +628,9 @@ public final class MekanismUtils
|
|||
* @param def - original, default max energy
|
||||
* @return max energy
|
||||
*/
|
||||
public static double getMaxEnergy(IUpgradeManagement mgmt, double def)
|
||||
public static double getMaxEnergy(IUpgradeTile mgmt, double def)
|
||||
{
|
||||
return def * Math.pow(Mekanism.maxUpgradeMultiplier, mgmt.getEnergyMultiplier()/8.0);
|
||||
return def * Math.pow(Mekanism.maxUpgradeMultiplier, mgmt.getComponent().getUpgrades(Upgrade.ENERGY)/8.0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -637,9 +639,10 @@ public final class MekanismUtils
|
|||
* @param def - original, default max energy
|
||||
* @return max energy
|
||||
*/
|
||||
public static double getMaxEnergy(ItemStack itemStack, IUpgradeManagement mgmt, double def)
|
||||
public static double getMaxEnergy(ItemStack itemStack, double def)
|
||||
{
|
||||
return def * Math.pow(Mekanism.maxUpgradeMultiplier, mgmt.getEnergyMultiplier(itemStack)/8.0);
|
||||
Map<Upgrade, Integer> upgrades = Upgrade.buildMap(itemStack.stackTagCompound);
|
||||
return def * Math.pow(Mekanism.maxUpgradeMultiplier, upgrades.get(Upgrade.ENERGY)/8.0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue