aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMy-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com>2021-09-15 01:06:27 -0400
committerMy-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com>2021-09-15 01:06:27 -0400
commit72ba35305fade073729b39c5ad5d520e72fce9dd (patch)
treed1c0ee609cf33ac514631c97e31827d77fa0d2a7
parentb11685fdab665cba33013f0e6027a5252a53889f (diff)
downloadSkytilsMod-72ba35305fade073729b39c5ad5d520e72fce9dd.tar.gz
SkytilsMod-72ba35305fade073729b39c5ad5d520e72fce9dd.tar.bz2
SkytilsMod-72ba35305fade073729b39c5ad5d520e72fce9dd.zip
idk stuff
-rw-r--r--src/main/java/skytils/skytilsmod/mixins/transformers/block/MixinBlockSlab.java44
-rw-r--r--src/main/java/skytils/skytilsmod/mixins/transformers/block/MixinBlockStairs.java44
-rw-r--r--src/main/kotlin/skytils/skytilsmod/core/Config.kt7
-rw-r--r--src/main/resources/mixins.skytils.json2
4 files changed, 97 insertions, 0 deletions
diff --git a/src/main/java/skytils/skytilsmod/mixins/transformers/block/MixinBlockSlab.java b/src/main/java/skytils/skytilsmod/mixins/transformers/block/MixinBlockSlab.java
new file mode 100644
index 00000000..ea74c7a7
--- /dev/null
+++ b/src/main/java/skytils/skytilsmod/mixins/transformers/block/MixinBlockSlab.java
@@ -0,0 +1,44 @@
+/*
+ * 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.block;
+
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockSlab;
+import net.minecraft.block.material.Material;
+import net.minecraft.block.state.IBlockState;
+import net.minecraft.util.BlockPos;
+import net.minecraft.util.EnumFacing;
+import net.minecraft.world.IBlockAccess;
+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.CallbackInfoReturnable;
+import skytils.skytilsmod.core.Config;
+
+@Mixin(BlockSlab.class)
+public abstract class MixinBlockSlab extends Block {
+ public MixinBlockSlab(Material materialIn) {
+ super(materialIn);
+ }
+
+ @Inject(method = "doesSideBlockRendering", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/state/IBlockState;getValue(Lnet/minecraft/block/properties/IProperty;)Ljava/lang/Comparable;", ordinal = 0), cancellable = true)
+ private void checkRendering(IBlockAccess world, BlockPos pos, EnumFacing face, CallbackInfoReturnable<Boolean> cir) {
+ if (Config.INSTANCE.getFixFallingSandRendering() && !(world.getBlockState(pos).getBlock() instanceof BlockSlab)) cir.setReturnValue(true);
+ }
+}
diff --git a/src/main/java/skytils/skytilsmod/mixins/transformers/block/MixinBlockStairs.java b/src/main/java/skytils/skytilsmod/mixins/transformers/block/MixinBlockStairs.java
new file mode 100644
index 00000000..3dbbd658
--- /dev/null
+++ b/src/main/java/skytils/skytilsmod/mixins/transformers/block/MixinBlockStairs.java
@@ -0,0 +1,44 @@
+/*
+ * 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.block;
+
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockStairs;
+import net.minecraft.block.material.Material;
+import net.minecraft.block.state.IBlockState;
+import net.minecraft.util.BlockPos;
+import net.minecraft.util.EnumFacing;
+import net.minecraft.world.IBlockAccess;
+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.CallbackInfoReturnable;
+import skytils.skytilsmod.core.Config;
+
+@Mixin(BlockStairs.class)
+abstract public class MixinBlockStairs extends Block {
+ public MixinBlockStairs(Material materialIn) {
+ super(materialIn);
+ }
+
+ @Inject(method = "doesSideBlockRendering", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/state/IBlockState;getValue(Lnet/minecraft/block/properties/IProperty;)Ljava/lang/Comparable;", ordinal = 0), cancellable = true)
+ private void checkRendering(IBlockAccess world, BlockPos pos, EnumFacing face, CallbackInfoReturnable<Boolean> cir, IBlockState iblockstate) {
+ if (Config.INSTANCE.getFixFallingSandRendering() && !(iblockstate.getBlock() instanceof BlockStairs)) cir.setReturnValue(true);
+ }
+}
diff --git a/src/main/kotlin/skytils/skytilsmod/core/Config.kt b/src/main/kotlin/skytils/skytilsmod/core/Config.kt
index 08ee980e..c7e9d8f6 100644
--- a/src/main/kotlin/skytils/skytilsmod/core/Config.kt
+++ b/src/main/kotlin/skytils/skytilsmod/core/Config.kt
@@ -932,6 +932,13 @@ object Config : Vigilant(File("./config/skytils/config.toml"), "Skytils", sortin
var autoSwitchChatChannel = false
@Property(
+ type = PropertyType.SWITCH, name = "Fix Falling Sand Rendering",
+ description = "Adds a check to rendering in order to prevent crashes.",
+ category = "Miscellaneous", subcategory = "Fixes"
+ )
+ var fixFallingSandRendering = false
+
+ @Property(
type = PropertyType.SWITCH, name = "Fix SBA Chroma",
description = "Fixes SBA chroma with Patcher 1.6",
category = "Miscellaneous", subcategory = "Fixes"
diff --git a/src/main/resources/mixins.skytils.json b/src/main/resources/mixins.skytils.json
index 5c4461cf..23835052 100644
--- a/src/main/resources/mixins.skytils.json
+++ b/src/main/resources/mixins.skytils.json
@@ -17,6 +17,8 @@
"accessors.AccessorSettingsGui",
"accessors.AccessorWorldInfo",
"audio.MixinSoundManager",
+ "block.MixinBlockSlab",
+ "block.MixinBlockStairs",
"crash.MixinCrashReport",
"entity.MixinAbstractClientPlayer",
"entity.MixinBossStatus",