From 6ced980fa51ef04faec3dd6b6f34b6bbb547c14e Mon Sep 17 00:00:00 2001 From: Vos Date: Thu, 12 Mar 2026 18:49:18 -0500 Subject: [PATCH] Command Core Functionality 2 --- .../acesbs/item/custom/CommandCore.java | 9 ++++++++ .../acesbs/mixin/LivingEntityMixin.java | 23 +++++++++++++++++++ .../screen/custom/CommandCoreScreen.java | 8 +++---- 3 files changed, 36 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/acethewildfire/acesbs/item/custom/CommandCore.java b/src/main/java/com/acethewildfire/acesbs/item/custom/CommandCore.java index 7a3a968..75db31d 100644 --- a/src/main/java/com/acethewildfire/acesbs/item/custom/CommandCore.java +++ b/src/main/java/com/acethewildfire/acesbs/item/custom/CommandCore.java @@ -1,6 +1,7 @@ package com.acethewildfire.acesbs.item.custom; import com.acethewildfire.acesbs.component.ModDataComponentTypes; +import com.acethewildfire.acesbs.effect.ModEffects; import com.acethewildfire.acesbs.screen.custom.CommandCoreScreen; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.Screen; @@ -78,6 +79,14 @@ public class CommandCore extends Item { switch (command) { case "TEST" -> { entity.setOnFireFor(1); } case "Sight" -> { if (!world.isClient()) livingEntity.removeStatusEffect(StatusEffects.BLINDNESS); } + case "Immunity" -> { + if (!world.isClient()) { + livingEntity.removeStatusEffect(StatusEffects.POISON); + livingEntity.removeStatusEffect(StatusEffects.WITHER); + livingEntity.removeStatusEffect(ModEffects.LEMON); + } + } + case "Immovable" -> { if (!world.isClient()) livingEntity.removeStatusEffect(StatusEffects.LEVITATION); } case null, default -> {} } } diff --git a/src/main/java/com/acethewildfire/acesbs/mixin/LivingEntityMixin.java b/src/main/java/com/acethewildfire/acesbs/mixin/LivingEntityMixin.java index 05d2ba5..f127493 100644 --- a/src/main/java/com/acethewildfire/acesbs/mixin/LivingEntityMixin.java +++ b/src/main/java/com/acethewildfire/acesbs/mixin/LivingEntityMixin.java @@ -1,14 +1,22 @@ package com.acethewildfire.acesbs.mixin; +import com.acethewildfire.acesbs.component.ModDataComponentTypes; +import com.acethewildfire.acesbs.item.ModItems; import com.acethewildfire.acesbs.item.custom.SovsPlateCarrierArmorItem; import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.damage.DamageSource; +import net.minecraft.entity.effect.StatusEffectInstance; +import net.minecraft.entity.effect.StatusEffects; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; 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.ModifyVariable; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +import java.util.Objects; @Mixin(LivingEntity.class) public abstract class LivingEntityMixin { @@ -37,4 +45,19 @@ public abstract class LivingEntityMixin { return amount; } + + @Inject(method = "takeKnockback", at = @At("HEAD"), cancellable = true) + private void cancelKnockback(double strength, double x, double z, CallbackInfo ci) { + if ((Object)this instanceof PlayerEntity player) { + for (ItemStack stack : player.getInventory().main) { + if (stack.isOf(ModItems.COMMAND_CORE)) { + if (Boolean.TRUE.equals(stack.get(ModDataComponentTypes.COMMAND_ACTIVE))){ + if (Objects.equals(stack.get(ModDataComponentTypes.COMMAND), "Immovable")){ + ci.cancel(); + } + }; + } + } + } + } } diff --git a/src/main/java/com/acethewildfire/acesbs/screen/custom/CommandCoreScreen.java b/src/main/java/com/acethewildfire/acesbs/screen/custom/CommandCoreScreen.java index 4c4ebbb..a4676cf 100644 --- a/src/main/java/com/acethewildfire/acesbs/screen/custom/CommandCoreScreen.java +++ b/src/main/java/com/acethewildfire/acesbs/screen/custom/CommandCoreScreen.java @@ -25,10 +25,10 @@ public class CommandCoreScreen extends Screen { super(Text.literal("Select Option")); this.stack = stack; this.options = new TreeMap<>(); - options.put("Sight", "See when others can not"); - options.put("Omnipotence", "Let nothing escape your sight"); - options.put("Intimidate", "Warn any would be foes that you mean business"); - options.put("Immunity", "Most physical ailments have no effect on you"); + options.put("Sight", "Blindness has no effect on you"); + options.put("Omnipotence", "Hit entities will glow for 30 seconds"); +// options.put("Intimidate", "Warn any would be foes that you mean business"); + options.put("Immunity", "Poison and Wither have no effect on you"); options.put("Immovable", "You cannot be moved against your will"); options.put("Unstoppable", "You cannot be stopped by obstacles"); options.put("Grounded", "You always have sure footing");