Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-21 05:50:05 +01:00
103 Zeilen
5.0 KiB
Diff
103 Zeilen
5.0 KiB
Diff
--- a/net/minecraft/server/EntityFox.java
|
|
+++ b/net/minecraft/server/EntityFox.java
|
|
@@ -263,8 +263,8 @@
|
|
private List<UUID> eE() {
|
|
List<UUID> list = Lists.newArrayList();
|
|
|
|
- list.add(((Optional) this.datawatcher.get(EntityFox.FIRST_TRUSTED_PLAYER)).orElse((Object) null));
|
|
- list.add(((Optional) this.datawatcher.get(EntityFox.SECOND_TRUSTED_PLAYER)).orElse((Object) null));
|
|
+ list.add((this.datawatcher.get(EntityFox.FIRST_TRUSTED_PLAYER)).orElse(null)); // CraftBukkit - decompile error
|
|
+ list.add((this.datawatcher.get(EntityFox.SECOND_TRUSTED_PLAYER)).orElse(null)); // CraftBukkit - decompile error
|
|
return list;
|
|
}
|
|
|
|
@@ -397,7 +397,7 @@
|
|
protected void a(EntityItem entityitem) {
|
|
ItemStack itemstack = entityitem.getItemStack();
|
|
|
|
- if (this.g(itemstack)) {
|
|
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPickupItemEvent(this, entityitem, itemstack.getCount() - 1, !this.g(itemstack)).isCancelled()) { // CraftBukkit - call EntityPickupItemEvent
|
|
int i = itemstack.getCount();
|
|
|
|
if (i > 1) {
|
|
@@ -918,6 +918,11 @@
|
|
int i = (Integer) iblockdata.get(BlockSweetBerryBush.a);
|
|
|
|
iblockdata.set(BlockSweetBerryBush.a, 1);
|
|
+ // CraftBukkit start - call EntityChangeBlockEvent
|
|
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(EntityFox.this, this.e, iblockdata.set(BlockSweetBerryBush.a, 1)).isCancelled()) {
|
|
+ return;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
int j = 1 + EntityFox.this.world.random.nextInt(2) + (i == 3 ? 1 : 0);
|
|
ItemStack itemstack = EntityFox.this.getEquipment(EnumItemSlot.MAINHAND);
|
|
|
|
@@ -957,7 +962,7 @@
|
|
private int f;
|
|
|
|
public r() {
|
|
- super(null);
|
|
+ super(); // CraftBukkit - decompile error
|
|
this.a(EnumSet.of(PathfinderGoal.Type.MOVE, PathfinderGoal.Type.LOOK));
|
|
}
|
|
|
|
@@ -1009,7 +1014,7 @@
|
|
private int c;
|
|
|
|
public t() {
|
|
- super(null);
|
|
+ super(); // CraftBukkit - decompile error
|
|
this.c = EntityFox.this.random.nextInt(140);
|
|
this.a(EnumSet.of(PathfinderGoal.Type.MOVE, PathfinderGoal.Type.LOOK, PathfinderGoal.Type.JUMP));
|
|
}
|
|
@@ -1120,7 +1125,7 @@
|
|
private EntityLiving k;
|
|
private int l;
|
|
|
|
- public a(Class oclass, boolean flag, boolean flag1, Predicate predicate) {
|
|
+ public a(Class oclass, boolean flag, boolean flag1, Predicate<EntityLiving> predicate) { // CraftBukkit - decompile error
|
|
super(EntityFox.this, oclass, 10, flag, flag1, predicate);
|
|
}
|
|
|
|
@@ -1155,7 +1160,7 @@
|
|
|
|
@Override
|
|
public void c() {
|
|
- EntityFox.this.setGoalTarget(this.j);
|
|
+ EntityFox.this.setGoalTarget(this.j, org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_OWNER, true); // CraftBukkit
|
|
this.c = this.j;
|
|
if (this.k != null) {
|
|
this.l = this.k.cI();
|
|
@@ -1199,6 +1204,14 @@
|
|
if (entityplayer1 != null && entityplayer != entityplayer1) {
|
|
entityfox.b(entityplayer1.getUniqueID());
|
|
}
|
|
+ // CraftBukkit start - call EntityBreedEvent
|
|
+ int experience = this.animal.getRandom().nextInt(7) + 1;
|
|
+ org.bukkit.event.entity.EntityBreedEvent entityBreedEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityBreedEvent(entityfox, animal, partner, entityplayer, this.animal.breedItem, experience);
|
|
+ if (entityBreedEvent.isCancelled()) {
|
|
+ return;
|
|
+ }
|
|
+ experience = entityBreedEvent.getExperience();
|
|
+ // CraftBukkit end
|
|
|
|
if (entityplayer2 != null) {
|
|
entityplayer2.a(StatisticList.ANIMALS_BRED);
|
|
@@ -1213,10 +1226,14 @@
|
|
this.partner.resetLove();
|
|
entityfox.setAgeRaw(-24000);
|
|
entityfox.setPositionRotation(this.animal.locX(), this.animal.locY(), this.animal.locZ(), 0.0F, 0.0F);
|
|
- this.b.addEntity(entityfox);
|
|
+ this.b.addEntity(entityfox, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - added SpawnReason
|
|
this.b.broadcastEntityEffect(this.animal, (byte) 18);
|
|
if (this.b.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) {
|
|
- this.b.addEntity(new EntityExperienceOrb(this.b, this.animal.locX(), this.animal.locY(), this.animal.locZ(), this.animal.getRandom().nextInt(7) + 1));
|
|
+ // CraftBukkit start - use event experience
|
|
+ if (experience > 0) {
|
|
+ this.b.addEntity(new EntityExperienceOrb(this.b, this.animal.locX(), this.animal.locY(), this.animal.locZ(), experience));
|
|
+ }
|
|
+ // CraftBukkit end
|
|
}
|
|
|
|
}
|