aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/anthonyhilyard/iceberg/mixin
diff options
context:
space:
mode:
authorAnthony Hilyard <anthony.hilyard@gmail.com>2022-06-14 17:12:07 -0700
committerAnthony Hilyard <anthony.hilyard@gmail.com>2022-06-14 17:12:07 -0700
commitbb600c7a27816d8390e5bb44cfe53d8736070902 (patch)
tree29c91330c33b81dcb7c3abb648409284c297655e /src/main/java/com/anthonyhilyard/iceberg/mixin
parent39398536fb13a0d08308229f9b38e9d1b58d0f54 (diff)
downloadIceberg-bb600c7a27816d8390e5bb44cfe53d8736070902.tar.gz
Iceberg-bb600c7a27816d8390e5bb44cfe53d8736070902.tar.bz2
Iceberg-bb600c7a27816d8390e5bb44cfe53d8736070902.zip
Updated to support 1.18.2.
Diffstat (limited to 'src/main/java/com/anthonyhilyard/iceberg/mixin')
-rw-r--r--src/main/java/com/anthonyhilyard/iceberg/mixin/EntityMixin.java63
1 files changed, 0 insertions, 63 deletions
diff --git a/src/main/java/com/anthonyhilyard/iceberg/mixin/EntityMixin.java b/src/main/java/com/anthonyhilyard/iceberg/mixin/EntityMixin.java
deleted file mode 100644
index 5d02156..0000000
--- a/src/main/java/com/anthonyhilyard/iceberg/mixin/EntityMixin.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package com.anthonyhilyard.iceberg.mixin;
-
-import java.util.Objects;
-
-import com.anthonyhilyard.iceberg.events.EntityFluidEvents;
-
-import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.asm.mixin.Shadow;
-import org.spongepowered.asm.mixin.injection.At;
-import org.spongepowered.asm.mixin.injection.Inject;
-import org.spongepowered.asm.mixin.injection.At.Shift;
-import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-
-import net.minecraft.world.entity.Entity;
-import net.minecraft.world.level.material.Fluid;
-import net.minecraft.tags.Tag;
-
-@Mixin(Entity.class)
-public class EntityMixin
-{
- private Fluid previousFluidOnEyes = null;
-
- @Shadow
- protected Tag<Fluid> fluidOnEyes;
-
- @Inject(method = "updateFluidOnEyes", at = @At(value = "RETURN"))
- public void onUpdateFluidOnEyes(CallbackInfo callbackInfo)
- {
- if (fluidOnEyes != null && fluidOnEyes.getValues().size() > 0)
- {
- previousFluidOnEyes = fluidOnEyes.getValues().get(0);
- }
- else if (previousFluidOnEyes != null)
- {
- // We were submerged in a fluid that we no longer are.
- if (previousFluidOnEyes != null)
- {
- EntityFluidEvents.EXITED.invoker().onExited((Entity)(Object)this, previousFluidOnEyes);
- }
- previousFluidOnEyes = null;
- }
- }
-
- @Inject(method = "updateFluidOnEyes",
- at = @At(value = "FIELD", target = "Lnet/minecraft/world/entity/Entity;fluidOnEyes:Lnet/minecraft/tags/Tag;", ordinal = 1, shift = Shift.AFTER))
- public void onUpdateFluidOnEyeAssign(CallbackInfo callbackInfo)
- {
- Fluid currentFluid = null;
- if (fluidOnEyes != null && fluidOnEyes.getValues().size() > 0)
- {
- currentFluid = fluidOnEyes.getValues().get(0);
- }
-
- if (!Objects.equals(previousFluidOnEyes, currentFluid))
- {
- // We are now submerged in a fluid that doesn't match the previous one.
- if (currentFluid != null)
- {
- EntityFluidEvents.ENTERED.invoker().onEntered((Entity)(Object)this, currentFluid);
- }
- }
- }
-}