aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorMy-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com>2021-08-24 18:27:36 -0400
committerMy-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com>2021-08-24 18:27:36 -0400
commit6345af3be1b112390ce07d44c243be23397e10e0 (patch)
tree5d76ead9c14bc9e6017c003ee112d26f5aff5c1e /src/main
parenta79d35e847996d0d6afa2582cf6d6f528dbe8c6f (diff)
downloadSkytilsMod-6345af3be1b112390ce07d44c243be23397e10e0.tar.gz
SkytilsMod-6345af3be1b112390ce07d44c243be23397e10e0.tar.bz2
SkytilsMod-6345af3be1b112390ce07d44c243be23397e10e0.zip
"no block animation"
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/skytils/skytilsmod/mixins/transformers/renderer/MixinItemRenderer.java38
-rw-r--r--src/main/kotlin/skytils/skytilsmod/core/Config.kt7
-rw-r--r--src/main/kotlin/skytils/skytilsmod/mixins/hooks/renderer/ItemRendererHook.kt30
-rw-r--r--src/main/resources/mixins.skytils.json1
4 files changed, 76 insertions, 0 deletions
diff --git a/src/main/java/skytils/skytilsmod/mixins/transformers/renderer/MixinItemRenderer.java b/src/main/java/skytils/skytilsmod/mixins/transformers/renderer/MixinItemRenderer.java
new file mode 100644
index 00000000..7761a449
--- /dev/null
+++ b/src/main/java/skytils/skytilsmod/mixins/transformers/renderer/MixinItemRenderer.java
@@ -0,0 +1,38 @@
+/*
+ * Skytils - Hypixel Skyblock Quality of Life Mod
+ * Copyright (C) 2021 Skytils
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package skytils.skytilsmod.mixins.transformers.renderer;
+
+import net.minecraft.client.entity.AbstractClientPlayer;
+import net.minecraft.client.renderer.ItemRenderer;
+import net.minecraft.item.ItemStack;
+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.Redirect;
+import skytils.skytilsmod.mixins.hooks.renderer.ItemRendererHookKt;
+
+@Mixin(ItemRenderer.class)
+public class MixinItemRenderer {
+ @Shadow private ItemStack itemToRender;
+
+ @Redirect(method = "renderItemInFirstPerson", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/entity/AbstractClientPlayer;getItemInUseCount()I"))
+ private int getItemInUseCountForFirstPerson(AbstractClientPlayer abstractClientPlayer) {
+ return ItemRendererHookKt.getItemInUseCountForFirstPerson(abstractClientPlayer, itemToRender);
+ }
+}
diff --git a/src/main/kotlin/skytils/skytilsmod/core/Config.kt b/src/main/kotlin/skytils/skytilsmod/core/Config.kt
index 051a2526..29aa69e3 100644
--- a/src/main/kotlin/skytils/skytilsmod/core/Config.kt
+++ b/src/main/kotlin/skytils/skytilsmod/core/Config.kt
@@ -997,6 +997,13 @@ object Config : Vigilant(File("./config/skytils/config.toml"), "Skytils", sortin
var compactStars = false
@Property(
+ type = PropertyType.SWITCH, name = "Disable Block Animation",
+ description = "Removes the block animation on swords.",
+ category = "Miscellaneous", subcategory = "Items"
+ )
+ var disableBlockAnimation = false
+
+ @Property(
type = PropertyType.SWITCH, name = "Hide Implosion Particles",
description = "Removes the explosion created by the Implosion ability.",
category = "Miscellaneous", subcategory = "Items"
diff --git a/src/main/kotlin/skytils/skytilsmod/mixins/hooks/renderer/ItemRendererHook.kt b/src/main/kotlin/skytils/skytilsmod/mixins/hooks/renderer/ItemRendererHook.kt
new file mode 100644
index 00000000..b75dde39
--- /dev/null
+++ b/src/main/kotlin/skytils/skytilsmod/mixins/hooks/renderer/ItemRendererHook.kt
@@ -0,0 +1,30 @@
+/*
+ * Skytils - Hypixel Skyblock Quality of Life Mod
+ * Copyright (C) 2021 Skytils
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package skytils.skytilsmod.mixins.hooks.renderer
+
+import net.minecraft.client.entity.AbstractClientPlayer
+import net.minecraft.item.ItemStack
+import net.minecraft.item.ItemSword
+import skytils.skytilsmod.Skytils
+import skytils.skytilsmod.utils.Utils
+
+fun getItemInUseCountForFirstPerson(player: AbstractClientPlayer, item: ItemStack): Int {
+ if (Skytils.config.disableBlockAnimation && Utils.inSkyblock && item.item is ItemSword && player.itemInUseDuration < 5) return 0
+ return player.itemInUseCount
+} \ No newline at end of file
diff --git a/src/main/resources/mixins.skytils.json b/src/main/resources/mixins.skytils.json
index 41dbab13..48ce3c2d 100644
--- a/src/main/resources/mixins.skytils.json
+++ b/src/main/resources/mixins.skytils.json
@@ -63,6 +63,7 @@
"verbose": true,
"client": [
"neu.MixinCustomAH",
+ "renderer.MixinItemRenderer",
"renderer.MixinRendererLivingEntity"
]
} \ No newline at end of file