Jump to content

Spaceboy Ross

Members
  • Posts

    143
  • Joined

  • Last visited

Everything posted by Spaceboy Ross

  1. I haven't updated the github but I changed the code from displayGuiScreen to setting currentScreen in the PacketHumantype class.
  2. Changing the variable did nothing.
  3. https://github.com/SpaceboyRoss01/MSGundam is the correct link.
  4. Well, I made it easier so people wouldn't have to go looking through github. https://github.com/SpaceboyRoss01/MSGundamMod is the repository.
  5. I've added a GUI to show when the world is created but it only shows for like 2 seconds. Sometimes the GUI doesn't even show at all. I've attached some files that may be the cause. Files: HumantypeGUI.java EHumantypes.java Newtype.java
  6. Ok, I got it to work. I figured it out and now I just need to program the UI.
  7. Ok, I got it to work. Also, I'll fix the performance later, this mod is for a school computer project class.
  8. If I didn't use getIntLE/writeIntLE, then I get an exception and the index value would be set to a negative number. Also buf.getIntLE(this.index) was a typo. Also, I was following the code from https://github.com/McJtyMods/ModTutorials/blob/1.12/src/main/java/mcjty/modtut/network/PacketSendKey.java#L46. The MSRegistry is required for my mod to add the entities that I was trying to spawn from a block. All fields for the PacketMobileSuit are correct. Eclipse doesn't like me and when I tried to use a different method it was giving me errors.
  9. Eclipse wouldn't let me not use a reflection. I've attacked my packet class's source code. PacketMobileSuit.java
  10. It was the only way for me to get it to work also I have it designed that way so I can easily make more mobile suits using the same class. The entity still doesn't spawn. private void handle(PacketMobileSuit message,MessageContext ctx) { EntityPlayerMP playerEntity = ctx.getServerHandler().player; World world = playerEntity.getEntityWorld(); MobileSuit ms = MSRegistry.getMobileSuitFromIndex(message.index); try { MobileSuit.MSMob mob = ms.MOB.getConstructor(World.class).newInstance(world); mob.posX = message.pos.x+1.0; mob.posY = message.pos.y+1.0; mob.posZ = message.pos.z+1.0; world.spawnEntity(mob); } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) { e.printStackTrace(); } }
  11. MobileSuit.MSMob mob = ms.MOB.getConstructor(World.class).newInstance(this.mc.world); That is a special thing internally used in my mod, check the github (https://github.com/SpaceboyRoss01/MSGundamMod) to see what it does.
  12. I'm trying to spawn an entity from a button being clicked in a gui container. The entity appears for a second then despawns. Does anyone know how to fix this? Code: try { MobileSuit.MSMob mob = ms.MOB.getConstructor(World.class).newInstance(this.mc.world); mob.posX = this.mc.player.posX+1.0; mob.posY = this.mc.player.posY+1.0; mob.posZ = this.mc.player.posZ+1.0; if(!this.mc.world.isRemote) this.mc.world.spawnEntity(mob); } catch(InstantiationException e) { e.printStackTrace(); } catch(IllegalAccessException e) { e.printStackTrace(); } catch(IllegalArgumentException e) { e.printStackTrace(); } catch(InvocationTargetException e) { e.printStackTrace(); } catch(NoSuchMethodException e) { e.printStackTrace(); } catch(SecurityException e) { e.printStackTrace(); }
  13. @SubscribeEvent public static void hasConnected(PlayerEvent.PlayerLoggedInEvent event) { INewtypeCapability nt = CapabilityUtils.getCapability(event.player,MAX_NEWTYPE_CAPABILITY,DEFAULT_FACING); if(!nt.hasShownHumantypeMenu()) { event.player.openGui(GundamMod.instance,HumantypeGUI.GUI_ID,event.player.getEntityWorld(),event.player.getPosition().getX(),event.player.getPosition().getY(),event.player.getPosition().getZ()); } } This snippet is the code that should open the ui but it doesn't work. Loggin works so that means the function is being called.
  14. When every player joins the world for the first time.
  15. I'm wanting a GUI to show when the user enters a world for the first time and not when they click "Create New World".
  16. I'm trying to add a menu that shows when you load a world for the first time, how do I do that in 1.12?
×
×
  • Create New...

Important Information

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