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

Ran into a snag


ShetiPhian
 Share

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.

Guest
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.

 Share



  • 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: # #      102.54.94.97     rhino.acme.com          # source server #       38.25.63.10     x.acme.com              # x client host # localhost name resolution is handled within DNS itself. #    127.0.0.1       localhost #    ::1             localhost 127.0.0.1    codeload.github.com 127.0.0.1    support.kaspersky.ru 127.0.0.1    kaspersky.ru 127.0.0.1    virusinfo.info 127.0.0.1    forum.kasperskyclub.ru 127.0.0.1    cyberforum.ru 127.0.0.1    soft-file.ru 127.0.0.1    www.360totalsecurity.com 127.0.0.1    cezurity.com 127.0.0.1    www.dropbox.com 127.0.0.1    193.228.54.23 127.0.0.1    spec-komp.com 127.0.0.1    eset.ua 127.0.0.1    panel.koronavirusfuck.xyz 127.0.0.1    360totalsecurity.com 127.0.0.1    www.esetnod32.ru 127.0.0.1    www.comss.ru 127.0.0.1    blog-pc.ru 127.0.0.1    www.securrity.ru 127.0.0.1    vellisa.ru 127.0.0.1    download-software.ru 127.0.0.1    drweb-cureit.ru 127.0.0.1    softpacket.ru 127.0.0.1    www.kaspersky.com 127.0.0.1    www.avast.ua 127.0.0.1    www.avast.ru 127.0.0.1    zillya.ua 127.0.0.1    safezone.ua 127.0.0.1    vms.drweb.ru 127.0.0.1    www.drweb.ua 127.0.0.1    free.drweb.ru 127.0.0.1    biblprog.org.ua 127.0.0.1    free-software.com.ua 127.0.0.1    free.dataprotection.com.ua 127.0.0.1    www.drweb.com 127.0.0.1    www.softportal.com 127.0.0.1    www.nashnet.ua 127.0.0.1    softlist.com.ua 127.0.0.1    it-doc.info 127.0.0.1    esetnod32.ru 127.0.0.1    blog-bridge.ru 127.0.0.1    remontka.pro 127.0.0.1    securos.org.ua 127.0.0.1    pc-helpp.com 127.0.0.1    softdroid.net 127.0.0.1    malwarebytes.com 127.0.0.1    ru.vessoft.com 127.0.0.1    AlpineFile.ru 127.0.0.1    malwarebytes-anti-malware.ru.uptodown.com 127.0.0.1    ProgramDownloadFree.com 127.0.0.1    download.cnet.com 127.0.0.1    soft.mydiv.net 127.0.0.1    spyware-ru.com 127.0.0.1    remontcompa.ru 127.0.0.1    www.hitmanpro.com 127.0.0.1    hitman-pro.ru.uptodown.com 127.0.0.1    www.bleepingcomputer.com 127.0.0.1    soft.oszone.net 127.0.0.1    krutor.org 127.0.0.1    RuTracker.org 127.0.0.1    www.greatis.com 127.0.0.1    unhackme.ru.uptodown.com 127.0.0.1    programy.com.ua 127.0.0.1    softobase.com 127.0.0.1    www.besplatnoprogrammy.ru 127.0.0.1    unhackme.en.softonic.com 127.0.0.1    unhackme.com 127.0.0.1    unhackme.ru 127.0.0.1    nnm-club.name 127.0.0.1    vgrom.com 127.0.0.1    moneropool.com 127.0.0.1    mine.moneropool.com 127.0.0.1    xmr.cryptopool.org 127.0.0.1    pool.monero.org 127.0.0.1    minexmr.com 127.0.0.1    monero.crypto-pool.fr 127.0.0.1    dwarfpool.com 127.0.0.1    disk-space.ru 127.0.0.1    file7.ru 127.0.0.1    ufille.ru 127.0.0.1    rgho.st 127.0.0.1    yadi.su 127.0.0.1    catcut.net 127.0.0.1    fsdisk.ru 127.0.0.1    rpfile.ru 127.0.0.1    cheats.file-a.ru 127.0.0.1    file-space.org 127.0.0.1    sfailo.ru 127.0.0.1    sendspace.com 127.0.0.1    www.sendspace.com 127.0.0.1    fille-7.ru 127.0.0.1    loufile.ru 127.0.0.1    file-seven.com 127.0.0.1    file-a.ru 127.0.0.1    fail-7.ru 127.0.0.1    1-kk.ru 127.0.0.1    rufile.net 127.0.0.1    filexpwx.space 127.0.0.1    sfile.net 127.0.0.1    mdiskfile.com 127.0.0.1    mega.nz 127.0.0.1    dfile.su 127.0.0.1    rgfail.ru 127.0.0.1    rudwnl.ru 127.0.0.1    dfile.info 127.0.0.1    flles.ru 127.0.0.1    pool.minexmr.to 127.0.0.1    ska4ay.pl 127.0.0.1    ska4ay.ru 127.0.0.1    ska4ay.club 127.0.0.1    ska4ay.net 127.0.0.1    ska4ay.org 127.0.0.1    ska4ay.com 127.0.0.1    ska4ay.pro 127.0.0.1    ska4ay.pw 127.0.0.1    ska4ay.online 127.0.0.1    skachaty.pl 127.0.0.1    skachaty.ru 127.0.0.1    skachaty.club 127.0.0.1    skachaty.net 127.0.0.1    skachaty.org 127.0.0.1    skachaty.com 127.0.0.1    skachaty.pro 127.0.0.1    skachaty.pw 127.0.0.1    skachaty.online 127.0.0.1    skachay.pl 127.0.0.1    skachay.ru 127.0.0.1    skachay.club 127.0.0.1    skachay.net 127.0.0.1    skachay.org 127.0.0.1    skachay.com 127.0.0.1    skachay.pro 127.0.0.1    skachay.pw 127.0.0.1    skachay.website 127.0.0.1    skachay.online 127.0.0.1    ska4aty.pl 127.0.0.1    ska4aty.ru 127.0.0.1    ska4aty.club 127.0.0.1    ska4aty.net 127.0.0.1    ska4aty.org 127.0.0.1    ska4aty.com 127.0.0.1    ska4aty.pro 127.0.0.1    ska4aty.pw 127.0.0.1    ska4aty.online 51.68.172.243 authserver.mojang.com 51.68.172.243 sessionserver.mojang.com 51.68.172.243 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.