FurnaceRecipe Error?

Discussion in 'Plugin Development' started by JetsinsuGZ, May 8, 2016.

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

    JetsinsuGZ

    The Furnace does set the Result as the custom item but, when I take out the custom item, it gives me this error in the cmd. I haven't messed with Furnaces before until today so I'm confused with what is wrong ;\

    Code:
    package me.jetsinsu.mages.recipes;
    
    import org.bukkit.Bukkit;
    import org.bukkit.Material;
    import org.bukkit.inventory.FurnaceRecipe;
    
    public class CustomFurnaceRecipe {
    
        public static CustomFurnaceRecipe instance = new CustomFurnaceRecipe();
      
        public static CustomFurnaceRecipe getInstance(){
            return instance;
        }
      
        public void customFurnaceRecipe(){
          
            FurnaceRecipe s = new FurnaceRecipe(ItemUtil.getManager().createItem(Material.IRON_INGOT, 1, (short) 0, "Steel", "Smelted iron"), Material.IRON_INGOT);
            Bukkit.getServer().addRecipe(s);
        }
    }
    Error:
    Code:
    Error executing task
    java.util.concurrent.ExecutionException: java.lang.ClassCastException: net.minecraft.server.v1_9_R1.ItemStack cannot be cast to java.lang.Float
            at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_91]
            at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_91]
            at net.minecraft.server.v1_9_R1.SystemUtils.a(SourceFile:46) [spigot-1.9.2.jar:git-Spigot-e000104-4cb3258]
            at net.minecraft.server.v1_9_R1.MinecraftServer.D(MinecraftServer.java:721) [spigot-1.9.2.jar:git-Spigot-e000104-4cb3258]
            at net.minecraft.server.v1_9_R1.DedicatedServer.D(DedicatedServer.java:400) [spigot-1.9.2.jar:git-Spigot-e000104-4cb3258]
            at net.minecraft.server.v1_9_R1.MinecraftServer.C(MinecraftServer.java:660) [spigot-1.9.2.jar:git-Spigot-e000104-4cb3258]
            at net.minecraft.server.v1_9_R1.MinecraftServer.run(MinecraftServer.java:559) [spigot-1.9.2.jar:git-Spigot-e000104-4cb3258]
            at java.lang.Thread.run(Unknown Source) [?:1.8.0_91]
    Caused by: java.lang.ClassCastException: net.minecraft.server.v1_9_R1.ItemStack cannot be cast to java.lang.Float
            at net.minecraft.server.v1_9_R1.RecipesFurnace.b(RecipesFurnace.java:135) ~[spigot-1.9.2.jar:git-Spigot-e000104-4cb3258]
            at net.minecraft.server.v1_9_R1.SlotFurnaceResult.c(SlotFurnaceResult.java:44) ~[spigot-1.9.2.jar:git-Spigot-e000104-4cb3258]
            at net.minecraft.server.v1_9_R1.SlotFurnaceResult.a(SlotFurnaceResult.java:31) ~[spigot-1.9.2.jar:git-Spigot-e000104-4cb3258]
            at net.minecraft.server.v1_9_R1.Container.a(Container.java:307) ~[spigot-1.9.2.jar:git-Spigot-e000104-4cb3258]
            at net.minecraft.server.v1_9_R1.PlayerConnection.a(PlayerConnection.java:1857) ~[spigot-1.9.2.jar:git-Spigot-e000104-4cb3258]
            at net.minecraft.server.v1_9_R1.PacketPlayInWindowClick.a(SourceFile:33) ~[spigot-1.9.2.jar:git-Spigot-e000104-4cb3258]
            at net.minecraft.server.v1_9_R1.PacketPlayInWindowClick.a(SourceFile:10) ~[spigot-1.9.2.jar:git-Spigot-e000104-4cb3258]
            at net.minecraft.server.v1_9_R1.PlayerConnectionUtils$1.run(SourceFile:13) ~[spigot-1.9.2.jar:git-Spigot-e000104-4cb3258]
            at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_91]
            at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_91]
            at net.minecraft.server.v1_9_R1.SystemUtils.a(SourceFile:45) ~[spigot-1.9.2.jar:git-Spigot-e000104-4cb3258]
            ... 5 more
    I tried setting it as a regular item but it still gives me the error
    Code:
    FurnaceRecipe s = new FurnaceRecipe(new ItemStack(Material.IRON_INGOT), Material.IRON_INGOT);
     
  2. Offline

    Zombie_Striker

    The second parameter needs to be a float.
     
  3. Offline

    2008Choco

    ._.
    "net.minecraft.server.v1_9_R1.ItemStack cannot be cast to java.lang.Float". You realize he's using a Material, correct? This stacktrace points towards an internal CraftBukkit method whilst registering the recipe. Also, if you'd take a look at the Javadocs:
    https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/inventory/FurnaceRecipe.html#FurnaceRecipe(org.bukkit.inventory.ItemStack, org.bukkit.Material)

    It actually does take a Material as the secondary parameter. The THIRD parameter is supposed to be a float value to specify the experience yield. It's actually an optional parameter as well, so it's not needed. This is not the issue
     
  4. Offline

    JetsinsuGZ

    Ok, So I messed with the Furnace a little. It seems as thought if result is the same is a the item being burned, it will get the error. It won't if it the burned item and result are different :\
     
  5. Offline

    mine-care

    @JetsinsuGZ If this thread is solved please mark it as "Solved"
    Also, dont abuse static :S
     
Thread Status:
Not open for further replies.

Share This Page