Skip to content

Commit

Permalink
Fixing bug where you respawn and are still casting if keepinventory i…
Browse files Browse the repository at this point in the history
…s set to true
  • Loading branch information
lab3 committed Apr 30, 2023
1 parent e3eeb7a commit 487a067
Showing 1 changed file with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@
import net.minecraft.world.item.SwordItem;
import net.minecraftforge.event.ItemAttributeModifierEvent;
import net.minecraftforge.event.entity.EntityMountEvent;
import net.minecraftforge.event.entity.living.LivingAttackEvent;
import net.minecraftforge.event.entity.living.LivingDamageEvent;
import net.minecraftforge.event.entity.living.LivingEquipmentChangeEvent;
import net.minecraftforge.event.entity.living.LivingExperienceDropEvent;
import net.minecraftforge.event.entity.living.*;
import net.minecraftforge.event.entity.player.PlayerContainerEvent;
import net.minecraftforge.event.entity.player.PlayerEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
Expand Down Expand Up @@ -130,6 +127,17 @@ public static void onPlayerCloned(PlayerEvent.Clone event) {
event.getEntity().setTicksFrozen(0);
}

@SubscribeEvent
public static void onLivingDeathEvent(LivingDeathEvent event) {
//IronsSpellbooks.LOGGER.debug("onLivingDeathEvent: {} {}", event.getEntity().getName().getString(), event.getEntity().isDeadOrDying());
event.getEntity().clearFire();
event.getEntity().setTicksFrozen(0);
if (event.getEntity() instanceof ServerPlayer serverPlayer) {
//IronsSpellbooks.LOGGER.debug("onLivingDeathEvent: {}", serverPlayer.getName().getString());
Utils.serverSideCancelCast(serverPlayer);
}
}

@SubscribeEvent
public static void onPlayerChangedDimension(PlayerEvent.PlayerChangedDimensionEvent event) {
//Ironsspellbooks.logger.debug("PlayerChangedDimension: {}", event.getEntity().getName().getString());
Expand Down

0 comments on commit 487a067

Please sign in to comment.