Jump to content

Knux14

Members
  • Posts

    51
  • Joined

  • Last visited

Everything posted by Knux14

  1. mmh actually I'm not that done.. I am doing pretty much the same thing, once the player has set it server-side, I send another packet to sync the ExtandedProperties: public IMessage handleClientMessage(final EntityPlayer player, final UpdateClientMessage message, MessageContext ctx) { final Minecraft mc = Minecraft.getMinecraft(); mc.addScheduledTask(new Runnable() { @Override public void run() { System.out.println("Tries to get it"); PlayerProps pp = PlayerProps.get(player); System.out.println("Got it: " + pp.toString()); pp.setName(message.fName, message.lName); pp.setMoney(message.money); } }); return null; } Then I get it at each connect. It works the first time when I set my name, but then as soon as I connect it does nothing. When I take out the task, it kicks me out and the log says that "NullPointerException" on PlayerProps.get I have no clue how to register it since I already do this: @SubscribeEvent public void onEntityConstructing(EntityConstructing evt) { if (evt.entity instanceof EntityPlayer && PlayerProps.get((EntityPlayer)evt.entity) == null) { PlayerProps.register((EntityPlayer)evt.entity); } } NOTE that it does work without problems singleplayer EDIT: Actually, it works some times, and some other it doesn't.. I can't find how to reproduce working / non working. By "Some time" I mean, when I connect, and that it doesn't work, I disconnect and reconnect, untill it works. Tough when I disconnect and reconnect it is not mandatory that it works...
  2. This is working indeed, Thank you I haven't modded for a while those thinks looks kinda new to me..
  3. Hello, So, recently I started my mod, which is designed to be played multiplayer without any other mod. In this mod, the server send a "OpenGui" Message/Packet, and the client need to open a GUI in which he will put a first name and a last name. Then the client need to send back a "SetName" Message/Packet. Right now I implemented this as is: - PlayerLoggedInEvent detect a player connection. After checking that the world !isRemote, I send a OpenGuiMessage(Login) to the player - When the client receive "OpenGuiMessage(Int)" it opens the Gui "Int" with a simple "mc.displayGuiScreen" The problem is that actually, the Gui pops up just before Minecraft load the render, so a few ms after the screen shows, it closes to have currentScreen == null & GuiIngame. It is not even visible, though my PC got laggy during the connection so I had time to see the GuiScreen poping up then closes.. How can I wait the render has been done to open the Gui (Or opening it directly without showing the Game first) Thanks in advance
  4. Yes I know, I already used it, but I don't understand how the packet is supposed to say "THAT entity", how to select MY entity, Because I won't be able to include a whole entity in the packet and I don't think I can have "Update name of Entity at X/Y/Z" Here's my sourcecode: https://github.com/Knux14/Stuffies/tree/master/fr/Knux14/Stuffies
  5. Okai so it's now pretty much working. All I do is add if (!w.isRemote) In the interact of the Entity. Now I need to get the name from the server, Am I forced to use packet ? Is there any other ways?
  6. ow that would explain everything... I'm gonna try something, I'll let you know
  7. Hello everyone, Today I tried to make a boat but I am in front of a problem. Data doesn't works. In the rightclic method I have the username correctly working but if I print the username in the interact method I get "null" Here's my codes: ItemFlycar: https://gist.github.com/Knux14/8887545 EntityFlycar: https://gist.github.com/Knux14/8887547 RenderFlycar: https://gist.github.com/Knux14/8887556 I've tried several different way but nothing is working. Here's what I currently get for ONE right clic: http://screencloud.net/v/52oT I don't understand why the function is triggered twice and why does the first time everything is set to null and not the second... Thanks in advance
  8. Okay I found the bug. I was posting the events in the "updateEntity" and "invalidate" methods of the TileEntity. I moved them in the "onBlockAdded" and "breakBlock" events and now it works fine. Thank you
  9. I've didn't found where to post EnergyNet has a remove tile entity method that you need to use when the block is broken. It seems that it doesn't contain it, here's my IEnergyNet class: https://gist.github.com/anonymous/8189898 I've found this on google which seems to have it but it also seems to be a bit old: http://atomicstrykers-minecraft-mods.googlecode.com/hg-history/853343e5b365415ccfc8583059ca7bf3d87ba538/PowerConverters/common/ic2/api/EnergyNet.java I have an event which is supposed to do the same as EnergyNet.removeTileEntity() => EnergyTileUnloadEvent but it doesn't work. It is said in the comment that it should do the same as the method but the method doesn't exists anymore: * Every energy tile which wants to get disconnected from the IC2 Energy * Network has to either post this event or alternatively call * EnergyNet.removeTileEntity(). Edit2: If I post the event in breakBlock I have this error when I destroy then replace the block 2013-12-31 00:32:40 [Avertissement] [iC2] EnergyNet.removeTileEntity: fr.Knux14.Electools.TileEntity.TileEntityTeleportBlock@24ed3cfa (fr.Knux14.Electools.TileEntity.TileEntityTeleportBlock@24ed3cfa) wasn't found (added), skipping 2013-12-31 00:32:55 [Avertissement] [iC2] EnergyNet.addTileEntity: fr.Knux14.Electools.TileEntity.TileEntityTeleportBlock@69217a9c (fr.Knux14.Electools.TileEntity.TileEntityTeleportBlock@69217a9c) is conflicting with fr.Knux14.Electools.TileEntity.TileEntityTeleportBlock@24ed3cfa using the same position (already added, prev. te not removed, overlapping), aborting
  10. Hello I am making a mod which using the IC2 api bug I got a problem. The tile entity seems not to be removing. Here's my code: https://gist.github.com/anonymous/8188707 I've already tried by using "world.removeBlockTileEntity(x, y, z)" but it's still giving me the same error... When I place the block (Or any IC2 blocks) where I destroyed one of mine, i get this error in the logs: 2013-12-30 22:37:38 [Avertissement] [iC2] EnergyNet.addTileEntity: fr.Knux14.Electools.TileEntity.TileEntityTeleportBlock@85fc923 (fr.Knux14.Electools.TileEntity.TileEntityTeleportBlock@85fc923) is conflicting with fr.Knux14.Electools.TileEntity.TileEntityTeleportBlock@48cdb24 using the same position (already added, prev. te not removed, overlapping), aborting If there is a cable next to this block, even if I break mine, the cable still seems to be connected. Anybody can help me ? Thanks in advance
  11. Okay thanks, i've already tried with IConnectionHandler but it does not seems to work serverside (The connect is only clientside) I'll try it right now
  12. Hello everyone, I'm searching a way to detect when a player is connecting and when is deconnecting. I've looked in the events but the only one i've found is "playerJoinWorldEvent" which is triggered every time a player is changing dimension ... I didn't managed to find a way to get what i want. Did anybody knows how could I do it ? Thanks in advance
  13. Mmh sorry for the doublepost but, I have the world name but I need the Folder... I can't get it by this way and I can't just use the function "makeUsableName" because if the player has renamed the world it won't be the same folder ...
  14. By using a coremod: http://www.minecraftforum.net/topic/1854988-tutorial-162-changing-vanilla-without-editing-base-classes-coremods-and-events-very-advanced/ or http://www.minecraftforge.net/wiki/Using_Access_Transformers or By using reflexion: http://tutorials.jenkov.com/java-reflection/index.html Coremod is the way to do because it's Forge based. But reflexion works too.
  15. Oh yeah, I feel so stupid now >< For those who need the solution: mc.getIntegratedServer().getWorldName(); Thanks man !
  16. Ok so, in this file there's pretty much what I need, but it's not when the player exit the game, it load all the level list, then it sort it and finally it .get() the selected one...
  17. Hello everyone, I'm making a mod to save worlds, but I need to get the world name when the player disconnects. So I have overriden the ingamemenu, here's my button: case 100: par100GuiButton.enabled = false; this.mc.statFileWriter.readStat(StatList.leaveGameStat, 1); this.mc.theWorld.sendQuittingDisconnectingPacket(); String world = mc.theWorld.getWorldInfo().getWorldName(); this.mc.loadWorld((WorldClient)null); System.out.println("World Name: " + world); this.mc.displayGuiScreen(new GuiUpload()); break; The only problem is that the worldname is always equals to "MpServer", but I need the world name to zip the folder ... Thanks in advance
  18. yes it does public static void glRotated(double angle, double x, double y, double z) { ContextCapabilities caps = GLContext.getCapabilities(); long function_pointer = caps.glRotated; BufferChecks.checkFunctionAddress(function_pointer); nglRotated(angle, x, y, z, function_pointer); } I've got something witch will work soon So my jetpack render next to the head of the player. I'll try a glTranslate Ok it works. Now, the last thing I need is to make it visible for the other players in SMP. How am I supposed to do that?
  19. Thanks man, so I can't use GL11.glRotate (Function does not exists) and there is glRotatef. I tried it but i cant get a correct value for the params. The player have two vars which are called rotationYaw and rotationPitch but I dont understand how they really works. I'm trying with these
  20. Ok so the last param was the size, so 0 was .... A bit too small x) Now I need to make it turn with the player
  21. I sent the url to hydro (If you want to try its this: http://forum.ironcraft.fr/topic/8678-all-travailler-avec-mcp-et-netbeans/ )
  22. So now, the prints work but the render dont show either with .Post or .Pre @ForgeSubscribe public void renderPlayer (RenderPlayerEvent.Post evt){ EntityCustomPlayer pl = (EntityCustomPlayer) evt.entityPlayer.getExtendedProperties("JetpackJoycraft Custom Player"); System.out.println("TEST"); //if (pl.gadgets[0].getItem() == Items.jetpack){ //if (pl.gadgets[0].getItemDamage() == 11) // { EntityPlayer p = evt.entityPlayer; EntityPlayer mcPl = Minecraft.getMinecraft().thePlayer; new ModelLaserJetpack().render(p, getDist(p.posX, mcPl.posX), getDist(p.posY, mcPl.posY), getDist(p.posX, mcPl.posY), 0.0F, 0.0F, 0.0F); // } //} } public float getDist(double a, double b){ if (a > b) return (float)(a - b); else if (b > a) return (float)(b - a); else return 0.0F; }
  23. So I wrote this: @ForgeSubscribe public void renderPlayer (RenderPlayerEvent evt){ EntityPlayer p = evt.entityPlayer; new ModelLaserJetpack().render(p, (float)p.posX, (float)p.posY, (float)p.posZ, 0.0F, 0.0F, 0.0F); } But it doesn't work I dont see any render at all It seems that the renderPlayer event does not work because i tried to do a System.out.println("TEST") and nothing show up Here's how the class is registred in the main class: MinecraftForge.EVENT_BUS.register(new EntityEventHandler());
×
×
  • Create New...

Important Information

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