Made Camera Movement Speed adjustable by Mousewheel
This commit is contained in:
@@ -18,9 +18,28 @@ import org.lwjgl.Sys;
|
||||
|
||||
public class CameraEntity extends EntityPlayer {
|
||||
|
||||
private static final double MAX_SPEED = 10;
|
||||
private static final double THRESHOLD = MAX_SPEED / 20;
|
||||
private static final double DECAY = MAX_SPEED/3;
|
||||
public static final double SPEED_CHANGE = 0.5;
|
||||
public static final double LOWER_SPEED = 2;
|
||||
public static final double UPPER_SPEED = 20;
|
||||
|
||||
private static double MAX_SPEED = 10;
|
||||
private static double THRESHOLD = MAX_SPEED / 20;
|
||||
private static double DECAY = MAX_SPEED/3;
|
||||
|
||||
public static void modifyCameraSpeed(boolean increase) {
|
||||
setCameraMaximumSpeed(getCameraMaximumSpeed() + (increase ? 1 : -1) * SPEED_CHANGE);
|
||||
}
|
||||
|
||||
public static void setCameraMaximumSpeed(double maxSpeed) {
|
||||
if(maxSpeed < LOWER_SPEED || maxSpeed > UPPER_SPEED) return;
|
||||
MAX_SPEED = maxSpeed;
|
||||
THRESHOLD = MAX_SPEED / 20;
|
||||
DECAY = MAX_SPEED/3;
|
||||
}
|
||||
|
||||
public static double getCameraMaximumSpeed() {
|
||||
return MAX_SPEED;
|
||||
}
|
||||
|
||||
private Vec3 direction;
|
||||
private double motion;
|
||||
@@ -32,7 +51,6 @@ public class CameraEntity extends EntityPlayer {
|
||||
private boolean speedup = false;
|
||||
|
||||
public CameraEntity(World worldIn) {
|
||||
//super(worldIn);
|
||||
super(worldIn, Minecraft.getMinecraft().getSession().getProfile());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package eu.crushedpixel.replaymod.events;
|
||||
|
||||
import eu.crushedpixel.replaymod.entities.CameraEntity;
|
||||
import eu.crushedpixel.replaymod.replay.ReplayHandler;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraftforge.client.event.MouseEvent;
|
||||
@@ -13,11 +14,15 @@ public class MouseInputHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public void mouseEvent(MouseEvent event) {
|
||||
if(!ReplayHandler.isInReplay() || !Mouse.isButtonDown(1)) {
|
||||
rightDown = false;
|
||||
if(!ReplayHandler.isInReplay()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(event.dwheel != 0 && mc.currentScreen == null) {
|
||||
boolean increase = event.dwheel > 0;
|
||||
CameraEntity.modifyCameraSpeed(increase);
|
||||
}
|
||||
|
||||
if(Mouse.isButtonDown(1)) {
|
||||
if(!rightDown) {
|
||||
rightDown = true;
|
||||
|
||||
Reference in New Issue
Block a user