Furnaces..

Discussion in 'Plugin Development' started by girardcome, Jun 24, 2019.

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

    girardcome

    Hello, I have a problem with the furnaces, I can not open a furnace for a player, I think it should use a CraftFurnace.

    What I want: a method to spawn a furnace has precise coordinates, and then open it to a specific player, and that he can cook things in his own furnace (like minerals, food .. the basics of minecraft)

    What I did:

    PHP:
        private void spawnBlock(int xint yint zPlayer p) {
           
            
    World w Bukkit.getWorld("world");
            
    Location furnaceLoc = new Location(wxyz);
            
    furnaceLoc.getBlock().setType(Material.FURNACE);
            
    CraftFurnace furnace = new CraftFurnace(p.getWorld().getBlockAt(xyz));
            if(
    furnace.getBlock().getState() instanceof Furnace){
               
    p.openInventory(furnace.getInventory());
            }

        }

    What I got: I spawn a furnace to precise coordinates and when I try to open it with the p.openInventory method (furnace.getInventory ()); and it does not work.

    Thank you to those who will help me.
     
  2. Offline

    Shqep

    Very detailed thread.

    But really, what do you need help with xd...

    Unless I’m a witch, I can’t read your mind
     
  3. Offline

    girardcome

    I want to open a furnace inventory with an item for a player and let player smelting smelting what's inside, even while being closed!
     
  4. Offline

    Shqep

    @girardcome
    How about
    Bukkit.createInventory(holder, InventoryType.FURNACE, title)?
     
  5. Offline

    girardcome

    Actually, it opens an inventory of Furnace, but it does not cook anything at all, and the items that you put in this furnace, once closed they disappear.
     
  6. Offline

    Shqep

    I don’t really know, never used it

    By the way, you can always listen for InventoryDrag/Click/CloseEvent to, idk, “imitate” the original Furnace?
     
Thread Status:
Not open for further replies.

Share This Page