-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
466dc43
commit 0573cb3
Showing
6 changed files
with
54 additions
and
40 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
src/main/java/io/github/itzispyder/clickcrystals/events/events/client/EntityDamageEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package io.github.itzispyder.clickcrystals.events.events.client; | ||
|
||
import io.github.itzispyder.clickcrystals.events.Event; | ||
import io.github.itzispyder.clickcrystals.util.minecraft.PlayerUtils; | ||
import net.minecraft.entity.Entity; | ||
import net.minecraft.entity.damage.DamageSource; | ||
import net.minecraft.network.packet.s2c.play.EntityDamageS2CPacket; | ||
|
||
public class EntityDamageEvent extends Event { | ||
|
||
private final DamageSource source; | ||
private final Entity entity; | ||
|
||
public EntityDamageEvent(EntityDamageS2CPacket packet) { | ||
var world = PlayerUtils.getWorld(); | ||
this.source = packet.createDamageSource(world); | ||
this.entity = world.getEntityById(packet.entityId()); | ||
} | ||
|
||
public boolean isSelf() { | ||
return PlayerUtils.playerNotNull() && entity.getId() == PlayerUtils.player().getId(); | ||
} | ||
|
||
public DamageSource getSource() { | ||
return source; | ||
} | ||
|
||
public float getCurrentHealth() { | ||
return PlayerUtils.playerNull() ? 0.0F : PlayerUtils.player().getHealth(); | ||
} | ||
} |
21 changes: 0 additions & 21 deletions
21
src/main/java/io/github/itzispyder/clickcrystals/events/events/client/TakeDamageEvent.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters