[Code Suggestion] Needed change for Wrench-API

    • Official Post

    If you are a Coder you may know how the "IWrenchable"-Interface works, it lets you choose if your Block can be wrenched or not. But what do you get when you Wrench a Machine? The Machine itself? NO, you get a Block with the metavalue of the wrenched Block. There is absolutely no way of adding custom drops for wrenched Machines.


    Lets say we have a special Machine. The Metavalue of its Block is 0, but there is another Machine with a diffrent purpose, which has normally just another Metavalue. But what if, lets say that Machine has a Metavalue of 17? Does the Wrench drop an Itemblock with Metavalue 17? NO it doesnt. Why? Because there is a friggin Cap of maximum Metavalues for a Block at 16 in Minecraft!


    Now we have people, who want to avoid that Cap, like Eloraam did for her Microblocks (i think). I personally try to make a MetaTileEntity with over 30000 diffrent Machine-ID's! Is that wrenchable? Not at all. So now for the suggested addition. I want a function within that API, which determines the ItemStacks (look at the plural), which are dropped, when the Wrench is used on a Block. Something similar to the following:


    Code
    public ItemStack[] getWrenchDrops(float aProbalility, EntityPlayer aPlayer, short aSide);


    Yes, that's all i suggest. A simple line of Code, which gets used by the Wrench, to determine the dropped Items.


    Edit: short aSide is the Minecraft-Side-Value of the side you clicked on. If the callback returns "null" instead of an empty ItemStack-Array, then the Machine doesnt get wrenched away.

  • Im not gonna say: "I love it cuz im a coder". No im not, and i got 00000 experience in coding.


    Im just gonna say: "If coders think its usefull, then forward with it!"

    The Viper will hide in the shadows... unseen... unheard... and when you least expect, she strikes.

  • Im not gonna say: "I love it cuz im a coder". No im not, and i got 00000 experience in coding.


    Im just gonna say: "If coders think its usefull, then forward with it!"


    How about you saying: "Since i have no fudging idea what this is for, im just gonna shut my mouth and not post at all!"


    If you still have the anal desire to show your support even though you have zer0 idea what it is, then just 5 star rate it and move on.


    Seriously...

  • Seems useful. Half-byte metadata cap is fairly annoying, and you're right, it's technically impossible to have a tile entity - based block drop itself. This could also be taken to the level of bad wrench drops, so you could specify what block or item would be dropped if a wrenching was unsuccessful. This could easily be implemented, and I am completely with GregT on this one.

  • what about wrench callback method that can be used to perform any action action, not only drops, this method shoud pass wrench item, player, maybe side and some additional data to use inside machine code.


    this will allow not only custom drops, but also custom effects, custom energy cost.


    wrenching machine that currently active may harm player who wrench and soo on.