Jump to content

Unable to get nearby tile entities?


austinv11

Recommended Posts

Hi, I was making a tile entity that would need to detect nearby tile entities. I check all sides of the block on each updateEntity() method call, but it is unable to detect any nearby tile entities. I added a debug line to print the name of the blocks it detected, and they all returned as "tile.air" despite the blocks clearly not being air blocks. Code: https://github.com/austinv11/PeripheralsPlusPlus/blob/master/src%2Fmain%2Fjava%2Fcom%2Faustinv11%2Fperipheralsplusplus%2Ftiles%2FTileEntityRFCharger.java

Thanks!

Link to comment
Share on other sites

Hi

 

I'd suggest adding a few more diagnostics, eg

 

for (int i = 0; i < 6; i++) {
		int x = this.xCoord + dirs[i].offsetX;
		int y = this.yCoord + dirs[i].offsetY;
		int z = this.zCoord + dirs[i].offsetZ;
System.out.println("Test " + i + " at [" + x + ", " + y + ", " + z + "]");
		if (!getWorldObj().blockExists(x, y, z))
			continue;
		Block t = getWorldObj().getBlock(x, y, z);
System.out.println("Block found:" + block);

		TileEntity te = getWorldObj().getTileEntity(x, y, z);
System.out.println("Tile Entity found:" + te);

		if (te instanceof ITurtleAccess) {
			turtles.add((ITurtleAccess) te);
			Logger.info("");
		}
	}

 

-TGG

 

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.