SimpleMultipart/src/main/java/net/shadowfacts/simplemultipart/util/MultipartHitResult.java

33 lines
974 B
Java
Raw Normal View History

2018-12-20 00:39:10 +00:00
package net.shadowfacts.simplemultipart.util;
import net.minecraft.util.HitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.Vec3d;
2018-12-25 15:20:44 +00:00
import net.shadowfacts.simplemultipart.api.MultipartView;
2018-12-20 00:39:10 +00:00
/**
* @author shadowfacts
*/
public class MultipartHitResult extends HitResult {
2018-12-25 15:20:44 +00:00
public MultipartView view;
2018-12-20 00:39:10 +00:00
2018-12-25 15:20:44 +00:00
public MultipartHitResult(Vec3d pos, Direction side, BlockPos blockPos, MultipartView view) {
2018-12-20 00:39:10 +00:00
super(pos, side, blockPos);
2018-12-25 15:20:44 +00:00
this.view = view;
2018-12-20 00:39:10 +00:00
}
2018-12-25 15:20:44 +00:00
public MultipartHitResult(HitResult result, MultipartView view) {
this(result.pos, result.side, result.getBlockPos(), view);
2018-12-20 00:39:10 +00:00
if (result.type != Type.BLOCK) {
throw new IllegalArgumentException("Can't create a MultipartHitResult from a non BLOCK-type HitResult");
}
}
@Override
public String toString() {
2018-12-25 15:20:44 +00:00
return "HitResult{type=" + type + ", blockpos=" + getBlockPos() + ", f=" + side + ", pos=" + pos + ", view=" + view + '}';
2018-12-20 00:39:10 +00:00
}
}