use of io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems in project Slimefun4 by Slimefun.
the class CustomTextureService method register.
/**
* This method registers the given {@link SlimefunItem SlimefunItems} to this {@link CustomTextureService}.
* If saving is enabled, it will save them to the {@link Config} file.
*
* @param items
* The {@link SlimefunItem SlimefunItems} to register
* @param save
* Whether to save this file
*/
public void register(@Nonnull Collection<SlimefunItem> items, boolean save) {
Validate.notEmpty(items, "items must neither be null or empty.");
loadDefaultValues();
for (SlimefunItem item : items) {
if (item != null) {
config.setDefaultValue(item.getId(), 0);
if (config.getInt(item.getId()) != 0) {
modified = true;
}
}
}
version = config.getString("version");
if (save) {
config.save();
}
}
use of io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems in project Slimefun4 by Slimefun.
the class SlimefunItemsProvider method getAsItemStack.
private ItemStack getAsItemStack(String fieldName) {
Class<SlimefunItems> clazz = SlimefunItems.class;
Field field;
try {
field = clazz.getField(fieldName);
return (ItemStack) field.get(null);
} catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
throw new IllegalArgumentException("Could not find field SlimefunItems." + fieldName);
}
}
Aggregations