Reduced reflection usage / Improved event system
This commit is contained in:
@@ -34,7 +34,7 @@ public class FloatingDialog extends Dialog{
|
||||
}
|
||||
|
||||
protected void onResize(Runnable run){
|
||||
Events.on(ResizeEvent.class, () -> {
|
||||
Events.on(ResizeEvent.class, event -> {
|
||||
if(isShown()){
|
||||
run.run();
|
||||
}
|
||||
|
||||
@@ -89,14 +89,12 @@ public class BlocksFragment extends Fragment{
|
||||
}).bottom().right().get();
|
||||
});
|
||||
|
||||
Events.on(WorldLoadEvent.class, this::rebuild);
|
||||
Events.on(WorldLoadEvent.class, event -> rebuild());
|
||||
|
||||
rebuild();
|
||||
}
|
||||
|
||||
/**
|
||||
* Rebuilds the whole placement menu, attempting to preserve previous state.
|
||||
*/
|
||||
/**Rebuilds the whole placement menu, attempting to preserve previous state.*/
|
||||
void rebuild(){
|
||||
selectTable.clear();
|
||||
|
||||
|
||||
@@ -138,8 +138,8 @@ public class HudFragment extends Fragment{
|
||||
parent.fill(t -> {
|
||||
float notifDuration = 240f;
|
||||
|
||||
Events.on(StateChangeEvent.class, (from, to) -> {
|
||||
if(to == State.menu || from == State.menu){
|
||||
Events.on(StateChangeEvent.class, event -> {
|
||||
if(event.to == State.menu || event.from == State.menu){
|
||||
coreAttackTime = 0f;
|
||||
lastCoreHP = Float.NaN;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public class MenuFragment extends Fragment{
|
||||
buildDesktop();
|
||||
}else{
|
||||
buildMobile();
|
||||
Events.on(ResizeEvent.class, this::buildMobile);
|
||||
Events.on(ResizeEvent.class, event -> buildMobile());
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user