Eli Wood

can u make me a mod with guns and suger and chocolate milk and bullet proof vest. can you make it so the gun and bullets have a 10% chance to deal 250 damage, and the gun is crafter by using gun powder, iron, and copper. can you make it so there is an ak-47 and sniper with a scope. can you make the ak-47 be crafted by three iron, gunpowder, and copper. can the sniper be made with gunpowder, a stick, two iron, spy glass, and copper. lastly can you make a healing ammo for all weapons. can you make it so the scope on the sniper works like a real-life scope when you left click can you make it so the healing ammo is crafted with a golden apple, gold, and iron. last can you make it so that all ammo needs gunpowder to craft them can you make the bullet proof vest make it so the wearer takes half damage from any attack and is crafted with three gold, three iron, one wool, and one gun. can the suger be crafted by one sugar and one gunpowder and have it give you nausea. can the chocolate milk be crafted by one coco seed, one bucket of milk, and one gunpowder and when you drink it you get nausea and after you next sleep you wake up with three hearts instead of ten

Kodari AI
KodariOct 17 at 7:50 pm 1
GunCraftSurvival
Adds craftable AK-47 and scoped sniper rifles with 10% chance to deal 250 damage. Includes healing ammo, bulletproof vests reducing damage by half, sugar giving nausea, and chocolate milk causing nausea plus reduced hearts after sleeping. All ammo requires gunpowder; weapons use specified crafting recipes with functional zoom scope on sniper.
  1. Create the Paper plugin project files and register the crafting recipes.

  2. Implement weapon firing, ammo effects, the vest, consumables, and the sniper scope toggle.

Created the GunCraft Paper plugin with recipes for the AK-47, sniper, bulletproof vest, regular ammo, healing ammo, sugar, and chocolate milk. Right-click to fire; shots consume ammo, and regular ammo has a 10% chance to deal 250 damage. The vest halves incoming damage, sugar causes nausea, and chocolate milk causes nausea and sets health to three hearts after the player next sleeps.

Left-clicking with the sniper toggles aiming mode and slows movement. True visual scope magnification isn’t exposed by the standard Bukkit API, so this scope toggle doesn’t zoom the view.

Eli Wood

can you make this mod for the latest version of bedrock edition too

Kodari AI
KodariOct 17 at 7:58 pm 1

This project is a Paper Java plugin, so it can’t be installed directly as a Bedrock add-on. I can adapt it so Bedrock players can use it on a Java server through Geyser, or make a separate Bedrock add-on. Which one do you want?

Eli Wood

I would like to be able to play this mod on bedrock edition too so can you adapt it for bedrock pleas

Kodari AI
KodariOct 17 at 8:01 pm 1

Plan:

  • Keep this as a Paper plugin that Bedrock players use through Geyser, not a standalone Bedrock add-on.

  • Add a crouch-and-use control to toggle the sniper scope for touch/controller players.

  • Keep the existing left-click scope control for mouse users.

Added a Bedrock-friendly sniper control: crouch + use toggles the scope, while left-click still works for mouse users.

Bedrock players can use the plugin by joining a Paper server running Geyser; it is not a standalone Bedrock add-on. Keep Geyser updated for the latest Bedrock client. The scope toggle still slows movement but doesn’t visually zoom.

Eli Wood

can you make this a mod i can download into bedrock edition

Kodari AI
KodariOct 17 at 8:01 pm 1

This Paper plugin can’t be downloaded and installed directly in Bedrock Edition—it builds a Java .jar, not a Bedrock .mcaddon. Bedrock players can use it by joining a Java server running the plugin with Geyser, but a standalone Bedrock add-on would need to be built separately as a behavior/resource pack.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
Code
3 310
src/main/java/com/kodari/guncraft/GunCraftPlugin.java
package com.kodari.guncraft;

import com.cryptomorin.xseries.XMaterial;
import com.cryptomorin.xseries.XPotion;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.player.PlayerBedLeaveEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerItemHeldEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.RecipeChoice;
import org.bukkit.inventory.ShapelessRecipe;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.persistence.PersistentDataContainer;
import org.bukkit.persistence.PersistentDataType;
import org.bukkit.util.RayTraceResult;
import org.bukkit.util.Vector;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ThreadLocalRandom;

public final class GunCraftPlugin extends JavaPlugin implements Listener {
    private NamespacedKey itemKindKey;
    private NamespacedKey pendingSleepKey;
    private final Map<UUID, Long> nextShotAt = new HashMap<>();
    private final Map<UUID, Float> previousWalkSpeed = new HashMap<>();

    @Override
    public void onEnable() {
        itemKindKey = new NamespacedKey(this, "item_kind");
        pendingSleepKey = new NamespacedKey(this, "chocolate_milk_sleep");
        Bukkit.getPluginManager().registerEvents(this, this);
        registerRecipes();
    }

    private void registerRecipes() {
        ShapelessRecipe ak = new ShapelessRecipe(recipeKey("ak47"), customItem("IRON_HOE", "AK-47", "ak47", 1));
        ak.addIngredient(3, material("IRON_INGOT"));
        ak.addIngredient(material("GUNPOWDER"));
        ak.addIngredient(material("COPPER_INGOT"));
        Bukkit.addRecipe(ak);

        ShapelessRecipe sniper = new ShapelessRecipe(recipeKey("sniper"), customItem("SPYGLASS", "Sniper Rifle", "sniper", 1));
        sniper.addIngredient(2, material("IRON_INGOT"));
        sniper.addIngredient(material("GUNPOWDER"));
        sniper.addIngredient(material("STICK"));
        sniper.addIngredient(material("SPYGLASS"));
        sniper.addIngredient(material("COPPER_INGOT"));
        Bukkit.addRecipe(sniper);

        ShapelessRecipe ammo = new ShapelessRecipe(recipeKey("ammo"), customItem("IRON_NUGGET", "Bullet Ammo", "ammo", 8));
        ammo.addIngredient(material("GUNPOWDER"));
        ammo.addIngredient(material("IRON_NUGGET"));
        Bukkit.addRecipe(ammo);

        ShapelessRecipe healingAmmo = new ShapelessRecipe(recipeKey("healing_ammo"), customItem("GOLDEN_APPLE", "Healing Ammo", "healing_ammo", 4));
        healingAmmo.addIngredient(material("GOLDEN_APPLE"));
        healingAmmo.addIngredient(material("GOLD_INGOT"));
        healingAmmo.addIngredient(material("IRON_INGOT"));
        healingAmmo.addIngredient(material("GUNPOWDER"));
        Bukkit.addRecipe(healingAmmo);

        ShapelessRecipe vest = new ShapelessRecipe(recipeKey("bulletproof_vest"), customItem("LEATHER_CHESTPLATE", "Bulletproof Vest", "vest", 1));
        vest.addIngredient(3, material("GOLD_INGOT"));
        vest.addIngredient(3, material("IRON_INGOT"));
        vest.addIngredient(material("WHITE_WOOL"));
        vest.addIngredient(new RecipeChoice.ExactChoice(customItem("IRON_HOE", "AK-47", "ak47", 1)));
        Bukkit.addRecipe(vest);

        ShapelessRecipe sugar = new ShapelessRecipe(recipeKey("sugar"), customItem("SUGAR", "Sugar", "sugar", 1));
        sugar.addIngredient(material("SUGAR"));
        sugar.addIngredient(material("GUNPOWDER"));
        Bukkit.addRecipe(sugar);

        ShapelessRecipe chocolateMilk = new ShapelessRecipe(recipeKey("chocolate_milk"), customItem("MILK_BUCKET", "Chocolate Milk", "chocolate_milk", 1));
        chocolateMilk.addIngredient(material("COCOA_BEANS"));
        chocolateMilk.addIngredient(material("MILK_BUCKET"));
        chocolateMilk.addIngredient(material("GUNPOWDER"));
        Bukkit.addRecipe(chocolateMilk);
    }

    @EventHandler
    public void onInteract(PlayerInteractEvent event) {
        if (event.getHand() != EquipmentSlot.HAND) {
            return;
        }

        Player player = event.getPlayer();
        ItemStack held = player.getInventory().getItemInMainHand();
        String kind = itemKind(held);

        if ("sniper".equals(kind) && event.getAction().isLeftClick()) {
            event.setCancelled(true);
            toggleScope(player);
            return;
        }

        if (("ak47".equals(kind) || "sniper".equals(kind)) && event.getAction().isRightClick()) {
            event.setCancelled(true);
            if ("sniper".equals(kind) && player.isSneaking()) {
                toggleScope(player);
            } else {
                fire(player, kind);
            }
            return;
        }

        if (event.getAction().isRightClick() && ("sugar".equals(kind) || "chocolate_milk".equals(kind))) {
            event.setCancelled(true);
            consume(player, held, kind);
        }
    }

    @EventHandler
    public void onDamage(EntityDamageEvent event) {
        if (!(event.getEntity() instanceof Player player)) {
            return;
        }
        if ("vest".equals(itemKind(player.getInventory().getChestplate()))) {
            event.setDamage(event.getDamage() * 0.5);
        }
    }

    @EventHandler
    public void onBedLeave(PlayerBedLeaveEvent event) {
        Player player = event.getPlayer();
        PersistentDataContainer data = player.getPersistentDataContainer();
        if (data.has(pendingSleepKey, PersistentDataType.BYTE)) {
            player.setHealth(Math.min(6.0, player.getMaxHealth()));
            data.remove(pendingSleepKey);
        }
    }

    @EventHandler
    public void onHeldItemChange(PlayerItemHeldEvent event) {
        if (previousWalkSpeed.containsKey(event.getPlayer().getUniqueId())) {
            ItemStack next = event.getPlayer().getInventory().getItem(event.getNewSlot());
            if (!"sniper".equals(itemKind(next))) {
                clearScope(event.getPlayer());
            }
        }
    }

    @EventHandler
    public void onQuit(PlayerQuitEvent event) {
        clearScope(event.getPlayer());
        nextShotAt.remove(event.getPlayer().getUniqueId());
    }

    private void toggleScope(Player player) {
        UUID id = player.getUniqueId();
        if (previousWalkSpeed.containsKey(id)) {
            clearScope(player);
            player.sendMessage(ChatColor.GRAY + "Sniper scope off.");
            return;
        }
        previousWalkSpeed.put(id, player.getWalkSpeed());
        player.setWalkSpeed(0.02f);
        player.sendMessage(ChatColor.GREEN + "Sniper scope on. Movement slowed while aiming.");
    }

    private void clearScope(Player player) {
        Float speed = previousWalkSpeed.remove(player.getUniqueId());
        if (speed != null) {
            player.setWalkSpeed(speed);
        }
    }

    private void fire(Player player, String weapon) {
        long now = System.currentTimeMillis();
        long readyAt = nextShotAt.getOrDefault(player.getUniqueId(), 0L);
        if (now < readyAt) {
            return;
        }

        String ammoKind = consumeAmmo(player);
        if (ammoKind == null) {
            player.sendMessage(ChatColor.RED + "You need bullet ammo.");
            return;
        }
        nextShotAt.put(player.getUniqueId(), now + ("sniper".equals(weapon) ? 1200L : 150L));

        Vector direction = player.getEyeLocation().getDirection().normalize();
        double range = "sniper".equals(weapon) ? 120.0 : 45.0;
        RayTraceResult hit = player.getWorld().rayTraceEntities(
                player.getEyeLocation(), direction, range, 0.25,