diff --git a/src/main/java/com/minecrafttas/tasmod/virtual/VirtualPeripheral.java b/src/main/java/com/minecrafttas/tasmod/virtual/VirtualPeripheral.java
index 1a5a1633..44130857 100644
--- a/src/main/java/com/minecrafttas/tasmod/virtual/VirtualPeripheral.java
+++ b/src/main/java/com/minecrafttas/tasmod/virtual/VirtualPeripheral.java
@@ -12,7 +12,8 @@
* Base class for {@link VirtualKeyboard} and {@link VirtualMouse}
*
* Contains the shared code for keeping track of which buttons are pressed.
- * This works by storing the keycodes of the buttons in a set, as keycodes are supposed to be unique
+ * This works by storing the keycodes of the buttons in a set, as keycodes are
+ * supposed to be unique
*
* Generating {@link VirtualEvent}s is handled in the child classes.
*
@@ -20,90 +21,95 @@
*/
public abstract class VirtualPeripheral> extends Subtickable implements Serializable {
- /**
- * The list of keycodes that are currently pressed on this peripheral.
- */
- protected final Set pressedKeys;
-
- /**
- * Creates a VirtualPeripheral
- * @param pressedKeys The {@link #pressedKeys}
- * @param subtickList The {@link #subtickList}
- * @param ignoreFirstUpdate The {@link #ignoreFirstUpdate} state
- */
- protected VirtualPeripheral(Set pressedKeys, List subtickList, boolean ignoreFirstUpdate) {
- super(subtickList, ignoreFirstUpdate);
- this.pressedKeys = pressedKeys;
- }
+ /**
+ * The list of keycodes that are currently pressed on this peripheral.
+ */
+ protected final Set pressedKeys;
- /**
- * Set the specified keycode to pressed
- * @param keycode The keycode to check
- * @param keystate The keystate of the keycode
- */
- protected void setPressed(int keycode, boolean keystate) {
- if (VirtualKeybindings.isKeyCodeAlwaysBlocked(keycode)) { //TODO Maybe a better system?
+ /**
+ * Creates a VirtualPeripheral
+ *
+ * @param pressedKeys The {@link #pressedKeys}
+ * @param subtickList The {@link #subtickList}
+ * @param ignoreFirstUpdate The {@link #ignoreFirstUpdate} state
+ */
+ protected VirtualPeripheral(Set pressedKeys, List subtickList, boolean ignoreFirstUpdate) {
+ super(subtickList, ignoreFirstUpdate);
+ this.pressedKeys = pressedKeys;
+ }
+
+ /**
+ * Set the specified keycode to pressed
+ *
+ * @param keycode The keycode to check
+ * @param keystate The keystate of the keycode
+ */
+ protected void setPressed(int keycode, boolean keystate) {
+ if (VirtualKeybindings.isKeyCodeAlwaysBlocked(keycode)) { // TODO Maybe a better system?
return;
}
- if (keystate)
- pressedKeys.add(keycode);
- else
- pressedKeys.remove(keycode);
- }
-
- /**
- * Set the specified keyname to pressed
- * @param keyname The keyname to check
- * @param keystate The keystate of the keyname
- */
- public void setPressed(String keyname, boolean keystate) {
- Integer keycode = VirtualKey.getKeycode(keyname);
- if (keycode != null) {
- setPressed(keycode, keystate);
- }
- }
+ if (keystate)
+ pressedKeys.add(keycode);
+ else
+ pressedKeys.remove(keycode);
+ }
- /**
- * @return A list of all currently pressed keynames
- */
- public List getCurrentPresses() {
- List out = new ArrayList<>();
- pressedKeys.forEach(keycode -> {
- out.add(VirtualKey.getName(keycode));
- });
- return out;
- }
+ /**
+ * Set the specified keyname to pressed
+ *
+ * @param keyname The keyname to check
+ * @param keystate The keystate of the keyname
+ */
+ public void setPressed(String keyname, boolean keystate) {
+ Integer keycode = VirtualKey.getKeycode(keyname);
+ if (keycode != null) {
+ setPressed(keycode, keystate);
+ }
+ }
- @Override
- public String toString() {
- return String.join(",", getCurrentPresses());
- }
+ /**
+ * @return A list of all currently pressed keynames
+ */
+ public List getCurrentPresses() {
+ List out = new ArrayList<>();
+ pressedKeys.forEach(keycode -> {
+ out.add(VirtualKey.getName(keycode));
+ });
+ return out;
+ }
- /**
- * @return An immutable set of pressed keycodes
- */
+ @Override
+ public String toString() {
+ return String.join(",", getCurrentPresses());
+ }
+
+ /**
+ * @return An immutable set of pressed keycodes
+ */
public Set getPressedKeys() {
return ImmutableSet.copyOf(pressedKeys);
}
/**
* If the key is available in {@link #pressedKeys}
+ *
* @param keycode The keycode in question
* @return If the key is pressed
*/
public boolean isKeyDown(int keycode) {
return pressedKeys.contains(keycode);
}
-
+
/**
* If the key is available in {@link #pressedKeys}
+ *
* @param keyname The keyname in question
* @return If the key is pressed
*/
public boolean isKeyDown(String keyname) {
return pressedKeys.contains(VirtualKey.getKeycode(keyname));
}
-
+
/**
* Clears pressed keys and subticks
*/
@@ -112,13 +118,13 @@ protected void clear() {
pressedKeys.clear();
super.clear();
}
-
+
@Override
public boolean equals(Object obj) {
- if(obj instanceof VirtualPeripheral) {
+ if (obj instanceof VirtualPeripheral) {
VirtualPeripheral> peripheral = (VirtualPeripheral>) obj;
for (Integer keycode : pressedKeys) {
- if(!peripheral.pressedKeys.contains(keycode)) {
+ if (!peripheral.pressedKeys.contains(keycode)) {
return false;
}
}
@@ -126,11 +132,13 @@ public boolean equals(Object obj) {
}
return super.equals(obj);
}
-
- /**
- * Copies the data from another virtual peripheral into this peripheral without creating a new object.
- * @param peripheral The peripheral to move from
- */
+
+ /**
+ * Copies the data from another virtual peripheral into this peripheral without
+ * creating a new object.
+ *
+ * @param peripheral The peripheral to move from
+ */
protected void copyFrom(T peripheral) {
this.pressedKeys.clear();
this.pressedKeys.addAll(peripheral.pressedKeys);
diff --git a/src/main/resources/tasmod.mixin.json b/src/main/resources/tasmod.mixin.json
index efd2d938..04a4d468 100644
--- a/src/main/resources/tasmod.mixin.json
+++ b/src/main/resources/tasmod.mixin.json
@@ -43,7 +43,7 @@
//Playbackhooks
"playbackhooks.MixinMinecraft",
- "playbackhooks.MixinEntityRenderer",
+ "playbackhooks.MixinEntityRenderer",
"playbackhooks.MixinGuiScreen",
"playbackhooks.MixinGameSettings",
"playbackhooks.MixinGuiChat",