aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/anthonyhilyard/iceberg/mixin/EntityMixin.java
diff options
context:
space:
mode:
authorAnthony Hilyard <anthony.hilyard@gmail.com>2022-05-19 15:53:47 -0700
committerAnthony Hilyard <anthony.hilyard@gmail.com>2022-05-19 15:53:47 -0700
commitfd1948939a5978832ce5da5bb2dbbd0df49a2ac3 (patch)
tree7856ada82a27bb0cf136fbbd9296aa351a85f22a /src/main/java/com/anthonyhilyard/iceberg/mixin/EntityMixin.java
parent312cf6b1d2990d7632807dfa5ef93b8dd2cbb865 (diff)
downloadIceberg-fd1948939a5978832ce5da5bb2dbbd0df49a2ac3.tar.gz
Iceberg-fd1948939a5978832ce5da5bb2dbbd0df49a2ac3.tar.bz2
Iceberg-fd1948939a5978832ce5da5bb2dbbd0df49a2ac3.zip
Bumped required forge version to 40.1, fixed IcebergConfig crash.
Diffstat (limited to 'src/main/java/com/anthonyhilyard/iceberg/mixin/EntityMixin.java')
-rw-r--r--src/main/java/com/anthonyhilyard/iceberg/mixin/EntityMixin.java64
1 files changed, 0 insertions, 64 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 8c03e8b..0000000
--- a/src/main/java/com/anthonyhilyard/iceberg/mixin/EntityMixin.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package com.anthonyhilyard.iceberg.mixin;
-
-import java.util.Objects;
-
-import com.anthonyhilyard.iceberg.events.EntityFluidEvent;
-
-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;
-import net.minecraftforge.common.MinecraftForge;
-
-@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)
- {
- MinecraftForge.EVENT_BUS.post(new EntityFluidEvent.Exited((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)
- {
- MinecraftForge.EVENT_BUS.post(new EntityFluidEvent.Entered((Entity)(Object)this, currentFluid));
- }
- }
- }
-}