Jump to content

[1.7.10] getIcon() called before removedByPlayer() [Solved]


larsgerrits

Recommended Posts

As in the title, the

getIcon()

method is called before the

removedByPlayer()

method. I am sure it is, because I put a breakpoint in the

getIcon()

method and one in the

removedByPlayer()

method, and the breakpoint in the

getIcon()

method hit first, and after that the breakpoint in the

removedByPlayer()

method.

 

The problem is, I need a value in the

getIcon()

method, which is set when the block is broken in the

removedByPlayer()

method. So does anyone know if there's a break-block method that is called before the

getIcon()

method?

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

Sorry, bad wording.

 

Say, I have 2 of the same blocks next to each other. When I break one of them, the other's

getIcon()

method is called before the

removedByPlayer()

method on the block you are breaking. And when I break that block, it sets a variable to the surrounding blocks, which need to be accessed in the

getIcon()

method.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

That's what I was thinking too. And this is my

removedByPlayer()

method:

@Override
    public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest)
    {
        TileEntity tile = world.getTileEntity(x, y, z);
        if (tile instanceof TileEntityMultiblock)
        {
            TileEntityMultiblock tileMultiblock = (TileEntityMultiblock) tile;
            if (tileMultiblock.hasMaster())
            {
                int[] offset = tileMultiblock.getOffset();
                IMultiblock multiblock = tileMultiblock.getMultiblock();
                multiblock.resetStructure(world, x - offset[0], y - offset[1], z - offset[2]);
            }
        }
        return super.removedByPlayer(world, player, x, y, z, willHarvest);
    }

So I don't know what's wrong with it...

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

Well, I'll do some more digging, and in the meanwhile: I hope someone else knows what's going on...

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

I figured out the issue!

 

I was looking at the deprecated version of the

removedByPlayer()

method, and saw it was called from 2 places: the non-deprecated

removedByPlayer

method, and in the

onPlayerDestroyBlock()

method in

PlayerControllerMP

. So I tryed overridong the deprecated version of the method, and that works!

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.