Command Core Functionality 2

This commit is contained in:
Vos
2026-03-12 18:49:18 -05:00
parent fdfb322026
commit 6ced980fa5
3 changed files with 36 additions and 4 deletions
@@ -1,6 +1,7 @@
package com.acethewildfire.acesbs.item.custom; package com.acethewildfire.acesbs.item.custom;
import com.acethewildfire.acesbs.component.ModDataComponentTypes; import com.acethewildfire.acesbs.component.ModDataComponentTypes;
import com.acethewildfire.acesbs.effect.ModEffects;
import com.acethewildfire.acesbs.screen.custom.CommandCoreScreen; import com.acethewildfire.acesbs.screen.custom.CommandCoreScreen;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.Screen;
@@ -78,6 +79,14 @@ public class CommandCore extends Item {
switch (command) { switch (command) {
case "TEST" -> { entity.setOnFireFor(1); } case "TEST" -> { entity.setOnFireFor(1); }
case "Sight" -> { if (!world.isClient()) livingEntity.removeStatusEffect(StatusEffects.BLINDNESS); } 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 -> {} case null, default -> {}
} }
} }
@@ -1,14 +1,22 @@
package com.acethewildfire.acesbs.mixin; 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 com.acethewildfire.acesbs.item.custom.SovsPlateCarrierArmorItem;
import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.damage.DamageSource; 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.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At; 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.ModifyVariable;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.util.Objects;
@Mixin(LivingEntity.class) @Mixin(LivingEntity.class)
public abstract class LivingEntityMixin { public abstract class LivingEntityMixin {
@@ -37,4 +45,19 @@ public abstract class LivingEntityMixin {
return amount; 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();
}
};
}
}
}
}
} }
@@ -25,10 +25,10 @@ public class CommandCoreScreen extends Screen {
super(Text.literal("Select Option")); super(Text.literal("Select Option"));
this.stack = stack; this.stack = stack;
this.options = new TreeMap<>(); this.options = new TreeMap<>();
options.put("Sight", "See when others can not"); options.put("Sight", "Blindness has no effect on you");
options.put("Omnipotence", "Let nothing escape your sight"); options.put("Omnipotence", "Hit entities will glow for 30 seconds");
options.put("Intimidate", "Warn any would be foes that you mean business"); // 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("Immunity", "Poison and Wither have no effect on you");
options.put("Immovable", "You cannot be moved against your will"); options.put("Immovable", "You cannot be moved against your will");
options.put("Unstoppable", "You cannot be stopped by obstacles"); options.put("Unstoppable", "You cannot be stopped by obstacles");
options.put("Grounded", "You always have sure footing"); options.put("Grounded", "You always have sure footing");