Skip to content

Commit

Permalink
Merge pull request #68 from DaddyWesker/master
Browse files Browse the repository at this point in the history
Agent fix
  • Loading branch information
DaddyWesker authored Aug 18, 2023
2 parents e42fcd3 + 2e721e4 commit 70bab44
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/main/java/io/singularitynet/Client/VereyaModClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ public MyMouse(MinecraftClient client) {

@Override
public void lockCursor(){
if (MinecraftClient.getInstance().attackCooldown > 1000){
//since our agent can spam attack and therefore after opening inventory or chat or advancements attack
// won't work we need to manually set attackCooldown to 0.
MinecraftClient.getInstance().attackCooldown = 0;
}
if(VereyaModClient.this.inputType == InputType.AI) {
return;
}
Expand Down Expand Up @@ -227,7 +232,7 @@ public void setInputType(InputType input)

this.inputType = input;
// send chat message
if (MinecraftClient.getInstance().player != null)
if ((MinecraftClient.getInstance().player != null))
MinecraftClient.getInstance().player.sendMessage(Text.of("input type set to: " + input.name()), true);
if (input == InputType.HUMAN || input == InputType.HYBRID_MOUSE_KEYBOARD)
{
Expand All @@ -237,15 +242,14 @@ public void setInputType(InputType input)
MinecraftClient.getInstance().mouse.unlockCursor();
}
LogManager.getLogger().info("successfully set input type to: " + input);
MinecraftClient.getInstance().attackCooldown=0;
}

private void onKey(long window, int key, int scancode, int action, int modifiers) {
// do default thing if any screen is open
Screen screen = MinecraftClient.getInstance().currentScreen;
if (screen != null) {
if (screen instanceof ChatScreen) {
return;
}
return;
}

if ((key == GLFW.GLFW_KEY_F6) && (action == GLFW.GLFW_PRESS))
Expand Down

0 comments on commit 70bab44

Please sign in to comment.