Skip to content

Commit

Permalink
Add IC2 Experimental Bronze compat
Browse files Browse the repository at this point in the history
  • Loading branch information
IcarussOne committed Nov 22, 2024
1 parent dde17a2 commit 7d2a42d
Show file tree
Hide file tree
Showing 24 changed files with 532 additions and 22 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ ___
- Desh
- Heavy Duty
- Titanium
- **IC2 Classic:**
- **IndustrialCraft 2 (Classic and Experimental):**
- Bronze
- **Project Red Exploration:**
- Peridot
Expand All @@ -29,3 +29,4 @@ ___
- Steel
- **Thaumcraft:**
- Thaumium
- Void
8 changes: 5 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,15 @@ dependencies {
}

// Balkon's WeaponMod Legacy
implementation rfg.deobf('curse.maven:balkons-weaponmod-legacy-1033985:5600030')
implementation rfg.deobf('curse.maven:balkons-weaponmod-legacy-1033985:5853367')
// Galacticraft Legacy
implementation rfg.deobf('curse.maven:galacticraft-legacy-564236:4671122')
// IC2 Classic
implementation rfg.deobf('curse.maven:ic2-classic-242942:5554368')
implementation rfg.deobf('curse.maven:ic2-classic-242942:5800761')
// IC2 Experimental
implementation rfg.deobf('curse.maven:industrial-craft-242638:3838713')
// Mo' Creatures Extended
implementation rfg.deobf('curse.maven:mo-creatures-extended-867351:5393397')
implementation rfg.deobf('curse.maven:mo-creatures-extended-867351:5654788')
// Project Red
compileOnly 'curse.maven:codechickenlib-242818:2779848'
compileOnly 'curse.maven:mrtjpcore-229002:2735197'
Expand Down
18 changes: 9 additions & 9 deletions src/main/java/mod/emt/balkonsexpansion/BEConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ public class BEConfig {
@Config.Comment("Galacticraft Legacy")
public static GalacticraftSettings galacticraft_settings = new GalacticraftSettings();

@Config.Comment("Industrial Craft 2 Classic")
public static IC2ClassicSettings ic2_classic_settings = new IC2ClassicSettings();
@Config.Comment("IndustrialCraft 2")
public static IC2Settings ic2_settings = new IC2Settings();

@Config.Comment("Project Red Exploration")
public static ProjectRedSettings project_red_settings = new ProjectRedSettings();
Expand Down Expand Up @@ -47,10 +47,10 @@ public static class ModIntegrationSettings {
@Config.RequiresMcRestart
public boolean GALACTICRAFT_INTEGRATION = true;

@Config.Name("Industrial Craft 2 Classic")
@Config.Comment("Enables Industrial Craft 2 Classic integration [default: true]")
@Config.Name("IndustrialCraft 2")
@Config.Comment("Enables IndustrialCraft 2 Classic and IndustrialCraft 2 Experimental integration [default: true]")
@Config.RequiresMcRestart
public boolean IC2_CLASSIC_INTEGRATION = true;
public boolean IC2_INTEGRATION = true;

@Config.Name("Project Red Exploration")
@Config.Comment("Enables Project Red Exploration integration [default: true]")
Expand Down Expand Up @@ -85,11 +85,11 @@ public static class GalacticraftSettings {
public boolean GC_TITANIUM_MATERIAL = true;
}

public static class IC2ClassicSettings {
@Config.Name("Material: Bronze (IC2 Classic)")
@Config.Comment("Enables support for the Bronze material from IC2 Classic [default: true]")
public static class IC2Settings {
@Config.Name("Material: Bronze (IC2 Classic and IC2 Experimental)")
@Config.Comment("Enables support for the Bronze material from IC2 Classic and IC2 Experimental [default: true]")
@Config.RequiresWorldRestart
public boolean IC2C_BRONZE_MATERIAL = true;
public boolean IC2_BRONZE_MATERIAL = true;
}

public static class ProjectRedSettings {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class BalkonsExpansion {
public static final String NAME = "Balkon's Expansion";
public static final String VERSION = Tags.VERSION;
public static final String ACCEPTED_VERSIONS = "[1.12.2]";
public static final String DEPENDENCIES = "required-after:weaponmod@[1.22.1,);after:galacticraftcore;after:galacticraftplanets;after:ic2-classic-spmod;after:mocreatures@[12.4.3,);after:railcraft;"
public static final String DEPENDENCIES = "required-after:weaponmod@[1.22.1,);after:galacticraftcore;after:galacticraftplanets;after:ic2;after:mocreatures@[12.4.3,);after:railcraft;"
+ "after:projectred-exploration;after:thaumcraft@[1.12.2-6.1.BETA26,);";
public static final Logger LOGGER = LogManager.getLogger(NAME);

Expand Down
28 changes: 24 additions & 4 deletions src/main/java/mod/emt/balkonsexpansion/compat/CompatHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import mod.emt.balkonsexpansion.compat.galacticraft.GalacticraftRegistration;
import mod.emt.balkonsexpansion.compat.ic2classic.IC2ClassicMaterialColors;
import mod.emt.balkonsexpansion.compat.ic2classic.IC2ClassicRegistration;
import mod.emt.balkonsexpansion.compat.ic2experimental.IC2ExperimentalMaterialColors;
import mod.emt.balkonsexpansion.compat.ic2experimental.IC2ExperimentalRegistration;
import mod.emt.balkonsexpansion.compat.projectred.ProjectRedMaterialColors;
import mod.emt.balkonsexpansion.compat.projectred.ProjectRedRegistration;
import mod.emt.balkonsexpansion.compat.railcraft.RailcraftMaterialColors;
Expand Down Expand Up @@ -37,24 +39,37 @@ public static void registerItems(RegistryEvent.Register<Item> event) {
if (Loader.isModLoaded("galacticraftcore") && (Loader.isModLoaded("galacticraftplanets") && BEConfig.mod_integration_settings.GALACTICRAFT_INTEGRATION)) {
GalacticraftRegistration.registerItems(event);
GalacticraftMaterialColors.registerMaterialColors();

if (FMLLaunchHandler.side().isClient()) {
GalacticraftRegistration.registerRenderersItem();
}
}

// Industrial Craft 2 Classic
if (Loader.isModLoaded("ic2-classic-spmod") && BEConfig.mod_integration_settings.IC2_CLASSIC_INTEGRATION) {
// IndustrialCraft 2 Classic
if (Loader.isModLoaded("ic2-classic-spmod") && BEConfig.mod_integration_settings.IC2_INTEGRATION) {
IC2ClassicRegistration.registerItems(event);
IC2ClassicMaterialColors.registerMaterialColors();

if (FMLLaunchHandler.side().isClient()) {
IC2ClassicRegistration.registerRenderersItem();
}
}

// IndustrialCraft 2 Experimental
if (Loader.isModLoaded("ic2") && !Loader.isModLoaded("ic2-classic-spmod") && BEConfig.mod_integration_settings.IC2_INTEGRATION) {
IC2ExperimentalRegistration.registerItems(event);
IC2ExperimentalMaterialColors.registerMaterialColors();

if (FMLLaunchHandler.side().isClient()) {
IC2ExperimentalRegistration.registerRenderersItem();
}
}

// Project Red
if (Loader.isModLoaded("projectred-exploration") && BEConfig.mod_integration_settings.PROJECT_RED_INTEGRATION) {
ProjectRedRegistration.registerItems(event);
ProjectRedMaterialColors.registerMaterialColors();

if (FMLLaunchHandler.side().isClient()) {
ProjectRedRegistration.registerRenderersItem();
}
Expand All @@ -64,6 +79,7 @@ public static void registerItems(RegistryEvent.Register<Item> event) {
if (Loader.isModLoaded("railcraft") && BEConfig.mod_integration_settings.RAILCRAFT_INTEGRATION) {
RailcraftRegistration.registerItems(event);
RailcraftMaterialColors.registerMaterialColors();

if (FMLLaunchHandler.side().isClient()) {
RailcraftRegistration.registerRenderersItem();
}
Expand All @@ -73,6 +89,7 @@ public static void registerItems(RegistryEvent.Register<Item> event) {
if (Loader.isModLoaded("thaumcraft") && BEConfig.mod_integration_settings.THAUMCRAFT_INTEGRATION) {
ThaumcraftRegistration.registerItems(event);
ThaumcraftMaterialColors.registerMaterialColors();

if (FMLLaunchHandler.side().isClient()) {
ThaumcraftRegistration.registerRenderersItem();
}
Expand All @@ -84,9 +101,12 @@ public static void registerRecipes(RegistryEvent.Register<IRecipe> event) {
// Galacticraft Legacy
if (Loader.isModLoaded("galacticraftcore") && (Loader.isModLoaded("galacticraftplanets") && BEConfig.mod_integration_settings.GALACTICRAFT_INTEGRATION))
GalacticraftRegistration.registerRecipes(event);
// Industrial Craft 2 Classic
if (Loader.isModLoaded("ic2-classic-spmod") && BEConfig.mod_integration_settings.IC2_CLASSIC_INTEGRATION)
// IndustrialCraft 2 Classic
if (Loader.isModLoaded("ic2-classic-spmod") && BEConfig.mod_integration_settings.IC2_INTEGRATION)
IC2ClassicRegistration.registerRecipes(event);
// IndustrialCraft 2 Experimental
if (Loader.isModLoaded("ic2") && !Loader.isModLoaded("ic2-classic-spmod") && BEConfig.mod_integration_settings.IC2_INTEGRATION)
IC2ExperimentalRegistration.registerRecipes(event);
// Project Red
if (Loader.isModLoaded("projectred-exploration") && BEConfig.mod_integration_settings.PROJECT_RED_INTEGRATION)
ProjectRedRegistration.registerRecipes(event);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class IC2ClassicRegistration {
public static void registerItems(RegistryEvent.Register<Item> event) {
IForgeRegistry<Item> registry = event.getRegistry();

if (BEConfig.ic2_classic_settings.IC2C_BRONZE_MATERIAL) {
if (BEConfig.ic2_settings.IC2_BRONZE_MATERIAL) {
registry.register(spearBronze = BEItemBuilder.createCustomSpear("spear.bronze.ic2c", ToolHelper.bronzeToolMaterial, -0.15F, 1.0F));
registry.register(halberdBronze = BEItemBuilder.createCustomHalberd("halberd.bronze.ic2c", ToolHelper.bronzeToolMaterial, 0.4F, 1.0F));
registry.register(battleaxeBronze = BEItemBuilder.createCustomBattleaxe("battleaxe.bronze.ic2c", ToolHelper.bronzeToolMaterial, 0.25F, 1.0F));
Expand All @@ -47,7 +47,7 @@ public static void registerItems(RegistryEvent.Register<Item> event) {
public static void registerRecipes(RegistryEvent.Register<IRecipe> event) {
IForgeRegistry<IRecipe> registry = event.getRegistry();

if (BEConfig.ic2_classic_settings.IC2C_BRONZE_MATERIAL) {
if (BEConfig.ic2_settings.IC2_BRONZE_MATERIAL) {
registry.register(BERecipes.registerBattleaxeRecipe("ingotBronze", "stickWood", battleaxeBronze));
registry.register(BERecipes.registerBoomerangRecipe("ingotBronze", "plankWood", boomerangBronze));
registry.register(BERecipes.registerBayonetRecipe(knifeBronze, bayonetBronze));
Expand All @@ -65,7 +65,7 @@ public static void registerRecipes(RegistryEvent.Register<IRecipe> event) {

@SideOnly(Side.CLIENT)
public static void registerRenderersItem() {
if (BEConfig.ic2_classic_settings.IC2C_BRONZE_MATERIAL) {
if (BEConfig.ic2_settings.IC2_BRONZE_MATERIAL) {
BERegistry.registerWeaponItemModel(battleaxeBronze);
BERegistry.registerWeaponItemModel(boomerangBronze);
BERegistry.registerWeaponItemModel(bayonetBronze);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package mod.emt.balkonsexpansion.compat.ic2experimental;

import ckathode.weaponmod.entity.projectile.ICustomProjectileMaterials;
import ckathode.weaponmod.entity.projectile.MaterialRegistry;
import ckathode.weaponmod.item.IItemWeapon;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraft.item.ItemStack;

// Some entities of BWM: Legacy such as flails can change their color, which is what this is used for.
public class IC2ExperimentalMaterialColors {
public static final int MATERIAL_BRONZE = ToolMaterial.valueOf("IC2_BRONZE").ordinal();

public static void registerMaterialColors() {
MaterialRegistry.registerCustomProjectileMaterial(new ICustomProjectileMaterials() {
@Override
public int[] getAllMaterialIDs() {
return new int[]{MATERIAL_BRONZE};
}

@Override
public int getMaterialID(ItemStack itemStack) {
if (itemStack != null && itemStack.getItem() instanceof IItemWeapon) {
IItemWeapon weapon = ((IItemWeapon) itemStack.getItem());

if (weapon.getMeleeComponent() != null) {
if (weapon.getMeleeComponent().weaponMaterial == ToolMaterial.valueOf("IC2_BRONZE"))
return MATERIAL_BRONZE;
}
}

return -1;
}

@Override
public float[] getColorFromMaterialID(int i) {
// The color for the given item tier must be returned as
// {R,G,B}, where each value is between 0 and 1.
if (i == MATERIAL_BRONZE) return new float[]{0.78F, 0.345F, 0.173F};

return null;
}
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
package mod.emt.balkonsexpansion.compat.ic2experimental;

import mod.emt.balkonsexpansion.BEConfig;
import mod.emt.balkonsexpansion.BEItemBuilder;
import mod.emt.balkonsexpansion.BERecipes;
import mod.emt.balkonsexpansion.BERegistry;
import mod.emt.balkonsexpansion.item.BEItemFlail;
import mod.emt.balkonsexpansion.item.BEItemMelee;
import mod.emt.balkonsexpansion.item.BEItemMusket;
import net.minecraft.item.Item;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraft.item.crafting.IRecipe;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.registries.IForgeRegistry;

public class IC2ExperimentalRegistration {
public static BEItemMelee battleaxeBronze;
public static BEItemMelee boomerangBronze;
public static BEItemMusket bayonetBronze;
public static BEItemFlail flailBronze;
public static BEItemMelee halberdBronze;
public static BEItemMelee katanaBronze;
public static BEItemMelee knifeBronze;
public static BEItemMelee spearBronze;
public static BEItemMelee warhammerBronze;

public static void registerItems(RegistryEvent.Register<Item> event) {
IForgeRegistry<Item> registry = event.getRegistry();

if (BEConfig.ic2_settings.IC2_BRONZE_MATERIAL) {
registry.register(spearBronze = BEItemBuilder.createCustomSpear("spear.bronze.ic2e", ToolMaterial.valueOf("IC2_BRONZE"), -0.15F, 1.0F));
registry.register(halberdBronze = BEItemBuilder.createCustomHalberd("halberd.bronze.ic2e", ToolMaterial.valueOf("IC2_BRONZE"), 0.4F, 1.0F));
registry.register(battleaxeBronze = BEItemBuilder.createCustomBattleaxe("battleaxe.bronze.ic2e", ToolMaterial.valueOf("IC2_BRONZE"), 0.25F, 1.0F));
registry.register(knifeBronze = BEItemBuilder.createCustomKnife("knife.bronze.ic2e", ToolMaterial.valueOf("IC2_BRONZE"), -0.15F));
registry.register(warhammerBronze = BEItemBuilder.createCustomWarhammer("warhammer.bronze.ic2e", ToolMaterial.valueOf("IC2_BRONZE"), 0.55F));
registry.register(flailBronze = BEItemBuilder.createCustomFlail("flail.bronze.ic2e", ToolMaterial.valueOf("IC2_BRONZE")));
registry.register(katanaBronze = BEItemBuilder.createCustomKatana("katana.bronze.ic2e", ToolMaterial.valueOf("IC2_BRONZE")));
registry.register(boomerangBronze = BEItemBuilder.createCustomBoomerang("boomerang.bronze.ic2e", ToolMaterial.valueOf("IC2_BRONZE"), 0.1F));
registry.register(bayonetBronze = BEItemBuilder.createCustomMusketBayonet("musketbayonet.bronze.ic2e", ToolMaterial.valueOf("IC2_BRONZE"), knifeBronze, -0.15F));
}
}

@SubscribeEvent
public static void registerRecipes(RegistryEvent.Register<IRecipe> event) {
IForgeRegistry<IRecipe> registry = event.getRegistry();

if (BEConfig.ic2_settings.IC2_BRONZE_MATERIAL) {
registry.register(BERecipes.registerBattleaxeRecipe("ingotBronze", "stickWood", battleaxeBronze));
registry.register(BERecipes.registerBoomerangRecipe("ingotBronze", "plankWood", boomerangBronze));
registry.register(BERecipes.registerBayonetRecipe(knifeBronze, bayonetBronze));
registry.register(BERecipes.registerFlailRecipe("ingotBronze", "stickWood", "string", flailBronze));
registry.register(BERecipes.registerHalberdRecipe("ingotBronze", "stickWood", halberdBronze));
registry.register(BERecipes.registerKatanaRecipe("ingotBronze", "stickWood", katanaBronze));
registry.register(BERecipes.registerKnifeRecipe("ingotBronze", "stickWood", knifeBronze));
registry.register(BERecipes.registerKnifeAltRecipe("ingotBronze", "stickWood", knifeBronze));
registry.register(BERecipes.registerSpearRecipe("ingotBronze", "stickWood", spearBronze));
registry.register(BERecipes.registerWarhammerRecipe("ingotBronze", "stickWood", warhammerBronze));
}

// IC2 Classic tools have no smelting recipes so none needs to be added.
}

@SideOnly(Side.CLIENT)
public static void registerRenderersItem() {
if (BEConfig.ic2_settings.IC2_BRONZE_MATERIAL) {
BERegistry.registerWeaponItemModel(battleaxeBronze);
BERegistry.registerWeaponItemModel(boomerangBronze);
BERegistry.registerWeaponItemModel(bayonetBronze);
BERegistry.registerWeaponItemModel(flailBronze);
BERegistry.registerWeaponItemModel(halberdBronze);
BERegistry.registerWeaponItemModel(katanaBronze);
BERegistry.registerWeaponItemModel(knifeBronze);
BERegistry.registerWeaponItemModel(spearBronze);
BERegistry.registerWeaponItemModel(warhammerBronze);
}
}
}
13 changes: 12 additions & 1 deletion src/main/resources/assets/balkonsexpansion/lang/en_us.lang
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ item.warhammer.desh.name=Desh Warhammer
item.warhammer.heavy_duty.name=Heavy Duty Warhammer
item.warhammer.titanium.name=Titanium Warhammer

# Industrial Craft 2 Classic
# IndustrialCraft 2 Classic
item.battleaxe.bronze.ic2c.name=Bronze Battleaxe
item.boomerang.bronze.ic2c.name=Bronze Boomerang
item.flail.bronze.ic2c.name=Bronze Flail
Expand All @@ -38,6 +38,17 @@ item.musketbayonet.bronze.ic2c.name=Musket with Bronze Bayonet
item.spear.bronze.ic2c.name=Bronze Spear
item.warhammer.bronze.ic2c.name=Bronze Warhammer

# IndustrialCraft 2 Experimental
item.battleaxe.bronze.ic2e.name=Bronze Battleaxe
item.boomerang.bronze.ic2e.name=Bronze Boomerang
item.flail.bronze.ic2e.name=Bronze Flail
item.halberd.bronze.ic2e.name=Bronze Halberd
item.katana.bronze.ic2e.name=Bronze Katana
item.knife.bronze.ic2e.name=Bronze Knife
item.musketbayonet.bronze.ic2e.name=Musket with Bronze Bayonet
item.spear.bronze.ic2e.name=Bronze Spear
item.warhammer.bronze.ic2e.name=Bronze Warhammer

# Mo' Creatures Extended
item.battleaxe.ancient_silver.name=Ancient Silver Battleaxe
item.battleaxe.dark_scorpion.name=Dark Scorpion Battleaxe
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "weaponmod:item/handheld_block",
"textures": {
"layer0": "balkonsexpansion:ic2/items/battleaxe.bronze"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"parent": "item/handheld",
"textures": {
"layer0": "balkonsexpansion:ic2/items/battleaxe.bronze"
},
"overrides": [
{
"predicate": {
"weaponmod:block": 1
},
"model": "balkonsexpansion:item/battleaxe.bronze.ic2e.block"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"parent": "item/handheld",
"textures": {
"layer0": "balkonsexpansion:ic2/items/boomerang.bronze"
},
"overrides": [
{
"predicate": {
"weaponmod:ready-to-throw": 1
},
"model": "balkonsexpansion:item/boomerang.bronze.ic2e_ready"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "weaponmod:item/handheld_block",
"textures": {
"layer0": "balkonsexpansion:ic2/items/boomerang.bronze"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "balkonsexpansion:item/flail.bronze.ic2e",
"textures": {
"layer0": "weaponmod:items/flail-thrown"
}
}
Loading

0 comments on commit 7d2a42d

Please sign in to comment.