Search in sources :

Example 16 with DimletType

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

the class KnownDimletConfiguration method getRandomPartLists.

public static List<List<ItemStack>> getRandomPartLists() {
    if (randomPartLists == null) {
        randomPartLists = new ArrayList<>();
        randomPartLists.add(Lists.newArrayList(new ItemStack(ModItems.dimletBaseItem), new ItemStack(ModItems.dimletControlCircuitItem, 1, 0), new ItemStack(ModItems.dimletEnergyModuleItem)));
        randomPartLists.add(Lists.newArrayList(new ItemStack(ModItems.dimletControlCircuitItem, 1, 1), new ItemStack(ModItems.dimletEnergyModuleItem, 1, 0), new ItemStack(ModItems.dimletMemoryUnitItem, 1, 0)));
        randomPartLists.add(Lists.newArrayList(new ItemStack(ModItems.dimletControlCircuitItem, 1, 2)));
        ArrayList<ItemStack> list3 = Lists.newArrayList(new ItemStack(ModItems.dimletControlCircuitItem, 1, 3), new ItemStack(ModItems.dimletEnergyModuleItem, 1, 1), new ItemStack(ModItems.dimletMemoryUnitItem, 1, 1));
        for (DimletType type : DimletType.values()) {
            list3.add(new ItemStack(ModItems.dimletTypeControllerItem, 1, type.ordinal()));
        }
        randomPartLists.add(list3);
        randomPartLists.add(Lists.newArrayList(new ItemStack(ModItems.dimletControlCircuitItem, 1, 4)));
        randomPartLists.add(Lists.newArrayList(new ItemStack(ModItems.dimletControlCircuitItem, 1, 5), new ItemStack(ModItems.dimletEnergyModuleItem, 1, 2), new ItemStack(ModItems.dimletMemoryUnitItem, 1, 2)));
        randomPartLists.add(Lists.newArrayList(new ItemStack(ModItems.dimletControlCircuitItem, 1, 6)));
    }
    return randomPartLists;
}
Also used : DimletType(mcjty.rftoolsdim.dimensions.dimlets.types.DimletType) ItemStack(net.minecraft.item.ItemStack)

Example 17 with DimletType

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

the class DimensionDescriptor method calculateBonus.

private int calculateBonus(List<Pair<DimletKey, List<DimletKey>>> dimlets) {
    int rfGain = 0;
    for (Pair<DimletKey, List<DimletKey>> dimletWithModifier : dimlets) {
        DimletKey key = dimletWithModifier.getLeft();
        DimletType type = key.getType();
        int c = getMaintenanceCost(type, key);
        if (c < 0) {
            // This dimlet gives a bonus in cost. This value is a percentage.
            rfGain -= c;
        }
    }
    return rfGain;
}
Also used : DimletType(mcjty.rftoolsdim.dimensions.dimlets.types.DimletType) ArrayList(java.util.ArrayList) List(java.util.List) DimletKey(mcjty.rftoolsdim.dimensions.dimlets.DimletKey)

Example 18 with DimletType

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

the class DimensionDescriptor method calculateTickCost.

private int calculateTickCost(List<Pair<DimletKey, List<DimletKey>>> dimlets) {
    int ticks = DimletCosts.baseDimensionTickCost;
    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.getModifierTickCostFactor(modifier.getType(), key);
                ticks += (int) (getTickCost(modifier.getType(), modifier) * mult);
            }
        }
        ticks += getTickCost(type, key);
    }
    return ticks;
}
Also used : DimletType(mcjty.rftoolsdim.dimensions.dimlets.types.DimletType) ArrayList(java.util.ArrayList) List(java.util.List) DimletKey(mcjty.rftoolsdim.dimensions.dimlets.DimletKey)

Example 19 with DimletType

use of mcjty.rftoolsdim.dimensions.dimlets.types.DimletType 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

DimletType (mcjty.rftoolsdim.dimensions.dimlets.types.DimletType)19 DimletKey (mcjty.rftoolsdim.dimensions.dimlets.DimletKey)13 ArrayList (java.util.ArrayList)9 ItemStack (net.minecraft.item.ItemStack)8 List (java.util.List)5 IDimletType (mcjty.rftoolsdim.dimensions.dimlets.types.IDimletType)4 HashMap (java.util.HashMap)3 Counter (mcjty.lib.varia.Counter)2 Settings (mcjty.rftoolsdim.config.Settings)2 ControllerType (mcjty.rftoolsdim.dimensions.types.ControllerType)2 FeatureType (mcjty.rftoolsdim.dimensions.types.FeatureType)2 TerrainType (mcjty.rftoolsdim.dimensions.types.TerrainType)2 ItemMeshDefinition (net.minecraft.client.renderer.ItemMeshDefinition)2 ModelResourceLocation (net.minecraft.client.renderer.block.model.ModelResourceLocation)2 Slot (net.minecraft.inventory.Slot)2 TextComponentString (net.minecraft.util.text.TextComponentString)2 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)2 Map (java.util.Map)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1