Skip to content

Commit

Permalink
fix forge event
Browse files Browse the repository at this point in the history
  • Loading branch information
MORIMORI0317 committed Apr 15, 2022
1 parent da0c846 commit 5688e37
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static void init() {
private static EventResult entityTick(Entity entity) {
// if (!(entity instanceof Player))
// return EventResult.interruptFalse();
//entity.setPos(entity.position().add(0, 0.5f, 0));
// entity.setPos(entity.position().add(0, 0.5f, 0));
return EventResult.pass();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package dev.felnull.otyacraftengine.mixin;

import dev.felnull.otyacraftengine.event.OECommonEventHooks;
import net.minecraft.world.entity.Entity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(Entity.class)
public class EntityMixin {
@Inject(method = "tick", at = @At("HEAD"), cancellable = true)
private void tick(CallbackInfo ci) {
if (!OECommonEventHooks.onEntityTick((Entity) (Object) this))
ci.cancel();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"client.SubtitleMixin"
],
"mixins": [
"EntityMixin",
"InventoryChangeTriggerMixin",
"LivingEntityMixin",
"MinecraftServerMixin",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,4 @@ public class EntityMixin {
private void init(EntityType<?> entityType, Level level, CallbackInfo ci) {
OECommonEventHooks.onEntityDefineSynchedData((Entity) (Object) this, entityData);
}

@Inject(method = "tick", at = @At("HEAD"), cancellable = true)
private void tick(CallbackInfo ci) {
if (!OECommonEventHooks.onEntityTick((Entity) (Object) this))
ci.cancel();
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ minecraft_version=1.18.2
#-------------------MOD Data--------------------#
archives_base_name=otyacraftengine
mod_display_name=OtyacraftEngine
mod_version=2.13
mod_version=2.14
#-----------------Library Version---------------#
architectury_version=4.1.32
fabric_loader_version=0.13.3
Expand Down

0 comments on commit 5688e37

Please sign in to comment.