Search in sources :

Example 61 with DimletKey

use of mcjty.rftoolsdim.dimensions.dimlets.DimletKey in project RFToolsDimensions by McJty.

the class DimensionDescriptor method calculateMaintenanceRfCost.

// Calculate the maintenance cost of a dimension without bonus dimlets.
private int calculateMaintenanceRfCost(List<Pair<DimletKey, List<DimletKey>>> dimlets) {
    int rf = DimletCosts.baseDimensionMaintenanceCost;
    for (Pair<DimletKey, List<DimletKey>> dimletWithModifier : dimlets) {
        DimletKey key = dimletWithModifier.getLeft();
        DimletType type = key.getType();
        List<DimletKey> list = dimletWithModifier.getRight();
        if (list != null) {
            for (DimletKey modifier : list) {
                float mult = type.dimletType.getModifierMaintainCostFactor(modifier.getType(), key);
                rf += (int) (getMaintenanceCost(modifier.getType(), modifier) * mult);
            }
        }
        int c = getMaintenanceCost(type, key);
        if (c > 0) {
            rf += c;
        }
    }
    return rf;
}
Also used : DimletType(mcjty.rftoolsdim.dimensions.dimlets.types.DimletType) ArrayList(java.util.ArrayList) List(java.util.List) DimletKey(mcjty.rftoolsdim.dimensions.dimlets.DimletKey)

Aggregations

DimletKey (mcjty.rftoolsdim.dimensions.dimlets.DimletKey)61 ArrayList (java.util.ArrayList)19 List (java.util.List)15 Settings (mcjty.rftoolsdim.config.Settings)14 ItemStack (net.minecraft.item.ItemStack)14 DimletType (mcjty.rftoolsdim.dimensions.dimlets.types.DimletType)13 Block (net.minecraft.block.Block)10 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)7 IBlockState (net.minecraft.block.state.IBlockState)6 TerrainType (mcjty.rftoolsdim.dimensions.types.TerrainType)5 DimensionDescriptor (mcjty.rftoolsdim.dimensions.description.DimensionDescriptor)3 IDimletType (mcjty.rftoolsdim.dimensions.dimlets.types.IDimletType)3 ControllerType (mcjty.rftoolsdim.dimensions.types.ControllerType)3 FeatureType (mcjty.rftoolsdim.dimensions.types.FeatureType)3 ResourceLocation (net.minecraft.util.ResourceLocation)3 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)3 Pair (org.apache.commons.lang3.tuple.Pair)3 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 Argument (mcjty.lib.network.Argument)2