Fixed block IDs in 1.20.5+

This commit is contained in:
Jules 2024-06-19 17:56:30 -07:00
parent 7f330ae129
commit 63a5fabc56

View File

@ -3,25 +3,24 @@ package net.Indyuce.mmoitems.stat.block;
import net.Indyuce.mmoitems.api.item.build.ItemStackBuilder;
import net.Indyuce.mmoitems.api.util.NumericStatFormula;
import net.Indyuce.mmoitems.stat.data.DoubleData;
import net.Indyuce.mmoitems.stat.data.random.RandomStatData;
import net.Indyuce.mmoitems.stat.data.type.StatData;
import net.Indyuce.mmoitems.stat.type.DoubleStat;
import io.lumine.mythic.lib.api.item.ItemTag;
import org.bukkit.Material;
import org.jetbrains.annotations.NotNull;
public class BlockID extends DoubleStat {
public BlockID() {
super("BLOCK_ID", Material.STONE, "Block ID", new String[] { "This value determines which", "custom block will get placed." }, new String[] { "block" });
super("BLOCK_ID", Material.STONE, "Block ID", new String[]{"This value determines which", "custom block will get placed."}, new String[]{"block"});
}
@Override
public void whenApplied(@NotNull ItemStackBuilder item, @NotNull DoubleData data) {
super.whenApplied(item, data);
item.addItemTag(new ItemTag("CustomModelData", (int) data.getValue() +1000));
item.getMeta().setCustomModelData((int) data.getValue() + 1000);
}
@Override
public void whenPreviewed(@NotNull ItemStackBuilder item, @NotNull DoubleData currentData, @NotNull NumericStatFormula templateData) throws IllegalArgumentException { whenApplied(item, currentData); }
public void whenPreviewed(@NotNull ItemStackBuilder item, @NotNull DoubleData currentData, @NotNull NumericStatFormula templateData) throws IllegalArgumentException {
whenApplied(item, currentData);
}
}