Skip to content

Commit

Permalink
Working TR Energy modifier
Browse files Browse the repository at this point in the history
  • Loading branch information
KonSola5 committed Feb 25, 2024
1 parent bf92183 commit 871e682
Show file tree
Hide file tree
Showing 22 changed files with 674 additions and 75 deletions.
51 changes: 35 additions & 16 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -95,41 +95,60 @@ dependencies {
// Hephaestus
modImplementation "slimeknights.tconstruct:Hephaestus:1.20.1-3.6.3.240"
modImplementation("slimeknights.mantle:Mantle:${minecraft_version}-${mantle_version}")
// FabricaeExNihilo
modImplementation "maven.modrinth:j9JARqmz:vkrmmrFW"
// Jade
modImplementation "maven.modrinth:nvQzSEkH:OPfSqApE"

modImplementation annotationProcessor(include("com.github.mattidragon:configtoolkit:$configtoolkit_version"))
// I can't believe I have to say this in a Minecraft video, but here it comes:
annotationProcessor modImplementation("io.wispforest:owo-lib:${project.owo_version}")

modImplementation "maven.modrinth:mythicmetals:${project.mm_version}"
modImplementation "maven.modrinth:alloy-forgery:${project.af_version}"
if (project.use_fabricae_ex_nihilo.toBoolean()) {
modImplementation "maven.modrinth:j9JARqmz:vkrmmrFW"
} else {
modCompileOnly "maven.modrinth:j9JARqmz:vkrmmrFW"
}

if (project.use_mythic_metals.toBoolean()) {
modImplementation "maven.modrinth:mythicmetals:${project.mm_version}"
modImplementation "maven.modrinth:alloy-forgery:${project.af_version}"
} else {
modCompileOnly "maven.modrinth:mythicmetals:${project.mm_version}"
modCompileOnly "maven.modrinth:alloy-forgery:${project.af_version}"
}

if (project.use_botania.toBoolean()) {
modImplementation("vazkii.botania:Botania:1.20.1-441-FABRIC") {
exclude group: "dev.emi", module: "emi-fabric"
}
} else {
modCompileOnly("vazkii.botania:Botania:1.20.1-441-FABRIC") {
exclude group: "dev.emi", module: "emi-fabric"
}
}

if (project.use_tech_reborn.toBoolean()) {
modImplementation "curse.maven:techreborn-233564:4708962"
modImplementation "curse.maven:reborncore-237903:4708961"
} else {
modCompileOnly "curse.maven:techreborn-233564:4708962"
modCompileOnly "curse.maven:reborncore-237903:4708961"
}


modRuntimeOnly "maven.modrinth:tamago:2.2"
// Come on, trigger the Bytecode Junkie
//modRuntimeOnly("com.simibubi.create:create-fabric-${minecraft_version}:${create_version}")
modRuntimeOnly "dev.onyxstudios.cardinal-components-api:cardinal-components-base:${project.cca_version}"
modRuntimeOnly "dev.onyxstudios.cardinal-components-api:cardinal-components-entity:${project.cca_version}"

// Mixin Extras is bundled with Fabric > 0.15.0.
//implementation(annotationProcessor("com.github.llamalad7.mixinextras:mixinextras-fabric:${project.me_version}"))

// Additional Entity Attributes
modImplementation ("maven.modrinth:additionalentityattributes:${project.aea_version}")

// Botania
modImplementation("vazkii.botania:Botania:1.20.1-441-FABRIC") {
exclude group: "dev.emi", module: "emi-fabric"
include(modApi("teamreborn:energy:${project.tr_energy_version}")) {
transitive = false
}

//include(modApi("teamreborn:energy:${project.tr_energy_version}")) {
// transitive = false
//}
// Tech Reborn
//modImplementation "curse.maven:techreborn-233564:4708962"
//modImplementation "curse.maven:reborncore-237903:4708961"

//modImplementation include("dev.isxander.yacl:yet-another-config-lib-fabric:$yacl_version")
}

Expand Down
12 changes: 12 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,17 @@ aea_version=1.2.2+1.19.4
emi_version=0.7.3+1.19.4
create_version = 0.5.1-d-build.1161+mc1.20.1

# Toggle mods on and off for testing mod compat
use_fabricae_ex_nihilo = true
use_mythic_metals = true
use_tech_reborn = true
# Currently Botania has a race condition with Porting Lib, making stuff not drop anything
use_botania = false
# Future
use_spectrum = false
use_better_nether = false
use_better_end = false
use_ad_astra = false

# Dependencies
fabric_version=0.90.0+1.20.1
15 changes: 15 additions & 0 deletions src/main/generated/.cache/3bedd6e6915232a23a01e57e746cea5ce5d34b29
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// 1.20.1 2024-01-23T18:00:25.9617694 HephaestusPlus/HephaestusPlus Item Tags
cbebaf8575c9c5e9bfb5b423aa6a3b15cf9db881 data\tconstruct\tags\items\modifiable\melee.json
cbebaf8575c9c5e9bfb5b423aa6a3b15cf9db881 data\tconstruct\tags\items\modifiable\aoe.json
df50f44ddfa67f31c57064a6b50c29fdd981df48 data\fabricaeexnihilo\tags\items\hammers.json
f7633517e698750ff4e0004a656b2e6ba812dd3f data\tconstruct\tags\items\casts\sand.json
cad8115e851eb2743933c51d4b8ff9fa6f89e305 data\tconstruct\tags\items\casts\red_sand.json
cbebaf8575c9c5e9bfb5b423aa6a3b15cf9db881 data\tconstruct\tags\items\modifiable\multipart.json
84c823f338f31c17c1eea72560c110e32a0bd286 data\tconstruct\tags\items\modifiable\harvest.json
cbebaf8575c9c5e9bfb5b423aa6a3b15cf9db881 data\minecraft\tags\items\cluster_max_harvestables.json
cbebaf8575c9c5e9bfb5b423aa6a3b15cf9db881 data\tconstruct\tags\items\modifiable\harvest\primary.json
df50f44ddfa67f31c57064a6b50c29fdd981df48 data\tconstruct\tags\items\modifiable\harvest\stone.json
715210998b786d852d9b72d8439b9966e3139c89 data\tconstruct\tags\items\casts\gold.json
84c823f338f31c17c1eea72560c110e32a0bd286 data\fabricaeexnihilo\tags\items\crooks.json
cbebaf8575c9c5e9bfb5b423aa6a3b15cf9db881 data\tconstruct\tags\items\modifiable\durability.json
cbebaf8575c9c5e9bfb5b423aa6a3b15cf9db881 data\tconstruct\tags\items\modifiable\held.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// 1.20.1 2024-01-23T18:00:25.94377 HephaestusPlus/HephaestusPlus Block Tags
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"replace": false,
"values": [
{
"id": "hephaestusplus:hand_hammer",
"id": "hephaestusplus:crook",
"required": false
},
{
"id": "hephaestusplus:crook",
"id": "hephaestusplus:hand_hammer",
"required": false
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"replace": false,
"values": [
{
"id": "hephaestusplus:hand_hammer",
"id": "hephaestusplus:crook",
"required": false
},
{
"id": "hephaestusplus:crook",
"id": "hephaestusplus:hand_hammer",
"required": false
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"replace": false,
"values": [
{
"id": "hephaestusplus:hand_hammer",
"id": "hephaestusplus:crook",
"required": false
},
{
"id": "hephaestusplus:crook",
"id": "hephaestusplus:hand_hammer",
"required": false
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"replace": false,
"values": [
{
"id": "hephaestusplus:hand_hammer",
"id": "hephaestusplus:crook",
"required": false
},
{
"id": "hephaestusplus:crook",
"id": "hephaestusplus:hand_hammer",
"required": false
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"replace": false,
"values": [
{
"id": "hephaestusplus:hand_hammer",
"id": "hephaestusplus:crook",
"required": false
},
{
"id": "hephaestusplus:crook",
"id": "hephaestusplus:hand_hammer",
"required": false
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"replace": false,
"values": [
{
"id": "hephaestusplus:hand_hammer",
"id": "hephaestusplus:crook",
"required": false
},
{
"id": "hephaestusplus:crook",
"id": "hephaestusplus:hand_hammer",
"required": false
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"replace": false,
"values": [
{
"id": "hephaestusplus:hand_hammer",
"id": "hephaestusplus:crook",
"required": false
},
{
"id": "hephaestusplus:crook",
"id": "hephaestusplus:hand_hammer",
"required": false
}
]
Expand Down
25 changes: 25 additions & 0 deletions src/main/java/konsola5/hephaestusplus/HephPlusHooks.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//package konsola5.hephaestusplus;
//
//import konsola5.hephaestusplus.util.EnergyModifierHook;
//import slimeknights.tconstruct.library.modifiers.ModifierHook;
//import slimeknights.tconstruct.library.modifiers.ModifierHooks;
//
//import javax.annotation.Nullable;
//
//import java.util.Collection;
//import java.util.function.Function;
//
//public class HephPlusHooks {
// private HephPlusHooks() {}
//
// public static void init() {}
//
// /** Hook for a tool boosting the tool's Energy capacity */
// public static final ModifierHook<EnergyModifierHook> TOOL_ENERGY = register("tool_energy", EnergyModifierHook.class, EnergyModifierHook.SUM_MERGER,
// (tool, modifier, capacity) -> 0);
//
// /** Registers a new modifier hook under {@code hephaestusplus} */
// private static <T> ModifierHook<T> register(String name, Class<T> filter, @Nullable Function<Collection<T>,T> merger, T defaultInstance) {
// return ModifierHooks.register(HephaestusPlus.getResource(name), filter, defaultInstance, merger);
// }
//}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class HephPlusMixinPlugin implements IMixinConfigPlugin {
"konsola5.hephaestusplus.mixin.IsCrookMixin", () -> FabricLoader.getInstance().isModLoaded("fabricaeexnihilo"),
"konsola5.hephaestusplus.mixin.IsHammerMixin", () -> FabricLoader.getInstance().isModLoaded("fabricaeexnihilo"),
"konsola5.hephaestusplus.mixin.CarmotShieldMixin", () -> FabricLoader.getInstance().isModLoaded("mythicmetals"),
"konsola5.hephaestusplus.mixin.PlayerMixin", () -> FabricLoader.getInstance().isModLoaded("mythicmetals"),
"konsola5.hephaestusplus.mixin.ShouldFilterOutMixin", () -> FabricLoader.getInstance().isModLoaded("botania")
);

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package konsola5.hephaestusplus.mixin;

import io.github.fabricators_of_create.porting_lib.common.util.Lazy;
import konsola5.hephaestusplus.util.ToolEnergyCapability;
import net.minecraft.resources.ResourceKey;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.Item.Properties;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import slimeknights.tconstruct.library.tools.definition.ToolDefinition;
import slimeknights.tconstruct.library.tools.item.ModifiableItem;
import slimeknights.tconstruct.library.tools.nbt.ToolStack;
import team.reborn.energy.api.EnergyStorage;

@SuppressWarnings("UnstableApiUsage")
@Mixin(ModifiableItem.class)
public class ModifiableItemMixin {

@Inject(method = "<init>", at = @At("TAIL"))
private void addEnergyCapability(Properties properties, ToolDefinition toolDefinition, ResourceKey<CreativeModeTab> tab, CallbackInfo ci) {
EnergyStorage.ITEM.registerFallback((itemStack, context) -> new ToolEnergyCapability(context, Lazy.of(() -> ToolStack.from(itemStack))));
}

}
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
package konsola5.hephaestusplus.mixin;

import net.minecraft.network.chat.Component;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import slimeknights.tconstruct.FabricEvents;

import java.util.List;

@Mixin(FabricEvents.class)
public class NoTooltipsInDevMixin {
@Inject(method = "init", at = @At(
Expand All @@ -17,7 +14,7 @@ public class NoTooltipsInDevMixin {
shift = At.Shift.AFTER),
cancellable = true, remap = false)
private static void injected(CallbackInfo ci) {
boolean TOOLTIPS = true;
boolean TOOLTIPS = false;
if (!TOOLTIPS) ci.cancel();
}
}
Loading

0 comments on commit 871e682

Please sign in to comment.