Tools for handling resource code

Forum for alternative clients, mods & discussions on the same.

Re: Tools for handling resource code

Postby loftar » Thu Jun 09, 2022 4:28 pm

iamahh wrote:seems running on IntelliJ terminal requires some authentication?

You're running with -jar instead of -cp.

EDIT: Which was apparently my fault. In my defense, it was correct in the documentation, just not in the post. Edited OP to reflect.
"Object-oriented design is the roman numerals of computing." -- Rob Pike
User avatar
loftar
 
Posts: 8926
Joined: Fri Apr 03, 2009 7:05 am

Re: Tools for handling resource code

Postby iamahh » Fri Jun 10, 2022 12:11 am

Oops, I typed instead of copying.
Now it works silently but I'm not finding the downloaded java files. But that could be my noob skills acting up. I'll definatley play more with it.
iamahh
 
Posts: 1810
Joined: Sat Dec 12, 2015 8:23 pm

Re: Tools for handling resource code

Postby telum12 » Fri Jun 10, 2022 3:12 pm

loftar wrote:
I have no problem understanding that would be the mindset, I just can't really imagine a way in which it would cause a real-life problem. The way I imagine it working, a locally modified resource class being overridden with the code actually in the resource would just basically look the same to the client as if the server hadn't asked for the resource to be used to begin with, and that is a situation that I imagine that all custom clients need to deal with regardless. I guess I'm just kind of curious what an example would be of something that would cause a crash or other sort of serious problem right now.



Honestly, it's just lazy design choices. I'm sure there's some fields we've added to some of the res overwrites out of laziness, but I'm not sure.

It doesn't seem like Ender's has much in terms of custom res files though, and none seem to be doing anything that will break. This probably would've been more of a problem on the pre-render clients, since many had an absurd amount of features.
MagicManICT wrote:To me, being called a pedo is exactly like being called gay.

Jalpha wrote:She must have been in heat bro. She was literally fanging for it. Literally posting repeatedly in chat, in all caps "DO IT! POST YOUR DICK! THERE'S NO WAY IT'S 7 INCHES!"

How could any hot-blooded male deny such a request under the circumstances.
User avatar
telum12
 
Posts: 426
Joined: Mon Mar 12, 2012 10:36 pm

Re: Tools for handling resource code

Postby loftar » Sat Jun 11, 2022 10:31 pm

telum12 wrote:Honestly, it's just lazy design choices. I'm sure there's some fields we've added to some of the res overwrites out of laziness, but I'm not sure.

I don't think added fields should be a problem either, though. As I said, an overridden class will simply act as a different and separate class (with a different set of fields), and your local class will just not be asked for by the server, but can be interacted with from other local code without any issues.

Merged into mainline, btw.

shubla wrote:Why not just recompile all resources? Fear the wasted bandwidth to send the new res files? We don't live in the age of ADSL anymore!

Fine, I just wasn't sure there even were any left and didn't feel like writing a tool to detect what resources lacked source code. But I did that now and will recompile the affected resource at the next server restart.
"Object-oriented design is the roman numerals of computing." -- Rob Pike
User avatar
loftar
 
Posts: 8926
Joined: Fri Apr 03, 2009 7:05 am

Re: Tools for handling resource code

Postby Mysia » Sun Jun 12, 2022 2:45 pm

thank u loftar for your hard work.

will buy some stuff from store later in support
User avatar
Mysia
 
Posts: 220
Joined: Mon Jan 02, 2012 9:49 pm
Location: CODE OF CONDUCT

Re: Tools for handling resource code

Postby ksetrad » Fri Jun 24, 2022 5:19 am

There is some problem when interacting with resources that require additional data loading from the server. For example:
(ui/tt/q/qbuff and
ui/tt/q/quality) We use(in constructor) Resource.classres(Quality.class).layer(Resource.imgc, 0).scaled(), but it causes some problems - Cannot fetch resource of non-resloaded class class haven.res.ui.tt.q.quality.Quality
Discord of Nurgling custom client : https://discord.gg/3YF5yaKKPn
ksetrad
 
Posts: 84
Joined: Sun Feb 21, 2016 9:13 pm

Re: Tools for handling resource code

Postby Keiriku » Sun Jul 24, 2022 8:02 pm

ksetrad wrote:There is some problem when interacting with resources that require additional data loading from the server. For example:
(ui/tt/q/qbuff and
ui/tt/q/quality) We use(in constructor) Resource.classres(Quality.class).layer(Resource.imgc, 0).scaled(), but it causes some problems - Cannot fetch resource of non-resloaded class class haven.res.ui.tt.q.quality.Quality


You can compile Quality's image into your custom resources and load it from there:
Code: Select all
public static final BufferedImage qimg = Resource.loadsimg("custom/quality");

public Quality(Owner owner, double q) {
    super(owner, qimg, "Quality", q);
  }
Image
User avatar
Keiriku
 
Posts: 67
Joined: Mon Jun 18, 2012 9:03 pm

Re: Tools for handling resource code

Postby iamahh » Thu Aug 11, 2022 3:25 pm

some classes have no package defined (like ISmoke and others)

I tested assigning a package to them, but I guess eventually this could break somehow?
iamahh
 
Posts: 1810
Joined: Sat Dec 12, 2015 8:23 pm

Re: Tools for handling resource code

Postby loftar » Thu Aug 11, 2022 6:00 pm

iamahh wrote:some classes have no package defined (like ISmoke and others)

Yeah, I know. I probably should give all resource code packages. It just feel a bit ugly for some of the extremely simple ones, but I probably should. It's arguably nicer anyway.

iamahh wrote:I tested assigning a package to them, but I guess eventually this could break somehow?

I don't think that breaks them in itself, but not having them in the directory corresponding to the package (which I'm not sure if it may have consequences) probably interacts poorly with Java compilation tools.
"Object-oriented design is the roman numerals of computing." -- Rob Pike
User avatar
loftar
 
Posts: 8926
Joined: Fri Apr 03, 2009 7:05 am

Re: Tools for handling resource code

Postby Keiriku » Fri Aug 12, 2022 1:44 pm

+1 to adding all resource code packages.
To access some of the default package classes from within a packaged class I've moved them to named packages and simply replaced names in ResClassLoader.loadClass i.e.
Code: Select all
overrideClasses.put("Armpen", "haven.res.ui.tt.wpn.info.Armpen");
overrideClasses.put("Damage", "haven.res.ui.tt.wpn.info.Damage");
overrideClasses.put("Armor", "haven.res.ui.tt.armor.Armor");

It worked well until I added ISlots, though I didn't investigate it deeper, probably related to loading Fac class or Spec lib.
I think adding packages to all default package classes will reduce the headache.
Image
User avatar
Keiriku
 
Posts: 67
Joined: Mon Jun 18, 2012 9:03 pm

PreviousNext

Return to The Wizards' Tower

Who is online

Users browsing this forum: Broccolo and 15 guests