This repository has been archived on 2023-11-26. You can view files and clone it, but cannot push or open issues or pull requests.
ScriptCraft/src/main/java/com/thebrokenrail/scriptcraft/bridge/ItemSettingsBridges.java

29 lines
852 B
Java
Raw Normal View History

2020-04-25 13:33:17 +00:00
package com.thebrokenrail.scriptcraft.bridge;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.util.Rarity;
class ItemSettingsBridges {
static void register() {
Bridges.addBridge("ItemSettings.create", args -> {
Item.Settings settings = new Item.Settings();
settings.maxCount(((Double) args[0]).intValue());
settings.rarity(Rarity.valueOf((String) args[1]));
String selectedGroup = (String) args[2];
if (selectedGroup != null) {
for (ItemGroup group : ItemGroup.GROUPS) {
if (group.getName().equals(selectedGroup)) {
settings.group(group);
break;
}
}
}
return settings;
});
}
}