Jump to content

Recommended Posts

Posted

I created a block with it's own GUI. What the GUI dose is that creates an explosion based on number you input in the text box. Everything works on singleplayer, but on multiplayer, the server crashes when i click on the button

 

Here's the method

 

protected void actionPerformed(GuiButton button) {

 

World world = null;

WorldServer[] list = MinecraftServer.getServer().worldServers; // in console it says this line crashes

 

for (WorldServer ins : list) {

if (ins.provider.dimensionId == entity.worldObj.provider.dimensionId)

world = ins;

}

if (world == null)

world = list[0];

 

if (button.id == 0) {

 

if (true) {

if (power.getText().isEmpty())

power.setText("");

else if (power.getText().matches("[a-zA-Z]+"))

power.setText("");

else if (power.getText().matches("[0-9]+")) {

this.mc.displayGuiScreen((GuiScreen) null);

world.createExplosion((Entity) null, i, j - 10, k, Integer.parseInt(power.getText().trim()), true);

}

else

power.setText("");

}

 

}

 

}

 

 

_         

___ ___| |__  _ __ 

/ __/ __| '_ \| '_ \

\__ \__ \ | | | | | |

|___/___/_| |_|_| |_|

Posted

How can I do that? I never mess around with packets before, I heard, but don't know what it is.

_         

___ ___| |__  _ __ 

/ __/ __| '_ \| '_ \

\__ \__ \ | | | | | |

|___/___/_| |_|_| |_|

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.