Skip to content

Commit 501ee42

Browse files
committed
feat: update mod version to 3.0.0 and change release type to STABLE; enhance sword block feature and fix NPC scaling
1 parent c4bb20c commit 501ee42

File tree

8 files changed

+35
-27
lines changed

8 files changed

+35
-27
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
New Features:
22

3-
feat: add client side sword block when holding right click with a sword
3+
feat: Add client-side sword block when holding right-click with a sword
4+
fix: Hypixel NPC scaling when chasing the other player scale slider.

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ publishMods {
110110
displayName = "${property("mod.name")} ${property("mod.version")} for ${stonecutter.current.version}"
111111
version = property("mod.version") as String
112112
changelog = rootProject.file("CHANGELOG.md").readText()
113-
type = BETA
113+
type = STABLE
114114
modLoaders.add("fabric")
115115

116116
dryRun = providers.environmentVariable("MODRINTH_TOKEN").getOrNull() == null

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ org.gradle.parallel=true
44
org.gradle.configuration-cache=false
55

66
# Mod properties
7-
mod.version=3.0.0-beta.1
7+
mod.version=3.0.0
88
mod.group=com.github.kd_gaming1
99
mod.id=scaleme
1010
mod.name=Scale Me

src/main/java/com/github/kd_gaming1/scaleme/ScaleMe.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
*///?} else {
1818
import net.minecraft.Util;
1919
//?}
20+
import com.mojang.blaze3d.platform.InputConstants;
2021
import net.minecraft.client.KeyMapping;
2122
import net.minecraft.tags.ItemTags;
2223
import org.lwjgl.glfw.GLFW;
@@ -44,6 +45,7 @@ public void onInitializeClient() {
4445

4546
KeyMapping blockKey = KeyBindingHelper.registerKeyBinding(new KeyMapping(
4647
"key.scaleme.sword_block",
48+
InputConstants.Type.MOUSE,
4749
GLFW.GLFW_MOUSE_BUTTON_RIGHT,
4850
KeyMapping.Category.GAMEPLAY
4951
));

src/main/java/com/github/kd_gaming1/scaleme/config/ScaleMeConfig.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public class ScaleMeConfig extends MidnightConfig {
102102
public static float armHeightScaleOffhand = -0.6f;
103103

104104
@Comment(category = HAND, centered = true)
105-
public static Comment spacer6;
105+
public static Comment spacer5;
106106

107107
@Entry(category = HAND, isSlider = true, min = 0.1f, max = 3f, precision = 1000)
108108
public static float itemScaleOffhand = 1f;
@@ -117,7 +117,7 @@ public class ScaleMeConfig extends MidnightConfig {
117117
public static float itemTranslationZOffhand = 0f;
118118

119119
@Comment(category = HAND, centered = true)
120-
public static Comment spacer7;
120+
public static Comment spacer6;
121121

122122
@Entry(category = HAND, isSlider = true, min = -180f, max = 180f, precision = 10)
123123
public static float itemRotationXOffhand = 0f;
@@ -134,10 +134,13 @@ public class ScaleMeConfig extends MidnightConfig {
134134
public static Comment animDesc;
135135

136136
@Entry(category = ANIM)
137-
public static boolean enableAnimOverrides = false;
137+
public static boolean enableSwordBlock = false;
138+
139+
@Comment(category = HAND, centered = true)
140+
public static Comment spacer7;
138141

139142
@Entry(category = ANIM)
140-
public static boolean enableSwordBlock = false;
143+
public static boolean enableAnimOverrides = false;
141144

142145
@Entry(category = ANIM)
143146
public static boolean disableSwingBobbing = false;

src/main/java/com/github/kd_gaming1/scaleme/mixin/ItemInHandRendererMixin.java

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -174,32 +174,28 @@ public class ItemInHandRendererMixin {
174174
/** Applies a blocking pose when holding a sword and right-clicking. */
175175
@Inject(method = "renderArmWithItem", at = @At("HEAD"), cancellable = true)
176176
private void scaleme$applySwordBlockPose(
177-
AbstractClientPlayer player,
178-
float tickDelta, float pitch,
179-
InteractionHand hand,
180-
float swingProgress,
181-
ItemStack heldItem,
182-
float equipProgress,
183-
PoseStack poseStack,
184-
SubmitNodeCollector collector,
185-
int packedLight,
177+
AbstractClientPlayer player, float tickDelta, float pitch,
178+
InteractionHand hand, float swingProgress, ItemStack heldItem,
179+
float equipProgress, PoseStack poseStack,
180+
SubmitNodeCollector collector, int packedLight,
186181
CallbackInfo ci) {
187182

188-
if (!BlockingState.isBlocking || hand != InteractionHand.MAIN_HAND || !heldItem.is(ItemTags.SWORDS)) return;
183+
if (!BlockingState.isBlocking
184+
|| hand != InteractionHand.MAIN_HAND
185+
|| !heldItem.is(ItemTags.SWORDS)) return;
186+
189187
ci.cancel();
190188

191189
poseStack.pushPose();
192-
193190
HumanoidArm arm = player.getMainArm();
194-
int armSideSign = (arm == HumanoidArm.RIGHT) ? 1 : -1;
191+
int side = arm == HumanoidArm.RIGHT ? 1 : -1;
195192

196193
applyItemArmTransform(poseStack, arm, equipProgress);
197-
poseStack.translate((float) armSideSign * -0.14142136F, 0.08F, 0.14142136F);
194+
poseStack.translate(side * -0.14142136F, 0.08F, 0.14142136F);
198195
poseStack.mulPose(Axis.XP.rotationDegrees(-102.25F));
199-
poseStack.mulPose(Axis.YP.rotationDegrees((float) armSideSign * 13.365F));
200-
poseStack.mulPose(Axis.ZP.rotationDegrees((float) armSideSign * 78.05F));
196+
poseStack.mulPose(Axis.YP.rotationDegrees(side * 13.365F));
197+
poseStack.mulPose(Axis.ZP.rotationDegrees(side * 78.05F));
201198

202-
// Self-cast required: Mixin class can't directly extend ItemInHandRenderer
203199
((ItemInHandRenderer) (Object) this).renderItem(
204200
player,
205201
heldItem,
@@ -210,7 +206,13 @@ public class ItemInHandRendererMixin {
210206
collector,
211207
packedLight
212208
);
213-
214209
poseStack.popPose();
210+
211+
// --- release HandContext --- //
212+
HandContext.renderDepth--;
213+
if (HandContext.renderDepth <= 0) {
214+
HandContext.renderDepth = 0;
215+
HandContext.currentHand = null;
216+
}
215217
}
216218
}

src/main/java/com/github/kd_gaming1/scaleme/util/ScaleResolver.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ public static float resolveScale(Minecraft mc, int entityId) {
1616
boolean scalingAllowed = !onHypixel || HypixelLocationState.isOnSkyblock();
1717

1818
if (entityId == mc.player.getId()) {
19-
return scalingAllowed ? ScaleMeConfig.playerScale : 1f;
19+
return ScaleMeConfig.playerScale;
2020
}
2121

22-
if (onHypixel && ScaleMeConfig.hypixelNpcScale != 1f) {
22+
if (onHypixel) {
2323
var entity = mc.level.getEntity(entityId);
2424
if (entity instanceof AbstractClientPlayer player && HypixelNpcUtil.isHypixelNpc(player)) {
2525
return HypixelLocationState.isInDungeon() ? 1f : ScaleMeConfig.hypixelNpcScale;

src/main/resources/assets/scaleme/lang/en_us.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696

9797
"scaleme.midnightconfig.animDesc": "Master switch for all animation customisation. Swing speed, shape, and bobbing are all controlled by this toggle.",
9898

99-
"scaleme.midnightconfig.enableSwordBlock": "Enable Sword Block [does not requires Animation Master]",
99+
"scaleme.midnightconfig.enableSwordBlock": "Enable Sword Block",
100100
"scaleme.midnightconfig.enableSwordBlock.tooltip": "Lets you hold right-click with a sword to enter a blocking pose, similar to pre-1.9.\nThe keybind defaults to right mouse button — rebind it in Controls if needed.",
101101

102102
"scaleme.midnightconfig.enableAnimOverrides": "Enable Animation Changes [MASTER]",

0 commit comments

Comments
 (0)