Search in sources :

Example 11 with Settings

use of mcjty.rftoolsdim.config.Settings in project RFToolsDimensions by McJty.

the class DimensionInformation method addToCost.

private void addToCost(DimletKey key) {
    Settings settings = KnownDimletConfiguration.getSettings(key);
    if (settings == null)
        return;
    int rfMaintainCost = settings.getMaintainCost();
    if (rfMaintainCost < 0) {
        int nominalCost = descriptor.calculateNominalCost();
        int rfMinimum = Math.max(10, nominalCost * PowerConfiguration.minimumCostPercentage / 100);
        actualRfCost = actualRfCost - (actualRfCost * (-rfMaintainCost) / 100);
        if (actualRfCost < rfMinimum) {
            // Never consume less then this
            actualRfCost = rfMinimum;
        }
    } else {
        actualRfCost += rfMaintainCost;
    }
}
Also used : Settings(mcjty.rftoolsdim.config.Settings)

Example 12 with Settings

use of mcjty.rftoolsdim.config.Settings in project RFToolsDimensions by McJty.

the class DimensionDescriptor method getCreationCost.

private int getCreationCost(DimletType type, DimletKey key) {
    int cost = 0;
    Settings settings = KnownDimletConfiguration.getSettings(key);
    if (settings != null) {
        cost = settings.getCreateCost();
    }
    return cost;
}
Also used : Settings(mcjty.rftoolsdim.config.Settings)

Example 13 with Settings

use of mcjty.rftoolsdim.config.Settings in project RFToolsDimensions by McJty.

the class DimensionDescriptor method getMaintenanceCost.

private int getMaintenanceCost(DimletType type, DimletKey key) {
    int cost = 0;
    Settings settings = KnownDimletConfiguration.getSettings(key);
    if (settings != null) {
        cost = settings.getMaintainCost();
    }
    return cost;
}
Also used : Settings(mcjty.rftoolsdim.config.Settings)

Example 14 with Settings

use of mcjty.rftoolsdim.config.Settings in project RFToolsDimensions by McJty.

the class DimensionDescriptor method getTickCost.

private int getTickCost(DimletType type, DimletKey key) {
    int cost = 0;
    Settings settings = KnownDimletConfiguration.getSettings(key);
    if (settings != null) {
        cost = settings.getTickCost();
    }
    return cost;
}
Also used : Settings(mcjty.rftoolsdim.config.Settings)

Example 15 with Settings

use of mcjty.rftoolsdim.config.Settings in project RFToolsDimensions by McJty.

the class DimletDebug method dumpBlock.

private static void dumpBlock(Block block) {
    if (block instanceof BlockLiquid) {
        return;
    }
    Set<Filter.Feature> features = KnownDimletConfiguration.getBlockFeatures(block);
    String mod = Block.REGISTRY.getNameForObject(block).getResourceDomain();
    for (IBlockState state : block.getBlockState().getValidStates()) {
        int meta = state.getBlock().getMetaFromState(state);
        List<IProperty<?>> propertyNames = new ArrayList<>(state.getPropertyKeys());
        propertyNames.sort(Comparator.comparing(IProperty::getName));
        ImmutableMap<IProperty<?>, Comparable<?>> properties = state.getProperties();
        Map<String, String> props = new HashMap<>();
        for (Map.Entry<IProperty<?>, Comparable<?>> entry : properties.entrySet()) {
            props.put(entry.getKey().getName(), entry.getValue().toString());
        }
        DimletKey key = new DimletKey(DimletType.DIMLET_MATERIAL, block.getRegistryName() + "@" + meta);
        Settings settings = DimletRules.getSettings(key, mod, features, props);
        Logging.log(key + " (" + state.toString() + "): " + settings.toString());
    }
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) BlockLiquid(net.minecraft.block.BlockLiquid) IProperty(net.minecraft.block.properties.IProperty) ImmutableMap(com.google.common.collect.ImmutableMap) Settings(mcjty.rftoolsdim.config.Settings)

Aggregations

Settings (mcjty.rftoolsdim.config.Settings)33 DimletKey (mcjty.rftoolsdim.dimensions.dimlets.DimletKey)16 ItemStack (net.minecraft.item.ItemStack)9 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)6 ArrayList (java.util.ArrayList)5 Block (net.minecraft.block.Block)5 ResourceLocation (net.minecraft.util.ResourceLocation)5 Filter (mcjty.rftoolsdim.config.Filter)3 DimensionDescriptor (mcjty.rftoolsdim.dimensions.description.DimensionDescriptor)3 IBlockState (net.minecraft.block.state.IBlockState)3 ImmutableMap (com.google.common.collect.ImmutableMap)2 DimletType (mcjty.rftoolsdim.dimensions.dimlets.types.DimletType)2 BlockLiquid (net.minecraft.block.BlockLiquid)2 IProperty (net.minecraft.block.properties.IProperty)2 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1 SortedMap (java.util.SortedMap)1 IFilterBuilder (mcjty.rftoolsdim.api.dimlet.IFilterBuilder)1 ISettingsBuilder (mcjty.rftoolsdim.api.dimlet.ISettingsBuilder)1