Commit graph

5685 commits

Author SHA1 Message Date
Warrior
b5cda1d98f Add getChunkSnapshot includeLightData parameter 2024-02-10 10:03:48 +01:00
Yannick Lamprecht
a2bbaf6744 ItemStack Tooltip API 2024-01-22 13:27:30 +01:00
Jake Potrebic
ef5bac21b2 Add Lifecycle Event system
This event system is separate from Bukkit's event system and is
meant for managing resources across reloads and from points in the
PluginBootstrap.
2023-07-18 17:49:38 -07:00
Luis
e5c2af7f5e Add api for spawn egg texture colors 2024-01-11 19:58:23 +01:00
Chase Henderson
0b0012faf2 Add ShulkerDuplicateEvent 2024-01-05 03:50:10 -05:00
Jake Potrebic
597ce940a4 Add PlayerTradeEvent and PlayerPurchaseEvent
Co-authored-by: Alexander <protonull@protonmail.com>
2020-07-02 16:12:10 -07:00
Spottedleaf
46c2fbfb74 Reduce allocation of Vec3D by entity tracker 2020-04-27 00:04:16 -07:00
FireInstall
0449ede4a6 Expose LootTable of DecoratedPot 2024-01-20 16:20:06 +01:00
Nassim Jahnke
898bf90054 Fixup NamespacedKey handling 2024-01-06 14:31:00 +01:00
Owen1212055
21837e419b Properly handle experience dropping on block break
This causes spawnAfterBreak to spawn xp by default, removing the need to manually add xp wherever this method is used.
For classes that use custom xp amounts, they can drop the resources with disabling
2023-12-30 15:00:06 -05:00
Nassim Jahnke
2506babe8e Validate ResourceLocation in NBT reading 2024-01-04 13:49:14 +01:00
Cryptite
b37ffd3a00 Add PlayerShieldDisableEvent
Called whenever a players shield is disabled. This is mainly caused by
attacking players or monsters that carry axes.

The event, while similar to the PlayerItemCooldownEvent, offers other
behaviour and can hence not be implemented as a childtype of said event.
Specifically, cancelling the event prevents the game events from being
sent to the player.

Plugins listening to just the PlayerItemCooldownEvent may not want said
sideeffects, meaning the disable event cannot share a handlerlist with
the cooldown event
2023-05-01 16:22:43 -05:00
Jake Potrebic
66ed50064c Add drops to shear events 2021-05-18 12:32:02 -07:00
Lukas Planz
57894618cf Add experience points API 2023-09-05 20:34:20 +02:00
Jake Potrebic
15fcde4b3c Fix NPE on null loc for EntityTeleportEvent
EntityTeleportEvent#setTo is marked as nullable and so is the
getTo method. This fixes the handling of a null "to" location
by treating it the same as the event being cancelled. This is
already existing behavior for the EntityPortalEvent (which
extends EntityTeleportEvent).
2023-12-09 19:15:59 -08:00
Jake Potrebic
5b1ab02f39 Improve Registry 2023-12-20 02:03:05 -08:00
Jake Potrebic
a264c42314 add more scoreboard API 2023-12-16 14:46:01 -08: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
Jake Potrebic
ddbfcd4403 Restore vanilla entity drops behavior
Instead of just tracking the itemstacks, this tracks with it, the
action to take with that itemstack to apply the correct logic
on dropping the item instead of generalizing it for all dropped
items like CB does.
2022-03-22 09:34:41 -07:00
hyper1423
ec3623bcc2 Fix CraftMetaItem#getAttributeModifier duplication check 2023-12-03 07:38:09 +09:00
Jake Potrebic
745260143e Add Structure check API 2023-03-27 10:20:00 -07:00
Jake Potrebic
fff5d44a12 Don't fire sync events during worldgen
Fixes EntityPotionEffectEvent
Fixes EntityPoseChangeEvent

Asynchronous chunk generation provides an opportunity for things
to happen async that previously fired synchronous-only events. This
patch is for mitigating those issues by various methods.

Also fixes correctly marking/clearing the entity generation flag.
This patch sets the generation flag anytime an entity is created
via StructureTemplate before loading from NBT to catch uses of
the flag during the loading logic. This patch clears the generation
flag from an entity when added to a ServerLevel for the situation
where generation happened directly to a ServerLevel and the
entity still has the flag set.
2023-11-23 10:33:25 -08:00
MrPowerGamerBR
5f134afc4b Lazily create LootContext for criterions
For each player on each tick, enter block triggers are invoked, and these create loot contexts that are promptly thrown away since the trigger doesn't pass the predicate

To avoid this, we now lazily create the LootContext if the criterion passes the predicate AND if any of the listener triggers require a loot context instance
2023-11-21 12:16:39 -03:00
booky10
4853ebd729 Fix missing event call for entity teleport API 2023-11-12 05:09:47 +01:00
TonytheMacaroni
c29a8dc160 Add UUID attribute modifier API 2023-11-09 20:34:44 -05:00
Jake Potrebic
d0b0b36801 Fix several issues with EntityBreedEvent
Upstream did not account for different hands when storing
the breed item for later use in the event. Also they only
stored a reference to the stack, not a copy so if the stack
changed after love mode was started, the breed item in the event
also changed. Also in several places, the breed item was stored after
it was decreased by one to consume the item.
2022-12-15 00:14:44 -08:00
booky10
ffa5164e4c Add hand to fish event for all player interactions 2023-07-03 01:55:32 +02:00
Tamion
cb16d3df2c Fix strikeLightningEffect powers lightning rods and clears copper 2023-09-30 12:36:14 +02:00
Tamion
e93201e90b Expand LingeringPotion API 2023-11-04 23:57:05 +01:00
booky10
b7be7d6807 Broadcast take item packets with collector as source
This fixes players (which can't view the collector) seeing item pickups with themselves as the target.
2023-10-29 02:36:10 +01:00
TonytheMacaroni
4866ee899b Add predicate for blocks when raytracing 2023-09-06 19:24:16 -04:00
TrollyLoki
d30ecac57d Add API to get the collision shape of a block before it's placed 2023-10-11 00:45:53 -04:00
astei
85e082a9b3 Optimize VarInts
https://github.com/PaperMC/Paper/pull/6957#issuecomment-985250854
2023-10-28 19:46:21 -04:00
David Scandurra
d1685ef68f Allow null itemstack for Player#sendEquipmentChange 2023-10-25 20:36:25 +02:00
Lulu13022002
93c87bedaf Fix NPE in SculkBloomEvent world access 2023-10-20 19:50:22 +02:00
Brokkonaut
a6ef388655 Don't check if we can see non-visible entities 2023-10-21 20:52:57 +01:00
booky10
2b6b81bde9 Add player idle duration API
Implements API for getting and resetting a player's idle duration.
2023-10-14 03:11:11 +02:00
LemonCaramel
de8998e411 Fix UnsafeValues#loadAdvancement 2023-09-24 20:19:44 +09:00
booky10
efc4457fa1 Update entity data when attaching firework to entity
== AT ==
public net.minecraft.world.entity.projectile.FireworkRocketEntity DATA_ATTACHED_TO_TARGET
2023-08-27 16:11:31 +02:00
Warrior
9f09c7a54d Fix missing map initialize event call
== AT ==
public net.minecraft.world.level.storage.DimensionDataStorage readSavedData(Ljava/util/function/Function;Lnet/minecraft/util/datafix/DataFixTypes;Ljava/lang/String;)Lnet/minecraft/world/level/saveddata/SavedData;
2023-09-24 18:35:28 +02:00
Jake Potrebic
48d9ecee25 Fix team sidebar objectives not being cleared
Objectives displayed in team sidebars were not cleared when switching
scoreboards. If a player's scoreboard has a displayed objective for the
'gold' sidebar, and their scoreboard was switched to one where they
still had a 'gold' team, it would still be displayed
2023-09-23 22:31:54 -07:00
Jake Potrebic
cfe07dca76 Fix NPE in AdvancementProgress#getDateAwarded 2023-09-23 22:07:15 -07:00
Spottedleaf
fa87f62891 Fix race condition on UpgradeData.BlockFixers class init
The CHUNKY_FIXERS field is modified during the constructors
of the BlockFixers, but the code that uses CHUNKY_FIXERS does
not properly ensure that BlockFixers has been initialised before
using it, leading to a possible race condition where instances of
BlockFixers are accessed before they have initialised correctly.

We can force the class to initialise fully before accessing the
field by calling any method on the class, and for convenience
we use values().
2023-08-08 17:29:33 -07:00
Owen1212055
d12a537299 Add missing logs for log-ips config option 2023-09-23 01:49:39 -04:00
Spottedleaf
65466558be Do not read tile entities in chunks that are positioned outside of the chunk
The tile entities are not accessible and so should not be loaded.
This can happen as a result of users moving regionfiles around,
which would cause a crash on Folia but would appear to function
fine on Paper.
2023-06-18 23:04:46 -07:00
Jake Potrebic
183683ecc5 Add missing InventoryHolders to inventories 2022-01-24 00:09:02 -08:00
The456gamer
a24a58dfab Fix spigot's Forced-Stats
moves the loading after vanilla loading, so it overrides the values.
disables saving any forced stats, so it stays at the same value (without enabling disableStatSaving)
fixes stat initialization to not cause a NullPointerException
2023-08-28 01:32:39 +01:00
Lulu13022002
bf607b1e23 Fix silent equipment change for mobs 2023-08-31 17:32:48 +02:00
Aeltumn
675028a699 Allow proper checking of empty item stacks 2023-08-28 13:44:09 +02:00
Warrior
d4ab21c047 Call BlockRedstoneEvents properly
Call BlockRedstoneEvents for lecterns.
Fix previous power level for experimental redstone wire.
2023-09-13 05:46:10 +02:00