Command Core Functionality 2
This commit is contained in:
@@ -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 -> {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user