Use own event distribution system instead abusing fabric's one

This commit is contained in:
Jonas Herzig
2019-05-20 10:06:10 +02:00
parent 7cbf7f7c94
commit 0e086d91a6
22 changed files with 75 additions and 101 deletions

View File

@@ -1,8 +1,7 @@
package com.replaymod.pathing.player;
import com.replaymod.core.utils.WrappedTimer;
import net.fabricmc.fabric.api.event.Event;
import net.fabricmc.fabric.api.event.EventFactory;
import de.johni0702.minecraft.gui.utils.Event;
import net.minecraft.client.render.RenderTickCounter;
/**
@@ -45,12 +44,13 @@ public class ReplayTimer extends WrappedTimer {
}
public interface UpdatedCallback {
Event<UpdatedCallback> EVENT = EventFactory.createArrayBacked(UpdatedCallback.class,
(listeners) -> () -> {
Event<UpdatedCallback> EVENT = Event.create((listeners) ->
() -> {
for (UpdatedCallback listener : listeners) {
listener.onUpdate();
}
});
}
);
void onUpdate();
}
}