Implementing MaterialAPI - Create new materials!

Discussion in 'Plugin Development' started by Ahmet094, Jun 14, 2013.

Thread Status:
Not open for further replies.
  1. http://forums.bukkit.org/threads/materialapi-create-new-items-and-blocks.123851/

    I'm confused.
    I can't figure out how to use a map as "texture".
    Here's my code, pls help me out. I've been trying to get it working for 2 hours now, but I'm sure you guys know how it should be^^
    #

    This code has to be inserted.
    Code:
    CustomMap PICTURE = new CustomMap("pictureId", new File(Plugin.getDataFolder(), "Picture.png"));
    CustomMaterial MAP_PICTURE = new CustomMaterial("materialId", Material.MAP);
    MAP_PICTURE.setName("Picture");
    MAP_PICTURE.setMap(PICTURE);

    [removed the unimportant parts of my code]
    Main class:
    Code:
    public class ThaumTools extends JavaPlugin implements Listener {
     
        public static CustomMaterial ThaumAxe;
     
        @Override
        public void onEnable() {
            getServer().getPluginManager().registerEvents(this, this);
     
            ThaumAxe = new ThaumAxe("ThaumAxe", Material.DIAMOND_AXE);
     
            CustomItemStack is1 = new CustomItemStack(ThaumAxe);
            CustomRecipeShaped r1 = new CustomRecipeShaped(is1);
            r1.setShape(
                    new CustomItemStack[]{null, new CustomItemStack(Material.DIAMOND), null},
                    new CustomItemStack[]{new CustomItemStack(Material.DIAMOND), new CustomItemStack(Material.DIAMOND_AXE), new CustomItemStack(Material.DIAMOND)},
                    new CustomItemStack[]{null});
            RecipeData.registerRecipe(r1);
        }
    }

    Weapon class:
    Code:
    public class ThaumAxe extends CustomMaterial {
     
        public ThaumTools plugin;
        CustomMap PICTURE;
     
        public ThaumAxe(String id, Material material) {
            super(id, material);
            this.PICTURE = new CustomMap("pictureId", new File("plugins/ThaumTools/axe.png"));
     
            this.setDamage(3);
            this.setName("ThaumAxe");
            this.setLore("Left-click a tree!");
        }
    }

    Thanks in advance!
     
  2. Offline

    desht

    Looking at the MaterialAPI code & examples, Cybermaxke is providing a way to easily set the image displayed on a map when you hold it. You can't use this to add custom textures to items (that isn't possible without a client mod).
     
  3. Offline

    Samthelord1

    desht I'm getting a error in netbeans saying its not abstract and doesnt override some things, why is this?
     
  4. Offline

    desht

    Uh, no idea. I would suggest you ask the API creator in the original thread.
     
Thread Status:
Not open for further replies.

Share This Page