aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2022-09-30 23:14:39 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2022-09-30 23:14:39 +0200
commite306319f1980d861c7075832ebb64bd5c19db0fa (patch)
tree8168c27a855a2dbb128e5453445c7ecf631304cc /src/main
parent0f6f97ddb7770bc5d3e22e46e368382ac9b55b2c (diff)
downloadskyhanni-e306319f1980d861c7075832ebb64bd5c19db0fa.tar.gz
skyhanni-e306319f1980d861c7075832ebb64bd5c19db0fa.tar.bz2
skyhanni-e306319f1980d861c7075832ebb64bd5c19db0fa.zip
hide blaze particles next to ashfang
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/events/BlazeParticleEvent.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideParticles.kt15
-rw-r--r--src/main/java/at/hannibal2/skyhanni/mixins/hooks/EntityBlazeHook.kt9
-rw-r--r--src/main/java/at/hannibal2/skyhanni/mixins/hooks/render/BlockRendererDispatcherHook.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinEntityBlaze.java20
-rw-r--r--src/main/java/at/hannibal2/skyhanni/mixins/transformers/renderer/MixinBlockRendererDispatcher.java2
-rw-r--r--src/main/resources/mixins.skyhanni.json11
7 files changed, 56 insertions, 10 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/events/BlazeParticleEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/BlazeParticleEvent.kt
new file mode 100644
index 000000000..cbf709a34
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/events/BlazeParticleEvent.kt
@@ -0,0 +1,7 @@
+package at.hannibal2.skyhanni.events
+
+import net.minecraft.entity.monster.EntityBlaze
+import net.minecraftforge.fml.common.eventhandler.Cancelable
+
+@Cancelable
+class BlazeParticleEvent(val blaze: EntityBlaze): LorenzEvent() \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideParticles.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideParticles.kt
index 419f82486..c6c5f8786 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideParticles.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideParticles.kt
@@ -1,6 +1,7 @@
package at.hannibal2.skyhanni.features.nether.ashfang
import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.events.BlazeParticleEvent
import at.hannibal2.skyhanni.events.PlayParticleEvent
import at.hannibal2.skyhanni.features.damageindicator.BossType
import at.hannibal2.skyhanni.features.damageindicator.DamageIndicatorManager
@@ -11,10 +12,18 @@ class AshfangHideParticles {
@SubscribeEvent
fun onReceivePacket(event: PlayParticleEvent) {
- if (LorenzUtils.inSkyblock && SkyHanniMod.feature.ashfang.hideParticles &&
- DamageIndicatorManager.isBossSpawned(BossType.NETHER_ASHFANG)
- ) {
+ if (isEnabled()) {
event.isCanceled = true
}
}
+
+ @SubscribeEvent
+ fun onBlazeParticle(event: BlazeParticleEvent) {
+ if (isEnabled()) {
+ event.isCanceled = true
+ }
+ }
+
+ private fun isEnabled() = LorenzUtils.inSkyblock && SkyHanniMod.feature.ashfang.hideParticles &&
+ DamageIndicatorManager.isBossSpawned(BossType.NETHER_ASHFANG)
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/EntityBlazeHook.kt b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/EntityBlazeHook.kt
new file mode 100644
index 000000000..9b7e09cc7
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/EntityBlazeHook.kt
@@ -0,0 +1,9 @@
+package at.hannibal2.skyhanni.mixins.hooks
+
+import at.hannibal2.skyhanni.events.BlazeParticleEvent
+import net.minecraft.entity.monster.EntityBlaze
+
+fun onBlockBlazeParticle(mixinBlaze: Any): Boolean {
+ val blaze = mixinBlaze as EntityBlaze
+ return BlazeParticleEvent(blaze).postAndCatch()
+}
diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/render/BlockRendererDispatcherHook.kt b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/render/BlockRendererDispatcherHook.kt
index 4f951a887..8b6fce6b3 100644
--- a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/render/BlockRendererDispatcherHook.kt
+++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/render/BlockRendererDispatcherHook.kt
@@ -1,4 +1,4 @@
-package at.hannibal2.skyhanni.mixinhooks.render
+package at.hannibal2.skyhanni.mixins.hooks.render
import at.hannibal2.skyhanni.events.RenderBlockInWorldEvent
import net.minecraft.block.state.IBlockState
diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinEntityBlaze.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinEntityBlaze.java
new file mode 100644
index 000000000..2565e4c69
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinEntityBlaze.java
@@ -0,0 +1,20 @@
+package at.hannibal2.skyhanni.mixins.transformers;
+
+import at.hannibal2.skyhanni.mixins.hooks.EntityBlazeHookKt;
+import net.minecraft.entity.monster.EntityBlaze;
+import net.minecraft.util.EnumParticleTypes;
+import net.minecraft.world.World;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Redirect;
+
+@Mixin(EntityBlaze.class)
+public abstract class MixinEntityBlaze {
+
+ @Redirect(method = "onLivingUpdate", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;spawnParticle(Lnet/minecraft/util/EnumParticleTypes;DDDDDD[I)V"))
+ private void onBlazeSpawnParticle(World instance, EnumParticleTypes particleType, double xCoord, double yCoord, double zCoord, double xOffset, double yOffset, double zOffset, int[] p_175688_14_) {
+ if (!EntityBlazeHookKt.onBlockBlazeParticle(this)) {
+ instance.spawnParticle(particleType, xCoord, yCoord, zCoord, xOffset, yOffset, zOffset, p_175688_14_);
+ }
+ }
+}
diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/renderer/MixinBlockRendererDispatcher.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/renderer/MixinBlockRendererDispatcher.java
index 26c9ab76f..32324ce7f 100644
--- a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/renderer/MixinBlockRendererDispatcher.java
+++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/renderer/MixinBlockRendererDispatcher.java
@@ -1,6 +1,6 @@
package at.hannibal2.skyhanni.mixins.transformers.renderer;
-import at.hannibal2.skyhanni.mixinhooks.render.BlockRendererDispatcherHookKt;
+import at.hannibal2.skyhanni.mixins.hooks.render.BlockRendererDispatcherHookKt;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.BlockRendererDispatcher;
import net.minecraft.client.resources.IResourceManagerReloadListener;
diff --git a/src/main/resources/mixins.skyhanni.json b/src/main/resources/mixins.skyhanni.json
index be81450d1..9ff82adb2 100644
--- a/src/main/resources/mixins.skyhanni.json
+++ b/src/main/resources/mixins.skyhanni.json
@@ -3,16 +3,17 @@
"refmap": "mixins.skyhanni.refmap.json",
"compatibilityLevel": "JAVA_8",
"mixins": [
- "MixinNetworkManager",
+ "AccessorGuiPlayerTabOverlay",
+ "MixinEntityBlaze",
"MixinNetHandlerPlayClient",
+ "MixinNetworkManager",
"MixinRenderItem",
- "AccessorGuiPlayerTabOverlay",
"MixinRenderManager",
- "gui.MixinGuiContainer",
"gui.AccessorGuiContainer",
+ "gui.MixinGuiContainer",
"gui.inventory.GuiEditSignMixin",
- "tileentity.TileEntitySignMixin",
"renderer.MixinBlockRendererDispatcher",
- "renderer.MixinRendererLivingEntity"
+ "renderer.MixinRendererLivingEntity",
+ "tileentity.TileEntitySignMixin"
]
}