Jump to content

Minebot1708

Members
  • Posts

    16
  • Joined

  • Last visited

Everything posted by Minebot1708

  1. Hello everybody I wrote a render with a stencil: int bit = MinecraftForgeClient.reserveStencilBit(); int flag = 1 << bit; glDisable(GL_TEXTURE_2D); glEnable(GL_STENCIL_TEST); glStencilFunc(GL_ALWAYS, flag, flag); glStencilOp(GL_ZERO, GL_ZERO, GL_REPLACE); glStencilMask(flag); glColorMask(false, false, false, false); glDepthMask(false); glClearStencil(0); glClear(GL_STENCIL_BUFFER_BIT); // Render pattern by tesselator glEnable(GL_TEXTURE_2D); glStencilFunc(GL_EQUAL, flag, flag); glStencilMask(0); glColorMask(true, true, true, true); glDepthMask(true); // Render other primitives by tesselator glDisable(GL_STENCIL_TEST); MinecraftForgeClient.releaseStencilBit(bit); In the ClientProxy, in preInit I enabled the stencil: if (!Minecraft.getMinecraft().getFramebuffer().isStencilEnabled()) Minecraft.getMinecraft().getFramebuffer().enableStencil(); if I run the game in the development environment, then everything works fine. But if I build a mod to a jar file and install it on a clean minecraft with forge, then everything is rendered as if this stencil is not present (Nothing is cut off for a template). There are no errors in the logs. Does anyone know why the stencil does not work after build? UPD: Oops, I'm in the wrong section created a topic
  2. Here I draw a polygon on the side of another polygon in the event RenderSpecificHandEvent. It must be turned sideways to the player buf.begin(GL11.GL_POLYGON, DefaultVertexFormats.POSITION); buf.pos(0.8D, -0.45D, -1.5D).endVertex(); buf.pos(0.8D, 0.45D, -1.5D).endVertex(); buf.pos(0.8D, 0.45D, -2D).endVertex(); buf.pos(0.8D, -0.45D, -2D).endVertex(); tes.draw(); But for some reason he turned face (red polygons) Why is the polygon not drawn in depth? How to fix it?
  3. In the game, all metadata have the model of a zero metadata In register class - ModItems: public static void registerRenders(){ registerRenderMeta(energyTool, 5); } private static void registerRenderMeta(Item item, int metaCount){ for (int i = 0; i < metaCount; i++) ModelLoader.setCustomModelResourceLocation(item, i, new ModelResourceLocation(item.getRegistryName().toString()+i, "inventory")); } In ClientProxy: @Override public void preInit(FMLPreInitializationEvent event) { ModItems.registerRenders(); ModBlocks.registerRenders(); } In preInit: @EventHandler public void preInit(FMLPreInitializationEvent event) throws Exception { ModItems.init(); ModItems.register(); ModBlocks.init(); ModBlocks.register(); ModCrafts.register(); ModTileEntities.init(); proxy.preInit(event); } RegistryName of item: "ItemEnergyTool" Path to models: And models (Models differ only in texture): Client Log: fml-client-latest.logfml-client-latest.log What could be the problem?
  4. The method is called. If the coordinates are considered relative to the upper left edge of the window, then they are correct
  5. I just tested, so enderGameOverlayEvent.Post is not worth it. But there is no difference, the problem still does not change. I changed the code. Now the HUD does not appear at all @SubscribeEvent public void renderHUD(RenderGameOverlayEvent.Post e){ if (e.getType() == RenderGameOverlayEvent.ElementType.HOTBAR) { GlStateManager.pushMatrix(); int x = (e.getResolution().getScaledWidth() - 109) / 7; int y = (e.getResolution().getScaledHeight() - 290) / 2; GlStateManager.translate(x, y, 0); implantsHUD.draw(mc, font, 0, 100, 0); GlStateManager.popMatrix(); } }
  6. In EventHandler: final Minecraft mc = Minecraft.getMinecraft(); final FontRenderer font = Minecraft.getMinecraft().fontRendererObj; final ImplantsHUD implantsHUD = new ImplantsHUD(); @SubscribeEvent public void renderHUD(RenderGameOverlayEvent e){ GlStateManager.pushMatrix(); int x = (e.getResolution().getScaledWidth() - 109) / 7; int y = (e.getResolution().getScaledHeight() - 290) / 2; GlStateManager.translate(x, y, 0); implantsHUD.draw(mc, font, 0); GlStateManager.popMatrix(); } HUD class: public class ImplantsHUD extends Gui{ public void draw(Minecraft mc, FontRenderer font, int voltage){ GlStateManager.pushMatrix(); GlStateManager.enableAlpha(); GlStateManager.enableBlend(); GlStateManager.alphaFunc(GL_GREATER, 0.05f); GlStateManager.color(1,1,1,0.75f); GlStateManager.blendFunc(GL_DST_COLOR, GL_ONE_MINUS_SRC_COLOR); mc.getTextureManager().bindTexture(new ResourceLocation("meem:textures/gui/implantshud/energybackground.png")); drawModalRectWithCustomSizedTexture(0, 0, 0,0,109,290,109,290); font.drawString("Energy", 30, -20, 1606345); font.drawString(voltage == 0 ? "Not charging" : voltage + " Volt", 10, 300, voltage == 0 ? 13107200 : 51200); GlStateManager.disableBlend(); GlStateManager.popMatrix(); } }
  7. I made my HUD in RenderGameOverlayEvent.Post. All the renders, but when I take a thing in hand, the name of item appears at the bottom of the screen, and at that moment the HUD does not render. How to fix it?
  8. I fixed it. The problem was that I did not call markDirty when changing variables
  9. I will give an example of a bug. I go into the world, in the GUI of the blocks I change the variables. These variables are normally synchronized between the client and the server. If I get out of the world, and then come back, then those changes to the variables that I did will not happen. That is, the readFromNBT method will load those values of the variables that were during the the last login in world, without taking my changes into account. But sometimes all the same readFromNBT loads the correct data when entering the world. In the debugger, I realized that when data is not synchronized during a restart, then when write-out of the world, writeToNBT is not called. When there is no bug, then before the last exit from the world, writeToNBT is called. Null is nowhere to be found. Before the advent of this problem, I made that switch and added two variables to read / write. And I'll add that can not be called writeToNBT only for my TileEntity. When a bug occurs, TileEntity of vanilla does not suffer. At least in the chests things are save
  10. This is key in NBTTagCompound. In any case, I further wrote that NBT generally ceased to work everywhere. Something is wrong with my code
  11. I do not have an isPublic field. IsPublic is used as a key to understand whether ids are null or not. Therefore, everything should work. And I just realized that my NBT has stopped working on all the blocks. There are no exceptions. Because of what it can happen?
  12. The most interesting thing is that only "isPublic" is reset. All other values are perfectly readable when you re-enter the world
  13. There is a switch in the GUI of the block. When switching, a packet is sent to the server with the switch values and the block position. When the server receives the packet, it sets the value in TileEntity by position and synchronizes it with the world.notifyBlockUpdate. NBT is normally written and read from the server and client, I checked using system.out.println in update. But if I re-enter the world, then NBT is considered a different meaning. While trying to understand why this is, I noticed that in the game pause sometimes writeToNBT from TileEntity is not called. When writeToNBT is called when paused, when you re-enter the world, NBT is read out normally. (If something is not clear, then ask me, because my English is at the level of a google translator) GUI (The method of clicking on the switch is onMouseClicked in framePrivate): Packet Class: TileEntity: TileEntity parent:
  14. Thank you. Texture in the inventory was not, because I forgot to put the model also in the models/item
  15. Well, I fixed it. But I have two more questions: 1. My model shows the blocks below. How to fix it? 2. You can see that the object does not have the texture in the inventory. And how to fix it?
  16. I created a json model and block with it. When I run minecraft, appear an exception: I think the model needs to be registered somehow. But exactly how?
×
×
  • Create New...

Important Information

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