ItemStackLib 2.0.3

[1.8-1.13.2] Library to modify some ItemStack traits that Bukkit doesn't support

  1. Sataniel
    Native Minecraft Version:
    1.13
    Tested Minecraft Versions:
    • 1.8
    • 1.9
    • 1.10
    • 1.11
    • 1.12
    • 1.13
    Source Code:
    https://github.com/DRE2N/ItemStackLib
    Contributors:
    Sataniel
    Usage
    ItemStackLib provides methods to do two things that the Bukkit API still lacks: The possibility to apply attributes like attack damage or armor to ItemStacks and Base64 encoded texture values to player head ItemStacks. Values to use for heads can be found for example here included in commands, like:
    UUID
    Base64 texture value

    JavaDocs

    Code example:
    Code (Text):
    // Item attributes
    ItemStack sword = new ItemStack(Material.IRON_SWORD);
    sword = AttributeWrapper.builder()
           .attribute(InternalAttribute.GENERIC_ATTACK_DAMAGE)
           .name("myattribute")// Optional
           .operation(InternalOperation.ADD_NUMBER)
           .amount(10.35)
           .slots(InternalSlot.HAND)// Optional
           .build()
           .applyTo(sword);

    Collection<AttributeWrapper> modifiers = ItemUtil.getAttributes(sword);

    // To remove all modifiers of a specific attribute:
    ItemUtil.removeAttributeType(sword, InternalAttribute.GENERIC_ATTACK_DAMAGE);
    // To remove all modifiers that have a specific name:
    ItemUtil.removeAttribute(sword, "myattribute");

    // Skulls with Base64 texture value
    String texture = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMmM2NDVhNDI1OTg3ZjNiN2MyZmFjMDIwNmNlOThiYTVlMjNiOWM0ODUyZmVhNWIxOTc4Zjc0NjdlOGQzMTMifX19";
    ItemStack texturedSkull = ItemUtil.setSkullOwner(head, player.getUniqueId(), textureValue);
    String textureFromSkull = ItemUtil.getTextureValue(head);
    Maven
    Code (Text):
       <dependencies>
           <dependency>
               <groupId>de.erethon</groupId>
               <artifactId>itemstacklib</artifactId>
               <version>2.0.1</version>
           </dependency>
       </dependencies>
       <repositories>
           <repository>
               <id>dre-repo</id>
               <url>https://erethon.de/repo/</url>
           </repository>
       </repositories>
    ItemStackLib is a library that developers can shade or copy into their own plugin. This is not a standalone plugin. Shading libraries can be done using Maven and its shade plugin:
    Code (Text):
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-shade-plugin</artifactId>
                    <version>3.1.1</version>
                    <executions>
                        <execution>
                            <phase>package</phase>
                            <goals>
                                <goal>shade</goal>
                            </goals>
                            <configuration>
                                <artifactSet>
                                    <includes>
                                        <include>de.erethon:itemstacklib</include>
                                    </includes>
                                </artifactSet>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    License
    Written in 2018 by Daniel Saukel

    To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide.

    This software is distributed without any warranty.

    You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see http://creativecommons.org/publicdomain/zero/1.0/.

    (tl;dr; do whatever you want with this without asking)

Recent Updates

  1. v2.0.3
  2. Update to 1.13.2
  3. Update to 1.13.2