Skip to content

Commit

Permalink
Merge pull request #509 from WaitingIdly/third-person-non-solid
Browse files Browse the repository at this point in the history
Third Person Ignores Non-solid Blocks
  • Loading branch information
ACGaming authored Jul 5, 2024
2 parents f7e7d81 + 6d4bdf2 commit d219a34
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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<RayTraceResult> original)
{
if (!UTConfigTweaks.ENTITIES.utThirdPersonIgnoresNonSolidBlocks) return original.call(instance, start, end);
return instance.rayTraceBlocks(start, end, false, true, true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,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);
Expand Down
7 changes: 7 additions & 0 deletions src/main/resources/mixins.tweaks.entities.playerf5.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"package": "mod.acgaming.universaltweaks.tweaks.entities.playerf5.mixin",
"refmap": "universaltweaks.refmap.json",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"client": ["UTEntityRendererMixin"]
}

0 comments on commit d219a34

Please sign in to comment.