# Need Help With Creating A Multiblock Structure [1.7.10] [SOLVED... For now]

## Recommended Posts

I need help with creating A multiblock structure. I have the code that checks if all the blocks are in the correct formation, but that is about it, I dont know what to do from here. Also, another thing I have no idea how to even start is all the blocks in the structure open the same inventory, you dont have to click a specific block in the structure to open the gui, and the inventories are synchronised with eachother so that if you open the gui from one block and add items, the gui from a different block has the same items as long as it is in the same structure.

This is the code I have that checks if the structure is correct (Warning, very long, the structure is large, 5x5x10)

```        public boolean checkMultiBlockForm() {
int x = this.xCoord;
int y = this.yCoord;
int z = this.zCoord;
Block block = BlockHandler.distillationChamber;

if (worldObj.getBlock(x+1, y, z) == block) {
if (worldObj.getBlock(x+2, y, z) == block) {
if (worldObj.getBlock(x+1, y, z+1) == block) {
if (worldObj.getBlock(x, y, z+1) == block) {
if (worldObj.getBlock(x, y, z+2) == block) {
if (worldObj.getBlock(x-1, y, z) == block) {
if (worldObj.getBlock(x-2, y, z) == block) {
if (worldObj.getBlock(x, y, z-1) == block) {
if (worldObj.getBlock(x, y, z-2) == block) {
if (worldObj.getBlock(x+1, y, z-1) == block) {
if (worldObj.getBlock(x+2, y, z+1) == block) {
if (worldObj.getBlock(x+1, y, z+2) == block) {
if (worldObj.getBlock(x+2, y, z-1) == block) {
if (worldObj.getBlock(x-1, y, z+1) == block) {
if (worldObj.getBlock(x-1, y, z+2) == block) {
if (worldObj.getBlock(x-2, y, z+1) == block) {
if (worldObj.getBlock(x-1, y, z-1) == block) {
if (worldObj.getBlock(x-2, y, z-1) == block) {
if (worldObj.getBlock(x+1, y, z-2) == block) {
if (worldObj.getBlock(x-1, y, z-2) == block) {
if (worldObj.getBlock(x+2, y+1, z) == block) {
if (worldObj.getBlock(x+2, y+1, z+1) == block) {
if (worldObj.getBlock(x+2, y+1, z-1) == block) {
if (worldObj.getBlock(x+1, y+1, z-2) == block) {
if (worldObj.getBlock(x+1, y+1, z+2) == block) {
if (worldObj.getBlock(x, y+1, z+2) == block) {
if (worldObj.getBlock(x, y+1, z-2) == block) {
if (worldObj.getBlock(x-1, y+1, z+2) == block) {
if (worldObj.getBlock(x-1, y+1, z-2) == block) {
if (worldObj.getBlock(x-2, y+1, z) == block) {
if (worldObj.getBlock(x-2, y+1, z+1) == block) {
if (worldObj.getBlock(x-2, y+1, z-1) == block) {
if (worldObj.getBlock(x+2, y+2, z) == block) {
if (worldObj.getBlock(x+2, y+2, z+1) == block) {
if (worldObj.getBlock(x+2, y+2, z-1) == block) {
if (worldObj.getBlock(x+1, y+2, z-2) == block) {
if (worldObj.getBlock(x+1, y+2, z+2) == block) {
if (worldObj.getBlock(x, y+2, z+2) == block) {
if (worldObj.getBlock(x, y+2, z-2) == block) {
if (worldObj.getBlock(x-1, y+2, z+2) == block) {
if (worldObj.getBlock(x-1, y+2, z-2) == block) {
if (worldObj.getBlock(x-2, y+2, z) == block) {
if (worldObj.getBlock(x-2, y+2, z+1) == block) {
if (worldObj.getBlock(x-2, y+2, z-1) == block) {
if (worldObj.getBlock(x+2, y+3, z) == block) {
if (worldObj.getBlock(x+2, y+3, z+1) == block) {
if (worldObj.getBlock(x+2, y+3, z-1) == block) {
if (worldObj.getBlock(x+1, y+3, z-2) == block) {
if (worldObj.getBlock(x+1, y+3, z+2) == block) {
if (worldObj.getBlock(x, y+3, z+2) == block) {
if (worldObj.getBlock(x, y+3, z-2) == block) {
if (worldObj.getBlock(x-1, y+3, z+2) == block) {
if (worldObj.getBlock(x-1, y+3, z-2) == block) {
if (worldObj.getBlock(x-2, y+3, z) == block) {
if (worldObj.getBlock(x-2, y+3, z+1) == block) {
if (worldObj.getBlock(x-2, y+3, z-1) == block) {
if (worldObj.getBlock(x+2, y+4, z) == block) {
if (worldObj.getBlock(x+2, y+4, z+1) == block) {
if (worldObj.getBlock(x+2, y+4, z-1) == block) {
if (worldObj.getBlock(x+1, y+4, z-2) == block) {
if (worldObj.getBlock(x+1, y+4, z+2) == block) {
if (worldObj.getBlock(x, y+4, z+2) == block) {
if (worldObj.getBlock(x, y+4, z-2) == block) {
if (worldObj.getBlock(x-1, y+4, z+2) == block) {
if (worldObj.getBlock(x-1, y+4, z-2) == block) {
if (worldObj.getBlock(x-2, y+4, z) == block) {
if (worldObj.getBlock(x-2, y+4, z+1) == block) {
if (worldObj.getBlock(x-2, y+4, z-1) == block) {
if (worldObj.getBlock(x+2, y+5, z) == block) {
if (worldObj.getBlock(x+2, y+5, z+1) == block) {
if (worldObj.getBlock(x+2, y+5, z-1) == block) {
if (worldObj.getBlock(x+1, y+5, z-2) == block) {
if (worldObj.getBlock(x+1, y+5, z+2) == block) {
if (worldObj.getBlock(x, y+5, z+2) == block) {
if (worldObj.getBlock(x, y+5, z-2) == block) {
if (worldObj.getBlock(x-1, y+5, z+2) == block) {
if (worldObj.getBlock(x-1, y+5, z-2) == block) {
if (worldObj.getBlock(x-2, y+5, z) == block) {
if (worldObj.getBlock(x-2, y+5, z+1) == block) {
if (worldObj.getBlock(x-2, y+5, z-1) == block) {
if (worldObj.getBlock(x+2, y+6, z) == block) {
if (worldObj.getBlock(x+2, y+6, z+1) == block) {
if (worldObj.getBlock(x+2, y+6, z-1) == block) {
if (worldObj.getBlock(x+1, y+6, z-2) == block) {
if (worldObj.getBlock(x+1, y+6, z+2) == block) {
if (worldObj.getBlock(x, y+6, z+2) == block) {
if (worldObj.getBlock(x, y+6, z-2) == block) {
if (worldObj.getBlock(x-1, y+6, z+2) == block) {
if (worldObj.getBlock(x-1, y+6, z-2) == block) {
if (worldObj.getBlock(x-2, y+6, z) == block) {
if (worldObj.getBlock(x-2, y+6, z+1) == block) {
if (worldObj.getBlock(x-2, y+6, z-1) == block) {
if (worldObj.getBlock(x+2, y+7, z) == block) {
if (worldObj.getBlock(x+2, y+7, z+1) == block) {
if (worldObj.getBlock(x+2, y+7, z-1) == block) {
if (worldObj.getBlock(x+1, y+7, z-2) == block) {
if (worldObj.getBlock(x+1, y+7, z+2) == block) {
if (worldObj.getBlock(x, y+7, z+2) == block) {
if (worldObj.getBlock(x, y+7, z-2) == block) {
if (worldObj.getBlock(x-1, y+7, z+2) == block) {
if (worldObj.getBlock(x-1, y+7, z-2) == block) {
if (worldObj.getBlock(x-2, y+7, z) == block) {
if (worldObj.getBlock(x-2, y+7, z+1) == block) {
if (worldObj.getBlock(x-2, y+7, z-1) == block) {
if (worldObj.getBlock(x+2, y+8, z) == block) {
if (worldObj.getBlock(x+2, y+8, z+1) == block) {
if (worldObj.getBlock(x+2, y+8, z-1) == block) {
if (worldObj.getBlock(x+1, y+8, z-2) == block) {
if (worldObj.getBlock(x+1, y+8, z+2) == block) {
if (worldObj.getBlock(x, y+8, z+2) == block) {
if (worldObj.getBlock(x, y+8, z-2) == block) {
if (worldObj.getBlock(x-1, y+8, z+2) == block) {
if (worldObj.getBlock(x-1, y+8, z-2) == block) {
if (worldObj.getBlock(x-2, y+8, z) == block) {
if (worldObj.getBlock(x-2, y+8, z+1) == block) {
if (worldObj.getBlock(x-2, y+8, z-1) == block) {
if (worldObj.getBlock(x+2, y+9, z) == block) {
if (worldObj.getBlock(x+2, y+9, z+1) == block) {
if (worldObj.getBlock(x+2, y+9, z-1) == block) {
if (worldObj.getBlock(x+1, y+9, z-2) == block) {
if (worldObj.getBlock(x+1, y+9, z+2) == block) {
if (worldObj.getBlock(x, y+9, z+2) == block) {
if (worldObj.getBlock(x, y+9, z-2) == block) {
if (worldObj.getBlock(x-1, y+9, z+2) == block) {
if (worldObj.getBlock(x-1, y+9, z-2) == block) {
if (worldObj.getBlock(x-2, y+9, z) == block) {
if (worldObj.getBlock(x-2, y+9, z+1) == block) {
if (worldObj.getBlock(x-2, y+9, z-1) == block) {
return true;
}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
return false;
}
```

This code is in the tileentity

I also want the container of this block to be able to store liquids, any ideas on how to make an inventory store liquids?

Thanks for the help.

I ask complicated questions, and apparently like to write really long detailed posts. But I also help others when I can.

##### Share on other sites

Okay, so I have just tested it by making it print in the console "Multi Block Structure Successfully Formed In TileEntity" if the formation is correct, and it works perfectly. Now what do I do from here?

I ask complicated questions, and apparently like to write really long detailed posts. But I also help others when I can.

##### Share on other sites

Well, to start of with, replace about 300 of those if statements with a few nested for loops. It'll clean your code up a lot.

Secondly, there are several methods to do the things you asked.

One way is all but one block are dummy blocks and simply reference the main block and its inventory, right click etc.

Second way, make them all real blocks but each has a reference of the original block as to interact with it.

So basically you always need one main block and every other block interacts with it. This doesn't mean those blocks can't do anything but the things that have to be the same everywhere will use that.

However do NOT attempt the following:

Make all blocks identical, and constantly update each other, you're wasting too much cpu that way. You can use the same block though, just make a block and if it is in the correct position(for instance in the bottom middle if it is a 3x3 at the bottom(it can detect another block there and has the same block around it) and simply let it behave as the core block, if isn't in that spot let it behave as a fake block.

##### Share on other sites

Okay, thanks for that, I'll try this. Also, how would I make a for loop check a 5x5x10 space and what do you mean by a nested for loop?? I have never heard of that (probably should have....)

And have you got any idea on how to make the inventory be able to store liquids? this whole multiblock is going to turn crude oil into petroleum, diesel, propane, tar, and butane (6 liquids I have already added)

I ask complicated questions, and apparently like to write really long detailed posts. But I also help others when I can.

##### Share on other sites

Nested for loops are for loops inside of other for loops.

Check out my mod, Realms of Chaos, here.

If I helped you, be sure to press the "Thank You" button!

##### Share on other sites

Ah, ok, that makes more sense now, so would I have a for loop for x pos, y pos, and z pos?

I ask complicated questions, and apparently like to write really long detailed posts. But I also help others when I can.

##### Share on other sites

Nope, you use whatever is most useful, logical and lets you compact as much as possible without doing extra loops or non-related numbers.

In minecraft however, this is often, and also here, the xyz.

##### Share on other sites

Okay, now, how do I make all the dummy blocks reference the main block (bottom centre) I know that black said:

Secondly, there are several methods to do the things you asked.

One way is all but one block are dummy blocks and simply reference the main block and its inventory, right click etc.

Second way, make them all real blocks but each has a reference of the original block as to interact with it.

So basically you always need one main block and every other block interacts with it. This doesn't mean those blocks can't do anything but the things that have to be the same everywhere will use that.

But how would I do this? I have had alot of trouble referencing other tileentities before

I ask complicated questions, and apparently like to write really long detailed posts. But I also help others when I can.

##### Share on other sites

Like this:

`TileEntity Tile = parWorld.getTileEntity(parCoordinateX, parCoordinateY, parCoordinateZ);`

##### Share on other sites

Okay, Thanks

I ask complicated questions, and apparently like to write really long detailed posts. But I also help others when I can.

##### Share on other sites

Now, any ideas on how I can make the inventory store liquids?

I ask complicated questions, and apparently like to write really long detailed posts. But I also help others when I can.

##### Share on other sites

Well, I'm not going to write this mod for you know, you'll have to do your own research.

There are several methods but the best way I believe is

that you can increment a counter if you've found the correct liquid and deleted it(whether as item or block).

Then if you need to make the liquid come out again you decrement the counter and spawn a liquid block at the correct coordinates.

Since the core block is obviously a tile entity, simply save the counter in nbt.

##### Share on other sites

Okay, thanks once again. I'll do this.

I ask complicated questions, and apparently like to write really long detailed posts. But I also help others when I can.

##### Share on other sites

Okay... I have been trying to figure this out for an hour now... my game crashes when I open the gui.

This is the crash report:

```[20:20:15] [server thread/ERROR]: Encountered an unexpected exception
net.minecraft.util.ReportedException: Ticking memory connection
at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:198) ~[NetworkSystem.class:?]
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:736) ~[MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:624) ~[MinecraftServer.class:?]
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) ~[integratedServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:495) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer\$2.run(MinecraftServer.java:762) [MinecraftServer\$2.class:?]
Caused by: java.lang.NullPointerException
at net.theepictekkit.generator.common.tileentity.TileEntityDistillationChamberFrame.checkMultiBlockForm(TileEntityDistillationChamberFrame.java:53) ~[TileEntityDistillationChamberFrame.class:?]
at net.minecraft.server.management.ItemInWorldManager.activateBlockOrUseItem(ItemInWorldManager.java:409) ~[itemInWorldManager.class:?]
at net.minecraft.network.NetHandlerPlayServer.processPlayerBlockPlacement(NetHandlerPlayServer.java:591) ~[NetHandlerPlayServer.class:?]
at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:74) ~[C08PacketPlayerBlockPlacement.class:?]
at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:122) ~[C08PacketPlayerBlockPlacement.class:?]
at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) ~[NetworkSystem.class:?]
... 5 more
[20:20:16] [server thread/ERROR]: This crash report has been saved to: C:\Users\Administrator\Desktop\MC Mod Dev\Generator Dev Workspace 1.7.10\eclipse\.\crash-reports\crash-2014-08-27_20.20.16-server.txt
[20:20:16] [server thread/INFO]: Saving chunks for level 'Generator Dev Test World III'/Overworld
---- Minecraft Crash Report ----
// Don't be sad, have a hug! <3

Time: 27/08/14 20:20
Description: Ticking memory connection

java.lang.NullPointerException: Ticking memory connection
at net.theepictekkit.generator.common.tileentity.TileEntityDistillationChamberFrame.checkMultiBlockForm(TileEntityDistillationChamberFrame.java:53)
at net.minecraft.server.management.ItemInWorldManager.activateBlockOrUseItem(ItemInWorldManager.java:409)
at net.minecraft.network.NetHandlerPlayServer.processPlayerBlockPlacement(NetHandlerPlayServer.java:591)
at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:74)
at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:122)
at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:736)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:624)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:495)
at net.minecraft.server.MinecraftServer\$2.run(MinecraftServer.java:762)

A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

Stacktrace:
at net.theepictekkit.generator.common.tileentity.TileEntityDistillationChamberFrame.checkMultiBlockForm(TileEntityDistillationChamberFrame.java:53)
at net.minecraft.server.management.ItemInWorldManager.activateBlockOrUseItem(ItemInWorldManager.java:409)
at net.minecraft.network.NetHandlerPlayServer.processPlayerBlockPlacement(NetHandlerPlayServer.java:591)
at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:74)
at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:122)

-- Ticking connection --
Details:
Connection: net.minecraft.network.NetworkManager@17634ddd
Stacktrace:
at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:736)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:624)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:495)
at net.minecraft.server.MinecraftServer\$2.run(MinecraftServer.java:762)

-- System Details --
Details:
Minecraft Version: 1.7.10
Operating System: Windows 8.1 (amd64) version 6.3
Java Version: 1.8.0_11, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 1831477296 bytes (1746 MB) / 2130051072 bytes (2031 MB) up to 2130051072 bytes (2031 MB)
JVM Flags: 5 total; -Xincgc -Xmx1024M -Xms1024M -Xmx2g -Xms2g
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
IntCache: cache: 0, tcache: 0, allocated: 12, tallocated: 94
FML: MCP v9.05 FML v7.10.25.1207 Minecraft Forge 10.13.0.1207 9 mods loaded, 9 mods active
mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
<CoFH ASM>{000} [CoFH ASM Data Initialization] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
Profiler Position: N/A (disabled)
Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Player Count: 1 / 8; [EntityPlayerMP['ForgeDevName'/310, l='Generator Dev Test World III', x=147.53, y=60.00, z=249.34]]
Type: Integrated Server (map_client.txt)
Is Modded: Definitely; Client brand changed to 'fml,forge'
#@!@# Game crashed! Crash report saved to: #@!@# .\crash-reports\crash-2014-08-27_20.20.16-server.txt
[20:20:16] [Client thread/INFO] [FML]: Waiting for the server to terminate/save.
[20:20:16] [server thread/INFO]: Saving chunks for level 'Generator Dev Test World III'/Nether
[20:20:16] [server thread/INFO]: Saving chunks for level 'Generator Dev Test World III'/The End
[20:20:18] [server thread/INFO] [FML]: Applying holder lookups
[20:20:18] [server thread/INFO] [FML]: Holder lookups applied
[20:20:18] [server thread/INFO] [FML]: The state engine was in incorrect state SERVER_STOPPING and forced into state SERVER_STOPPED. Errors may have been discarded.
[20:20:18] [Client thread/INFO] [FML]: Server terminated.
AL lib: (EE) alc_cleanup: 1 device not closed
Picked up _JAVA_OPTIONS: -Xmx2g -Xms2g
Java HotSpot(TM) 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release
```

This is the onBlockActivated code:

```        @Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
TileEntityDistillationChamberFrame tileEntity = new TileEntityDistillationChamberFrame();
if (!world.isRemote) {
if (!tileEntity.checkMultiBlockForm()) {
return false;
}
FMLNetworkHandler.openGui(player, Generator.instance, Generator.guiIdDistillationChamber, world, x, y, z);
}
return false;
}
```

And this is the checkMultiBlockForm method:

```        public boolean checkMultiBlockForm() {
int x = this.xCoord;
int y = this.yCoord;
int z = this.zCoord;
Block block = BlockHandler.distillationChamberWall;
Block main = BlockHandler.distillationChamber;

if (this != null) {
//Layer 1
if (worldObj.getBlock(x, y, z) == main) {
if (worldObj.getBlock(x+1, y, z) == block) {
if (worldObj.getBlock(x+2, y, z) == block) {
if (worldObj.getBlock(x+1, y, z+1) == block) {
if (worldObj.getBlock(x, y, z+1) == block) {
if (worldObj.getBlock(x, y, z+2) == block) {
if (worldObj.getBlock(x-1, y, z) == block) {
if (worldObj.getBlock(x-2, y, z) == block) {
if (worldObj.getBlock(x, y, z-1) == block) {
if (worldObj.getBlock(x, y, z-2) == block) {
if (worldObj.getBlock(x+1, y, z-1) == block) {
if (worldObj.getBlock(x+2, y, z+1) == block) {
if (worldObj.getBlock(x+1, y, z+2) == block) {
if (worldObj.getBlock(x+2, y, z-1) == block) {
if (worldObj.getBlock(x-1, y, z+1) == block) {
if (worldObj.getBlock(x-1, y, z+2) == block) {
if (worldObj.getBlock(x-2, y, z+1) == block) {
if (worldObj.getBlock(x-1, y, z-1) == block) {
if (worldObj.getBlock(x-2, y, z-1) == block) {
if (worldObj.getBlock(x+1, y, z-2) == block) {
if (worldObj.getBlock(x-1, y, z-2) == block) {
//Layer 2
if (worldObj.getBlock(x+2, y+1, z) == block) {
if (worldObj.getBlock(x+2, y+1, z+1) == block) {
if (worldObj.getBlock(x+2, y+1, z-1) == block) {
if (worldObj.getBlock(x+1, y+1, z-2) == block) {
if (worldObj.getBlock(x+1, y+1, z+2) == block) {
if (worldObj.getBlock(x, y+1, z+2) == block) {
if (worldObj.getBlock(x, y+1, z-2) == block) {
if (worldObj.getBlock(x-1, y+1, z+2) == block) {
if (worldObj.getBlock(x-1, y+1, z-2) == block) {
if (worldObj.getBlock(x-2, y+1, z) == block) {
if (worldObj.getBlock(x-2, y+1, z+1) == block) {
if (worldObj.getBlock(x-2, y+1, z-1) == block) {
//Layer 3
if (worldObj.getBlock(x+2, y+2, z) == block) {
if (worldObj.getBlock(x+2, y+2, z+1) == block) {
if (worldObj.getBlock(x+2, y+2, z-1) == block) {
if (worldObj.getBlock(x+1, y+2, z-2) == block) {
if (worldObj.getBlock(x+1, y+2, z+2) == block) {
if (worldObj.getBlock(x, y+2, z+2) == block) {
if (worldObj.getBlock(x, y+2, z-2) == block) {
if (worldObj.getBlock(x-1, y+2, z+2) == block) {
if (worldObj.getBlock(x-1, y+2, z-2) == block) {
if (worldObj.getBlock(x-2, y+2, z) == block) {
if (worldObj.getBlock(x-2, y+2, z+1) == block) {
if (worldObj.getBlock(x-2, y+2, z-1) == block) {
//Layer 4
if (worldObj.getBlock(x+2, y+3, z) == block) {
if (worldObj.getBlock(x+2, y+3, z+1) == block) {
if (worldObj.getBlock(x+2, y+3, z-1) == block) {
if (worldObj.getBlock(x+1, y+3, z-2) == block) {
if (worldObj.getBlock(x+1, y+3, z+2) == block) {
if (worldObj.getBlock(x, y+3, z+2) == block) {
if (worldObj.getBlock(x, y+3, z-2) == block) {
if (worldObj.getBlock(x-1, y+3, z+2) == block) {
if (worldObj.getBlock(x-1, y+3, z-2) == block) {
if (worldObj.getBlock(x-2, y+3, z) == block) {
if (worldObj.getBlock(x-2, y+3, z+1) == block) {
if (worldObj.getBlock(x-2, y+3, z-1) == block) {
//Layer 5
if (worldObj.getBlock(x+2, y+4, z) == block) {
if (worldObj.getBlock(x+2, y+4, z+1) == block) {
if (worldObj.getBlock(x+2, y+4, z-1) == block) {
if (worldObj.getBlock(x+1, y+4, z-2) == block) {
if (worldObj.getBlock(x+1, y+4, z+2) == block) {
if (worldObj.getBlock(x, y+4, z+2) == block) {
if (worldObj.getBlock(x, y+4, z-2) == block) {
if (worldObj.getBlock(x-1, y+4, z+2) == block) {
if (worldObj.getBlock(x-1, y+4, z-2) == block) {
if (worldObj.getBlock(x-2, y+4, z) == block) {
if (worldObj.getBlock(x-2, y+4, z+1) == block) {
if (worldObj.getBlock(x-2, y+4, z-1) == block) {
//Layer 6
if (worldObj.getBlock(x+2, y+5, z) == block) {
if (worldObj.getBlock(x+2, y+5, z+1) == block) {
if (worldObj.getBlock(x+2, y+5, z-1) == block) {
if (worldObj.getBlock(x+1, y+5, z-2) == block) {
if (worldObj.getBlock(x+1, y+5, z+2) == block) {
if (worldObj.getBlock(x, y+5, z+2) == block) {
if (worldObj.getBlock(x, y+5, z-2) == block) {
if (worldObj.getBlock(x-1, y+5, z+2) == block) {
if (worldObj.getBlock(x-1, y+5, z-2) == block) {
if (worldObj.getBlock(x-2, y+5, z) == block) {
if (worldObj.getBlock(x-2, y+5, z+1) == block) {
if (worldObj.getBlock(x-2, y+5, z-1) == block) {
//Layer 7
if (worldObj.getBlock(x+2, y+6, z) == block) {
if (worldObj.getBlock(x+2, y+6, z+1) == block) {
if (worldObj.getBlock(x+2, y+6, z-1) == block) {
if (worldObj.getBlock(x+1, y+6, z-2) == block) {
if (worldObj.getBlock(x+1, y+6, z+2) == block) {
if (worldObj.getBlock(x, y+6, z+2) == block) {
if (worldObj.getBlock(x, y+6, z-2) == block) {
if (worldObj.getBlock(x-1, y+6, z+2) == block) {
if (worldObj.getBlock(x-1, y+6, z-2) == block) {
if (worldObj.getBlock(x-2, y+6, z) == block) {
if (worldObj.getBlock(x-2, y+6, z+1) == block) {
if (worldObj.getBlock(x-2, y+6, z-1) == block) {
//Layer 8
if (worldObj.getBlock(x+2, y+7, z) == block) {
if (worldObj.getBlock(x+2, y+7, z+1) == block) {
if (worldObj.getBlock(x+2, y+7, z-1) == block) {
if (worldObj.getBlock(x+1, y+7, z-2) == block) {
if (worldObj.getBlock(x+1, y+7, z+2) == block) {
if (worldObj.getBlock(x, y+7, z+2) == block) {
if (worldObj.getBlock(x, y+7, z-2) == block) {
if (worldObj.getBlock(x-1, y+7, z+2) == block) {
if (worldObj.getBlock(x-1, y+7, z-2) == block) {
if (worldObj.getBlock(x-2, y+7, z) == block) {
if (worldObj.getBlock(x-2, y+7, z+1) == block) {
if (worldObj.getBlock(x-2, y+7, z-1) == block) {
//Layer 9
if (worldObj.getBlock(x+2, y+8, z) == block) {
if (worldObj.getBlock(x+2, y+8, z+1) == block) {
if (worldObj.getBlock(x+2, y+8, z-1) == block) {
if (worldObj.getBlock(x+1, y+8, z-2) == block) {
if (worldObj.getBlock(x+1, y+8, z+2) == block) {
if (worldObj.getBlock(x, y+8, z+2) == block) {
if (worldObj.getBlock(x, y+8, z-2) == block) {
if (worldObj.getBlock(x-1, y+8, z+2) == block) {
if (worldObj.getBlock(x-1, y+8, z-2) == block) {
if (worldObj.getBlock(x-2, y+8, z) == block) {
if (worldObj.getBlock(x-2, y+8, z+1) == block) {
if (worldObj.getBlock(x-2, y+8, z-1) == block) {
//Layer 10
if (worldObj.getBlock(x+2, y+9, z) == block) {
if (worldObj.getBlock(x+2, y+9, z+1) == block) {
if (worldObj.getBlock(x+2, y+9, z-1) == block) {
if (worldObj.getBlock(x+1, y+9, z-2) == block) {
if (worldObj.getBlock(x+1, y+9, z+2) == block) {
if (worldObj.getBlock(x, y+9, z+2) == block) {
if (worldObj.getBlock(x, y+9, z-2) == block) {
if (worldObj.getBlock(x-1, y+9, z+2) == block) {
if (worldObj.getBlock(x-1, y+9, z-2) == block) {
if (worldObj.getBlock(x-2, y+9, z) == block) {
if (worldObj.getBlock(x-2, y+9, z+1) == block) {
if (worldObj.getBlock(x-2, y+9, z-1) == block) {
return true;
}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
return false;
}
```

Now I know it is nothing to do with the actual container or gui because the gui was working perfectly fine before I made it check if the structure is properly formed, It opened, I could place items inside, it closed etc wothout a problem

I have the feeling that it is something really obvious that I have missed.

I ask complicated questions, and apparently like to write really long detailed posts. But I also help others when I can.

##### Share on other sites

Also...

Like this:

`TileEntity Tile = parWorld.getTileEntity(parCoordinateX, parCoordinateY, parCoordinateZ);`

This wont let me reference variables in the tileentity class like if the multiblock is formed.

I ask complicated questions, and apparently like to write really long detailed posts. But I also help others when I can.

##### Share on other sites

Allright,

First of all the error log (reading that thing actually helps, who knew)

```Caused by: java.lang.NullPointerException
at net.theepictekkit.generator.common.tileentity.TileEntityDistillationChamberFrame.checkMultiBlockForm(TileEntityDistillationChamberFrame.java:53)```

This line tells you that at line 53 of the file and in the method checkMultiBlockForm a nullpointerexception is occuring. E.g. You're asking an object and a null is returned.

Go to that line and find out why you're not getting what you're asking.

Secondly:

The line I gave you puts the TileEntity in a variable of type TileEntity. It's quite obvious it can't call methods that are only known by its subclass.

A solution is a simple reflection. Replace TileEntity with the class you want to access (granted it inherits the Tileentity class some way or another) and place that same class in round brackets just after the '='. Example:

`TileEntityDistillationChamberFrame Tile = (TileEntityDistillationChamberFrame) parWorld.getTileEntity(parCoordinateX, parCoordinateY, parCoordinateZ);`

Thirdly:

I didn't notice this before but this might possibly be the longest line of closing brackets I have seen that are actually useful, and I have seen quite a bit of code already.

```}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
```

##### Share on other sites

Okay, I did read the error log, and I did go to line 53 in the tileentity, and that was the first if statement:

```if (worldObj.getBlock(x, y, z) == main) {
```

This could not possibly be null because one: this is the main block in the structure that actually stores the data, and it is the actual blockDistillationChamber that has the onBlockActivated method that is causing the error. and two: if it were null, the structure would not be formed, and I know it is formed because when it is, it prints in the console that it is formed. And I have tested this, it only prints that if it is actually formed, it isn't a false reading.

and I also looked at line 58 in BlockDistillationChamber and that was:

```if (!tileEntity.checkMultiBlockForm()) {
```

I did say that I have spent about an hour trying to figure this out, and the first thing I did was read the crash report to see if I could locate the error.

I ask complicated questions, and apparently like to write really long detailed posts. But I also help others when I can.

##### Share on other sites

Nevermind. I got it working.

I changed:

```TileEntityDistillationChamberFrame tileEntity = new TileEntityDistillationChamberFrame();
```

to:

```TileEntityDistillationChamberFrame tileEntity = (TileEntityDistillationChamberFrame)world.getTileEntity(x, y, z);
```

So it was a problem with the way I was getting the tileentity.

I ask complicated questions, and apparently like to write really long detailed posts. But I also help others when I can.

##### Share on other sites

I didn't notice this before but this might possibly be the longest line of closing brackets I have seen that are actually useful, and I have seen quite a bit of code already.

```}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
```

lol.... yeah..... it is a messy bit of code.... but I diddnt want to do the for loop thing because I felt like this was more specific to what blocks needed to be where. The structure is quite a specific shape.... and btw, there is 129 if statements there...

I ask complicated questions, and apparently like to write really long detailed posts. But I also help others when I can.

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

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.

×   Pasted as rich text.   Restore formatting

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

• ### Posts

• Minecraft opened, but when I went to create a new world I got another error. https://pastebin.com/mmdNztmW
• Hi, I have the oficial launcher using the version 1.21, and forge 51.0.13, as soon as I start the installation the games crashes and gives me "exit code: 1", I haven't put any mods yet in the folder. Its the second time that uninstall and install everything and nothing works, checket my graphics and they are updated. https://pastebin.com/STPgEiVs   thanks!
• Ty very much it worked
• no clue what is going on, you guys seem more knowledgeable than I am. So here's my log as well as my mod list. Error Folder On Google Drive

• ### Who's Online (See full list)

×

• #### Activity

×
• Create New...