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