2021-03-15 23:00:00 +01:00
|
|
|
--- a/net/minecraft/world/item/ItemEgg.java
|
|
|
|
+++ b/net/minecraft/world/item/ItemEgg.java
|
2024-04-23 17:15:00 +02:00
|
|
|
@@ -22,14 +22,22 @@
|
2021-11-21 23:00:00 +01:00
|
|
|
public InteractionResultWrapper<ItemStack> use(World world, EntityHuman entityhuman, EnumHand enumhand) {
|
|
|
|
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
|
2020-01-28 06:22:09 +01:00
|
|
|
|
2021-11-21 23:00:00 +01:00
|
|
|
- world.playSound((EntityHuman) null, entityhuman.getX(), entityhuman.getY(), entityhuman.getZ(), SoundEffects.EGG_THROW, SoundCategory.PLAYERS, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F));
|
|
|
|
+ // world.playSound((EntityHuman) null, entityhuman.getX(), entityhuman.getY(), entityhuman.getZ(), SoundEffects.EGG_THROW, SoundCategory.PLAYERS, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F)); // CraftBukkit - moved down
|
2020-01-28 06:22:09 +01:00
|
|
|
if (!world.isClientSide) {
|
|
|
|
EntityEgg entityegg = new EntityEgg(world, entityhuman);
|
|
|
|
|
|
|
|
entityegg.setItem(itemstack);
|
2021-11-21 23:00:00 +01:00
|
|
|
entityegg.shootFromRotation(entityhuman, entityhuman.getXRot(), entityhuman.getYRot(), 0.0F, 1.5F, 1.0F);
|
|
|
|
- world.addFreshEntity(entityegg);
|
2020-01-28 06:22:09 +01:00
|
|
|
+ // CraftBukkit start
|
2021-11-21 23:00:00 +01:00
|
|
|
+ if (!world.addFreshEntity(entityegg)) {
|
2021-03-15 23:00:00 +01:00
|
|
|
+ if (entityhuman instanceof net.minecraft.server.level.EntityPlayer) {
|
|
|
|
+ ((net.minecraft.server.level.EntityPlayer) entityhuman).getBukkitEntity().updateInventory();
|
2020-01-28 06:22:09 +01:00
|
|
|
+ }
|
|
|
|
+ return InteractionResultWrapper.fail(itemstack);
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
|
|
|
}
|
2021-11-21 23:00:00 +01:00
|
|
|
+ world.playSound((EntityHuman) null, entityhuman.getX(), entityhuman.getY(), entityhuman.getZ(), SoundEffects.EGG_THROW, SoundCategory.PLAYERS, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F));
|
2020-01-28 06:22:09 +01:00
|
|
|
|
2021-11-21 23:00:00 +01:00
|
|
|
entityhuman.awardStat(StatisticList.ITEM_USED.get(this));
|
2024-04-23 17:15:00 +02:00
|
|
|
itemstack.consume(1, entityhuman);
|