Jump to content

[Solved]Destroying block...


Naiten

Recommended Posts

I have declared proper variables in my tile entity

public int px = 0;
public int py = 0;
public int pz = 0;

And minecraft returns nullpointerexception on world.destroy

	public void onBlockDestroyedByPlayer(World world, int par2, int par3, int par4, int par5)
{
	TileEntityBlockZRail tle = (TileEntityBlockZRail)world.getBlockTileEntity(par2, par3, par4);
	world.destroyBlock((int)tle.px, par3, par4, true);
}

What's wrong with that?

If i helped you, don't forget pressing "Thank You" button. Thanks for your time.

Link to comment
Share on other sites

Either world or tle is null.

First, do an:

if(tle!=null)
{
world.destroyBlock((int)tle.px, par3, par4, true);
}

If it still shrieks about null, then world is null, which probably would mean You're calling onBlockDestroyedByPlayer some weird way.

Okay, now it doesn't crash, but it doesn't work as i want either. The thing is — i'm placing a couple of blocks at once and i want them to be broken once too, so i...

public void onBlockPlacedBy(World world, int i, int j, int k, EntityLiving entityliving, ItemStack par6ItemStack)
{
   int[][] bl = {{0,1,240},{0,2,224},{0,3,208},{0,4,192},{0,5,176},{0,6,160},
   {-1,1,241},{-1,2,225},{-1,3,209},{-1,4,193},{-1,5,177},{-1,6,161},{-1,7,145},{-1,8,129},
   {-2,2,226},{-2,3,210},{-2,4,194},{-2,5,178},{-2,6,162},{-2,7,146},{-2,8,130},{-2,9,114},
   {-3,6,163},{-3,7,147},{-3,8,131},{-3,9,115},{-3,10,99},{-3,11,83},
   {-4,8,132},{-4,9,116},{-4,10,100},{-4,11,84},{-4,12,68},
   {-5,9,117},{-5,10,101},{-5,11,85},{-5,12,69},{-5,13,53}};
   int dir = MathHelper.floor_double((double)((entityliving.rotationYaw * 4F) / 360F) + 0.5D) & 3;
   world.setBlockMetadataWithNotify(i, j, k, dir, 0);
   for (int l = 0; l < bl.length; l++){
      int[] c = rotxybydir(bl[l][0], bl[l][1], dir);
      world.setBlock(i + c[0], j, k + c[1], RoW.Rails.blockID, dir, 0);
      TileEntityBlockZRail tl = (TileEntityBlockZRail) world.getBlockTileEntity(i + c[0], j, k + c[1]);
      tl.mid = bl[l][2];
      tl.px = i;
      tl.pz = j;
      tl.py = k;
   };
}

It places them rather well, but i want to brake them all too...

If i helped you, don't forget pressing "Thank You" button. Thanks for your time.

Link to comment
Share on other sites

You need to make a for loop. Also I would store all positions in a 2D array in all of your TileEntities.

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Link to comment
Share on other sites

You need to make a for loop. Also I would store all positions in a 2D array in all of your TileEntities.

Where exactly?

As i remember, nbttagcompaund doesn't save arrays...

If i helped you, don't forget pressing "Thank You" button. Thanks for your time.

Link to comment
Share on other sites

You need to make a for loop. Also I would store all positions in a 2D array in all of your TileEntities.

Where exactly?

As i remember, nbttagcompaund doesn't save arrays...

 

A for loop on your block break method.

An (integer) array can be saved in the NBT just fine (i think it's called set-/getIntArray()), else you can also use NBTList for storing arrays... look at the TileEntityChest NBT methods on how to use them.

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Link to comment
Share on other sites

Uh. I mean, i don't understand the point i should make loop for...

 

You're trying to destroy multiple blocks, so you need to call the destroyBlock method for each block you're trying to destroy.

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Link to comment
Share on other sites

No i don't. I will destroy main block, it will update nearby blocks, they will check if main block exists, destroy themselves, update nearby and so on. But i'm getting error on world.destroyBlock((int)tle.px, par3, par4, true); line...

If i helped you, don't forget pressing "Thank You" button. Thanks for your time.

Link to comment
Share on other sites

No i don't. I will destroy main block, it will update nearby blocks, they will check if main block exists, destroy themselves, update nearby and so on. But i'm getting error on world.destroyBlock((int)tle.px, par3, par4, true); line...

 

Ah, now I see... what error do you get exactly?

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Link to comment
Share on other sites

 

2013-05-02 22:39:57 [iNFO] [Minecraft-Server] Player364[/127.0.0.1:0] logged in with entity id 7 at (-747.7620571800405, 56.0, -643.1231716829554)
2013-05-02 22:39:59 [iNFO] [sTDERR] net.minecraft.util.ReportedException: Ticking memory connection
2013-05-02 22:39:59 [iNFO] [sTDERR] 	at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:60)
2013-05-02 22:39:59 [iNFO] [sTDERR] 	at net.minecraft.server.integrated.IntegratedServerListenThread.networkTick(IntegratedServerListenThread.java:109)
2013-05-02 22:39:59 [iNFO] [sTDERR] 	at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:674)
2013-05-02 22:39:59 [iNFO] [sTDERR] 	at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:570)
2013-05-02 22:39:59 [iNFO] [sTDERR] 	at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:127)
2013-05-02 22:39:59 [iNFO] [sTDERR] 	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:468)
2013-05-02 22:39:59 [iNFO] [sTDERR] 	at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)
2013-05-02 22:39:59 [iNFO] [sTDERR] Caused by: java.lang.NullPointerException
2013-05-02 22:39:59 [iNFO] [sTDERR] 	at net.railowar.src.BlockZRail.onBlockDestroyedByPlayer(BlockZRail.java:72)
2013-05-02 22:39:59 [iNFO] [sTDERR] 	at net.minecraft.item.ItemInWorldManager.removeBlock(ItemInWorldManager.java:279)
2013-05-02 22:39:59 [iNFO] [sTDERR] 	at net.minecraft.item.ItemInWorldManager.tryHarvestBlock(ItemInWorldManager.java:308)
2013-05-02 22:39:59 [iNFO] [sTDERR] 	at net.minecraft.item.ItemInWorldManager.onBlockClicked(ItemInWorldManager.java:170)
2013-05-02 22:39:59 [iNFO] [sTDERR] 	at net.minecraft.network.NetServerHandler.handleBlockDig(NetServerHandler.java:491)
2013-05-02 22:39:59 [iNFO] [sTDERR] 	at net.minecraft.network.packet.Packet14BlockDig.processPacket(Packet14BlockDig.java:67)
2013-05-02 22:39:59 [iNFO] [sTDERR] 	at net.minecraft.network.MemoryConnection.processReadPackets(MemoryConnection.java:89)
2013-05-02 22:39:59 [iNFO] [sTDERR] 	at net.minecraft.network.NetServerHandler.networkTick(NetServerHandler.java:134)
2013-05-02 22:39:59 [iNFO] [sTDERR] 	at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:53)
2013-05-02 22:39:59 [iNFO] [sTDERR] 	... 6 more
2013-05-02 22:39:59 [sEVERE] [Minecraft-Server] Encountered an unexpected exception ReportedException
net.minecraft.util.ReportedException: Ticking memory connection
at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:60)
at net.minecraft.server.integrated.IntegratedServerListenThread.networkTick(IntegratedServerListenThread.java:109)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:674)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:570)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:127)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:468)
at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)
Caused by: java.lang.NullPointerException
at net.railowar.src.BlockZRail.onBlockDestroyedByPlayer(BlockZRail.java:72)
at net.minecraft.item.ItemInWorldManager.removeBlock(ItemInWorldManager.java:279)
at net.minecraft.item.ItemInWorldManager.tryHarvestBlock(ItemInWorldManager.java:308)
at net.minecraft.item.ItemInWorldManager.onBlockClicked(ItemInWorldManager.java:170)
at net.minecraft.network.NetServerHandler.handleBlockDig(NetServerHandler.java:491)
at net.minecraft.network.packet.Packet14BlockDig.processPacket(Packet14BlockDig.java:67)
at net.minecraft.network.MemoryConnection.processReadPackets(MemoryConnection.java:89)
at net.minecraft.network.NetServerHandler.networkTick(NetServerHandler.java:134)
at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:53)
... 6 more
2013-05-02 22:40:00 [sEVERE] [Minecraft-Server] This crash report has been saved to: E:\Minecraft\mcp744\jars\.\crash-reports\crash-2013-05-02_22.40.00-server.txt
2013-05-02 22:40:00 [iNFO] [Minecraft-Server] Stopping server
2013-05-02 22:40:00 [iNFO] [Minecraft-Server] Saving players
2013-05-02 22:40:00 [iNFO] [Minecraft-Server] Saving worlds
2013-05-02 22:40:00 [iNFO] [Minecraft-Server] Saving chunks for level 'New World'/Overworld
2013-05-02 22:40:00 [iNFO] [Minecraft-Server] Saving chunks for level 'New World'/Nether
2013-05-02 22:40:00 [iNFO] [Minecraft-Server] Saving chunks for level 'New World'/The End
2013-05-02 22:40:00 [iNFO] [ForgeModLoader] Unloading dimension 0
2013-05-02 22:40:00 [iNFO] [ForgeModLoader] Unloading dimension -1
2013-05-02 22:40:00 [iNFO] [ForgeModLoader] Unloading dimension 1
2013-05-02 22:40:00 [sEVERE] [ForgeModLoader] Fatal errors were detected during the transition from SERVER_STARTED to SERVER_STOPPED. Loading cannot continue
2013-05-02 22:40:00 [sEVERE] [ForgeModLoader] 
mcp [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available->Available
FML [Forge Mod Loader] (coremods) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available->Available
Forge [Minecraft Forge] (coremods) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available->Available
RoW [Rails of War] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available->Available
2013-05-02 22:40:00 [sEVERE] [ForgeModLoader] The ForgeModLoader state engine has become corrupted. Probably, a state was missed by and invalid modification to a base classForgeModLoader depends on. This is a critical error and not recoverable. Investigate any modifications to base classes outside ofForgeModLoader, especially Optifine, to see if there are fixes available.
2013-05-02 22:40:00 [iNFO] [sTDERR] Exception in thread "Server thread" java.lang.RuntimeException: The ForgeModLoader state engine is invalid
2013-05-02 22:40:00 [iNFO] [sTDERR] 	at cpw.mods.fml.common.LoadController.transition(LoadController.java:134)
2013-05-02 22:40:00 [iNFO] [sTDERR] 	at cpw.mods.fml.common.Loader.serverStopped(Loader.java:800)
2013-05-02 22:40:00 [iNFO] [sTDERR] 	at cpw.mods.fml.common.FMLCommonHandler.handleServerStopped(FMLCommonHandler.java:468)
2013-05-02 22:40:00 [iNFO] [sTDERR] 	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:530)
2013-05-02 22:40:00 [iNFO] [sTDERR] 	at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)
2013-05-02 22:40:00 [iNFO] [sTDERR] java.lang.NullPointerException
2013-05-02 22:40:00 [iNFO] [sTDERR] 	at net.railowar.src.BlockZRail.onBlockDestroyedByPlayer(BlockZRail.java:72)
2013-05-02 22:40:00 [iNFO] [sTDERR] 	at net.minecraft.client.multiplayer.PlayerControllerMP.onPlayerDestroyBlock(PlayerControllerMP.java:158)
2013-05-02 22:40:00 [iNFO] [sTDERR] 	at net.minecraft.client.multiplayer.PlayerControllerMP.clickBlockCreative(PlayerControllerMP.java:81)
2013-05-02 22:40:00 [iNFO] [sTDERR] 	at net.minecraft.client.multiplayer.PlayerControllerMP.clickBlock(PlayerControllerMP.java:193)
2013-05-02 22:40:00 [iNFO] [sTDERR] 	at net.minecraft.client.Minecraft.clickMouse(Minecraft.java:1305)
2013-05-02 22:40:00 [iNFO] [sTDERR] 	at net.minecraft.client.Minecraft.runTick(Minecraft.java:1791)
2013-05-02 22:40:00 [iNFO] [sTDERR] 	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:831)
2013-05-02 22:40:00 [iNFO] [sTDERR] 	at net.minecraft.client.Minecraft.run(Minecraft.java:756)
2013-05-02 22:40:00 [iNFO] [sTDERR] 	at java.lang.Thread.run(Unknown Source)
2013-05-02 22:40:10 [iNFO] [Minecraft-Client] Stopping!
2013-05-02 22:40:10 [iNFO] [sTDOUT] 
2013-05-02 22:40:10 [iNFO] [sTDOUT] SoundSystem shutting down...
2013-05-02 22:40:10 [iNFO] [sTDOUT]     Author: Paul Lamb, www.paulscode.com
2013-05-02 22:40:10 [iNFO] [sTDOUT] 

 

This comes when i try to get tl.px...

If i helped you, don't forget pressing "Thank You" button. Thanks for your time.

Link to comment
Share on other sites

 

2013-05-02 22:39:57 [iNFO] [Minecraft-Server] Player364[/127.0.0.1:0] logged in with entity id 7 at (-747.7620571800405, 56.0, -643.1231716829554)
2013-05-02 22:39:59 [iNFO] [sTDERR] net.minecraft.util.ReportedException: Ticking memory connection
2013-05-02 22:39:59 [iNFO] [sTDERR] 	at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:60)
2013-05-02 22:39:59 [iNFO] [sTDERR] 	at net.minecraft.server.integrated.IntegratedServerListenThread.networkTick(IntegratedServerListenThread.java:109)
2013-05-02 22:39:59 [iNFO] [sTDERR] 	at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:674)
2013-05-02 22:39:59 [iNFO] [sTDERR] 	at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:570)
2013-05-02 22:39:59 [iNFO] [sTDERR] 	at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:127)
2013-05-02 22:39:59 [iNFO] [sTDERR] 	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:468)
2013-05-02 22:39:59 [iNFO] [sTDERR] 	at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)
2013-05-02 22:39:59 [iNFO] [sTDERR] Caused by: java.lang.NullPointerException
2013-05-02 22:39:59 [iNFO] [sTDERR] 	at net.railowar.src.BlockZRail.onBlockDestroyedByPlayer(BlockZRail.java:72)
2013-05-02 22:39:59 [iNFO] [sTDERR] 	at net.minecraft.item.ItemInWorldManager.removeBlock(ItemInWorldManager.java:279)
2013-05-02 22:39:59 [iNFO] [sTDERR] 	at net.minecraft.item.ItemInWorldManager.tryHarvestBlock(ItemInWorldManager.java:308)
2013-05-02 22:39:59 [iNFO] [sTDERR] 	at net.minecraft.item.ItemInWorldManager.onBlockClicked(ItemInWorldManager.java:170)
2013-05-02 22:39:59 [iNFO] [sTDERR] 	at net.minecraft.network.NetServerHandler.handleBlockDig(NetServerHandler.java:491)
2013-05-02 22:39:59 [iNFO] [sTDERR] 	at net.minecraft.network.packet.Packet14BlockDig.processPacket(Packet14BlockDig.java:67)
2013-05-02 22:39:59 [iNFO] [sTDERR] 	at net.minecraft.network.MemoryConnection.processReadPackets(MemoryConnection.java:89)
2013-05-02 22:39:59 [iNFO] [sTDERR] 	at net.minecraft.network.NetServerHandler.networkTick(NetServerHandler.java:134)
2013-05-02 22:39:59 [iNFO] [sTDERR] 	at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:53)
2013-05-02 22:39:59 [iNFO] [sTDERR] 	... 6 more
2013-05-02 22:39:59 [sEVERE] [Minecraft-Server] Encountered an unexpected exception ReportedException
net.minecraft.util.ReportedException: Ticking memory connection
at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:60)
at net.minecraft.server.integrated.IntegratedServerListenThread.networkTick(IntegratedServerListenThread.java:109)
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:674)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:570)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:127)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:468)
at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)
Caused by: java.lang.NullPointerException
at net.railowar.src.BlockZRail.onBlockDestroyedByPlayer(BlockZRail.java:72)
at net.minecraft.item.ItemInWorldManager.removeBlock(ItemInWorldManager.java:279)
at net.minecraft.item.ItemInWorldManager.tryHarvestBlock(ItemInWorldManager.java:308)
at net.minecraft.item.ItemInWorldManager.onBlockClicked(ItemInWorldManager.java:170)
at net.minecraft.network.NetServerHandler.handleBlockDig(NetServerHandler.java:491)
at net.minecraft.network.packet.Packet14BlockDig.processPacket(Packet14BlockDig.java:67)
at net.minecraft.network.MemoryConnection.processReadPackets(MemoryConnection.java:89)
at net.minecraft.network.NetServerHandler.networkTick(NetServerHandler.java:134)
at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:53)
... 6 more
2013-05-02 22:40:00 [sEVERE] [Minecraft-Server] This crash report has been saved to: E:\Minecraft\mcp744\jars\.\crash-reports\crash-2013-05-02_22.40.00-server.txt
2013-05-02 22:40:00 [iNFO] [Minecraft-Server] Stopping server
2013-05-02 22:40:00 [iNFO] [Minecraft-Server] Saving players
2013-05-02 22:40:00 [iNFO] [Minecraft-Server] Saving worlds
2013-05-02 22:40:00 [iNFO] [Minecraft-Server] Saving chunks for level 'New World'/Overworld
2013-05-02 22:40:00 [iNFO] [Minecraft-Server] Saving chunks for level 'New World'/Nether
2013-05-02 22:40:00 [iNFO] [Minecraft-Server] Saving chunks for level 'New World'/The End
2013-05-02 22:40:00 [iNFO] [ForgeModLoader] Unloading dimension 0
2013-05-02 22:40:00 [iNFO] [ForgeModLoader] Unloading dimension -1
2013-05-02 22:40:00 [iNFO] [ForgeModLoader] Unloading dimension 1
2013-05-02 22:40:00 [sEVERE] [ForgeModLoader] Fatal errors were detected during the transition from SERVER_STARTED to SERVER_STOPPED. Loading cannot continue
2013-05-02 22:40:00 [sEVERE] [ForgeModLoader] 
mcp [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available->Available
FML [Forge Mod Loader] (coremods) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available->Available
Forge [Minecraft Forge] (coremods) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available->Available
RoW [Rails of War] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available->Available
2013-05-02 22:40:00 [sEVERE] [ForgeModLoader] The ForgeModLoader state engine has become corrupted. Probably, a state was missed by and invalid modification to a base classForgeModLoader depends on. This is a critical error and not recoverable. Investigate any modifications to base classes outside ofForgeModLoader, especially Optifine, to see if there are fixes available.
2013-05-02 22:40:00 [iNFO] [sTDERR] Exception in thread "Server thread" java.lang.RuntimeException: The ForgeModLoader state engine is invalid
2013-05-02 22:40:00 [iNFO] [sTDERR] 	at cpw.mods.fml.common.LoadController.transition(LoadController.java:134)
2013-05-02 22:40:00 [iNFO] [sTDERR] 	at cpw.mods.fml.common.Loader.serverStopped(Loader.java:800)
2013-05-02 22:40:00 [iNFO] [sTDERR] 	at cpw.mods.fml.common.FMLCommonHandler.handleServerStopped(FMLCommonHandler.java:468)
2013-05-02 22:40:00 [iNFO] [sTDERR] 	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:530)
2013-05-02 22:40:00 [iNFO] [sTDERR] 	at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)
2013-05-02 22:40:00 [iNFO] [sTDERR] java.lang.NullPointerException
2013-05-02 22:40:00 [iNFO] [sTDERR] 	at net.railowar.src.BlockZRail.onBlockDestroyedByPlayer(BlockZRail.java:72)
2013-05-02 22:40:00 [iNFO] [sTDERR] 	at net.minecraft.client.multiplayer.PlayerControllerMP.onPlayerDestroyBlock(PlayerControllerMP.java:158)
2013-05-02 22:40:00 [iNFO] [sTDERR] 	at net.minecraft.client.multiplayer.PlayerControllerMP.clickBlockCreative(PlayerControllerMP.java:81)
2013-05-02 22:40:00 [iNFO] [sTDERR] 	at net.minecraft.client.multiplayer.PlayerControllerMP.clickBlock(PlayerControllerMP.java:193)
2013-05-02 22:40:00 [iNFO] [sTDERR] 	at net.minecraft.client.Minecraft.clickMouse(Minecraft.java:1305)
2013-05-02 22:40:00 [iNFO] [sTDERR] 	at net.minecraft.client.Minecraft.runTick(Minecraft.java:1791)
2013-05-02 22:40:00 [iNFO] [sTDERR] 	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:831)
2013-05-02 22:40:00 [iNFO] [sTDERR] 	at net.minecraft.client.Minecraft.run(Minecraft.java:756)
2013-05-02 22:40:00 [iNFO] [sTDERR] 	at java.lang.Thread.run(Unknown Source)
2013-05-02 22:40:10 [iNFO] [Minecraft-Client] Stopping!
2013-05-02 22:40:10 [iNFO] [sTDOUT] 
2013-05-02 22:40:10 [iNFO] [sTDOUT] SoundSystem shutting down...
2013-05-02 22:40:10 [iNFO] [sTDOUT]     Author: Paul Lamb, www.paulscode.com
2013-05-02 22:40:10 [iNFO] [sTDOUT] 

 

This comes when i try to get tl.px...

 

Seems like your TileEntity is null. Mostly it's caused because the block doesn't set one. Can I see the whole block code of yours? Use pastebin.

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Link to comment
Share on other sites

http://pastebin.com/aBhB7ikB

---

Yeah, when i try

public void onBlockDestroyedByPlayer(World world, int i, int j, int k, int par5)
{
   TileEntityBlockZRail tl = (TileEntityBlockZRail) world.getBlockTileEntity(i, j, k);
   System.out.println(tl);
}

It return null, and for some reason it does that four times. And game does not crash. However, i have tileentityrender class and it reads that data fine without any obvious reason... I think it's something with coordinates...

If i helped you, don't forget pressing "Thank You" button. Thanks for your time.

Link to comment
Share on other sites

Hell yeah. That code saved me.

public void breakBlock(World world, int i, int j, int k, int par5, int par6)
{
TileEntityBlockZRail tl = (TileEntityBlockZRail) world.getBlockTileEntity(i, j, k);
if (tl != null)
{
  world.destroyBlock(tl.px, j, tl.py, false);
}
}

public void onNeighborBlockChange(World world, int i, int j, int k, int par5)
{
TileEntityBlockZRail tl = (TileEntityBlockZRail) world.getBlockTileEntity(i, j, k);
if (tl != null)
{
  if(world.getBlockId(tl.px, j, tl.py) != RoW.Rails.blockID)
  {
   world.destroyBlock(i, j, k, false);
  }
}
}

Now, the only thing i need is my locomotive physics...

If i helped you, don't forget pressing "Thank You" button. Thanks for your time.

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.