Search in sources :

Example 1 with BlockIce

use of net.minecraft.block.BlockIce in project DynamicSurroundings by OreCruncher.

the class FootstepsRegistry method seedMap.

private void seedMap() {
    // Iterate through the blockmap looking for known pattern types.
    // Though they probably should all be registered with Forge
    // dictionary it's not a requirement.
    final Iterator<Block> itr = Block.REGISTRY.iterator();
    while (itr.hasNext()) {
        final Block block = itr.next();
        final String blockName = MCHelper.nameOf(block);
        if (block instanceof BlockCrops) {
            final BlockCrops crop = (BlockCrops) block;
            if (crop.getMaxAge() == 3) {
                registerBlocks("#beets", blockName);
            } else if (blockName.equals("minecraft:wheat")) {
                registerBlocks("#wheat", blockName);
            } else if (crop.getMaxAge() == 7) {
                registerBlocks("#crop", blockName);
            }
        } else if (block instanceof BlockSapling) {
            registerBlocks("#sapling", blockName);
        } else if (block instanceof BlockReed) {
            registerBlocks("#reed", blockName);
        } else if (block instanceof BlockFence) {
            registerBlocks("#fence", blockName);
        } else if (block instanceof BlockFlower || block instanceof BlockMushroom) {
            registerBlocks("NOT_EMITTER", blockName);
        } else if (block instanceof BlockLog || block instanceof BlockPlanks) {
            registerBlocks("wood", blockName);
        } else if (block instanceof BlockDoor) {
            registerBlocks("bluntwood", blockName);
        } else if (block instanceof BlockLeaves) {
            registerBlocks("leaves", blockName);
        } else if (block instanceof BlockOre) {
            registerBlocks("ore", blockName);
        } else if (block instanceof BlockIce) {
            registerBlocks("ice", blockName);
        }
    }
}
Also used : BlockMushroom(net.minecraft.block.BlockMushroom) BlockCrops(net.minecraft.block.BlockCrops) BlockIce(net.minecraft.block.BlockIce) BlockOre(net.minecraft.block.BlockOre) BlockLog(net.minecraft.block.BlockLog) BlockReed(net.minecraft.block.BlockReed) BlockFlower(net.minecraft.block.BlockFlower) BlockPlanks(net.minecraft.block.BlockPlanks) BlockDoor(net.minecraft.block.BlockDoor) BlockLeaves(net.minecraft.block.BlockLeaves) BlockSapling(net.minecraft.block.BlockSapling) Block(net.minecraft.block.Block) ItemBlock(net.minecraft.item.ItemBlock) BlockFence(net.minecraft.block.BlockFence)

Example 2 with BlockIce

use of net.minecraft.block.BlockIce in project Cavern2 by kegare.

the class RecipeChargeIceEquipment method matches.

@Override
public boolean matches(InventoryCrafting crafting, World world) {
    resultItem = ItemStack.EMPTY;
    if (!(crafting.getStackInRowAndColumn(1, 1).getItem() instanceof IIceEquipment)) {
        return false;
    }
    int ice = 0;
    for (int row = 0; row < 3; ++row) {
        for (int column = 0; column < 3; ++column) {
            if (row == 1 && column == 1) {
                continue;
            }
            ItemStack stack = crafting.getStackInRowAndColumn(row, column);
            if (!stack.isEmpty()) {
                Block block = Block.getBlockFromItem(stack.getItem());
                if (block == null) {
                    continue;
                }
                if (block instanceof BlockIce || block instanceof BlockPackedIce) {
                    if (row != 1 && column == 1 || row == 1 && column != 1) {
                        ++ice;
                    }
                } else if (row != 1 && column != 1) {
                    return false;
                }
            }
        }
    }
    if (ice >= 4) {
        resultItem = getResult(crafting);
        return true;
    }
    return false;
}
Also used : BlockIce(net.minecraft.block.BlockIce) IIceEquipment(cavern.api.IIceEquipment) BlockPackedIce(net.minecraft.block.BlockPackedIce) Block(net.minecraft.block.Block) ItemStack(net.minecraft.item.ItemStack)

Example 3 with BlockIce

use of net.minecraft.block.BlockIce in project Cavern2 by kegare.

the class RecipeChargeIceEquipment method getResult.

protected ItemStack getResult(InventoryCrafting crafting) {
    ItemStack result = crafting.getStackInRowAndColumn(1, 1).copy();
    int ice = 0;
    int packed = 0;
    for (int row = 0; row < 3; ++row) {
        for (int column = 0; column < 3; ++column) {
            if (row == 1 && column == 1) {
                continue;
            }
            ItemStack stack = crafting.getStackInRowAndColumn(row, column);
            if (!stack.isEmpty()) {
                Block block = Block.getBlockFromItem(stack.getItem());
                if (block == null) {
                    continue;
                }
                if (block instanceof BlockPackedIce) {
                    ++packed;
                } else if (block instanceof BlockIce) {
                    ++ice;
                }
            }
        }
    }
    if (result.isItemStackDamageable() && result.isItemDamaged()) {
        result.setItemDamage(0);
    } else {
        result = ((IIceEquipment) result.getItem()).addCharge(result, ice + packed * 9);
        result.getTagCompound().setBoolean("AfterIceCharge", true);
    }
    return result;
}
Also used : BlockIce(net.minecraft.block.BlockIce) BlockPackedIce(net.minecraft.block.BlockPackedIce) Block(net.minecraft.block.Block) ItemStack(net.minecraft.item.ItemStack)

Aggregations

Block (net.minecraft.block.Block)3 BlockIce (net.minecraft.block.BlockIce)3 BlockPackedIce (net.minecraft.block.BlockPackedIce)2 ItemStack (net.minecraft.item.ItemStack)2 IIceEquipment (cavern.api.IIceEquipment)1 BlockCrops (net.minecraft.block.BlockCrops)1 BlockDoor (net.minecraft.block.BlockDoor)1 BlockFence (net.minecraft.block.BlockFence)1 BlockFlower (net.minecraft.block.BlockFlower)1 BlockLeaves (net.minecraft.block.BlockLeaves)1 BlockLog (net.minecraft.block.BlockLog)1 BlockMushroom (net.minecraft.block.BlockMushroom)1 BlockOre (net.minecraft.block.BlockOre)1 BlockPlanks (net.minecraft.block.BlockPlanks)1 BlockReed (net.minecraft.block.BlockReed)1 BlockSapling (net.minecraft.block.BlockSapling)1 ItemBlock (net.minecraft.item.ItemBlock)1