-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixDebugBoundingBox being offset up for the player (#104)
* fixDebugBoundingBox * forgot Side.CLIENT
- Loading branch information
Showing
3 changed files
with
53 additions
and
1 deletion.
There are no files selected for viewing
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
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
40 changes: 40 additions & 0 deletions
40
src/main/java/com/mitchej123/hodgepodge/mixins/minecraft/MixinRenderManager.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,40 @@ | ||
package com.mitchej123.hodgepodge.mixins.minecraft; | ||
|
||
import net.minecraft.client.entity.EntityPlayerSP; | ||
import net.minecraft.client.renderer.entity.RenderManager; | ||
import net.minecraft.entity.Entity; | ||
import net.minecraft.util.AxisAlignedBB; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Redirect; | ||
|
||
@Mixin(RenderManager.class) | ||
public class MixinRenderManager { | ||
|
||
@Redirect( | ||
method = "renderDebugBoundingBox", | ||
at = | ||
@At( | ||
value = "INVOKE", | ||
target = | ||
"Lnet/minecraft/util/AxisAlignedBB;getBoundingBox(DDDDDD)Lnet/minecraft/util/AxisAlignedBB;")) | ||
public AxisAlignedBB hodgepodge$fixDebugBoundingBox( | ||
double minX, | ||
double minY, | ||
double minZ, | ||
double maxX, | ||
double maxY, | ||
double maxZ, | ||
Entity entity, | ||
double p_85094_2_, | ||
double p_85094_4_, | ||
double p_85094_6_, | ||
float p_85094_8_, | ||
float p_85094_9_) { | ||
if (entity instanceof EntityPlayerSP) { | ||
final float offset = -1.62F + (entity.isSneaking() ? 0.08F : 0); | ||
return AxisAlignedBB.getBoundingBox(minX, minY + offset, minZ, maxX, maxY + offset, maxZ); | ||
} | ||
return AxisAlignedBB.getBoundingBox(minX, minY, minZ, maxX, maxY, maxZ); | ||
} | ||
} |