mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 07:20:24 +01:00
Allow trident custom damage
This commit is contained in:
parent
9b0d705d63
commit
e9583f82db
1 changed files with 38 additions and 7 deletions
|
@ -10,7 +10,27 @@
|
|||
|
||||
public class ThrownTrident extends AbstractArrow {
|
||||
|
||||
@@ -76,10 +79,10 @@
|
||||
@@ -34,16 +37,19 @@
|
||||
|
||||
public ThrownTrident(EntityType<? extends ThrownTrident> type, Level world) {
|
||||
super(type, world);
|
||||
+ this.setBaseDamage(net.minecraft.world.item.TridentItem.BASE_DAMAGE); // Paper - Allow trident custom damage
|
||||
}
|
||||
|
||||
public ThrownTrident(Level world, LivingEntity owner, ItemStack stack) {
|
||||
super(EntityType.TRIDENT, owner, world, stack, (ItemStack) null);
|
||||
+ this.setBaseDamage(net.minecraft.world.item.TridentItem.BASE_DAMAGE); // Paper - Allow trident custom damage
|
||||
this.entityData.set(ThrownTrident.ID_LOYALTY, this.getLoyaltyFromItem(stack));
|
||||
this.entityData.set(ThrownTrident.ID_FOIL, stack.hasFoil());
|
||||
}
|
||||
|
||||
public ThrownTrident(Level world, double x, double y, double z, ItemStack stack) {
|
||||
super(EntityType.TRIDENT, x, y, z, world, stack, stack);
|
||||
+ this.setBaseDamage(net.minecraft.world.item.TridentItem.BASE_DAMAGE); // Paper - Allow trident custom damage
|
||||
this.entityData.set(ThrownTrident.ID_LOYALTY, this.getLoyaltyFromItem(stack));
|
||||
this.entityData.set(ThrownTrident.ID_FOIL, stack.hasFoil());
|
||||
}
|
||||
@@ -76,10 +82,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,15 +43,17 @@
|
|||
return;
|
||||
}
|
||||
|
||||
@@ -111,6 +114,20 @@
|
||||
return (Boolean) this.entityData.get(ThrownTrident.ID_FOIL);
|
||||
}
|
||||
@@ -109,8 +115,22 @@
|
||||
|
||||
public boolean isFoil() {
|
||||
return (Boolean) this.entityData.get(ThrownTrident.ID_FOIL);
|
||||
+ }
|
||||
+
|
||||
+ // Paper start
|
||||
+ public void setFoil(boolean foil) {
|
||||
+ this.entityData.set(ThrownTrident.ID_FOIL, foil);
|
||||
+ }
|
||||
+
|
||||
}
|
||||
|
||||
+ public int getLoyalty() {
|
||||
+ return this.entityData.get(ThrownTrident.ID_LOYALTY);
|
||||
+ }
|
||||
|
@ -44,7 +66,16 @@
|
|||
@Nullable
|
||||
@Override
|
||||
protected EntityHitResult findHitEntity(Vec3 currentPosition, Vec3 nextPosition) {
|
||||
@@ -137,7 +154,7 @@
|
||||
@@ -120,7 +140,7 @@
|
||||
@Override
|
||||
protected void onHitEntity(EntityHitResult entityHitResult) {
|
||||
Entity entity = entityHitResult.getEntity();
|
||||
- float f = 8.0F;
|
||||
+ float f = (float) this.getBaseDamage(); // Paper - Allow trident custom damage
|
||||
Entity entity1 = this.getOwner();
|
||||
DamageSource damagesource = this.damageSources().trident(this, (Entity) (entity1 == null ? this : entity1));
|
||||
Level world = this.level();
|
||||
@@ -137,7 +157,7 @@
|
||||
|
||||
world = this.level();
|
||||
if (world instanceof ServerLevel) {
|
||||
|
|
Loading…
Reference in a new issue