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.Vec3i;
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
* @since 8/25/2018
*/
@Mixin(Vec3i.class)
public class MixinVec3i {
@Mixin(BlockPos.class)
public abstract class MixinBlockPos extends Vec3i {
@Redirect(
method = "toString",
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) {
public MixinBlockPos(int xIn, int yIn, int zIn) {
super(xIn, yIn, zIn);
}
if (object.getClass().equals(BlockPos.class)) {
return MoreObjects.toStringHelper("BlockPos");
}
return MoreObjects.toStringHelper(object);
@Override
@Nonnull
public String toString() {
return MoreObjects.toStringHelper("BlockPos").add("x", this.getX()).add("y", this.getY()).add("z", this.getZ()).toString();
}
}

View File

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