event.load("block_break"); event.load("block_drop"); crops_tag = block.getTag("minecraft:crops"); hoe_tag = item.getTag("km:hoe"); auto_farm_set = set.new(); set.add(auto_farm_set, "minecraft:wheat_seeds"); set.add(auto_farm_set, "minecraft:carrot"); set.add(auto_farm_set, "minecraft:potato"); set.add(auto_farm_set, "minecraft:beetroot_seeds"); auto_farm_set2 = set.new(); set.add(auto_farm_set2, "minecraft:wheat"); set.add(auto_farm_set2, "minecraft:carrots"); set.add(auto_farm_set2, "minecraft:potatoes"); set.add(auto_farm_set2, "minecraft:beetroots"); msg("dev", "§bHarvest §rloaded."); @wait wait(); if(event == "block_drop") { loc = location; } else { loc = entity.getLocation(player); } world_name = world.getName(loc.getWorld(loc)); if(world.isSurvName(world_name)) { ignoreGoto(event); } goto("wait"); @block_break if(!block.hasTag(crops_tag, block)) { goto("wait"); } block_type = block.getType(block_loc); if(!set.contains(auto_farm_set2, block_type)) { goto("wait"); } item = living.getEquip(player, "hand"); if(!item.hasTag(hoe_tag, item)) { item = living.getEquip(player, "offhand"); if(!item.hasTag(hoe_tag, item)) { goto("wait"); } } cancel = false; goto("wait"); @block_drop if(!isPlayer(entity)) { goto("wait"); } player = entity; if(item == null) { goto("wait"); } if(!block.hasTag(crops_tag, block)) { goto("wait"); } if(!item.hasTag(hoe_tag, item)) { goto("wait"); } for(i = 0; i < list.getSize(drops); i++) { drop_item = list.getIndex(drops, i); if(set.contains(auto_farm_set, item.getType(drop_item))) { amount = item.getAmount(drop_item); if(amount > 0) { item.setAmount(drop_item, amount - 1); } } } block.set(location, concat(block_type, "[age=0]")); player.damageItem(player, 1); goto("wait");