Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Farianit

Members
  • Joined

  • Last visited

  1. Hello. I'm working with SimpleNetworkWrapper and my mod should spawn entity when it receives message. Message receiving works great, but when i'm trying to spawn enitity, it doesn't do it. Here's my Message.java: import cpw.mods.fml.common.network.ByteBufUtils; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; import io.netty.buffer.ByteBuf; import net.minecraft.world.WorldServer; import net.minecraftforge.common.DimensionManager; public class Message implements IMessage{ private String text; public Message() { } public Message(String text) { this.text = text; } @Override public void fromBytes(ByteBuf buf) { text = ByteBufUtils.readUTF8String(buf); } @Override public void toBytes(ByteBuf buf) { ByteBufUtils.writeUTF8String(buf, text); } public static class Handler implements IMessageHandler<Message, IMessage> { @Override public IMessage onMessage(Message message, MessageContext ctx) { String[] action = message.text.split(" "); System.out.println(String.format("Recieved message %s.", message.text)); if (action[0].equals("spawn")) { WorldServer world = null; double x, y, z; for(WorldServer _world : DimensionManager.getWorlds()) { if (_world.getWorldInfo().getWorldName().equals(action[1])) { world = _world; } CrystallEntity crystall = new CrystallEntity(world); x = Double.valueOf(action[2]); y = Double.valueOf(action[3]); z = Double.valueOf(action[4]); crystall.setLocationAndAngles(x, y, z, 0.0F, 0.0F); System.out.println(String.format("Trying to spawn a Crystall at %d %d %d", x, y, z)); world.spawnEntityInWorld(crystall); } } return null; // no response in this case } } }

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.