Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Defining a custom item in PocketMine would succeed?

Comments in 'Plugin Development' started by PEMapModder, Jan 21, 2014.

  1. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Look at this code I just made:
    PHP:
    class Wallet extends Item{
            public function 
    __construct($meta=0,$count=1) {
                    
    $this->block=BlockAPI::get(329);
                    
    parent::__construct(329,0,$count,"Wallet");
                    
    $this->maxStackSize=1;
                    
    $this->isActivable=true;
            }
            public function 
    onActivate(Level $l,Player $p,Block $b,Block $t,$face,$fx,$y,$z) {//drop money
                    
    ServerAPI::request()->api->entity->drop(
                            new 
    Position($target->x+0.5,$target->y+1,$target->z+0.5,$target->level),
                            
    $this);
                    
    $p->removeItem(329,$this->meta,1,true);
            }
            public function 
    setMoney($amount) {
                    
    $this->meta=$amount;;
            }
            public function 
    increaseMoney($amount) {
                    
    $this->meta+=$amount;
            }
            public function 
    getMoney() {
                    return 
    $this->meta;
            }
            public static function 
    equipChange($data) {//called from the Plugin
                    
    if($data["item"] instanceof Wallet and EconFactionsLoadable::wantWalletMsg($data["player"]->username)){
                            
    $data["player"]->sendChat("You are holding a wallet containing $".$data["item"]->getMoney()*100);
                    }
            }
    }
    This code uses the unused saddle object to replace a wallet (similarly leather) and saves data in its damage value.
    Would this kind of custom items succeed? (yes and I know that the max money to be in a wallet is $1500 and must be multiples of $100 but I don't need to if()else() it because it is only called from my own code or otherwise, just not from players' hands)
    Last edited: Jan 21, 2014
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Or if I have to save more money I will need to make two kinds of wallets with same/similar texture, but I can't find any.
  3. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Wait... I suddenly realized that I could submit this for the plugin contest. Can I still submit the whole plugin after this partial release of part of the code? @shoghicp ?
    Last edited: Jan 21, 2014
  4. Darunia18
    Offline

    Darunia18 Staff Member Sectional Moderator

    Joined:
    Aug 23, 2013
    Posts:
    754
    Plugins:
    2
    Minecraft User:
    Darunia18
    I believe it just can't be released in the plugin repository.
  5. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    It can if I add something more.
  6. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    So would it work? Or do I need to define something else?
  7. Robotbuilder
    Offline

    Robotbuilder New Member

    Joined:
    Jan 19, 2014
    Posts:
    23
    Minecraft User:
    r0b0tbuilder
    So your saying...you can create custom items? But what about giving your item a texture?
  8. Darunia18
    Offline

    Darunia18 Staff Member Sectional Moderator

    Joined:
    Aug 23, 2013
    Posts:
    754
    Plugins:
    2
    Minecraft User:
    Darunia18
    You can however, since it's not possible to get a texture to it, he decided to use the saddle, which is currently unused in PocketMine and MCPE itself I believe. This is a pretty cool idea really! :D
    FrozenNintendo and Robotbuilder like this.
  9. Robotbuilder
    Offline

    Robotbuilder New Member

    Joined:
    Jan 19, 2014
    Posts:
    23
    Minecraft User:
    r0b0tbuilder
    Yeah!
  10. Robotbuilder
    Offline

    Robotbuilder New Member

    Joined:
    Jan 19, 2014
    Posts:
    23
    Minecraft User:
    r0b0tbuilder
    Actually, it is possible to edit the texture of an unused block or item and set the texture for the item that you created to the texture of the unused item or block. To edit the textures you would need to replace the source images for Minecraft PE with your own textures. For ios you can only replace source images on ios 5 and below using a program called iexplorer or a program similar to iexplorer
  11. FrozenNintendo
    Offline

    FrozenNintendo New Member

    Joined:
    Jan 26, 2014
    Posts:
    30
    Minecraft User:
    CupcakezMonkey
    I do think it's possible. It's pretty kewl
  12. Robotbuilder
    Offline

    Robotbuilder New Member

    Joined:
    Jan 19, 2014
    Posts:
    23
    Minecraft User:
    r0b0tbuilder
    Yes, and there are a few blocks and items that are not in use! :)
    FrozenNintendo likes this.
  13. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    pocketmine discussion usually do not include client modding.
  14. Cheston Tan
    Offline

    Cheston Tan Active Member

    Joined:
    Dec 22, 2013
    Posts:
    57
    Minecraft User:
    Jake70112
    Hey Pemapmodder! I'm Jake70112 (You know me lol) I would like to tell you that The Butter Network is willing to work with you with other owner of servers. We would be very gald that you are willing to work with us. Please message that you want to work with us at the The Butter Network forums. Thanks!


    By Cheston Tan
  15. FrozenNintendo
    Offline

    FrozenNintendo New Member

    Joined:
    Jan 26, 2014
    Posts:
    30
    Minecraft User:
    CupcakezMonkey
    Please go discus this elsewhere on topic.
  16. Cheston Tan
    Offline

    Cheston Tan Active Member

    Joined:
    Dec 22, 2013
    Posts:
    57
    Minecraft User:
    Jake70112
    Lol im trying to get people to work with us. Am i not allowed here???
  17. LDX
    Offline

    LDX Notable Member Plugin Developer

    Joined:
    Oct 2, 2013
    Posts:
    1,397
    Plugins:
    14
    No, you can't just burst off topic without at least having something to do with the topic in the first place.
  18. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Well it is true that he/she should inbox me. But it is better than creating a topic.
    FrozenNintendo likes this.
  19. Cheston Tan
    Offline

    Cheston Tan Active Member

    Joined:
    Dec 22, 2013
    Posts:
    57
    Minecraft User:
    Jake70112
    lol well never mind
  20. FrozenNintendo
    Offline

    FrozenNintendo New Member

    Joined:
    Jan 26, 2014
    Posts:
    30
    Minecraft User:
    CupcakezMonkey
    'Eh em... Anyways...... BACK ON TOPIC. :p

Share This Page

Advertisement