nikczu

(Minecraft) Generate a proper Plugin for 1.21.11 paper in which there will be a Tractor that harvests and immediately replants because it has 2 tanks where the harvests go into one and the seeds that it is supposed to plant go into the other, and to obtain such a tractor you have to craft it through custom crafting which administrators can change using the command /traktor craftingz and to pick up a placed tractor into the inventory you have to click left shift and the right mouse button while having the tractor within range there is also the command /traktor give (Person) which instantly gives the tractor to the owner the appearance is supposed to be as good as possible and at the back there are supposed to be 2 chests and as I said 1 is supposed to be the tank for harvests and the 2nd for seeds try to make this tractor 3D so that there are non-breakable signs on it with the text seeds and harvests on the side where the chest is the wheels are supposed to be made of coal but they should look like wheels and not like a square and the tractor is supposed to be about 4 blocks high and 3 blocks wide and as long as needed to look nice and professional the item that has to be placed and that you get after custom crafting, meaning the tractor, is supposed to be a chest which when placed becomes the tractor it is supposed to be enchanted with unbreaking 10 and have lore with some color and text You Come Up With and remember to bold it using &l

Kodari AI
KodariAug 19 at 10:00 am 3
TractorFarmSystem
A comprehensive Minecraft plugin that adds a 3D tractor vehicle for automated farming. Players craft a tractor item through customizable admin-defined recipes, then place it to spawn a 4-block-tall, 3-block-wide tractor structure with coal wheels, non-breakable signs labeled "Seeds" and "Harvests", and two chest compartments - one collecting harvested crops and one dispensing seeds for automatic replanting. The tractor harvests mature crops and immediately replants using stored seeds. Players retrieve placed tractors by shift-right-clicking within range. Admin commands include /traktor craftingz to modify recipes and /traktor give to instantly grant tractors. The tractor item is an enchanted chest with Unbreaking X and bold colored lore text.
  1. Create the Paper 1.21.11 plugin foundation, item identity, configuration, and permissions.

  2. Implement the 3D tractor structure, two tank inventories, wheels, signs, persistence, pickup, and crop harvesting/replanting.

  3. Add /traktor give, /traktor craftingz, editable recipe storage, and event protection.

  4. Add build metadata and default configuration.

The first generation is in place. I’m tightening the interaction and persistence paths before finishing: the recipe editor must save the inventory actually being edited, and pickup must inspect the real tank contents rather than use a placeholder.Implemented the Traktor plugin from scratch for Paper 1.21.x.

Features included:

  • Custom enchanted tractor chest item with bold colored lore.

  • /traktor give <player>.

  • /traktor craftingz custom 3×3 recipe editor.

  • Editable recipe saved to config.yml.

  • Automatic recipe registration.

  • Tractor placement from the custom chest item.

  • Decorative tractor structure approximately 3 blocks wide and 4 blocks tall.

  • Two rear tank chests:

    • HARVEST TANK

    • SEED TANK

  • Non-breakable labeled signs for HARVESTS and SEEDS.

  • Coal-block item-display wheels.

  • Automatic crop harvesting and replanting.

  • Supports wheat, carrots, potatoes, beetroot, and nether wart.

  • Shift-right-click pickup.

  • Pickup blocked while either tank contains items.

  • Tractor persistence in tractors.yml.

  • Protection against breaking tractor blocks and damaging wheels.

  • Admin permission: traktor.admin.

  • /traktor reload.

Files created include the Gradle project, plugin metadata, configuration, command system, tractor manager, recipe manager/editor, listener system, tractor model, and supporting utilities.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
13 975
src/main/java/com/kodari/traktor/TraktorPlugin.java
package com.kodari.traktor;

import com.cryptomorin.xseries.XEnchantment;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.persistence.PersistentDataType;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.Arrays;

public final class TraktorPlugin extends JavaPlugin {
    private NamespacedKey tractorItemKey;
    private TractorManager tractorManager;
    private RecipeManager recipeManager;

    @Override
    public void onEnable() {
        saveDefaultConfig();
        tractorItemKey = new NamespacedKey(this, "tractor_item");
        tractorManager = new TractorManager(this);
        recipeManager = new RecipeManager(this);
        recipeManager.registerRecipe();
        tractorManager.load();

        TraktorListener listener = new TraktorListener(this);
        getServer().getPluginManager().registerEvents(listener, this);
        TraktorCommand command = new TraktorCommand(this);
        getCommand("traktor").setExecutor(command);
        getCommand("traktor").setTabCompleter(command);

        getServer().getScheduler().runTaskTimer(this, tractorManager::harvestAll, 20L, 20L);
    }

    @Override
    public void onDisable() {
        if (tractorManager != null) {
            tractorManager.save();
        }
    }

    public TractorManager getTractorManager() {
        return tractorManager;
    }

    public RecipeManager getRecipeManager() {
        return recipeManager;
    }

    public String color(String text) {
        return ChatColor.translateAlternateColorCodes('&', text);
    }

    public ItemStack createTractorItem() {
        Material chest = MaterialUtil.material("CHEST");
        ItemStack item = new ItemStack(chest);
        ItemMeta meta = item.getItemMeta();
        meta.setDisplayName(color("&6&lTRAKTOR"));
        meta.setLore(Arrays.asList(
                color("&8&lIndustrial farming machine"),
                color("&7&lHarvests crops and replants them"),
                color("&7&lautomatically from its tanks."),
                "",
                color("&e&lSHIFT + RIGHT CLICK &7&lto pick it up"),
                color("&8&lEmpty both tanks before pickup."),
                "",
                color("&6&lBuilt for the fields")
        ));
        XEnchantment.matchXEnchantment("UNBREAKING")
                .ifPresent(enchantment -> meta.addEnchant(enchantment.getEnchant(), 10, true));
        meta.getPersistentDataContainer().set(tractorItemKey, PersistentDataType.BYTE, (byte) 1);
        item.setItemMeta(meta);
        return item;
    }

    public boolean isTractorItem(ItemStack item) {
        if (item == null || !item.hasItemMeta()) {
            return false;
        }
        Byte value = item.getItemMeta().getPersistentDataContainer().get(tractorItemKey, PersistentDataType.BYTE);
        return value != null && value == 1;
    }
}