Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,12 @@ private boolean spawnParticle(World instance, Entity entity, byte b) {
//#endif
}

@Inject(method = "isBaby", at = @At("HEAD"), cancellable = true)
private void setChildState(CallbackInfoReturnable<Boolean> cir) {
hook.isChild(cir);
}
//#if MC==10809
//$$ @Inject(method = "isBaby", at = @At("HEAD"), cancellable = true)
//$$ private void setChildState(CallbackInfoReturnable<Boolean> cir) {
//$$ hook.isChild(cir);
//$$ }
//#endif

@NotNull
@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Skytils - Hypixel Skyblock Quality of Life Mod
* Copyright (C) 2020-2025 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/>.
*/
//#if MC>12000
package gg.skytils.skytilsmod.mixins.transformers.renderer;

import gg.skytils.skytilsmod.mixins.extensions.ExtensionPlayerEntityRenderer;
import gg.skytils.skytilsmod.mixins.hooks.renderer.PlayerEntityRendererHook;
import net.minecraft.client.render.entity.PlayerEntityRenderer;
import net.minecraft.client.render.entity.state.PlayerEntityRenderState;
import net.minecraft.client.util.math.MatrixStack;
import org.jetbrains.annotations.NotNull;
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(PlayerEntityRenderer.class)
public class MixinPlayerEntityRenderer implements ExtensionPlayerEntityRenderer {
private static final PlayerEntityRendererHook hook = new PlayerEntityRendererHook();

@Inject(method = "scale(Lnet/minecraft/client/render/entity/state/PlayerEntityRenderState;Lnet/minecraft/client/util/math/MatrixStack;)V", at = @At("HEAD"))
private static void doScale(PlayerEntityRenderState playerEntityRenderState, MatrixStack matrixStack, CallbackInfo ci){
hook.smol(playerEntityRenderState, matrixStack);
}

@NotNull
@Override
public PlayerEntityRendererHook getSkytilsHook() {
return hook;
}
}
//#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Skytils - Hypixel Skyblock Quality of Life Mod
* Copyright (C) 2020-2025 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 gg.skytils.skytilsmod.mixins.extensions

import gg.skytils.skytilsmod.mixins.hooks.renderer.PlayerEntityRendererHook
interface ExtensionPlayerEntityRenderer {
val skytilsHook: PlayerEntityRendererHook
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,17 @@ class EntityLivingBaseHook(val entity: LivingEntity) {
var colorMultiplier: Color? = null
var masterDragonType: WitherKingDragons? = null

val isBreefing by lazy {
entity.name.string == "Breefing" && (SuperSecretSettings.breefingDog || Random.nextInt(
100
) < 3)
}

val isSmol by lazy {
Utils.inSkyblock && entity is PlayerEntity && (SuperSecretSettings.smolPeople || isBreefing)
}
//#if MC==10809
//$$ val isBreefing by lazy {
//$$ entity.name.string == "Breefing" && (SuperSecretSettings.breefingDog || Random.nextInt(
//$$ 100
//$$ ) < 3)
//$$ }
//$$
//$$ val isSmol by lazy {
//$$ Utils.inSkyblock && entity is PlayerEntity && (SuperSecretSettings.smolPeople || isBreefing)
//$$ }
//#endif

//#if MC>12000
fun modifyPotionActive(statusEffect: StatusEffect, cir: CallbackInfoReturnable<Boolean>) {
Expand Down Expand Up @@ -79,7 +81,9 @@ class EntityLivingBaseHook(val entity: LivingEntity) {
//$$ }
//#endif

fun isChild(cir: CallbackInfoReturnable<Boolean>) {
cir.returnValue = isSmol
}
//#if MC==10809
//$$fun isChild(cir: CallbackInfoReturnable<Boolean>) {
//$$ cir.returnValue = isSmol
//$$}
//#endif
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Skytils - Hypixel Skyblock Quality of Life Mod
* Copyright (C) 2020-2025 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 gg.skytils.skytilsmod.mixins.hooks.renderer
//#if MC>12000
import gg.skytils.skytilsmod.utils.SuperSecretSettings
import gg.skytils.skytilsmod.utils.Utils
import net.minecraft.client.render.entity.state.PlayerEntityRenderState
import net.minecraft.client.util.math.MatrixStack
import kotlin.random.Random

class PlayerEntityRendererHook {
fun isBreefing(state: PlayerEntityRenderState): Boolean
= state.name == "Breefing" && (SuperSecretSettings.breefingDog || Random.nextInt(
100
) < 3)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Consider making isBreefing private since it's only used within this class to improve encapsulation. Also, using Random.nextInt() in a function called on every render frame will cause the "Breefing" player's size to flicker. If this is not the intended visual effect, consider caching the random result per player entity. Finally, the values 100 and 3 are magic numbers. Define them as named constants for clarity.

Suggested change
fun isBreefing(state: PlayerEntityRenderState): Boolean
= state.name == "Breefing" && (SuperSecretSettings.breefingDog || Random.nextInt(
100
) < 3)
private fun isBreefing(state: PlayerEntityRenderState): Boolean
= state.name == "Breefing" && (SuperSecretSettings.breefingDog || Random.nextInt(
100
) < 3)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: flickering for breefing


fun smol(state: PlayerEntityRenderState, ms: MatrixStack) {
if (Utils.inSkyblock && (SuperSecretSettings.smolPeople || isBreefing(state))){
ms.scale(0.5f, 0.5f, 0.5f)
}
}
}
//#endif
1 change: 1 addition & 0 deletions mod/src/main/resources/mixins.skytils.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"renderer.MixinTileEntityChestRenderer",
"renderer.MixinTileEntitySkullRenderer",
"renderer.MixinWorldRenderer_Glow",
"renderer.MixinPlayerEntityRenderer",
"util.MixinChatStyle",
"util.MixinUtil",
"world.MixinClientWorld",
Expand Down