From bc6311538d2ff6346827e2f56190a52fa3ed78b0 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Fri, 5 Jul 2024 09:03:04 -0700 Subject: [PATCH 1/2] Third Person Ignores Non-solid Blocks --- README.md | 1 + .../config/UTConfigTweaks.java | 5 ++++ .../universaltweaks/core/UTLoadingPlugin.java | 1 + .../playerf5/mixin/UTEntityRendererMixin.java | 25 +++++++++++++++++++ .../mixins.tweaks.entities.playerf5.json | 7 ++++++ 5 files changed, 39 insertions(+) create mode 100644 src/main/java/mod/acgaming/universaltweaks/tweaks/entities/playerf5/mixin/UTEntityRendererMixin.java create mode 100644 src/main/resources/mixins.tweaks.entities.playerf5.json diff --git a/README.md b/README.md index 12862efd..bb94b567 100644 --- a/README.md +++ b/README.md @@ -241,6 +241,7 @@ All changes are toggleable via config files. * **Super Hot Torch:** Enables one-time ignition of entities by hitting them with a torch * **Stronghold Enforcement:** Enforces stronghold generation to generate all blocks, regardless of air * **Swing Through Grass:** Allows hitting entities through grass instead of breaking it +* **Third Person Ignores Non-solid Blocks:** When viewing in third person, don't stop the camera on non-solid blocks * **Tidy Chunk:** Tidies newly generated chunks by removing scattered item entities * **Toast Control:** Enables the control of toasts (pop-up text boxes) * **Toggle Cheats Button:** Adds a button to the pause menu to toggle cheats diff --git a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java index 4d1b9559..0bbe5cce 100644 --- a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java +++ b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java @@ -528,6 +528,11 @@ public static class EntitiesCategory @Config.Comment("Sets the offset for the fire overlay in first person when the player is burning") public double utFirstPersonBurningOverlay = -0.3D; + @Config.RequiresMcRestart + @Config.Name("Third Person Ignores Non-solid Blocks") + @Config.Comment("When viewing in third person, don't stop the camera on non-solid blocks") + public boolean utThirdPersonIgnoresNonSolidBlocks = false; + @Config.RequiresMcRestart @Config.Name("Husk & Stray Spawning") @Config.Comment("Lets husks and strays spawn underground like regular zombies and skeletons") diff --git a/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java b/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java index 35f49f84..8a8d9dca 100644 --- a/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java +++ b/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java @@ -176,6 +176,7 @@ public class UTLoadingPlugin implements IFMLLoadingPlugin, IEarlyMixinLoader put("mixins.tweaks.blocks.betterplacement.json", () -> UTConfigTweaks.BLOCKS.BETTER_PLACEMENT.utBetterPlacementToggle); put("mixins.tweaks.entities.autojump.json", () -> UTConfigTweaks.ENTITIES.utAutoJumpToggle); put("mixins.tweaks.entities.burning.player.json", () -> UTConfigTweaks.ENTITIES.utFirstPersonBurningOverlay != -0.3D); + put("mixins.tweaks.entities.playerf5.json", () -> UTConfigTweaks.ENTITIES.utThirdPersonIgnoresNonSolidBlocks); put("mixins.tweaks.items.attackcooldown.client.json", () -> UTConfigTweaks.ITEMS.ATTACK_COOLDOWN.utAttackCooldownToggle); put("mixins.tweaks.items.itementities.client.json", () -> UTConfigTweaks.ITEMS.ITEM_ENTITIES.utItemEntitiesToggle); put("mixins.tweaks.misc.advancements.guisize.json", () -> UTConfigTweaks.MISC.ADVANCEMENTS.utAdvancementsToggle); diff --git a/src/main/java/mod/acgaming/universaltweaks/tweaks/entities/playerf5/mixin/UTEntityRendererMixin.java b/src/main/java/mod/acgaming/universaltweaks/tweaks/entities/playerf5/mixin/UTEntityRendererMixin.java new file mode 100644 index 00000000..9a33b4a2 --- /dev/null +++ b/src/main/java/mod/acgaming/universaltweaks/tweaks/entities/playerf5/mixin/UTEntityRendererMixin.java @@ -0,0 +1,25 @@ +package mod.acgaming.universaltweaks.tweaks.entities.playerf5.mixin; + +import net.minecraft.client.multiplayer.WorldClient; +import net.minecraft.client.renderer.EntityRenderer; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.math.Vec3d; + +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(EntityRenderer.class) +public abstract class UTEntityRendererMixin +{ + @WrapOperation(method = "orientCamera", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/WorldClient;rayTraceBlocks(Lnet/minecraft/util/math/Vec3d;Lnet/minecraft/util/math/Vec3d;)Lnet/minecraft/util/math/RayTraceResult;")) + private RayTraceResult utCamaraBypassesNonSolidBlocks(WorldClient instance, Vec3d start, Vec3d end, Operation original) + { + if (!UTConfigTweaks.ENTITIES.utThirdPersonIgnoresNonSolidBlocks) return original.call(instance, start, end); + return instance.rayTraceBlocks(start, end, false, true, true); + } +} diff --git a/src/main/resources/mixins.tweaks.entities.playerf5.json b/src/main/resources/mixins.tweaks.entities.playerf5.json new file mode 100644 index 00000000..489b5da1 --- /dev/null +++ b/src/main/resources/mixins.tweaks.entities.playerf5.json @@ -0,0 +1,7 @@ +{ + "package": "mod.acgaming.universaltweaks.tweaks.entities.playerf5.mixin", + "refmap": "universaltweaks.refmap.json", + "minVersion": "0.8", + "compatibilityLevel": "JAVA_8", + "client": ["UTEntityRendererMixin"] +} \ No newline at end of file From 6d4bdf28718855f79b82b8ed35060e4239ccd708 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Fri, 5 Jul 2024 09:17:57 -0700 Subject: [PATCH 2/2] obsolete f5fix --- .../universaltweaks/util/compat/UTObsoleteModsHandler.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/mod/acgaming/universaltweaks/util/compat/UTObsoleteModsHandler.java b/src/main/java/mod/acgaming/universaltweaks/util/compat/UTObsoleteModsHandler.java index e186b874..90c00b46 100644 --- a/src/main/java/mod/acgaming/universaltweaks/util/compat/UTObsoleteModsHandler.java +++ b/src/main/java/mod/acgaming/universaltweaks/util/compat/UTObsoleteModsHandler.java @@ -63,6 +63,7 @@ public class UTObsoleteModsHandler put("erebusfix", () -> UTConfigMods.EREBUS.utEBPreservedBlocksToggle); put("experiencebugfix", () -> UTConfigBugfixes.ENTITIES.utDimensionChangeToggle); put("eyltrafix", () -> UTConfigBugfixes.ENTITIES.utElytraDeploymentLandingToggle); + put("f5fix", () -> UTConfigTweaks.ENTITIES.utThirdPersonIgnoresNonSolidBlocks); put("fastbench", () -> UTConfigTweaks.PERFORMANCE.utCraftingCacheToggle); put("fastleafdecay", () -> UTConfigTweaks.BLOCKS.utLeafDecayToggle); put("fencejumper", () -> UTConfigTweaks.BLOCKS.utFenceWallJumpToggle);