Java Code Examples for net.minecraft.init.Blocks#vine()

The following examples show how to use net.minecraft.init.Blocks#vine() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BlockCraftingGrid.java    From Translocators with MIT License 6 votes vote down vote up
public boolean placeBlock(World world, EntityPlayer player, int x, int y, int z, int side) {
    if(disableCraftingGridKey)
        return false;

    Block block = world.getBlock(x, y, z);
    if(side != 1 && block != Blocks.snow_layer)
        return false;

    if (block != Blocks.vine && block != Blocks.tallgrass && block != Blocks.deadbush
            && !block.isReplaceable(world, x, y, z))
        y++;

    if (!world.isSideSolid(x, y-1, z, ForgeDirection.UP))
        return false;

    if (!world.canPlaceEntityOnSide(this, x, y, z, false, 1, null, null))
        return false;

    player.swingItem();
    if(!world.setBlock(x, y, z, this))
        return false;

    onBlockPlacedBy(world, x, y, z, player, null);
    return true;
}
 
Example 2
Source File: BWBlock.java    From NOVA-Core with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public boolean shouldDisplacePlacement() {
	if (mcBlock == Blocks.snow_layer && ((int) blockState().getValue(BlockSnow.LAYERS) < 1)) {
		return false;
	}

	if (mcBlock == Blocks.vine || mcBlock == Blocks.tallgrass || mcBlock == Blocks.deadbush || mcBlock.isReplaceable((net.minecraft.world.World) blockAccess(), blockPos())) {
		return false;
	}
	return super.shouldDisplacePlacement();
}
 
Example 3
Source File: BWBlock.java    From NOVA-Core with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public boolean shouldDisplacePlacement() {
	if (mcBlock == Blocks.snow_layer && (blockAccess().getBlockMetadata(xi(), yi(), zi()) & 7) < 1) {
		return false;
	}

	if (mcBlock == Blocks.vine || mcBlock == Blocks.tallgrass || mcBlock == Blocks.deadbush || mcBlock.isReplaceable(blockAccess(), xi(), yi(), zi())) {
		return false;
	}
	return super.shouldDisplacePlacement();
}
 
Example 4
Source File: ItemTranslocator.java    From Translocators with MIT License 5 votes vote down vote up
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
    Block block = world.getBlock(x, y, z);

    if (block == Blocks.snow_layer && (world.getBlockMetadata(x, y, z) & 7) < 1) {
        side = 1;
    } else if (block != Blocks.vine && block != Blocks.tallgrass && block != Blocks.deadbush && !block.isReplaceable(world, x, y, z)) {
        if (side == 0)
            --y;
        if (side == 1)
            ++y;
        if (side == 2)
            --z;
        if (side == 3)
            ++z;
        if (side == 4)
            --x;
        if (side == 5)
            ++x;
    }

    if (stack.stackSize == 0 || !player.canPlayerEdit(x, y, z, side, stack))
        return false;

    if (placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, stack.getItemDamage())) {
        world.playSoundEffect(x + 0.5, y + 0.5, z + 0.5, field_150939_a.stepSound.func_150496_b(), (field_150939_a.stepSound.getVolume() + 1.0F) / 2.0F, field_150939_a.stepSound.getPitch() * 0.8F);
        --stack.stackSize;
        return true;
    }

    return false;
}
 
Example 5
Source File: ItemExtendedNodeJar.java    From Gadomancy with GNU Lesser General Public License v3.0 4 votes vote down vote up
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float par8, float par9, float par10) {
    Block var11 = world.getBlock(x, y, z);
    if (var11 == Blocks.snow_layer) {
        side = 1;
    } else if ((var11 != Blocks.vine) && (var11 != Blocks.tallgrass) && (var11 != Blocks.deadbush) && ((var11.isAir(world, x, y, z)) || (!var11.isReplaceable(world, x, y, z)))) {
        if (side == 0) {
            y--;
        }
        if (side == 1) {
            y++;
        }
        if (side == 2) {
            z--;
        }
        if (side == 3) {
            z++;
        }
        if (side == 4) {
            x--;
        }
        if (side == 5) {
            x++;
        }
    }
    if (stack.stackSize == 0) {
        return false;
    }
    if (!player.canPlayerEdit(x, y, z, side, stack)) {
        return false;
    }
    if ((y == 255) && (RegisteredBlocks.blockExtendedNodeJar.getMaterial().isSolid())) {
        return false;
    }
    if (world.canPlaceEntityOnSide(RegisteredBlocks.blockExtendedNodeJar, x, y, z, false, side, player, stack)) {
        Block var12 = RegisteredBlocks.blockExtendedNodeJar;
        int var13 = 2;
        int var14 = RegisteredBlocks.blockExtendedNodeJar.onBlockPlaced(world, x, y, z, side, par8, par9, par10, var13);
        if (placeBlockAt(stack, player, world, x, y, z, side, par8, par9, par10, var14)) {
            TileEntity te = world.getTileEntity(x, y, z);

            if ((te != null) && ((te instanceof TileExtendedNodeJar))) {
                if (stack.hasTagCompound()) {
                    AspectList aspects = getAspects(stack);
                    if (aspects != null) {
                        ((TileExtendedNodeJar) te).setAspects(aspects);
                        ((TileExtendedNodeJar) te).setNodeType(getNodeType(stack));
                        ((TileExtendedNodeJar) te).setNodeModifier(getNodeModifier(stack));
                        ((TileExtendedNodeJar) te).setExtendedNodeType(getExtendedNodeType(stack));
                        ((TileExtendedNodeJar) te).setId(getNodeId(stack));
                        ((TileExtendedNodeJar) te).setBehaviorSnapshot(getBehaviorSnapshot(stack));
                    }
                }
            }


            world.playSoundEffect(x + 0.5F, y + 0.5F, z + 0.5F, var12.stepSound.getStepResourcePath(), (var12.stepSound.getVolume() + 1.0F) / 2.0F, var12.stepSound.getPitch() * 0.8F);
            stack.stackSize -= 1;
        }
        return true;
    }
    return false;
}
 
Example 6
Source File: ModRecipes.java    From GardenCollection with MIT License 4 votes vote down vote up
public void init () {
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.chainLink, 3, 0), "xx ", "x x", " xx", 'x', "nuggetIron"));
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.chainLink, 3, 1), "xx ", "x x", " xx", 'x', "nuggetGold"));
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.chainLink, 3, 1), "xx ", "x x", " xx", 'x', "nuggetBrass"));
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.chainLink, 3, 2), "xx ", "x x", " xx", 'x', "nuggetWroughtIron"));

    ItemStack linkIron = new ItemStack(ModItems.chainLink, 1, 0);
    ItemStack linkGold = new ItemStack(ModItems.chainLink, 1, 1);
    ItemStack linkWroughtIron = new ItemStack(ModItems.chainLink, 1, 2);
    ItemStack ironNugget = new ItemStack(ModItems.ironNugget);
    ItemStack heavyChainIron = new ItemStack(ModBlocks.heavyChain);
    ItemStack lightChainIron = new ItemStack(ModBlocks.lightChain);
    ItemStack latticeIron = new ItemStack(ModBlocks.latticeMetal);
    ItemStack vine = new ItemStack(Blocks.vine);
    ItemStack blockWroughtIron = new ItemStack(ModBlocks.metalBlock);
    ItemStack wroughtIronIngot = new ItemStack(ModItems.wroughtIronIngot);
    ItemStack wroughtIronNugget = new ItemStack(ModItems.wroughtIronNugget);
    ItemStack blockCharcoal = new ItemStack(ModBlocks.stoneBlock);

    GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.heavyChain, 4, 0), "xx", "xx", "xx", 'x', linkIron);
    GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.heavyChain, 4, 1), "xx", "xx", "xx", 'x', linkGold);
    GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.heavyChain, 4, 4), "xx", "xx", "xx", 'x', linkWroughtIron);
    GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.heavyChain, 8, 5), "xxx", "xyx", "xxx", 'x', heavyChainIron, 'y', vine);

    GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.lightChain, 2, 0), "x", "x", "x", 'x', linkIron);
    GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.lightChain, 2, 1), "x", "x", "x", 'x', linkGold);
    GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.lightChain, 2, 4), "x", "x", "x", 'x', linkWroughtIron);
    GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.lightChain, 8, 5), "xxx", "xyx", "xxx", 'x', lightChainIron, 'y', vine);

    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.latticeMetal, 16, 0), " x ", "xxx", " x ", 'x', "ingotIron"));
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.latticeMetal, 16, 2), " x ", "xxx", " x ", 'x', "ingotWroughtIron"));
    GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.latticeMetal, 8, 3), "xxx", "xyx", "xxx", 'x', latticeIron, 'y', vine);

    GameRegistry.addShapedRecipe(new ItemStack(Items.iron_ingot), "xxx", "xxx", "xxx", 'x', ironNugget);
    GameRegistry.addShapedRecipe(new ItemStack(ModItems.ironNugget, 9), "x", 'x', new ItemStack(Items.iron_ingot));

    GameRegistry.addShapedRecipe(blockCharcoal, "xxx", "xxx", "xxx", 'x', new ItemStack(Items.coal, 1, 1));
    GameRegistry.addShapedRecipe(new ItemStack(Items.coal, 9, 1), "x", 'x', blockCharcoal);

    GameRegistry.addShapedRecipe(blockWroughtIron, "xxx", "xxx", "xxx", 'x', wroughtIronIngot);
    GameRegistry.addShapedRecipe(new ItemStack(ModItems.wroughtIronIngot, 9), "x", 'x', blockWroughtIron);
    GameRegistry.addShapedRecipe(wroughtIronIngot, "xxx", "xxx", "xxx", 'x', wroughtIronNugget);
    GameRegistry.addShapedRecipe(new ItemStack(ModItems.wroughtIronNugget, 9), "x", 'x', wroughtIronIngot);

    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.fence, 16, 0), "xxx", "xxx", 'x', "ingotWroughtIron"));
    GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.fence, 1, 1), "x", 'x', new ItemStack(ModBlocks.fence, 1, 0));
    GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.fence, 1, 2), "x", 'x', new ItemStack(ModBlocks.fence, 1, 1));
    GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.fence, 1, 3), "x", 'x', new ItemStack(ModBlocks.fence, 1, 2));
    GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.fence, 1, 0), "x", 'x', new ItemStack(ModBlocks.fence, 1, 3));

    GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.bloomeryFurnace), "xxx", "xyx", "xxx",
        'x', Items.brick, 'y', new ItemStack(Blocks.furnace));

    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.lantern, 4, 0), " x ", "y y", "yxy",
        'x', "ingotWroughtIron", 'y', new ItemStack(ModBlocks.fence, 1, 0)));
    for (int i = 0; i < 16; i++) {
        ItemStack target = ((ItemLantern)Item.getItemFromBlock(ModBlocks.lantern)).makeItemStack(4, i, true);
        GameRegistry.addRecipe(new ShapedOreRecipe(target, " x ", "yzy", "yxy",
            'x', "ingotWroughtIron", 'y', new ItemStack(ModBlocks.fence, 1, 0), 'z', paneGlassOreDict[15 - i]));

        target = ((ItemLantern)Item.getItemFromBlock(ModBlocks.lantern)).makeItemStack(1, i, true);
        GameRegistry.addRecipe(new ShapelessOreRecipe(target, new ItemStack(ModBlocks.lantern, 1, 0), paneGlassOreDict[15 - i]));
    }

    for (int i = 0; i < 6; i++) {
        GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.latticeWood, 8, i), " x ", "xxx", " x ", 'x', new ItemStack(Blocks.planks, 1, i));
    }

    GameRegistry.addRecipe(new ItemStack(ModItems.mossPaste), "xyx", "yxy", "xyx", 'x', Blocks.vine, 'y', Items.clay_ball);

    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.candle, 4, 0), "x", "y", "y", 'x', Items.string, 'y', "materialWax"));
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.candle, 4, 0), "x", "y", "y", 'x', Items.string, 'y', "materialPressedwax"));

    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.candelabra, 4, 0), " x ", " y ", " z ",
        'x', ModItems.candle, 'y', "nuggetWroughtIron", 'z', "ingotWroughtIron"));
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.candelabra, 4, 1), "x x", "y y", " z ",
        'x', ModItems.candle, 'y', "nuggetWroughtIron", 'z', "ingotWroughtIron"));
    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.candelabra, 4, 2), "xxx", "yyy", " z ",
        'x', ModItems.candle, 'y', "nuggetWroughtIron", 'z', "ingotWroughtIron"));

    GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.hoop, 2, 0), "xyx", "y y", "xyx",
        'x', "nuggetWroughtIron", 'y', "ingotWroughtIron"));

    GameRegistry.addSmelting(wroughtIronIngot, new ItemStack(Items.iron_ingot), 0);
}
 
Example 7
Source File: ItemArcaneCake.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 4 votes vote down vote up
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World yWorld, int z, int par5, int par6, int par7, float par8, float par9, float par10) {
    Block block = yWorld.getBlock(z, par5, par6);

    if (block == Blocks.snow_layer && (yWorld.getBlockMetadata(z, par5, par6) & 7) < 1) {
        par7 = 1;
    } else if (block != Blocks.vine && block != Blocks.tallgrass && block != Blocks.deadbush) {
        if (par7 == 0) {
            --par5;
        }

        if (par7 == 1) {
            ++par5;
        }

        if (par7 == 2) {
            --par6;
        }

        if (par7 == 3) {
            ++par6;
        }

        if (par7 == 4) {
            --z;
        }

        if (par7 == 5) {
            ++z;
        }
    }

    if (!player.canPlayerEdit(z, par5, par6, par7, stack)) {
        return false;
    } else if (stack.stackSize == 0) {
        return false;
    } else {
        Block cake = ForbiddenBlocks.arcaneCake;
        if (yWorld.canPlaceEntityOnSide(cake, z, par5, par6, false, par7, (Entity) null, stack)) {
            int j1 = cake.onBlockPlaced(yWorld, z, par5, par6, par7, par8, par9, par10, 0);

            if (yWorld.setBlock(z, par5, par6, cake, j1, 3)) {
                if (yWorld.getBlock(z, par5, par6) == cake) {
                    cake.onBlockPlacedBy(yWorld, z, par5, par6, player, stack);
                    cake.onPostBlockPlaced(yWorld, z, par5, par6, j1);
                }

                yWorld.playSoundEffect((double) ((float) z + 0.5F), (double) ((float) par5 + 0.5F), (double) ((float) par6 + 0.5F), block.stepSound.soundName, (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F);
                --stack.stackSize;
            }
        }

        return true;
    }
}