aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/dulkirmod/mixins/MixinWorld.java13
-rw-r--r--src/main/kotlin/dulkirmod/events/Events.kt9
2 files changed, 20 insertions, 2 deletions
diff --git a/src/main/java/dulkirmod/mixins/MixinWorld.java b/src/main/java/dulkirmod/mixins/MixinWorld.java
index 1c75281..5b6a267 100644
--- a/src/main/java/dulkirmod/mixins/MixinWorld.java
+++ b/src/main/java/dulkirmod/mixins/MixinWorld.java
@@ -1,8 +1,11 @@
package dulkirmod.mixins;
import dulkirmod.DulkirMod;
-import dulkirmod.features.DragonTimer;
+import dulkirmod.events.EntityRemovedEvent;
+import dulkirmod.features.DragonFeatures;
+import net.minecraft.entity.Entity;
import net.minecraft.world.World;
+import net.minecraftforge.common.MinecraftForge;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
@@ -13,7 +16,7 @@ public class MixinWorld {
@Inject(method = "spawnParticle(IZDDDDDD[I)V", at = @At("HEAD"), cancellable = true)
public void onInitGui(int particleID, boolean p_175720_2_, double xCoord, double yCoord, double zCoord, double xOffset, double yOffset, double zOffset, int[] p_175720_15_, CallbackInfo ci) {
- DragonTimer.INSTANCE.handleNewParticle(particleID, xCoord, yCoord, zCoord);
+ DragonFeatures.INSTANCE.handleNewParticle(particleID, xCoord, yCoord, zCoord);
if (particleID == 25 && DulkirMod.Companion.getConfig().getHideEnchantRune()) {
ci.cancel();
@@ -21,4 +24,10 @@ public class MixinWorld {
ci.cancel();
}
}
+
+ // Source: Aton addons https://github.com/FloppaCoding/AtonAddons/blob/main/src/main/java/atonaddons/mixins/MixinWorld.java
+ @Inject(method = "removeEntity", at = @At("HEAD"))
+ public void onEntityRemoved(Entity entityIn, CallbackInfo ci) {
+ MinecraftForge.EVENT_BUS.post(new EntityRemovedEvent(entityIn));
+ }
}
diff --git a/src/main/kotlin/dulkirmod/events/Events.kt b/src/main/kotlin/dulkirmod/events/Events.kt
new file mode 100644
index 0000000..45cc8ff
--- /dev/null
+++ b/src/main/kotlin/dulkirmod/events/Events.kt
@@ -0,0 +1,9 @@
+package dulkirmod.events
+
+import net.minecraft.entity.Entity
+import net.minecraftforge.fml.common.eventhandler.Event
+
+/**
+ * Fired when an entity is removed from the world.
+ */
+class EntityRemovedEvent(val entity: Entity) : Event() \ No newline at end of file