Obligatory "I ruined everything!" thread
#5
Rev 602 has a new hook, HOOK_BLOCK_TO_PICKUP, that is called each time a player breaks a block and it can modify the pickups that they receive. It is called when MCServer has already decided what the standard pickups should be, and the hook can add / modify / remove them.
Hook parameters: BlockType, BlockMeta, cPlayer, cItem (equipped), cItems (pickups)

Example code that makes grass drop 4 diamonds:
Code:
PluginManager:AddHook(Plugin, cPluginManager.HOOK_BLOCK_TO_PICKUP)
...
function OnBlockToPickup(BlockType, BlockMeta, Player, EquippedItem, Pickups)
    if (BlockType == E_BLOCK_GRASS) then
        Pickups:Clear()
        Pickups:Add(E_ITEM_DIAMOND, 4, 0)
        return true
    end
    return false
end
Reply
Thanks given by:


Messages In This Thread
RE: Obligatory "I ruined everything!" thread - by xoft - 06-14-2012, 03:45 AM



Users browsing this thread: 5 Guest(s)