LUKÁŠ SOBOL

make me a plugin that will make new door with no texture but if i right click with any block it will get the texture of the block

Kodari AI
KodariSep 27 at 7:48 pm 1
BlockDoorTexture
A Minecraft plugin that creates invisible, textureless doors. When a player right-clicks the door while holding any block, the door adopts that block's texture. The plugin registers a custom door type with no default texture, listens for right-click interactions on these doors, and applies the held block's material texture to the door's appearance. Supports multiple doors, persists texture assignments across server restarts, and provides a simple command to create new textureless doors. Includes configurable permissions and messages for a seamless user experience.
  1. Add the Paper plugin setup and a /textureddoor command that gives the blank door item.

  2. Place it as an invisible two-block display with a clickable hitbox.

  3. Apply the held block’s appearance to both panels when right-clicked.

Added TexturedDoor for Paper 1.20.4+: use /textureddoor (or /newdoor) to get a blank, placeable door. Right-click its panel while holding a block to apply that block’s appearance to both halves.

The door’s panels are invisible until textured. I haven’t run a build or server test.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
6 225
src/main/java/com/kodari/textureddoor/TexturedDoorPlugin.java
package com.kodari.textureddoor;

import com.cryptomorin.xseries.XMaterial;
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;

public final class TexturedDoorPlugin extends JavaPlugin {
    private NamespacedKey doorItemKey;
    private NamespacedKey doorIdKey;

    @Override
    public void onEnable() {
        doorItemKey = new NamespacedKey(this, "door_item");
        doorIdKey = new NamespacedKey(this, "door_id");

        getServer().getPluginManager().registerEvents(new DoorListener(this), this);
        getCommand("textureddoor").setExecutor(new DoorCommand(this));
    }

    public NamespacedKey getDoorItemKey() {
        return doorItemKey;
    }

    public NamespacedKey getDoorIdKey() {
        return doorIdKey;
    }

    public ItemStack createDoorItem() {
        ItemStack item = XMaterial.matchXMaterial("PAPER")
                .map(XMaterial::parseItem)
                .orElseThrow(() -> new IllegalStateException("Could not create the door item."));
        ItemMeta meta = item.getItemMeta();
        meta.setDisplayName("§fBlank Door");
        meta.setLore(java.util.List.of("§7Place it, then right-click it", "§7while holding any block."));
        meta.getPersistentDataContainer().set(doorItemKey, PersistentDataType.BYTE, (byte) 1);
        item.setItemMeta(meta);
        return item;
    }
}