Jump to content

TheOrangeInd

Members
  • Posts

    30
  • Joined

  • Last visited

1 Follower

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

TheOrangeInd's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. I'm trying to create a custom renderer for my entity and in order to do so I need to draw a sprite that has a lava texture and also a mask indicating which pixels to apply texture colors to. I've made quite a few attempts to implement this sort of thing, but all my scripts have either rendered nothing or just rendered a texture. Below is the code for my latest attempt. This code renders just a texture (instead of lava, I temporarily use a custom image). I would be grateful for any hints on how to fix it. So this is my test script: @Override public void render(EntityEruptionSource entity, float entityYaw, float partialTicks, PoseStack pose, MultiBufferSource buffer, int packedLight) { pose.pushPose(); Vector3f vertexRotAxis = new Vector3f(0, 1, 0); GL11.glEnable(GL11.GL_STENCIL_TEST); GL11.glClear(GL11.GL_STENCIL_BUFFER_BIT); GL11.glStencilMask(0xFF); GL11.glStencilFunc(GL11.GL_ALWAYS, 1, 0xFF); GL11.glStencilOp(GL11.GL_KEEP, GL11.GL_KEEP, GL11.GL_REPLACE); VertexConsumer builder = buffer.getBuffer(RenderType.entityCutout(MainClass.RLof("textures/entities/eruption_source_mask.png"))); Vector3f vertexPos = new Vector3f(-0.5f, 0.2f, 0.5f); for(int i = 0; i < 4; i++) { builder.vertex(pose.last().pose(), -vertexPos.x(), vertexPos.y(), -vertexPos.z()) .color(255, 255, 255, 255) .uv(0, 0) .overlayCoords(OverlayTexture.NO_OVERLAY) .uv2(packedLight) .normal(0, 1, 0) .endVertex(); vertexPos.transform(new Quaternion(vertexRotAxis, 90, true)); } GL11.glStencilMask(0x00); GL11.glStencilFunc(GL11.GL_NOTEQUAL, 0, 0xFF); vertexPos = new Vector3f(-0.5f, 0.2f, 0.5f); VertexConsumer builder1 = buffer.getBuffer(RenderType.entityCutout(MainClass.RLof("textures/entities/eruption_source_c.png"))); for(int i = 0; i < 4; i++) { builder1.vertex(pose.last().pose(), -vertexPos.x(), vertexPos.y(), -vertexPos.z()) .color(255, 255, 255, 255) .uv(0, 0) .overlayCoords(OverlayTexture.NO_OVERLAY) .uv2(packedLight) .normal(0, 1, 0) .endVertex(); vertexPos.transform(new Quaternion(vertexRotAxis, 90, true)); } GL11.glDisable(GL11.GL_STENCIL_TEST); pose.popPose(); super.render(entity, entityYaw, partialTicks, pose, buffer, packedLight); }
  2. I tried to update the forge and the library used, and then completely rebuilt the project. I'm still not sure what exactly the problem was, but it has now been resolved.
  3. In my mod, I need to use some libraries (GeckoLib), which I have not done before. So, I decided to just follow the API developer's instructions. Now I can successfully build my mod with the library connected and I see the library classes in my IDE. The problem is that I cannot start the game client to test my mod. The client gives me the error "NoSuchMethodError". As far as I understand, this should be related to mappings (I use the official ones). If anyone knows what I am doing wrong, please explain to me. This is my 'build.gradle': This is the Crash Report:
  4. Fixed this. Thanks again for your help.
  5. Okay. Now I think that I figured out my mistake and this is how my Provider looks now:
  6. Should I just create a new instance of RadiationCapability in my Provider? Or should I not use LazyOptional at all?
  7. Should I use an instance of my RadiationCapability for this?
  8. Okay. The second link was really helpful to me. Thanks for it. I managed to implement the capability I needed, but I'm not sure about the correctness of my approach to serialization. Anyway, I post the resulting code here. Thanks again for your help. My interface: Its implementation: And its provider:
  9. I'm trying to add a radiation to my mod and I need to store its value for each player. As I understand it, I should use capability for this. The problem is that I don't understand well the new capability system in 1.17. So, can I create a capability to store an integer value? What are the main components of capability in its present form?
  10. I tried to make a multipart entity using a Forge class called "PartEntity" and I think I found a flaw in the hooks associated with this class. Currently, such entity parts cannot take damage (their "hurt" method is simply not called). It seems to me that this is due to the fact that the "getEntities" methods in the vanilla class "Level" have not been modified. It would be nice if these methods were also modified to notify the game when there are custom entity parts in the world (similar to vanilla dragon parts). P. S. Sorry for my English.
  11. So, after researching how vanilla projectiles work, I found that when determining whether to hit the target, they request a list of entities using a method from the Level class (the method is called getEntities). So the fact is that in this method they directly check whether the entity is a vanilla Dragon and, if true, request its PartEntities. That is, this method cannot add custom PartEntities to the returned list as ordinary entities, since they do not exist in the world, but they are a logical continuation of the parent class. At the same time, the getEntities method does not ask the checked entity to check the isMultipartEntity (from IForgeEntity interface) and, accordingly, does not add entities returned by the getParts method to the list. I still do not rule out the possibility that I misunderstand the principle of this system. But at the moment it seems to me that in the current version of Forge, the correct implementation of Multipart Entities in the way conceived by the API developers is not possible. I will be glad if I'm wrong and someone will correct me.
  12. Experimenting with multiparty entities, I ran into a problem. My part entity does not detect incoming damage. I was making my entities following the example of vanilla dragon, and I think I missed some important detail. I would be grateful for any hints. So this is my Parent Entity class: and a Part Entity:
  13. As a result, I came to the conclusion that the problem was a conflict between the render of the fluid and its tank. That is, a tank whose render type was set to Translucent simply did not allow fluids with similar render types to be rendered. I'm not sure if there is a way to fix this, but for now I decided to just change the render type of the tank.
  14. I tried to change the buffer value, but it didn't work. Current buffer value: IVertexBuilder builder = buffer.getBuffer(RenderType.getText(AtlasTexture.LOCATION_BLOCKS_TEXTURE));
×
×
  • Create New...

Important Information

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