Jump to content

lorizz

Members
  • Posts

    80
  • Joined

  • Last visited

Everything posted by lorizz

  1. Hi guys, it's me TheLorizz and I found this version a little harder and confusing than the others. I miss the old keyDown and keyUp methods and the hold KeyHandler from forge, but how do I do similiar things in forge 1.7.2? That's my class: KeyHandler (FMLEvents): How can I do a "keyHold" method like I did in 1.5.2 with keyUp and keyDown methods? Ps: and possibly, can I use "ClientTickEvent" for doing a key's code every tick? Thanks, lorizz =)
  2. Finally, it works! It opens the gui, but it isn't resized as well. I'm fixing this problem right now, if you can help me then do it
  3. I think I need to change everything, because my intention was a new inventory gui (not like the standard one, but like the inventory character of every RPG) here's the screen: I need to delete tileentity, make a NEW container and a NEW gui (I delete the old ones) and then open it with "Minecraft.getMinecraft().displayGuiScreen();" right?
  4. ...Really. A new tile entity. No no no no. You have a tile entity somewhere that is involved. Generally when the player right clicks it is when you open a gui for it. That method is inside a tile entity and has reference to itself. Unfortunately with the code you have supplied I'm not sure you even HAVE a tile entity anywhere. So I don't know why you're trying to reference it at all. I think I figured out, but it crashes with a NPE: private void openCharacterGui(Packet250CustomPayload packet, EntityPlayer player) { DataInputStream inputStream = new DataInputStream( new ByteArrayInputStream(packet.data)); TileEntity tileEntity = player.worldObj.getBlockTileEntity((int)player.posX, (int)player.posY, (int)player.posZ); player.openGui( ExoWorld_Client.instance, GuiRegistry.guiCharacter, player.worldObj, tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord); //<------------------------ Here System.out.println("Gui Aperto!"); } I think because xCoord, yCoord and zCoord are empty
  5. Sorry but I cannot figure out, canyou write me the code? I tried with "TileEntity tileEntity = new TileEntityCharacter()"'s xCoord, yCoord and zCoord or creating the tileentity in the packet handler then calling the coordinates. Can you write me the code?
  6. You are trying to find a TileEntity where the player is located. That is rather unlikely. You need to give the correct TileEntity coordinates to the "openGui" method. I can't figure out how to do that, I tried MatHelper.floor_double(); but doesn't work....
  7. If you can give us the error line it will be more helpful and faster.
  8. I already done with player.worldObj but still not opening the gui, I tried with this method that I hate so much, still nothin'
  9. UPDATE: Now it doesn't open...no crash, no errors, the packet is called (I put a "print" method to check if the method is called and it works) but now it doesn't open...I also modified a bit the gui handler: PacketHandler Method: private void openCharacterGui(Packet250CustomPayload packet, EntityPlayer player) { DataInputStream inputStream = new DataInputStream( new ByteArrayInputStream(packet.data)); player.openGui(ExoWorld_Client.instance, GuiRegistry.guiCharacter, Minecraft.getMinecraft().theWorld, (int) player.posX, (int) player.posY, (int) player.posZ); Log.log("Gui Aperto"); } New GuiHandler: public class ExoGuiHandler implements IGuiHandler { public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { TileEntity entity = world.getBlockTileEntity(x, y, z); if (entity != null) { // detecta si hay una entidad switch (ID) { case GuiRegistry.guiCharacter: if (entity instanceof TileEntityCharacter) { return new ContainerCharacter(player.inventory, (TileEntityCharacter) entity); } } } return null; } public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { TileEntity entity = world.getBlockTileEntity(x, y, z); if (entity != null) { switch (ID) { case GuiRegistry.guiCharacter: if (entity instanceof TileEntityCharacter) { return new GuiCharacter(player.inventory, (TileEntityCharacter) entity); } } } return null; } }
  10. Ah yeah sorry, I didn't notice "modid", and for the randomInt I didn't remove them because I get the packet handler from the tutorial on the wiki and didn't notice them, for the channel name ok, I'll try with OPENGUICHARACTER
  11. Still doesn't work, why? GuiHandler: @Override public void keyDown(EnumSet<TickType> types, KeyBinding kb, boolean tickEnd, boolean isRepeat) { this.isKeyDown = true; EntityPlayer player = (EntityPlayer) this.mc.thePlayer; World world = (World) this.mc.theWorld; int x = (int) player.posX; int y = (int) player.posY; int z = (int) player.posZ; if (kb.keyCode == this.openCharacter.keyCode) { this.phMethods.openGui(player); } } PacketHandler: public class ExoPacketHandler implements IPacketHandler { public static final String OPENGUI = "OPENGUI"; @Override public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player) { if (packet.channel.equals(ExoPacketHandler.OPENGUI)) { this.openCharacterGui(packet, (EntityPlayer) player); } } private void openCharacterGui(Packet250CustomPayload packet, EntityPlayer player) { DataInputStream inputStream = new DataInputStream( new ByteArrayInputStream(packet.data)); player.openGui(ExoWorld_Client.modid, GuiRegistry.guiCharacter, player.worldObj, (int) player.posX, (int) player.posY, (int) player.posZ); } } The method that sends the packet: public void openGui(EntityPlayer entityPlayer) { Random random = new Random(); int randomInt1 = random.nextInt(); int randomInt2 = random.nextInt(); ByteArrayOutputStream bos = new ByteArrayOutputStream(; DataOutputStream outputStream = new DataOutputStream(bos); try { outputStream.writeInt(randomInt1); outputStream.writeInt(randomInt2); } catch (Exception ex) { ex.printStackTrace(); } Packet250CustomPayload packet = new Packet250CustomPayload(); packet.channel = ExoPacketHandler.OPENGUI; packet.data = bos.toByteArray(); packet.length = bos.size(); Side side = FMLCommonHandler.instance().getEffectiveSide(); if (side == Side.SERVER) { // We are on the server side. EntityPlayerMP entityPlayerMP = (EntityPlayerMP) entityPlayer; } else if (side == Side.CLIENT) { // We are on the client side. EntityClientPlayerMP entityClientPlayerMP = (EntityClientPlayerMP) entityPlayer; entityClientPlayerMP.sendQueue.addToSendQueue(packet); } else { // We are on the Bukkit server. } } @NetworkMod(): @NetworkMod(clientSideRequired = true, serverSideRequired = true, channels = { ExoPacketHandler.OPENGUI }, packetHandler = ExoPacketHandler.class)
  12. I need to save the player data, I also use datawatcher but if the launcher everytime find new files for the server or find modified files or missing files it redownload everything, I use SQL system. Thanks guys I think I figured out the configuration file, I'm so blockhead! Anyway I transfered every class of the server mod to the client mod, loading the connection on the server connection, but I still have the problem "A mod tried to open a gui in a server without being a network mod", I also changed the "serverSideRequired" to true, but no fix. Oh god I think it's the customnpcs mod....
  13. It's in the goddamn server! Nobody can access to the server machine and get the EXOWORLD_SERVER.zip file! It's a launcher with multiple hosted server, join in a server and it downloads ONLY the files that are in the client folder of the server.
  14. You didn't realize this is wrong ? If you make a server only mod, it isn't supposed to have a client part at all. Doesn't make sense to me. Your "Server Mod Only" actually works like a Universal mod, and thus you don't need a "Client Mod Only", since you can merge it in the first one. If "put on client mod" means installing it, you can't do that. It isn't possible to download and install a mod without restarting the game. and I know this....Let's see if it works then I need to work with this settings, otherwise there's a problem. I realized now that you guys didn't understand something: THEY CAN STEAL MY DATABASE INFORMATION!(host, username, password, database name), do you understand now?? What the hell are you talking about? And now I write the last things. If I have got a XMPP Chat connection and a MySQL Connection, do I need to load it on the client so EVERY PLAYER can get it from my Roaming folder (".exoworld"), put it in a minecraft.jar of a MCP folder and click the goddamn "DECOMPILE.BAT" for decompiling and deobfuscating my mod then open the SQLConnection and read every information? Think guys before posting, I thought you were good guys and answering without complaining about Server and Client Side Mod Only, now I ask the last question. Can I fix this problem WITHOUT deleting the server mod? How? Simply just write "Yes, you can. You need to do...." or "No, you can't sorry!" I'm not so stupid to load a mod in the client, it's SERVER SIDE ONLY it loads only on the server, NOBODY CAN ACCESS TO IT.
  15. I know this....Let's see if it works then I need to work with this settings, otherwise there's a problem.
  16. What word didn't you understand of "Connect to MySQL database" and "Anti-Steal Mod"?
  17. Make one mod. Not two. I NEED two mods! This is the reason: On Server Starting -> Server Mod Only -> Connect to MySQL database -> load everything -> put on client mod; On Client Starting -> Server Mod Only -> Load everything from Client Mod Only; Client Mod Only Contains: resources, textures; Server Mod Only Contains: SQL table; Now please can someone help me?
  18. I know I know I know.... Just tell me how can I fix this problem and stop.
  19. Hi guys, I'm TheLorizz and today I'm here with a new problem!: A mod tried to open a gui on the server without being a network mod Why? I tried changing instances, redoing every main class (I got a mod for the client and and another for the server for a better security, 'cause I've got a custom launcher). ExoWorld_Client (Client Mod Mainclass): ExoWorld_Server (Server Mod Mainclass): ClientProxy (Called on server mod): ServerProxy (Called on server mod too): GuiHandler: KeyHandler (The class where the method "player.openGui()" has been called):
  20. Ok, I think I made for myself, but I got an ArrayIndexOutsOfExceptions crash on "EntityLiving entity = (EntityLiving) data[1];" package it.exoworld_client.renderer; import it.exoworld_client.ExoWorld_Client; import it.exoworld_client.extender.ItemDaggerExtender; import it.exoworld_client.registry.ItemRegistry; import it.exoworld_client.watcher.PlayerInformation; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.ItemRenderer; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.entity.EntityLiving; import net.minecraft.item.ItemStack; import net.minecraft.util.Icon; import net.minecraftforge.client.IItemRenderer; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; import cpw.mods.fml.client.FMLClientHandler; public class ItemDaggerRenderer implements IItemRenderer { private RenderManager renderManager; private Minecraft mc; public ItemDaggerRenderer() { this.renderManager = RenderManager.instance; this.mc = Minecraft.getMinecraft(); } @Override public boolean handleRenderType(ItemStack item, ItemRenderType type) { return (type == ItemRenderType.INVENTORY || type == ItemRenderType.EQUIPPED || type == ItemRenderType.EQUIPPED_FIRST_PERSON); } @Override public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { return false; } @Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { EntityLiving entity = (EntityLiving) data[1]; //Here, WHY I CRASH! ItemRenderer irInstance = this.mc.entityRenderer.itemRenderer; PlayerInformation props = PlayerInformation.get(Minecraft .getMinecraft().thePlayer); ItemDaggerExtender dagger = (ItemDaggerExtender) item.getItem(); int selectedClass = props.getSelectedClass(); int classConfirm = props.getClassConfirm(); Icon daggerIcon = dagger.getIconIndex(item); Icon daggerWrongClass = ItemRegistry.daggerWrongClass .getIconIndex(item); if (type == ItemRenderType.INVENTORY) { if (classConfirm != 1 && selectedClass != 1) { RenderItem renderItem = new RenderItem(); renderItem.renderIcon(0, 0, daggerWrongClass, 16, 16); } else { RenderItem renderItem = new RenderItem(); renderItem.renderIcon(0, 0, daggerIcon, 16, 16); } } GL11.glPushMatrix(); if (type == ItemRenderType.EQUIPPED) { float f2 = 3F - (1F / 3F); GL11.glRotatef(-20.0F, 0.0F, 0.0F, 1.0F); GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(-60.0F, 0.0F, 0.0F, 1.0F); GL11.glScalef(f2, f2, f2); GL11.glTranslatef(-0.25F, -0.1875F, 0.1875F); // render the item as 'real' bow float f3 = 0.625F; GL11.glTranslatef(0.0F, 0.125F, 0.3125F); GL11.glRotatef(-20.0F, 0.0F, 1.0F, 0.0F); GL11.glScalef(f3, -f3, f3); GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); this.renderItem(entity, item, 0); } else if (type == ItemRenderType.EQUIPPED_FIRST_PERSON) { this.renderItem(entity, item, 0); } GL11.glPopMatrix(); } private void renderItem(EntityLiving par1EntityLiving, ItemStack par2ItemStack, int par3) { Icon icon = par1EntityLiving.getItemIcon(par2ItemStack, par3); if (icon == null) { return; } if (par2ItemStack.getItemSpriteNumber() == 0) { this.mc.renderEngine.bindTexture("/terrain.png"); } else { this.mc.renderEngine.bindTexture("/gui/items.png"); } Tessellator tessellator = Tessellator.instance; float f = icon.getMinU(); float f1 = icon.getMaxU(); float f2 = icon.getMinV(); float f3 = icon.getMaxV(); float f4 = 0.0F; float f5 = 0.3F; GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glTranslatef(-f4, -f5, 0.0F); float f6 = 1.5F; GL11.glScalef(f6, f6, f6); GL11.glRotatef(50.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(335.0F, 0.0F, 0.0F, 1.0F); GL11.glTranslatef(-0.9375F, -0.0625F, 0.0F); ItemRenderer.renderItemIn2D(tessellator, f1, f2, f, f3, icon.getSheetWidth(), icon.getSheetHeight(), 0.0625F); if (par2ItemStack != null && par2ItemStack.hasEffect() && par3 == 0) { GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDisable(GL11.GL_LIGHTING); this.mc.renderEngine.bindTexture("%blur%/misc/glint.png"); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE); float f7 = 0.76F; GL11.glColor4f(0.5F * f7, 0.25F * f7, 0.8F * f7, 1.0F); GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glPushMatrix(); float f8 = 0.125F; GL11.glScalef(f8, f8, f8); float f9 = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F; GL11.glTranslatef(f9, 0.0F, 0.0F); GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F); ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glScalef(f8, f8, f8); f9 = (float) (Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F; GL11.glTranslatef(-f9, 0.0F, 0.0F); GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F); ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDepthFunc(GL11.GL_LEQUAL); } GL11.glDisable(GL12.GL_RESCALE_NORMAL); } } How can I fix that problem?
  21. This is what I wanted to do: 1)Creating an item normally; 2)Changing position and angles of the render in First Person and Third Person. From point 2 I created an IItemRenderer for the angles and position, but when I wrote "case EQUIPPED" or "case EQUIPPED_FIRST_PERSON" the texture's gone...I don't know why, the player has nothing in hand! I can't fix/render this!
  22. I want to render the item texture in EQUIPPED and EQUIPPED_FIRST_PERSON types
  23. I don't use it because I DON'T KNOW how to do that, if you can give me the answer or ATLEAST an example.....
×
×
  • Create New...

Important Information

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