mirror of
https://github.com/TeamMidnightDust/SwordBlocking.git
synced 2025-12-13 05:45:09 +01:00
1.21.10
This commit is contained in:
@@ -25,6 +25,7 @@ stonecutter {
|
||||
}
|
||||
|
||||
mc("1.21.8", listOf("fabric", "neoforge"))
|
||||
mc("1.21.10", listOf("fabric", "neoforge"))
|
||||
|
||||
vcsVersion = "1.21.8-fabric"
|
||||
}
|
||||
|
||||
@@ -7,20 +7,20 @@ import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.ShieldItem;
|
||||
|
||||
//? fabric {
|
||||
/*import dev.kikugie.fletching_table.annotation.fabric.Entrypoint;
|
||||
import dev.kikugie.fletching_table.annotation.fabric.Entrypoint;
|
||||
import net.fabricmc.api.ClientModInitializer;
|
||||
*///?} else {
|
||||
import net.neoforged.api.distmarker.Dist;
|
||||
//?} else {
|
||||
/*import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.fml.common.Mod;
|
||||
//?}
|
||||
*///?}
|
||||
|
||||
//? fabric
|
||||
/*@Entrypoint*/
|
||||
@Entrypoint
|
||||
//? neoforge
|
||||
@Mod(value = SwordBlockingClient.MOD_ID, dist = Dist.CLIENT)
|
||||
/*@Mod(value = SwordBlockingClient.MOD_ID, dist = Dist.CLIENT)*/
|
||||
public final class SwordBlockingClient
|
||||
//? fabric
|
||||
/*implements ClientModInitializer*/
|
||||
implements ClientModInitializer
|
||||
{
|
||||
public static final String MOD_ID = "@MODID@";
|
||||
|
||||
@@ -54,13 +54,13 @@ public final class SwordBlockingClient
|
||||
}
|
||||
|
||||
//? neoforge {
|
||||
public SwordBlockingClient() {
|
||||
/*public SwordBlockingClient() {
|
||||
initialize();
|
||||
}
|
||||
//?} else {
|
||||
/*@Override
|
||||
*///?} else {
|
||||
@Override
|
||||
public void onInitializeClient() {
|
||||
initialize();
|
||||
}
|
||||
*///?}
|
||||
//?}
|
||||
}
|
||||
@@ -9,7 +9,6 @@ import eu.midnightdust.swordblocking.config.SwordBlockingConfig;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.player.AbstractClientPlayer;
|
||||
import net.minecraft.client.renderer.ItemInHandRenderer;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.entity.HumanoidArm;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
@@ -25,6 +24,12 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
//? >=1.21.10 {
|
||||
import net.minecraft.client.renderer.SubmitNodeCollector;
|
||||
//? } else {
|
||||
/*import net.minecraft.client.renderer.MultiBufferSource;
|
||||
*///? }
|
||||
|
||||
@Mixin(ItemInHandRenderer.class)
|
||||
public abstract class MixinItemInHandRenderer {
|
||||
@Shadow
|
||||
@@ -35,7 +40,19 @@ public abstract class MixinItemInHandRenderer {
|
||||
protected abstract void applyItemArmAttackTransform(PoseStack poseStack, HumanoidArm hand, float swingProgress);
|
||||
|
||||
@WrapMethod(method = "renderItem")
|
||||
public void swordBlocking$hideShield(LivingEntity entity, ItemStack stack, ItemDisplayContext displayContext, PoseStack poseStack, MultiBufferSource bufferSource, int packedLight, Operation<Void> original) {
|
||||
public void swordBlocking$hideShield(
|
||||
LivingEntity entity,
|
||||
ItemStack stack,
|
||||
ItemDisplayContext displayContext,
|
||||
PoseStack poseStack,
|
||||
//? >=1.21.10 {
|
||||
SubmitNodeCollector bufferSource,
|
||||
//? } else {
|
||||
/*MultiBufferSource bufferSource,
|
||||
*///? }
|
||||
int packedLight,
|
||||
Operation<Void> original
|
||||
) {
|
||||
if (!SwordBlockingClient.shouldHideShield(entity.getMainHandItem(), entity.getOffhandItem(), stack)) {
|
||||
original.call(entity, stack, displayContext, poseStack, bufferSource, packedLight);
|
||||
}
|
||||
@@ -62,7 +79,24 @@ public abstract class MixinItemInHandRenderer {
|
||||
}
|
||||
|
||||
@Inject(method = "renderArmWithItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/ItemInHandRenderer;applyItemArmTransform(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/world/entity/HumanoidArm;F)V", ordinal = 3, shift = At.Shift.AFTER))
|
||||
private void swordBlocking$applySwingOffset(AbstractClientPlayer player, float partialTicks, float pitch, InteractionHand hand, float swingProgress, ItemStack stack, float equippedProgress, PoseStack poseStack, MultiBufferSource buffer, int combinedLight, CallbackInfo ci, @Local HumanoidArm arm) {
|
||||
private void swordBlocking$applySwingOffset(
|
||||
AbstractClientPlayer player,
|
||||
float partialTicks,
|
||||
float pitch,
|
||||
InteractionHand hand,
|
||||
float swingProgress,
|
||||
ItemStack stack,
|
||||
float equippedProgress,
|
||||
PoseStack poseStack,
|
||||
//? >=1.21.10 {
|
||||
SubmitNodeCollector bufferSource,
|
||||
//? } else {
|
||||
/*MultiBufferSource bufferSource,
|
||||
*///? }
|
||||
int combinedLight,
|
||||
CallbackInfo ci,
|
||||
@Local HumanoidArm arm
|
||||
) {
|
||||
if (SwordBlockingConfig.enabled && SwordBlockingConfig.blockHitAnimation) {
|
||||
this.applyItemArmAttackTransform(poseStack, arm, swingProgress);
|
||||
}
|
||||
|
||||
@@ -3,9 +3,7 @@ package eu.midnightdust.swordblocking.mixins;
|
||||
import eu.midnightdust.swordblocking.SwordBlockingClient;
|
||||
import eu.midnightdust.swordblocking.config.SwordBlockingConfig;
|
||||
import net.minecraft.client.model.HumanoidModel;
|
||||
import net.minecraft.client.renderer.entity.player.PlayerRenderer;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.ShieldItem;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
@@ -13,17 +11,48 @@ import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
//? fabric {
|
||||
/*import net.fabricmc.api.Environment;
|
||||
import net.fabricmc.api.EnvType;
|
||||
//? >=1.21.10 {
|
||||
import net.minecraft.client.renderer.entity.player.AvatarRenderer;
|
||||
import net.minecraft.world.entity.Avatar;
|
||||
//? } else {
|
||||
/*import net.minecraft.client.renderer.entity.player.PlayerRenderer;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
*///? }
|
||||
|
||||
@Mixin(PlayerRenderer.class)
|
||||
//? fabric {
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.fabricmc.api.EnvType;
|
||||
//?}
|
||||
|
||||
@Mixin(
|
||||
//? >=1.21.10 {
|
||||
AvatarRenderer.class
|
||||
//? } else {
|
||||
/*PlayerRenderer.class
|
||||
*///? }
|
||||
)
|
||||
public abstract class MixinPlayerRenderer {
|
||||
//? fabric
|
||||
/*@Environment(EnvType.CLIENT)*/
|
||||
@Inject(method = "getArmPose(Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/InteractionHand;)Lnet/minecraft/client/model/HumanoidModel$ArmPose;", at = @At(value = "RETURN"), cancellable = true)
|
||||
private static void swordBlocking$getArmPose(Player player, ItemStack stack, InteractionHand hand, CallbackInfoReturnable<HumanoidModel.ArmPose> cir) {
|
||||
@Environment(EnvType.CLIENT)
|
||||
@Inject(
|
||||
//? >=1.21.10 {
|
||||
method = "getArmPose(Lnet/minecraft/world/entity/Avatar;Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/InteractionHand;)Lnet/minecraft/client/model/HumanoidModel$ArmPose;",
|
||||
//? } else {
|
||||
/*method = "getArmPose(Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/InteractionHand;)Lnet/minecraft/client/model/HumanoidModel$ArmPose;",
|
||||
*///? }
|
||||
at = @At(value = "RETURN"),
|
||||
cancellable = true
|
||||
)
|
||||
private static void swordBlocking$getArmPose(
|
||||
//? >=1.21.10 {
|
||||
Avatar player,
|
||||
//? } else {
|
||||
/*Player player,
|
||||
*///? }
|
||||
ItemStack stack,
|
||||
InteractionHand hand,
|
||||
CallbackInfoReturnable<HumanoidModel.ArmPose> cir
|
||||
) {
|
||||
if (SwordBlockingConfig.enabled) {
|
||||
final ItemStack handStack = player.getItemInHand(hand);
|
||||
final ItemStack offStack = player.getItemInHand(hand.equals(InteractionHand.MAIN_HAND) ? InteractionHand.OFF_HAND : InteractionHand.MAIN_HAND);
|
||||
|
||||
@@ -5,7 +5,7 @@ plugins {
|
||||
alias(libs.plugins.publishing)
|
||||
}
|
||||
|
||||
stonecutter active "1.21.8-neoforge" /* [SC] DO NOT EDIT */
|
||||
stonecutter active "1.21.10-fabric" /* [SC] DO NOT EDIT */
|
||||
|
||||
stonecutter tasks {
|
||||
val ordering = Comparator
|
||||
|
||||
8
versions/1.21.10-fabric/gradle.properties
Normal file
8
versions/1.21.10-fabric/gradle.properties
Normal file
@@ -0,0 +1,8 @@
|
||||
loom.platform=fabric
|
||||
|
||||
deps.parchment_version=2025.10.12
|
||||
deps.fabric_api_version=0.138.3+1.21.10
|
||||
deps.modmenu_version=16.0.0-rc.1
|
||||
|
||||
mod.minecraft_version=1.21.10
|
||||
mod.minecraft_version_range=>=1.21.9 <=1.21.10
|
||||
7
versions/1.21.10-neoforge/gradle.properties
Normal file
7
versions/1.21.10-neoforge/gradle.properties
Normal file
@@ -0,0 +1,7 @@
|
||||
loom.platform=neoforge
|
||||
|
||||
deps.parchment_version=2025.10.12
|
||||
deps.neoforge_version=21.10.55-beta
|
||||
|
||||
mod.minecraft_version=1.21.10
|
||||
mod.minecraft_version_range=[1.21.9, 1.21.10]
|
||||
Reference in New Issue
Block a user