Jump to content

XPModder

Members
  • Posts

    16
  • Joined

  • Last visited

Recent Profile Visitors

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

XPModder's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. After doing some more testing, I determined that comparing two VoxelShapes never returns true, even if I compare a variable of type VoxelShape with itself it returns false. I was able to circumvent this by calling toAabbs() on both VoxelShapes and comparing the resulting lists of AABBs using the .equals method. This works correctly as far as I can tell. So instead of shape1 == shape2 I now use shape1.toAabbs().equals(shape2.toAabbs())
  2. I am working on a mod for mc 1.18.2 that allows multiple smaller blocks to be combined in a single blockspace. To do this I have created a block with block entity, where the block entity stores the blockstates of the smaller blocks that make up the bigger combined block. In order to add additional (small) blocks to an existing combined block I want to check if the block Im trying to add itersects/overlaps with any part of the existing combined block it it were added. I am trying to do this by comparing the VoxelShapes of the two blockstate with each other, but I cannot figure out how to do this. How can I compare two VoxelShapes with each other? It is enough if I can check somehow if two VoxelShapes are equal, but this does not appear to be possible... I have tried using shape1.equals(shape2) as well as shape1 == shape2 Both of these do not seem to return true, if the shapes are equal. I have looked into the VoxelShape class and the DiscreteVoxelShape class, as well as the Shapes clasee, but was not able to find anything that would help me in comparing two VoxelShapes.
  3. Thank you! That worked! I had seen the createTagKey method before, but I thought it was there to create an entirely new tag.... I guess the method is simply named weird or I haven't fully understood some aspect of how these tags work in the background... I would have expected a method doing this to be named 'getTagKey' or 'getKey' or similar...
  4. I am trying to perform some operations with all items with a certain tag. At the moment I am doing this by iterating over all items with the tag using ForgeRegistries.ITEMS.tags().getTag(). This works, but I am passing in the specific tag directly. Now I am in the process of moving some things into a config file. In the config file file I want to have a list of items or tags (aka the list will contain both items and tags). I have the list working with just items, but now I need to add the tags. So the question is: How do I get a TagKey object that can be passed into the getTag() method mentioned above from its string representation? So as an example I am reading "forge:logs" from the config and want to get ItemTags.LOGS. How can I do this? Looking into it, I think I could do it by iterating over the output of ForgeRegistries.ITEMS.tags().getTagNames() and then somehow comparing those to the string, but I don't even see an easy way to do that. Also I would like to avoid iterating over a potentially large list, if there is a better way of doing it... I have looked into the ITagManager and TagKey classes, but haven't found a solution.
  5. I got it to work now! The problem apperently was the scaling of the matrixStack. For some reason with the matrixStack.scale(1, 1, 1) it does not create any text at all, but as soon as I changed it to -0.025F, it worked! That was the only change required to make it work in some capacity. I later made some other changes to, but they were not neccersary to make the text show up ingame. I have no idea why that is the case, as I thought, the text would simply be way to big, if the scale was of... Seing as it needs a negative scale, maybe scaling it to 1, 1, 1 made the text super small. So small that it wasnt visible.... Also: any translation should be done before the scaling, otherwise its way off... Thanks for the help!
  6. Ok. I think I understand it now. The pose is translated first by the difference between camera and block position to move it to where the block is. Then it is translated upwards, so it is above the block/entity and not inside it. I am doing that now, but it still doesn't fix the problem... PoseStack matrixStack = event.getPoseStack(); String text = "Collectable XP: "; text += entity.getCollectedXP(); LogHelper.info("Render: " + text); matrixStack.pushPose(); Vec3 cameraPosition = event.getCamera().getPosition(); matrixStack.translate((double)hitPos.getX() - cameraPosition.x, (double)hitPos.getY() - cameraPosition.y, (double)hitPos.getZ() - cameraPosition.z); matrixStack.scale(1, 1, 1); matrixStack.translate(0, 1.5, 0); matrixStack.mulPose(event.getCamera().rotation()); MultiBufferSource bufferSource = event.getMultiBufferSource(); int packedLight = instance.getEntityRenderDispatcher().getPackedLightCoords(instance.player, event.getPartialTicks()); //instance.font.draw(matrixStack, text, 7, 80, 0xffffff); instance.font.drawInBatch(text, 7, 10, 0x20ffffff, false, matrixStack.last().pose(), bufferSource, false, 0, packedLight); matrixStack.popPose(); It still doesn't draw the text ingame. I think I understand how most of the game works, but all the graphics and rendering stuff is still somewhat beyond my understanding... Well, we can hope that someone else, who understands this better, picks up this thread and helps us out...
  7. Can you show me where that is actually done in the game code? If I look at the EntityRenderer class I can only find a single call to translate(), which is the one that moves it to the correct height. Yes, I see that. I have now moved my code to the HighlightBlock event and inside the mulPose() call I now have event.getCamera.getRotation(). I also adjusted everything else to use the additional information availbale through that event. I also tried to translate the pose to the block position, but it didn't fix the problem. I also couldn't see that being done anywhere in the vanilla code, so I assumed it was not neccessary....
  8. I will look into that. I looked further into the renderNameTag method and also where it is being called from. I still don't know 100% how everything works, but the renderNameTag method only translates the pose only by adjusting the y value of it. It does not modify the y and z translation. So I tried doing essentially the same: translating in the y direction and leaving x and z as is. I also adjusted the text to the camera, similar to the way it is done in renderNameTag. I also looked at another project of mine, where I rendered a block in the world, that isn't actually there, but that project uses getActiveRenderInfo().getProjectedView() in the translation. This other project is sitting in 1.16.5 and there it works, but the ActiveRenderInfo class does not exist anymore and I can't find anything that would be the equivalent to getProjectedView() in 1.18.2. I still havent been able to get it to work. My code looks like this now: PoseStack matrixStack = event.getPoseStack(); String text = "Collectable XP: "; text += entity.getCollectedXP(); LogHelper.info("Render: " + text); matrixStack.pushPose(); matrixStack.scale(1, 1, 1); matrixStack.translate(0, 1, 0); matrixStack.mulPose(instance.getEntityRenderDispatcher().cameraOrientation()); MultiBufferSource bufferSource = instance.renderBuffers().bufferSource(); int packedLight = instance.getEntityRenderDispatcher().getPackedLightCoords(playerIn, 0); //instance.font.draw(matrixStack, text, 7, 80, 0xffffff); instance.font.drawInBatch(text, 7, 10, 0x20ffffff, false, matrixStack.last().pose(), bufferSource, false, 0, packedLight); matrixStack.popPose();
  9. Yes. It is for 1.18.2. I do want to render the text in world, as the text will show some data about a specific type of blockentity. Basically I want to draw some text above the block, when it is being looked at by the player. The text will show information about the blockentity. I have looked at EntityRenderer.renderNameTag() now, but I am still having problems. Unfortunately all the parameters in both the renderNameTag method, as well as all of the methods of the Font class do not have meaningful names, which makes it a lot harder to find out how something is working. I am still not sure what some of the parameters do. I have now tried to use the method font.drawInBatch instead of font.draw, as this is what the renderNameTag method uses, but I still can't get any text to actually show up ingame.
  10. Hi. I am working on a mod and wanted to render some text during the LevelLastRenderEvent. I am trying to draw the Text using Minecraft.getInstance().font.draw(), by passing in the PoseStack from the event, as well as my Text. For some reason I can't get it to actually render anything. I am not quite sure what the x and y coordinates mean, that the method requires, but I tried many different values. I also looked at some other mods and tried to find an example of this actually being done, but I haven't really found something helpful... Are the x and y parameters of the function world coordinates (like block coordinates) or are they relative to something else? Ho do I find the correct coordinates to use? Also, why is it not rendering anything at all for me right now? Here is how I am trying to render the text at the moment. PoseStack matrixStack = event.getPoseStack(); String text = "Collectable XP: "; text += entity.getCollectedXP(); LogHelper.info("Render: " + text); matrixStack.pushPose(); matrixStack.scale(1, 1, 1); instance.font.draw(matrixStack, text, 7, 100, 0xffffff); matrixStack.popPose(); This is inside an eventhandler for the LevelLastRenderEvent and with the LogHelper printing it to the log, I can see that it is definitively getting to this point and executing it. The logging of this is just temporary, so I know that its actually trying to render...
  11. I am working on a mod, that will have a lot of essentially the same blocks with different materials and textures. (Stairs, slabs and quarter blocks) In order to save me a lot of work and allow the mod to automatically create these blocks from just a list of base-blocks I have created a system that auto-generates the resource files for the blocks (block model, blockstate, item model) and places them in a folder named with the modid inside the minecraft folder. This works fine and I am loading the resource files from the folder by adding the folder as a resource pack using ResourcePackInfo.createResourcePack and supplying it using Minecraft.getInstance().getResourcePackList().addPackFinder. Now I want to add the crafting recipes and I implemented the auto-generation of the json files for all the crafting recipes. These files are placed in a data subfolder of the resource folder. The folder tree looks like this: .minecraft |->modid | |->resources | | |->assets | | | |->..... <-Here are the other files in the correct folders (blockstates, models, lang) | | |->data | | | |->recipes | | | | |->..... <-This is where the crafting recipe json files are located | | |->pack.mcmeta The problem is, that the crafting recipes are not loaded into the game, while all the files under assets are. I guess the reason for this is, that the game reads all the files in the resources directory as a resource pack, but it does not look for crafting recipes in a resource pack, as those would come in a datapack. So the question is, how do I load the contents of that data folder as a internal datapack (like the data folder inside the mod jar would be)? I looked around on the internet a little, but couldn't really find anything that would help me. I also tried finding out how forge loads that stuff, but I couldn't really find it quickly.... I am specificly asking for version 1.18.2! (Please don't close this question because of the version...) (I know this is essentially a repost of another question of mine, but the earlier one was closed before I got an answer, due to the version...)
  12. I am working on a mod, that will have a lot of essentially the same blocks with different materials and textures. (Stairs, slabs and quarter blocks) In order to save me a lot of work and allow the mod to automatically create these blocks from just a list of base-blocks I have created a system that auto-generates the resource files for the blocks (block model, blockstate, item model) and places them in a folder named with the modid inside the minecraft folder. This works fine and I am loading the resource files from the folder by adding the folder as a resource pack using ResourcePackInfo.createResourcePack and supplying it using Minecraft.getInstance().getResourcePackList().addPackFinder. Now I want to add the crafting recipes and I implemented the auto-generation of the json files for all the crafting recipes. These files are placed in a data subfolder of the resource folder. The folder tree looks like this: .minecraft |->modid | |->resources | | |->assets | | | |->..... <-Here are the other files in the correct folders (blockstates, models, lang) | | |->data | | | |->recipes | | | | |->..... <-This is where the crafting recipe json files are located | | |->pack.mcmeta The problem is, that the crafting recipes are not loaded into the game, while all the files under assets are. I guess the reason for this is, that the game reads all the files in the resources directory as a resource pack, but it does not look for crafting recipes in a resource pack, as those would come in a datapack. So the question is, how do I load the contents of that data folder as a internal datapack (like the data folder inside the mod jar would be)? I looked around on the internet a little, but couldn't really find anything that would help me. I also tried finding out how forge loads that stuff, but I couldn't really find it quickly.... I am working on 1.16.5 currently, but I will take a solution for 1.18. I think I would be able to adapt a 1.18 solution for 1.16.5....
  13. Hi, I want to create a block that can have multiple different textures, but have them dynamically assigned to the block. Example: A slab block that will, when right clicked with any other slab block combine into a full block, but with the textures of both slabs (so it looks like one slab is on top of the other, but inside the same block). I can do this with blockstate and blockmodel files, but I am looking for a different solution as I want to add potentially 100s of slabs and that would obviously result in a huge number of blockstate and block model files. So I thought, maybe I can create a block that holds the registry names of the two slabs its made up of as properties and then write something that applies the correct textures to the block. I tried looking at the chisels and bits mod, as I thought that it must be doing something simmilar (storing the texture of each pixel of the blocks), but I didn't really understand how that works. Could someone point me in the right direction or explain to me how this is done, please.
  14. Hi everyone, I am currently working on a mod for minecraft 1.12.2 (although I want to move to 1.14.4 eventually), that has it's own hud. For now, I'm just adding a second progressbar ( similar to the xp bar) and some text to go with it. Now I want this new bar to be displayed just above the armor bar in survival and just above the hotbar in creative. This is already working fine, but during testing I realized that in survival, the text that shows the name of the item your currently holding, is now basically behind my bar. Of cause this is not intentionally and I want to resolve this. I however don't want to move my bar to above the text as that would put it basically in the middle of the screen and I don't want it at the top of the screen as that would obviously interfere with bossbars. Basically I want the bar to stay where it is and instead want to move the text further up. I found out that the text is rendered by GuiIngame.renderSelectedItem and inside this method there literally just is a variable that holds the y coordinate for the text. Unfortunately I have no idea how to go about doing that. I don't want to create a coremod or completely change the method, but I want to change the y coordinate of the text. Is there a way to override this method or can I somehow prevent that method from getting executed at all and instead execute my own?
  15. Hello request, I am interested in this mod as well and may consider helping you, but there are a few problems. First of all I won't help you until you do have permission from the original author to continue this project. This is very important, because even if the original mod is not protected under any licence it is still not a very good idea to just copy his work. Just try to get a email-address or some other form of contact and politely ask for the permission to use his mod/ideas and create a new version of the mod. If he/she is not interested in working on it himself/herself than there is a relatively high chance that you will get permission to use at least the idea. The second problem is, that the last version of the mod is for Minecraft 1.6.4, so nearly every single line of code will have to change in order for it to work on 1.12.2 and doing so is a lot and I mean a LOT of work. Without the original code it is even more work. While I am interested in this myself and would be interested in helping you, you have to know that I won't do this for you. You would have to work on it as well and that means that you have to know java and be able to actually write some code. If you cannot do so, you would have to learn it first. You won't find anyone here, who is willing to do all the work alone, just so you can have some more fun.
×
×
  • Create New...

Important Information

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