Search in sources :

Example 21 with Settings

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

the class DimletWorkbenchTileEntity method startExtracting.

private void startExtracting() {
    if (extracting > 0) {
        // Already extracting
        return;
    }
    ItemStack stack = inventoryHelper.getStackInSlot(DimletWorkbenchContainer.SLOT_INPUT);
    if (!stack.isEmpty()) {
        if (ModItems.knownDimletItem.equals(stack.getItem())) {
            DimletKey key = KnownDimletConfiguration.getDimletKey(stack);
            Settings settings = KnownDimletConfiguration.getSettings(key);
            if (settings != null && settings.isDimlet()) {
                if (!KnownDimletConfiguration.isCraftable(key)) {
                    extracting = 64;
                    idToExtract = key;
                    inventoryHelper.decrStackSize(DimletWorkbenchContainer.SLOT_INPUT, 1);
                    markDirty();
                }
            }
        }
    }
}
Also used : ItemStack(net.minecraft.item.ItemStack) DimletKey(mcjty.rftoolsdim.dimensions.dimlets.DimletKey) Settings(mcjty.rftoolsdim.config.Settings)

Example 22 with Settings

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

the class CmdTestDimlet method execute.

@Override
public void execute(ICommandSender sender, String[] args) {
    if (args.length != 4) {
        ITextComponent component = new TextComponentString(TextFormatting.RED + "Bad parameters!");
        if (sender instanceof EntityPlayer) {
            ((EntityPlayer) sender).sendStatusMessage(component, false);
        } else {
            sender.sendMessage(component);
        }
        return;
    }
    String typeString = fetchString(sender, args, 1, "material");
    String mod = fetchString(sender, args, 2, "minecraft");
    String name = fetchString(sender, args, 3, "");
    DimletType type = DimletType.getTypeByName(typeString);
    if (type == null) {
        ITextComponent component = new TextComponentString(TextFormatting.RED + "Bad type!");
        if (sender instanceof EntityPlayer) {
            ((EntityPlayer) sender).sendStatusMessage(component, false);
        } else {
            sender.sendMessage(component);
        }
        return;
    }
    Settings settings = DimletRules.getSettings(type, mod, name, Collections.emptySet(), 0, Collections.emptyMap());
    ITextComponent component = new TextComponentString(TextFormatting.GREEN + settings.toString());
    if (sender instanceof EntityPlayer) {
        ((EntityPlayer) sender).sendStatusMessage(component, false);
    } else {
        sender.sendMessage(component);
    }
}
Also used : DimletType(mcjty.rftoolsdim.dimensions.dimlets.types.DimletType) ITextComponent(net.minecraft.util.text.ITextComponent) EntityPlayer(net.minecraft.entity.player.EntityPlayer) TextComponentString(net.minecraft.util.text.TextComponentString) Settings(mcjty.rftoolsdim.config.Settings) TextComponentString(net.minecraft.util.text.TextComponentString)

Example 23 with Settings

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

the class DimletDebug method dumpLiquid.

private static void dumpLiquid(Map.Entry<String, Fluid> entry) {
    Block block = entry.getValue().getBlock();
    if (block != null) {
        ResourceLocation nameForObject = Block.REGISTRY.getNameForObject(block);
        String mod = nameForObject.getResourceDomain();
        DimletKey key = new DimletKey(DimletType.DIMLET_LIQUID, block.getRegistryName() + "@0");
        Settings settings = DimletRules.getSettings(key, mod);
        Logging.log(key + ": " + settings.toString());
    }
}
Also used : ResourceLocation(net.minecraft.util.ResourceLocation) Block(net.minecraft.block.Block) Settings(mcjty.rftoolsdim.config.Settings)

Example 24 with Settings

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

the class DimletDebug method dumpDimlets.

public static void dumpDimlets() {
    Map<DimletKey, Settings> knownDimlets = KnownDimletConfiguration.getKnownDimlets();
    List<DimletKey> keys = new ArrayList<>(knownDimlets.keySet());
    keys.sort(null);
    for (DimletKey key : keys) {
        Settings value = knownDimlets.get(key);
        Logging.log(key + ": " + value);
    }
}
Also used : Settings(mcjty.rftoolsdim.config.Settings)

Example 25 with Settings

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

the class DimletRandomizer method setupWeightedRandomList.

private static void setupWeightedRandomList() {
    if (randomDimlets != null) {
        return;
    }
    SortedMap<DimletKey, Settings> knownDimlets = KnownDimletConfiguration.getKnownDimlets();
    boolean rarityScalesBySize = DimletConfiguration.rarityScalesBySize;
    float rarity0 = DimletConfiguration.rarity0;
    float rarity1 = DimletConfiguration.rarity1;
    float rarity2 = DimletConfiguration.rarity2;
    float rarity3 = DimletConfiguration.rarity3;
    float rarity4 = DimletConfiguration.rarity4;
    float rarity5 = DimletConfiguration.rarity5;
    float rarity6 = DimletConfiguration.rarity6;
    randomDimlets = new RarityRandomSelector<>(rarityScalesBySize);
    setupRarity(randomDimlets, rarity0, rarity1, rarity2, rarity3, rarity4, rarity5, rarity6);
    randomUncraftableDimlets = new RarityRandomSelector<>(rarityScalesBySize);
    setupRarity(randomUncraftableDimlets, rarity0, rarity1, rarity2, rarity3, rarity4, rarity5, rarity6);
    for (Map.Entry<DimletKey, Settings> entry : knownDimlets.entrySet()) {
        DimletKey key = entry.getKey();
        Settings settings = KnownDimletConfiguration.getSettings(key);
        if (settings == null) {
            continue;
        }
        if (!settings.isWorldgen()) {
            continue;
        }
        randomDimlets.addItem(entry.getValue().getRarity(), key);
        if (key.getType() == DimletType.DIMLET_MATERIAL) {
            if (randomMaterialDimlets == null) {
                randomMaterialDimlets = new RarityRandomSelector<>(rarityScalesBySize);
                setupRarity(randomMaterialDimlets, rarity0, rarity1, rarity2, rarity3, rarity4, rarity5, rarity6);
            }
            randomMaterialDimlets.addItem(entry.getValue().getRarity(), key);
        } else if (key.getType() == DimletType.DIMLET_LIQUID) {
            if (randomLiquidDimlets == null) {
                randomLiquidDimlets = new RarityRandomSelector<>(rarityScalesBySize);
                setupRarity(randomLiquidDimlets, rarity0, rarity1, rarity2, rarity3, rarity4, rarity5, rarity6);
            }
            randomLiquidDimlets.addItem(entry.getValue().getRarity(), key);
        } else if (key.getType() == DimletType.DIMLET_MOB) {
            if (randomMobDimlets == null) {
                randomMobDimlets = new RarityRandomSelector<>(rarityScalesBySize);
                setupRarity(randomMobDimlets, rarity0, rarity1, rarity2, rarity3, rarity4, rarity5, rarity6);
            }
            randomMobDimlets.addItem(entry.getValue().getRarity(), key);
        } else if (key.getType() == DimletType.DIMLET_EFFECT) {
            if (randomEffectDimlets == null) {
                randomEffectDimlets = new RarityRandomSelector<>(rarityScalesBySize);
                setupRarity(randomEffectDimlets, rarity0, rarity1, rarity2, rarity3, rarity4, rarity5, rarity6);
            }
            randomEffectDimlets.addItem(entry.getValue().getRarity(), key);
            randomUncraftableDimlets.addItem(entry.getValue().getRarity(), key);
        } else if (key.getType() == DimletType.DIMLET_FEATURE) {
            if (randomFeatureDimlets == null) {
                randomFeatureDimlets = new RarityRandomSelector<>(rarityScalesBySize);
                setupRarity(randomFeatureDimlets, rarity0, rarity1, rarity2, rarity3, rarity4, rarity5, rarity6);
            }
            randomFeatureDimlets.addItem(entry.getValue().getRarity(), key);
            randomUncraftableDimlets.addItem(entry.getValue().getRarity(), key);
        } else if (key.getType() == DimletType.DIMLET_STRUCTURE) {
            if (randomStructureDimlets == null) {
                randomStructureDimlets = new RarityRandomSelector<>(rarityScalesBySize);
                setupRarity(randomStructureDimlets, rarity0, rarity1, rarity2, rarity3, rarity4, rarity5, rarity6);
            }
            randomStructureDimlets.addItem(entry.getValue().getRarity(), key);
            randomUncraftableDimlets.addItem(entry.getValue().getRarity(), key);
        } else if (key.getType() == DimletType.DIMLET_TERRAIN) {
            if (randomTerrainDimlets == null) {
                randomTerrainDimlets = new RarityRandomSelector<>(rarityScalesBySize);
                setupRarity(randomTerrainDimlets, rarity0, rarity1, rarity2, rarity3, rarity4, rarity5, rarity6);
            }
            randomTerrainDimlets.addItem(entry.getValue().getRarity(), key);
            randomUncraftableDimlets.addItem(entry.getValue().getRarity(), key);
        } else if (key.getType() == DimletType.DIMLET_WEATHER) {
            if (randomWeatherDimlets == null) {
                randomWeatherDimlets = new RarityRandomSelector<>(rarityScalesBySize);
                setupRarity(randomWeatherDimlets, rarity0, rarity1, rarity2, rarity3, rarity4, rarity5, rarity6);
            }
            randomWeatherDimlets.addItem(entry.getValue().getRarity(), key);
            randomUncraftableDimlets.addItem(entry.getValue().getRarity(), key);
        } else if (key.getType() == DimletType.DIMLET_CONTROLLER) {
            randomUncraftableDimlets.addItem(entry.getValue().getRarity(), key);
        } else if (key.getType() == DimletType.DIMLET_SKY) {
            if (randomSkyDimlets == null) {
                randomSkyDimlets = new RarityRandomSelector<>(rarityScalesBySize);
                setupRarity(randomSkyDimlets, rarity0, rarity1, rarity2, rarity3, rarity4, rarity5, rarity6);
            }
            randomSkyDimlets.addItem(entry.getValue().getRarity(), key);
            if (SkyRegistry.isSkyBody(key)) {
                if (randomSkyBodyDimlets == null) {
                    randomSkyBodyDimlets = new RarityRandomSelector<>(rarityScalesBySize);
                    setupRarity(randomSkyBodyDimlets, rarity0, rarity1, rarity2, rarity3, rarity4, rarity5, rarity6);
                }
                randomSkyBodyDimlets.addItem(entry.getValue().getRarity(), key);
            }
            randomUncraftableDimlets.addItem(entry.getValue().getRarity(), key);
        }
    }
}
Also used : RarityRandomSelector(mcjty.rftoolsdim.varia.RarityRandomSelector) Map(java.util.Map) SortedMap(java.util.SortedMap) 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