[Demonstration 1]

[Buggy Method]
private void addMonitorPanel(Minecraft mc, Gui gui, final NBTTagCompound currentData, Panel panel) {
    Panel monitorPanel = new Panel(mc, gui).setLayout(new HorizontalLayout()).setDesiredHeight(16);
    String monitoring;
    if (currentData.hasKey("monitorx")) {
        int dim = currentData.getInteger("dim");
        World world = RfToolsDimensionManager.getWorldForDimension(dim);
        int x = currentData.getInteger("monitorx");
        int y = currentData.getInteger("monitory");
        int z = currentData.getInteger("monitorz");
        monitoring = currentData.getString("monitorname");
        Block block = world.getBlock(x, y, z);
        monitorPanel.addChild(new BlockRender(mc, gui).setRenderItem(block)).setDesiredWidth(20);
    } else {
        monitoring = "<not set>";
    }
    panel.addChild(monitorPanel);
    panel.addChild(new Label(mc, gui).setText(monitoring));
}

[Buggy Hunk]
World world = RfToolsDimensionManager.getWorldForDimension(dim);

[Patch]
World world = mc.thePlayer.worldObj;

[Demonstration 2]

[Buggy Method]
public void execute(CommandSender commandSender, String[] strings) {
    //restores a region
    Player sender = (Player) commandSender;
    if (sender.hasPermission("RegionReset.restore")) {
        if (strings.length > 1) {
            String regionName = strings[1];
            ProtectedRegion region = RegionReset.getInstance().getWorldGuard().getRegionManager(sender.getWorld()).getRegion(regionName);
            if (region != null) {
                Blueprint blueprint = RegionManager.getInstance().getBlueprint(region);
                if (blueprint != null) {
                    if (blueprint.getBlueprintFile().exists()) {
                        try {
                            RegionManager.getInstance().restoreRegion(sender, region);
                            RegionReset.sendMessage(sender, RegionResetConfig.getText("info.restore.restored").replace("{0}", regionName));
                            RegionReset.getInstance().getLogger().info("Region '" + region.getId() + "' in World '" + sender.getWorld().getName() + "' has been restored by " + sender.getName());
                        } catch (UnknownException e) {
                            RegionReset.sendMessage(sender, RegionResetConfig.getText("error.unknownException").replace("{0}", e.getException().getClass().getName()));
                            e.printStackTrace();
                        } catch (DifferentRegionSizeException e) {
                            RegionReset.sendMessage(sender, RegionResetConfig.getText("error.differentSize").replace("{0}", e.getRegionName()).replace("{1}", e.getBlueprintName()));
                        } catch (ChunkNotLoadedException e) {
                            RegionReset.sendMessage(sender, RegionResetConfig.getText("error.chunkNotLoaded"));
                        }
                    } else {
                        RegionReset.sendMessage(sender, RegionResetConfig.getText("error.noBackupFound").replace("{0}", blueprint.getBlueprintFile().getName()));
                    }
                } else {
                    RegionReset.sendMessage(sender, RegionResetConfig.getText("error.regionNotAssigned"));
                }
            } else {
                RegionReset.sendMessage(sender, RegionResetConfig.getText("error.unknownRegion").replace("{0}", regionName));
            }
        } else {
            RegionReset.sendMessage(sender, RegionResetConfig.getText("error.wrongUsage").replace("{0}", "/rr restore <Region>"));
        }
    } else {
        RegionReset.sendMessage(sender, RegionResetConfig.getText("error.noPermission"));
    }
}

[Buggy Hunk]
Blueprint blueprint = RegionManager.getInstance().getBlueprint(region);

[Patch]
Blueprint blueprint = RegionManager.getInstance().getBlueprint(sender.getWorld(), region);

[Demonstration 3]

[Buggy Method]
public static boolean isInDarkCave(World world, int x, int y, int z, boolean checkSpaceToSpawn) {
    Block block = world.getBlock(x, y, z);
    if (!world.canBlockSeeTheSky(x, y, z) && world.getBlockLightValue(x, y, z) < 5) {
        if (!CoroUtilBlock.isAir(block) && block.getMaterial() == Material.rock) /*(block != Blocks.grass || block.getMaterial() != Material.grass)*/
        {
            if (!checkSpaceToSpawn) {
                return true;
            } else {
                Block blockAir1 = world.getBlock(x, y + 1, z);
                if (CoroUtilBlock.isAir(blockAir1)) {
                    Block blockAir2 = world.getBlock(x, y + 2, z);
                    if (CoroUtilBlock.isAir(blockAir2)) {
                        return true;
                    }
                }
            }
        }
    }
    return false;
}

[Buggy Hunk]
if (!world.canBlockSeeTheSky(x, y, z) && world.getBlockLightValue(x, y, z) < 5) {

[Patch]
if (!world.canBlockSeeTheSky(x, y, z) && isValidLightLevel(world, x, y, z)/*world.getBlockLightValue(x, y, z) < 5*/) {