Search in sources :

Example 11 with BlockMeta

use of mcjty.lib.varia.BlockMeta in project RFTools by McJty.

the class DimensionInformation method getFeatureBlock.

public BlockMeta getFeatureBlock(Random random, Map<FeatureType, List<DimletKey>> modifiersForFeature, FeatureType featureType) {
    BlockMeta block;
    if (featureTypes.contains(featureType)) {
        List<BlockMeta> blocks = new ArrayList<BlockMeta>();
        List<Block> fluids = new ArrayList<Block>();
        getMaterialAndFluidModifiers(modifiersForFeature.get(featureType), blocks, fluids);
        if (!blocks.isEmpty()) {
            block = blocks.get(random.nextInt(blocks.size()));
            if (block == null) {
                // This is the default in case None was specified.
                block = BlockMeta.STONE;
            }
        } else {
            // Nothing was specified. With a relatively big chance we use stone. But there is also a chance that the material will be something else.
            if (random.nextFloat() < DimletConfiguration.randomFeatureMaterialChance) {
                DimletKey key = DimletRandomizer.getRandomMaterialBlock(random, true);
                actualRfCost += calculateCostFactor(key);
                block = DimletObjectMapping.idToBlock.get(key);
            } else {
                block = BlockMeta.STONE;
            }
        }
    } else {
        block = BlockMeta.STONE;
    }
    return block;
}
Also used : Block(net.minecraft.block.Block) BlockMeta(mcjty.lib.varia.BlockMeta)

Example 12 with BlockMeta

use of mcjty.lib.varia.BlockMeta in project RFTools by McJty.

the class DimensionInformation method readBlockArrayFromNBT.

private static BlockMeta[] readBlockArrayFromNBT(NBTTagCompound tagCompound, String name) {
    List<BlockMeta> blocks = new ArrayList<BlockMeta>();
    int[] blockIds = getIntArraySafe(tagCompound, name);
    int[] metas = getIntArraySafe(tagCompound, name + "_meta");
    for (int i = 0; i < blockIds.length; i++) {
        int id = blockIds[i];
        Block block = (Block) Block.blockRegistry.getObjectById(id);
        int meta = 0;
        if (i < metas.length) {
            meta = metas[i];
        }
        blocks.add(new BlockMeta(block, meta));
    }
    return blocks.toArray(new BlockMeta[blocks.size()]);
}
Also used : Block(net.minecraft.block.Block) BlockMeta(mcjty.lib.varia.BlockMeta)

Example 13 with BlockMeta

use of mcjty.lib.varia.BlockMeta in project RFTools by McJty.

the class DimensionInformation method writeBlockArrayToBuf.

private static void writeBlockArrayToBuf(ByteBuf buf, BlockMeta[] array) {
    buf.writeInt(array.length);
    for (BlockMeta block : array) {
        buf.writeInt(Block.blockRegistry.getIDForObject(block.getBlock()));
        buf.writeInt(block.getMeta());
    }
}
Also used : BlockMeta(mcjty.lib.varia.BlockMeta)

Example 14 with BlockMeta

use of mcjty.lib.varia.BlockMeta in project RFTools by McJty.

the class DimensionInformation method getBlockMeta.

private BlockMeta getBlockMeta(NBTTagCompound tagCompound, String name) {
    Block block = (Block) Block.blockRegistry.getObjectById(tagCompound.getInteger(name));
    int meta = tagCompound.getInteger(name + "_meta");
    return new BlockMeta(block, meta);
}
Also used : Block(net.minecraft.block.Block) BlockMeta(mcjty.lib.varia.BlockMeta)

Example 15 with BlockMeta

use of mcjty.lib.varia.BlockMeta in project RFTools by McJty.

the class DimensionInformation method dump.

public void dump(EntityPlayer player) {
    String digits = getDigitString();
    if (!digits.isEmpty()) {
        logDebug(player, "    Digits: " + digits);
    }
    if (forcedDimensionSeed != 0) {
        logDebug(player, "    Forced seed: " + forcedDimensionSeed);
    }
    if (baseSeed != 0) {
        logDebug(player, "    Base seed: " + baseSeed);
    }
    logDebug(player, "    World version: " + worldVersion);
    TerrainType terrainType = getTerrainType();
    logDebug(player, "    Terrain: " + terrainType.toString());
    logDebug(player, "        Base block: " + new ItemStack(baseBlockForTerrain.getBlock(), 1, baseBlockForTerrain.getMeta()).getDisplayName());
    if (featureTypes.contains(FeatureType.FEATURE_TENDRILS)) {
        logDebug(player, "        Tendril block: " + new ItemStack(tendrilBlock.getBlock(), 1, tendrilBlock.getMeta()).getDisplayName());
    }
    if (featureTypes.contains(FeatureType.FEATURE_PYRAMIDS)) {
        for (BlockMeta block : pyramidBlocks) {
            if (block != null) {
                logDebug(player, "        Pyramid blocks: " + new ItemStack(block.getBlock(), 1, block.getMeta()).getDisplayName());
            }
        }
    }
    if (featureTypes.contains(FeatureType.FEATURE_ORBS)) {
        for (BlockMeta block : sphereBlocks) {
            if (block != null) {
                logDebug(player, "        Orb blocks: " + new ItemStack(block.getBlock(), 1, block.getMeta()).getDisplayName());
            }
        }
    }
    if (featureTypes.contains(FeatureType.FEATURE_HUGEORBS)) {
        for (BlockMeta block : hugeSphereBlocks) {
            if (block != null) {
                logDebug(player, "        Huge Orb blocks: " + new ItemStack(block.getBlock(), 1, block.getMeta()).getDisplayName());
            }
        }
    }
    if (featureTypes.contains(FeatureType.FEATURE_LIQUIDORBS)) {
        for (BlockMeta block : liquidSphereBlocks) {
            if (block != null) {
                logDebug(player, "        Liquid Orb blocks: " + new ItemStack(block.getBlock(), 1, block.getMeta()).getDisplayName());
            }
        }
    }
    if (featureTypes.contains(FeatureType.FEATURE_HUGELIQUIDORBS)) {
        for (BlockMeta block : hugeLiquidSphereBlocks) {
            if (block != null) {
                logDebug(player, "        Huge Liquid Orb blocks: " + new ItemStack(block.getBlock(), 1, block.getMeta()).getDisplayName());
            }
        }
    }
    if (featureTypes.contains(FeatureType.FEATURE_CANYONS)) {
        logDebug(player, "        Canyon block: " + new ItemStack(canyonBlock.getBlock(), 1, canyonBlock.getMeta()).getDisplayName());
    }
    logDebug(player, "        Base fluid: " + new ItemStack(fluidForTerrain).getDisplayName());
    logDebug(player, "    Biome controller: " + (controllerType == null ? "<null>" : controllerType.name()));
    for (BiomeGenBase biome : getBiomes()) {
        if (biome != null) {
            logDebug(player, "    Biome: " + biome.biomeName);
        }
    }
    for (FeatureType featureType : getFeatureTypes()) {
        logDebug(player, "    Feature: " + featureType.toString());
    }
    for (BlockMeta block : extraOregen) {
        if (block != null) {
            logDebug(player, "        Extra ore: " + new ItemStack(block.getBlock(), 1, block.getMeta()).getDisplayName());
        }
    }
    for (Block block : fluidsForLakes) {
        logDebug(player, "        Lake fluid: " + new ItemStack(block).getDisplayName());
    }
    if (featureTypes.contains(FeatureType.FEATURE_LIQUIDORBS)) {
        for (Block fluid : liquidSphereFluids) {
            logDebug(player, "        Liquid orb fluids: " + new ItemStack(fluid).getDisplayName());
        }
    }
    if (featureTypes.contains(FeatureType.FEATURE_HUGELIQUIDORBS)) {
        for (Block fluid : hugeLiquidSphereFluids) {
            logDebug(player, "        Huge Liquid orb fluids: " + new ItemStack(fluid).getDisplayName());
        }
    }
    for (StructureType structureType : getStructureTypes()) {
        logDebug(player, "    Structure: " + structureType.toString());
    }
    if (structureTypes.contains(StructureType.STRUCTURE_RECURRENTCOMPLEX)) {
        for (String type : dimensionTypes) {
            logDebug(player, "    RR DimensionType: " + type);
        }
    }
    for (EffectType effectType : getEffectTypes()) {
        logDebug(player, "    Effect: " + effectType.toString());
    }
    logDebug(player, "    Sun brightness: " + skyDescriptor.getSunBrightnessFactor());
    logDebug(player, "    Star brightness: " + skyDescriptor.getStarBrightnessFactor());
    float r = skyDescriptor.getSkyColorFactorR();
    float g = skyDescriptor.getSkyColorFactorG();
    float b = skyDescriptor.getSkyColorFactorB();
    logDebug(player, "    Sky color: " + r + ", " + g + ", " + b);
    r = skyDescriptor.getFogColorFactorR();
    g = skyDescriptor.getFogColorFactorG();
    b = skyDescriptor.getFogColorFactorB();
    logDebug(player, "    Fog color: " + r + ", " + g + ", " + b);
    SkyType skyType = skyDescriptor.getSkyType();
    if (skyType != SkyType.SKY_NORMAL) {
        logDebug(player, "    Sky type: " + skyType.toString());
    }
    for (CelestialBodyType bodyType : skyDescriptor.getCelestialBodies()) {
        logDebug(player, "    Sky body: " + bodyType.name());
    }
    if (weatherDescriptor.getRainStrength() > -0.5f) {
        logDebug(player, "    Weather rain: " + weatherDescriptor.getRainStrength());
    }
    if (weatherDescriptor.getThunderStrength() > -0.5f) {
        logDebug(player, "    Weather thunder " + weatherDescriptor.getThunderStrength());
    }
    for (MobDescriptor mob : extraMobs) {
        if (mob != null) {
            if (mob.getEntityClass() == null) {
                logDebug(player, "    Mob: " + mob);
            } else {
                logDebug(player, "    Mob: " + mob.getEntityClass().getName());
            }
        }
    }
    if (peaceful) {
        logDebug(player, "    Peaceful mode");
    }
    if (noanimals) {
        logDebug(player, "    No animals mode");
    }
    if (shelter) {
        logDebug(player, "    Safe shelter");
    }
    if (respawnHere) {
        logDebug(player, "    Respawn local");
    }
    if (celestialAngle != null) {
        logDebug(player, "    Celestial angle: " + celestialAngle);
    }
    if (timeSpeed != null) {
        logDebug(player, "    Time speed: " + timeSpeed);
    }
    if (probeCounter > 0) {
        logDebug(player, "    Probes: " + probeCounter);
    }
    if (patreon1 != 0) {
        logDebug(player, "    Patreon: " + patreon1);
    }
}
Also used : BiomeGenBase(net.minecraft.world.biome.BiomeGenBase) Block(net.minecraft.block.Block) ItemStack(net.minecraft.item.ItemStack) BlockMeta(mcjty.lib.varia.BlockMeta)

Aggregations

BlockMeta (mcjty.lib.varia.BlockMeta)31 Block (net.minecraft.block.Block)18 ItemStack (net.minecraft.item.ItemStack)6 Random (java.util.Random)5 DimletKey (mcjty.rftools.items.dimlets.DimletKey)3 World (net.minecraft.world.World)3 BiomeGenBase (net.minecraft.world.biome.BiomeGenBase)3 HashMap (java.util.HashMap)2 Map (java.util.Map)2 Entity (net.minecraft.entity.Entity)2 EntityPlayer (net.minecraft.entity.player.EntityPlayer)2 TileEntity (net.minecraft.tileentity.TileEntity)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 GenericEnergyReceiverTileEntity (mcjty.lib.entity.GenericEnergyReceiverTileEntity)1 HorizontalLayout (mcjty.lib.gui.layout.HorizontalLayout)1 Label (mcjty.lib.gui.widgets.Label)1 Panel (mcjty.lib.gui.widgets.Panel)1 Coordinate (mcjty.lib.varia.Coordinate)1