Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config to Disable Rendering Items in Smeltery #420

Merged
merged 2 commits into from
Apr 5, 2024
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ All changes are toggleable via config files.
* **Duplication Fixes:** Fixes various duplication exploits
* **Insolator Custom Monoculture:** Adds Monoculture Cycle integration to desired phytogenic insolator recipes added by ModTweaker
* **Tinkers' Construct**
* **Disable Rendering Items in Smeltery:** Disables rendering items in the world when they are inside the Smeltery to prevent lag while rendering
* **Duplication Fixes:** Fixes various duplication exploits
* **Gaseous Fluids:** Excludes gaseous fluids from being transferable via faucets
* **Material Blacklist:** Hides tool/bow materials in the 'Materials and You' book
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,15 @@ public static class TinkersConstructCategory
@Config.Comment("Excludes gaseous fluids from being transferable via faucets")
public boolean utTConGaseousFluidsToggle = false;

@Config.Name("Maximum Items to Render in Smeltery")
@Config.Comment
({
"Determines the maximum number of possible items to display before not rendering any to prevent substantial lag",
"0 to disable rendering items in the smeltery entirely",
"-1 for the default, which is always rendering items"
})
public int utMaximumItemRendersInSmeltery = -1;

@Config.RequiresMcRestart
@Config.Name("Material Blacklist")
@Config.Comment
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package mod.acgaming.universaltweaks.mods.tconstruct.mixin;

import mod.acgaming.universaltweaks.config.UTConfigMods;
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.smeltery.client.SmelteryRenderer;
import slimeknights.tconstruct.smeltery.client.SmelteryTankRenderer;
import slimeknights.tconstruct.smeltery.tileentity.TileSmeltery;

import javax.annotation.Nonnull;

// Courtesy of WaitingIdly
@Mixin(value = SmelteryRenderer.class, remap = false)
public abstract class SmelteryRendererMixin extends SmelteryTankRenderer<TileSmeltery>
{
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lslimeknights/tconstruct/smeltery/client/SmelteryRenderer;renderFluids(Lslimeknights/tconstruct/library/smeltery/SmelteryTank;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/BlockPos;DDD)V", shift = At.Shift.AFTER), cancellable = true)
public void utRender(@Nonnull TileSmeltery smeltery, double x, double y, double z, float partialTicks, int destroyStage, float alpha, CallbackInfo ci)
{
if (UTConfigMods.TINKERS_CONSTRUCT.utMaximumItemRendersInSmeltery == -1) return;
if (smeltery.getSizeInventory() > UTConfigMods.TINKERS_CONSTRUCT.utMaximumItemRendersInSmeltery) {
ci.cancel();
}
}
}
2 changes: 1 addition & 1 deletion src/main/resources/mixins.mods.tconstruct.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"refmap": "universaltweaks.refmap.json",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"mixins": ["MaterialAccessor", "UTEntityProjectileBaseMixin", "UTFaucetMixin", "UTLongSwordMixin", "UTRapierMixin"]
"mixins": ["MaterialAccessor", "UTEntityProjectileBaseMixin", "UTFaucetMixin", "UTLongSwordMixin", "UTRapierMixin", "SmelteryRendererMixin"]
}
Loading