Commit Graph

58 Commits

Author SHA1 Message Date
Noah van der Aa 5eb4ceb6a4 net.minecraft.world.item.enchantment 2024-12-14 14:40:36 +01:00
Jake Potrebic fe1744dfd1 net.minecraft.world.item.alchemy 2024-12-13 16:02:20 -08:00
Nassim Jahnke aa998246f7 More work 2024-12-13 18:40:56 +01:00
Nassim Jahnke 45ddf764d9 Move patches to unapplied 2024-12-12 12:30:31 +01:00
Owen1212055 d300c94ec2 Properly resend entities
This resolves some issues which caused entities to not be resent correctly.
Entities that are interacted with need to be resent to the client, so we resend all the entity
data to the player whilst making sure not to clear dirty entries from the tracker. This makes
sure that values will be correctly updated to other players.

This also adds utilities to aid in further preventing entity desyncs.

This also also fixes the bug causing cancelling PlayerInteractEvent to cause items to continue
to be used despite being cancelled on the server.

For example, items being consumed but never finishing, shields being put up, etc.
The underlying issue of this is that the client modifies their synced data values,
and so we have to (forcibly) resend them in order for the client to reset their using item state.

See: https://github.com/PaperMC/Paper/pull/1896

== AT ==
public net.minecraft.server.level.ChunkMap$TrackedEntity serverEntity
2022-12-07 17:25:19 -05:00
Jake Potrebic 9467a08b36 Improve performance of RecipeMap#removeRecipe 2024-10-31 20:36:41 -07:00
masmc05 1cd7fd4eec Item serialization as json 2024-08-11 03:01:52 +03:00
Tamion 276e09c3b0 Fix cancelling BlockPlaceEvent calling onRemove 2024-05-23 11:02:20 +02:00
Jake Potrebic 5d843f3120 Fix issues with Recipe API 2024-05-12 15:49:36 -07:00
Jake Potrebic 31725bc039 General ItemMeta fixes
== AT ==
private-f net/minecraft/world/item/ItemStack components
public net/minecraft/world/food/FoodProperties DEFAULT_EAT_SECONDS
public org/bukkit/craftbukkit/block/CraftBlockStates getBlockState(Lorg/bukkit/World;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/block/entity/BlockEntity;)Lorg/bukkit/craftbukkit/block/CraftBlockState;
public net/minecraft/world/level/block/entity/BlockEntity saveId(Lnet/minecraft/nbt/CompoundTag;)V

Co-authored-by: GhastCraftHD <julius.gruenberg@leghast.de>
2024-04-27 20:56:17 -07:00
Aikar 3844905fa8 Support old UUID format for NBT
We have stored UUID in plenty of places that did not get DFU'd

So just look for old format and load it if it exists.
2020-06-29 03:26:17 -04:00
Jake Potrebic 597ce940a4 Add PlayerTradeEvent and PlayerPurchaseEvent
Co-authored-by: Alexander <protonull@protonmail.com>
2020-07-02 16:12:10 -07:00
Owen1212055 893616e851 Dont resend blocks on interactions
In general, the client now has an acknowledgment system which will prevent block changes made by the client to be reverted correctly.

It should be noted that this system does not yet support block entities, so those still need to resynced when needed.
2023-06-27 21:09:11 -04:00
booky10 ffa5164e4c Add hand to fish event for all player interactions 2023-07-03 01:55:32 +02:00
Martijn Muijsers cdc3b28062 Do crystal-portal proximity check before entity lookup
This adds a very cheap distance check when an end crystal is placed.

Attempting to respawn the dragon, which involves looking up the end crystal
entities near the portal, every time an end crystal is placed, can be slow on
some servers that have players placing end crystals as a style of combat.

The very cheap distance check prevents running the entity lookup every time.
2023-08-15 21:04:55 +02:00
Jake Potrebic 7dcff24771 Fix slot desync
General patch fixing slot desyncs between the server and client that
result from cancelled events/paper introduced logic.

Co-authored-by: Minecrell <minecrell@minecrell.net>
Co-authored-by: Newwind <support@newwindserver.com>
2023-08-23 13:22:09 -07:00
The456gamer 8b97b13142 Expose hand in BlockCanBuildEvent 2023-08-21 14:13:42 +01:00
Jake Potrebic 36ae0bcfea Only capture actual tree growth 2021-08-21 18:53:03 -07:00
by77er 6702fe7546 Add event for player editing sign 2023-06-12 12:56:46 -04:00
Owen1212055 f1735f4440 Fix spigot sound playing for BlockItem ItemStacks 2023-06-08 20:23:13 -04:00
Lulu13022002 439ca99331 Fix block place logic
Fix several issues when a player interact with a block:
* the place sound isn't played for the dispensed shulker block
* desync of the jukebox blocks between bukkit handler and the vanilla interaction
* poi can desync when the BlockPhysicsEvent is cancelled
2023-04-03 18:46:49 +02:00
Jake Potrebic 4a416ca85a ItemStack damage API
Adds methods notify clients about item breaks and
to simulate damage done to an itemstack and all
the logic associated with damaging them

== AT ==
public net.minecraft.world.entity.LivingEntity entityEventForEquipmentBreak(Lnet/minecraft/world/entity/EquipmentSlot;)B
2022-05-08 13:35:45 -07:00
Jake Potrebic 75c623590f Fire EntityChangeBlockEvent in more places
Co-authored-by: ChristopheG <61288881+chrisgdt@users.noreply.github.com>
Co-authored-by: maxcom1 <46265094+maxcom1@users.noreply.github.com>
2021-08-09 20:45:46 -07:00
Jake Potrebic ce5660a8e9 Add various missing EntityDropItemEvent calls 2021-07-20 21:35:47 -07:00
Nassim Jahnke 1be6fca1f1 Disable component selector resolving in books by default 2022-06-02 20:35:58 +02:00
HexedHero bc02501cc2 Expand PlayerItemDamageEvent 2022-04-10 06:26:32 +01:00
Jake Potrebic 0b5d7ad8d6 Custom Potion Mixes
== AT ==
public-f net.minecraft.server.MinecraftServer potionBrewing
2021-10-07 14:34:55 -07:00
Jake Potrebic 140e68625c Fix cancelled powdered snow bucket placement
Cancelling the placement of powdered snow from the powdered
snow bucket didn't revert grass that became snowy because of the
placement.
2021-10-08 13:12:58 -07:00
Nassim Jahnke cbe94e7657 Reset placed block on exception 2022-01-07 11:45:15 +01:00
Jake Potrebic 65ec6cf342 Option to prevent data components copy in smithing recipes 2021-09-26 12:57:28 -07:00
Jake Potrebic 826dc5744d Add EntityDamageItemEvent 2020-12-22 13:52:48 -08:00
Jake Potrebic e86b844e04 Fix PlayerBucketEmptyEvent result itemstack
Fixes SPIGOT-2560: https://hub.spigotmc.org/jira/projects/SPIGOT/issues/SPIGOT-2560
2021-05-20 22:16:37 -07:00
Jake Potrebic 000882670b Add PlayerNameEntityEvent 2020-07-05 00:33:54 -07:00
JRoy e793c7d8be Add EntityLoadCrossbowEvent 2020-10-07 12:04:01 -04:00
BrodyBeckwith 870ed90a9a Allow disabling mob spawner spawn egg transformation 2020-10-09 20:30:12 -04:00
Nassim Jahnke d1d54d35bf Add PlayerItemCooldownEvent 2020-08-25 13:48:33 +02:00
Mariell Hoversholm 8bac10ce5e Add ignore discounts API 2020-11-09 20:44:51 +01:00
Aikar 6815064398 Use seed based lookup for Treasure Maps - Fixes lag from carto/sunken maps 2020-06-07 19:25:13 -04:00
Phoenix616 1631c7e251 Maps shouldn't load chunks
Previously maps would load all chunks in a certain radius depending on
 their scale when trying to update their content. This would result in
 main thread chunk loads when they weren't really necessary, especially
 on low view distances or "slow" async chunk loads after teleports or
 other prioritisation.

 This changes it to only try to render already loaded chunks based on
 the assumption that the chunks around the player will get loaded
 eventually anyways and that maps will get checked for update every
 five ticks that movement occur in anyways.
2020-06-07 21:43:42 +01:00
chickeneer 2898b4a7eb Fix villager trading demand - MC-163962
Prevent demand from going negative and tending to negative infinity
2020-06-05 20:02:04 -05:00
Aikar 54b44d1f1c Prevent various interactions from causing chunk loads
Co-authored-by: Shane Freeder <theboyetronic@gmail.com>
2018-09-10 23:56:36 -04:00
BillyGalbreath ca341c9de8 Allow chests to be placed with NBT data 2018-09-08 18:43:31 -05:00
Aikar 223c6c3b5a Remove unnecessary itemmeta handling 2016-11-22 00:40:42 -05:00
Hugo Manrique 510b8187c7 Vanished players don't have rights 2018-07-23 14:22:26 +02:00
BillyGalbreath 925d397466 PlayerLaunchProjectileEvent 2018-07-21 03:11:03 -05:00
BillyGalbreath a949eef7aa PlayerElytraBoostEvent 2018-07-21 01:59:59 -05:00
Aikar 4f248b1b5b Fill Profile Property Events
Allows plugins to populate profile properties from local sources to avoid calls out to Mojang API
to fill in textures for example.

If Mojang API does need to be hit, event fire so you can get the results.

This is useful for implementing a ProfileCache for Player Skulls
2018-01-02 00:31:26 -05:00
Aikar 746f540e81 Firework API's
== AT ==
public net.minecraft.world.entity.projectile.FireworkRocketEntity attachedToEntity
2016-12-28 07:18:33 +01:00
Jake Potrebic 08698c4642 Fix global sound handling
* Only send global sounds to same world if limiting radius
* respect global sound events gamerule

Co-authored-by: Evan McCarthy <evanmccarthy@outlook.com>
Co-authored-by: lexikiq <noellekiq@gmail.com>
Co-authored-by: Aikar <aikar@aikar.co>
2016-05-31 22:53:50 -04:00
Aikar 20b9d3de7b Handle Item Meta Inconsistencies
First, Enchantment order would blow away seeing 2 items as the same,
however the Client forces enchantment list in a certain order, as well
as does the /enchant command. Anvils can insert it into forced order,
causing 2 same items to be considered different.

This change makes unhandled NBT Tags and Enchantments use a sorted tree map,
so they will always be in a consistent order.

Additionally, the old enchantment API was never updated when ItemMeta
was added, resulting in 2 different ways to modify an items enchantments.

For consistency, the old API methods now forward to use the
ItemMeta API equivalents, and should deprecate the old API's.
2015-05-28 23:00:19 -04:00