29 lines
852 B
Java
29 lines
852 B
Java
|
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;
|
||
|
});
|
||
|
}
|
||
|
}
|