Jump to content

GenElectrovise

Members
  • Posts

    132
  • Joined

  • Last visited

Recent Profile Visitors

215390 profile views

GenElectrovise's Achievements

Creeper Killer

Creeper Killer (4/8)

6

Reputation

  1. We're going to need to see the structure of your project. Show at least your mods.toml, root Java (the one with the @Mod) and the full structure of your resources and datapack (or at least what you can fit without spamming screenshots everywhere - we basically need as much info as possible) Also, how are you exporting it? You should be using the Gradle build task (not the IDEA jar export).
  2. Wise advice for many circumstances. Interesting commit also. Thank you - this is very comprehensive and I understand the point that LexManos is trying to make now. This is the explanation I've been looking for. I will now close this thread.
  3. It seems to me that anything that you'd need in order to make the GUI could be accomplished with #drawString or with Widgets. Is maintaining these the cost of which you speak? After all, a config GUI is just rendering a list of keys and a way to edit each value (either toggles or text widgets), no? I suppose if you wanted to cut down on maintenance then the first port of call would be to minimise independent calls to volatile 3rd party code (i.e. Minecraft itself). Perhaps it is not so simple though... If it was I'd think that someone would have gotten there before me?
  4. What would this mean in this context exactly? (Trying to consider whether this project would be a valuable addition to Forge) To clarify, does this mean: "any system is too much to maintain, so it's better to just leave it to mod authors" Or does it mean: "If we had a more maintainable system, it would be a useful addition" I'm basically asking because if it's the former, then I'll only make a screen for my own mods; if it's the latter, then I'll at least have a shot at implementing it in Forge itself
  5. If I may ask, what was the bottleneck in updating it? I suppose changes to screen rendering, given you mentioned the rendering guy? If I'm going to try to implement my own version, I may as well try to target the problem!!
  6. Fair enough seems like a pretty good reason. In this case sounds like it could be more complex than I thought, but if I achieve anything worth sharing I'll put in a pull request. Thanks!
  7. Heyo, I'm currently in the process of making a GUI for my mod's configuration options, accessible from "Mods > My Mod > Config" (The whole business of registering an extension point etc). Given the shear number of times poor Diesieben has had to answer the same question of how to achieve this I'd say it's a pretty common query (and why wouldn't it be config is pretty standard stuff). Why is this config GUI not built into Forge? Is there some secret reason I should know about or has simply noone gotten round to it? Maybe just a decision to let modders implement it themselves? But then surely you could still have a generic GUI and provide a hook for modders to edit or replace it if they choose? If my implementation is successful enough and testable I may just put in a pull request on the Forge GitHub to implement this. But it does perplex me why this isn't a thing... All the best to whomever reads this! P.s. Apologies if I have missed something important: it is very late.
  8. I personally have no idea what could be causing the issue, other than compatibility between some others of your 158 mods. Combining all of those could have some... strange side effects. If you're using an "official" modpack I'd suggest asking on a forum dedicated to that, otherwise you may be in for many hours of debugging (add a mod at a time and see what breaks it). I do not think that it sounds like an issue with Forge. A quick Ctrl+F didn't reveal any errors containing "door" but you probably already looked for that. You seem to have two mods which edit doors: mcwdoors and mcwtrpdoors. Perhaps start by looking at those, or other sound mods. Ps. I commend you on the thoroughness of your post - I'd hate to have to ask for logs, etc (that's really tedious)
  9. Thanks for sending me a working log file, but I will not answer questions in DMs. Please continue the conversation here, and copy the link here as well. What version of Forge are you using?
  10. Whatever your issue is, someone has probably already had it; what have you tried before coming here? That page does not exist. (The link does not work, code 404. Is the Gist private? Does it even exist?) Show the contents of start.bat. What version of Forge are you using (check the lovely banner at the top of the page. If your version isn't supported, you must update) Minor point, but "Guys can you help me" is not a descriptive title whatsoever. Check my signature for an article on writing a good coding question. Having a good title is helpful for people who have the same issue later on.
  11. I have no idea whether this code would work, but it would go in your mob's renderer class. See one of mine here: https://github.com/GenElectrovise/MagiksMostEvile/blob/1.16.5/src/main/java/genelectrovise/magiksmostevile/entity/boss/kitty_the_kraken/KittyTheKrakenRenderer.java I also have little idea of which method in which to put that code, though the parameters nearly match those of protected void applyRotations(SquidEntity entityLiving, MatrixStack matrixStackIn, float ageInTicks, float rotationYaw, float partialTicks) ... so that might be a reasonable place to start? (I know the method name doesn't match - there may be another one which is a better match but I do not have an IDE right now). Unless someone with more knowledge can come along and enlighten us, you may need to solve this issue with trial-and-error and vanilla-code-browsing.
  12. Greetings, it's been a while. I'd like to intercept chunk loading events so that I can generate new ores in previously explored areas. I suppose that I'd listen for ChunkEvent.Load and use event.getChunk(), but the documentation says: "You will cause chunk loading deadlocks if you don't delay your world interactions."... which doesn't sound like a good thing. How do I achieve said "delaying"?
  13. There'd also be a small startup time tradeoff but I don't know how much of a difference that would make. Interesting idea with running tests later on... I hadn't thought of that... Might try that out just to satisfy curiosity!
  14. Right then. I've tried some thing out over the last few days and come to the following verdict: Unit-testing Minecraft and Forge classes is really hard. Let me give you an example: For context, I'm using JUnit 5 with Mockito 3.8. I have a custom implementation of a fluid tank. I first tried writing a simple unit-test to check that "when there is no fluid in the tank and I try to drain some, drain zero units". I used to extend FluidTank, but in trying to write a simple test, I niow implement IFluidHandler and IFluidTank directly. The reason for this is that creating my object to test, it constructs a FluidTank, which contains this field: @Nonnull protected FluidStack fluid = FluidStack.EMPTY; When FluidStack.EMPTY (a static field) is called on, the JVM tries to also load FluidStack's other static field, FluidStack.CODEC. This in turn causes a cascade of other static initialisations which culminates in crashing the JVM with a NullPointerException sometime around it trying to either load a World or access a Registry. So not good. I tried to @InjectMocks on that field, but the injection occurs after the object is instantiated, so the JVM has already crashed. In order to get around this, you have to implement the aforementioned interfaces directly because: 1) They are the required interfaces so they have to be there anyway; 2) They contain no static fields, so they won't start a cascade. The upshot? Forge and Minecraft are not designed to be tested in this way (not surprising), and have interlinking fields with will cause crashes. What can we do? Well, you can test anything that you write. You can't test a FluidTank, but you can test an IFluidTank. Try to not have unnecessary static fields, and use constructor injection when possible. (This would fix the problem above: see my code below) // How to fix that crash // In FluidTank.java: // Don't initialise the field now! protected FluidStack fluid; // Add a new constructor to allow modders to specify a starting stack. public FluidTank(int capacity, Predicate<FluidStack> validator, FluidStack initialFluid) // Using constructor injection here means that a tester *can* inject a mock object for the initialFluid. This means that no initialisation cascade occurs! { this.capacity = capacity; this.validator = validator; // Probably a good idea to test the stack for safety. if (!validator.test(initialFluid)) throw new IllegalStateException("Whatever kind of error you want"); this.fluid = initialFluid; } // Changing the current constructor to just use the overloaded one. public FluidTank(int capacity, Predicate<FluidStack> validator) { // This time it's safer to default to EMPTY this(capacity, validator, FluidStack.EMPTY); } I realise that this all sounds very... ahhh... something? (can't think of the word) I'm certainly not the expert on this and I'm not a professional tester so I've probably made some errors or assumptions here. I would put this in as a pull request on the Forge Github if I could actually clone it (never works for some reason...) Best, GenElectrovise
  15. All of it. If you don't have a repo, please make one. Everything will be easier.
×
×
  • Create New...

Important Information

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