Skip to content

Commit

Permalink
Merge pull request #420 from WaitingIdly/tinkers-smeltery-rendering
Browse files Browse the repository at this point in the history
Config to Disable Rendering Items in Smeltery
  • Loading branch information
ACGaming authored Apr 5, 2024
2 parents 7ca6614 + 523a6e0 commit 9c8de14
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,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 @@ -794,6 +794,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"]
}

0 comments on commit 9c8de14

Please sign in to comment.