Snippets

Matix Timer Plugin

Created by Paxi

File ModuleTimer.java Added

  • Ignore whitespace
  • Hide word diff
+package de.paxii.clarinet.module.external;
+
+import de.paxii.clarinet.Wrapper;
+import de.paxii.clarinet.event.EventHandler;
+import de.paxii.clarinet.event.events.game.IngameTickEvent;
+import de.paxii.clarinet.module.Module;
+import de.paxii.clarinet.module.ModuleCategory;
+import de.paxii.clarinet.util.module.settings.ValueBase;
+
+import net.minecraft.util.Timer;
+
+import lombok.Getter;
+
+/**
+ * Created by Lars on 28.07.17.
+ */
+public class ModuleTimer extends Module {
+
+  private Timer timer;
+
+  public ModuleTimer() {
+    super("Timer", ModuleCategory.MOVEMENT);
+
+    this.setVersion("1.0");
+    this.setBuildVersion(18200);
+    this.setDescription("Changes the speed of everything.");
+
+    this.getModuleValues().put("speed", new ValueBase("Speed", 2.0F, 0.5F, 10.0F) {
+      @Override
+      public void onUpdate(float oldValue, float newValue) {
+        ModuleTimer.this.resetTimer();
+        ModuleTimer.this.setTimer();
+      }
+    });
+  }
+
+  @Override
+  public void onEnable() {
+    this.setTimer();
+  }
+
+  protected void setTimer() {
+    this.timer = Wrapper.getMinecraft().getTimer();
+    Wrapper.getMinecraft().setTimer(new Timer(this.getValueBase("speed").getValue() * 20.0F));
+  }
+
+  protected void resetTimer() {
+    Wrapper.getMinecraft().setTimer(this.timer);
+  }
+
+  @Override
+  public void onDisable() {
+    this.resetTimer();
+  }
+
+}
HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.