Skip to content

Commit

Permalink
feat: Contingency - Immobilization now help against spiderweb or quic…
Browse files Browse the repository at this point in the history
…ksand. Fixes #200
  • Loading branch information
WinDanesz committed Dec 30, 2023
1 parent e18117e commit b8d45a5
Showing 1 changed file with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
import electroblob.wizardry.util.ParticleBuilder;
import electroblob.wizardry.util.SpellModifiers;
import electroblob.wizardry.util.WandHelper;
import net.minecraft.block.material.Material;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityCreature;
Expand All @@ -90,6 +91,7 @@
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumHand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraftforge.common.MinecraftForge;
Expand Down Expand Up @@ -1388,6 +1390,27 @@ public static void onPlayerTickEvent(TickEvent.PlayerTickEvent event) {
}
}
}

if (!event.player.world.isRemote && event.player.ticksExisted % 6 == 0) {
// Contingency - Immobility
WizardData data = WizardData.get(player);
if (data != null) {
NBTTagCompound activeContingencies = data.getVariable(Contingency.ACTIVE_CONTINGENCIES);
if (activeContingencies != null) {

if (activeContingencies.hasKey(Contingency.Type.IMMOBILITY.spellName)) {

for (BlockPos pos : Arrays.asList(player.getPosition(), player.getPosition().up())) {
if (player.world.getBlockState(pos).getMaterial() == Material.WEB || player.world.getBlockState(pos).getBlock() == ASBlocks.QUICKSAND) {
Contingency.tryCastContingencySpell(player, data, Contingency.Type.IMMOBILITY);
break;
}

}
}
}
}
}
}

// tick artefacts
Expand Down

0 comments on commit b8d45a5

Please sign in to comment.