Skip to content

Commit

Permalink
Merge remote-tracking branch 'main' into mixin-and-obsolete-mod-simpl…
Browse files Browse the repository at this point in the history
…ified
  • Loading branch information
WaitingIdly committed Apr 12, 2024
2 parents 02e8ec2 + 6226fb0 commit 2e8209c
Show file tree
Hide file tree
Showing 23 changed files with 586 additions and 45 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ All changes are toggleable via config files.
* **Easy Breeding:** Enables easy breeding of animals by tossing food on the ground
* **End Crystal Placing:** Allows placing End Crystals without requiring Obsidian or Bedrock below
* **End Portal Parallax:** Re-implements parallax rendering of the end portal from 1.11 and older
* **Entity Radius Check**
* These tweaks are only effective if you have mod(s) that increase `World.MAX_ENTITY_RADIUS`! (Lycanites Mobs, Advanced Rocketry, Immersive Railroading, etc.)
* Reduces the search size of various AABB functions for specified entity types to improve performance
* Reduces size of collision checks for most vanilla and specified entity types to improve performance
* **Explosion Block Drop Chance:** Determines the numerator of the block drop formula on explosions
* **Falling Block Lifespan:** Determines how long falling blocks remain in ticks until they are dropped under normal circumstances
* **Fast Dye Blending:** Replaces color lookup for sheep to check a predefined table rather than querying the recipe registry
Expand Down Expand Up @@ -174,6 +178,7 @@ All changes are toggleable via config files.
* **No Golems:** Disables the manual creation of golems and withers
* **No Leftover Breath Bottles:** Disables dragon's breath from leaving off empty bottles when a stack is brewed with
* **No Night Vision Flash:** Disables the flashing effect when the night vision potion effect is about to run out
* **No Pathfinding Chunk Loading:** Disables mob pathfinding from loading new/unloaded chunks when building chunk caches to improve performance
* **No Potion Shift:** Disables the inventory shift when potion effects are active
* **No Portal Spawning:** Prevents zombie pigmen spawning from nether portals
* **No Redstone Lighting:** Disables lighting of active redstone, repeaters, and comparators to improve performance
Expand Down Expand Up @@ -290,6 +295,8 @@ All changes are toggleable via config files.
* **Duplication Fixes:** Fixes various duplication exploits
* **Mob Stages**
* **Spawning Rules Fixes:** Fixes mob replacement ignoring entity spawning rules
* **Modular Routers**
* **Particle Thread Fix:** Fixes particles being added from the wrong thread which corrupted the particle manager
* **MrTJPCore**
* **Memory Leak Fix:** Fixes a memory leak associated with EntityPlayer
* **Nether Chest**
Expand Down
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ dependencies {
compileOnly 'curse.maven:industrialcraft-242638:3078604'
compileOnly 'curse.maven:ironbackpacks-227049:2564573'
compileOnly 'curse.maven:mekanism-268560:2835175'
compileOnly 'curse.maven:modular-routers-250294:2954953'
compileOnly 'curse.maven:mrtjpcore-229002:2735197'
compileOnly 'curse.maven:netherchest-268888:2655413'
compileOnly 'curse.maven:netherrocks-226140:2628297'
Expand All @@ -203,7 +204,7 @@ dependencies {
compileOnly 'curse.maven:tinkerscomplement-272671:2843439'
compileOnly 'curse.maven:tinyprogressions-250850:2721018'
compileOnly 'maven.modrinth:industrial-foregoing:1.12.13-237'
// implementation 'TechReborn:TechReborn-ModCompatibility-1.12.2:1.4.0.76:universal'
// runtimeOnly 'TechReborn:TechReborn-ModCompatibility-1.12.2:1.4.0.76:universal'

if (project.use_mixins.toBoolean()) {
String mixin = modUtils.enableMixins("zone.rong:mixinbooter:9.1", "universaltweaks.refmap.json")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import mod.acgaming.universaltweaks.tweaks.misc.swingthroughgrass.UTSwingThroughGrassLists;
import mod.acgaming.universaltweaks.tweaks.misc.toastcontrol.UTTutorialToast;
import mod.acgaming.universaltweaks.tweaks.performance.autosave.UTAutoSaveOFCompat;
import mod.acgaming.universaltweaks.tweaks.performance.entityradiuscheck.UTEntityRadiusCheck;
import mod.acgaming.universaltweaks.tweaks.world.stronghold.UTStronghold;
import mod.acgaming.universaltweaks.tweaks.world.stronghold.worldgen.SafeStrongholdWorldGenerator;
import mod.acgaming.universaltweaks.util.UTPacketHandler;
Expand Down Expand Up @@ -205,6 +206,7 @@ public void onServerStarted(FMLServerStartedEvent event)
public void onLoadComplete(FMLLoadCompleteEvent event)
{
if (Loader.isModLoaded("tconstruct") && UTConfigMods.TINKERS_CONSTRUCT.utTConOreDictCacheToggle) UTOreDictCache.onLoadComplete();
if (UTConfigTweaks.PERFORMANCE.ENTITY_RADIUS_CHECK.utEntityRadiusCheckCategoryToggle) UTEntityRadiusCheck.onLoadComplete();
if (UTConfigGeneral.DEBUG.utLoadingTimeToggle) LOGGER.info("The game loaded in approximately {} seconds", (System.currentTimeMillis() - UTLoadingPlugin.launchTime) / 1000F);
if (UTObsoleteModsHandler.showObsoleteMods && UTObsoleteModsHandler.obsoleteModsMessage().size() > 5 && !UTConfigGeneral.DEBUG.utBypassIncompatibilityToggle)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ public class UTConfigMods
@Config.Name("Mob Stages")
public static final MobStagesCategory MOB_STAGES = new MobStagesCategory();

@Config.LangKey("cfg.universaltweaks.modintegration.modularrouters")
@Config.Name("Modular Routers")
public static final ModularRoutersCategory MODULAR_ROUTERS = new ModularRoutersCategory();

@Config.LangKey("cfg.universaltweaks.modintegration.mrtjpcore")
@Config.Name("MrTJPCore")
public static final MrTJPCoreCategory MRTJPCORE = new MrTJPCoreCategory();
Expand Down Expand Up @@ -510,6 +514,14 @@ public static class MobStagesCategory
public boolean utSpawningRules = true;
}

public static class ModularRoutersCategory
{
@Config.RequiresMcRestart
@Config.Name("Particle Thread Fix")
@Config.Comment("Fixes particles being added from the wrong thread which corrupted the particle manager")
public boolean utParticleThreadToggle = true;
}

public static class MrTJPCoreCategory
{
@Config.RequiresMcRestart
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import mod.acgaming.universaltweaks.tweaks.misc.loadsound.UTLoadSound;
import mod.acgaming.universaltweaks.tweaks.misc.swingthroughgrass.UTSwingThroughGrassLists;
import mod.acgaming.universaltweaks.tweaks.performance.autosave.UTAutoSaveOFCompat;
import mod.acgaming.universaltweaks.tweaks.performance.entityradiuscheck.UTEntityRadiusCheck;

@Config(modid = UniversalTweaks.MODID, name = UniversalTweaks.NAME + " - Tweaks")
public class UTConfigTweaks
Expand Down Expand Up @@ -1686,6 +1687,10 @@ public static class ToastControlCategory

public static class PerformanceCategory
{
@Config.LangKey("cfg.universaltweaks.tweaks.performance.entityradiuscheck")
@Config.Name("Entity Radius Check")
public final EntityRadiusCheckCategory ENTITY_RADIUS_CHECK = new EntityRadiusCheckCategory();

@Config.RequiresMcRestart
@Config.Name("Auto Save Interval")
@Config.Comment("Determines the interval in ticks between world auto saves")
Expand Down Expand Up @@ -1755,6 +1760,11 @@ public static class PerformanceCategory
@Config.Comment("Silences texture map errors")
public boolean utTextureMapCheckToggle = false;

@Config.RequiresMcRestart
@Config.Name("No Pathfinding Chunk Loading")
@Config.Comment("Disables mob pathfinding from loading new/unloaded chunks when building chunk caches")
public boolean utPathfindingChunkCacheFixToggle = true;

@Config.RequiresMcRestart
@Config.Name("No Redstone Lighting")
@Config.Comment("Disables lighting of active redstone, repeaters, and comparators to improve performance")
Expand All @@ -1764,6 +1774,49 @@ public static class PerformanceCategory
@Config.Name("Uncap FPS")
@Config.Comment("Removes the hardcoded 30 FPS limit in screens like the main menu")
public boolean utUncapFPSToggle = true;

public static class EntityRadiusCheckCategory
{
@Config.RequiresMcRestart
@Config.Name("[1] Entity Radius Check Toggle")
@Config.Comment
({
"Toggles all tweaks in this category",
"IMPORTANT: These tweaks are only effective if you have mod(s) that increase World.MAX_ENTITY_RADIUS!",
"(Lycanites Mobs, Advanced Rocketry, Immersive Railroading, etc.)"
})
public boolean utEntityRadiusCheckCategoryToggle = true;

@Config.Name("[2] Reduce Search Size Toggle")
@Config.Comment("Reduces the search size of various AABB functions for specified entity types")
public boolean utReduceSearchSizeToggle = true;

@Config.Name("[3] Reduce Search Size Targets")
@Config.Comment
({
"The entity types to reduce the search size for",
"Syntax - modid:name"
})
public String[] utReduceSearchSizeTargets = new String[]
{
"minecraft:item",
"minecraft:player"
};

@Config.Name("[4] Less Collisions Toggle")
@Config.Comment("Reduces size of collision checks for most vanilla and specified entity types")
public boolean utLessCollisionsToggle = true;

@Config.Name("[5] Less Collisions Extra Targets")
@Config.Comment
({
"The extra entity types to reduce the size of collision checks for",
"Syntax - modid:name;radius",
"Vanilla ids aren't allowed because they are already included",
"Most types should be specified with the vanilla default radius: 2.0"
})
public String[] utLessCollisionsExtraTargets = new String[]{};
}
}

public static class WorldCategory
Expand Down Expand Up @@ -1862,6 +1915,11 @@ public static void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event
if (MISC.ARMOR_CURVE.utArmorCurveToggle) UTArmorCurve.initExpressions();
if (MISC.SWING_THROUGH_GRASS.utSwingThroughGrassToggle) UTSwingThroughGrassLists.initLists();
if (MISC.INCURABLE_POTIONS.utIncurablePotionsToggle) UTIncurablePotions.initPotionList();
if (PERFORMANCE.ENTITY_RADIUS_CHECK.utEntityRadiusCheckCategoryToggle)
{
if (PERFORMANCE.ENTITY_RADIUS_CHECK.utReduceSearchSizeToggle) UTEntityRadiusCheck.initSearchTargets();
if (PERFORMANCE.ENTITY_RADIUS_CHECK.utLessCollisionsToggle) UTEntityRadiusCheck.initCollisionTargets();
}
if (ITEMS.utCustomRarities.length > 0) UTCustomRarity.initItemRarityMap();
if (ITEMS.utCustomUseDurations.length > 0) UTCustomUseDuration.initItemUseMaps();
if (ITEMS.PARRY.utParryToggle) UTParry.initProjectileList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import mod.acgaming.universaltweaks.config.UTConfigBugfixes;
import mod.acgaming.universaltweaks.config.UTConfigGeneral;
import mod.acgaming.universaltweaks.config.UTConfigTweaks;
import mod.acgaming.universaltweaks.util.UTReflectionUtil;
import zone.rong.mixinbooter.IEarlyMixinLoader;

@IFMLLoadingPlugin.Name("UniversalTweaksCore")
Expand Down Expand Up @@ -179,7 +180,10 @@ public class UTLoadingPlugin implements IFMLLoadingPlugin, IEarlyMixinLoader
put("mixins.tweaks.performance.autosave.json", () -> UTConfigTweaks.PERFORMANCE.utAutoSaveInterval != 900);
put("mixins.tweaks.performance.craftingcache.json", () -> UTConfigTweaks.PERFORMANCE.utCraftingCacheToggle);
put("mixins.tweaks.performance.dyeblending.json", () -> UTConfigTweaks.PERFORMANCE.utDyeBlendingToggle);
put("mixins.tweaks.performance.entityradiuscheck.lesscollisions.json", () -> UTConfigTweaks.PERFORMANCE.ENTITY_RADIUS_CHECK.utEntityRadiusCheckCategoryToggle && UTConfigTweaks.PERFORMANCE.ENTITY_RADIUS_CHECK.utLessCollisionsToggle);
put("mixins.tweaks.performance.entityradiuscheck.reducesearchsize.json", () -> UTConfigTweaks.PERFORMANCE.ENTITY_RADIUS_CHECK.utEntityRadiusCheckCategoryToggle && UTConfigTweaks.PERFORMANCE.ENTITY_RADIUS_CHECK.utReduceSearchSizeToggle);
put("mixins.tweaks.performance.oredictionarycheck.json", () -> UTConfigTweaks.PERFORMANCE.utOreDictionaryCheckToggle);
put("mixins.tweaks.performance.pathfinding.json", () -> UTConfigTweaks.PERFORMANCE.utPathfindingChunkCacheFixToggle);
put("mixins.tweaks.performance.prefixcheck.json", () -> UTConfigTweaks.PERFORMANCE.utPrefixCheckToggle);
put("mixins.tweaks.performance.redstone.json", () -> UTConfigTweaks.PERFORMANCE.utRedstoneLightingToggle);
put("mixins.tweaks.performance.texturemapcheck.json", () -> UTConfigTweaks.PERFORMANCE.utTextureMapCheckToggle);
Expand All @@ -200,33 +204,10 @@ public class UTLoadingPlugin implements IFMLLoadingPlugin, IEarlyMixinLoader
Locale.setDefault(Locale.ENGLISH);
}

try
{
Class.forName("com.therandomlabs.randompatches.core.RPCore");
randomPatchesLoaded = true;
}
catch (ClassNotFoundException ignored) {}

try
{
Class.forName("meldexun.renderlib.RenderLib");
renderLibLoaded = true;
}
catch (ClassNotFoundException ignored) {}

try
{
Class.forName("org.spongepowered.mod.util.CompatibilityException");
spongeForgeLoaded = true;
}
catch (ClassNotFoundException ignored) {}

try
{
Class.forName("net.darkhax.surge.core.SurgeLoadingPlugin");
surgeLoaded = true;
}
catch (ClassNotFoundException ignored) {}
randomPatchesLoaded = UTReflectionUtil.isClassLoaded("com.therandomlabs.randompatches.core.RPCore");
renderLibLoaded = UTReflectionUtil.isClassLoaded("meldexun.renderlib.RenderLib");
spongeForgeLoaded = UTReflectionUtil.isClassLoaded("org.spongepowered.mod.util.CompatibilityException");
surgeLoaded = UTReflectionUtil.isClassLoaded("net.darkhax.surge.core.SurgeLoadingPlugin");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class UTMixinLoader implements ILateMixinLoader
put("mixins.mods.compactmachines.json", () -> loaded("compactmachines3") && UTConfigMods.COMPACT_MACHINES.utCMRenderFixToggle);
put("mixins.mods.crafttweaker.json", () -> loaded("crafttweaker"));
put("mixins.mods.hwyla.json", () -> loaded("waila"));
put("mixins.mods.modularrouters.json", () -> loaded("modularrouters") && UTConfigMods.MODULAR_ROUTERS.utParticleThreadToggle);
put("mixins.mods.roost.json", () -> loaded("roost") && loaded("contenttweaker"));
put("mixins.mods.storagedrawers.client.json", () -> loaded("storagedrawers"));
put("mixins.mods.thaumcraft.entities.client.json", () -> loaded("thaumcraft"));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package mod.acgaming.universaltweaks.mods.modularrouters.mixin;


import java.awt.Color;

import net.minecraft.client.Minecraft;
import net.minecraft.world.World;

import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import me.desht.modularrouters.client.fx.Vector3;
import me.desht.modularrouters.network.ParticleBeamMessage;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;

// Courtesy of jchung01
@Mixin(value = ParticleBeamMessage.Handler.class, remap = false)
public class UTParticleBeamMessageMixin
{
@WrapOperation(method = "onMessage(Lme/desht/modularrouters/network/ParticleBeamMessage;Lnet/minecraftforge/fml/common/network/simpleimpl/MessageContext;)Lnet/minecraftforge/fml/common/network/simpleimpl/IMessage;", at = @At(value = "INVOKE", target = "Lme/desht/modularrouters/client/fx/ParticleBeam;doParticleBeam(Lnet/minecraft/world/World;Lme/desht/modularrouters/client/fx/Vector3;Lme/desht/modularrouters/client/fx/Vector3;Ljava/awt/Color;F)V"))
private void utScheduleParticle(World world, Vector3 orig, Vector3 end, Color flatColor, float size, Operation<Void> original)
{
Minecraft.getMinecraft().addScheduledTask(() ->
{
original.call(world, orig, end, flatColor, size);
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import mod.acgaming.universaltweaks.UniversalTweaks;
import mod.acgaming.universaltweaks.config.UTConfigTweaks;
import mod.acgaming.universaltweaks.core.UTLoadingPlugin;
import mod.acgaming.universaltweaks.util.UTReflectionUtil;

public class UTAutoSaveOFCompat
{
Expand All @@ -20,9 +21,9 @@ public class UTAutoSaveOFCompat
public static void updateOFConfig()
{
if (!UTLoadingPlugin.isClient) return;
if (!UTReflectionUtil.isClassLoaded("optifine.OptiFineTweaker")) return;
try
{
Class.forName("optifine.OptiFineTweaker");
UniversalTweaks.LOGGER.info("OptiFine detected, updating config file...");

Path ofConfigPath = Paths.get(rootFolder + File.separator + "optionsof.txt");
Expand Down
Loading

0 comments on commit 2e8209c

Please sign in to comment.