some fixes
This commit is contained in:
parent
27627e8404
commit
596ca3c0d3
@ -4,14 +4,14 @@ org.gradle.parallel=true
|
||||
|
||||
# Fabric Properties
|
||||
# check these on https://fabricmc.net/develop
|
||||
minecraft_version=1.20.4
|
||||
yarn_mappings=1.20.4+build.3
|
||||
minecraft_version=1.20
|
||||
yarn_mappings=1.20+build.1
|
||||
loader_version=0.15.10
|
||||
|
||||
#Fabric api
|
||||
fabric_version=0.97.0+1.20.4
|
||||
fabric_version=0.83.0+1.20
|
||||
|
||||
# Mod Properties
|
||||
mod_version = 1.1.0+1.20.4
|
||||
mod_version = 1.1.1+1.20
|
||||
maven_group = themixray.repeating.mod
|
||||
archives_base_name = repeating-mod
|
@ -41,8 +41,10 @@ public class RecordList {
|
||||
}
|
||||
}
|
||||
|
||||
public void addRecord(File file) throws Exception {
|
||||
addRecord(RecordState.load(file));
|
||||
public RecordState addRecord(File file) throws Exception {
|
||||
RecordState st = RecordState.load(file);
|
||||
addRecord(st);
|
||||
return st;
|
||||
}
|
||||
|
||||
public void addRecord(RecordState record) {
|
||||
|
@ -109,6 +109,8 @@ public class RecordState {
|
||||
}
|
||||
|
||||
public void save() throws IOException {
|
||||
if (start_record_pos == null || finish_record_pos == null) return;
|
||||
|
||||
StringBuilder text = new StringBuilder();
|
||||
|
||||
text.append(name).append("\n")
|
||||
@ -162,8 +164,13 @@ public class RecordState {
|
||||
}
|
||||
|
||||
public void remove() {
|
||||
file.delete();
|
||||
Main.me.record_list.removeRecord(this);
|
||||
Main.me.record_list.getWidget().removeWidget(this);
|
||||
if (Main.me.is_recording && this.equals(Main.me.now_record)) {
|
||||
Main.me.stopRecording();
|
||||
Main.me.now_record = null;
|
||||
return;
|
||||
}
|
||||
file.delete();
|
||||
}
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ public class RepeatingScreen extends Screen {
|
||||
|
||||
@Override
|
||||
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||
renderBackground(context,mouseX,mouseY,delta);
|
||||
renderBackground(context);
|
||||
|
||||
for (RenderListener l : render_listeners) {
|
||||
if (l.beforeRender()) {
|
||||
@ -148,7 +148,7 @@ public class RepeatingScreen extends Screen {
|
||||
if (files != null) {
|
||||
for (File file : files) {
|
||||
try {
|
||||
Main.me.record_list.addRecord(file);
|
||||
Main.me.setNowRecord(Main.me.record_list.addRecord(file));
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ public class RecordListWidget extends ScrollableWidget {
|
||||
public boolean checkTransport(transport tr) {
|
||||
for (RecordWidget wid : widgets) {
|
||||
for (ClickableWidget child : wid.getChildren()) {
|
||||
if (tr.check(child)) {
|
||||
if (child.isFocused() && tr.check(child)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -112,12 +112,14 @@ public class RecordListWidget extends ScrollableWidget {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean checkTransportNF(transport tr) {
|
||||
public boolean checkTransportNF(double mouseX, double mouseY, int button) {
|
||||
for (RecordWidget wid : widgets) {
|
||||
for (ClickableWidget child : wid.getChildren()) {
|
||||
boolean res = tr.check(child);
|
||||
if (wid.contains((int) mouseX, (int) mouseY)) {
|
||||
Main.me.setNowRecord(wid.getRecord());
|
||||
}
|
||||
|
||||
if (res) {
|
||||
for (ClickableWidget child : wid.getChildren()) {
|
||||
if (child.mouseClicked(mouseX, mouseY, button)) {
|
||||
child.setFocused(true);
|
||||
return true;
|
||||
} else {
|
||||
@ -130,7 +132,7 @@ public class RecordListWidget extends ScrollableWidget {
|
||||
|
||||
@Override
|
||||
public boolean mouseClicked(double mouseX, double mouseY, int button) {
|
||||
return checkTransportNF((c) -> c.mouseClicked(mouseX, mouseY + this.getScrollY(), button)) || super.mouseClicked(mouseX, mouseY, button);
|
||||
return checkTransportNF(mouseX, mouseY + getScrollY(), button) || super.mouseClicked(mouseX, mouseY, button);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -42,6 +42,10 @@ public class RecordWidget implements Drawable, Widget {
|
||||
this.children = new ArrayList<>();
|
||||
}
|
||||
|
||||
public boolean contains(int x, int y) {
|
||||
return parent.getX() + getX() <= x && parent.getY() + getY() <= y && x <= parent.getX() + getX() + getWidth() && y <= parent.getY() + getY() + getHeight();
|
||||
}
|
||||
|
||||
public void setX(int x) {
|
||||
this.x = x;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user