Jump to content

JdiJack

Members
  • Posts

    30
  • Joined

  • Last visited

Everything posted by JdiJack

  1. How do I make mod B obtain the capability? In the Mod A I just do: IMana mana = player.getCapability(ModCapabilities.MANA, null); if(mana!=null){ int value = mana.getMana(); } The problem is that Mod B does not know the "IMana and ModCapabilities.MANA" classes
  2. So I just need to recreate the same classes on Mod B and it will work?
  3. Hi all, I made two mods that for simplicity we will call Mod A and Mod B. Mod A creates and adds a Capability<IMana> to EntityPlayer and works great. My requirement is to be able to read the capabilities of Mod A from mod B
  4. The player must see for each protected block the rendering of the contour along its sides (see attached picture). Can the payload from server to client be unlimited?
  5. While the payload of packets sent by the server to clients can be great?
  6. I meant "packages", it was a translation error. I need a packet that contains a coordinate list of all the blocks protected by the players. It has worked so far, unfortunately the block list has become too big.
  7. When I try to send my NBTTagCompound with a package to the server, I get the following error: Payload may not be larger than 32767 bytes Can you increase the Payload of the packages?
  8. I've implemented a simple class like this and I can not get it running. I'm desperate are 7 days trying to run WorldSaveData, I'm tired
  9. I do not know. I can not run the code inside them. Even though I call "markDirty ();"
  10. Thank you very much for your help, I appreciate it very much. Conceptually your work is perfect, but my problem is another one. I can not call the "writeToNBT ()" and "readFromNBT ()" methods. I will probably abandon WorldSaveData and implement a system that stores NTBCompaund directly on Disk
  11. I think I'm close to the solution, the problem is that the "readFromNBT" and "writeToNBT" methods are never called, although I call "markDirty ()". Class Code "WorldSavedData": another class code to save a new NTB: code to recover NTB saved:
  12. Thank you, my goal was to understand this. Although I have not yet understood how to pass and assign the result of "getNBTListAree ()" to "writeToNBT (NBTTagCompound nbt)"
  13. As I said before, the areas I want to get must NOT be rectangles, but they can take any shape, so I need to track every block. Please pay attention to this aspect and help me instead of the code I have extended. I have read the documentation https://mcforge.readthedocs.io/en/latest/datastorage/worldsaveddata/ several times. My question is: 1) Is my code correct? 2) how do i save my ntb in worldsavedata class?
  14. I worked a bit and I produced this code: AreeData class (WorldSavedData) methods to write/read NBT I want to save in my WorldSavedData class "AreeData" the result of this method
  15. thank you, I will try to get me to work and keep you up to date on the code that I will produce
  16. No, the areas are determined by the sum of the selected blocks. Areas can also be different from simple rectangles. Exactly, but this should not be a problem for the time being. This is the logic I had imagined myself. The problem though is to understand how to implement the packages that the server must send to the client. Try to explain me better: I currently have a "Area.java" class that stores all the information about a single area: - area name - tenant - taxes - permissions - List <BlockClaim.java> I have two questions: 1) Can I save/load the "Area.java" class in WorldSavedData? 2a) Can I send the "Area.java" class with packages? 2b) Do you want to convert the "Area.java" class to json, and send the json through packets?
  17. I forgot to say, I chose to use a custom GUI to modify the parameters of the various areas (see screenshot below). I start the GUI client side, is it correct?
  18. Hello, my goal is to create a mod that can protect portions of the map, something like the famous "Towny / Faction" plugin. Working daily on Android and websites have always been used to using relational databases. While here on the forge I noticed that many programmers prefer to use the internal system "WorldSavedData". So I ask you that you definitely have more experience with me with the mods. - What is the best approach to implementing my project? - To save the data I use: Database; jSON; Java Sql, WorldSavedData? - How do I handle the Client / Server synchronization problem?
  19. Finally a few days ago, I managed to draw my first line, my thanks go to "Butsi" who had the patience to put me on the right path. Updated topic start, code Solution: public static void drawBoundingBox(Vec3d player_pos, Vec3d posA, Vec3d posB, boolean smooth, float width) { GL11.glPushAttrib(GL11.GL_ENABLE_BIT); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glTranslated(-player_pos.x, -player_pos.y, -player_pos.z); Color c = new Color(255, 0, 0, 150); GL11.glColor4d(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()); GL11.glLineWidth(width); GL11.glDepthMask(false); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferBuilder = tessellator.getBuffer(); bufferBuilder.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION_COLOR); double dx = Math.abs(posA.x - posB.x); double dy = Math.abs(posA.y - posB.y); double dz = Math.abs(posA.z - posB.z); //AB bufferBuilder.pos(posA.x, posA.y, posA.z).color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()).endVertex(); //A bufferBuilder.pos(posA.x, posA.y, posA.z+dz).color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()).endVertex(); //B //BC bufferBuilder.pos(posA.x, posA.y, posA.z+dz).color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()).endVertex(); //B bufferBuilder.pos(posA.x+dx, posA.y, posA.z+dz).color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()).endVertex(); //C //CD bufferBuilder.pos(posA.x+dx, posA.y, posA.z+dz).color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()).endVertex(); //C bufferBuilder.pos(posA.x+dx, posA.y, posA.z).color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()).endVertex(); //D //DA bufferBuilder.pos(posA.x+dx, posA.y, posA.z).color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()).endVertex(); //D bufferBuilder.pos(posA.x, posA.y, posA.z).color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()).endVertex(); //A //EF bufferBuilder.pos(posA.x, posA.y+dy, posA.z).color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()).endVertex(); //E bufferBuilder.pos(posA.x, posA.y+dy, posA.z+dz).color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()).endVertex(); //F //FG bufferBuilder.pos(posA.x, posA.y+dy, posA.z+dz).color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()).endVertex(); //F bufferBuilder.pos(posA.x+dx, posA.y+dy, posA.z+dz).color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()).endVertex(); //G //GH bufferBuilder.pos(posA.x+dx, posA.y+dy, posA.z+dz).color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()).endVertex(); //G bufferBuilder.pos(posA.x+dx, posA.y+dy, posA.z).color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()).endVertex(); //H //HE bufferBuilder.pos(posA.x+dx, posA.y+dy, posA.z).color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()).endVertex(); //H bufferBuilder.pos(posA.x, posA.y+dy, posA.z).color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()).endVertex(); //E //AE bufferBuilder.pos(posA.x, posA.y, posA.z).color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()).endVertex(); //A bufferBuilder.pos(posA.x, posA.y+dy, posA.z).color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()).endVertex(); //E //BF bufferBuilder.pos(posA.x, posA.y, posA.z+dz).color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()).endVertex(); //B bufferBuilder.pos(posA.x, posA.y+dy, posA.z+dz).color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()).endVertex(); //F //CG bufferBuilder.pos(posA.x+dx, posA.y, posA.z+dz).color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()).endVertex(); //C bufferBuilder.pos(posA.x+dx, posA.y+dy, posA.z+dz).color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()).endVertex(); //G //DH bufferBuilder.pos(posA.x+dx, posA.y, posA.z).color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()).endVertex(); //D bufferBuilder.pos(posA.x+dx, posA.y+dy, posA.z).color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()).endVertex(); //H tessellator.draw(); GL11.glDepthMask(true); GL11.glPopAttrib(); }
  20. I followed this example perfectly well, the line is not drawn. My project: https://github.com/JdiJack/TutorialMod/tree/master/src/main/java/it/petitogennaro/tutorial_mod
  21. busti thank you for the time you are devoting to my project, I accept your suggestions, as indicated by you I went to study the mod botania, but can you tell me why my code does not work? I want to draw a simple line and I can not, what's wrong? I am going crazy
  22. I'm desolate but I can not go ahead, please give me the working code, I'm trying to draw in the "RenderWorldLastEvent" event and the lines are never drawn. I have created a new "drawLine5 ()" method in the "DrawHandler" class and it does not work.
×
×
  • Create New...

Important Information

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