Jump to content

baku

Members
  • Posts

    10
  • Joined

  • Last visited

Converted

  • Gender
    Male
  • Location
    Catalonia

baku's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. I reply to myself. I finally got it: @SubscribeEvent public static void onRenderLastEvent(RenderLevelLastEvent event) { Minecraft mc = Minecraft.getInstance(); LocalPlayer player = mc.player; Camera cam = mc.gameRenderer.getMainCamera(); LevelRenderer renderer = event.getLevelRenderer(); PoseStack pose = event.getPoseStack(); MultiBufferSource.BufferSource buffer = mc.renderBuffers().bufferSource(); VertexConsumer vc = buffer.getBuffer(RenderType.lines()); Vec3 vec = player.getEyePosition(event.getPartialTick()); double px = vec.x; double py = vec.y; double pz = vec.z; Vec3 camvec = cam.getPosition(); double d0 = camvec.x; double d1 = camvec.y; double d2 = camvec.z; pose.translate(px-d0, py-d1, pz-d2); LevelRenderer.renderLineBox(pose, vc, -5, -5, -5, 5, 5, 5, 0.9F, 0.9F, 0.9F, 1.0F, 0.5F, 0.5F, 0.5F); renderer.renderLevel(pose, event.getPartialTick(), event.getStartNanos(), true, cam, mc.gameRenderer, new LightTexture(mc.gameRenderer, mc), event.getProjectionMatrix()); } Just had to call renderLevel at the end of the event handler.
  2. Hi again, I've come back to the problem that I had several days ago. According to the StructureBlockRenderer way of doing it, I have the above code. It sill doesn't render anything. Well, I suspect that it is rendering it, but in the wrong place. Am I linking the wrong buffers? Am I missing something important? Is my translation wrong? I haven't been able to understand exactly how the render process works, so, any explanation about it would be welcome. Hope you can help me, this is the code: @SubscribeEvent public void onRenderLastEvent(RenderLevelLastEvent event) { PoseStack pose = event.getPoseStack(); LocalPlayer player = Minecraft.getInstance().player; VertexConsumer vc = Minecraft.getInstance().renderBuffers().bufferSource().getBuffer(RenderType.lines()); Camera cam = Minecraft.getInstance().gameRenderer.getMainCamera(); Vec3 vec = player.getPosition(0); Vec3 camvec = cam.getPosition(); double px = vec.x; double py = vec.y; double pz = vec.z; double d0 = camvec.x; double d1 = camvec.y; double d2 = camvec.z; pose.pushPose(); pose.translate(px - d0, py - d1, -pz - d2); LevelRenderer.renderLineBox(pose, vc, -5, -5, -5, 5, 5, 5, 0.9F, 0.9F, 0.9F, 1.0F, 0.5F, 0.5F, 0.5F); pose.popPose(); }
  3. Not much. I was just making code tests to learn a little bit more about how BlockEntities work. Thanks for your help
  4. Is it possible? I'd been looking around and found lots of info about attaching a custom BlockEntity to a custom Block, but nothing about attatching it to any kind of vanilla block that exists in the world. This is the register code for a custom Block. According to Forge documentation, I should register my entity as: validBlocks in this case are all blocks. Do I have to create a string listing all the blocks? I hope there is a more beautiful and clean way of doing it :).
  5. OK. Starting from 0 again. It can't be so difficult
  6. I have this. Now just trying to render a simple line xD. Anyone can help? Am I in the good way? Help!
  7. Hi there! Just wanna ask you some help. I'd like to draw a red point (a small red circle) in the middle of a block face. I've been reading about quads, textures, and all that stuff, but I'm sure there must be an easy and quick way of doing what I want. Is it? Thanks!
  8. Finally I have a first complete version of the mod. Here are all my classes for if someone considers them useful. I also add some questions below about how to improve it. Here it goes Let's go with some questions: As I never created a capability, I used this https://gist.github.com/N1K-x/a17812bac9de4cf064baa789e9ccb96a as a basic example. Did I implement it well or is a best way of doing it? I am checking if the target seleccion is running from the PlayerRightClickEvent, and if so, I'm cancelling the event. Is there a way to tell Minecraft to always disable it for a certain player and not having to do it from inside itself? Easier explain of the question: can I tell MC that a player can't place blocks while the boolean "running" of the mod is true? I am coding the command execution from the command class. Shall I put the start/stop/fire funcions in the Capability implementation or it is ok to do it here? That's all. I hope my code would be useful as an example of implementing commands or capabilities. And thanks to whoever answers my questions :D.
  9. Ok. Understood. Now I am saving the player who rightclicks the blocks to fire and finally it works :D. I'm sure there are other things that I'm doing the worst way, but it is easier to learn from a working code xD. I used this as a java standard way of seeing what is crashing. Can you link me some documentation about mc forge exceptions handling? Thanks!
  10. Hi there! It is my first question in this forum, so excuse me if I ask very basic questions. And I don't have a very good English, so forgive me for that too. I am developing a mod (my first mod, have not experience in mc modding but have it in java programming). My mod is a Pyromaniac mod. I'll explain: the user executes a command (/pyro start) and clicks on some blocks. When finished executes '/pyro stop', and finally executes '/pyro fire' to start all fires at the same time. Ok. No problem with the commands, they work fine: The problem comes when setting the fire blocks. In this test version, all fires start in the .above() block of the targeted position. I can see how fires start, but they don't interact with their fireable neightbours, and nothing of I have done is being saved. I know (or I think I know xD) that the problem is because I am not updating both sides correctly. Could you help me in doing that? Here is my extremely naïve fire function in the PyromaniacMod class: Tell me if you need any more code part. And be nice, please ;). Thaaaaaanks!
×
×
  • Create New...

Important Information

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