mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-09 11:44:19 +01:00
65bc2541a3
By: md_5 <git@md-5.net>
64 lines
3.8 KiB
Diff
64 lines
3.8 KiB
Diff
--- a/net/minecraft/world/entity/animal/EntityCat.java
|
|
+++ b/net/minecraft/world/entity/animal/EntityCat.java
|
|
@@ -182,10 +182,10 @@
|
|
@Override
|
|
public void readAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
|
super.readAdditionalSaveData(nbttagcompound);
|
|
- Optional optional = Optional.ofNullable(MinecraftKey.tryParse(nbttagcompound.getString("variant"))).map((minecraftkey) -> {
|
|
+ Optional<ResourceKey<CatVariant>> optional = Optional.ofNullable(MinecraftKey.tryParse(nbttagcompound.getString("variant"))).map((minecraftkey) -> { // CraftBukkit - decompile error
|
|
return ResourceKey.create(Registries.CAT_VARIANT, minecraftkey);
|
|
});
|
|
- IRegistry iregistry = BuiltInRegistries.CAT_VARIANT;
|
|
+ IRegistry<CatVariant> iregistry = BuiltInRegistries.CAT_VARIANT; // CraftBukkit - decompile error
|
|
|
|
Objects.requireNonNull(iregistry);
|
|
optional.flatMap(iregistry::getHolder).ifPresent(this::setVariant);
|
|
@@ -462,7 +462,7 @@
|
|
}
|
|
|
|
private void tryToTame(EntityHuman entityhuman) {
|
|
- if (this.random.nextInt(3) == 0) {
|
|
+ if (this.random.nextInt(3) == 0 && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled()) { // CraftBukkit
|
|
this.tame(entityhuman);
|
|
this.setOrderedToSit(true);
|
|
this.level().broadcastEntityEvent(this, (byte) 7);
|
|
@@ -480,7 +480,7 @@
|
|
private static class PathfinderGoalTemptChance extends PathfinderGoalTempt {
|
|
|
|
@Nullable
|
|
- private EntityHuman selectedPlayer;
|
|
+ private EntityLiving selectedPlayer; // CraftBukkit
|
|
private final EntityCat cat;
|
|
|
|
public PathfinderGoalTemptChance(EntityCat entitycat, double d0, Predicate<ItemStack> predicate, boolean flag) {
|
|
@@ -621,7 +621,15 @@
|
|
while (iterator.hasNext()) {
|
|
ItemStack itemstack = (ItemStack) iterator.next();
|
|
|
|
- this.cat.level().addFreshEntity(new EntityItem(this.cat.level(), (double) blockposition_mutableblockposition.getX() - (double) MathHelper.sin(this.cat.yBodyRot * 0.017453292F), (double) blockposition_mutableblockposition.getY(), (double) blockposition_mutableblockposition.getZ() + (double) MathHelper.cos(this.cat.yBodyRot * 0.017453292F), itemstack));
|
|
+ // CraftBukkit start
|
|
+ EntityItem entityitem = new EntityItem(this.cat.level(), (double) blockposition_mutableblockposition.getX() - (double) MathHelper.sin(this.cat.yBodyRot * 0.017453292F), (double) blockposition_mutableblockposition.getY(), (double) blockposition_mutableblockposition.getZ() + (double) MathHelper.cos(this.cat.yBodyRot * 0.017453292F), itemstack);
|
|
+ org.bukkit.event.entity.EntityDropItemEvent event = new org.bukkit.event.entity.EntityDropItemEvent(this.cat.getBukkitEntity(), (org.bukkit.entity.Item) entityitem.getBukkitEntity());
|
|
+ entityitem.level().getCraftServer().getPluginManager().callEvent(event);
|
|
+ if (event.isCancelled()) {
|
|
+ continue;
|
|
+ }
|
|
+ this.cat.level().addFreshEntity(entityitem);
|
|
+ // CraftBukkit end
|
|
}
|
|
|
|
}
|
|
@@ -653,10 +661,10 @@
|
|
private final EntityCat cat;
|
|
|
|
public a(EntityCat entitycat, Class<T> oclass, float f, double d0, double d1) {
|
|
- Predicate predicate = IEntitySelector.NO_CREATIVE_OR_SPECTATOR;
|
|
+ // Predicate predicate = IEntitySelector.NO_CREATIVE_OR_SPECTATOR; // CraftBukkit - decompile error
|
|
|
|
- Objects.requireNonNull(predicate);
|
|
- super(entitycat, oclass, f, d0, d1, predicate::test);
|
|
+ // Objects.requireNonNull(predicate); // CraftBukkit - decompile error
|
|
+ super(entitycat, oclass, f, d0, d1, IEntitySelector.NO_CREATIVE_OR_SPECTATOR::test); // CraftBukkit - decompile error
|
|
this.cat = entitycat;
|
|
}
|
|
|