Skip to content

Commit

Permalink
Finish custom item builders for melee weapons
Browse files Browse the repository at this point in the history
Also fix some dumb oversights...
  • Loading branch information
IcarussOne committed Aug 8, 2024
1 parent 478be20 commit 61582df
Show file tree
Hide file tree
Showing 14 changed files with 485 additions and 89 deletions.
79 changes: 77 additions & 2 deletions src/main/java/mod/emt/balkonsexpansion/BEItemBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,91 @@
import javax.annotation.Nonnull;

import ckathode.weaponmod.WMItemBuilder;
import ckathode.weaponmod.item.ItemFlail;
import ckathode.weaponmod.item.ItemMelee;
import ckathode.weaponmod.item.ItemMusket;
import ckathode.weaponmod.item.MeleeCompNone;
import mod.emt.balkonsexpansion.item.MeleeCompBattleaxeCustom;
import mod.emt.balkonsexpansion.item.MeleeCompBoomerangCustom;
import mod.emt.balkonsexpansion.item.MeleeCompHalberdCustom;
import mod.emt.balkonsexpansion.item.MeleeCompKatanaCustom;
import mod.emt.balkonsexpansion.item.MeleeCompKnifeCustom;
import mod.emt.balkonsexpansion.item.MeleeCompSpearCustom;
import mod.emt.balkonsexpansion.item.MeleeCompWarhammerCustom;
import net.minecraft.item.Item;

public class BEItemBuilder {
// ==================================================================== //
// Custom builders used to specify a custom attribute amount
// ==================================================================== //
public static ItemMelee createCustomBattleaxe(String id, @Nonnull Item.ToolMaterial material, float knockbackAmount, float ignoreArmorAmount) {
return WMItemBuilder.createItemMelee(BalkonsExpansion.MOD_ID, id, new MeleeCompBattleaxeCustom(material, knockbackAmount, ignoreArmorAmount));
}

public static ItemMelee createCustomBoomerang(String id, @Nonnull Item.ToolMaterial material, float knockbackAmount) {
return WMItemBuilder.createItemMelee(BalkonsExpansion.MOD_ID, id, new MeleeCompBoomerangCustom(material, knockbackAmount));
}

public static ItemMelee createCustomHalberd(String id, @Nonnull Item.ToolMaterial material, float knockbackAmount, float reachAmount) {
return WMItemBuilder.createItemMelee(BalkonsExpansion.MOD_ID, id, new MeleeCompHalberdCustom(material, knockbackAmount, reachAmount));
}

public static ItemMelee createCustomKatana(String id, @Nonnull Item.ToolMaterial material, float knockbackAmount) {
return WMItemBuilder.createItemMelee(BalkonsExpansion.MOD_ID, id, new MeleeCompKatanaCustom(material, knockbackAmount));
}

public static ItemMelee createCustomKnife(String id, @Nonnull Item.ToolMaterial material, float knockbackAmount) {
return WMItemBuilder.createItemMelee(BalkonsExpansion.MOD_ID, id, new MeleeCompKnifeCustom(material, knockbackAmount));
}

public static ItemMusket createCustomMusketBayonet(String id, @Nonnull Item.ToolMaterial material, @Nonnull Item bayonetItem, float knockbackAmount) {
return WMItemBuilder.createItemMusket(BalkonsExpansion.MOD_ID, id, new MeleeCompKnifeCustom(material, knockbackAmount), bayonetItem);
}

public static ItemMelee createCustomSpear(String id, @Nonnull Item.ToolMaterial material, float knockbackAmount, float reachAmount) {
return WMItemBuilder.createItemMelee(BalkonsExpansion.MOD_ID, id, new MeleeCompSpearCustom(material, knockbackAmount, reachAmount));
}

public static ItemMelee createCustomWarhammer(String id, @Nonnull Item.ToolMaterial material, float knockbackAmount) {
return WMItemBuilder.createItemMelee(BalkonsExpansion.MOD_ID, id, new MeleeCompWarhammerCustom(material, knockbackAmount));
}

// ==================================================================== //
// More basic builders that are mainly just used to register the items more easily
// ==================================================================== //
public static ItemMelee createCustomBattleaxe(String id, @Nonnull Item.ToolMaterial material) {
return WMItemBuilder.createItemMelee(BalkonsExpansion.MOD_ID, id, new MeleeCompBattleaxeCustom(material, 0.1F, 1.0F));
}

public static ItemMelee createCustomBattleaxe(String id, @Nonnull Item.ToolMaterial material, float knockbackAmount, float ignoreArmorAmount) {
return WMItemBuilder.createItemMelee(BalkonsExpansion.MOD_ID, id, new MeleeCompBattleaxeCustom(material, knockbackAmount, ignoreArmorAmount));
public static ItemMelee createCustomBoomerang(String id, @Nonnull Item.ToolMaterial material) {
return WMItemBuilder.createItemMelee(BalkonsExpansion.MOD_ID, id, new MeleeCompBoomerangCustom(material, 0.0F));
}

public static ItemFlail createCustomFlail(String id, @Nonnull Item.ToolMaterial material) {
return WMItemBuilder.createItemFlail(BalkonsExpansion.MOD_ID, id, new MeleeCompNone(material));
}

public static ItemMelee createCustomHalberd(String id, @Nonnull Item.ToolMaterial material) {
return WMItemBuilder.createItemMelee(BalkonsExpansion.MOD_ID, id, new MeleeCompHalberdCustom(material, 0.2F, 1.0F));
}

public static ItemMelee createCustomKatana(String id, @Nonnull Item.ToolMaterial material) {
return WMItemBuilder.createItemMelee(BalkonsExpansion.MOD_ID, id, new MeleeCompKatanaCustom(material, -0.4F));
}

public static ItemMelee createCustomKnife(String id, @Nonnull Item.ToolMaterial material) {
return WMItemBuilder.createItemMelee(BalkonsExpansion.MOD_ID, id, new MeleeCompKnifeCustom(material, -0.2F));
}

public static ItemMusket createCustomMusketBayonet(String id, @Nonnull Item.ToolMaterial material, @Nonnull Item bayonetItem) {
return WMItemBuilder.createItemMusket(BalkonsExpansion.MOD_ID, id, new MeleeCompKnifeCustom(material, -0.2F), bayonetItem);
}

public static ItemMelee createCustomSpear(String id, @Nonnull Item.ToolMaterial material) {
return WMItemBuilder.createItemMelee(BalkonsExpansion.MOD_ID, id, new MeleeCompSpearCustom(material, -0.2F, 1.0F));
}

public static ItemMelee createCustomWarhammer(String id, @Nonnull Item.ToolMaterial material) {
return WMItemBuilder.createItemMelee(BalkonsExpansion.MOD_ID, id, new MeleeCompWarhammerCustom(material, 0.3F));
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package mod.emt.balkonsexpansion.compat.galacticraft;

import ckathode.weaponmod.WMItemBuilder;
import ckathode.weaponmod.item.ItemFlail;
import ckathode.weaponmod.item.ItemMelee;
import ckathode.weaponmod.item.ItemMusket;
Expand All @@ -11,7 +10,6 @@
import mod.emt.balkonsexpansion.BEItemBuilder;
import mod.emt.balkonsexpansion.BERecipes;
import mod.emt.balkonsexpansion.BERegistry;
import mod.emt.balkonsexpansion.BalkonsExpansion;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
Expand Down Expand Up @@ -54,39 +52,39 @@ public static void registerItems(RegistryEvent.Register<Item> event) {
IForgeRegistry<Item> registry = event.getRegistry();

if (BEConfig.galacticraft_settings.GC_HEAVY_DUTY_MATERIAL) {
registry.register(spearHeavyDuty = WMItemBuilder.createStandardSpear(BalkonsExpansion.MOD_ID, "spear.heavy_duty", GCItems.TOOL_STEEL));
registry.register(halberdHeavyDuty = WMItemBuilder.createStandardHalberd(BalkonsExpansion.MOD_ID, "halberd.heavy_duty", GCItems.TOOL_STEEL));
registry.register(spearHeavyDuty = BEItemBuilder.createCustomSpear("spear.heavy_duty", GCItems.TOOL_STEEL));
registry.register(halberdHeavyDuty = BEItemBuilder.createCustomHalberd("halberd.heavy_duty", GCItems.TOOL_STEEL));
registry.register(battleaxeHeavyDuty = BEItemBuilder.createCustomBattleaxe("battleaxe.heavy_duty", GCItems.TOOL_STEEL, 0.2F, 1.0F));
registry.register(knifeHeavyDuty = WMItemBuilder.createStandardKnife(BalkonsExpansion.MOD_ID, "knife.heavy_duty", GCItems.TOOL_STEEL));
registry.register(warhammerHeavyDuty = WMItemBuilder.createStandardWarhammer(BalkonsExpansion.MOD_ID, "warhammer.heavy_duty", GCItems.TOOL_STEEL));
registry.register(flailHeavyDuty = WMItemBuilder.createStandardFlail(BalkonsExpansion.MOD_ID, "flail.heavy_duty", GCItems.TOOL_STEEL));
registry.register(katanaHeavyDuty = WMItemBuilder.createStandardKatana(BalkonsExpansion.MOD_ID, "katana.heavy_duty", GCItems.TOOL_STEEL));
registry.register(boomerangHeavyDuty = WMItemBuilder.createStandardBoomerang(BalkonsExpansion.MOD_ID, "boomerang.heavy_duty", GCItems.TOOL_STEEL));
registry.register(bayonetHeavyDuty = WMItemBuilder.createStandardMusketWithBayonet(BalkonsExpansion.MOD_ID, "musketbayonet.heavy_duty", GCItems.TOOL_STEEL, knifeHeavyDuty));
registry.register(knifeHeavyDuty = BEItemBuilder.createCustomKnife("knife.heavy_duty", GCItems.TOOL_STEEL));
registry.register(warhammerHeavyDuty = BEItemBuilder.createCustomWarhammer("warhammer.heavy_duty", GCItems.TOOL_STEEL));
registry.register(flailHeavyDuty = BEItemBuilder.createCustomFlail("flail.heavy_duty", GCItems.TOOL_STEEL));
registry.register(katanaHeavyDuty = BEItemBuilder.createCustomKatana("katana.heavy_duty", GCItems.TOOL_STEEL));
registry.register(boomerangHeavyDuty = BEItemBuilder.createCustomBoomerang("boomerang.heavy_duty", GCItems.TOOL_STEEL));
registry.register(bayonetHeavyDuty = BEItemBuilder.createCustomMusketBayonet("musketbayonet.heavy_duty", GCItems.TOOL_STEEL, knifeHeavyDuty));
}

if (BEConfig.galacticraft_settings.GC_DESH_MATERIAL) {
registry.register(spearDesh = WMItemBuilder.createStandardSpear(BalkonsExpansion.MOD_ID, "spear.desh", MarsItems.TOOLDESH));
registry.register(halberdDesh = WMItemBuilder.createStandardHalberd(BalkonsExpansion.MOD_ID, "halberd.desh", MarsItems.TOOLDESH));
registry.register(spearDesh = BEItemBuilder.createCustomSpear("spear.desh", MarsItems.TOOLDESH));
registry.register(halberdDesh = BEItemBuilder.createCustomHalberd("halberd.desh", MarsItems.TOOLDESH));
registry.register(battleaxeDesh = BEItemBuilder.createCustomBattleaxe("battleaxe.desh", MarsItems.TOOLDESH, 0.3F, 1.0F));
registry.register(knifeDesh = WMItemBuilder.createStandardKnife(BalkonsExpansion.MOD_ID, "knife.desh", MarsItems.TOOLDESH));
registry.register(warhammerDesh = WMItemBuilder.createStandardWarhammer(BalkonsExpansion.MOD_ID, "warhammer.desh", MarsItems.TOOLDESH));
registry.register(flailDesh = WMItemBuilder.createStandardFlail(BalkonsExpansion.MOD_ID, "flail.desh", MarsItems.TOOLDESH));
registry.register(katanaDesh = WMItemBuilder.createStandardKatana(BalkonsExpansion.MOD_ID, "katana.desh", MarsItems.TOOLDESH));
registry.register(boomerangDesh = WMItemBuilder.createStandardBoomerang(BalkonsExpansion.MOD_ID, "boomerang.desh", MarsItems.TOOLDESH));
registry.register(bayonetDesh = WMItemBuilder.createStandardMusketWithBayonet(BalkonsExpansion.MOD_ID, "musketbayonet.desh", MarsItems.TOOLDESH, knifeDesh));
registry.register(knifeDesh = BEItemBuilder.createCustomKnife("knife.desh", MarsItems.TOOLDESH));
registry.register(warhammerDesh = BEItemBuilder.createCustomWarhammer("warhammer.desh", MarsItems.TOOLDESH));
registry.register(flailDesh = BEItemBuilder.createCustomFlail("flail.desh", MarsItems.TOOLDESH));
registry.register(katanaDesh = BEItemBuilder.createCustomKatana("katana.desh", MarsItems.TOOLDESH));
registry.register(boomerangDesh = BEItemBuilder.createCustomBoomerang("boomerang.desh", MarsItems.TOOLDESH));
registry.register(bayonetDesh = BEItemBuilder.createCustomMusketBayonet("musketbayonet.desh", MarsItems.TOOLDESH, knifeDesh));
}

if (BEConfig.galacticraft_settings.GC_TITANIUM_MATERIAL) {
registry.register(spearTitanium = WMItemBuilder.createStandardSpear(BalkonsExpansion.MOD_ID, "spear.titanium", AsteroidsItems.TOOL_TITANIUM));
registry.register(halberdTitanium = WMItemBuilder.createStandardHalberd(BalkonsExpansion.MOD_ID, "halberd.titanium", AsteroidsItems.TOOL_TITANIUM));
registry.register(spearTitanium = BEItemBuilder.createCustomSpear("spear.titanium", AsteroidsItems.TOOL_TITANIUM));
registry.register(halberdTitanium = BEItemBuilder.createCustomHalberd("halberd.titanium", AsteroidsItems.TOOL_TITANIUM));
registry.register(battleaxeTitanium = BEItemBuilder.createCustomBattleaxe("battleaxe.titanium", AsteroidsItems.TOOL_TITANIUM, 0.45F, 1.0F));
registry.register(knifeTitanium = WMItemBuilder.createStandardKnife(BalkonsExpansion.MOD_ID, "knife.titanium", AsteroidsItems.TOOL_TITANIUM));
registry.register(warhammerTitanium = WMItemBuilder.createStandardWarhammer(BalkonsExpansion.MOD_ID, "warhammer.titanium", AsteroidsItems.TOOL_TITANIUM));
registry.register(flailTitanium = WMItemBuilder.createStandardFlail(BalkonsExpansion.MOD_ID, "flail.titanium", AsteroidsItems.TOOL_TITANIUM));
registry.register(katanaTitanium = WMItemBuilder.createStandardKatana(BalkonsExpansion.MOD_ID, "katana.titanium", AsteroidsItems.TOOL_TITANIUM));
registry.register(boomerangTitanium = WMItemBuilder.createStandardBoomerang(BalkonsExpansion.MOD_ID, "boomerang.titanium", AsteroidsItems.TOOL_TITANIUM));
registry.register(bayonetTitanium = WMItemBuilder.createStandardMusketWithBayonet(BalkonsExpansion.MOD_ID, "musketbayonet.titanium", AsteroidsItems.TOOL_TITANIUM, knifeTitanium));
registry.register(knifeTitanium = BEItemBuilder.createCustomKnife("knife.titanium", AsteroidsItems.TOOL_TITANIUM));
registry.register(warhammerTitanium = BEItemBuilder.createCustomWarhammer("warhammer.titanium", AsteroidsItems.TOOL_TITANIUM));
registry.register(flailTitanium = BEItemBuilder.createCustomFlail("flail.titanium", AsteroidsItems.TOOL_TITANIUM));
registry.register(katanaTitanium = BEItemBuilder.createCustomKatana("katana.titanium", AsteroidsItems.TOOL_TITANIUM));
registry.register(boomerangTitanium = BEItemBuilder.createCustomBoomerang("boomerang.titanium", AsteroidsItems.TOOL_TITANIUM));
registry.register(bayonetTitanium = BEItemBuilder.createCustomMusketBayonet("musketbayonet.titanium", AsteroidsItems.TOOL_TITANIUM, knifeTitanium));
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package mod.emt.balkonsexpansion.compat.ic2classic;

import ckathode.weaponmod.WMItemBuilder;
import ckathode.weaponmod.item.ItemFlail;
import ckathode.weaponmod.item.ItemMelee;
import ckathode.weaponmod.item.ItemMusket;
Expand All @@ -9,8 +8,6 @@
import mod.emt.balkonsexpansion.BEItemBuilder;
import mod.emt.balkonsexpansion.BERecipes;
import mod.emt.balkonsexpansion.BERegistry;
import mod.emt.balkonsexpansion.BalkonsExpansion;
import mods.railcraft.common.items.ItemMaterials;
import net.minecraft.item.Item;
import net.minecraft.item.crafting.IRecipe;
import net.minecraftforge.event.RegistryEvent;
Expand All @@ -34,15 +31,15 @@ public static void registerItems(RegistryEvent.Register<Item> event) {
IForgeRegistry<Item> registry = event.getRegistry();

if (BEConfig.ic2_classic_settings.IC2C_BRONZE_MATERIAL) {
registry.register(spearBronze = WMItemBuilder.createStandardSpear(BalkonsExpansion.MOD_ID, "spear.bronze.ic2c", ToolHelper.bronzeToolMaterial));
registry.register(halberdBronze = WMItemBuilder.createStandardHalberd(BalkonsExpansion.MOD_ID, "halberd.bronze.ic2c", ToolHelper.bronzeToolMaterial));
registry.register(spearBronze = BEItemBuilder.createCustomSpear("spear.bronze.ic2c", ToolHelper.bronzeToolMaterial));
registry.register(halberdBronze = BEItemBuilder.createCustomHalberd("halberd.bronze.ic2c", ToolHelper.bronzeToolMaterial));
registry.register(battleaxeBronze = BEItemBuilder.createCustomBattleaxe("battleaxe.bronze.ic2c", ToolHelper.bronzeToolMaterial, 0.2F, 1.0F));
registry.register(knifeBronze = WMItemBuilder.createStandardKnife(BalkonsExpansion.MOD_ID, "knife.bronze.ic2c", ItemMaterials.STEEL_TOOL));
registry.register(warhammerBronze = WMItemBuilder.createStandardWarhammer(BalkonsExpansion.MOD_ID, "warhammer.bronze.ic2c", ToolHelper.bronzeToolMaterial));
registry.register(flailBronze = WMItemBuilder.createStandardFlail(BalkonsExpansion.MOD_ID, "flail.bronze.ic2c", ToolHelper.bronzeToolMaterial));
registry.register(katanaBronze = WMItemBuilder.createStandardKatana(BalkonsExpansion.MOD_ID, "katana.bronze.ic2c", ToolHelper.bronzeToolMaterial));
registry.register(boomerangBronze = WMItemBuilder.createStandardBoomerang(BalkonsExpansion.MOD_ID, "boomerang.bronze.ic2c", ToolHelper.bronzeToolMaterial));
registry.register(bayonetBronze = WMItemBuilder.createStandardMusketWithBayonet(BalkonsExpansion.MOD_ID, "musketbayonet.bronze.ic2c", ToolHelper.bronzeToolMaterial, knifeBronze));
registry.register(knifeBronze = BEItemBuilder.createCustomKnife("knife.bronze.ic2c", ToolHelper.bronzeToolMaterial));
registry.register(warhammerBronze = BEItemBuilder.createCustomWarhammer("warhammer.bronze.ic2c", ToolHelper.bronzeToolMaterial));
registry.register(flailBronze = BEItemBuilder.createCustomFlail("flail.bronze.ic2c", ToolHelper.bronzeToolMaterial));
registry.register(katanaBronze = BEItemBuilder.createCustomKatana("katana.bronze.ic2c", ToolHelper.bronzeToolMaterial));
registry.register(boomerangBronze = BEItemBuilder.createCustomBoomerang("boomerang.bronze.ic2c", ToolHelper.bronzeToolMaterial));
registry.register(bayonetBronze = BEItemBuilder.createCustomMusketBayonet("musketbayonet.bronze.ic2c", ToolHelper.bronzeToolMaterial, knifeBronze));
}
}

Expand Down
Loading

0 comments on commit 61582df

Please sign in to comment.