-
Notifications
You must be signed in to change notification settings - Fork 0
Getting Started
This page will teach how to start using ItemContent.
You need to add the following repository and dependency to your project if you didn't before.
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<dependency>
<groupId>com.github.efekos</groupId>
<artifactId>ItemContent</artifactId>
<version>master-SNAPSHOT</version> // master branch is for Minecraft 1.20.2. Use other branches as version for older/newer versions of Minecraft.
</dependency>You need to add the following repository and dependency to your project if you didn't before.
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
dependencies {
implementation 'com.github.efekos:ItemContent:master-SNAPSHOT' // master branch is for Minecraft 1.20.2. Use other branches as version for older/newer versions of Minecraft.
}As you might know, when you want to add an hover event using BaseComponents of BungeeAPI, you need a HoverEvent object and use it on BaseComponent#setHoverEvent(HoverEvent) method. This HoverEvent object has a constructor with signature HoverEvent#HoverEvent(Action,Content...). All you need to do is choose SHOW_ITEM as action type, and add an ItemContent. Here is a basic example of this:
TextComponent component;
ItemStack item;
component.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_ITEM,ItemContent.from(item)));ItemContent#from(ItemStack,Integer) method is used to define slots inside item containers (such as a shulker box), so you don't have to use that. The other method (ItemContent#from(ItemStack)) is the main method. It generates an ItemContent from the ItemStack given.
And that's it! I hope this page was helpful. Have a nice day with your cool items in chat!