Git Product home page Git Product logo

Comments (4)

CovertJaguar avatar CovertJaguar commented on June 6, 2024

I should also mention that the code that is supposed to prevent this from happening in ItemBucket doesn't actually work because getMovingObjectPositionFromPlayer() always returns an EnumMovingObjectType.TILE. The code at the bottom pertaining to cows is never called. The actual code for milking cows is in EntityCow, and suffers from similar issues of onItemRightClick() being called with odd results at times depending on what is behind the cow when the right click happened.

from minecraftforge.

LexManos avatar LexManos commented on June 6, 2024

Sorry its been a while, but, can you double check this. Returning false from IEntityInteractHandler.onEntityInteract should prevent any further processing from happening.

from minecraftforge.

CovertJaguar avatar CovertJaguar commented on June 6, 2024

It can't prevent further processing because the processing continues from Minecraft.clickMouse() two levels above the IEntityInteractHandler call. Below is the relevant code.

This line handles the entity interaction and ultimately results in calling the handler:
this.playerController.interactWithEntity(this.thePlayer, this.objectMouseOver.entityHit);

But it has no return value. And item right clicks are sent at the bottom after the first IF-ELSE block from this line:
if (var10 != null && this.playerController.sendUseItem(this.thePlayer, this.theWorld, var10))

So no processing does not stop if you return false. The item right click is still sent regardless.

        if (this.objectMouseOver == null)
        {
            if (par1 == 0 && this.playerController.isNotCreative())
            {
                this.leftClickCounter = 10;
            }
        }
        else if (this.objectMouseOver.typeOfHit == EnumMovingObjectType.ENTITY)
        {
            if (par1 == 0)
            {
                this.playerController.attackEntity(this.thePlayer, this.objectMouseOver.entityHit);
            }

            if (par1 == 1)
            {
                this.playerController.interactWithEntity(this.thePlayer, this.objectMouseOver.entityHit);
            }
        }
        else if (this.objectMouseOver.typeOfHit == EnumMovingObjectType.TILE)
        {
            int var4 = this.objectMouseOver.blockX;
            int var5 = this.objectMouseOver.blockY;
            int var6 = this.objectMouseOver.blockZ;
            int var7 = this.objectMouseOver.sideHit;

            if (par1 == 0)
            {
                this.playerController.clickBlock(var4, var5, var6, this.objectMouseOver.sideHit);
            }
            else
            {
                int var9 = var3 != null ? var3.stackSize : 0;

                if (this.playerController.onPlayerRightClick(this.thePlayer, this.theWorld, var3, var4, var5, var6, var7))
                {
                    var2 = false;
                    this.thePlayer.swingItem();
                }

                if (var3 == null)
                {
                    return;
                }

                if (var3.stackSize == 0)
                {
                    this.thePlayer.inventory.mainInventory[this.thePlayer.inventory.currentItem] = null;
                }
                else if (var3.stackSize != var9 || this.playerController.isInCreativeMode())
                {
                    this.entityRenderer.itemRenderer.func_9449_b();
                }
            }
        }

        if (var2 && par1 == 1)
        {
            ItemStack var10 = this.thePlayer.inventory.getCurrentItem();

            if (var10 != null && this.playerController.sendUseItem(this.thePlayer, this.theWorld, var10))
            {
                this.entityRenderer.itemRenderer.func_9450_c();
            }
        }

from minecraftforge.

CovertJaguar avatar CovertJaguar commented on June 6, 2024

From looking at the code, I'd say its fixed. I'll let you know if I still have issues in the future.

from minecraftforge.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.