Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/24/18 in all areas

  1. My last recommendation is to step through the mob spawning code with the debugger built into your IDE.
    1 point
  2. Okay, I normally do not provide people with ready-to-use code because it is my firm belief that people need to learn how to code themselves, not use ready solutions. However this might be a special case because it requires a descent OpenGL knowledge that you might not be willing to learn because you don't really need it in minecraft modding or even usual java programming. It is also quite difficult to understand out of the box if you've never worked with it before. So I will deviate from my usual ideas and provide you with some code that will be commented so you have an understanding of what's going on and can actually learn something from it. // Define the width and the height of the framebuffer, the texture and as a result the final png file. int width = 256; int height = 256; // Get the framebuffer object that was already in use since we have to restore the state when we are done Framebuffer fbo = Minecraft.getMinecraft().getFramebuffer(); // Create a new framebuffer object with the width and the height defined. The last parameter defines whether to use depth or not. Framebuffer framebuffer = new Framebuffer(width, height, true); // Bind the created framebuffer as the active framebuffer. The last parameter also adjusts the viewport to the dimensions of our framebuffer. framebuffer.bindFramebuffer(true); // These are not really needed, however I prefer do draw over black. By default the texture would be white. GlStateManager.clearColor(0, 0, 0, 1); // No need to clear depth/stencil since those are clean as is since nothing has been drawn yet. GlStateManager.clear(GL11.GL_COLOR_BUFFER_BIT); // Draw the actual entity. You might want to play with positions and scaling. GuiInventory.drawEntityOnScreen(200, 200, 100, 0, 0, new EntitySheep(Minecraft.getMinecraft().world)); // Alternatively if the GL matrix isn't as desired: /* GlStateManager.pushMatrix(); // Do matrix manipulations - scaling, translating, rotating. GuiInventory.drawEntityOnScreen(200, 200, 100, 0, 0, new EntitySheep(Minecraft.getMinecraft().world)); GlStateManager.popMatrix(); */ // Allocate a buffer for GL to dump pixels into. IntBuffer pixels = BufferUtils.createIntBuffer(width * height); // Bind the framebuffer's texture. GlStateManager.bindTexture(framebuffer.framebufferTexture); // Dump the pixels onto the IntBuffer. Note that the pixel format is BGRA and the pixel type is 8 bits per color. GlStateManager.glGetTexImage(GL11.GL_TEXTURE_2D, 0, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, pixels); // Allocate the array to hold pixel values. int[] vals = new int[width * height]; // Copy the buffer to the array. pixels.get(vals); // Rearrange pixel values to correct positions so they can be read by the BufferedImage correctly. TextureUtil.processPixelValues(vals, width, height); // Create the BufferedImage object. BufferedImage bufferedimage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); // Copy the pixels from the array onto the BufferedImage. bufferedimage.setRGB(0, 0, width, height, vals, 0, width); // Create a file to store the image within. Here the file will be outputted to the game's base directory with a name of img.png. File f = new File(Minecraft.getMinecraft().mcDataDir, "img.png"); f.createNewFile(); // Finally write the buffered image into the file. ImageIO.write(bufferedimage, "png", f); // Delete the framebuffer from memory. It is no longer needed. framebuffer.deleteFramebuffer(); // If the game had a buffer bound. In most cases it did but who knows what could be the case with mods and such. if (fbo != null) { // Restore the original framebuffer. The parameter set to true also restores the viewport. fbo.bindFramebuffer(true); } else { // If the game didn't have a framebuffer bound we need to restore the default one. It's ID is always 0. GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, 0); // We also need to restore the viewport back in this case. GL11.glViewport(0, 0, Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight); } And here is the resulting image: Note that you must do all this in a thread that is the main render thread!
    1 point
  3. Try removing your BiomeDictionary registries.
    1 point
  4. Do you mean the same way the player is rendered in their inventory screen? Use GuiInventory#drawEntityOnScreen. A render of what? The entity? The GUI? The screen? If it's the screen then you can do the same thing the game does when taking screenshots. Otherwise you would need to create a framebuffer, bind a texture as a render output to that, bind that framebuffer, render your stuff, get the texture from that framebuffer, read that texture into a BufferedImage and save it to a file. You can see how vanilla does the last 3 actions in ScreenShotHelper.createScreenshot, but everything else you would have to do yourself since the game never does anything similar. Feel free to ask for help though.
    1 point
  5. So... you ran the gradlew task and then extracted a fresh MDK into your project folder? That seems incorrect... Also you do not need to run gradle with no tasks. Try doing this: Download and extract MDK into a folder. Open IntelliJ Click File -> Open Navigate to your folder and click OK. Click OK in the popup dialog, making sure that "Create separate module per source set" is selected. Wait for Build: Sync to finish. Mouse over a square icon in the bottom left of IDEA and select Gradle from the dropdown. Open Tasks -> forgegradle. Double-click on setupDecompWorkspace Wait for the process to be done. Optionally run genIntellijRuns. If you don't run this you will need to create the run configurations yourself. Main classes are GradleStart and GradleStartServer. After the tasks are done click Refresh all Gradle projects button(looks like 2 circular arrows in the top right, next to the + and - signs) Now you can start modding. Do not move any files/folders around! This sets up the workspace in the folder where you extracted the MDK.
    1 point
  6. Please post your final code and mark the topic as solved to help people in the future
    1 point
  7. It's probably java 6 as that's really old, but it might be java 7. Definitely not 8.
    1 point
  8. Sorry we don't support 1.2.5 (or any version below 1.9) on this forum anymore due to its age (4+ years old). We simply don't know how to help you anymore. You can go to the Minecraft Forum where I think that they still still support older versions, or update to a modern version of Minecraft (the latest version or the one before it) to receive support on this forum. Your problem might be related to the fact that you need to use Java 8.
    1 point
  9. Entity class to spawn, weight, min spawned, max spawned.
    1 point
  10. @Vert3x I'm sorry but that version isn't supported here because of its age. No one on here is going to remember how to set it up or even mod for it.
    1 point
×
×
  • Create New...

Important Information

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