Jump to content

Recommended Posts

Posted (edited)

Is IResourcePack loads whole resource pack or individual textures? (Just to be sure, I know the name is IReseourcePack, don't gaze your wrath upon me diesieben)
Is it requires FileResourcePack or FolderResourcePack? Or does not matter as it would eventually be InputStream?
How should I feed it with InputStream? Would only a .zip file work? (I'm downloading the resource pack in preInit, so, instead of File->Inputstream, HttpInputStream should work, I suppose.)
Is it possible to check whether IResourcePack loads or not with Resource Packs menu in the game? Or, do I have to load the world or check logs about assets every time if it is not working properly (wrong resource location etc.).
 

These are my questions for now. Thanks.
 

Edited by Belial
Posted (edited)
2 hours ago, diesieben07 said:

You can return whatever stream you want for the resources. Downloading them from the internet every time seems like a terrible idea.


I know. It will only download them when client and server versions are different. You might say don't reinvent the wheel, use forge's built-in update system,  but I don't need and want to update the whole mod whenever a new decorative block is added. As this will be only a clientside mod for a roleplay server, I don't think that would affect that much.

 

2 hours ago, diesieben07 said:

I have no idea what this is supposed to mean.

 


My bad, I should've restructured that sentence.

I'm including the resource pack in default resource packs on preInit. But, it does not work. I'm not asking why it's not working, I can figure out by myself and I don't think you can figure it out without a proper git repo. But to figure out that, I have to know if resource pack loads or not. So that way, I can focus on the source of the problem. So, is it possible to know when IResourcePack is successfully loaded? When it loads, can I see it in in-game Resource Packs menu like the normal resource packs? If so, that means my resource pack didn't load because I didn't see anything in the in-game menu.

Also, is ResourceLocation on getInputStream is resource pack's location or individual asset location?

Edited by Belial
Posted (edited)
1 hour ago, diesieben07 said:

Uhm... what? Please clarify wtf you are doing.

 

I think what I said was quite self-explanatory but alright… But, first of all, I have to state this. When I say “server”, don’t understand it as “minecraft server”. I use “server” as a general term as it should’ve been. In my last post, it’s understood as “minecraft server”, that is why I’m stating this.


 

As I stated in my older comment, I’m doing this for a roleplay server. It might seem irrelevant, but I have to clarify why I’m doing it. We are using Spigot (Bukkit) to accomplish our serverside goals (like rolls, different chat channels etc.). But, we also wanted to add several GUI’s (like character sheet) and new decorative blocks. But without client modification, these are not possible. We considered switching to Sponge, but as Sponge does not have already coded resources (logblock like plugins and the plugins we wrote for our older servers), it requires more work than we should dedicate.


 

So, we decided to code clientside with Forge and connect the two with packets. If we speak of GUI’s, they are easier to maintain. Because we won’t have more than several and they won’t change quite often. But for decorative blocks… Yeah, it is quite a challenge. Because, each time a new block is needed, they need me to add it for both Forge and my packet implementation on Bukkit. This is quite boilerplate. So, to avoid it, I’m generating data for blocks with a Python script, so that way both Client and Minecraft Server can access and use the same data without requiring me to recompile the mod each time. By that way, not only me, also they can add the blocks without serious effort and coding.


 

So, this is the story of it. I did manage to register blocks according to a json file which is downloaded from a server, but textures are not possible without implementing a IResourcePack, as I can see.



And to avoid unnecessary usage of the network, I will check both server's and client's versions before downloading them, otherwise, it would be very dumb.

 

I know, this isn’t a good way, this will probably bring me more headaches. But I don’t think any other good way to achieve this. If you have any idea about accomplishing it, I would like to hear it. You might simply say “don’t” or “use Sponge”. I’ve seen several of your comments on similar posts. I’m also okay with them.

 

1 hour ago, diesieben07 said:

Default resource packs won't be shown there.


Thanks, I also expected this. But I wanted a confirmation from you.
 

1 hour ago, diesieben07 said:

What?


To implement my own IResourcePack, I have to override getInputStream method.
 

InputStream getInputStream(ResourceLocation location) throws IOException;


As you can see, there is a ResourceLocation part. I don't know what it is required for as this is only an interface. I tried to find a usage of ResourcePack but couldn't manage to. (probably there is)

So, what is that location stands for? Is that supposed to be a location for FileResourcePack or FoldeResourcePack, if so, I can simply deny it as I will directly feed it with InputStream. But if it's location for anything else, I have to consider that. I hope this clarifies it.

Edited by Belial
Posted (edited)
12 minutes ago, diesieben07 said:

What you are doing will not work. Adding new blocks requires IDs to be synchronized between client and server, which requires Forge on server and client. I did not even know Bukkit let you add new blocks...

As for the ResourceLocation in IResourcePack: It is whatever is specified at the "load me this resource" side. Check out where IResourceManager#getResource is called.

as far as i'm aware, Bukkit doesn't have a PROPER method to add new blocks besides hacky solutions...yes there's ways to add new items/blocks, this however uses things spawners and textures and is way more limiting unlike forge

Edited by Optic_Fusion1
Posted (edited)
24 minutes ago, diesieben07 said:

What you are doing will not work. Adding new blocks requires IDs to be synchronized between client and server, which requires Forge on server and client. I did not even know Bukkit let you add new blocks...

 

13 minutes ago, Optic_Fusion1 said:

as far as i'm aware, Bukkit doesn't have a PROPER method to add new blocks besides hacky solutions...yes there's ways to add new items/blocks, this however uses work around with spawners and textures and is way more limiting unlike forge


Yes, Bukkit does not have methods for adding blocks.

https://wiki.vg/Protocol#Block_Change

But, there are 2 packets about block change. One is block change and the other is multi-block change. It is possible to intercept these with Bukkit. That way, it is possible to show fake blocks and it is used in plugins. So if I edit these and send non-existent blocks, it is possible to show them blocks the server does not have. That is the trick behind it.

 

24 minutes ago, diesieben07 said:

As for the ResourceLocation in IResourcePack: It is whatever is specified at the "load me this resource" side. Check out where IResourceManager#getResource is called.

1


Thank you, I will check it out.

Edited by Belial
Posted
1 hour ago, Belial said:

 


Yes, Bukkit does not have methods for adding blocks.

https://wiki.vg/Protocol#Block_Change

But, there are 2 packets about block change. One is block change and the other is multi-block change. It is possible to intercept these with Bukkit. That way, it is possible to show fake blocks and it is used in plugins. So if I edit these and send non-existent blocks, it is possible to show them blocks the server does not have. That is the trick behind it.

 


Thank you, I will check it out.

You're still VERY limited on what is possible

Posted
4 minutes ago, Optic_Fusion1 said:

You're still VERY limited on what is possible

I only need them for decorative purposes. That would be enough.

Posted
11 minutes ago, diesieben07 said:

You are breaking everything by doing this.

Do not do this.

 


There is no way around to achieve it. So, it is the only way to make it. What I do is only intercept the communication of the game. If I override the necessary events on the server side, what could be broken? I won't intercept all the block data, just fake ones.

Posted (edited)
1 minute ago, diesieben07 said:

You are creating block IDs that don't exist. This breaks Forge's registries in every possible way.

There is no way to enforce certain block IDs in Forge and you should never try to do so.

If you want to add new blocks, you need Forge on the server.


I'm not forcing anything to the Forge. I'm forcing those fake ID's to Bukkit. Forge will already have those ID's. Am I wrong?

Edited by Belial
Posted
Just now, diesieben07 said:

If you create new blocks in a Forge client, you do not have control over the IDs. They are assigned by Forge and Forge will synchronize IDs between server and client upon connection to the server. This is the only possibly way to add new blocks.

IDs can be different between worlds.


Now, got it. So, if I send block data without using ID's, that would be probably reinventing what Forge does with less efficiency and that is bad, right?

Posted (edited)
2 minutes ago, diesieben07 said:

You can't "send block data without using IDs". Blocks fundamentally require an internal ID so they can be saved to the world, held in memory, send over the network, etc. etc. Vanilla code relies on blocks having an ID. I cannot think of a way to add new blocks to the game without them having an ID. Registering a block automatically assigns it an ID. Not registering a block makes it unable to be used in the world.


But, what if I store it in another file than the world file? I know that would be very bad practice but, isn't that possible? I could simply paste it over the world data when it's sent. Of course, this only applies to serverside. But I don't know how I can assign them in memory without editing the game... That would be impossible.

Edited by Belial
Posted
Just now, diesieben07 said:

You would have to re-implement everything. Placing blocks. Interacting with them. Storing them in the world. Rendering them.

Other mods would simply ignore your blocks (after all they are not real blocks).

Yes, this means you cannot extend the Block class, either. You have to write everything from scratch.

I do not recommend you do this.

 

If you want new blocks I am afraid you will need to use Forge on the server side.


As this will be only for our server, we don't need any other mods; but still, as you said, its overkill. Thank you for explaining the reason.

Posted
1 minute ago, diesieben07 said:

I should have worded that better. Everything will ignore your blocks. Pistons won't push them, instead they will happily push other blocks into them. Water will flow through them. Entities will walk through them. Light will pass through them. I can go on. This is not a viable idea.


Definitely not viable, got it. Thanks again.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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