Fixed: RedstoneSignal вызывался до первого тика
This commit is contained in:
@@ -62,6 +62,7 @@ public class EventListener implements Listener {
|
|||||||
public static Object dealingEvent = null;
|
public static Object dealingEvent = null;
|
||||||
|
|
||||||
public static final int FORM_REJOIN_EXCEPTION = 2560;
|
public static final int FORM_REJOIN_EXCEPTION = 2560;
|
||||||
|
public static boolean isFirstTickEnd = false;
|
||||||
|
|
||||||
public static void consumeEvent(Event event, CallbackHelper.ICallbackApply apply, boolean isPrevent) {
|
public static void consumeEvent(Event event, CallbackHelper.ICallbackApply apply, boolean isPrevent) {
|
||||||
CallbackHelper.apply(event, apply, isPrevent);
|
CallbackHelper.apply(event, apply, isPrevent);
|
||||||
@@ -115,12 +116,14 @@ public class EventListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onRedstoneUpdate(RedstoneUpdateEvent event) {
|
public void onRedstoneUpdate(RedstoneUpdateEvent event) {
|
||||||
Block block = event.getBlock();
|
if(isFirstTickEnd){
|
||||||
Level level = event.getBlock().getLevel();
|
Block block = event.getBlock();
|
||||||
int signal = level.isBlockIndirectlyGettingPowered(block);
|
Level level = event.getBlock().getLevel();
|
||||||
|
int signal = level.isBlockIndirectlyGettingPowered(block);
|
||||||
|
|
||||||
consumeEvent(event, () -> NativeCallback.onRedstoneSignalChange((int) block.x, (int) block.y, (int) block.z,
|
consumeEvent(event, () -> NativeCallback.onRedstoneSignalChange((int) block.x, (int) block.y, (int) block.z,
|
||||||
signal, !event.getBlock().isPowerSource(), level));
|
signal, !event.getBlock().isPowerSource(), level));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import com.reider745.api.hooks.TypeHook;
|
|||||||
import com.reider745.api.hooks.annotation.Inject;
|
import com.reider745.api.hooks.annotation.Inject;
|
||||||
import com.reider745.api.hooks.annotation.Hooks;
|
import com.reider745.api.hooks.annotation.Hooks;
|
||||||
import com.reider745.entity.EntityMotion;
|
import com.reider745.entity.EntityMotion;
|
||||||
|
import com.reider745.event.EventListener;
|
||||||
import com.zhekasmirnov.horizon.runtime.logger.Logger;
|
import com.zhekasmirnov.horizon.runtime.logger.Logger;
|
||||||
import com.zhekasmirnov.innercore.api.NativeCallback;
|
import com.zhekasmirnov.innercore.api.NativeCallback;
|
||||||
|
|
||||||
@@ -70,6 +71,8 @@ public class ServerHooks implements HookClass {
|
|||||||
try {
|
try {
|
||||||
EntityMotion.tick();
|
EntityMotion.tick();
|
||||||
NativeCallback.onTick();
|
NativeCallback.onTick();
|
||||||
|
|
||||||
|
EventListener.isFirstTickEnd = true;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.warning("IC-TICK", e.getCause());
|
Logger.warning("IC-TICK", e.getCause());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user