Right clicking an Entity now spectates it
This commit is contained in:
@@ -2,10 +2,6 @@ package eu.crushedpixel.replaymod.events;
|
||||
|
||||
import eu.crushedpixel.replaymod.replay.ReplayHandler;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraftforge.client.event.MouseEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import org.lwjgl.input.Mouse;
|
||||
@@ -13,27 +9,21 @@ import org.lwjgl.input.Mouse;
|
||||
public class MouseInputHandler {
|
||||
|
||||
private final Minecraft mc = Minecraft.getMinecraft();
|
||||
private boolean leftDown = false;
|
||||
private boolean rightDown = false;
|
||||
|
||||
@SubscribeEvent
|
||||
public void mouseEvent(MouseEvent event) {
|
||||
if(!ReplayHandler.isInReplay() || mc.objectMouseOver != null) return;
|
||||
if(Mouse.isButtonDown(0)) {
|
||||
if(!leftDown) {
|
||||
leftDown = true;
|
||||
mc.objectMouseOver = new MovingObjectPosition(MovingObjectPosition.MovingObjectType.MISS,
|
||||
new Vec3(0, 0, 0), EnumFacing.NORTH, new BlockPos(0, 0, 0));
|
||||
}
|
||||
} else {
|
||||
leftDown = false;
|
||||
if(!ReplayHandler.isInReplay() || !Mouse.isButtonDown(1)) {
|
||||
rightDown = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if(Mouse.isButtonDown(1)) {
|
||||
if(!rightDown) {
|
||||
rightDown = true;
|
||||
mc.objectMouseOver = new MovingObjectPosition(MovingObjectPosition.MovingObjectType.MISS,
|
||||
new Vec3(0, 0, 0), EnumFacing.NORTH, new BlockPos(0, 0, 0));
|
||||
if(mc.pointedEntity != null && ReplayHandler.isCamera() && mc.currentScreen == null) {
|
||||
ReplayHandler.spectateEntity(mc.pointedEntity);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
rightDown = false;
|
||||
|
||||
Reference in New Issue
Block a user