Skip to content

Commit

Permalink
fix: Execute loopcast only after setting the appropriate player data
Browse files Browse the repository at this point in the history
Fixes #768
  • Loading branch information
Kamefrede committed Nov 7, 2023
1 parent 7f0d5d3 commit 33fa090
Showing 1 changed file with 1 addition and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.item.Item.Properties;
import net.minecraft.world.item.ItemStack;

import vazkii.psi.api.spell.SpellContext;
Expand All @@ -29,12 +28,12 @@ public ItemLoopcastSpellBullet(Properties properties) {
public ArrayList<Entity> castSpell(ItemStack stack, SpellContext context) {
PlayerDataHandler.PlayerData data = PlayerDataHandler.get(context.caster);
if(!data.loopcasting || context.castFrom != data.loopcastHand) {
context.cspell.safeExecute(context);
data.loopcasting = true;
data.loopcastHand = context.castFrom;
data.lastTickLoopcastStack = null;
data.loopcastTime = 1;
data.loopcastAmount = 0;
context.cspell.safeExecute(context);
if(context.caster instanceof ServerPlayer) {
LoopcastTrackingHandler.syncForTrackersAndSelf((ServerPlayer) context.caster);
}
Expand All @@ -57,9 +56,4 @@ public String getBulletType() {
public boolean isCADOnlyContainer(ItemStack stack) {
return true;
}

@Override
public double getCostModifier(ItemStack stack) {
return 1.0;
}
}

0 comments on commit 33fa090

Please sign in to comment.