Jump to content

[1.7.10]can't run the method MinecraftServer.getServer() in Multiplayer Server


abcd778811

Recommended Posts

hi guys!help me!!! :'(

I want to find the Player coordinate of the world,so I wrote the code like that:

public class GuiTeleportTicket extends GuiContainer 
{        ....
        protected void actionPerformed(GuiButton guibutton)
         {        
                //the code can running in single but not in online server
                EntityPlayer goToPlayer=MinecraftServer.getServer()
	  .getEntityWorld().getPlayerEntityByName(this.text.getText().toString());

                Minecraft.getMinecraft().thePlayer.sendChatMessage(
                 this.text.getText().toString()+" coordinate at:"+goToPlayer.posX+","+goToPlayer.posY+","+goToPlayer.posZ);

        }
        ....
}

 

my project link:https://www.dropbox.com/s/tuutsc1ol0bqeae/Modding2.zip?dl=0

 

this is crash info:

---- Minecraft Crash Report ----
// There are four lights!

Time: 15-2-20 上午11:28
Description: Updating screen events

java.lang.ArrayIndexOutOfBoundsException: 0
at net.minecraft.server.MinecraftServer.func_130014_f_(MinecraftServer.java:1166)
at tw.iscraft.mod1forrealmanserver.container.GuiTeleportTicket.func_146284_a(GuiTeleportTicket.java:96)
at net.minecraft.client.gui.GuiScreen.func_73864_a(GuiScreen.java:225)
at net.minecraft.client.gui.inventory.GuiContainer.func_73864_a(GuiContainer.java:326)
at tw.iscraft.mod1forrealmanserver.container.GuiTeleportTicket.func_73864_a(GuiTeleportTicket.java:83)
at net.minecraft.client.gui.GuiScreen.func_146274_d(GuiScreen.java:296)
at net.minecraft.client.gui.GuiScreen.func_146269_k(GuiScreen.java:268)
at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:1629)
at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:962)
at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:887)
at net.minecraft.client.main.Main.main(SourceFile:148)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)


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

-- Head --
Stacktrace:
at net.minecraft.server.MinecraftServer.func_130014_f_(MinecraftServer.java:1166)
at tw.iscraft.mod1forrealmanserver.container.GuiTeleportTicket.func_146284_a(GuiTeleportTicket.java:96)
at net.minecraft.client.gui.GuiScreen.func_73864_a(GuiScreen.java:225)
at net.minecraft.client.gui.inventory.GuiContainer.func_73864_a(GuiContainer.java:326)
at tw.iscraft.mod1forrealmanserver.container.GuiTeleportTicket.func_73864_a(GuiTeleportTicket.java:83)
at net.minecraft.client.gui.GuiScreen.func_146274_d(GuiScreen.java:296)
at net.minecraft.client.gui.GuiScreen.func_146269_k(GuiScreen.java:268)

-- Affected screen --
Details:
Screen name: tw.iscraft.mod1forrealmanserver.container.GuiTeleportTicket

-- Affected level --
Details:
Level name: MpServer
All players: 1 total; [EntityClientPlayerMP['is100602'/161, l='MpServer', x=-113.99, y=66.62, z=-188.48]]
Chunk stats: MultiplayerChunkCache: 420, 420
Level seed: 0
Level generator: ID 00 - default, ver 1. Features enabled: false
Level generator options: 
Level spawn location: World: (0,64,0), Chunk: (at 0,4,0 in 0,0; contains blocks 0,0,0 to 15,255,15), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
Level time: 108824 game time, 96801 day time
Level dimension: 0
Level storage version: 0x00000 - Unknown?
Level weather: Rain time: 0 (now: true), thunder time: 0 (now: false)
Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false
Forced entities: 98 total; [EntityChicken['雞'/0, l='MpServer', x=-181.59, y=66.00, z=-180.38], EntitySpider['蜘蛛'/1, l='MpServer', x=-187.63, y=66.00, z=-189.41], EntityChicken['雞'/2, l='MpServer', x=-182.53, y=72.00, z=-176.41], EntityEnderman['終界使者'/261, l='MpServer', x=-173.50, y=36.00, z=-258.50], EntitySkeleton['骷髏'/262, l='MpServer', x=-130.50, y=36.00, z=-212.50], EntitySkeleton['骷髏'/263, l='MpServer', x=-129.94, y=36.00, z=-223.47], EntitySquid['烏賊'/7, l='MpServer', x=-174.50, y=55.13, z=-147.69], EntityZombie['殭屍'/264, l='MpServer', x=-133.50, y=38.00, z=-214.50], EntityPig['豬'/265, l='MpServer', x=-142.53, y=65.00, z=-214.56], EntityItem['item.item.arrow'/266, l='MpServer', x=-142.75, y=65.13, z=-215.44], EntityCreeper['苦力怕'/10, l='MpServer', x=-169.41, y=25.00, z=-176.94], EntityItem['item.item.bone'/267, l='MpServer', x=-142.38, y=65.13, z=-215.16], EntityChicken['雞'/11, l='MpServer', x=-171.56, y=64.00, z=-181.38], EntitySpider['蜘蛛'/268, l='MpServer', x=-133.81, y=64.00, z=-218.84], EntityChicken['雞'/12, l='MpServer', x=-171.59, y=64.00, z=-177.53], EntityCreeper['苦力怕'/269, l='MpServer', x=-135.34, y=64.00, z=-219.09], EntityCreeper['苦力怕'/13, l='MpServer', x=-170.44, y=26.00, z=-175.91], EntityPig['豬'/270, l='MpServer', x=-135.78, y=64.00, z=-215.91], EntitySquid['烏賊'/14, l='MpServer', x=-166.16, y=61.38, z=-157.63], EntityCreeper['苦力怕'/271, l='MpServer', x=-100.94, y=30.00, z=-264.34], EntityZombie['殭屍'/15, l='MpServer', x=-163.25, y=21.00, z=-109.44], EntitySkeleton['骷髏'/272, l='MpServer', x=-107.56, y=40.00, z=-260.03], EntitySkeleton['骷髏'/273, l='MpServer', x=-114.13, y=36.00, z=-267.50], EntityItem['item.item.beefRaw'/274, l='MpServer', x=-94.69, y=65.13, z=-222.47], EntityCreeper['苦力怕'/275, l='MpServer', x=-87.09, y=25.00, z=-236.78], EntityItem['item.item.arrow'/276, l='MpServer', x=-95.66, y=65.13, z=-239.50], EntityCow['乳牛'/20, l='MpServer', x=-137.44, y=65.00, z=-183.50], EntityCow['乳牛'/277, l='MpServer', x=-78.31, y=64.00, z=-204.53], EntityCow['乳牛'/21, l='MpServer', x=-135.13, y=63.00, z=-160.97], EntityCreeper['苦力怕'/278, l='MpServer', x=-97.41, y=15.00, z=-192.00], EntityCow['乳牛'/22, l='MpServer', x=-134.50, y=63.92, z=-165.50], EntitySkeleton['骷髏'/279, l='MpServer', x=-92.44, y=15.00, z=-194.94], EntityItem['item.tile.cactus'/23, l='MpServer', x=-112.28, y=65.13, z=-187.44], EntityCow['乳牛'/24, l='MpServer', x=-127.41, y=69.00, z=-169.25], EntityBat['蝙蝠'/281, l='MpServer', x=-86.13, y=17.44, z=-250.03], EntityItem['item.item.bone'/282, l='MpServer', x=-80.87, y=73.13, z=-244.88], EntityItem['item.item.arrow'/283, l='MpServer', x=-80.53, y=73.13, z=-244.44], EntityCow['乳牛'/30, l='MpServer', x=-125.84, y=63.00, z=-111.16], EntityCreeper['苦力怕'/287, l='MpServer', x=-66.50, y=18.00, z=-252.50], EntitySkeleton['骷髏'/35, l='MpServer', x=-102.44, y=15.00, z=-189.94], EntityCow['乳牛'/36, l='MpServer', x=-101.97, y=66.00, z=-184.03], EntityCow['乳牛'/37, l='MpServer', x=-96.31, y=72.00, z=-134.47], EntityBat['蝙蝠'/38, l='MpServer', x=-90.91, y=57.10, z=-186.44], EntityCreeper['苦力怕'/39, l='MpServer', x=-91.00, y=57.00, z=-184.44], EntityCow['乳牛'/40, l='MpServer', x=-85.22, y=66.00, z=-165.47], EntityCow['乳牛'/41, l='MpServer', x=-84.03, y=65.00, z=-165.50], EntityCow['乳牛'/42, l='MpServer', x=-88.25, y=71.00, z=-157.22], EntityCow['乳牛'/43, l='MpServer', x=-91.66, y=76.00, z=-119.28], EntityCow['乳牛'/44, l='MpServer', x=-88.03, y=76.00, z=-117.03], EntityCow['乳牛'/45, l='MpServer', x=-96.81, y=65.00, z=-119.44], EntityCow['乳牛'/52, l='MpServer', x=-78.78, y=64.00, z=-195.63], EntityCow['乳牛'/53, l='MpServer', x=-68.81, y=63.00, z=-118.81], EntityCow['乳牛'/54, l='MpServer', x=-74.47, y=67.00, z=-122.63], EntityCow['乳牛'/55, l='MpServer', x=-74.78, y=63.00, z=-116.31], EntityCow['乳牛'/56, l='MpServer', x=-66.03, y=66.00, z=-124.09], EntityCreeper['苦力怕'/67, l='MpServer', x=-49.91, y=43.00, z=-136.28], EntityCow['乳牛'/68, l='MpServer', x=-61.72, y=63.00, z=-117.28], EntityCow['乳牛'/69, l='MpServer', x=-49.50, y=72.00, z=-114.50], EntityCow['乳牛'/71, l='MpServer', x=-58.97, y=64.00, z=-111.88], EntitySpider['蜘蛛'/78, l='MpServer', x=-45.88, y=36.00, z=-112.50], EntityClientPlayerMP['is100602'/161, l='MpServer', x=-113.99, y=66.62, z=-188.48], EntityPig['豬'/162, l='MpServer', x=-155.06, y=67.00, z=-204.91], EntityPig['豬'/163, l='MpServer', x=-147.59, y=67.00, z=-206.81], EntityBat['蝙蝠'/165, l='MpServer', x=-78.59, y=27.73, z=-256.31], EntityCreeper['苦力怕'/166, l='MpServer', x=-90.66, y=34.00, z=-265.50], EntityBat['蝙蝠'/167, l='MpServer', x=-81.25, y=37.10, z=-262.25], EntityCreeper['苦力怕'/168, l='MpServer', x=-160.50, y=21.00, z=-229.50], EntitySkeleton['骷髏'/169, l='MpServer', x=-96.69, y=15.00, z=-194.69], EntitySkeleton['骷髏'/170, l='MpServer', x=-98.69, y=15.00, z=-193.44], EntityBat['蝙蝠'/171, l='MpServer', x=-121.25, y=37.10, z=-205.47], EntityZombie['殭屍'/172, l='MpServer', x=-116.50, y=37.00, z=-203.97], EntityItem['item.item.rottenFlesh'/173, l='MpServer', x=-107.31, y=64.13, z=-212.13], EntityItem['item.item.leather'/174, l='MpServer', x=-109.44, y=65.13, z=-210.53], EntityItem['item.item.beefRaw'/175, l='MpServer', x=-109.09, y=65.13, z=-210.94], EntityZombie['殭屍'/176, l='MpServer', x=-118.44, y=36.00, z=-213.00], EntityCreeper['苦力怕'/177, l='MpServer', x=-127.69, y=36.00, z=-219.28], EntityCreeper['苦力怕'/178, l='MpServer', x=-126.28, y=36.00, z=-211.59], EntitySkeleton['骷髏'/179, l='MpServer', x=-154.50, y=24.00, z=-234.50], EntityZombie['殭屍'/180, l='MpServer', x=-145.06, y=36.00, z=-234.56], EntityCreeper['苦力怕'/200, l='MpServer', x=-164.50, y=25.00, z=-207.50], EntityBat['蝙蝠'/201, l='MpServer', x=-132.25, y=37.10, z=-230.75], EntityBat['蝙蝠'/202, l='MpServer', x=-120.88, y=34.00, z=-235.28], EntityItem['item.item.rottenFlesh'/203, l='MpServer', x=-130.34, y=70.13, z=-233.13], EntitySkeleton['骷髏'/210, l='MpServer', x=-124.88, y=33.00, z=-232.72], EntityZombie['殭屍'/214, l='MpServer', x=-155.78, y=39.00, z=-252.69], EntityZombie['殭屍'/215, l='MpServer', x=-112.88, y=25.00, z=-263.78], EntityBat['蝙蝠'/216, l='MpServer', x=-116.31, y=24.86, z=-261.44], EntityPig['豬'/218, l='MpServer', x=-189.16, y=69.00, z=-259.66], EntityBat['蝙蝠'/220, l='MpServer', x=-124.63, y=39.10, z=-240.53], EntityCreeper['苦力怕'/221, l='MpServer', x=-129.00, y=38.00, z=-250.44], EntityCreeper['苦力怕'/222, l='MpServer', x=-122.50, y=32.00, z=-246.50], EntitySkeleton['骷髏'/223, l='MpServer', x=-121.50, y=32.00, z=-241.50], EntityZombie['殭屍'/224, l='MpServer', x=-186.13, y=33.00, z=-249.28], EntityPig['豬'/225, l='MpServer', x=-181.31, y=70.00, z=-243.53], EntityPig['豬'/226, l='MpServer', x=-182.81, y=69.00, z=-245.94], EntitySpider['蜘蛛'/239, l='MpServer', x=-152.38, y=36.00, z=-263.94], EntitySkeleton['骷髏'/240, l='MpServer', x=-157.50, y=47.00, z=-268.50], EntityBat['蝙蝠'/241, l='MpServer', x=-126.16, y=32.45, z=-263.63]]
Retry entities: 0 total; []
Server brand: fml,forge
Server type: Non-integrated multiplayer server
Stacktrace:
at net.minecraft.client.multiplayer.WorldClient.func_72914_a(WorldClient.java:373)
at net.minecraft.client.Minecraft.func_71396_d(Minecraft.java:2433)
at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:908)
at net.minecraft.client.main.Main.main(SourceFile:148)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

-- System Details --
Details:
Minecraft Version: 1.7.10
Operating System: Windows 7 (amd64) version 6.1
Java Version: 1.8.0_25, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 85858912 bytes (81 MB) / 343695360 bytes (327 MB) up to 1060372480 bytes (1011 MB)
JVM Flags: 6 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xmx1G -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:-UseAdaptiveSizePolicy -Xmn128M
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
IntCache: cache: 0, tcache: 0, allocated: 13, tallocated: 95
FML: MCP v9.05 FML v7.10.85.1236 Minecraft Forge 10.13.2.1236 4 mods loaded, 4 mods active
mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available->Available->Available
FML{7.10.85.1236} [Forge Mod Loader] (forge-1.7.10-10.13.2.1236.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available->Available->Available
Forge{10.13.2.1236} [Minecraft Forge] (forge-1.7.10-10.13.2.1236.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available->Available->Available
mod1forrealmanserver{v0.1} [Mod1 For Realman Server] (Mod1 For Realman Server-v0.1.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available->Available->Available
Launched Version: 1.7.10-Forge10.13.2.1236
LWJGL: 2.9.1
OpenGL: GeForce GTX 650/PCIe/SSE2 GL version 4.4.0, NVIDIA Corporation
GL Caps: Using GL 1.3 multitexturing.
Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
Anisotropic filtering is supported and maximum anisotropy is 16.
Shaders are available because OpenGL 2.1 is supported.

Is Modded: Definitely; Client brand changed to 'fml,forge'
Type: Client (map_client.txt)
Resource Packs: []
Current Language: 繁體中文 (台灣)
Profiler Position: N/A (disabled)
Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Anisotropic Filtering: Off (1)

Link to comment
Share on other sites

public class GuiTeleportTicket extends GuiContainer 
{        ....
        protected void actionPerformed(GuiButton guibutton)
         {        
                //the code can running in single but not in online server
                EntityPlayer goToPlayer=MinecraftServer.getServer()

 

No shit, Sherlock.  The GuiButton is client side only code.  Accessing the server object doesn't magically create a connection between your computer (client) and another (the server).  "Running on the same machine" isn't an excuse, because they're separate executables.

 

You need packets.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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.



×
×
  • Create New...

Important Information

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