Merge conflict 1

This commit is contained in:
Steven Tracey 2022-08-03 09:31:41 -04:00
parent 6b1b1646a3
commit 09c81a117a
2 changed files with 42 additions and 0 deletions

View File

@ -0,0 +1,20 @@
package tech.nevets.vplus.items;
import net.fabricmc.fabric.api.registry.FuelRegistry;
import net.minecraft.item.ItemConvertible;
import tech.nevets.vplus.blocks.VPBlocks;
public class VPFuels {
public VPFuels() {}
static {
register(VPBlocks.SATURATED_LAVA_SPONGE_BLOCK, 20000);
}
private static void register(ItemConvertible fuel, int duration) {
FuelRegistry.INSTANCE.add(fuel, duration);
}
public static void init() {}
}

View File

@ -1,10 +1,14 @@
package tech.nevets.vplus.items;
import net.minecraft.item.Item;
import net.minecraft.item.ToolItem;
import net.minecraft.item.ToolMaterial;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import tech.nevets.vplus.items.tools.*;
import java.lang.reflect.InvocationTargetException;
public class VPTools {
public VPTools() {}
@ -25,5 +29,23 @@ public class VPTools {
Registry.register(Registry.ITEM, new Identifier("vplus", material.getName() + "_sword"), new SwordBase(material, new Item.Settings()));
}
private static void register(VPMaterials material, Class<? extends ToolItem> T, String toolName) {
try {
Registry.register(Registry.ITEM, new Identifier("vplus", material.getName() + "_" + toolName), T.getConstructor(ToolMaterial.class, Item.Settings.class).newInstance(material, new Item.Settings().group(VPItemGroups.TOOLS)));
} catch (InvocationTargetException | InstantiationException | IllegalAccessException | NoSuchMethodException e) {
e.printStackTrace();
}
}
private static void registerAll(VPMaterials[] materials, Class<? extends ToolItem> T, String toolName) {
for (VPMaterials material : materials) {
try {
Registry.register(Registry.ITEM, new Identifier("vplus", material.getName() + "_" + toolName), T.getConstructor(ToolMaterial.class, Item.Settings.class).newInstance(material, new Item.Settings().group(VPItemGroups.TOOLS)));
} catch (InvocationTargetException | InstantiationException | IllegalAccessException | NoSuchMethodException e) {
e.printStackTrace();
}
}
}
public static void init() {}
}