3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-15 11:00:06 +01:00
Paper/Spigot-Server-Patches/0588-Player-elytra-boost-API.patch

47 Zeilen
2.3 KiB
Diff

2020-04-14 12:11:25 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Trigary <trigary0@gmail.com>
Date: Tue, 14 Apr 2020 12:05:22 +0200
Subject: [PATCH] Player elytra boost API
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
2021-03-16 16:50:45 +01:00
index a4726747c066d623f37162e2637403efee7f5708..204d3e879c736f44e01f9246af26f6cccf8d72a7 100644
2020-04-14 12:11:25 +02:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
2021-03-16 16:50:45 +01:00
@@ -69,12 +69,14 @@ import net.minecraft.world.entity.ai.attributes.AttributeMapBase;
import net.minecraft.world.entity.ai.attributes.AttributeModifiable;
import net.minecraft.world.entity.ai.attributes.GenericAttributes;
import net.minecraft.world.entity.player.EntityHuman;
+import net.minecraft.world.entity.projectile.EntityFireworks;
import net.minecraft.world.inventory.Container;
import net.minecraft.world.item.EnumColor;
import net.minecraft.world.item.enchantment.EnchantmentManager;
import net.minecraft.world.item.enchantment.Enchantments;
import net.minecraft.world.level.ChunkCoordIntPair;
import net.minecraft.world.level.EnumGamemode;
+import net.minecraft.world.level.World;
import net.minecraft.world.level.biome.BiomeManager;
import net.minecraft.world.level.block.entity.TileEntitySign;
import net.minecraft.world.level.saveddata.maps.MapIcon;
@@ -2281,6 +2283,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
2020-04-14 12:11:25 +02:00
}
throw new RuntimeException("Unknown settings type");
}
+
+ @Override
+ public org.bukkit.entity.Firework boostElytra(ItemStack firework) {
+ Validate.isTrue(isGliding(), "Player must be gliding");
+ Validate.isTrue(firework != null, "firework == null");
+ Validate.isTrue(firework.getType() == Material.FIREWORK_ROCKET, "Firework must be Material.FIREWORK_ROCKET");
+
2021-03-16 16:50:45 +01:00
+ net.minecraft.world.item.ItemStack item = org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(firework);
+ World world = ((CraftWorld) getWorld()).getHandle();
+ EntityFireworks entity = new EntityFireworks(world, item, getHandle());
2020-04-14 12:11:25 +02:00
+ return world.addEntity(entity)
+ ? (org.bukkit.entity.Firework) entity.getBukkitEntity()
+ : null;
+ }
// Paper end
// Spigot start