A less atrocious approach to fixing 95

This commit is contained in:
Brady 2018-08-25 23:12:43 -05:00
parent 7d863ebfed
commit 1801551d3b
No known key found for this signature in database
GPG Key ID: 73A788379A197567
2 changed files with 12 additions and 18 deletions

View File

@ -21,29 +21,23 @@ import com.google.common.base.MoreObjects;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3i; import net.minecraft.util.math.Vec3i;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect; import javax.annotation.Nonnull;
/** /**
* @author Brady * @author Brady
* @since 8/25/2018 * @since 8/25/2018
*/ */
@Mixin(Vec3i.class) @Mixin(BlockPos.class)
public class MixinVec3i { public abstract class MixinBlockPos extends Vec3i {
@Redirect( public MixinBlockPos(int xIn, int yIn, int zIn) {
method = "toString", super(xIn, yIn, zIn);
at = @At( }
value = "INVOKE",
target = "com/google/common/base/MoreObjects.toStringHelper(Ljava/lang/Object;)Lcom/google/common/base/MoreObjects$ToStringHelper;"
)
)
private MoreObjects.ToStringHelper toStringHelper(Object object) {
if (object.getClass().equals(BlockPos.class)) { @Override
return MoreObjects.toStringHelper("BlockPos"); @Nonnull
} public String toString() {
return MoreObjects.toStringHelper("BlockPos").add("x", this.getX()).add("y", this.getY()).add("z", this.getZ()).toString();
return MoreObjects.toStringHelper(object);
} }
} }

View File

@ -8,6 +8,7 @@
"maxShiftBy": 2 "maxShiftBy": 2
}, },
"client": [ "client": [
"MixinBlockPos",
"MixinEntity", "MixinEntity",
"MixinEntityPlayerSP", "MixinEntityPlayerSP",
"MixinEntityRenderer", "MixinEntityRenderer",
@ -19,7 +20,6 @@
"MixinMinecraft", "MixinMinecraft",
"MixinNetHandlerPlayClient", "MixinNetHandlerPlayClient",
"MixinNetworkManager", "MixinNetworkManager",
"MixinVec3i",
"MixinWorldClient", "MixinWorldClient",
"accessor.IAnvilChunkLoader", "accessor.IAnvilChunkLoader",