Skip to content

Commit

Permalink
ArchitectureCraft Integration
Browse files Browse the repository at this point in the history
  • Loading branch information
IntegerLimit committed Mar 7, 2024
1 parent b5f34f7 commit 511b222
Show file tree
Hide file tree
Showing 15 changed files with 569 additions and 4 deletions.
7 changes: 7 additions & 0 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ dependencies {
compileOnly rfg.deobf("curse.maven:libvulpes-236541:2949886") // Version 0.4.2-75 (Newer Versions Crash with Gas Charge Pad)
compileOnly rfg.deobf("curse.maven:advanced-rocketry-236542:3015079") // Version 1.7.0-232 (Newer Versions need Newer Lib Vulpes)

// Architecture Craft (from CurseForge)
compileOnly rfg.deobf("curse.maven:architecture-craft-277631:2750633") // Version 3.98

/* -------------------------------- Soft Deps, Multiple Runtime Declaration -------------------------------- */
if (project.enable_draconic.toBoolean() || project.enable_thermal.toBoolean()) {
runtimeOnly "curse.maven:redstone-flux-270789:2920436" // Version 2.1.1.1
Expand Down Expand Up @@ -174,6 +177,10 @@ dependencies {
runtimeOnly "curse.maven:advanced-rocketry-236542:3015079" // Version 1.7.0-232 (Newer Versions need Newer Lib Vulpes)
}

if (project.enable_architecture_craft.toBoolean()) {
runtimeOnly "curse.maven:architecture-craft-277631:2750633" // Version 3.98
}

if (project.enable_ender_storage.toBoolean()) {
// Ender Storage, runtime only, integrated in remappers (from CurseForge)
runtimeOnly "curse.maven:ender-storage-245174:2755787" // Version 2.4.6.137
Expand Down
7 changes: 6 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ curseForgeRelations = requiredDependency:codechicken-lib-1-8;\
optionalDependency:cofh-world;\
optionalDependency:cofh-core;\
optionalDependency:libvulpes;\
optionalDependency:advanced-rocketry;
optionalDependency:advanced-rocketry;\
optionalDependency:architecturecraft-tridev;

# This project's release type on CurseForge and/or Modrinth
# Alternatively this can be set with the 'RELEASE_TYPE' environment variable.
Expand Down Expand Up @@ -240,6 +241,10 @@ enable_xu2 = false
# If this is set to false, the mixin will not apply.
enable_rocketry = false

# Whether to enable Architecture Craft in runtime. Enables the mixin which adds more Architecture Craft Slopes.
# If this is set to false, the mixin will not apply.
enable_architecture_craft = false

# Whether to enable Ender Storage in runtime. Enables remappers to remap items in ender storage.
# If this is set to false, the remappers will not apply there.
enable_ender_storage = true
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/nomiceu/nomilabs/LabsValues.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ public class LabsValues {
public static final String ENDER_IO_MODID = "enderio";
public static final String JEI_MODID = "jei";
public static final String ROCKETRY_MODID = "advancedrocketry";
public static final String ARCHITECTURE_MODID = "architecturecraft";
}
3 changes: 2 additions & 1 deletion src/main/java/com/nomiceu/nomilabs/NomiLabs.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
+ "after:advancedrocketry;"
+ "after:libvulpes;"
+ "after:crafttweaker@[4.1.20,);"
+ "after:appliedenergistics2;")
+ "after:appliedenergistics2;"
+ "after:architecturecraft;")
@SuppressWarnings("unused")
public class NomiLabs {
public static final Logger LOGGER = LogManager.getLogger(LabsValues.LABS_MODID);
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/com/nomiceu/nomilabs/config/LabsConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,12 @@ public static class ModIntegration {
@Config.RequiresMcRestart
public boolean enableAdvancedRocketryIntegration = true;

@Config.Comment({"Whether to enable ArchitectureCraft Integration, which adds new slope variants.",
"[default: true]"})
@Config.LangKey("config.nomilabs.mod_integration.architecture_craft")
@Config.RequiresMcRestart
public boolean enableArchitectureCraftIntegration = true;

public static class DraconicEvolutionIntegration {
@Config.Comment({"Whether to enable Draconic Evolution Integration, which adds many features, such as:",
"Allowing GregTech Draconium and Awakened Draconium in the reactor and energy core.",
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/com/nomiceu/nomilabs/core/LabsLateMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ public class LabsLateMixin implements ILateMixinLoader {
new AbstractMap.SimpleImmutableEntry<>(LabsValues.GREGTECH_MODID, true),
new AbstractMap.SimpleImmutableEntry<>(LabsValues.JEI_MODID, true),
new AbstractMap.SimpleImmutableEntry<>(LabsValues.ROCKETRY_MODID,
LabsConfig.modIntegration.enableAdvancedRocketryIntegration))
LabsConfig.modIntegration.enableAdvancedRocketryIntegration),
new AbstractMap.SimpleImmutableEntry<>(LabsValues.ARCHITECTURE_MODID,
LabsConfig.modIntegration.enableArchitectureCraftIntegration)
)
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));

@Override
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/com/nomiceu/nomilabs/event/CommonProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import com.nomiceu.nomilabs.gregtech.prefix.LabsOrePrefix;
import com.nomiceu.nomilabs.gregtech.recipe.PerfectGemsCutterRecipes;
import com.nomiceu.nomilabs.groovy.GroovyScriptHandManager;
import com.nomiceu.nomilabs.integration.architecturecraft.LabsShapes;
import com.nomiceu.nomilabs.integration.top.TOPTooltipManager;
import com.nomiceu.nomilabs.item.ItemExcitationCoil;
import com.nomiceu.nomilabs.item.registry.LabsItems;
Expand Down Expand Up @@ -51,6 +52,10 @@
public class CommonProxy {
public static void preInit() {
LabsModeHelper.check();

if (Loader.isModLoaded(LabsValues.ARCHITECTURE_MODID) &&
LabsConfig.modIntegration.enableArchitectureCraftIntegration)
LabsShapes.preInit();

LabsCreativeTabs.preInit();

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.nomiceu.nomilabs.integration.architecturecraft;

import com.elytradev.architecture.common.shape.Shape;
import com.elytradev.architecture.common.shape.ShapeKind;
import com.elytradev.architecture.common.shape.ShapeSymmetry;
import com.nomiceu.nomilabs.mixin.architecturecraft.ShapeAccessor;
import net.minecraftforge.common.util.EnumHelper;

public class LabsShapes {
public static final Shape SLOPE_TILE_A1 = addShape("SLOPE_TILE_A1", 94, "Slope A Start", ShapeKind.Roof, ShapeSymmetry.BILATERAL, 1, 1, 0xcf);
public static final Shape SLOPE_TILE_A2 = addShape("SLOPE_TILE_A2", 95, "Slope A End", ShapeKind.Roof, ShapeSymmetry.BILATERAL, 1, 3, 0x0f);
public static final Shape SLOPE_TILE_B1 = addShape("SLOPE_TILE_B1", 96, "Slope B Start", ShapeKind.Roof, ShapeSymmetry.BILATERAL, 1, 1, 0xff);
public static final Shape SLOPE_TILE_B2 = addShape("SLOPE_TILE_B2", 97, "Slope B Middle", ShapeKind.Roof, ShapeSymmetry.BILATERAL, 1, 2, 0xcf);
public static final Shape SLOPE_TILE_B3 = addShape("SLOPE_TILE_B3", 98, "Slope B End", ShapeKind.Roof, ShapeSymmetry.BILATERAL, 1, 3, 0x0f);
public static final Shape SLOPE_TILE_C1 = addShape("SLOPE_TILE_C1", 99, "Slope C 1", ShapeKind.Roof, ShapeSymmetry.BILATERAL, 1, 1, 0xff);
public static final Shape SLOPE_TILE_C2 = addShape("SLOPE_TILE_C2", 100, "Slope C 2", ShapeKind.Roof, ShapeSymmetry.BILATERAL, 1, 2, 0xcf);
public static final Shape SLOPE_TILE_C3 = addShape("SLOPE_TILE_C3", 101, "Slope C 3", ShapeKind.Roof, ShapeSymmetry.BILATERAL, 1, 3, 0x0f);
public static final Shape SLOPE_TILE_C4 = addShape("SLOPE_TILE_C4", 102, "Slope C 4", ShapeKind.Roof, ShapeSymmetry.BILATERAL, 1, 4, 0x0f);

/**
* Essentially, this loads the class, allowing the above values to be added.
* <p>
* If for some reason, the values are needed before this, they will still be loaded, and calling init will have no affect on that.
*/
public static void preInit() {

}

@SuppressWarnings("SameParameterValue")
private static Shape addShape(String name, int id, String title, ShapeKind kind, ShapeSymmetry sym, int used, int made, int occ) {
var shape = EnumHelper.addEnum(Shape.class, name,
new Class<?>[]{int.class, String.class, ShapeKind.class, ShapeSymmetry.class, int.class, int.class, int.class},
id, title, kind, sym, used, made, occ);
ShapeAccessor.getIDMap().put(id, shape) ;
return shape;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.nomiceu.nomilabs.mixin.architecturecraft;

import com.elytradev.architecture.client.gui.GuiSawbench;
import com.elytradev.architecture.legacy.base.BaseGui;
import net.minecraft.inventory.Container;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

/**
* Changes the Gui Shape Item Texture Used.
*/
@Mixin(value = GuiSawbench.class, remap = false)
public class GuiSawbenchMixin extends BaseGui.Screen {
@Unique
private static final String ORIGINAL_GUI_ITEMS_PATH = "gui/shapemenu_items.png";

@Unique
private static final String NEW_GUI_ITEMS_PATH = "gui/labs_shapemenu_items.png";

/**
* Default Ignored Constructor.
*/
public GuiSawbenchMixin(Container container, int width, int height) {
super(container, width, height);
}

@Redirect(method = "drawShapeMenu", at = @At(value = "INVOKE", target = "Lcom/elytradev/architecture/client/gui/GuiSawbench;bindTexture(Ljava/lang/String;II)V"), remap = false)
public void bindNewGuiTexture(GuiSawbench instance, String texture, int u, int v) {
if (texture.equals(ORIGINAL_GUI_ITEMS_PATH)) {
instance.bindTexture(NEW_GUI_ITEMS_PATH, u, v);
return;
}
instance.bindTexture(texture, u, v);
}
}
Loading

0 comments on commit 511b222

Please sign in to comment.