aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2022-12-29 18:34:45 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2022-12-29 18:34:45 +0100
commit5689117e8d5f1ba39aef4c9c60529fb5a697b25d (patch)
tree08ec1172f643c71dc17e7f880793ea462da93879 /src
parent78328f061716609a61550aced3106b835b6f298c (diff)
downloadskyhanni-5689117e8d5f1ba39aef4c9c60529fb5a697b25d.tar.gz
skyhanni-5689117e8d5f1ba39aef4c9c60529fb5a697b25d.tar.bz2
skyhanni-5689117e8d5f1ba39aef4c9c60529fb5a697b25d.zip
performance increases via particle logic changes
Diffstat (limited to 'src')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/events/RenderParticleEvent.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/HideBlazeParticles.kt28
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/nether/ashfang/AshfangHideParticles.kt16
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerClearView.kt16
-rw-r--r--src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderGlobalHook.kt32
-rw-r--r--src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinEntityBlaze.java20
-rw-r--r--src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinRenderGlobal.java17
-rw-r--r--src/main/resources/mixins.skyhanni.json2
9 files changed, 21 insertions, 118 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
index b3622499f..afb2793d5 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.java
@@ -158,7 +158,6 @@ public class SkyHanniMod {
registerEvent(new SlayerQuestWarning());
registerEvent(new StatsTuning());
registerEvent(new NonGodPotEffectDisplay());
- registerEvent(new HideBlazeParticles());
registerEvent(new SoopyGuessBurrow());
registerEvent(new GriffinBurrowHelper());
registerEvent(new GriffinBurrowParticleFinder());
diff --git a/src/main/java/at/hannibal2/skyhanni/events/RenderParticleEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/RenderParticleEvent.kt
deleted file mode 100644
index 0146c0467..000000000
--- a/src/main/java/at/hannibal2/skyhanni/events/RenderParticleEvent.kt
+++ /dev/null
@@ -1,7 +0,0 @@
-package at.hannibal2.skyhanni.events
-
-import net.minecraftforge.fml.common.eventhandler.Cancelable
-
-@Cancelable
-class RenderParticleEvent(val particleId: Int, val callerClass: String, val x: Double, val y: Double, val z: Double) :
- LorenzEvent() \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/HideBlazeParticles.kt b/src/main/java/at/hannibal2/skyhanni/features/HideBlazeParticles.kt
deleted file mode 100644
index 6387ab145..000000000
--- a/src/main/java/at/hannibal2/skyhanni/features/HideBlazeParticles.kt
+++ /dev/null
@@ -1,28 +0,0 @@
-package at.hannibal2.skyhanni.features
-
-import at.hannibal2.skyhanni.SkyHanniMod
-import at.hannibal2.skyhanni.events.RenderParticleEvent
-import at.hannibal2.skyhanni.utils.EntityUtils.getEntitiesNearby
-import at.hannibal2.skyhanni.utils.LorenzVec
-import net.minecraft.client.Minecraft
-import net.minecraft.entity.monster.EntityBlaze
-import net.minecraft.util.EnumParticleTypes
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-
-class HideBlazeParticles {
-
- @SubscribeEvent
- fun onSpawnParticle(event: RenderParticleEvent) {
- val particleId = event.particleId
- if (!SkyHanniMod.feature.misc.hideBlazeParticles) return
-
- val particleType = EnumParticleTypes.values().find { it.particleID == particleId }
- if (particleType != EnumParticleTypes.SMOKE_LARGE) return
-
- val location = LorenzVec(event.x, event.y, event.z)
- val clazz = EntityBlaze::class.java
- if (Minecraft.getMinecraft().theWorld.getEntitiesNearby(clazz, location, 3.0).isNotEmpty()) {
- event.isCanceled = true
- }
- }
-} \ 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 c299e7ef6..b99f0ff7b 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
@@ -3,7 +3,6 @@ package at.hannibal2.skyhanni.features.nether.ashfang
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.events.CheckRenderEntityEvent
import at.hannibal2.skyhanni.events.ReceiveParticleEvent
-import at.hannibal2.skyhanni.events.RenderParticleEvent
import at.hannibal2.skyhanni.features.damageindicator.BossType
import at.hannibal2.skyhanni.features.damageindicator.DamageIndicatorManager
import at.hannibal2.skyhanni.utils.ItemUtils.name
@@ -35,21 +34,6 @@ class AshfangHideParticles {
event.isCanceled = true
}
- @SubscribeEvent
- fun onSpawnParticle(event: RenderParticleEvent) {
- if (!isEnabled()) return
-
-
- when (event.callerClass) {
- "net.minecraft.block.BlockFire",
- "net.minecraft.entity.monster.EntityBlaze",
- "net.minecraft.entity.projectile.EntityFireball",
- -> {
- event.isCanceled = true
- }
- }
- }
-
@SubscribeEvent(priority = EventPriority.HIGH)
fun onCheckRender(event: CheckRenderEntityEvent<*>) {
if (!isEnabled()) return
diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerClearView.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerClearView.kt
index 8a9f58718..3f0e8ad76 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerClearView.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/blaze/BlazeSlayerClearView.kt
@@ -3,7 +3,6 @@ package at.hannibal2.skyhanni.features.slayer.blaze
import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.events.CheckRenderEntityEvent
import at.hannibal2.skyhanni.events.ReceiveParticleEvent
-import at.hannibal2.skyhanni.events.RenderParticleEvent
import at.hannibal2.skyhanni.features.damageindicator.BossType
import at.hannibal2.skyhanni.features.damageindicator.DamageIndicatorManager
import at.hannibal2.skyhanni.utils.EntityUtils.hasSkullTexture
@@ -47,21 +46,6 @@ class BlazeSlayerClearView {
}
@SubscribeEvent
- fun onSpawnParticle(event: RenderParticleEvent) {
- if (isEnabled()) {
- when (event.callerClass) {
- "net.minecraft.block.BlockFire",
- "net.minecraft.entity.monster.EntityBlaze",
- "net.minecraft.entity.projectile.EntityFireball",
- -> {
- event.isCanceled = true
- return
- }
- }
- }
- }
-
- @SubscribeEvent
fun onCheckRender(event: CheckRenderEntityEvent<*>) {
if (isEnabled()) {
val entity = event.entity
diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderGlobalHook.kt b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderGlobalHook.kt
deleted file mode 100644
index 459d192f8..000000000
--- a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/RenderGlobalHook.kt
+++ /dev/null
@@ -1,32 +0,0 @@
-package at.hannibal2.skyhanni.mixins.hooks
-
-import at.hannibal2.skyhanni.events.RenderParticleEvent
-import at.hannibal2.skyhanni.utils.LorenzUtils
-import org.spongepowered.asm.mixin.injection.callback.CallbackInfo
-
-class RenderGlobalHook {
- companion object {
- fun spawnParticle(
- particleId: Int,
- x: Double,
- y: Double,
- z: Double,
- ci: CallbackInfo,
- ) {
- val callerClass = LorenzUtils.getCallerClass(
- "at.hannibal2.skyhanni.mixins.hooks.RenderGlobalHook\$Companion",
- "at.hannibal2.skyhanni.mixins.hooks.RenderGlobalHook",
- "net.minecraft.client.renderer.RenderGlobal",
- "net.minecraft.world.World",
- "net.minecraft.client.network.NetHandlerPlayClient",
- "net.minecraft.network.play.server.S2APacketParticles",
- ) ?: "null"
-
- if (RenderParticleEvent(particleId, callerClass, x, y, z).postAndCatch()) {
- ci.cancel()
- return
- }
-
- }
- }
-} \ No newline at end of file
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..d041a8b69
--- /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.SkyHanniMod;
+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 class MixinEntityBlaze {
+
+ @Redirect(method = "onLivingUpdate", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;spawnParticle(Lnet/minecraft/util/EnumParticleTypes;DDDDDD[I)V"))
+ private void onLivingUpdate(World instance, EnumParticleTypes particleType, double xCoord, double yCoord, double zCoord, double xOffset, double yOffset, double zOffset, int[] p_175688_14_) {
+ if (!SkyHanniMod.feature.misc.hideBlazeParticles) {
+ instance.spawnParticle(particleType, xCoord, yCoord, zCoord, xOffset, yOffset, zOffset, p_175688_14_);
+ }
+ }
+}
diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinRenderGlobal.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinRenderGlobal.java
deleted file mode 100644
index 8d5f58127..000000000
--- a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/MixinRenderGlobal.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package at.hannibal2.skyhanni.mixins.transformers;
-
-import at.hannibal2.skyhanni.mixins.hooks.RenderGlobalHook;
-import net.minecraft.client.renderer.RenderGlobal;
-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(RenderGlobal.class)
-public class MixinRenderGlobal {
-
- @Inject(method = "spawnParticle(IZDDDDDD[I)V", at = @At("HEAD"), cancellable = true)
- private void spawnParticle(int particleId, boolean ignoreRange, double x, double y, double z, double xOffset, double yOffset, double zOffset, int[] p_180442_15_, CallbackInfo ci) {
- RenderGlobalHook.Companion.spawnParticle(particleId, x, y, z, ci);
- }
-}
diff --git a/src/main/resources/mixins.skyhanni.json b/src/main/resources/mixins.skyhanni.json
index dc5d80243..337fe91de 100644
--- a/src/main/resources/mixins.skyhanni.json
+++ b/src/main/resources/mixins.skyhanni.json
@@ -4,9 +4,9 @@
"compatibilityLevel": "JAVA_8",
"mixins": [
"AccessorGuiPlayerTabOverlay",
+ "MixinEntityBlaze",
"MixinNetHandlerPlayClient",
"MixinNetworkManager",
- "MixinRenderGlobal",
"MixinRenderItem",
"MixinRenderManager",
"gui.AccessorGuiContainer",