forked from Sk1erLLC/Patcher
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add all blocks for better camera (#79)
- Loading branch information
1 parent
911aa28
commit 11eede6
Showing
2 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
src/main/java/club/sk1er/patcher/mixins/features/WorldMixin_CameraPerspective.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package club.sk1er.patcher.mixins.features; | ||
|
||
import club.sk1er.patcher.config.PatcherConfig; | ||
import com.google.common.collect.Sets; | ||
import net.minecraft.block.Block; | ||
import net.minecraft.block.state.IBlockState; | ||
import net.minecraft.init.Blocks; | ||
import net.minecraft.util.AxisAlignedBB; | ||
import net.minecraft.util.BlockPos; | ||
import net.minecraft.world.World; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Unique; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Redirect; | ||
|
||
import java.util.Set; | ||
|
||
@Mixin(World.class) | ||
public abstract class WorldMixin_CameraPerspective { | ||
@Unique | ||
private static final Set<Block> patcher$ignoredBlocks = Sets.newHashSet( | ||
Blocks.glass, | ||
Blocks.stained_glass, | ||
Blocks.glass_pane, | ||
Blocks.stained_glass_pane, | ||
Blocks.iron_bars | ||
); | ||
|
||
@Redirect(method = "rayTraceBlocks(Lnet/minecraft/util/Vec3;Lnet/minecraft/util/Vec3;ZZZ)Lnet/minecraft/util/MovingObjectPosition;", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/Block;getCollisionBoundingBox(Lnet/minecraft/world/World;Lnet/minecraft/util/BlockPos;Lnet/minecraft/block/state/IBlockState;)Lnet/minecraft/util/AxisAlignedBB;", ordinal = 1)) | ||
private AxisAlignedBB patcher$shouldCancel(Block instance, World world, BlockPos blockPos, IBlockState iBlockState) { | ||
if (PatcherConfig.betterCamera && patcher$ignoredBlocks.contains(iBlockState.getBlock())) return null; | ||
return instance.getCollisionBoundingBox(world, blockPos, iBlockState); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters