private long i;
@SubscribeEvent
public void onstop(FMLServerStoppedEvent e) {
i=0;
}
@SubscribeEvent
public void onDeath(RenderWorldLastEvent e) {
i++;
if(i==1) {
Minecraft mc = Minecraft.getInstance();
mc.getIntegratedServer().shareToLAN(GameType.ADVENTURE, false, 25565);
ITextComponent itextcomponent = new TranslationTextComponent("本地游戏已在端口"+Minecraft.getInstance().getIntegratedServer().getServerPort()+"上开启 ");
mc.ingameGUI.getChatGUI().printChatMessage(itextcomponent);
}
}
This is the way I currently think of , Since RenderWorldLastEvent is rendering the world all the time, I can only do this. Can you provide other events that are executed only once after entering the map?