Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Ran into a snag


Recommended Posts

I've ran into a snag while converting my 1.2.5 mod


PlayerAPI edits on the EntityPlayerSP & MP level which works for most things but flops for canHarvestBlock


ForgeHooks.canHarvestBlock calls EntityPlayer.canHarvestBlock which returns its value to ForgeHooks.canHarvestBlock


My code does nothing through PlayerAPI, but doing a temp edit in EntityPlayer get everything working fine.


For the life of me I just can't seem to think of a way to edit the return of a direct call to EntityPlayer.canHarvestBlock from EntityPlayerSP.canHarvestBlock

Link to comment
Share on other sites

It would be nice to drop a dependency, I noticed the new Event system was able to replace a few things I needed PAPI for.


Anyhow, looks like I'm off to google I've never used asm before and have no clue what to do.

If anyone want to post any helpful info I'd be grateful  ;D

Link to comment
Share on other sites

Well the good news is the event system was able to replace all but two parts from my PAPI code. (Just a bit of rethinking was required)


The bad news is I'm apparently too dumb to understand how to use the asm library  :'(


Maybe if I better explained what I'm trying to do.


My Mod adds player classes, the strongman/earth class is the only one with troubles. They can punch through stone and get a small bonus to mining speed.

To make this work I need to change the return of EntityPlayer.getCurrentPlayerStrVsBlock and EntityPlayer.canHarvestBlock


EntityPlayer.canHarvestBlock mock-up

    public boolean canHarvestBlock(Block par1Block)
        //return this.inventory.canHarvestBlock(par1Block);
        return ShetiPhian.proxy.canHarvestBlock(this, this.inventory.canHarvestBlock(par1Block), par1Block);


EntityPlayer.getCurrentPlayerStrVsBlock mock-up

    public float getCurrentPlayerStrVsBlock(Block par1Block, int meta)
        ItemStack stack = inventory.getCurrentItem();
        float var2 = (stack == null ? 1.0F : stack.getItem().getStrVsBlock(stack, par1Block, meta));
        int var3 = EnchantmentHelper.getEfficiencyModifier(this.inventory);

        if (var3 > 0 && ForgeHooks.canHarvestBlock(par1Block, this, meta))
            var2 += (float)(var3 * var3 + 1);

        if (this.isPotionActive(Potion.digSpeed))
            var2 *= 1.0F + (float)(this.getActivePotionEffect(Potion.digSpeed).getAmplifier() + 1) * 0.2F;

        if (this.isPotionActive(Potion.digSlowdown))
            var2 *= 1.0F - (float)(this.getActivePotionEffect(Potion.digSlowdown).getAmplifier() + 1) * 0.2F;

        if (this.isInsideOfMaterial(Material.water) && !EnchantmentHelper.getAquaAffinityModifier(this.inventory))
            var2 /= 5.0F;

        if (!this.onGround)
            var2 /= 5.0F;

        //return var2;
        return ShetiPhian.proxy.getCurrentPlayerStrVsBlock(this, var2, par1Block, meta);

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • What on earth... Did you put all those entries there? This file should usually be empty. Are you using any antivirus software? If so: Which? Do you have any Minecraft-related software installed (third party launchers)? If so: Which?
    • I can't dm, so i'll attach it here  # Copyright (c) 1993-2009 Microsoft Corp. # # This is a sample HOSTS file used by Microsoft TCP/IP for Windows. # # This file contains the mappings of IP addresses to host names. Each # entry should be kept on an individual line. The IP address should # be placed in the first column followed by the corresponding host name. # The IP address and the host name should be separated by at least one # space. # # Additionally, comments (such as these) may be inserted on individual # lines or following the machine name denoted by a '#' symbol. # # For example: # #     rhino.acme.com          # source server #     x.acme.com              # x client host # localhost name resolution is handled within DNS itself. #       localhost #    ::1             localhost    codeload.github.com    support.kaspersky.ru    kaspersky.ru    virusinfo.info    forum.kasperskyclub.ru    cyberforum.ru    soft-file.ru    www.360totalsecurity.com    cezurity.com    www.dropbox.com    spec-komp.com    eset.ua    panel.koronavirusfuck.xyz    360totalsecurity.com    www.esetnod32.ru    www.comss.ru    blog-pc.ru    www.securrity.ru    vellisa.ru    download-software.ru    drweb-cureit.ru    softpacket.ru    www.kaspersky.com    www.avast.ua    www.avast.ru    zillya.ua    safezone.ua    vms.drweb.ru    www.drweb.ua    free.drweb.ru    biblprog.org.ua    free-software.com.ua    free.dataprotection.com.ua    www.drweb.com    www.softportal.com    www.nashnet.ua    softlist.com.ua    it-doc.info    esetnod32.ru    blog-bridge.ru    remontka.pro    securos.org.ua    pc-helpp.com    softdroid.net    malwarebytes.com    ru.vessoft.com    AlpineFile.ru    malwarebytes-anti-malware.ru.uptodown.com    ProgramDownloadFree.com    download.cnet.com    soft.mydiv.net    spyware-ru.com    remontcompa.ru    www.hitmanpro.com    hitman-pro.ru.uptodown.com    www.bleepingcomputer.com    soft.oszone.net    krutor.org    RuTracker.org    www.greatis.com    unhackme.ru.uptodown.com    programy.com.ua    softobase.com    www.besplatnoprogrammy.ru    unhackme.en.softonic.com    unhackme.com    unhackme.ru    nnm-club.name    vgrom.com    moneropool.com    mine.moneropool.com    xmr.cryptopool.org    pool.monero.org    minexmr.com    monero.crypto-pool.fr    dwarfpool.com    disk-space.ru    file7.ru    ufille.ru    rgho.st    yadi.su    catcut.net    fsdisk.ru    rpfile.ru    cheats.file-a.ru    file-space.org    sfailo.ru    sendspace.com    www.sendspace.com    fille-7.ru    loufile.ru    file-seven.com    file-a.ru    fail-7.ru    1-kk.ru    rufile.net    filexpwx.space    sfile.net    mdiskfile.com    mega.nz    dfile.su    rgfail.ru    rudwnl.ru    dfile.info    flles.ru    pool.minexmr.to    ska4ay.pl    ska4ay.ru    ska4ay.club    ska4ay.net    ska4ay.org    ska4ay.com    ska4ay.pro    ska4ay.pw    ska4ay.online    skachaty.pl    skachaty.ru    skachaty.club    skachaty.net    skachaty.org    skachaty.com    skachaty.pro    skachaty.pw    skachaty.online    skachay.pl    skachay.ru    skachay.club    skachay.net    skachay.org    skachay.com    skachay.pro    skachay.pw    skachay.website    skachay.online    ska4aty.pl    ska4aty.ru    ska4aty.club    ska4aty.net    ska4aty.org    ska4aty.com    ska4aty.pro    ska4aty.pw    ska4aty.online authserver.mojang.com sessionserver.mojang.com launchermeta.mojang.com    
    • You don't need to worry about this anymore, Forge has fixed this in the installer.
  • Topics

  • Who's Online (See full list)

  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.