mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 20:07:41 +01:00
Allow trident custom damage
This commit is contained in:
parent
9b0d705d63
commit
e9583f82db
@ -10,7 +10,27 @@
|
|||||||
|
|
||||||
public class ThrownTrident extends AbstractArrow {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,6 +114,20 @@
|
@@ -109,8 +115,22 @@
|
||||||
return (Boolean) this.entityData.get(ThrownTrident.ID_FOIL);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
public boolean isFoil() {
|
||||||
|
return (Boolean) this.entityData.get(ThrownTrident.ID_FOIL);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
+ // Paper start
|
+ // Paper start
|
||||||
+ public void setFoil(boolean foil) {
|
+ public void setFoil(boolean foil) {
|
||||||
+ this.entityData.set(ThrownTrident.ID_FOIL, foil);
|
+ this.entityData.set(ThrownTrident.ID_FOIL, foil);
|
||||||
+ }
|
}
|
||||||
+
|
|
||||||
+ public int getLoyalty() {
|
+ public int getLoyalty() {
|
||||||
+ return this.entityData.get(ThrownTrident.ID_LOYALTY);
|
+ return this.entityData.get(ThrownTrident.ID_LOYALTY);
|
||||||
+ }
|
+ }
|
||||||
@ -44,7 +66,16 @@
|
|||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
protected EntityHitResult findHitEntity(Vec3 currentPosition, Vec3 nextPosition) {
|
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();
|
world = this.level();
|
||||||
if (world instanceof ServerLevel) {
|
if (world instanceof ServerLevel) {
|
||||||
|
Loading…
Reference in New Issue
Block a user