mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-22 14:35:11 +01:00
Work work work
This commit is contained in:
parent
f1649d702b
commit
9d63c814c2
17 changed files with 140 additions and 167 deletions
|
@ -10,10 +10,10 @@ Adds an option to control the force mode of the particle.
|
|||
This adds a new Builder API which is much friendlier to use.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 7c6b094de5e29cb2663e8a7072a27d7adbceb4b2..1fac100819e59d00f50e530d3a4157b56d966dba 100644
|
||||
index 21c3d771a3dd921767c2cba1e11583d015879ca9..252f1deea98a6eb83ac99adea3ea7a3c229c0f07 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -1508,12 +1508,17 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -1566,12 +1566,17 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
||||
}
|
||||
|
||||
public <T extends ParticleOptions> int sendParticles(ServerPlayer sender, T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6, boolean force) {
|
||||
|
@ -34,10 +34,10 @@ index 7c6b094de5e29cb2663e8a7072a27d7adbceb4b2..1fac100819e59d00f50e530d3a4157b5
|
|||
|
||||
if (this.sendParticles(entityplayer, force, d0, d1, d2, packetplayoutworldparticles)) { // CraftBukkit
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index 1b7660a2d003bfb19ef80ba8066b6417f85328ec..3c00eaf52ab04d1396f226cc074d9dd013c57027 100644
|
||||
index 8cf4ecc5065ade18f0d13eaf0a786912ecb4dd08..4b2742c0841bd686ee637e1d6dc011e13b0df192 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -1982,8 +1982,19 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
@@ -1992,8 +1992,19 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
|
||||
@Override
|
||||
public <T> void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data, boolean force) {
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] Fix exploit that allowed colored signs to be created
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
|
||||
index e535fb3b5194b8412c0c26c0799340916c7542eb..394d0b03f18d55b43f091a9ae1a47e06a6fa4c0d 100644
|
||||
index cdaa050f237c6d6d5a0df0faf23daf3775249451..469d0046ba98289e98aa0f3f66e3ed27026a98a2 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
|
||||
@@ -202,9 +202,9 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
|
||||
@@ -202,9 +202,9 @@ public class SignBlockEntity extends BlockEntity {
|
||||
Style chatmodifier = signtext.getMessage(i, entityhuman.isTextFilteringEnabled()).getStyle();
|
||||
|
||||
if (entityhuman.isTextFilteringEnabled()) {
|
|
@ -8,23 +8,21 @@ Allow control over whether or not an enderman aggros a player.
|
|||
This allows you to override/extend the pumpkin/stare logic.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
|
||||
index 51e9988685b1a9a3d4d2effec63560b0ae9e8d3a..70888dd25b6a1d1ab7702d73a64a47eebafe76fe 100644
|
||||
index d7145b3a19402a03d0af02822ffcb0ef07eaa663..5f1bbb4302013c2c1788db6b64eafba2a11a373a 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
|
||||
@@ -233,7 +233,15 @@ public class EnderMan extends Monster implements NeutralMob {
|
||||
this.readPersistentAngerSaveData(this.level(), nbt);
|
||||
@@ -234,6 +234,14 @@ public class EnderMan extends Monster implements NeutralMob {
|
||||
}
|
||||
|
||||
- boolean isLookingAtMe(Player player) {
|
||||
boolean isBeingStaredBy(Player player) {
|
||||
+ // Paper start - EndermanAttackPlayerEvent
|
||||
+ private boolean isLookingAtMe(Player player) {
|
||||
+ boolean shouldAttack = isLookingAtMe_check(player);
|
||||
+ boolean shouldAttack = isBeingStaredBy0(player);
|
||||
+ com.destroystokyo.paper.event.entity.EndermanAttackPlayerEvent event = new com.destroystokyo.paper.event.entity.EndermanAttackPlayerEvent((org.bukkit.entity.Enderman) getBukkitEntity(), (org.bukkit.entity.Player) player.getBukkitEntity());
|
||||
+ event.setCancelled(!shouldAttack);
|
||||
+ return event.callEvent();
|
||||
+ }
|
||||
+ private boolean isLookingAtMe_check(Player player) {
|
||||
+ // Paper end - EndermanAttackPlayerEvent
|
||||
ItemStack itemstack = (ItemStack) player.getInventory().armor.get(3);
|
||||
+ private boolean isBeingStaredBy0(Player player) {
|
||||
+ // Paper end - EndermanAttackPlayerEvent
|
||||
return this.isLookingAtMe(player, 0.025D, true, false, LivingEntity.PLAYER_NOT_WEARING_DISGUISE_ITEM, new DoubleSupplier[]{this::getEyeY});
|
||||
}
|
||||
|
||||
if (itemstack.is(Blocks.CARVED_PUMPKIN.asItem())) {
|
|
@ -6,10 +6,10 @@ Subject: [PATCH] WitchConsumePotionEvent
|
|||
Fires when a witch consumes the potion in their hand
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Witch.java b/src/main/java/net/minecraft/world/entity/monster/Witch.java
|
||||
index a4d10409f06316ee628b683b231b3cc2a08bf593..f9cd71379a1d195731e7348ac6928372a4b2c29c 100644
|
||||
index 4fe13665f298503d28d866551fa7871437ca683b..93cc6a6345d8b9c349eba8bc5ba3d23cb36d76cc 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Witch.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Witch.java
|
||||
@@ -123,6 +123,12 @@ public class Witch extends Raider implements RangedAttackMob {
|
||||
@@ -124,6 +124,12 @@ public class Witch extends Raider implements RangedAttackMob {
|
||||
|
||||
this.setItemSlot(EquipmentSlot.MAINHAND, ItemStack.EMPTY);
|
||||
PotionContents potioncontents = (PotionContents) itemstack.get(DataComponents.POTION_CONTENTS);
|
25
patches/server/0190-WitchThrowPotionEvent.patch
Normal file
25
patches/server/0190-WitchThrowPotionEvent.patch
Normal file
|
@ -0,0 +1,25 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Wed, 16 May 2018 20:44:58 -0400
|
||||
Subject: [PATCH] WitchThrowPotionEvent
|
||||
|
||||
Fired when a witch throws a potion at a player
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Witch.java b/src/main/java/net/minecraft/world/entity/monster/Witch.java
|
||||
index 93cc6a6345d8b9c349eba8bc5ba3d23cb36d76cc..52475eb5fd0240e80826a52d6cd10bc1fbe8f903 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Witch.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Witch.java
|
||||
@@ -237,6 +237,13 @@ public class Witch extends Raider implements RangedAttackMob {
|
||||
ServerLevel worldserver = (ServerLevel) world;
|
||||
ItemStack itemstack = PotionContents.createItemStack(Items.SPLASH_POTION, holder);
|
||||
|
||||
+ // Paper start - WitchThrowPotionEvent
|
||||
+ com.destroystokyo.paper.event.entity.WitchThrowPotionEvent event = new com.destroystokyo.paper.event.entity.WitchThrowPotionEvent((org.bukkit.entity.Witch) this.getBukkitEntity(), (org.bukkit.entity.LivingEntity) target.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack));
|
||||
+ if (!event.callEvent()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ itemstack = org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getPotion());
|
||||
+ // Paper end - WitchThrowPotionEvent
|
||||
Projectile.spawnProjectileUsingShoot(ThrownPotion::new, worldserver, itemstack, this, d0, d1 + d3 * 0.2D, d2, 0.75F, 8.0F);
|
||||
}
|
||||
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] WitchReadyPotionEvent
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Witch.java b/src/main/java/net/minecraft/world/entity/monster/Witch.java
|
||||
index a14e00d55930628333cc63b18727ea56dbdc4ee3..f6d01d21745391595d61b191832be4c28a3e58cb 100644
|
||||
index 52475eb5fd0240e80826a52d6cd10bc1fbe8f903..120f0c729c48ddfa598472029cdfbab3dc6db50f 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Witch.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Witch.java
|
||||
@@ -151,7 +151,11 @@ public class Witch extends Raider implements RangedAttackMob {
|
||||
@@ -152,7 +152,11 @@ public class Witch extends Raider implements RangedAttackMob {
|
||||
}
|
||||
|
||||
if (holder != null) {
|
||||
|
@ -22,10 +22,10 @@ index a14e00d55930628333cc63b18727ea56dbdc4ee3..f6d01d21745391595d61b191832be4c2
|
|||
this.setUsingItem(true);
|
||||
if (!this.isSilent()) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index 91180d7ad705ca97c0df43debc14b204127165d0..e3af0db8082e4e90902197f96f1c833405bf5f63 100644
|
||||
index 0a3c89dba691760c7e0be58914003cc438269a03..f05a19f868be0d685c4fbf64e1dfbefda71131ac 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -1976,4 +1976,14 @@ public class CraftEventFactory {
|
||||
@@ -1974,4 +1974,14 @@ public class CraftEventFactory {
|
||||
).callEvent();
|
||||
}
|
||||
// Paper end - PlayerUseUnknownEntityEvent
|
33
patches/server/0192-ItemStack-getMaxItemUseDuration.patch
Normal file
33
patches/server/0192-ItemStack-getMaxItemUseDuration.patch
Normal file
|
@ -0,0 +1,33 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Tue, 5 Jun 2018 23:00:29 -0400
|
||||
Subject: [PATCH] ItemStack#getMaxItemUseDuration
|
||||
|
||||
Allows you to determine how long it takes to use a usable/consumable item
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
||||
index aea09533fada5bd3d42e2cc147921167a5e7c1a5..60062ea5b18b95a14c459f2f3a0743c1e1ac0f12 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
||||
@@ -225,6 +225,21 @@ public final class CraftItemStack extends ItemStack {
|
||||
return (this.handle == null) ? Material.AIR.getMaxStackSize() : this.handle.getMaxStackSize();
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public int getMaxItemUseDuration(final org.bukkit.entity.LivingEntity entity) {
|
||||
+ if (handle == null) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ // Make sure plugins calling the old method don't blow up
|
||||
+ if (entity == null && (handle.is(net.minecraft.world.item.Items.CROSSBOW) || handle.is(net.minecraft.world.item.Items.GOAT_HORN))) {
|
||||
+ throw new UnsupportedOperationException("This item requires an entity to determine the max use duration");
|
||||
+ }
|
||||
+ return handle.getUseDuration(entity != null ? ((org.bukkit.craftbukkit.entity.CraftLivingEntity) entity).getHandle() : null);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Override
|
||||
public void addUnsafeEnchantment(Enchantment ench, int level) {
|
||||
Preconditions.checkArgument(ench != null, "Enchantment cannot be null");
|
|
@ -5,13 +5,13 @@ Subject: [PATCH] Add EntityTeleportEndGatewayEvent
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 946f289e0e681524c6fde696921965dbdedda372..d6017d9d71fb4b3a3df6eaa44da0ebda54c83da4 100644
|
||||
index 99794276626d26849150d4956abbbc2296543907..087f030985180b91a809fb45244e23106da62e34 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -3301,8 +3301,16 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
if (!this.isRemoved()) {
|
||||
@@ -3429,8 +3429,16 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
// CraftBukkit start
|
||||
Location to = new Location(teleportTarget.newLevel().getWorld(), teleportTarget.pos().x, teleportTarget.pos().y, teleportTarget.pos().z, teleportTarget.yRot(), teleportTarget.xRot());
|
||||
PositionMoveRotation absolutePosition = PositionMoveRotation.calculateAbsolute(PositionMoveRotation.of(this), PositionMoveRotation.of(teleportTarget), teleportTarget.relatives());
|
||||
Location to = CraftLocation.toBukkit(absolutePosition.position(), teleportTarget.newLevel().getWorld(), absolutePosition.yRot(), absolutePosition.xRot());
|
||||
- EntityTeleportEvent teleEvent = CraftEventFactory.callEntityTeleportEvent(this, to);
|
||||
- if (teleEvent.isCancelled()) {
|
||||
+ // Paper start - gateway-specific teleport event
|
||||
|
@ -26,4 +26,4 @@ index 946f289e0e681524c6fde696921965dbdedda372..d6017d9d71fb4b3a3df6eaa44da0ebda
|
|||
+ if (teleEvent.isCancelled() || teleEvent.getTo() == null) {
|
||||
return null;
|
||||
}
|
||||
to = teleEvent.getTo();
|
||||
if (!to.equals(teleEvent.getTo())) {
|
|
@ -6,10 +6,10 @@ Subject: [PATCH] Unset Ignited flag on cancel of Explosion Event
|
|||
Otherwise the creeper infinite explodes
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Creeper.java b/src/main/java/net/minecraft/world/entity/monster/Creeper.java
|
||||
index 39486215ac080220a6018a35a8437092dbc8fe9d..95df4ac539ec284654c53d39955870a46478c27d 100644
|
||||
index 31405c3a95e8e8217a6efede1e4599c14583081f..0552cc23391ec305754339d000630ccab0729100 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Creeper.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Creeper.java
|
||||
@@ -278,6 +278,7 @@ public class Creeper extends Monster implements PowerableMob {
|
||||
@@ -278,6 +278,7 @@ public class Creeper extends Monster {
|
||||
// CraftBukkit start
|
||||
} else {
|
||||
this.swell = 0;
|
|
@ -21,10 +21,10 @@ check is essentially the same as this.getHandle() == other.getHandle()
|
|||
However, replaced it too to make it clearer of intent.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
index 69b5946625a53a1351ffc4bdf61c6874949bbeae..bddf98bdf60473eb1d2e533cf533ed7eee797aaa 100644
|
||||
index 0480fbeffd19011d3cd63021225f376c464b480c..0e5cc680ee2418ec2af5fc3e215618ad4e768ed0 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
@@ -502,14 +502,15 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
@@ -503,14 +503,15 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
return false;
|
||||
}
|
||||
final CraftEntity other = (CraftEntity) obj;
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] Print Error details when failing to save player data
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java
|
||||
index e11c8523e633d2a8e3cea7ecd54978b2958b9684..1d287dd7379e56f7fd4b425880b850cd843f5789 100644
|
||||
index cd013567dd6224c86c0f1813d8a3d5fb7b8cabb5..b54a3741cd3ba615c83c98985cb4b3c4c586ed7a 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java
|
||||
@@ -47,7 +47,7 @@ public class PlayerDataStorage {
|
|
@ -5,17 +5,17 @@ Subject: [PATCH] Make shield blocking delay configurable
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 7a7c404778757e6778305c9f8334a4fba1f466a6..d58439f85f4d3a9b863ecadb3b42b2ee3270a772 100644
|
||||
index 76b71af07a311bc415b36f517afab31505a14483..0a4d2abc5b70c5e4e93dc06fe112e2398d9916e7 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -3969,12 +3969,24 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -4103,12 +4103,24 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
if (this.isUsingItem() && !this.useItem.isEmpty()) {
|
||||
Item item = this.useItem.getItem();
|
||||
|
||||
- return item.getUseAnimation(this.useItem) != UseAnim.BLOCK ? false : item.getUseDuration(this.useItem, this) - this.useItemRemaining >= 5;
|
||||
+ return item.getUseAnimation(this.useItem) != UseAnim.BLOCK ? false : item.getUseDuration(this.useItem, this) - this.useItemRemaining >= getShieldBlockingDelay(); // Paper - Make shield blocking delay configurable
|
||||
- return item.getUseAnimation(this.useItem) != ItemUseAnimation.BLOCK ? null : (item.getUseDuration(this.useItem, this) - this.useItemRemaining < 5 ? null : this.useItem);
|
||||
+ return item.getUseAnimation(this.useItem) != ItemUseAnimation.BLOCK ? null : (item.getUseDuration(this.useItem, this) - this.useItemRemaining < getShieldBlockingDelay() ? null : this.useItem); // Paper - Make shield blocking delay configurable
|
||||
} else {
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,10 +35,10 @@ index 7a7c404778757e6778305c9f8334a4fba1f466a6..d58439f85f4d3a9b863ecadb3b42b2ee
|
|||
return this.isShiftKeyDown();
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
index 7a01569f62b3b27a9eb6def0e2ec72e1d392258d..73c72b8cdece357193afb3c5f474e055086311ea 100644
|
||||
index 452fe788152f7c38ab4b6c627e3ba37da3d9b9d9..e5186fbd4030d7b39443090b711e855dcbc39426 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
@@ -853,5 +853,15 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
@@ -873,5 +873,15 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
public void setArrowsStuck(final int arrows) {
|
||||
this.getHandle().setArrowCount(arrows);
|
||||
}
|
45
patches/server/0199-Improve-EntityShootBowEvent.patch
Normal file
45
patches/server/0199-Improve-EntityShootBowEvent.patch
Normal file
|
@ -0,0 +1,45 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sat, 15 Jun 2013 19:51:17 -0400
|
||||
Subject: [PATCH] Improve EntityShootBowEvent
|
||||
|
||||
Adds missing call to Illagers and also adds Arrow ItemStack to skeletons
|
||||
|
||||
== AT ==
|
||||
public net.minecraft.world.entity.projectile.AbstractArrow getPickupItem()Lnet.minecraft.world.item.ItemStack;
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
||||
index b16979ae9ad9636d91d3f2cd80baf01250ec534d..8f63e27d904abb33492daf627d48d33d1193deef 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
||||
@@ -208,7 +208,7 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
|
||||
|
||||
if (world instanceof ServerLevel worldserver) {
|
||||
// CraftBukkit start
|
||||
- org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getMainHandItem(), null, entityarrow, net.minecraft.world.InteractionHand.MAIN_HAND, 0.8F, true);
|
||||
+ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getMainHandItem(), entityarrow.getPickupItem(), entityarrow, net.minecraft.world.InteractionHand.MAIN_HAND, 0.8F, true); // Paper - improve entity shhot bow event - add arrow stack to event
|
||||
if (event.isCancelled()) {
|
||||
event.getProjectile().remove();
|
||||
return;
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Illusioner.java b/src/main/java/net/minecraft/world/entity/monster/Illusioner.java
|
||||
index 60388ab18d7a4ecb235e54ecfdb4088b690a6178..db3aac9ba711dcd18ffc35c4a745ecaec89d0166 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Illusioner.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Illusioner.java
|
||||
@@ -184,7 +184,17 @@ public class Illusioner extends SpellcasterIllager implements RangedAttackMob {
|
||||
Level world = this.level();
|
||||
|
||||
if (world instanceof ServerLevel worldserver) {
|
||||
+ // Paper start - EntityShootBowEvent
|
||||
+ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getMainHandItem(), entityarrow.getPickupItem(), entityarrow, target.getUsedItemHand(), 0.8F, true);
|
||||
+ if (event.isCancelled()) {
|
||||
+ event.getProjectile().remove();
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (event.getProjectile() == entityarrow.getBukkitEntity()) {
|
||||
Projectile.spawnProjectileUsingShoot(entityarrow, worldserver, itemstack1, d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - worldserver.getDifficulty().getId() * 4));
|
||||
+ }
|
||||
+ // Paper end - EntityShootBowEvent
|
||||
}
|
||||
|
||||
this.playSound(SoundEvents.SKELETON_SHOOT, 1.0F, 1.0F / (this.getRandom().nextFloat() * 0.4F + 0.8F));
|
|
@ -1,30 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Wed, 16 May 2018 20:44:58 -0400
|
||||
Subject: [PATCH] WitchThrowPotionEvent
|
||||
|
||||
Fired when a witch throws a potion at a player
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Witch.java b/src/main/java/net/minecraft/world/entity/monster/Witch.java
|
||||
index f9cd71379a1d195731e7348ac6928372a4b2c29c..a14e00d55930628333cc63b18727ea56dbdc4ee3 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Witch.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Witch.java
|
||||
@@ -230,9 +230,16 @@ public class Witch extends Raider implements RangedAttackMob {
|
||||
holder = Potions.WEAKNESS;
|
||||
}
|
||||
|
||||
+ // Paper start - WitchThrowPotionEvent
|
||||
+ ItemStack potion = PotionContents.createItemStack(Items.SPLASH_POTION, holder);
|
||||
+ com.destroystokyo.paper.event.entity.WitchThrowPotionEvent event = new com.destroystokyo.paper.event.entity.WitchThrowPotionEvent((org.bukkit.entity.Witch) this.getBukkitEntity(), (org.bukkit.entity.LivingEntity) target.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(potion));
|
||||
+ if (!event.callEvent()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ potion = org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getPotion());
|
||||
ThrownPotion entitypotion = new ThrownPotion(this.level(), this);
|
||||
-
|
||||
- entitypotion.setItem(PotionContents.createItemStack(Items.SPLASH_POTION, holder));
|
||||
+ entitypotion.setItem(potion);
|
||||
+ // Paper end - WitchThrowPotionEvent
|
||||
entitypotion.setXRot(entitypotion.getXRot() - -20.0F);
|
||||
entitypotion.shoot(d0, d1 + d3 * 0.2D, d2, 0.75F, 8.0F);
|
||||
if (!this.isSilent()) {
|
|
@ -1,51 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Tue, 5 Jun 2018 23:00:29 -0400
|
||||
Subject: [PATCH] ItemStack#getMaxItemUseDuration
|
||||
|
||||
Allows you to determine how long it takes to use a usable/consumable item
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
||||
index 6c76aeddb34239a5acc204a17b2aa2d80e6b2c88..e8a455eb5e17bcfcae3f03664f2b47773fbdf37e 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
||||
@@ -7,14 +7,17 @@ import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.component.DataComponentPatch;
|
||||
import net.minecraft.core.component.DataComponents;
|
||||
import net.minecraft.world.item.Item;
|
||||
+import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.item.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.world.item.enchantment.ItemEnchantments;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.serialization.DelegateDeserialization;
|
||||
import org.bukkit.craftbukkit.enchantments.CraftEnchantment;
|
||||
+import org.bukkit.craftbukkit.entity.CraftLivingEntity;
|
||||
import org.bukkit.craftbukkit.util.CraftLegacy;
|
||||
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
+import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.material.MaterialData;
|
||||
@@ -210,6 +213,21 @@ public final class CraftItemStack extends ItemStack {
|
||||
return (this.handle == null) ? Material.AIR.getMaxStackSize() : this.handle.getMaxStackSize();
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public int getMaxItemUseDuration(final LivingEntity entity) {
|
||||
+ if (handle == null) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ // Make sure plugins calling the old method don't blow up
|
||||
+ if (entity == null && handle.is(Items.CROSSBOW)) {
|
||||
+ throw new UnsupportedOperationException("This item requires an entity to determine the max use duration");
|
||||
+ }
|
||||
+ return handle.getUseDuration(entity != null ? ((CraftLivingEntity) entity).getHandle() : null);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Override
|
||||
public void addUnsafeEnchantment(Enchantment ench, int level) {
|
||||
Preconditions.checkArgument(ench != null, "Enchantment cannot be null");
|
|
@ -1,47 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sat, 15 Jun 2013 19:51:17 -0400
|
||||
Subject: [PATCH] Improve EntityShootBowEvent
|
||||
|
||||
Adds missing call to Illagers and also adds Arrow ItemStack to skeletons
|
||||
|
||||
== AT ==
|
||||
public net.minecraft.world.entity.projectile.AbstractArrow getPickupItem()Lnet.minecraft.world.item.ItemStack;
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
||||
index 1bf013a10502395d9f432f80c517d5c9a50f5eab..aec440d32eb97fa8ce738b98dae1cdc346e8a59b 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
|
||||
@@ -205,7 +205,7 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
|
||||
|
||||
entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.level().getDifficulty().getId() * 4));
|
||||
// CraftBukkit start
|
||||
- org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getMainHandItem(), null, entityarrow, net.minecraft.world.InteractionHand.MAIN_HAND, 0.8F, true);
|
||||
+ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getMainHandItem(), entityarrow.getPickupItem(), entityarrow, net.minecraft.world.InteractionHand.MAIN_HAND, 0.8F, true); // Paper
|
||||
if (event.isCancelled()) {
|
||||
event.getProjectile().remove();
|
||||
return;
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Illusioner.java b/src/main/java/net/minecraft/world/entity/monster/Illusioner.java
|
||||
index 93e3454de0b0d62895f165b0772526f3eae1e333..c858556ea457931aa14e338e20672cb50cb19f0e 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Illusioner.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Illusioner.java
|
||||
@@ -185,8 +185,18 @@ public class Illusioner extends SpellcasterIllager implements RangedAttackMob {
|
||||
double d3 = Math.sqrt(d0 * d0 + d2 * d2);
|
||||
|
||||
entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.level().getDifficulty().getId() * 4));
|
||||
+ // Paper start - EntityShootBowEvent
|
||||
+ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getMainHandItem(), entityarrow.getPickupItem(), entityarrow, target.getUsedItemHand(), 0.8F, true);
|
||||
+ if (event.isCancelled()) {
|
||||
+ event.getProjectile().remove();
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (event.getProjectile() == entityarrow.getBukkitEntity()) {
|
||||
+ this.level().addFreshEntity(entityarrow);
|
||||
+ }
|
||||
+ // Paper end - EntityShootBowEvent
|
||||
this.playSound(SoundEvents.SKELETON_SHOOT, 1.0F, 1.0F / (this.getRandom().nextFloat() * 0.4F + 0.8F));
|
||||
- this.level().addFreshEntity(entityarrow);
|
||||
}
|
||||
|
||||
@Override
|
Loading…
Reference in a new issue