3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-23 14:50:08 +01:00
Paper/nms-patches/ItemTrident.patch

63 Zeilen
3.1 KiB
Diff

2018-08-02 01:38:52 +02:00
--- a/net/minecraft/server/ItemTrident.java
+++ b/net/minecraft/server/ItemTrident.java
@@ -6,9 +6,13 @@
public ItemTrident(Item.Info item_info) {
super(item_info);
+ // CraftBukkit start - obfuscator went a little crazy
+ /*
this.a(new MinecraftKey("throwing"), (itemstack, world, entityliving) -> {
2019-06-21 12:00:00 +02:00
return entityliving != null && entityliving.isHandRaised() && entityliving.dm() == itemstack ? 1.0F : 0.0F;
2018-08-02 01:38:52 +02:00
});
+ */
+ // CraftBukkit end
}
2019-04-23 04:00:00 +02:00
@Override
@@ -37,9 +41,12 @@
2019-04-23 04:00:00 +02:00
if (k <= 0 || entityhuman.isInWaterOrRain()) {
if (!world.isClientSide) {
2019-04-23 04:00:00 +02:00
+ // CraftBukkit - moved down
+ /*
itemstack.damage(1, entityhuman, (entityhuman1) -> {
entityhuman1.d(entityliving.getRaisedHand());
});
+ */
if (k == 0) {
EntityThrownTrident entitythrowntrident = new EntityThrownTrident(world, entityhuman, itemstack);
2019-04-23 04:00:00 +02:00
@@ -48,7 +55,20 @@
entitythrowntrident.fromPlayer = EntityArrow.PickupStatus.CREATIVE_ONLY;
}
- world.addEntity(entitythrowntrident);
+ // CraftBukkit start
+ if (!world.addEntity(entitythrowntrident)) {
+ if (entityhuman instanceof EntityPlayer) {
+ ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory();
+ }
+ return;
+ }
+
2019-04-23 04:00:00 +02:00
+ itemstack.damage(1, entityhuman, (entityhuman1) -> {
+ entityhuman1.d(entityliving.getRaisedHand());
+ });
2018-12-06 00:00:00 +01:00
+ entitythrowntrident.trident = itemstack.cloneItemStack(); // SPIGOT-4511 update since damage call moved
+ // CraftBukkit end
+
2019-04-23 04:00:00 +02:00
world.a((EntityHuman) null, (Entity) entitythrowntrident, SoundEffects.ITEM_TRIDENT_THROW, SoundCategory.PLAYERS, 1.0F, 1.0F);
if (!entityhuman.abilities.canInstantlyBuild) {
entityhuman.inventory.f(itemstack);
2019-04-23 04:00:00 +02:00
@@ -58,6 +78,10 @@
2018-08-02 01:38:52 +02:00
2019-04-23 04:00:00 +02:00
entityhuman.b(StatisticList.ITEM_USED.b(this));
2018-08-02 01:38:52 +02:00
if (k > 0) {
+ // CraftBukkit start
+ org.bukkit.event.player.PlayerRiptideEvent event = new org.bukkit.event.player.PlayerRiptideEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack));
+ event.getPlayer().getServer().getPluginManager().callEvent(event);
+ // CraftBukkit end
float f = entityhuman.yaw;
float f1 = entityhuman.pitch;
float f2 = -MathHelper.sin(f * 0.017453292F) * MathHelper.cos(f1 * 0.017453292F);