13
0
geforkt von Mirrors/Paper

#1468: Expand riptiding API

By: ShreyasAyyengar <shreyas.ayyengar@gmail.com>
Dieser Commit ist enthalten in:
CraftBukkit/Spigot 2024-09-07 18:08:13 +10:00
Ursprung 106225f127
Commit 7657f347d2
3 geänderte Dateien mit 36 neuen und 6 gelöschten Zeilen

Datei anzeigen

@ -33,6 +33,15 @@
public abstract class EntityLiving extends Entity implements Attackable { public abstract class EntityLiving extends Entity implements Attackable {
private static final Logger LOGGER = LogUtils.getLogger(); private static final Logger LOGGER = LogUtils.getLogger();
@@ -157,7 +183,7 @@
private static final double MAX_LINE_OF_SIGHT_TEST_RANGE = 128.0D;
protected static final int LIVING_ENTITY_FLAG_IS_USING = 1;
protected static final int LIVING_ENTITY_FLAG_OFF_HAND = 2;
- protected static final int LIVING_ENTITY_FLAG_SPIN_ATTACK = 4;
+ public static final int LIVING_ENTITY_FLAG_SPIN_ATTACK = 4;
protected static final DataWatcherObject<Byte> DATA_LIVING_ENTITY_FLAGS = DataWatcher.defineId(EntityLiving.class, DataWatcherRegistry.BYTE);
public static final DataWatcherObject<Float> DATA_HEALTH_ID = DataWatcher.defineId(EntityLiving.class, DataWatcherRegistry.FLOAT);
private static final DataWatcherObject<List<ParticleParam>> DATA_EFFECT_PARTICLES = DataWatcher.defineId(EntityLiving.class, DataWatcherRegistry.PARTICLES);
@@ -249,6 +275,19 @@ @@ -249,6 +275,19 @@
protected boolean skipDropExperience; protected boolean skipDropExperience;
private final Reference2ObjectMap<Enchantment, Set<EnchantmentLocationBasedEffect>> activeLocationDependentEnchantments; private final Reference2ObjectMap<Enchantment, Set<EnchantmentLocationBasedEffect>> activeLocationDependentEnchantments;
@ -1008,7 +1017,7 @@
this.setSharedFlag(7, flag); this.setSharedFlag(7, flag);
} }
@@ -3141,14 +3634,21 @@ @@ -3141,13 +3634,20 @@
@Override @Override
public boolean isPickable() { public boolean isPickable() {
@ -1020,18 +1029,26 @@
public boolean isPushable() { public boolean isPushable() {
- return this.isAlive() && !this.isSpectator() && !this.onClimbable(); - return this.isAlive() && !this.isSpectator() && !this.onClimbable();
+ return this.isAlive() && !this.isSpectator() && !this.onClimbable() && this.collides; // CraftBukkit + return this.isAlive() && !this.isSpectator() && !this.onClimbable() && this.collides; // CraftBukkit
} + }
+
+ // CraftBukkit start - collidable API + // CraftBukkit start - collidable API
+ @Override + @Override
+ public boolean canCollideWithBukkit(Entity entity) { + public boolean canCollideWithBukkit(Entity entity) {
+ return isPushable() && this.collides != this.collidableExemptions.contains(entity.getUUID()); + return isPushable() && this.collides != this.collidableExemptions.contains(entity.getUUID());
+ } }
+ // CraftBukkit end + // CraftBukkit end
+
@Override @Override
public float getYHeadRot() { public float getYHeadRot() {
return this.yHeadRot; @@ -3245,7 +3745,7 @@
}
- protected void setLivingEntityFlag(int i, boolean flag) {
+ public void setLivingEntityFlag(int i, boolean flag) {
int j = (Byte) this.entityData.get(EntityLiving.DATA_LIVING_ENTITY_FLAGS);
if (flag) {
@@ -3346,7 +3846,26 @@ @@ -3346,7 +3846,26 @@
} else { } else {
if (!this.useItem.isEmpty() && this.isUsingItem()) { if (!this.useItem.isEmpty() && this.isUsingItem()) {

Datei anzeigen

@ -160,6 +160,14 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
getHandle().stopSleepInBed(true, setSpawnLocation); getHandle().stopSleepInBed(true, setSpawnLocation);
} }
@Override
public void startRiptideAttack(int duration, float damage, ItemStack attackItem) {
Preconditions.checkArgument(duration > 0, "Duration must be greater than 0");
Preconditions.checkArgument(damage >= 0, "Damage must not be negative");
getHandle().startAutoSpinAttack(duration, damage, CraftItemStack.asNMSCopy(attackItem));
}
@Override @Override
public Location getBedLocation() { public Location getBedLocation() {
Preconditions.checkState(isSleeping(), "Not sleeping"); Preconditions.checkState(isSleeping(), "Not sleeping");

Datei anzeigen

@ -656,6 +656,11 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
return getHandle().isAutoSpinAttack(); return getHandle().isAutoSpinAttack();
} }
@Override
public void setRiptiding(boolean riptiding) {
getHandle().setLivingEntityFlag(EntityLiving.LIVING_ENTITY_FLAG_SPIN_ATTACK, riptiding);
}
@Override @Override
public boolean isSleeping() { public boolean isSleeping() {
return getHandle().isSleeping(); return getHandle().isSleeping();