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

42 lines
1.3 KiB
Java
Raw Normal View History

2018-12-20 00:39:10 +00:00
package net.shadowfacts.simplemultipart.util;
2018-12-28 18:10:59 +00:00
import net.minecraft.entity.player.PlayerEntity;
2019-01-19 16:59:58 +00:00
import net.minecraft.util.BlockHitResult;
2018-12-20 00:39:10 +00:00
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-28 18:10:59 +00:00
import net.minecraft.world.World;
import net.shadowfacts.simplemultipart.container.MultipartContainer;
2018-12-28 02:55:51 +00:00
import net.shadowfacts.simplemultipart.multipart.MultipartView;
2019-01-19 16:59:58 +00:00
import sun.jvm.hotspot.opto.Block;
2018-12-20 00:39:10 +00:00
/**
2018-12-28 18:10:59 +00:00
* A raytrace result for a multipart.
*
2018-12-20 00:39:10 +00:00
* @author shadowfacts
2018-12-28 18:10:59 +00:00
* @since 0.1.0
2019-01-19 16:59:58 +00:00
* @see MultipartHelper#rayTrace(MultipartContainer, net.minecraft.world.BlockView, BlockPos, PlayerEntity)
2018-12-20 00:39:10 +00:00
*/
2019-01-19 16:59:58 +00:00
public class MultipartHitResult extends BlockHitResult {
2018-12-20 00:39:10 +00:00
2018-12-28 18:10:59 +00:00
/**
* The view of the hit multipart.
*/
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) {
2019-01-19 16:59:58 +00:00
super(pos, side, blockPos, false); // TODO: what does this boolean do?
2018-12-25 15:20:44 +00:00
this.view = view;
2018-12-20 00:39:10 +00:00
}
2019-01-19 16:59:58 +00:00
public MultipartHitResult(BlockHitResult result, MultipartView view) {
this(result.getPos(), result.getSide(), result.getBlockPos(), view);
2018-12-20 00:39:10 +00:00
}
@Override
public String toString() {
2019-01-19 16:59:58 +00:00
return "HitResult{type=" + getType() + ", blockpos=" + getBlockPos() + ", f=" + getSide() + ", pos=" + pos + ", view=" + view + '}';
2018-12-20 00:39:10 +00:00
}
}