From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: JellySquid Date: Mon, 11 May 2020 21:02:57 +0200 Subject: [PATCH] lithium MixinBox Original code by JellySquid, licensed under GNU Lesser General Public License v3.0 you can find the original code on https://github.com/CaffeineMC/lithium-fabric/ (Yarn mappings) diff --git a/src/main/java/net/minecraft/world/phys/AxisAlignedBB.java b/src/main/java/net/minecraft/world/phys/AxisAlignedBB.java index 0248ff18bf3f2dede4d0dda90df5e0eea56b7708..7a3577f919a250eb61b2dfb8d65e668f7af45220 100644 --- a/src/main/java/net/minecraft/world/phys/AxisAlignedBB.java +++ b/src/main/java/net/minecraft/world/phys/AxisAlignedBB.java @@ -197,12 +197,38 @@ public class AxisAlignedBB { return new AxisAlignedBB(vec3d.x, vec3d.y, vec3d.z, vec3d.x + 1.0D, vec3d.y + 1.0D, vec3d.z + 1.0D); } + /** + * @reason Simplify the code to better help the JVM optimize it + * @author JellySquid + */ public double a(EnumDirection.EnumAxis enumdirection_enumaxis) { - return enumdirection_enumaxis.a(this.minX, this.minY, this.minZ); + switch (enumdirection_enumaxis) { + case X: + return this.minX; + case Y: + return this.minY; + case Z: + return this.minZ; + } + + throw new IllegalArgumentException(); } + /** + * @reason Simplify the code to better help the JVM optimize it + * @author JellySquid + */ public double b(EnumDirection.EnumAxis enumdirection_enumaxis) { - return enumdirection_enumaxis.a(this.maxX, this.maxY, this.maxZ); + switch (enumdirection_enumaxis) { + case X: + return this.maxX; + case Y: + return this.maxY; + case Z: + return this.maxZ; + } + + throw new IllegalArgumentException(); } public boolean equals(Object object) {