Filled Decrafting Plugin

Discussion in 'Plugin Requests' started by thegiggitybyte, Jun 30, 2017.

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

    thegiggitybyte

    Plugin category: Mechanics

    Minecraft version: 1.12

    Suggested name: Decrafting Table

    What I want: I'd like something as close to the Deconstruction Table mod as possible in Bukkit. The video explains how the mechanics of it would work.

    For the block that the players would need to interact with, I am thinking either output slot of the vanilla crafting table or perhaps a player head of a crafting table would do. I'm fine with either, but would prefer the player head.

    If you do go for the player head, I'd like the crafting recipe to be the same as the one in the video above by default but customizable in the config. I'd like a boolean in the config for whether or not to use the player head as well.

    For the player head, if implemented, I'd prefer if players weren't able to actually craft things in there. Like, just bring up the crafting table GUI when the head is interacted with, but only allow for decrafting.

    For enchanted items: By default, I'd like for there to be a very small chance (20%?) for 80% of the enchantments to be placed onto a book and given to the player. I want the chance percentage to be configurable as well and a boolean toggle to disable this. If disabled, the player would lose their enchantments when decrafting.

    This isn't a must have, but it'd be cool if the decrafting table took into account for potions of luck and the luck attribute. Higher the luck, the more likely you are to get more back from decrafting. I'd like a boolean toggle for this in the config if implemented.

    I'd also like config for blacklisting specific items.


    Ideas for commands: /dt reload - Properly reloads config

    Ideas for permissions: decraftingtable.reload - Allow access to /dt reload. OP access by default.
    decraftingtable.notify - Allows receiving of error messages. OP access by default.

    When I'd like it by: ASAP. Not in too much of a rush.
     
  2. Offline

    Machine Maker

    @thegiggitybyte

    Have you looked around for a decrafting plugin? I find it hard to believe no ones created this.

    But if you can't find anything, I'd be happy to make this for you.
     
    Last edited: Jun 30, 2017
    thegiggitybyte likes this.
  3. Offline

    thegiggitybyte

    I have,@X1machinemaker1X. They're all either outdated to hell, very buggy, or don't have all the features I want.

    And yes! That'd be fantastic if you could do this for me!
     
    Last edited: Jun 30, 2017
  4. Offline

    Machine Maker

    @thegiggitybyte Ok, ill get on it.

    Wait, quick question. Only crafting recipies right? Not furnaces?

    EDIT: Also, I'm not sure I am going to be able to use an actual crafting grid. I might have to use a custom GUI and make it look like a crafting GUI by putting items in all the slots leaving the necessary ones open.
     
    Last edited: Jun 30, 2017
  5. Offline

    88p


    Just open a crafting bench to the player upon click, ez :D
     
  6. Offline

    Machine Maker

    @88p Idk about you, but I am not able to place an object into the output slot for decrafting.


    @thegiggitybyte Also, what about the fact that a chest can be crafted with dark oak planks and jungle planks? Should I always decraft those into oak planks?
     
    Last edited: Jun 30, 2017
  7. Offline

    InstanceofDeath

    Isn't it just CraftingInventoryInstance.setResult(ItemStack) ?

    Well this could not be very helpful, but the getServer().getRecipeFor(ItemStack) returns you a List of Recipes (Interface). And they are two necessary Interfaces which implement Recipe:

    ShapedRecipe GetIngredients returns a Map<Character, ItemStack> which you can easily run trough all the values in a for-each

    ShapelessRecipe GetIngredients returns a List of ItemStacks

    Hope I helped you a little bit eventhough you may knew it, but then you wouldn't have asked the plankquestion tho ;)
     
    Last edited: Jun 30, 2017
  8. Offline

    thegiggitybyte

    @X1machinemaker1X Sorry for taking a bit to reply.

    Yes, only crafting recipies. No smelted stuff and no potions.

    I've seen a few of the more outdated decrafting plugins use a custom GUI, and a few of the newer but more buggier ones use either the input slots of the crafting GUI or a simple right click on the output slot. I'm honestly fine with anything as long as it looks nice, has the same mechanics as the video, and is as bug free as humanly possible.

    Yes, that's fine for chests. For similar stuff like that where you can't figure out exactly which variant of something was used to craft the item, just have those decraft into a "base" block like oak, oak planks, stone, etc.
     
    Last edited: Jun 30, 2017
  9. Offline

    Machine Maker

    @InstanceofDeath Yeah I am doing exactly that to get the recipe and it works perfectly. I didn't know about the CraftingInventoryInstance.setResult(ItemStack). I will look into it thanks.

    I am having trouble finding a way to get the CraftingInventory object.

    Code:
    Inventory inv = Bukkit.getServer().createInventory(null, InventoryType.WORKBENCH, ChatColor.BLUE + "Decrafting Table");
            if (inv instanceof CraftingInventory) {
                Bukkit.getConsoleSender().sendMessage("True");
            }
    The inventory doesn't seem to be a crafting inventory.


    @thegiggitybyte Ok thanks! And also, another problem if I use the crafting gui, is that it is impossible to change the name of the GUI to anything other than its default. I was trying to find a way, but apparently, you can only change the name of a crafting gui client side. So I think its just better if I open a custom gui.
     
    Last edited: Jun 30, 2017
  10. Offline

    InstanceofDeath

    I think its just

    Code:java
    1.  
    2. CraftingInventory cInv = (CraftingInventory) Bukkit.createInventory(null, InventoryType.WORKBENCH);
    3.  
    4. //or
    5.  
    6. PlayerInstance.openWorkBench(parameters);
    7.  
     
  11. Offline

    Machine Maker

    @InstanceofDeath

    I thought I tried that. But anyway, I think I will just go with the custom gui.

    @thegiggitybyte So for the getting some items back from tools, I am thinking if the tool or armor is at say, 62% durability, for each item in the crafting recipe, you have a 62% chance of getting the item back. What do you think?


    One more question (I think!) the luck attribute of each minecraft player ranges from -1024 to 1024 with the default at 0. I was thinking that if you have a luck attribute of 512, the chance of getting an item back on a damaged tool or weapon would increase by half, up to 100% of course.

    Full Example: A player has a pick with 25% durability left. So for each item in the pick (3 diamonds, and 2 sticks), the player has, without Luck, a 25% chance of getting each item back. But, with a luck attribute of 256 (1/4 of max), his chance for each item increases. 25% + 25% = 50% for each item. It would work the same way with negative luck.
     
    Last edited: Jul 1, 2017
  12. Offline

    thegiggitybyte

    @X1machinemaker1X I think that sounds pretty damn good to me and well thought out [diamond]
    Do you have any concepts yet for how the GUI would look?
     
  13. Offline

    Machine Maker

    @thegiggitybyte Yeah, and here is the plugin. I think I got everything and I tested it a lot. But, this is a more complicated plugin so I might have missed something. Please let me know if I did.
     
  14. Offline

    thegiggitybyte

    @X1machinemaker1X

    Sweet! This looks nice so far.Found a few problems though.

    It'll eat torches.
    If I place any amount of torches on the output side, they'll disappear. I was about to play another game when I saw your post, so haven't tried much else, but it seems to be only torches.

    Also, when the Decrafting Table is broken the name will come back as craftingtable's Head instead of Decrafting Table.

    Haven't tested much else yet, but if I'll let you know if I find anything else!


    Thank you so much for taking the time to do this!
     
    Last edited: Jul 1, 2017
  15. Offline

    Machine Maker

    I uploaded a new version to the project page. It doesn't have the solution for the eating items, it's not just torches, but I have a plan and I am working on it. The problem is that cancelling InventoryClickEvent isn't working the way I thought it would. Anyway, I'll fix it soon.
     
    thegiggitybyte likes this.
  16. Offline

    thegiggitybyte

    @X1machinemaker1X Alright, sweet. Thanks my dude. I'll test it a lot more tomorrow when I'm home from work lmao.

    Gotta say though, I love the logo!
     
    Last edited: Jul 2, 2017
    Machine Maker likes this.
  17. Offline

    Machine Maker

    @thegiggitybyte Haha thanks! I have wanted to learn how to use software like GIMP for a while and this was kind of a start for me. Anyway, I uploaded what should be the fix for the eating items bug. Players should now be able to place items in the output slot but they will not be able to decraft anything while they are in there.
     
  18. Offline

    thegiggitybyte

    • Fixed a bug where some items were given the unbreakable attribute (they would show up as missing textures)
    Oh thank heck. This was a major issue with one of the older plugins I've tried before. My players and friends really didn't like that.
     
  19. Offline

    Machine Maker

Thread Status:
Not open for further replies.

Share This Page