gui not working, but im tried
This commit is contained in:
parent
f38629a294
commit
8d47394acc
@ -87,6 +87,10 @@ public class Main implements ClientModInitializer {
|
|||||||
RenderHelper.endTri(buffer);
|
RenderHelper.endTri(buffer);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ClientTickEvents.END_CLIENT_TICK.register(client -> {
|
||||||
|
TickTask.tickTasks(TickTask.TickAt.CLIENT_EVENT);
|
||||||
|
});
|
||||||
|
|
||||||
Map<String,String> def = new HashMap<>();
|
Map<String,String> def = new HashMap<>();
|
||||||
def.put("record_pos_delay", String.valueOf(record_pos_delay));
|
def.put("record_pos_delay", String.valueOf(record_pos_delay));
|
||||||
|
|
||||||
@ -273,12 +277,16 @@ public class Main implements ClientModInitializer {
|
|||||||
|
|
||||||
List<RecordEvent> events = now_record.getEvents();
|
List<RecordEvent> events = now_record.getEvents();
|
||||||
|
|
||||||
replay_tick = new TickTask(0,0, TickTask.TickAt.CLIENT_TAIL) {
|
replay_tick = new TickTask(0,0, TickTask.TickAt.CLIENT_EVENT) {
|
||||||
public int replay_index = 0;
|
public int replay_index = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (!is_replaying) cancel();
|
if (!is_replaying) {
|
||||||
|
cancel();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
RecordEvent e = events.get(replay_index);
|
RecordEvent e = events.get(replay_index);
|
||||||
if (e instanceof DelayEvent) {
|
if (e instanceof DelayEvent) {
|
||||||
setDelay(((DelayEvent) e).delay);
|
setDelay(((DelayEvent) e).delay);
|
||||||
|
@ -23,7 +23,8 @@ public abstract class TickTask implements Runnable {
|
|||||||
public enum TickAt {
|
public enum TickAt {
|
||||||
CLIENT_HEAD, CLIENT_TAIL,
|
CLIENT_HEAD, CLIENT_TAIL,
|
||||||
MOVEMENT_HEAD, MOVEMENT_TAIL,
|
MOVEMENT_HEAD, MOVEMENT_TAIL,
|
||||||
RENDER_HEAD, RENDER_TAIL
|
RENDER_HEAD, RENDER_TAIL,
|
||||||
|
CLIENT_EVENT
|
||||||
}
|
}
|
||||||
|
|
||||||
public TickTask(long delay, TickAt at) {
|
public TickTask(long delay, TickAt at) {
|
||||||
|
@ -2,23 +2,21 @@ package themixray.repeating.mod.event;
|
|||||||
|
|
||||||
import themixray.repeating.mod.event.events.*;
|
import themixray.repeating.mod.event.events.*;
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.util.function.Consumer;
|
|
||||||
|
|
||||||
public enum RecordEventType {
|
public enum RecordEventType {
|
||||||
BLOCK_BREAK('b',"block_break",BlockBreakEvent.class),
|
BLOCK_BREAK('b',"block_break",BlockBreakEvent.class),
|
||||||
BLOCK_INTERACT('i',"block_interact",BlockInteractEvent.class),
|
BLOCK_INTERACT('i',"block_interact",BlockInteractEvent.class),
|
||||||
DELAY('d',"delay",DelayEvent.class),
|
DELAY('d',"delay",DelayEvent.class),
|
||||||
INPUT('p',"input",InputEvent.class),
|
INPUT('p',"input",InputEvent.class),
|
||||||
MOVE('m',"move",MoveEvent.class),
|
MOVE('m',"move",MoveEvent.class);
|
||||||
GUI_KEY_PRESS('r',"key_press",BlockBreakEvent.class),
|
// GUI_KEY_PRESS('r',"key_press", GuiKeyPressEvent.class),
|
||||||
GUI_KEY_RELEASE('s',"key_release",BlockBreakEvent.class),
|
// GUI_KEY_RELEASE('s',"key_release",GuiKeyReleaseEvent.class),
|
||||||
GUI_CHAR_TYPE('h',"char_type",BlockBreakEvent.class),
|
// GUI_CHAR_TYPE('h',"char_type",GuiCharTypeEvent.class),
|
||||||
GUI_MOUSE_CLICK('c',"mouse_click",BlockBreakEvent.class),
|
// GUI_MOUSE_CLICK('c',"mouse_click",GuiMouseClickEvent.class),
|
||||||
GUI_MOUSE_RELEASE('l',"mouse_release",BlockBreakEvent.class),
|
// GUI_MOUSE_RELEASE('l',"mouse_release",GuiMouseReleaseEvent.class),
|
||||||
GUI_MOUSE_DRAG('g',"mouse_drag",BlockBreakEvent.class),
|
// GUI_MOUSE_DRAG('g',"mouse_drag",GuiMouseDragEvent.class),
|
||||||
GUI_MOUSE_SCROLL('o',"mouse_scroll",BlockBreakEvent.class),
|
// GUI_MOUSE_MOVE('v',"mouse_move",GuiMouseMoveEvent.class),
|
||||||
GUI_CLOSE('e',"close",BlockBreakEvent.class);
|
// GUI_MOUSE_SCROLL('o',"mouse_scroll",GuiMouseScrollEvent.class),
|
||||||
|
// GUI_CLOSE('e',"close",GuiCloseEvent.class);
|
||||||
|
|
||||||
private Class<? extends RecordEvent> ev;
|
private Class<? extends RecordEvent> ev;
|
||||||
private char ch;
|
private char ch;
|
||||||
|
@ -28,6 +28,8 @@ public class BlockBreakEvent extends RecordEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void replay() {
|
public void replay() {
|
||||||
Main.client.interactionManager.breakBlock(pos);
|
if (Main.client.interactionManager != null) {
|
||||||
|
Main.client.interactionManager.breakBlock(pos);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,9 @@ public class BlockInteractEvent extends RecordEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void replay() {
|
public void replay() {
|
||||||
Main.client.interactionManager.interactBlock(Main.client.player, hand, hitResult);
|
if (Main.client.interactionManager != null) {
|
||||||
|
Main.client.interactionManager.interactBlock(Main.client.player, hand, hitResult);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String[] serializeArgs() {
|
protected String[] serializeArgs() {
|
||||||
|
@ -0,0 +1,34 @@
|
|||||||
|
package themixray.repeating.mod.event.events;
|
||||||
|
|
||||||
|
import themixray.repeating.mod.Main;
|
||||||
|
import themixray.repeating.mod.event.RecordEvent;
|
||||||
|
|
||||||
|
public class GuiCharTypeEvent extends RecordEvent {
|
||||||
|
private char chr;
|
||||||
|
private int modifiers;
|
||||||
|
|
||||||
|
public GuiCharTypeEvent(char chr, int modifiers) {
|
||||||
|
this.chr = chr;
|
||||||
|
this.modifiers = modifiers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void replay() {
|
||||||
|
if (Main.client.currentScreen != null) {
|
||||||
|
Main.client.currentScreen.charTyped(chr, modifiers);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String[] serializeArgs() {
|
||||||
|
return new String[] {
|
||||||
|
String.valueOf((int) chr),
|
||||||
|
String.valueOf(modifiers)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static GuiCharTypeEvent deserialize(String[] args) {
|
||||||
|
return new GuiCharTypeEvent(
|
||||||
|
(char) Integer.parseInt(args[0]),
|
||||||
|
Integer.parseInt(args[1])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
package themixray.repeating.mod.event.events;
|
||||||
|
|
||||||
|
import themixray.repeating.mod.Main;
|
||||||
|
import themixray.repeating.mod.event.RecordEvent;
|
||||||
|
|
||||||
|
public class GuiCloseEvent extends RecordEvent {
|
||||||
|
public GuiCloseEvent() {}
|
||||||
|
|
||||||
|
public void replay() {
|
||||||
|
if (Main.client.currentScreen != null) {
|
||||||
|
Main.client.setScreen(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String[] serializeArgs() {
|
||||||
|
return new String[] {};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static GuiCloseEvent deserialize(String[] args) {
|
||||||
|
return new GuiCloseEvent();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
package themixray.repeating.mod.event.events;
|
||||||
|
|
||||||
|
import themixray.repeating.mod.Main;
|
||||||
|
import themixray.repeating.mod.event.RecordEvent;
|
||||||
|
|
||||||
|
public class GuiKeyPressEvent extends RecordEvent {
|
||||||
|
private int keyCode;
|
||||||
|
private int scanCode;
|
||||||
|
private int modifiers;
|
||||||
|
|
||||||
|
public GuiKeyPressEvent(int keyCode, int scanCode, int modifiers) {
|
||||||
|
this.keyCode = keyCode;
|
||||||
|
this.scanCode = scanCode;
|
||||||
|
this.modifiers = modifiers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void replay() {
|
||||||
|
if (Main.client.currentScreen != null) {
|
||||||
|
Main.client.currentScreen.keyPressed(keyCode, scanCode, modifiers);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String[] serializeArgs() {
|
||||||
|
return new String[] {
|
||||||
|
String.valueOf(keyCode),
|
||||||
|
String.valueOf(scanCode),
|
||||||
|
String.valueOf(modifiers)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static GuiKeyPressEvent deserialize(String[] args) {
|
||||||
|
return new GuiKeyPressEvent(
|
||||||
|
Integer.parseInt(args[0]),
|
||||||
|
Integer.parseInt(args[1]),
|
||||||
|
Integer.parseInt(args[2])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
package themixray.repeating.mod.event.events;
|
||||||
|
|
||||||
|
import themixray.repeating.mod.Main;
|
||||||
|
import themixray.repeating.mod.event.RecordEvent;
|
||||||
|
|
||||||
|
public class GuiKeyReleaseEvent extends RecordEvent {
|
||||||
|
private int keyCode;
|
||||||
|
private int scanCode;
|
||||||
|
private int modifiers;
|
||||||
|
|
||||||
|
public GuiKeyReleaseEvent(int keyCode, int scanCode, int modifiers) {
|
||||||
|
this.keyCode = keyCode;
|
||||||
|
this.scanCode = scanCode;
|
||||||
|
this.modifiers = modifiers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void replay() {
|
||||||
|
if (Main.client.currentScreen != null) {
|
||||||
|
Main.client.currentScreen.keyReleased(keyCode, scanCode, modifiers);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String[] serializeArgs() {
|
||||||
|
return new String[] {
|
||||||
|
String.valueOf(keyCode),
|
||||||
|
String.valueOf(scanCode),
|
||||||
|
String.valueOf(modifiers)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static GuiKeyReleaseEvent deserialize(String[] args) {
|
||||||
|
return new GuiKeyReleaseEvent(
|
||||||
|
Integer.parseInt(args[0]),
|
||||||
|
Integer.parseInt(args[1]),
|
||||||
|
Integer.parseInt(args[2])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
package themixray.repeating.mod.event.events;
|
||||||
|
|
||||||
|
import themixray.repeating.mod.Main;
|
||||||
|
import themixray.repeating.mod.event.RecordEvent;
|
||||||
|
|
||||||
|
public class GuiMouseClickEvent extends RecordEvent {
|
||||||
|
private double mouseX;
|
||||||
|
private double mouseY;
|
||||||
|
private int button;
|
||||||
|
|
||||||
|
public GuiMouseClickEvent(double mouseX, double mouseY, int button) {
|
||||||
|
this.mouseX = mouseX;
|
||||||
|
this.mouseY = mouseY;
|
||||||
|
this.button = button;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void replay() {
|
||||||
|
if (Main.client.currentScreen != null) {
|
||||||
|
Main.client.currentScreen.mouseClicked(mouseX, mouseY, button);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String[] serializeArgs() {
|
||||||
|
return new String[] {
|
||||||
|
String.valueOf(mouseX),
|
||||||
|
String.valueOf(mouseY),
|
||||||
|
String.valueOf(button)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static GuiMouseClickEvent deserialize(String[] args) {
|
||||||
|
return new GuiMouseClickEvent(
|
||||||
|
Double.parseDouble(args[0]),
|
||||||
|
Double.parseDouble(args[1]),
|
||||||
|
Integer.parseInt(args[2])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,46 @@
|
|||||||
|
package themixray.repeating.mod.event.events;
|
||||||
|
|
||||||
|
import themixray.repeating.mod.Main;
|
||||||
|
import themixray.repeating.mod.event.RecordEvent;
|
||||||
|
|
||||||
|
public class GuiMouseDragEvent extends RecordEvent {
|
||||||
|
private double mouseX;
|
||||||
|
private double mouseY;
|
||||||
|
private double deltaX;
|
||||||
|
private double deltaY;
|
||||||
|
private int button;
|
||||||
|
|
||||||
|
public GuiMouseDragEvent(double mouseX, double mouseY, int button, double deltaX, double deltaY) {
|
||||||
|
this.mouseX = mouseX;
|
||||||
|
this.mouseY = mouseY;
|
||||||
|
this.deltaX = deltaX;
|
||||||
|
this.deltaY = deltaY;
|
||||||
|
this.button = button;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void replay() {
|
||||||
|
if (Main.client.currentScreen != null) {
|
||||||
|
Main.client.currentScreen.mouseDragged(mouseX, mouseY, button, deltaX, deltaY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String[] serializeArgs() {
|
||||||
|
return new String[] {
|
||||||
|
String.valueOf(mouseX),
|
||||||
|
String.valueOf(mouseY),
|
||||||
|
String.valueOf(button),
|
||||||
|
String.valueOf(deltaX),
|
||||||
|
String.valueOf(deltaY)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static GuiMouseDragEvent deserialize(String[] args) {
|
||||||
|
return new GuiMouseDragEvent(
|
||||||
|
Double.parseDouble(args[0]),
|
||||||
|
Double.parseDouble(args[1]),
|
||||||
|
Integer.parseInt(args[2]),
|
||||||
|
Double.parseDouble(args[3]),
|
||||||
|
Double.parseDouble(args[4])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
package themixray.repeating.mod.event.events;
|
||||||
|
|
||||||
|
import themixray.repeating.mod.Main;
|
||||||
|
import themixray.repeating.mod.event.RecordEvent;
|
||||||
|
|
||||||
|
public class GuiMouseMoveEvent extends RecordEvent {
|
||||||
|
private double mouseX;
|
||||||
|
private double mouseY;
|
||||||
|
|
||||||
|
public GuiMouseMoveEvent(double mouseX, double mouseY) {
|
||||||
|
this.mouseX = mouseX;
|
||||||
|
this.mouseY = mouseY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void replay() {
|
||||||
|
if (Main.client.currentScreen != null) {
|
||||||
|
Main.client.currentScreen.mouseMoved(mouseX, mouseY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String[] serializeArgs() {
|
||||||
|
return new String[] {
|
||||||
|
String.valueOf(mouseX),
|
||||||
|
String.valueOf(mouseY)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static GuiMouseMoveEvent deserialize(String[] args) {
|
||||||
|
return new GuiMouseMoveEvent(
|
||||||
|
Double.parseDouble(args[0]),
|
||||||
|
Double.parseDouble(args[1])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
package themixray.repeating.mod.event.events;
|
||||||
|
|
||||||
|
import themixray.repeating.mod.Main;
|
||||||
|
import themixray.repeating.mod.event.RecordEvent;
|
||||||
|
|
||||||
|
public class GuiMouseReleaseEvent extends RecordEvent {
|
||||||
|
private double mouseX;
|
||||||
|
private double mouseY;
|
||||||
|
private int button;
|
||||||
|
|
||||||
|
public GuiMouseReleaseEvent(double mouseX, double mouseY, int button) {
|
||||||
|
this.mouseX = mouseX;
|
||||||
|
this.mouseY = mouseY;
|
||||||
|
this.button = button;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void replay() {
|
||||||
|
if (Main.client.currentScreen != null) {
|
||||||
|
Main.client.currentScreen.mouseReleased(mouseX, mouseY, button);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String[] serializeArgs() {
|
||||||
|
return new String[] {
|
||||||
|
String.valueOf(mouseX),
|
||||||
|
String.valueOf(mouseY),
|
||||||
|
String.valueOf(button)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static GuiMouseReleaseEvent deserialize(String[] args) {
|
||||||
|
return new GuiMouseReleaseEvent(
|
||||||
|
Double.parseDouble(args[0]),
|
||||||
|
Double.parseDouble(args[1]),
|
||||||
|
Integer.parseInt(args[2])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
package themixray.repeating.mod.event.events;
|
||||||
|
|
||||||
|
import themixray.repeating.mod.Main;
|
||||||
|
import themixray.repeating.mod.event.RecordEvent;
|
||||||
|
|
||||||
|
public class GuiMouseScrollEvent extends RecordEvent {
|
||||||
|
private double mouseX;
|
||||||
|
private double mouseY;
|
||||||
|
private double amount;
|
||||||
|
|
||||||
|
public GuiMouseScrollEvent(double mouseX, double mouseY, double amount) {
|
||||||
|
this.mouseX = mouseX;
|
||||||
|
this.mouseY = mouseY;
|
||||||
|
this.amount = amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void replay() {
|
||||||
|
if (Main.client.currentScreen != null) {
|
||||||
|
Main.client.currentScreen.mouseScrolled(mouseX, mouseY, amount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String[] serializeArgs() {
|
||||||
|
return new String[] {
|
||||||
|
String.valueOf(mouseX),
|
||||||
|
String.valueOf(mouseY),
|
||||||
|
String.valueOf(amount)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static GuiMouseScrollEvent deserialize(String[] args) {
|
||||||
|
return new GuiMouseScrollEvent(
|
||||||
|
Double.parseDouble(args[0]),
|
||||||
|
Double.parseDouble(args[1]),
|
||||||
|
Double.parseDouble(args[2])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -116,33 +116,35 @@ public class InputEvent extends RecordEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void inputCallback() {
|
public void inputCallback() {
|
||||||
if (sprinting != null && Main.client.player.isSprinting() != sprinting)
|
if (Main.client.player != null) {
|
||||||
Main.client.player.setSprinting(sprinting);
|
if (sprinting != null && Main.client.player.isSprinting() != sprinting)
|
||||||
if (Main.client.player.getYaw() != yaw)
|
Main.client.player.setSprinting(sprinting);
|
||||||
Main.client.player.setYaw(yaw);
|
if (Main.client.player.getYaw() != yaw)
|
||||||
if (Main.client.player.getHeadYaw() != head_yaw)
|
Main.client.player.setYaw(yaw);
|
||||||
Main.client.player.setHeadYaw(head_yaw);
|
if (Main.client.player.getHeadYaw() != head_yaw)
|
||||||
if (Main.client.player.getBodyYaw() != body_yaw)
|
Main.client.player.setHeadYaw(head_yaw);
|
||||||
Main.client.player.setBodyYaw(body_yaw);
|
if (Main.client.player.getBodyYaw() != body_yaw)
|
||||||
if (Main.client.player.getPitch() != pitch)
|
Main.client.player.setBodyYaw(body_yaw);
|
||||||
Main.client.player.setPitch(pitch);
|
if (Main.client.player.getPitch() != pitch)
|
||||||
if (Main.client.player.getMovementSpeed() != speed)
|
Main.client.player.setPitch(pitch);
|
||||||
Main.client.player.setMovementSpeed(speed);
|
if (Main.client.player.getMovementSpeed() != speed)
|
||||||
if (sneaking != null && Main.client.player.input.sneaking != sneaking)
|
Main.client.player.setMovementSpeed(speed);
|
||||||
Main.client.player.input.sneaking = sneaking;
|
if (sneaking != null && Main.client.player.input.sneaking != sneaking)
|
||||||
if (jumping != null && Main.client.player.input.jumping != jumping)
|
Main.client.player.input.sneaking = sneaking;
|
||||||
Main.client.player.input.jumping = jumping;
|
if (jumping != null && Main.client.player.input.jumping != jumping)
|
||||||
if (movementSideways != null && Main.client.player.input.movementSideways != movementSideways)
|
Main.client.player.input.jumping = jumping;
|
||||||
Main.client.player.input.movementSideways = movementSideways;
|
if (movementSideways != null && Main.client.player.input.movementSideways != movementSideways)
|
||||||
if (movementForward != null && Main.client.player.input.movementForward != movementForward)
|
Main.client.player.input.movementSideways = movementSideways;
|
||||||
Main.client.player.input.movementForward = movementForward;
|
if (movementForward != null && Main.client.player.input.movementForward != movementForward)
|
||||||
if (pressingForward != null && Main.client.player.input.pressingForward != pressingForward)
|
Main.client.player.input.movementForward = movementForward;
|
||||||
Main.client.player.input.pressingForward = pressingForward;
|
if (pressingForward != null && Main.client.player.input.pressingForward != pressingForward)
|
||||||
if (pressingBack != null && Main.client.player.input.pressingBack != pressingBack)
|
Main.client.player.input.pressingForward = pressingForward;
|
||||||
Main.client.player.input.pressingBack = pressingBack;
|
if (pressingBack != null && Main.client.player.input.pressingBack != pressingBack)
|
||||||
if (pressingLeft != null && Main.client.player.input.pressingLeft != pressingLeft)
|
Main.client.player.input.pressingBack = pressingBack;
|
||||||
Main.client.player.input.pressingLeft = pressingLeft;
|
if (pressingLeft != null && Main.client.player.input.pressingLeft != pressingLeft)
|
||||||
if (pressingRight != null && Main.client.player.input.pressingRight != pressingRight)
|
Main.client.player.input.pressingLeft = pressingLeft;
|
||||||
Main.client.player.input.pressingRight = pressingRight;
|
if (pressingRight != null && Main.client.player.input.pressingRight != pressingRight)
|
||||||
|
Main.client.player.input.pressingRight = pressingRight;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,11 +26,13 @@ public class MoveEvent extends RecordEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void replay() {
|
public void replay() {
|
||||||
Vec3d p = Main.client.player.getPos();
|
if (Main.client.player != null) {
|
||||||
Vec3d v = new Vec3d(vec.getX() - p.getX(), vec.getY() - p.getY(), vec.getZ() - p.getZ());
|
Vec3d p = Main.client.player.getPos();
|
||||||
Main.client.player.move(MovementType.SELF, v);
|
Vec3d v = new Vec3d(vec.getX() - p.getX(), vec.getY() - p.getY(), vec.getZ() - p.getZ());
|
||||||
Main.client.player.setYaw(yaw);
|
Main.client.player.move(MovementType.SELF, v);
|
||||||
Main.client.player.setPitch(pitch);
|
Main.client.player.setYaw(yaw);
|
||||||
|
Main.client.player.setPitch(pitch);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String[] serializeArgs() {
|
protected String[] serializeArgs() {
|
||||||
|
@ -18,6 +18,8 @@ import java.util.UUID;
|
|||||||
public abstract class PlayerMixin {
|
public abstract class PlayerMixin {
|
||||||
@Inject(at = @At(value = "HEAD"), method = "disconnect")
|
@Inject(at = @At(value = "HEAD"), method = "disconnect")
|
||||||
private void disconnect(Text disconnectReason, CallbackInfo ci) {
|
private void disconnect(Text disconnectReason, CallbackInfo ci) {
|
||||||
System.out.println("on client close");
|
if (Main.me.is_replaying) {
|
||||||
|
Main.me.stopReplay();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,53 +12,79 @@ import org.spongepowered.asm.mixin.injection.At;
|
|||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
import themixray.repeating.mod.Main;
|
||||||
import themixray.repeating.mod.TickTask;
|
import themixray.repeating.mod.TickTask;
|
||||||
|
import themixray.repeating.mod.event.events.*;
|
||||||
|
|
||||||
@Mixin(Screen.class)
|
@Mixin(Screen.class)
|
||||||
public abstract class ScreenMixin extends AbstractParentElement implements Drawable {
|
public abstract class ScreenMixin extends AbstractParentElement implements Drawable {
|
||||||
@Inject(at = @At(value = "HEAD"), method = "close")
|
@Inject(at = @At(value = "HEAD"), method = "close")
|
||||||
private void close(CallbackInfo ci) {
|
private void close(CallbackInfo ci) {
|
||||||
System.out.println("on screen close");
|
if (Main.me.is_recording) {
|
||||||
|
Main.me.now_record.addEvent(new GuiCloseEvent());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(at = @At(value = "HEAD"), method = "keyPressed")
|
@Inject(at = @At(value = "HEAD"), method = "keyPressed")
|
||||||
private void keyPressed(int keyCode, int scanCode, int modifiers, CallbackInfoReturnable<Boolean> cir) {
|
private void keyPressed(int keyCode, int scanCode, int modifiers, CallbackInfoReturnable<Boolean> cir) {
|
||||||
System.out.println("on screen keyPressed");
|
if (Main.me.is_recording) {
|
||||||
|
Main.me.now_record.addEvent(new GuiKeyPressEvent(keyCode, scanCode, modifiers));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean charTyped(char chr, int modifiers) {
|
public boolean charTyped(char chr, int modifiers) {
|
||||||
System.out.println("on screen charTyped");
|
if (Main.me.is_recording) {
|
||||||
|
Main.me.now_record.addEvent(new GuiCharTypeEvent(chr, modifiers));
|
||||||
|
}
|
||||||
return super.charTyped(chr, modifiers);
|
return super.charTyped(chr, modifiers);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean keyReleased(int keyCode, int scanCode, int modifiers) {
|
public boolean keyReleased(int keyCode, int scanCode, int modifiers) {
|
||||||
System.out.println("on screen keyReleased");
|
if (Main.me.is_recording) {
|
||||||
|
Main.me.now_record.addEvent(new GuiKeyReleaseEvent(keyCode, scanCode, modifiers));
|
||||||
|
}
|
||||||
return super.keyReleased(keyCode, scanCode, modifiers);
|
return super.keyReleased(keyCode, scanCode, modifiers);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean mouseClicked(double mouseX, double mouseY, int button) {
|
public boolean mouseClicked(double mouseX, double mouseY, int button) {
|
||||||
System.out.println("on screen mouseClicked");
|
if (Main.me.is_recording) {
|
||||||
|
Main.me.now_record.addEvent(new GuiMouseClickEvent(mouseX, mouseY, button));
|
||||||
|
}
|
||||||
return super.mouseClicked(mouseX, mouseY, button);
|
return super.mouseClicked(mouseX, mouseY, button);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mouseMoved(double mouseX, double mouseY) {
|
||||||
|
if (Main.me.is_recording) {
|
||||||
|
Main.me.now_record.addEvent(new GuiMouseMoveEvent(mouseX, mouseY));
|
||||||
|
}
|
||||||
|
super.mouseMoved(mouseX, mouseY);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY) {
|
public boolean mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY) {
|
||||||
System.out.println("on screen mouseDragged");
|
if (Main.me.is_recording) {
|
||||||
|
Main.me.now_record.addEvent(new GuiMouseDragEvent(mouseX, mouseY, button, deltaX, deltaY));
|
||||||
|
}
|
||||||
return super.mouseDragged(mouseX, mouseY, button, deltaX, deltaY);
|
return super.mouseDragged(mouseX, mouseY, button, deltaX, deltaY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean mouseReleased(double mouseX, double mouseY, int button) {
|
public boolean mouseReleased(double mouseX, double mouseY, int button) {
|
||||||
System.out.println("on screen mouseReleased");
|
if (Main.me.is_recording) {
|
||||||
|
Main.me.now_record.addEvent(new GuiMouseReleaseEvent(mouseX, mouseY, button));
|
||||||
|
}
|
||||||
return super.mouseReleased(mouseX, mouseY, button);
|
return super.mouseReleased(mouseX, mouseY, button);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean mouseScrolled(double mouseX, double mouseY, double amount) {
|
public boolean mouseScrolled(double mouseX, double mouseY, double amount) {
|
||||||
System.out.println("on screen mouseScrolled");
|
if (Main.me.is_recording) {
|
||||||
|
Main.me.now_record.addEvent(new GuiMouseScrollEvent(mouseX, mouseY, amount));
|
||||||
|
}
|
||||||
return super.mouseScrolled(mouseX, mouseY, amount);
|
return super.mouseScrolled(mouseX, mouseY, amount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user