Jump to content

Willsbr

Members
  • Posts

    7
  • Joined

  • Last visited

Everything posted by Willsbr

  1. So I'm creating a mod, and trying to get this mod compatible with another mod called "Figura". It's a model creation mod and one of the neat things it lets you do is use the player's NBT data in your models. Originally I thought since my the stuff I wanted to be used was a capability it was all good, then I realized that it never saved to NBT in a way I wanted it to. I tried to forcefully save it using event.player.serializeNBT();, but the discovered that saves everything at the exact state, and unless your calling it very slowly it effectively freezes every stat in the game. There's also some way to create a plugin for figura, but there's no documentation and I don't know how to even let another mod see the data I want it to see from my own mod. If someone could answer either question, that would manage to solve my problem!
  2. So I'm creating a mod, and trying to get this mod compatible with another mod called "Figura". It's a model creation mod and one of the neat things it lets you do is use the player's NBT data in your models. Originally I thought since my the stuff I wanted to be used was a capability it was all good, then I realized that it never saved to NBT in a way I wanted it to. I tried to forcefully save it using event.player.serializeNBT();, but the discovered that saves everything at the exact state, and unless your calling it very slowly it effectively freezes every stat in the game. There's also some way to create a plugin for figure, but there's no documentation and I don't know how to even let a plugin see the data I want it to see from my own mod. If someone could answer either question, that would manage to solve my problem!
  3. As the title reads, I've been trying to create a custom advancement trigger to activate based off a capability I've created. Despite my best efforts to A)Understand the sparse documentation for 1.19 on advancements and B) Reverse Engineer it by looking at the code, I keep coming back to this spot stumped. If anyone has example code using the SimpleTriggerInstance/AbstractTriggerInstance then I would be set and done. If you could explain what this line of the documentation is asking me to do, "Custom criteria triggers can be created by implementing SimpleCriterionTrigger for the created AbstractCriterionTriggerInstance subclass." then that would also be amazing. I've tried implementing it but it doesn't seem to actually want to be implemented, and extending it leads me in a direction that the documentation doesn't explain.
  4. I currently have a capability and everything I want to do with it setup correctly. I want to make it clear my capability works, persists through death updates correctly and all that. What I'm trying to do is force the NBT data to save at a time besides exiting the game/dying. I've tried to look at the super methods for saving but I can't grasp how exactly it's functioning. The reason I'm trying to do this in the first place is that I'm trying to make my mod-compatible with a modelling mod known as "Figura", and it's able to read the NBT data attached to a player for use in players models. Currently players can't actually read the new values because it doesn't save to NBT until death or exit.
  5. Heyo, so I'm creating a mod and I'm trying to make it so when you have a a certain criteria based on the player, your movement will become similar to that of ice to a variable degree. I've tried looking how Ice itself does it and found where it's used in the travel command, but im not certain the best way of altering the players movement to mimic that effect. Any guidance would be greatly appreciated.
  6. I'm trying to make a rather simple GUI to handle changing certain player attributes. To do this I extended screen, created a basic graphic along with a editBox and save button. However I can't figure out how to scale the elements properly so they correctly show up according to GUI Scale. I've tried looking for how the game and other mods handle it, but couldn't find a way that worked. I've gotten the background to stay at a constant point, but trying to apply that logic to anything else doesn't seem to be successful. Tried using pose. Scale and translate, but that renders my buttons inoperable. Any recommendations on how I should handle scaling the background/buttons scaling so it follows the GUI scaling would be much appreciated. Below is my current code, it's the most stable version so far public ConfigMenu(Component pTitle) { super(pTitle); } //this should initialize most things, gets ercalled on screen change. @Override protected void init() { super.init(); Window curWindow= Minecraft.getInstance().getWindow(); leftBackX=(int)(this.width/4*(1/curWindow.getGuiScale())); leftBackY=(int)(this.height/7*(1/curWindow.getGuiScale())); //make emR editbox1=new EditBox(Minecraft.getInstance().font, leftBackX+(width/60),leftBackY+(height/40),130,30, Component.literal("Beep boop").withStyle(ChatFormatting.GREEN)); saveButton= new Button(leftBackX+(int)(width/2.5),(int)(leftBackY+(height/1.5)),60,20, Component.literal("Save").withStyle(ChatFormatting.WHITE),button ->{ onClose(); }); // Add widgets and precomputed values //addRenderableOnly too this.addRenderableWidget(editbox1); this.addRenderableWidget(saveButton); } @Override public void render(PoseStack pose, int mouseX, int mouseY, float partialTick) { //DELETE THIS YOUR DOING THIS SO THE VALUES RELOAD IN DEBUG //this.init(); // Background is typically rendered first this.renderBackground(pose); //this.renderDirtBackground(1); // Render things here before widgets (background textures) this.background(pose); // Then the widgets if this is a direct child of the Screen super.render(pose, mouseX, mouseY, partialTick); // pose.popPose(); // Render things after widgets (tooltips) } public void background(PoseStack pose) { RenderSystem.setShaderTexture(0, OVERSTUFFED_BACKGROUND); //System.out.println(""+curWindow.getGuiScale()); this.blit(pose,leftBackX,leftBackY,0,0,0, (int)(width/4),(int)(height*0.5),(int)(width/4),(int)(height*0.5)); } Gui Scale 1 Image Gui Scale 2 Image if this is a simple fix I'm terribly sorry, I'm new to this and have wasted at least 3-4 hours testing ways to render it and looking at forum posts.
  7. So I've recently been trying to make a menu to serve as way to change some of the settings in my mod, however, every I'm having trouble figuring out what the best way for my purpose is. I've seen people say you should just use screen, but others say use ForgeGUI Component, and I think an AbstractContainer would be wrong but I've seen people say you need to use that do one of the others. If it helps to narrow it down, I'm going to have text boxes that's data will probably end up being sent in a packet to the server. Recommendations, or better yet just explanations of the differences would be greatly appreciated.
×
×
  • Create New...

Important Information

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