Jump to content

Accesing other blocks variables.


pollitoyeye

Recommended Posts

Hi, i made a block that stores variables in a tileentity so if i have another block how can i make it check the other block variable if is in x-1. For expample if i place the first block in x:0 y:10 z:0 thath has a variable j with the valor 4 and i place the second in x:-1 y:10 z:0

how can i make the second acces j valor?

Link to comment
Share on other sites

world.getBlockTileEntity(...)

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Just use:

t#(YOUR_VARIABLE_NAME/YOUR_METHOD_NAME

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

Using this

    public boolean onBlockActivated(World world, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{
            if(!world.isRemote)
            {
            	TileEntityPc t = (TileEntityPc) world.getBlockTileEntity(par2 +1, par3, par4);
                       	par5EntityPlayer.addChatMessage(TileEntityPc.visitor1);
            }
            return true;  
            
}

 

But it says me that i have to change visitor to static.

Where is the problem in this code?

Link to comment
Share on other sites

No shit.

class.png

Might want to go finish learning Java.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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.

Announcements



×
×
  • Create New...

Important Information

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