diff --git a/README.md b/README.md index 802c747a..1527076a 100644 --- a/README.md +++ b/README.md @@ -167,7 +167,9 @@ All changes are toggleable via config files. * **Hide Personal Effect Particles:** Disables potion effect particles emitting from yourself * **Horizontal Collision Damage:** Applies horizontal collision damage to the player akin to elytra collision * **Husk & Stray Spawning:** Lets husks and strays spawn underground like regular zombies and skeletons +* **Improve Barrier Particle Display:** Causes Barrier Particles to always be displayed to players in Creative mode * **Improve Language Switching Speed:** Improves the speed of switching languages in the Language GUI +* **Improve Server Connection Speed:** Improves the speed of connecting to servers by setting the InetAddress host name to the IP in situations where it can be represented as the IP address, preventing getHostFromNameService from being to be run * **Improved Entity Tracker Warning:** Provides more information to addPacket removed entity warnings * **Incurable Potions:** Excludes potion effects from being curable with curative items like buckets of milk * **Infinite Music:** Lets background music play continuously without delays @@ -184,6 +186,7 @@ All changes are toggleable via config files. * **Load Sounds:** Plays sounds when the game or the world are loaded * **Mending Overpowered:** If mending fix is enabled, repairs entire damaged inventory with XP * **Mending:** Only repairs damaged equipment with XP +* **Minecart Drops Itself:** Replaces vanilla Minecarts dropping a Minecart and the contained item, and instead drop the combined item * **Mob Despawn Improvement:** Mobs carrying picked up items will drop their equipment and despawn properly * **Modern Knockback:** Backports 1.16+ knockback to 1.12: Knockback resistance is now a scale instead of a probability * **More Banner Layers:** Sets the amount of applicable pattern layers for banners @@ -204,6 +207,7 @@ All changes are toggleable via config files. * **Offhand Improvement:** Prevents placing offhand blocks when blocks or food are held in the mainhand * **Overhaul Beacon:** Change how beacon construct and range apply per level * **Overlay Message Height:** Sets the Y value of the overlay message (action bar), displayed for playing records etc. +* **Particle Limit:** Limits particles to a set amount. Should not be set too low, as it will cause particles to appear for a single tick before vanishing * **Pickup Notification:** Displays highly configurable notifications when the player obtains or loses items * **Player Speed:** Enables the modification of base and maximum player speeds along with fixing 'Player moved too quickly' messages * **Prevent Observer Activating on Placement:** Controls if the observer activates itself on the first tick when it is placed @@ -213,7 +217,7 @@ All changes are toggleable via config files. * **Rabbit Toast Spawning:** Configurable chance for rabbits to spawn as the Toast variant * **Rally Health:** Adds Bloodborne's Rally system to Minecraft, regain lost health when attacking back within the risk time * **Remove 3D Anaglyph Button:** Removes the 3D Anaglyph button from the video settings menu -* **Remove Realms Button:** Removes the redundant Minecraft Realms button from the main menu +* **Remove Realms Button:** Removes the redundant Minecraft Realms button from the main menu and silences notifications * **Remove Recipe Book:** Removes the recipe book button from GUIs * **Remove Snooper:** Forcefully turns off the snooper and hides the snooper settings button from the options menu * **Render End Portal Bottom:** Controls if the End Portal renders its texture on the bottom face @@ -303,6 +307,7 @@ All changes are toggleable via config files. * **Epic Siege Mod** * **Disable Digger AI Debug:** Disables leftover debug logging inside the digger AI of the beta builds * **Extra Utilities 2** + * **Catch Radar Exception:** Fixes the Radar feature (find in nearby inventories) entirely breaking when near some inventories * **Duplication Fixes:** Fixes various duplication exploits * **Fix Deep Dark Stats:** Fixes Mob Attack and Health Statistics being repeatedly doubled * **Mutable Machine Block Drops:** Fixes Machine Block drops being immutable, causing a crash on attempting to remove entries from the list. diff --git a/build.gradle b/build.gradle index fdf03e73..21534757 100644 --- a/build.gradle +++ b/build.gradle @@ -153,6 +153,7 @@ dependencies { compileOnly rfg.deobf('curse.maven:openblocks-228816:2699056') compileOnly rfg.deobf('curse.maven:reborn-core-237903:3330308') compileOnly rfg.deobf('curse.maven:reskillable-286382:2815686') + compileOnly rfg.deobf('curse.maven:requious-frakto-336748:3218640') compileOnly rfg.deobf('curse.maven:roost-277711:2702080') compileOnly rfg.deobf('curse.maven:simpledifficulty-360779:3613814') compileOnly rfg.deobf('curse.maven:storage-drawers-223852:2952606') diff --git a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigMods.java b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigMods.java index 5f2131dd..15ecaa20 100644 --- a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigMods.java +++ b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigMods.java @@ -159,6 +159,10 @@ public class UTConfigMods @Config.Name("Railcraft") public static final RailcraftCategory RAILCRAFT = new RailcraftCategory(); + @Config.LangKey("cfg.universaltweaks.modintegration.requiousfrakto") + @Config.Name("Requious Frakto") + public static final RequiousFraktoCategory REQUIOUS_FRAKTO = new RequiousFraktoCategory(); + @Config.LangKey("cfg.universaltweaks.modintegration.rftoolsdimensions") @Config.Name("RFTools Dimensions") public static final RFToolsDimensionsCategory RFTOOLS_DIMENSIONS = new RFToolsDimensionsCategory(); @@ -435,6 +439,15 @@ public static class ErebusCategory public static class ExtraUtilitiesCategory { + @Config.RequiresMcRestart + @Config.Name("Catch Radar Exception") + @Config.Comment + ({ + "When near some inventories, the Radar feature (find in nearby inventories) will entirely break", + "this catches the AbstractMethodException thrown, allowing other nearby inventories to be searched" + }) + public boolean utCatchRadarException = true; + @Config.RequiresMcRestart @Config.Name("Fix Deep Dark Stats") @Config.Comment("Fixes Mob Attack and Health Statistics being repeatedly doubled") @@ -658,6 +671,14 @@ public static class RailcraftCategory public boolean utNoBetaWarningToggle = true; } + public static class RequiousFraktoCategory + { + @Config.RequiresMcRestart + @Config.Name("Particle Fixes") + @Config.Comment("Fixes server world being leaked to various particles") + public boolean utParticleFixesToggle = true; + } + public static class RoostCategory { @Config.RequiresMcRestart @@ -964,6 +985,11 @@ public static class TinkersConstructCategory @Config.Comment("Fixes various duplication exploits") public boolean utDuplicationFixesToggle = true; + @Config.RequiresMcRestart + @Config.Name("Particle Fixes") + @Config.Comment("Fixes server world being leaked to various particles") + public boolean utParticleFixesToggle = true; + @Config.RequiresMcRestart @Config.Name("Tool Customization") @Config.Comment("Enables usage of tweaks in below category to customize Tinkers' tools stats") diff --git a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java index 5d4783a3..0aeb2acc 100644 --- a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java +++ b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java @@ -158,6 +158,11 @@ public static class BlocksCategory @Config.Comment("Determines how long falling blocks remain in ticks until they are dropped under normal circumstances") public int utFallingBlockLifespan = 600; + @Config.RequiresMcRestart + @Config.Name("Improve Barrier Particle Display") + @Config.Comment("Causes Barrier Particles to always be displayed to players in Creative mode") + public boolean utBarrierParticleDisplay = false; + @Config.RequiresMcRestart @Config.Name("Prevent Observer Activating on Placement") @Config.Comment("Controls if the observer activates itself on the first tick when it is placed") @@ -536,6 +541,11 @@ public static class EntitiesCategory @Config.Comment("Backports 1.16+ knockback to 1.12: Knockback resistance is now a scale instead of a probability") public boolean utModernKnockbackToggle = true; + @Config.RequiresMcRestart + @Config.Name("Minecart Drops Itself") + @Config.Comment("Replaces vanilla Minecarts dropping a Minecart and the contained item, and instead drop the combined item") + public boolean utMinecartDropsType = false; + @Config.RequiresMcRestart @Config.Name("No Portal Spawning") @Config.Comment("Prevents zombie pigmen spawning from nether portals") @@ -1484,6 +1494,16 @@ public static class MiscCategory @Config.Comment("Disables potion effect particles emitting from yourself") public boolean utPoVEffectParticles = false; + @Config.RequiresMcRestart + @Config.Name("Particle Limit") + @Config.Comment + ({ + "Limits particles to a set amount. Should not be set too low, as it will cause particles to appear for a single tick before vanishing", + "Vanilla default is 16384", + "Less than or equal to 0 is set to the default" + }) + public int utParticleLimit = -1; + @Config.RequiresMcRestart @Config.Name("No Smelting XP") @Config.Comment("Disables the experience reward when smelting items in furnaces") @@ -1516,7 +1536,7 @@ public static class MiscCategory @Config.Name("Remove Realms Button") @Config.Comment ({ - "Removes the redundant Minecraft Realms button from the main menu", + "Removes the redundant Minecraft Realms button from the main menu and silences notifications", "Incompatible with RandomPatches" }) public boolean utRealmsButtonToggle = true; @@ -1983,6 +2003,15 @@ public static class PerformanceCategory @Config.Comment("Improves the speed of switching languages in the Language GUI") public boolean utImproveLanguageSwitchingSpeed = true; + @Config.RequiresMcRestart + @Config.Name("Improve Server Connection Speed") + @Config.Comment + ({ + "Improves the speed of connecting to servers by setting the InetAddress host name to the IP in situations", + "where it can be represented as the IP address, preventing getHostFromNameService from being to be run" + }) + public boolean utImproveServerConnectionSpeed = true; + @Config.RequiresMcRestart @Config.Name("Mute Advancement Errors") @Config.Comment("Silences advancement errors") diff --git a/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java b/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java index d5ff7333..79c55177 100644 --- a/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java +++ b/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java @@ -72,6 +72,7 @@ public class UTLoadingPlugin implements IFMLLoadingPlugin, IEarlyMixinLoader put("mixins.bugfixes.world.chunksaving.json", () -> UTConfigBugfixes.WORLD.utChunkSavingToggle && !spongeForgeLoaded); put("mixins.bugfixes.world.tileentities.json", () -> UTConfigBugfixes.WORLD.utTileEntityMap != UTConfigBugfixes.WorldCategory.EnumMaps.HASHMAP); put("mixins.bugfixes.world.witchhuts.json", () -> UTConfigBugfixes.WORLD.utWitchStructuresToggle); + put("mixins.tweaks.blocks.barrier.json", () -> UTConfigTweaks.BLOCKS.utBarrierParticleDisplay); put("mixins.tweaks.blocks.bedobstruction.json", () -> UTConfigTweaks.BLOCKS.utBedObstructionToggle); put("mixins.tweaks.blocks.breakablebedrock.json", () -> UTConfigTweaks.BLOCKS.BREAKABLE_BEDROCK.utBreakableBedrockToggle); put("mixins.tweaks.blocks.endcrystal.json", () -> UTConfigTweaks.BLOCKS.utEndCrystalAnywherePlacing); @@ -100,6 +101,7 @@ public class UTLoadingPlugin implements IFMLLoadingPlugin, IEarlyMixinLoader put("mixins.tweaks.entities.damage.velocity.json", () -> UTConfigTweaks.ENTITIES.DAMAGE_VELOCITY.utDamageVelocityToggle); put("mixins.tweaks.entities.despawning.json", () -> UTConfigTweaks.ENTITIES.utMobDespawnToggle); put("mixins.tweaks.entities.loot.json", () -> UTConfigTweaks.ENTITIES.utCreeperMusicDiscsToggle); + put("mixins.tweaks.entities.minecart.json", () -> UTConfigTweaks.ENTITIES.utMinecartDropsType); put("mixins.tweaks.entities.playerdismount.json", () -> UTConfigTweaks.MISC.utUseSeparateDismountKey); put("mixins.tweaks.entities.saturation.json", () -> UTConfigTweaks.ENTITIES.utRidingExhaustion != 0.0D); put("mixins.tweaks.entities.spawning.caps.json", () -> UTConfigTweaks.ENTITIES.SPAWN_CAPS.utSpawnCapsToggle); @@ -199,11 +201,13 @@ public class UTLoadingPlugin implements IFMLLoadingPlugin, IEarlyMixinLoader put("mixins.tweaks.misc.narrator.json", () -> UTConfigTweaks.MISC.utDisableNarratorToggle); put("mixins.tweaks.misc.narratorkeybind.json", () -> UTConfigTweaks.MISC.utUseCustomNarratorKeybind); put("mixins.tweaks.misc.nightvisionflash.json", () -> UTConfigTweaks.MISC.utNightVisionFlashToggle); + put("mixins.tweaks.misc.particlelimit.json", () -> UTConfigTweaks.MISC.utParticleLimit > 0); put("mixins.tweaks.misc.personalpotionparticles.json", () -> UTConfigTweaks.MISC.utPoVEffectParticles); put("mixins.tweaks.misc.recipebook.client.json", () -> UTConfigTweaks.MISC.utRecipeBookToggle); put("mixins.tweaks.misc.smoothscrolling.json", () -> UTConfigTweaks.MISC.SMOOTH_SCROLLING.utSmoothScrollingToggle); put("mixins.tweaks.misc.toastcontrol.json", () -> UTConfigTweaks.MISC.TOAST_CONTROL.utToastControlToggle); put("mixins.tweaks.performance.audioreload.json", () -> UTConfigTweaks.PERFORMANCE.utDisableAudioDebugToggle && !surgeLoaded); + put("mixins.tweaks.performance.connectionspeed.json", () -> UTConfigTweaks.PERFORMANCE.utImproveLanguageSwitchingSpeed); put("mixins.tweaks.performance.fps.json", () -> UTConfigTweaks.PERFORMANCE.utUncapFPSToggle); put("mixins.tweaks.performance.languageswitching.json", () -> UTConfigTweaks.PERFORMANCE.utImproveLanguageSwitchingSpeed); put("mixins.tweaks.performance.missingmodel.json", () -> UTConfigTweaks.PERFORMANCE.utDisableFancyMissingModelToggle); diff --git a/src/main/java/mod/acgaming/universaltweaks/core/UTMixinLoader.java b/src/main/java/mod/acgaming/universaltweaks/core/UTMixinLoader.java index 8b70d398..7baab647 100644 --- a/src/main/java/mod/acgaming/universaltweaks/core/UTMixinLoader.java +++ b/src/main/java/mod/acgaming/universaltweaks/core/UTMixinLoader.java @@ -24,6 +24,7 @@ public class UTMixinLoader implements ILateMixinLoader 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.tconstruct.client.json", () -> loaded("tconstruct") && UTConfigMods.TINKERS_CONSTRUCT.utParticleFixesToggle); put("mixins.mods.thaumcraft.entities.client.json", () -> loaded("thaumcraft")); } }); @@ -59,6 +60,7 @@ public class UTMixinLoader implements ILateMixinLoader put("mixins.mods.extrautilities.deepdarkstats.json", () -> loaded("extrautils2") && UTConfigMods.EXTRA_UTILITIES.utDeepDarkStats); put("mixins.mods.extrautilities.dupes.json", () -> loaded("extrautils2") && UTConfigMods.EXTRA_UTILITIES.utDuplicationFixesToggle); put("mixins.mods.extrautilities.mutabledrops.json", () -> loaded("extrautils2") && UTConfigMods.EXTRA_UTILITIES.utMutableBlockDrops); + put("mixins.mods.extrautilities.radar.json", () -> loaded("extrautils2") && UTConfigMods.EXTRA_UTILITIES.utCatchRadarException); put("mixins.mods.forestry.cocoa.json", () -> loaded("forestry") && UTConfigMods.FORESTRY.utFOCocoaBeansToggle); put("mixins.mods.forestry.dupes.json", () -> loaded("forestry") && UTConfigMods.FORESTRY.utDuplicationFixesToggle); put("mixins.mods.forestry.extratrees.json", () -> loaded("extratrees")); @@ -77,6 +79,7 @@ public class UTMixinLoader implements ILateMixinLoader put("mixins.mods.nuclearcraft.json", () -> loaded("nuclearcraft")); put("mixins.mods.openblocks.json", () -> loaded("openblocks") && UTConfigMods.OPEN_BLOCKS.utLastStandFixToggle); put("mixins.mods.quark.dupes.json", () -> loaded("quark") && UTConfigMods.QUARK.utDuplicationFixesToggle); + put("mixins.mods.requiousfrakto.json", () -> loaded("requious") && UTConfigMods.REQUIOUS_FRAKTO.utParticleFixesToggle); put("mixins.mods.reskillable.json", () -> loaded("reskillable")); put("mixins.mods.rftoolsdimensions.json", () -> loaded("rftoolsdim")); put("mixins.mods.roost.contenttweaker.json", () -> loaded("contenttweaker")); diff --git a/src/main/java/mod/acgaming/universaltweaks/mods/extrautilities/radar/mixin/UTRadarPingMixin.java b/src/main/java/mod/acgaming/universaltweaks/mods/extrautilities/radar/mixin/UTRadarPingMixin.java new file mode 100644 index 00000000..bcdd468e --- /dev/null +++ b/src/main/java/mod/acgaming/universaltweaks/mods/extrautilities/radar/mixin/UTRadarPingMixin.java @@ -0,0 +1,32 @@ +package mod.acgaming.universaltweaks.mods.extrautilities.radar.mixin; + +import net.minecraft.item.ItemStack; +import net.minecraftforge.items.IItemHandler; + +import com.llamalad7.mixinextras.injector.wrapoperation.Operation; +import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; +import com.rwtema.extrautils2.crafting.Radar; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; + +import mod.acgaming.universaltweaks.config.UTConfigMods; + +// Courtesy of WaitingIdly +@Mixin(value = Radar.PacketPing.class, remap = false) +public abstract class UTRadarPingMixin +{ + @WrapOperation(method = "lambda$doStuffServer$1", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/items/IItemHandler;getStackInSlot(I)Lnet/minecraft/item/ItemStack;")) + private ItemStack utCatchItemHandlerException(IItemHandler instance, int slot, Operation original) + { + if (!UTConfigMods.EXTRA_UTILITIES.utCatchRadarException) return original.call(instance, slot); + try + { + return original.call(instance, slot); + } + catch (AbstractMethodError e) + { + e.printStackTrace(); + return ItemStack.EMPTY; + } + } +} diff --git a/src/main/java/mod/acgaming/universaltweaks/mods/requiousfrakto/mixin/UTTileEntityAssemblyMixin.java b/src/main/java/mod/acgaming/universaltweaks/mods/requiousfrakto/mixin/UTTileEntityAssemblyMixin.java new file mode 100644 index 00000000..7be5c9ba --- /dev/null +++ b/src/main/java/mod/acgaming/universaltweaks/mods/requiousfrakto/mixin/UTTileEntityAssemblyMixin.java @@ -0,0 +1,24 @@ +package mod.acgaming.universaltweaks.mods.requiousfrakto.mixin; + +import com.llamalad7.mixinextras.injector.ModifyExpressionValue; +import net.minecraft.tileentity.TileEntity; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import requious.tile.TileEntityAssembly; + +// Courtesy of jchung01 +@Mixin(value = TileEntityAssembly.class) +public abstract class UTTileEntityAssemblyMixin extends TileEntity +{ + /** + * @reason Updating MachineVisuals should only be needed client-side. + * This is the earliest we can check the side before calls to IProxy + * methods for spawning particles. + */ + @ModifyExpressionValue(method = "update", at = @At(value = "INVOKE", target = "Ljava/util/Iterator;hasNext()Z", remap = false)) + private boolean utCheckSide(boolean original) + { + if (!this.world.isRemote) return false; + return original; + } +} diff --git a/src/main/java/mod/acgaming/universaltweaks/mods/tconstruct/mixin/UTClientProxyMixin.java b/src/main/java/mod/acgaming/universaltweaks/mods/tconstruct/mixin/UTClientProxyMixin.java new file mode 100644 index 00000000..b1cd233c --- /dev/null +++ b/src/main/java/mod/acgaming/universaltweaks/mods/tconstruct/mixin/UTClientProxyMixin.java @@ -0,0 +1,27 @@ +package mod.acgaming.universaltweaks.mods.tconstruct.mixin; + +import com.llamalad7.mixinextras.sugar.Local; +import com.llamalad7.mixinextras.sugar.ref.LocalRef; +import net.minecraft.client.Minecraft; +import net.minecraft.world.World; +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.common.ClientProxy; + +// Courtesy of jchung01 +@Mixin(value = ClientProxy.class, remap = false) +public class UTClientProxyMixin +{ + /** + * @reason It is never correct to use passed worlds for particles, only use the client's. + * Ideally we would check sides in the relevant methods before even calling this, + * but this is simpler. + */ + @Inject(method = "spawnParticle", at = @At(value = "HEAD")) + private void utSetWorld(CallbackInfo ci, @Local(argsOnly = true) LocalRef worldRef) + { + worldRef.set(Minecraft.getMinecraft().world); + } +} diff --git a/src/main/java/mod/acgaming/universaltweaks/tweaks/blocks/barrier/mixin/UTBarrierParticleMixin.java b/src/main/java/mod/acgaming/universaltweaks/tweaks/blocks/barrier/mixin/UTBarrierParticleMixin.java new file mode 100644 index 00000000..6ef84222 --- /dev/null +++ b/src/main/java/mod/acgaming/universaltweaks/tweaks/blocks/barrier/mixin/UTBarrierParticleMixin.java @@ -0,0 +1,29 @@ +package mod.acgaming.universaltweaks.tweaks.blocks.barrier.mixin; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.multiplayer.WorldClient; +import net.minecraft.world.GameType; + +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.ModifyVariable; + +import mod.acgaming.universaltweaks.config.UTConfigTweaks; + +// Courtesy of WaitingIdly +@Mixin(WorldClient.class) +public class UTBarrierParticleMixin +{ + @Shadow + @Final + private Minecraft mc; + + @ModifyVariable(method = "doVoidFogParticles", at = @At(value = "STORE", ordinal = 0)) + private boolean utAlwaysDisplayBarrier(boolean original) + { + if (!UTConfigTweaks.BLOCKS.utBarrierParticleDisplay) return original; + return this.mc.playerController.getCurrentGameType() == GameType.CREATIVE; + } +} \ No newline at end of file diff --git a/src/main/java/mod/acgaming/universaltweaks/tweaks/entities/minecart/mixin/UTEntityMinecartMixin.java b/src/main/java/mod/acgaming/universaltweaks/tweaks/entities/minecart/mixin/UTEntityMinecartMixin.java new file mode 100644 index 00000000..dbf6a429 --- /dev/null +++ b/src/main/java/mod/acgaming/universaltweaks/tweaks/entities/minecart/mixin/UTEntityMinecartMixin.java @@ -0,0 +1,28 @@ +package mod.acgaming.universaltweaks.tweaks.entities.minecart.mixin; + +import net.minecraft.entity.item.*; +import net.minecraft.item.ItemStack; + +import com.llamalad7.mixinextras.injector.wrapoperation.Operation; +import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; + +import mod.acgaming.universaltweaks.config.UTConfigTweaks; + +// Courtesy of WaitingIdly +@Mixin(value = EntityMinecart.class) +public abstract class UTEntityMinecartMixin +{ + @WrapOperation(method = "killMinecart", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/item/EntityMinecart;entityDropItem(Lnet/minecraft/item/ItemStack;F)Lnet/minecraft/entity/item/EntityItem;")) + private EntityItem utDropMinecartType(EntityMinecart instance, ItemStack item, float y, Operation original) + { + if (!UTConfigTweaks.ENTITIES.utMinecartDropsType || !(instance instanceof EntityMinecartFurnace || instance instanceof EntityMinecartChest || instance instanceof EntityMinecartTNT || instance instanceof EntityMinecartHopper)) + { + return original.call(instance, instance, y); + } + ItemStack itemstack = instance.getCartItem().copy(); + if (instance.hasCustomName()) itemstack.setStackDisplayName(instance.getCustomNameTag()); + return original.call(instance, itemstack, y); + } +} \ No newline at end of file diff --git a/src/main/java/mod/acgaming/universaltweaks/tweaks/entities/minecart/mixin/UTEntityMinecartTypeMixin.java b/src/main/java/mod/acgaming/universaltweaks/tweaks/entities/minecart/mixin/UTEntityMinecartTypeMixin.java new file mode 100644 index 00000000..40d7bede --- /dev/null +++ b/src/main/java/mod/acgaming/universaltweaks/tweaks/entities/minecart/mixin/UTEntityMinecartTypeMixin.java @@ -0,0 +1,23 @@ +package mod.acgaming.universaltweaks.tweaks.entities.minecart.mixin; + +import net.minecraft.entity.item.EntityMinecartChest; +import net.minecraft.entity.item.EntityMinecartFurnace; +import net.minecraft.entity.item.EntityMinecartHopper; +import net.minecraft.entity.item.EntityMinecartTNT; + +import com.llamalad7.mixinextras.injector.ModifyExpressionValue; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; + +import mod.acgaming.universaltweaks.config.UTConfigTweaks; + +// Courtesy of WaitingIdly +@Mixin(value = {EntityMinecartFurnace.class, EntityMinecartChest.class, EntityMinecartTNT.class, EntityMinecartHopper.class}) +public abstract class UTEntityMinecartTypeMixin +{ + @ModifyExpressionValue(method = "killMinecart", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/GameRules;getBoolean(Ljava/lang/String;)Z")) + private boolean utPreventDropMinecartType(boolean original) + { + return !UTConfigTweaks.ENTITIES.utMinecartDropsType && original; + } +} \ No newline at end of file diff --git a/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/buttons/realms/mixin/UTRealmsButtonMainMenuMixin.java b/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/buttons/realms/mixin/UTRealmsButtonMainMenuMixin.java index aa0aad4f..db762dc5 100644 --- a/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/buttons/realms/mixin/UTRealmsButtonMainMenuMixin.java +++ b/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/buttons/realms/mixin/UTRealmsButtonMainMenuMixin.java @@ -5,16 +5,18 @@ import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.resources.I18n; -import mod.acgaming.universaltweaks.UniversalTweaks; -import mod.acgaming.universaltweaks.config.UTConfigGeneral; -import mod.acgaming.universaltweaks.config.UTConfigTweaks; +import com.llamalad7.mixinextras.injector.ModifyReturnValue; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -// Courtesy of Robitobi01 +import mod.acgaming.universaltweaks.UniversalTweaks; +import mod.acgaming.universaltweaks.config.UTConfigGeneral; +import mod.acgaming.universaltweaks.config.UTConfigTweaks; + +// Courtesy of Robitobi01, WaitingIdly @Mixin(GuiMainMenu.class) public class UTRealmsButtonMainMenuMixin extends GuiScreen { @@ -25,8 +27,18 @@ public class UTRealmsButtonMainMenuMixin extends GuiScreen public void utRemoveRealmsButtonMainMenu(int p_73969_1_, int p_73969_2_, CallbackInfo ci) { if (!UTConfigTweaks.MISC.utRealmsButtonToggle) return; - if (UTConfigGeneral.DEBUG.utDebugToggle) UniversalTweaks.LOGGER.debug("UTRealmsButtonMainMenu ::: Initialize buttons"); + if (UTConfigGeneral.DEBUG.utDebugToggle) + { + UniversalTweaks.LOGGER.debug("UTRealmsButtonMainMenu ::: Initialize buttons"); + } buttonList.add(modButton = new GuiButton(6, this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 2, I18n.format("fml.menu.mods"))); ci.cancel(); } + + @ModifyReturnValue(method = "areRealmsNotificationsEnabled", at = @At("RETURN")) + private boolean utDisableRealmNotification(boolean original) + { + if (!UTConfigTweaks.MISC.utRealmsButtonToggle) return original; + return false; + } } \ No newline at end of file diff --git a/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/particlelimit/mixin/UTParticleManagerMixin.java b/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/particlelimit/mixin/UTParticleManagerMixin.java new file mode 100644 index 00000000..a2e9ba0a --- /dev/null +++ b/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/particlelimit/mixin/UTParticleManagerMixin.java @@ -0,0 +1,21 @@ +package mod.acgaming.universaltweaks.tweaks.misc.particlelimit.mixin; + +import net.minecraft.client.particle.ParticleManager; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.Constant; +import org.spongepowered.asm.mixin.injection.ModifyConstant; + +import mod.acgaming.universaltweaks.config.UTConfigTweaks; + +// Courtesy of WaitingIdly +@Mixin(ParticleManager.class) +public class UTParticleManagerMixin +{ + @ModifyConstant(method = "updateEffects", constant = @Constant(intValue = 16384)) + public int utRenderParticles(int original) + { + if (UTConfigTweaks.MISC.utParticleLimit <= 0) return original; + return UTConfigTweaks.MISC.utParticleLimit; + } +} \ No newline at end of file diff --git a/src/main/java/mod/acgaming/universaltweaks/tweaks/performance/connectionspeed/UTConnectionPatch.java b/src/main/java/mod/acgaming/universaltweaks/tweaks/performance/connectionspeed/UTConnectionPatch.java new file mode 100644 index 00000000..b4f2cfc8 --- /dev/null +++ b/src/main/java/mod/acgaming/universaltweaks/tweaks/performance/connectionspeed/UTConnectionPatch.java @@ -0,0 +1,28 @@ +package mod.acgaming.universaltweaks.tweaks.performance.connectionspeed; + +import java.net.InetAddress; +import java.net.UnknownHostException; + +import com.google.common.net.InetAddresses; + +import mod.acgaming.universaltweaks.UniversalTweaks; + +public class UTConnectionPatch +{ + public static InetAddress patch(String hostName) throws UnknownHostException + { + return patch(InetAddress.getByName(hostName), hostName); + } + + @SuppressWarnings("UnstableApiUsage") + public static InetAddress patch(InetAddress original, String hostName) throws UnknownHostException + { + if (InetAddresses.isInetAddress(hostName)) + { + InetAddress patched = InetAddress.getByAddress(original.getHostAddress(), original.getAddress()); + UniversalTweaks.LOGGER.debug("Patching ip-only InetAddress from {} to {}", original, patched); + return patched; + } + return original; + } +} diff --git a/src/main/java/mod/acgaming/universaltweaks/tweaks/performance/connectionspeed/mixin/UTGuiConnectingMixin.java b/src/main/java/mod/acgaming/universaltweaks/tweaks/performance/connectionspeed/mixin/UTGuiConnectingMixin.java new file mode 100644 index 00000000..6e0457e2 --- /dev/null +++ b/src/main/java/mod/acgaming/universaltweaks/tweaks/performance/connectionspeed/mixin/UTGuiConnectingMixin.java @@ -0,0 +1,24 @@ +package mod.acgaming.universaltweaks.tweaks.performance.connectionspeed.mixin; + +import java.net.InetAddress; +import java.net.UnknownHostException; + +import com.llamalad7.mixinextras.injector.wrapoperation.Operation; +import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; + +import mod.acgaming.universaltweaks.config.UTConfigTweaks; +import mod.acgaming.universaltweaks.tweaks.performance.connectionspeed.UTConnectionPatch; + +// Courtesy of WaitingIdly +@Mixin(targets = "net.minecraft.client.multiplayer.GuiConnecting$1") +public class UTGuiConnectingMixin +{ + @WrapOperation(method = "run", at = @At(value = "INVOKE", target = "Ljava/net/InetAddress;getByName(Ljava/lang/String;)Ljava/net/InetAddress;")) + private InetAddress utPatchInetAddress(String ip, Operation original) throws UnknownHostException + { + if (!UTConfigTweaks.PERFORMANCE.utImproveServerConnectionSpeed) return original.call(ip); + return UTConnectionPatch.patch(ip); + } +} diff --git a/src/main/java/mod/acgaming/universaltweaks/tweaks/performance/connectionspeed/mixin/UTRealmsConnectMixin.java b/src/main/java/mod/acgaming/universaltweaks/tweaks/performance/connectionspeed/mixin/UTRealmsConnectMixin.java new file mode 100644 index 00000000..8ad34ffa --- /dev/null +++ b/src/main/java/mod/acgaming/universaltweaks/tweaks/performance/connectionspeed/mixin/UTRealmsConnectMixin.java @@ -0,0 +1,24 @@ +package mod.acgaming.universaltweaks.tweaks.performance.connectionspeed.mixin; + +import java.net.InetAddress; +import java.net.UnknownHostException; + +import com.llamalad7.mixinextras.injector.wrapoperation.Operation; +import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; + +import mod.acgaming.universaltweaks.config.UTConfigTweaks; +import mod.acgaming.universaltweaks.tweaks.performance.connectionspeed.UTConnectionPatch; + +// Courtesy of WaitingIdly +@Mixin(targets = "net.minecraft.realms.RealmsConnect$1") +public class UTRealmsConnectMixin +{ + @WrapOperation(method = "run", at = @At(value = "INVOKE", target = "Ljava/net/InetAddress;getByName(Ljava/lang/String;)Ljava/net/InetAddress;")) + private InetAddress utPatchInetAddress(String ip, Operation original) throws UnknownHostException + { + if (!UTConfigTweaks.PERFORMANCE.utImproveServerConnectionSpeed) return original.call(ip); + return UTConnectionPatch.patch(ip); + } +} diff --git a/src/main/java/mod/acgaming/universaltweaks/tweaks/performance/connectionspeed/mixin/UTServerPingerMixin.java b/src/main/java/mod/acgaming/universaltweaks/tweaks/performance/connectionspeed/mixin/UTServerPingerMixin.java new file mode 100644 index 00000000..c0bea2dd --- /dev/null +++ b/src/main/java/mod/acgaming/universaltweaks/tweaks/performance/connectionspeed/mixin/UTServerPingerMixin.java @@ -0,0 +1,26 @@ +package mod.acgaming.universaltweaks.tweaks.performance.connectionspeed.mixin; + +import java.net.InetAddress; +import java.net.UnknownHostException; + +import net.minecraft.client.network.ServerPinger; + +import com.llamalad7.mixinextras.injector.wrapoperation.Operation; +import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; + +import mod.acgaming.universaltweaks.config.UTConfigTweaks; +import mod.acgaming.universaltweaks.tweaks.performance.connectionspeed.UTConnectionPatch; + +// Courtesy of WaitingIdly +@Mixin(value = ServerPinger.class) +public class UTServerPingerMixin +{ + @WrapOperation(method = "ping", at = @At(value = "INVOKE", target = "Ljava/net/InetAddress;getByName(Ljava/lang/String;)Ljava/net/InetAddress;")) + private InetAddress utPatchInetAddress(String ip, Operation original) throws UnknownHostException + { + if (!UTConfigTweaks.PERFORMANCE.utImproveServerConnectionSpeed) return original.call(ip); + return UTConnectionPatch.patch(ip); + } +} diff --git a/src/main/resources/assets/universaltweaks/lang/en_us.lang b/src/main/resources/assets/universaltweaks/lang/en_us.lang index 63fa116b..7924d0e0 100644 --- a/src/main/resources/assets/universaltweaks/lang/en_us.lang +++ b/src/main/resources/assets/universaltweaks/lang/en_us.lang @@ -85,6 +85,7 @@ cfg.universaltweaks.modintegration.projectred=ProjectRed cfg.universaltweaks.modintegration.quark=Quark cfg.universaltweaks.modintegration.rftoolsdimensions=RFTools Dimensions cfg.universaltweaks.modintegration.railcraft=Railcraft +cfg.universaltweaks.modintegration.requiousfrakto=Requious Frakto cfg.universaltweaks.modintegration.roost=Roost cfg.universaltweaks.modintegration.steamworld=SteamWorld cfg.universaltweaks.modintegration.sd=Storage Drawers diff --git a/src/main/resources/mixins.mods.extrautilities.radar.json b/src/main/resources/mixins.mods.extrautilities.radar.json new file mode 100644 index 00000000..3f2a04b6 --- /dev/null +++ b/src/main/resources/mixins.mods.extrautilities.radar.json @@ -0,0 +1,7 @@ +{ + "package": "mod.acgaming.universaltweaks.mods.extrautilities.radar.mixin", + "refmap": "universaltweaks.refmap.json", + "minVersion": "0.8", + "compatibilityLevel": "JAVA_8", + "mixins": ["UTRadarPingMixin"] +} \ No newline at end of file diff --git a/src/main/resources/mixins.mods.requiousfrakto.json b/src/main/resources/mixins.mods.requiousfrakto.json new file mode 100644 index 00000000..fac29229 --- /dev/null +++ b/src/main/resources/mixins.mods.requiousfrakto.json @@ -0,0 +1,7 @@ +{ + "package": "mod.acgaming.universaltweaks.mods.requiousfrakto.mixin", + "refmap": "universaltweaks.refmap.json", + "minVersion": "0.8", + "compatibilityLevel": "JAVA_8", + "mixins": ["UTTileEntityAssemblyMixin"] +} \ No newline at end of file diff --git a/src/main/resources/mixins.mods.tconstruct.client.json b/src/main/resources/mixins.mods.tconstruct.client.json new file mode 100644 index 00000000..abf061aa --- /dev/null +++ b/src/main/resources/mixins.mods.tconstruct.client.json @@ -0,0 +1,7 @@ +{ + "package": "mod.acgaming.universaltweaks.mods.tconstruct.mixin", + "refmap": "universaltweaks.refmap.json", + "minVersion": "0.8", + "compatibilityLevel": "JAVA_8", + "client": ["UTClientProxyMixin"] +} \ No newline at end of file diff --git a/src/main/resources/mixins.tweaks.blocks.barrier.json b/src/main/resources/mixins.tweaks.blocks.barrier.json new file mode 100644 index 00000000..b2200c76 --- /dev/null +++ b/src/main/resources/mixins.tweaks.blocks.barrier.json @@ -0,0 +1,7 @@ +{ + "package": "mod.acgaming.universaltweaks.tweaks.blocks.barrier.mixin", + "refmap": "universaltweaks.refmap.json", + "minVersion": "0.8", + "compatibilityLevel": "JAVA_8", + "client": ["UTBarrierParticleMixin"] +} \ No newline at end of file diff --git a/src/main/resources/mixins.tweaks.entities.minecart.json b/src/main/resources/mixins.tweaks.entities.minecart.json new file mode 100644 index 00000000..d3e1e7aa --- /dev/null +++ b/src/main/resources/mixins.tweaks.entities.minecart.json @@ -0,0 +1,7 @@ +{ + "package": "mod.acgaming.universaltweaks.tweaks.entities.minecart.mixin", + "refmap": "universaltweaks.refmap.json", + "minVersion": "0.8", + "compatibilityLevel": "JAVA_8", + "mixins": ["UTEntityMinecartMixin", "UTEntityMinecartTypeMixin"] +} \ No newline at end of file diff --git a/src/main/resources/mixins.tweaks.misc.particlelimit.json b/src/main/resources/mixins.tweaks.misc.particlelimit.json new file mode 100644 index 00000000..dd0651a1 --- /dev/null +++ b/src/main/resources/mixins.tweaks.misc.particlelimit.json @@ -0,0 +1,7 @@ +{ + "package": "mod.acgaming.universaltweaks.tweaks.misc.particlelimit.mixin", + "refmap": "universaltweaks.refmap.json", + "minVersion": "0.8", + "compatibilityLevel": "JAVA_8", + "client": ["UTParticleManagerMixin"] +} \ No newline at end of file diff --git a/src/main/resources/mixins.tweaks.performance.connectionspeed.json b/src/main/resources/mixins.tweaks.performance.connectionspeed.json new file mode 100644 index 00000000..4c555cd5 --- /dev/null +++ b/src/main/resources/mixins.tweaks.performance.connectionspeed.json @@ -0,0 +1,7 @@ +{ + "package": "mod.acgaming.universaltweaks.tweaks.performance.connectionspeed.mixin", + "refmap": "universaltweaks.refmap.json", + "minVersion": "0.8", + "compatibilityLevel": "JAVA_8", + "client": ["UTGuiConnectingMixin", "UTRealmsConnectMixin", "UTServerPingerMixin"] +} \ No newline at end of file