MaterialData hates me

Discussion in 'Plugin Development' started by Pitazzo, Oct 11, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    Pitazzo

    Hi guys,
    I've been stuck with this problem for hours, so I hope you can help me or at least give me a new point of view.
    First, you have to know that I'm using MoreMaterials, a SpoutCraft plugin in order to create custom items and blocks. All the custom stuff created with that plugin is based in flint item, and what actually defines which custom item is, is the data value. So, for example:

    Code:java
    1. Flint(32)

    and
    Code:java
    1. Flint(-85)

    would be different custom items. Easy, isn't it?

    Now, I'm trying to use a custom item as ingredient in a recipe, like this:

    Code:java
    1. public static ShapedRecipe Chest = new ShapedRecipe(new ItemStack(Material.CHEST, 1))
    2. .shape(" ", "*%*", " ")
    3. .setIngredient('*', new MaterialData(Material.ACTIVATOR_RAIL))
    4. .setIngredient('%', new MaterialData(Material.FLINT, (byte) 3));


    But it doesn't work! :'(

    I've tried lot of things like for example (while having the custom ingredient in hand):

    Code:java
    1. player.sendMessage("Data in hand:"+player.getItemInHand().getData().toString());
    2. player.sendMessage("Data 2:"+new MaterialData(Material.FLINT, (byte) 3).toString());
    3. if(player.getItemInHand().getData().equals(new MaterialData(Material.FLINT, (byte) 3))){
    4. player.sendMessage("MATCH!");
    5. }


    And my output was MATCH!
    So, I can see that the system actually works, but the recipe doesn't.

    I've also tried this (the way I definded the MaterialData was deprecated, so it might be the reason because it didn't work):
    Code:java
    1. public static ShapedRecipe Chest = new ShapedRecipe(new ItemStack(Material.CHEST, 1))
    2. .shape(" ", "*%*", " ")
    3. .setIngredient('*', new MaterialData(Material.ACTIVATOR_RAIL))
    4. .setIngredient('%', new MaterialData(Material.STAINED_CLAY, (byte) 10));


    And it worked! Therefore, the problem is that the item is custom.

    Any help will be appreciated, I really desperate...

    If something isn't clear enough, let me know it and I will try to explain it better. Sorry for my English ;)
     
  2. Offline

    xTrollxDudex

    So let me get this straight- you're using spout?
     
    Hawktasard and Code0 like this.
  3. Offline

    Pitazzo

    Yes, I'm a proud user of spout :D
     
  4. Offline

    fireblast709

    Pitazzo I think you might be on the wrong forums. As far as I can remember your code would work fine for Bukkit, so I just have to blame this one on Spout.

    [EDIT] in fact, I just read that you already figured out that it was Spout ;3
     
  5. Offline

    Pitazzo

    fireblast709
    I know it, but the spout forums are more or less, dead. Moreover, I've also asked about this to the main spoutcraft developer, without much succeess.
    As long as it was a bukkit-extrapolable question, I though someone could help me.
     
  6. Pitazzo Well since this doesn't occur using Bukkit, we've no way of knowing how to help, sorry. :)
     
  7. Offline

    fireblast709

    Pitazzo well the main issue is that the custom Materials are not found in Bukkit. Moreover, the Materials that are already there seem to function perfectly fine, thus it's not an issue with Bukkit itself, but rather an issue with how Spout deals with it. Since these fora are for Bukkit support (and not for Spout support) we cannot help you since there is nothing wrong with Bukkit.
     
Thread Status:
Not open for further replies.

Share This Page