Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,27 @@
import team.chisel.api.block.VariationData;
import team.chisel.common.block.BlockCarvable;

/**
* Mixin to add harvest level information to Chisel's carvable blocks.
* <p>
* Sets appropriate harvest tools (pickaxe, axe, shovel) based on block material type,
* enabling proper tool requirements for breaking these blocks.
*/
@Mixin(value = BlockCarvable.class, remap = false)
public abstract class BlockCarvableMixin extends Block {

protected BlockCarvableMixin(Material materialIn) {
super(materialIn);
}

/**
* Sets the harvest level for carvable blocks based on their material type.
* <ul>
* <li>Pickaxe: Rock, Iron, Anvil, Ice</li>
* <li>Axe: Wood</li>
* <li>Shovel: Ground, Sand, Clay</li>
* </ul>
*/
@Inject(method = "<init>(Lnet/minecraft/block/material/Material;Lnet/minecraft/util/BlockRenderLayer;II[Lteam/chisel/api/block/VariationData;)V",
at = @At("RETURN"))
private void gtexpert$setHarvestLevel(Material material, BlockRenderLayer layer, int index, int max,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;

/**
* Mixin to rebalance Shield Necklace stats from Draconic Additions.
* <p>
* Adjusts energy capacity, max receive rate, protection points, and recovery rate
* for basic and wyvern tiers to better fit the modpack progression.
*/
@Mixin(value = ShieldNecklace.class, remap = false)
public class ShieldNecklaceMixin {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;

/**
* Mixin to rebalance Portable Wired Charger capacity from Draconic Additions.
* <p>
* Adjusts energy storage capacity for basic and wyvern tiers to better fit
* the modpack progression.
*/
@Mixin(value = PortableWiredCharger.class, remap = false)
public class PortableWiredChargerMixin {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;

/**
* Mixin to disable default Draconic Additions recipes.
* <p>
* Overwrites the recipe registration with an empty method because
* the original recipes cannot be removed via config changes.
* Custom recipes are added through the DEDA integration module instead.
*/
@Mixin(value = DARecipes.class, remap = false)
public class DARecipesMixin {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,18 @@

import com.brandon3055.draconicevolution.OreHandler;

/**
* Mixin to prevent Draconic Evolution from registering its ore dictionary entries.
* <p>
* Specifically blocks the "oreDraconium" registration to allow GregTech
* to handle draconium ore processing instead.
*/
@Mixin(value = OreHandler.class, remap = false)
public class OreHandlerMixin {

/**
* Redirect OreDictionary.registerOre calls to prevent oreDraconium registration.
* Redirects OreDictionary.registerOre calls to skip oreDraconium registration.
* All other ore registrations are passed through unchanged.
*/
@Redirect(method = "registerOres",
at = @At(value = "INVOKE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,19 @@
import com.github.gtexpert.core.api.GTEValues;
import com.github.gtexpert.core.api.unification.material.GTEMaterials;

/**
* Mixin to extend {@link AlloyBlastRecipeProducer} with additional recipe variants.
* <p>
* Adds pyrotheum-boosted alloy blast recipes and cryotheum-cooled vacuum freezer recipes
* when Draconic Evolution/Draconic Additions (DEDA) is loaded.
*/
@Mixin(value = AlloyBlastRecipeProducer.class, remap = false)
public abstract class AlloyBlastRecipeProducerMixin {

/**
* Injects into buildRecipes to add pyrotheum-boosted recipes.
* Replaces the original method to include an additional recipe variant using molten pyrotheum.
*/
@Inject(
method = "buildRecipes",
at = @At(
Expand Down Expand Up @@ -90,10 +100,20 @@ protected int getGasCircuitNum(int componentAmount) {
return componentAmount + 10;
}

/**
* @param componentAmount the amount of different components in the material
* @return the circuit number for the pyrotheum-boosted recipe
*/
protected int getPyrotheumCircuitNum(int componentAmount) {
return componentAmount + 11;
}

/**
* Injects into addFreezerRecipes to add extended vacuum freezer recipes.
* <p>
* Adds recipes for multiple mold types (nugget, ingot, plate, gear, rotor) and
* cryotheum-cooled variants for high-temperature materials when DEDA is loaded.
*/
@Inject(method = "addFreezerRecipes", at = @At("HEAD"), cancellable = true)
protected void addFreezerRecipesMixin(@NotNull Material material, @NotNull Fluid molten,
@NotNull BlastProperty property, CallbackInfo ci) {
Expand Down Expand Up @@ -162,6 +182,20 @@ protected void addFreezerRecipesMixin(@NotNull Material material, @NotNull Fluid
ci.cancel();
}

/**
* Adds a standard vacuum freezer recipe with a mold.
* For high-temperature materials, liquid helium is used as a coolant.
*
* @param material the material to process
* @param molten the molten fluid input
* @param vacuumEUt the EU/t for the recipe
* @param vacuumDuration the duration in ticks
* @param highTemp whether the material requires high-temp processing (>= 5000K)
* @param flag the material flag required (null if always applicable)
* @param prefix the output ore prefix
* @param mold the mold item
* @param fluidAmount the amount of molten fluid required
*/
private void addMoldRecipe(@NotNull Material material, @NotNull Fluid molten,
int vacuumEUt, int vacuumDuration, boolean highTemp,
@Nullable MaterialFlag flag, @NotNull OrePrefix prefix,
Expand All @@ -183,6 +217,16 @@ private void addMoldRecipe(@NotNull Material material, @NotNull Fluid molten,
builder.buildAndRegister();
}

/**
* Adds a vacuum freezer recipe to convert molten fluid to standard fluid.
* For high-temperature materials, liquid helium is used as a coolant.
*
* @param material the material to process
* @param molten the molten fluid input
* @param vacuumEUt the EU/t for the recipe
* @param vacuumDuration the duration in ticks
* @param highTemp whether the material requires high-temp processing (>= 5000K)
*/
private void addFluidConversionRecipe(@NotNull Material material, @NotNull Fluid molten,
int vacuumEUt, int vacuumDuration, boolean highTemp) {
RecipeBuilder<SimpleRecipeBuilder> builder = RecipeMaps.VACUUM_RECIPES.recipeBuilder()
Expand All @@ -200,6 +244,19 @@ private void addFluidConversionRecipe(@NotNull Material material, @NotNull Fluid
builder.buildAndRegister();
}

/**
* Adds a cryotheum-cooled vacuum freezer recipe with a mold.
* Uses cryotheum as coolant and produces molten pyrotheum as a byproduct.
*
* @param material the material to process
* @param molten the molten fluid input
* @param vacuumEUt the EU/t for the recipe
* @param duration the duration in ticks
* @param flag the material flag required (null if always applicable)
* @param prefix the output ore prefix
* @param mold the mold item
* @param fluidAmount the amount of molten fluid required
*/
private void addCryotheumMoldRecipe(@NotNull Material material, @NotNull Fluid molten,
int vacuumEUt, int duration,
@Nullable MaterialFlag flag, @NotNull OrePrefix prefix,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@

import com.github.gtexpert.core.api.capability.impl.ITiered;

/**
* Mixin to implement {@link ITiered} interface on the Mega Blast Furnace.
* <p>
* Marks this multiblock as non-tiered to exclude it from tier-based
* recipe filtering or other tier-dependent logic.
*/
@Mixin(value = MetaTileEntityMegaBlastFurnace.class, remap = false)
public abstract class MetaTileEntityMegaBlastFurnaceMixin implements ITiered {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@

import com.github.gtexpert.core.api.capability.impl.ITiered;

/**
* Mixin to implement {@link ITiered} interface on the Mega Vacuum Freezer.
* <p>
* Marks this multiblock as non-tiered to exclude it from tier-based
* recipe filtering or other tier-dependent logic.
*/
@Mixin(value = MetaTileEntityMegaVacuumFreezer.class, remap = false)
public class MetaTileEntityMegaVacuumFreezerMixin implements ITiered {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@

import com.github.gtexpert.core.integration.deda.recipemaps.GTEDraconicRecipeMaps;

/**
* Mixin to fix JEI recipe display positioning for DEDA recipe maps.
* <p>
* Corrects the Y-position calculation for recipe info text when recipe properties
* have custom heights (via getInfoHeight) instead of the default 10px per property.
*/
@Mixin(value = GTRecipeWrapper.class, remap = false)
public class GTRecipeWrapperMixin {

Expand All @@ -33,7 +39,7 @@ public class GTRecipeWrapperMixin {
* Fixed: recipeHeight - (sumOfPropertyHeights + defaultLines * 10 - 3)
*/
@ModifyVariable(method = "drawInfo", at = @At(value = "STORE"), ordinal = 5)
private int gteCore$fixYPosition(int original) {
private int gtexpert$fixYPosition(int original) {
// Only apply fix for DEDA recipe maps
if (recipeMap != GTEDraconicRecipeMaps.DRACONIC_FUSION_TIER_UP_RECIPES &&
recipeMap != GTEDraconicRecipeMaps.DRACONIC_FUSION_UPGRADE_RECIPES) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package com.github.gtexpert.core.mixins.gregtech;

import java.util.List;

import net.minecraft.client.resources.I18n;
import net.minecraft.util.FoodStats;

import org.spongepowered.asm.mixin.Mixin;
Expand All @@ -10,16 +13,39 @@

import com.github.gtexpert.core.common.GTEConfigHolder;

/**
* Mixin to add configurable auto-eat behavior to the Quark Tech Suite helmet.
* <p>
* Allows disabling the automatic food consumption feature via config option,
* giving players more control over their food management.
*/
@Mixin(value = QuarkTechSuite.class, remap = false)
public class QuarkTechSuiteMixin {

/**
* Redirects the hunger check to optionally disable auto-eat functionality.
* When disabled, the helmet will never attempt to automatically feed the player.
*/
@Redirect(method = "onArmorTick",
at = @At(value = "INVOKE", target = "Lnet/minecraft/util/FoodStats;func_75121_c()Z"))
private boolean gteCore$onArmorTick(FoodStats foodStats) {
at = @At(value = "INVOKE", target = "Lnet/minecraft/util/FoodStats;needFood()Z", remap = true))
private boolean gtexpert$onArmorTick(FoodStats foodStats) {
if (GTEConfigHolder.ceuOverride.disableHelmetAutoEat) {
return false;
} else {
return foodStats.needFood();
}
}

/**
* Hides the auto-eat tooltip when the feature is disabled via config.
*/
@Redirect(method = "addInfo",
at = @At(value = "INVOKE", target = "Ljava/util/List;add(Ljava/lang/Object;)Z"))
private boolean gtexpert$hideAutoEatTooltip(List<String> list, Object element) {
if (GTEConfigHolder.ceuOverride.disableHelmetAutoEat &&
element.equals(I18n.format("metaarmor.tooltip.autoeat"))) {
return false;
}
return list.add((String) element);
}
Comment on lines +44 to +50
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This redirect method is susceptible to a NullPointerException if element is null, as element.equals(...) would be called. It's safer to invoke equals on the string literal, which is known to be non-null.

Additionally, the cast (String) element is unsafe and will throw a ClassCastException if a non-String object is ever added to the tooltip list. While this might be unlikely in the context of tooltips, it's a potential runtime error. The current logic would attempt the cast for any object that doesn't match the auto-eat tooltip.

The suggested change below fixes the potential NullPointerException.

Suggested change
private boolean gtexpert$hideAutoEatTooltip(List<String> list, Object element) {
if (GTEConfigHolder.ceuOverride.disableHelmetAutoEat &&
element.equals(I18n.format("metaarmor.tooltip.autoeat"))) {
return false;
}
return list.add((String) element);
}
private boolean gtexpert$hideAutoEatTooltip(List<String> list, Object element) {
if (GTEConfigHolder.ceuOverride.disableHelmetAutoEat &&
I18n.format("metaarmor.tooltip.autoeat").equals(element)) {
return false;
}
return list.add((String) element);
}

}