mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-31 21:06:31 +00:00
弹射物更新
This commit is contained in:
@@ -60,14 +60,14 @@ public class BukkitProjectileManager implements Listener, ProjectileManager {
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
|
||||
public void onProjectileLaunch(ProjectileLaunchEvent event) {
|
||||
Projectile projectile = event.getEntity();
|
||||
handleProjectileLoad(projectile, true);
|
||||
handleProjectileLoad(projectile);
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
|
||||
public void onEntitiesLoad(EntitiesLoadEvent event) {
|
||||
for (Entity entity : event.getEntities()) {
|
||||
if (entity instanceof Projectile projectile) {
|
||||
handleProjectileLoad(projectile, false);
|
||||
handleProjectileLoad(projectile);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -77,7 +77,7 @@ public class BukkitProjectileManager implements Listener, ProjectileManager {
|
||||
this.projectiles.remove(event.getEntity().getEntityId());
|
||||
}
|
||||
|
||||
private void handleProjectileLoad(Projectile projectile, boolean delay) {
|
||||
private void handleProjectileLoad(Projectile projectile) {
|
||||
ItemStack projectileItem;
|
||||
if (projectile instanceof ThrowableProjectile throwableProjectile) {
|
||||
projectileItem = throwableProjectile.getItem();
|
||||
@@ -92,14 +92,7 @@ public class BukkitProjectileManager implements Listener, ProjectileManager {
|
||||
ProjectileMeta meta = it.settings().projectileMeta();
|
||||
if (meta != null) {
|
||||
this.projectiles.put(projectile.getEntityId(), new BukkitCustomProjectile(meta, projectile, wrapped));
|
||||
ProjectileInjectTask task = new ProjectileInjectTask(projectile);
|
||||
if (!delay) {
|
||||
task.run();
|
||||
} else if (VersionHelper.isFolia()) {
|
||||
|
||||
} else {
|
||||
plugin.scheduler().sync().runDelayed(task);
|
||||
}
|
||||
new ProjectileInjectTask(projectile);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -101,6 +101,7 @@ public class ProjectilePacketHandler implements EntityPacketHandler {
|
||||
displayedItem = this.projectile.item().mergeCopy(displayedItem);
|
||||
ItemDisplayEntityData.InterpolationDelay.addEntityDataIfNotDefaultValue(-1, itemDisplayValues);
|
||||
ItemDisplayEntityData.Translation.addEntityDataIfNotDefaultValue(meta.translation(), itemDisplayValues);
|
||||
ItemDisplayEntityData.Scale.addEntityDataIfNotDefaultValue(meta.scale(), itemDisplayValues);
|
||||
ItemDisplayEntityData.RotationLeft.addEntityDataIfNotDefaultValue(meta.rotation(), itemDisplayValues);
|
||||
if (VersionHelper.isOrAbove1_20_2()) {
|
||||
ItemDisplayEntityData.TransformationInterpolationDuration.addEntityDataIfNotDefaultValue(1, itemDisplayValues);
|
||||
|
||||
Reference in New Issue
Block a user