added move tp when repeating is wrong
This commit is contained in:
parent
887bcd2221
commit
96c4ce4b9d
@ -9,7 +9,7 @@ yarn_mappings=1.19.3+build.1
|
||||
loader_version=0.14.17
|
||||
|
||||
# Mod Properties
|
||||
mod_version = 1.0.2
|
||||
mod_version = 1.0.3
|
||||
maven_group = themixray.repeating.mod
|
||||
archives_base_name = repeating-mod
|
||||
|
||||
|
@ -29,7 +29,14 @@ public class EasyConfig {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
reload();
|
||||
|
||||
for (Map.Entry<String,Object> m:def.entrySet())
|
||||
if (!data.containsKey(m.getKey()))
|
||||
data.put(m.getKey(),m.getValue());
|
||||
|
||||
save();
|
||||
}
|
||||
public EasyConfig(Path f, Map<String,Object> def) {
|
||||
this(f.toFile(),def);
|
||||
|
@ -28,6 +28,7 @@ public class RepeatingMod implements ClientModInitializer {
|
||||
public static final FabricLoader loader = FabricLoader.getInstance();
|
||||
public static RepeatingMod me;
|
||||
|
||||
public Thread move_tick = null;
|
||||
public List<RecordEvent> record = new ArrayList<>();
|
||||
public boolean is_recording = false;
|
||||
public Date last_record = null;
|
||||
@ -42,8 +43,7 @@ public class RepeatingMod implements ClientModInitializer {
|
||||
private static KeyBinding toggle_replay_key;
|
||||
private static KeyBinding toggle_record_key;
|
||||
|
||||
public double record_blocks_limit = 2;
|
||||
public long record_time_limit = 50;
|
||||
public long record_pos_delay = 1000;
|
||||
|
||||
public EasyConfig conf;
|
||||
|
||||
@ -53,12 +53,11 @@ public class RepeatingMod implements ClientModInitializer {
|
||||
me = this;
|
||||
|
||||
Map<String,Object> def = new HashMap<>();
|
||||
def.put("record_blocks_limit", record_blocks_limit);
|
||||
def.put("record_time_limit", record_time_limit);
|
||||
conf = new EasyConfig(new File(loader.getConfigDir().toFile(),"repeating-mod.yml").toPath(),def);
|
||||
def.put("record_pos_delay", (int) record_pos_delay);
|
||||
|
||||
record_blocks_limit = (double) conf.data.get("record_blocks_limit");
|
||||
record_time_limit = (Integer) conf.data.get("record_time_limit");
|
||||
conf = new EasyConfig(loader.getConfigDir(),"repeating-mod.yml",def);
|
||||
|
||||
record_pos_delay = (Integer) conf.data.get("record_pos_delay");
|
||||
|
||||
menu_key = KeyBindingHelper.registerKeyBinding(new KeyBinding(
|
||||
"key.repeating-mod.menu",InputUtil.Type.KEYSYM,
|
||||
@ -108,7 +107,20 @@ public class RepeatingMod implements ClientModInitializer {
|
||||
is_recording = true;
|
||||
menu.update_btns();
|
||||
record.clear();
|
||||
record.add(new RecordMoveEvent(client.player.getPos(),client.player.getHeadYaw(),client.player.getPitch()));
|
||||
|
||||
move_tick = new Thread(() -> {
|
||||
while (is_recording) {
|
||||
record.add(new RecordMoveEvent(client.player.getPos(),
|
||||
client.player.getHeadYaw(),client.player.getPitch()));
|
||||
try {
|
||||
Thread.sleep(record_pos_delay);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
move_tick.start();
|
||||
|
||||
sendMessage(Text.translatable("message.repeating-mod.record_start"));
|
||||
}
|
||||
|
||||
@ -200,6 +212,7 @@ public class RepeatingMod implements ClientModInitializer {
|
||||
|
||||
public void stopRecording() {
|
||||
is_recording = false;
|
||||
move_tick = null;
|
||||
menu.update_btns();
|
||||
last_record = null;
|
||||
sendMessage(Text.translatable("message.repeating-mod.record_stop"));
|
||||
@ -228,6 +241,7 @@ public class RepeatingMod implements ClientModInitializer {
|
||||
public void stopReplay() {
|
||||
is_recording = false;
|
||||
is_replaying = false;
|
||||
replay = null;
|
||||
menu.update_btns();
|
||||
sendMessage(Text.translatable("message.repeating-mod.replay_stop"));
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ public class RepeatingScreen extends BaseOwoScreen<FlowLayout> {
|
||||
.verticalAlignment(VerticalAlignment.CENTER)
|
||||
.horizontalAlignment(HorizontalAlignment.CENTER)
|
||||
.margins(Insets.of(1)))*/
|
||||
/*).child(
|
||||
).child(
|
||||
Containers.verticalFlow(Sizing.content(), Sizing.content())
|
||||
.child(Containers.verticalFlow(Sizing.content(), Sizing.content())
|
||||
.child(Components.label(Text.translatable("text.repeating-mod.settings")).margins(Insets.of(1)))
|
||||
@ -165,34 +165,24 @@ public class RepeatingScreen extends BaseOwoScreen<FlowLayout> {
|
||||
.horizontalAlignment(HorizontalAlignment.CENTER)
|
||||
.margins(Insets.of(1)))
|
||||
.child(Containers.verticalFlow(Sizing.content(), Sizing.content())
|
||||
.child(Components.discreteSlider(Sizing.fixed(120),0,5)
|
||||
.decimalPlaces(2)
|
||||
.setFromDiscreteValue(mod.record_blocks_limit)
|
||||
.child(Components.discreteSlider(Sizing.fixed(120),-24,5000)
|
||||
.setFromDiscreteValue(mod.record_pos_delay)
|
||||
.message((String s)->{
|
||||
mod.record_blocks_limit = Double.parseDouble(s.replace(",","."));
|
||||
mod.conf.data.put("record_blocks_limit",mod.record_blocks_limit);
|
||||
mod.record_pos_delay = Long.parseLong(s);
|
||||
mod.conf.data.put("record_pos_delay",mod.record_pos_delay);
|
||||
mod.conf.save();
|
||||
return Text.translatable("text.repeating-mod.block_limit",s);
|
||||
}).scrollStep(0.2)
|
||||
if (mod.record_pos_delay > -1)
|
||||
return Text.translatable("text.repeating-mod.pos_delay", s);
|
||||
return Text.translatable("text.repeating-mod.nan_pos_delay", s);
|
||||
}).scrollStep(25)
|
||||
.margins(Insets.of(1))
|
||||
.tooltip(Text.translatable("text.repeating-mod.block_limit_tooltip")))
|
||||
.child(Components.discreteSlider(Sizing.fixed(120),0,1000)
|
||||
.decimalPlaces(0)
|
||||
.setFromDiscreteValue(mod.record_time_limit)
|
||||
.message((String s)->{
|
||||
mod.record_time_limit = (long) Double.parseDouble(s.replace(",","."));
|
||||
mod.conf.data.put("record_time_limit",mod.record_time_limit);
|
||||
mod.conf.save();
|
||||
return Text.translatable("text.repeating-mod.time_limit",s);
|
||||
}).scrollStep(2)
|
||||
.margins(Insets.of(1))
|
||||
.tooltip(Text.translatable("text.repeating-mod.time_limit_tooltip")))
|
||||
.tooltip(Text.translatable("text.repeating-mod.pos_delay_text")))
|
||||
.padding(Insets.of(10))
|
||||
.surface(Surface.DARK_PANEL)
|
||||
.verticalAlignment(VerticalAlignment.CENTER)
|
||||
.horizontalAlignment(HorizontalAlignment.CENTER)
|
||||
.margins(Insets.of(1)))
|
||||
)*/));
|
||||
));
|
||||
update_btns();
|
||||
}
|
||||
}
|
||||
|
@ -14,10 +14,9 @@
|
||||
"text.repeating-mod.parkour": "Parkour mode",
|
||||
"text.repeating-mod.settings": "Settings",
|
||||
"text.repeating-mod.dev": "In development...",
|
||||
"text.repeating-mod.block_limit": "Block limit: %s",
|
||||
"text.repeating-mod.block_limit_tooltip": "Two recording events will\nbe summed up if the\ndistance between them is\nless than the limit.",
|
||||
"text.repeating-mod.time_limit": "Time limit: %s ms",
|
||||
"text.repeating-mod.time_limit_tooltip": "Two recording events will\nbe summed up if the time\nbetween them is less than\nthe limit.",
|
||||
"text.repeating-mod.nan_pos_delay": "No pos delay",
|
||||
"text.repeating-mod.pos_delay": "Pos delay: %s ms",
|
||||
"text.repeating-mod.pos_delay_text": "Delay after which the pos event is added",
|
||||
|
||||
"message.repeating-mod.replay_start": "Replay started",
|
||||
"message.repeating-mod.replay_stop": "Replay finished",
|
||||
|
@ -14,10 +14,9 @@
|
||||
"text.repeating-mod.parkour": "Режим паркура",
|
||||
"text.repeating-mod.settings": "Настройки",
|
||||
"text.repeating-mod.dev": "В разработке...",
|
||||
"text.repeating-mod.block_limit": "Лимит блоков: %s",
|
||||
"text.repeating-mod.block_limit_tooltip": "Два ивента записи будут\nсуммироваться, если\nрасстояние между ними\nменьше лимита.",
|
||||
"text.repeating-mod.time_limit": "Лимит времени: %s мс",
|
||||
"text.repeating-mod.time_limit_tooltip": "Два ивента записи будут\nсуммироваться, если время\nмежду ними меньше лимита.",
|
||||
"text.repeating-mod.nan_pos_delay": "Задержки позиции нету",
|
||||
"text.repeating-mod.pos_delay": "Задержка позиции: %s мс",
|
||||
"text.repeating-mod.pos_delay_text": "Задержка, после которой добавляется ивент позиции",
|
||||
|
||||
"message.repeating-mod.replay_start": "Повтор начат",
|
||||
"message.repeating-mod.replay_stop": "Повтор закончен",
|
||||
|
Loading…
Reference in New Issue
Block a user