itsJahona / ShrekMinecraftPlugin

GNU General Public License v3.0
1 stars 1 forks source link

Create Onion crop #5

Open jstockdi opened 3 years ago

jstockdi commented 3 years ago

As a user I want an onion crop so that I can plant, harvest, and eat onions.

jstockdi commented 3 years ago

Having troubles finding resources and clues on how to do it. Here is what I've learned so far:

  1. https://www.spigotmc.org/threads/how-to-create-a-custom-item.134241/ items can be customized
  2. Likely we will need to put graphics/sprites either in a file or as base64 encoding in the file
jstockdi commented 3 years ago

Definitely need a resource pack, which will be downloaded client side to render

https://github.com/ZtechNetwork/MCJVanillaResourcePack looks like the default resource pack and is a good example.

Things about resource packs:

  1. assets/minecraft/blockstates contains the json configuration defining which graphics go w/ which state. See https://github.com/ZtechNetwork/MCJVanillaResourcePack/blob/master/assets/minecraft/blockstates/potatoes.json for an example
  2. assets/minecraft/textures/ is the root folder for the paths in the json config
  3. textures/item is where the graphic is defined for items
jstockdi commented 3 years ago

As far as "creating an onion" I think there is no specific onion object or class in the code. Rather, its a enum of an ItemStack(1).

jstockdi commented 3 years ago

Need to tell our plugin to load the resource pack:

In the plugins onEnable() method...

InputStream source = this.getResource("resource.zip");
try
{
     ResourcePackManager.registerResource(this, source);
}
catch (IOException e)
{
      e.printStackTrace();
}
jstockdi commented 3 years ago

Need to set resource-pack in server.properties to a download URL to automagically install and download the resource pack