Skip to content

Commit baaed51

Browse files
committed
Merge branch 'legacypvp'
2 parents d7f706a + 44cf3e2 commit baaed51

File tree

12 files changed

+67
-68
lines changed

12 files changed

+67
-68
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package simpleclient.mixin.feature.legacypvp;
2+
3+
import net.minecraft.world.entity.Entity;
4+
import org.spongepowered.asm.mixin.Mixin;
5+
import org.spongepowered.asm.mixin.injection.At;
6+
import org.spongepowered.asm.mixin.injection.Inject;
7+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
8+
import simpleclient.feature.LegacyPvP;
9+
10+
@Mixin(Entity.class)
11+
public class EntityMixin {
12+
@Inject(at = @At("HEAD"), method = "getPickRadius", cancellable = true)
13+
public void getPickRadius(CallbackInfoReturnable<Float> cir) {
14+
if (LegacyPvP.ENABLED) cir.setReturnValue(0.1F);
15+
}
16+
}

simpleclient-1.19.4/src/main/java/simpleclient/mixin/feature/legacypvp/ItemInHandRendererMixin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public void itemUsed(InteractionHand interactionHand, CallbackInfo ci) {
4242

4343
@Inject(at = @At(value = "HEAD"), method = "renderArmWithItem", cancellable = true)
4444
public void renderArmWithItem(AbstractClientPlayer player, float partialTicks, float pitch, InteractionHand hand, float swingProgress, ItemStack itemStack, float equipProgress, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight, CallbackInfo ci) {
45-
if (LegacyPvP.ENABLED && LegacyPvP.BLOCKING && player.getUsedItemHand() == hand) {
45+
if (LegacyPvP.ENABLED && LegacyPvP.isBlocking(player) && player.getUsedItemHand() == hand) {
4646
poseStack.pushPose();
4747
boolean mainHand = hand == InteractionHand.MAIN_HAND;
4848
HumanoidArm arm = mainHand ? player.getMainArm() : player.getMainArm().getOpposite();

simpleclient-1.19.4/src/main/java/simpleclient/mixin/feature/legacypvp/LivingEntityMixin.java

Lines changed: 0 additions & 21 deletions
This file was deleted.

simpleclient-1.19.4/src/main/resources/simpleclient.mixins.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@
1010
"MinecraftMixin",
1111
"TitleScreenMixin",
1212
"feature.fullbright.OptionsMixin",
13+
"feature.legacypvp.EntityMixin",
14+
"feature.legacypvp.GuiMixin",
15+
"feature.legacypvp.HumanoidModelMixin",
16+
"feature.legacypvp.ItemInHandRendererMixin",
17+
"feature.legacypvp.PlayerItemInHandLayerMixin",
18+
"feature.legacypvp.PlayerMixin",
19+
"feature.legacypvp.SwordItemMixin",
1320
"feature.lowfire.ScreenEffectRendererMixin",
1421
"feature.perspective.CameraMixin",
1522
"feature.perspective.MouseMixin",
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package simpleclient.mixin.feature.legacypvp;
2+
3+
import net.minecraft.world.entity.Entity;
4+
import org.spongepowered.asm.mixin.Mixin;
5+
import org.spongepowered.asm.mixin.injection.At;
6+
import org.spongepowered.asm.mixin.injection.Inject;
7+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
8+
import simpleclient.feature.LegacyPvP;
9+
10+
@Mixin(Entity.class)
11+
public class EntityMixin {
12+
@Inject(at = @At("HEAD"), method = "getPickRadius", cancellable = true)
13+
public void getPickRadius(CallbackInfoReturnable<Float> cir) {
14+
if (LegacyPvP.ENABLED) cir.setReturnValue(0.1F);
15+
}
16+
}

simpleclient-1.20.1/src/main/java/simpleclient/mixin/feature/legacypvp/ItemInHandRendererMixin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public void itemUsed(InteractionHand interactionHand, CallbackInfo ci) {
4646

4747
@Inject(at = @At(value = "HEAD"), method = "renderArmWithItem", cancellable = true)
4848
public void renderArmWithItem(AbstractClientPlayer player, float partialTicks, float pitch, InteractionHand hand, float swingProgress, ItemStack itemStack, float equipProgress, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight, CallbackInfo ci) {
49-
if (LegacyPvP.ENABLED && LegacyPvP.BLOCKING && player.getUsedItemHand() == hand) {
49+
if (LegacyPvP.ENABLED && LegacyPvP.isBlocking(player) && player.getUsedItemHand() == hand) {
5050
poseStack.pushPose();
5151
boolean mainHand = hand == InteractionHand.MAIN_HAND;
5252
HumanoidArm arm = mainHand ? player.getMainArm() : player.getMainArm().getOpposite();

simpleclient-1.20.1/src/main/java/simpleclient/mixin/feature/legacypvp/LivingEntityMixin.java

Lines changed: 0 additions & 22 deletions
This file was deleted.

simpleclient-1.20.1/src/main/resources/simpleclient.mixins.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@
1212
"MinecraftMixin",
1313
"TitleScreenMixin",
1414
"feature.fullbright.OptionsMixin",
15+
"feature.legacypvp.EntityMixin",
1516
"feature.legacypvp.GuiMixin",
1617
"feature.legacypvp.HumanoidModelMixin",
1718
"feature.legacypvp.ItemInHandRendererMixin",
18-
"feature.legacypvp.LivingEntityMixin",
1919
"feature.legacypvp.PlayerItemInHandLayerMixin",
20+
"feature.legacypvp.PlayerMixin",
2021
"feature.legacypvp.SwordItemMixin",
2122
"feature.lowfire.ScreenEffectRendererMixin",
2223
"feature.perspective.CameraMixin",
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package simpleclient.mixin.feature.legacypvp;
2+
3+
import net.minecraft.world.entity.Entity;
4+
import org.spongepowered.asm.mixin.Mixin;
5+
import org.spongepowered.asm.mixin.injection.At;
6+
import org.spongepowered.asm.mixin.injection.Inject;
7+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
8+
import simpleclient.feature.LegacyPvP;
9+
10+
@Mixin(Entity.class)
11+
public class EntityMixin {
12+
@Inject(at = @At("HEAD"), method = "getPickRadius", cancellable = true)
13+
public void getPickRadius(CallbackInfoReturnable<Float> cir) {
14+
if (LegacyPvP.ENABLED) cir.setReturnValue(0.1F);
15+
}
16+
}

simpleclient-1.20/src/main/java/simpleclient/mixin/feature/legacypvp/ItemInHandRendererMixin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public void itemUsed(InteractionHand interactionHand, CallbackInfo ci) {
4242

4343
@Inject(at = @At(value = "HEAD"), method = "renderArmWithItem", cancellable = true)
4444
public void renderArmWithItem(AbstractClientPlayer player, float partialTicks, float pitch, InteractionHand hand, float swingProgress, ItemStack itemStack, float equipProgress, PoseStack poseStack, MultiBufferSource multiBufferSource, int packedLight, CallbackInfo ci) {
45-
if (LegacyPvP.ENABLED && LegacyPvP.BLOCKING && player.getUsedItemHand() == hand) {
45+
if (LegacyPvP.ENABLED && LegacyPvP.isBlocking(player) && player.getUsedItemHand() == hand) {
4646
poseStack.pushPose();
4747
boolean mainHand = hand == InteractionHand.MAIN_HAND;
4848
HumanoidArm arm = mainHand ? player.getMainArm() : player.getMainArm().getOpposite();

0 commit comments

Comments
 (0)