Commit graph

6103 commits

Author SHA1 Message Date
Owen1212055
25c25923e9 DataComponent API
Exposes the data component logic used by vanilla ItemStack to API
consumers as a version-specific API.
The types and methods introduced by this patch do not follow the general
API deprecation contracts and will be adapted to each new minecraft
release without backwards compatibility measures.

== AT ==
public net/minecraft/world/item/component/ItemContainerContents MAX_SIZE
public net/minecraft/world/item/component/ItemContainerContents items
2024-04-28 19:53:01 -04:00
Nassim Jahnke
2a20fde332 Add feature patch hook for overrides 2024-12-05 13:00:22 +01:00
Jake Potrebic
193eebecdf Tag Lifecycle Events
== AT ==
public net/minecraft/tags/TagEntry id
public net/minecraft/tags/TagEntry tag
public net/minecraft/tags/TagEntry required
2024-06-20 09:40:57 -07:00
Bjarne Koll
45d04f9749 Add registry entry and builders 2024-06-13 23:45:32 +02:00
Jake Potrebic
a1b891dd88 Registry Modification API
== AT ==
public net.minecraft.core.MappedRegistry validateWrite(Lnet/minecraft/resources/ResourceKey;)V
public net.minecraft.resources.RegistryOps lookupProvider
public net.minecraft.resources.RegistryOps$HolderLookupAdapter
2023-02-27 18:28:39 -08:00
MrPowerGamerBR
463f952cd4 Only attempt to find spawn position if there isn't a fixed spawn position set 2024-11-28 15:20:25 -03:00
kokiriglade
4bae091802 Expanded Art API 2024-11-23 18:58:49 +00:00
Kevin Raneri
b2d8133382 Configurable Entity Despawn Time 2024-09-30 09:50:55 -07:00
Abel
7294ae3022 API to allow/disallow tick sleeping 2024-11-12 22:25:20 +01:00
Abel
b4c394a1c6 API to check if the server is sleeping 2024-11-10 16:32:34 +01:00
Lulu13022002
7b83e91bb7 Fix NPE when EntityResurrectEvent is uncancelled 2024-11-18 20:27:58 +01:00
Bjarne Koll
c7c3d8a9cb Fix incorrect invulnerability damage reduction
Fixes incorrect spigot handling of the invulnerability damage
reduction applied when an already invulnerable entity is damaged with a
larger damage amount than the initial damage.
Vanilla still damages entities even if invulnerable if the damage to be
applied is larger than the previous damage taken. In that case, vanilla
applies the difference between the previous damage taken and the
proposed damage.

Spigot's damage modifier API takes over the computation of damage
reducing effects, however spigot invokes this handling with the initial
damage before computing the difference to the previous damage amount.
This leads to the reduction values to generally be larger than expected,
as they are computed on the not-yet-reduced value.
Spigot applies these reductions after calling the EntityDamageEvent and
*then* subtracts the previous damage point, leading to the final damage
amount being smaller than expected.

This patch cannot simply call the EntityDamageEvent with the reduced
damage, as that would lead to EntityDamageEvent#getDamage() returning
the already reduced damage, which breaks its method contract.
Instead, this patch makes use of the DamageModifier API, implementing
the last-damage-reduction as a DamageModifier.
2024-11-11 21:35:27 +01:00
Barnaby
318f7b2014 Reduce work done in CraftMapCanvas.drawImage by limiting size of image and using System.arraycopy instead of for loops and use bitwise operations to do bounds checks. 2024-06-29 12:06:51 +01:00
Jake Potrebic
9467a08b36 Improve performance of RecipeMap#removeRecipe 2024-10-31 20:36:41 -07:00
Gero
7acf73ce66 Call CraftPlayer#onEntityRemove for all online players 2024-11-09 22:27:58 +01:00
Bjarne Koll
66e1ce8504 Correct update cursor
Spigot uses a no longer valid ClientboundContainerSetSlotPacket with the
slot -1, which would update the carried stack in versions <=1.21.1 but
now leads to an IOOB.
1.21.2 instead introduced the ClientboundSetCursorItemPacket, which this
patch uses instead.
2024-11-01 14:58:57 +01:00
Jake Potrebic
b620df8e20 Fix inconsistencies in dispense events regarding stack size
The javadocs for BlockDispenseEvent suggest the ItemStack is a single
item which is being dispensed. Before this fix, sometimes it was the whole
stack before a single item had been taken. This fixes that so the stack size
is always 1.
2022-12-11 23:47:22 -08:00
Aikar
0d8c3dc008 Block Enderpearl Travel Exploit
Players are able to use alt accounts and enderpearls to travel
long distances utilizing the pearls in unloaded chunks and loading
the chunk later when convenient.

This disables that by not saving the thrower when the chunk is unloaded.

This is mainly useful for survival servers that do not allow freeform teleporting.

Note: Currently removed as enderpearls are ticked as long as their owner is online in 1.21.2.
Might be worth to re-add once an option to disable the above vanilla mechanic is added, to
fully prevent enderpearl travel exploits.

== AT ==
public net.minecraft.world.entity.projectile.Projectile ownerUUID
2018-04-30 17:15:26 -04:00
Jason Penilla
cf7a1191a9 Allow using old ender pearl behavior
When enabled, ender pearls will not load chunks and will save to the world instead of the player.

== AT ==
public net.minecraft.world.entity.projectile.Projectile cachedOwner
2024-10-27 12:36:53 -07:00
Jason Penilla
21f51ebd74 Avoid issues with certain tasks not processing during sleep
Execute processQueue tasks during sleep: needed for console tab completions, pre join event, etc.

Upstream has set precedent that the bukkit scheduler will still tick during sleep, which avoids some problems
with plugins not accounting for the new sleep feature, but can still lead to others. Because of this we have disabled
sleep by default, which avoids the problem and makes it more obvious to check if this is the cause of issues when
enabled. We also unload chunks during sleep to prevent memory leaks caused by plugin chunk loads.
2024-10-27 14:18:28 -07:00
Riley Park
855db272b1 Bundle spark 2024-07-16 14:55:23 -07:00
Spottedleaf
29e03d0439 Add startup flag to disable gamerule limits
-DPaper.DisableGameRuleLimits=true will disable gamerule limits

== AT ==
public net.minecraft.server.level.ChunkLevel ENTITY_TICKING_LEVEL
2024-10-25 14:20:40 -07:00
Jason Penilla
1218a52ac9 Fix CraftWorld#isChunkGenerated
The upstream implementation is returning true for non-full chunks.
2024-06-18 12:43:06 -07:00
Flo0
35f6f25e78 API for checking sent chunks 2024-04-08 16:43:16 +02:00
Shane Freeder
8f7365707a Always send Banner patterns to the client
The mojang client will not remove patterns from a Banner when none
are sent inside of an update packet, given that this is not an expected
flow for them, this is not all too surprising. So, we shall resort to always
sending the patterns over the network for update packets.
2024-10-20 18:23:59 +01:00
Nassim Jahnke
3d14e7af19 Separate dimensiondata executor 2024-11-28 10:35:58 +01:00
Spottedleaf
7ec2cf09a3 Add proper async player disconnections
Blocking can cause performance problems
2024-10-16 06:41:32 -07:00
Doc
e95dccb515 Add AnvilView#bypassEnchantmentLevelRestriction
Anvils, by default, limit applied enchantment levels to their respective
maximum level. The added API enables plugins to disable this behaviour,
allowing enchantments that are overleveled to be applied via the anvil.
2024-10-06 16:46:36 -03:00
Lulu13022002
f207099765 Add Offline PDC API 2022-07-09 17:28:42 +02:00
Axionize
66e26ebe48 Void damage configuration API 2024-09-29 14:20:42 -07:00
Mariell Hoversholm
411498e394 Add PlayerInsertLecternBookEvent 2024-09-29 16:21:26 +02:00
Jake Potrebic
5b0133e675 Call bucket events for cauldrons 2022-01-16 10:13:33 -08:00
Tamion
8b8acbb898 Add recipeBrewTime
== AT ==
public net.minecraft.world.inventory.BrewingStandMenu brewingStandData
2024-09-15 19:17:12 +02:00
Jake Potrebic
cea3e6b65b Improve entity effect API 2024-09-27 17:13:16 -07:00
masmc05
da18fc4d93 Add enchantWithLevels with enchantment registry set 2024-09-25 16:26:04 +03:00
Nassim Jahnke
c056e2319d Fix PlayerCommandPreprocessEvent on signed commands 2024-09-21 22:01:52 +02:00
Newwind
f5e9df0862 Disable pretty printing for advancement saving
Reduces json size by about 25%
Not sure why advancements even had pretty printing enabled.
My best guess was by accident on mojang's part, especially since stats json files don't have pretty printing.
2024-09-20 14:17:37 +02:00
Bjarne Koll
c8efaa46cb Remove wall-time / unused skip tick protection
Spigot still maintains some partial implementation of "tick skipping", a
practice in which the MinecraftServer.currentTick field is updated not
by an increment of one per actual tick, but instead set to
System.currentTimeMillis() / 50. This behaviour means that the tracked
tick may "skip" a tick value in case a previous tick took more than the
expected 50ms.

To compensate for this in important paths, spigot/craftbukkit
implements "wall-time". Instead of incrementing/decrementing ticks on
block entities/entities by one for each call to their tick() method,
they instead increment/decrement important values, like
an ItemEntity's age or pickupDelay, by the difference of
`currentTick - lastTick`, where `lastTick` is the value of
`currentTick` during the last tick() call.

These "fixes" however do not play nicely with minecraft's simulation
distance as entities/block entities implementing the above behaviour
would "catch up" their values when moving from a non-ticking chunk to a
ticking one as their `lastTick` value remains stuck on the last tick in
a ticking chunk and hence lead to a large "catch up" once ticked again.

Paper completely removes the "tick skipping" behaviour (See patch
"Further-improve-server-tick-loop"), making the above precautions
completely unnecessary, which also rids paper of the previous described
incompatibility with non-ticking chunks.
2024-09-16 23:07:29 +02:00
strnq
883f50eb19 Validate slot in PlayerInventory#setSlot
The CraftPlayerInventory implementation sends a container_set_slot
packet to the client which will error if an invalid slot is passed to
the setSlot method, making a validation necessary over simply silently
ignoring invalid slot values.
2024-09-14 12:53:13 +03:00
masmc05
1cd7fd4eec Item serialization as json 2024-08-11 03:01:52 +03:00
Jake Potrebic
90bc5f1e0b Add FeatureFlag API 2024-05-29 19:50:21 -07:00
Newwind
e29ea45639 Check dead flag in isAlive()
If a plugin sets the health of a living entity above 0 after it has already died, the entity will be "revived".
It will behave the exact same as before, except with the internal "dead" flag set, resulting in 2 behavior changes,
A: it's completely invulnerable to all damage
B: it's unable to pickup items

isValid() for these bugged entities will return true, isDead() will return false, despite the dead flag.
This patch checks that the mob isn't dead before saying its alive.

Also, even if the plugin is responsibly checking !isDead() before modifying health, on very rare circumstances
I am currently unable to replicate, these "revived" entities can still appear
2024-08-26 14:01:37 +02:00
Nathan
7b8f630280 Fire BlockExpEvent on grindstone use 2024-08-31 18:09:55 -06:00
Tamion
2742ad6a9a Fix InventoryOpenEvent cancellation 2024-08-19 18:05:26 +02:00
Gegy
be5187c2da Fix: synchronise sending chat to client with updating message signature cache
In the case where multiple messages from different players are being processed in parallel, there was a potential race condition where the messages would be sent to the client in a different order than the message signature cache was updated. However, the cache relies on the fact that the client and server get the exact same updates in the same order. This race condition would cause the caches to become corrupted, and any future message received by the client would fail to validate.

This also applies to the last seen state of the server, which becomes inconsistent in the same way as the message signature cache and would cause any messages sent to be rejected by the server too.
2024-08-26 19:45:07 +02:00
okx-code
ad8ae89c95 Add enchantment seed update API 2024-08-17 13:02:45 +01:00
Newwind
34c99b8c67 Remove set damage lootable item function from compasses
In VanillaChestLoot, compasses accidentally have a setdamage loot
function on them, but compasses don't take durability, resulting in a warning.
This patch simply removes attempting to add damage to the compass item.
2024-08-22 22:55:37 +02:00
Jake Potrebic
8a940ca0ba Fix SculkBloomEvent firing for block entity loading 2024-08-19 13:43:06 -07:00
Tamion
b724ae078d Fix CraftBukkit drag system
== AT ==
public net.minecraft.world.inventory.AbstractContainerMenu quickcraftSlots
public net.minecraft.world.inventory.AbstractContainerMenu quickcraftStatus
public net.minecraft.world.inventory.AbstractContainerMenu quickcraftType
public net.minecraft.world.inventory.AbstractContainerMenu resetQuickCraft()V
2024-05-26 22:20:21 +02:00
Lulu13022002
52acc18e4f Leashable API 2024-06-22 21:17:54 +02:00
Jake Potrebic
d72defffba Add even more Enchantment API
In a separate patch because RegistryKeySet is used
and the previous "more enchant api" patch is before that.
2024-07-19 08:42:45 -07:00
mja00
15c3f06938 Add skipping world symlink scan
In worlds that are extremely large (greater than 1TB), it can take an insanely long time to walk the entire world for symlinks.
This patch adds a system property to disable the symlink scan, which can be used to speed up world loading.
2024-08-12 06:27:15 -04:00
Newwind
4b761f97a3 Configuration for horizontal-only item merging
Most of the visual artifacts that result from having item merge radius above vanilla levels is from items merging vertically,
which realistically, only happens when a player is dropping items, or items are dropping from breaking a block.

Most of the scenarios where item merging makes sense involves the two item entities being on the same Y level. i.e on the ground next to each other.
This is even more apparent since paper fixed items being able to merge through blocks.

This patch allows us to configure items to only merge horizontally, which is what vanilla does.
This allows us to have both the reduced number of item entities a high item-merge radius provides,
without most of the visual artifacts caused by items merging vertically.
2024-08-07 13:25:55 +02:00
Jake Potrebic
f6f6664716 Add API for CanPlaceOn and CanDestroy NBT values 2018-09-12 18:53:55 +03:00
Nassim Jahnke
334058fa69 Check for block type in SculkSensorBlock#canActivate 2024-08-07 14:33:25 +02:00
Tamion
92fa922afd Fix PickupStatus getting reset 2024-07-21 19:11:22 +02:00
Newwind
15c4f72cf0 Make interaction leniency distance configurable
The server validates incoming interaction packets by ensuring the player
sending them is inside their interaction range. For this, the server adds
a magic value, by default 1.0, to the original interaction range to
account for latency issues.

This value however may be too low in high latency environments.
The patch exposes a new configuration option to configure said value.
2024-07-25 13:00:37 +02:00
Jason Penilla
91b690c240 Add plugin info at startup 2024-07-18 18:44:28 -07:00
Jake Potrebic
4ef8b976c9 Add ItemType#getItemRarity 2024-07-09 18:37:37 -07:00
Bjarne Koll
7b21e8c8d9 Only call EntityDamageEvents before actuallyHurt
The recent upstream update moved around the event logic for
EntiyDamageEvent and its derivatives.
However, the event was called on every call to #hurt as it was moved out
of actuallyHurt.

This patch moves the invocation directly before the #actuallyHurt calls,
respective invulnerable timings.
2024-07-08 22:01:08 +02:00
Jake Potrebic
471be1b4da fix horse inventories
Horse inventories now combine 2 inventories (like
result inventories).

== AT ==
public net/minecraft/world/inventory/HorseInventoryMenu SLOT_BODY_ARMOR
2024-07-06 13:57:10 -07:00
Jake Potrebic
d9e3bee3b5 Fix NPE for Jukebox#setRecord
Fallback to the global registry if no level exists
2024-06-17 17:41:09 -07:00
Jason Penilla
164078cd2a Prioritize Minecraft commands in function parsing and command blocks 2024-07-01 11:58:49 -07:00
Jake Potrebic
9f2cf09ec5 Make a PDC view accessible directly from ItemStack 2024-06-12 10:29:40 -07:00
Jake Potrebic
c441981c54 Proxy ItemStack to CraftItemStack 2024-05-14 11:57:43 -07:00
Owen1212055
c3d1a03428 Configurable Sand Duping 2024-06-15 22:01:39 -04:00
Shane Freeder
6863c9e6db disable forced empty world ticks 2023-03-21 23:51:46 +00:00
Jake Potrebic
9d89ebb121 Properly remove the experimental smithing inventory type 2023-06-08 14:45:18 -07:00
Bjarne Koll
c05db66ee6 Configurable damage tick when blocking with shield 2024-06-13 17:16:01 +02:00
Jake
d7b5168a81 Fix removing recipes from RecipeIterator
== AT ==
public net.minecraft.world.item.crafting.RecipeMap byKey
2024-06-15 18:50:18 +01:00
granny
826f299f4c check if itemstack is stackable first 2024-02-24 19:33:01 -08:00
Owen1212055
84d07ca942 Suspicious Effect Entry API
Exposes a new suspicious effect entry type that properly represents
storable effects in the context of suspicious effects as they only
define the potion effect type and duration.

This differentiates them from the existing PotionEffect API found in
bukkit and hence clarifies that storable values in the parts of the API
in which it replaces PotionEffect.

Co-authored-by: Yannick Lamprecht <yannicklamprecht@live.de>
2024-03-03 19:43:40 +01:00
Bjarne Koll
99cd3b6813 Adopt MaterialRerouting
Adopts the paper-api to the material rerouting infrastructure introduced
by upstream.
2024-06-13 11:02:36 +02:00
Shane Freeder
165e93c7c6 Fix sending disconnect packet in phases where it doesn't exist 2024-05-30 18:46:15 +01:00
Jake Potrebic
960d0c8179 Deprecate InvAction#HOTBAR_MOVE_AND_READD 2024-05-25 09:51:13 -07:00
SoSeDiK
64cbea9119 Add missing fishing event state 2024-05-01 07:44:50 +03:00
Tamion
276e09c3b0 Fix cancelling BlockPlaceEvent calling onRemove 2024-05-23 11:02:20 +02:00
Jake Potrebic
acdfeeea3d Prevent NPE if hooked entity was cleared 2024-05-12 21:57:23 -07:00
Nassim Jahnke
c6f962ba54 Prevent sending oversized item data in equipment and metadata
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
2021-12-01 12:36:25 +01:00
Jason Penilla
ce6fd58a5e Allow Bukkit plugin to use Paper PluginLoader API 2024-05-21 13:18:15 -07:00
Jake Potrebic
e1b7819229 Fix equipment slot and group API
Adds the following:
- Add test for EquipmentSlotGroup
- Expose LivingEntity#canUseSlot

Co-authored-by: SoSeDiK <mrsosedik@gmail.com>
2024-05-22 10:01:19 -07:00
Jake Potrebic
5d843f3120 Fix issues with Recipe API 2024-05-12 15:49:36 -07:00
Owen1212055
977543c545 Brigadier based command API
== AT ==
public net.minecraft.commands.arguments.blocks.BlockInput tag
public net.minecraft.commands.arguments.DimensionArgument ERROR_INVALID_VALUE
public net.minecraft.server.ReloadableServerResources registryLookup
public net.minecraft.server.ReloadableServerResources

Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
Co-authored-by: Marc Baloup <marc.baloup@laposte.net>
2022-08-01 22:50:34 -04:00
Nassim Jahnke
aabe9f5264 Print data component type on encoding error 2024-05-09 15:11:34 +02:00
SoSeDiK
b50682ab2b More Chest Block API
== AT ==
public net.minecraft.world.level.block.ChestBlock isBlockedChestByBlock(Lnet/minecraft/world/level/BlockGetter;Lnet/minecraft/core/BlockPos;)Z
2024-05-01 08:22:13 +03: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
nostalfinals
445e9a65fb Added API to get player ha proxy address 2024-04-08 23:24:38 +08:00
SoSeDiK
d5b93a0167 Expose #hasColor to leather armor 2024-05-01 10:58:50 +03:00
Jake Potrebic
ae4acc6aeb improve checking handled tags in itemmeta 2023-07-10 16:10:15 -07:00
Jake Potrebic
50b91c7359 Revert to vanilla handling of LivingEntity#actuallyHurt 2024-04-27 09:44:53 -07:00
Lulu13022002
ee130088cc Fix damage modifier inconsistencies
Affect the falling stalactite damage type where the
reduction is not applied like in Vanilla.
Additionally fix the "is_freezing" damage type tag.
2024-04-27 21:51:58 +02:00
Jake Potrebic
97a4aeda2d Fix ItemFlags
Re-adds missing functionality for HIDE_DESTROYS and
HIDE_PLACED_ON. Also adds new flag in HIDE_STORED_ENCHANTS
which was split from HIDE_ADDITIONAL_TOOLTIP.

== AT ==
public net.minecraft.world.item.AdventureModePredicate predicates
2024-04-27 12:16:38 -07:00
Aikar
236dce4925 Handle Large Packets disconnecting client
If a players inventory is too big to send in a single packet,
split the inventory set into multiple packets instead.
2018-11-27 21:18:06 -05:00
Jake Potrebic
ba71d372a5 Fix shield disable inconsistency
In vanilla, if the damage source is tagged as a projectile,
it will not disable the shield if the attacker is holding
an axe item.
2024-04-26 19:08:37 -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
SoSeDiK
4c8c367eee Deep clone nbt tags in PDC 2022-05-26 03:30:05 +03:00
Jake Potrebic
49778e042c Add config for mobs immune to default effects 2020-12-02 21:03:02 -08:00
Aikar
eb626e1176 Protect Bedrock and End Portal/Frames from being destroyed
This fixes exploits that let players destroy bedrock by Pistons, explosions
and Mushrooom/Tree generation.

These blocks are designed to not be broken except by creative players/commands.
So protect them from a multitude of methods of destroying them.

A config is provided if you rather let players use these exploits, and let
them destroy the worlds End Portals and get on top of the nether easy.
2020-05-13 23:01:26 -04:00
Jake Potrebic
27979040fd Properly track the changed item from dispense events 2022-12-12 12:14:03 -08:00
Jake Potrebic
193d6ee2ca Per world ticks per spawn settings 2021-11-13 12:36:26 -08:00
Owen1212055
5a83b512a7 Item Mutation Fixes 2024-03-20 20:41:35 -04:00
Nassim Jahnke
3758965f88 Improve tag parser handling 2024-02-05 11:54:04 +01:00
Jake Potrebic
6c400a907b Fix possible StackOverflowError and NPE for some dispenses
For saddles, carpets, horse armor, and chests for horse-likes
a BlockDispenseEvent handler that always mutated the item without
changing the type would result in a SO error because when it went
to find the replacement dispense behavior (since the item "changed")
it didn't properly handle if the replacement was the same instance
of dispense behavior.

Additionally equippable mob heads, wither skulls, and carved pumpkins
are subject to the same possible error.

Furthermore since 1.21.2, the DISPENSER_REGISTRY map doesn't have a default
return value anymore and some dispense behaviors like equippable and
regular items will not have a defined behavior in that map and might throw
a NPE in that case.
2022-10-29 17:02:42 -07:00
Pierpaolo Coletta
368ca9c145 Fix creation of invalid block entity during world generation 2024-03-30 21:06:10 +01:00
Jake Potrebic
d42ef390ea Fix DamageSource API
Uses the correct entity in the EntityDamageByEntity event
Returns the correct entity for API's DamageSource#getCausingEntity
2024-03-09 14:13:04 -08:00
RodneyMKay
a87a5e10d9 Fire EntityDamageByEntityEvent for unowned wither skulls 2024-02-11 20:05:11 +01:00
Warrior
079a41f4c4 Disable memory reserve allocating 2024-01-18 23:25:09 +01:00
Jake Potrebic
93a2600891 Fix bees aging inside hives
Fixes bees incorrectly being aged up due to upstream's
resetting the ticks inside hive on a failed release
2021-08-21 21:54:16 -07:00
Gero
f42abdfad3 Configurable max block/fluid ticks 2024-02-19 17:39:59 +01:00
leguan
046fc5171f Add onboarding message for initial server start 2024-03-10 20:10:41 +01:00
Jake Potrebic
e06fe76018 More Raid API
== AT ==
public net.minecraft.world.entity.raid.Raid raidEvent
2022-03-04 09:46:33 -08:00
Janet Blackquill
e57ad97c91 Add CartographyItemEvent 2024-04-07 16:52:42 -04:00
Owen1212055
70cd7cfb23 Deprecate ItemStack#setType 2024-03-26 21:42:23 -04:00
Badbird5907
66ebf93c21 Add BlockBreakProgressUpdateEvent 2024-03-04 22:18:28 -05:00
vicisacat
93c49bbe31 Expanded Hopper API
== AT ==
public net.minecraft.world.level.block.entity.HopperBlockEntity setCooldown(I)V
public net.minecraft.world.level.block.entity.HopperBlockEntity cooldownTime
2024-03-15 17:35:40 +01:00
Yannick Lamprecht
61c73ee83e improve BanList types 2024-02-10 20:50:01 +01:00
David Mayr
10a15650f1 add number format api
== AT ==
public net.minecraft.network.chat.numbers.FixedFormat value
public net.minecraft.network.chat.numbers.StyledFormat style
2023-12-16 10:40:29 +01:00
vicisacat
380cb52e43 Add FluidState API 2023-11-17 20:22:43 +01:00
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
Nassim Jahnke
5688b5cf50 Add slot sanity checks in container clicks 2023-09-11 12:01:57 +10:00
Paul Sauve
a951373bae Skip POI finding if stuck in vehicle
Copyright (C) 2020 Technove LLC

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
2021-02-18 13:13:27 -06: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
Lulu13022002
d66a2c4c26 Configure sniffer egg hatch time 2023-06-27 13:26:06 +02:00
Jake Potrebic
d300049246 Add titleOverride to InventoryOpenEvent 2022-03-04 12:45:03 -08: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
Aeltumn
1fc4ca9178 Implement OfflinePlayer#isConnected 2023-08-24 13:05:30 +02:00
Martijn Muijsers
badf809fef Optimize nearest structure border iteration
Getting the nearest generated structure contains a nested set of loops that
iterates over all chunks at a specific chessboard distance. It does this by
iterating over the entire square of chunks within that distance, and checking
if the coordinates are at exactly the right distance to be on the border.

This patch optimizes the iteration by only iterating over the border chunks.
This evaluated chunks are the same, and in the same order, as before, to
ensure that the returned found structure (which may for example be a buried
treasure that will be marked on a treasure map) is the same as in vanilla.
2023-08-21 21:05:09 +02:00
The456gamer
8b97b13142 Expose hand in BlockCanBuildEvent 2023-08-21 14:13:42 +01:00
Lulu13022002
e9583f82db Allow trident custom damage 2022-07-12 18:01:14 +02:00
RodneyMKay
9b0d705d63 Add PlayerPickItemEvent 2021-09-08 21:34:01 +02:00
Jake Potrebic
4527215d8e More DragonBattle API
== AT ==
public net.minecraft.world.level.dimension.end.EndDragonFight GATEWAY_COUNT
public net.minecraft.world.level.dimension.end.EndDragonFight gateways
public net.minecraft.world.level.dimension.end.EndDragonFight respawnCrystals
public net.minecraft.world.level.dimension.end.EndDragonFight spawnNewGateway(Lnet/minecraft/core/BlockPos;)V
2022-12-18 13:40:05 -08:00
SoSeDiK
1cb5b6e838 Expand Pose API 2023-01-11 20:59:01 +02:00
LemonCaramel
e39a789ec6 Fix NPE on Boat getStatus
Boat status is null until the entity is added to the world and the tick() method is called.

== AT ==
public net.minecraft.world.entity.vehicle.AbstractBoat getStatus()Lnet/minecraft/world/entity/vehicle/AbstractBoat$Status;
2023-04-10 20:48:26 +09:00
aerulion
edb4225d90 Add BlockFace to BlockDamageEvent 2023-08-21 04:36:07 +02:00
Astralchroma
1abc111403 Configurable Region Compression Format 2022-10-27 22:19:31 +01:00
Corey Shupe
53fab9663b Add Listing API for Player 2023-01-11 16:40:39 -05:00
ruViolence
8e05d19854 Configurable entity tracking range by Y coordinate
Options to configure entity tracking by Y coordinate, also for each entity category.
2023-06-27 15:38:18 +08:00
Trevor Bedson
b96d42bd8b Fire entity death event for ender dragon 2023-07-14 20:47:02 -04:00
Jake Potrebic
597cb633e8 Properly handle BlockBreakEvent#isDropItems
Setting whether a block break dropped items controlled
far more than just whether blocks dropped, like stat increases
food consumption, turtle egg count decreases, ice to water
conversions and beehive releases
2023-03-04 10:52:52 -08:00
EpicPlayerA10
0f4ee39a8e Don't tab-complete namespaced commands if send-namespaced is false
Tab-complete packet is supposed to tab-complete args for commands, but
it also can suggest commands like in version 1.12.2 or lower.

This patch prevents server from sending namespaced commands when player
requests tab-complete only commands.
2023-06-18 12:38:24 +02:00
Jake Potrebic
e46ee8e55e Deprecate and replace methods with old StructureType 2022-12-10 17:52:38 -08:00
Jake Potrebic
b690edd273 API for an entity's scoreboard name
Was obtainable through different methods, but you had to use different
methods depending on the implementation of Entity you were working with.
2023-07-09 11:55:02 -07:00
Oliwier Miodun
c6e45b313c SculkCatalyst bloom API
== AT ==
public net.minecraft.world.level.block.entity.SculkCatalystBlockEntity$CatalystListener bloom(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/util/RandomSource;)V
2023-07-10 17:59:42 +02:00
Jake Potrebic
8bb902842c Bandaid fix for Effect
Effect or LevelEvent needs to be replaced
but ideally after the enum PR has been merged
upstream. Until then, this test and these fixes
should address all the known issues with them
2023-07-28 15:02:44 -07:00
Noah van der Aa
3b2125b47d Fix custom statistic criteria creation 2023-08-12 15:33:49 +02:00
Jake Potrebic
06b00246a2 API for updating recipes on clients 2021-08-21 17:25:38 -07:00
Warrior
4c98f21716 Cache map ids on item frames 2023-08-07 12:58:28 +02:00
Spottedleaf
88464f509b Remove UpgradeData neighbour ticks outside of range
The lists are only supposed to contain ticks for the 1 radius
neighbours of the chunk.
2023-08-09 14:00:40 -07:00
Florian Schmidt
8a4e4f4066 Use correct seed on api world load 2023-07-28 14:14:35 +02:00
Jake Potrebic
d7a197deee Respect randomizeData on more entities when spawning
* ItemEntity
* PrimedTNT
* FireworkRocketEntity
* ExperienceOrb
2023-07-13 16:10:07 -07:00
Warrior
d2f251cc5c Use correct source for mushroom block spread event 2023-08-08 11:49:32 +02:00
Jake Potrebic
36ae0bcfea Only capture actual tree growth 2021-08-21 18:53:03 -07:00
Gameoholic
1754e3426c Fix rotation when spawning display entities 2023-07-30 13:30:34 +03:00
Bjarne Koll
c90fc43eb8 Only erase allay memory on non-item targets
Spigot incorrectly instanceOf checks the EntityTargetEvent#getTarget
against the internal ItemEntity type and removes the nearest wanted item
memory if said instanceOf check fails, (which is always the case)
causing allays to behave differently as they constantly lose their
target item.

This commit fixes the faulty behaviour by instance performing a check
against the CraftItem type.
2023-08-04 15:53:36 +02:00
Spottedleaf
a13bff4a5f Folia scheduler and owned region API
Pulling Folia API to Paper is primarily intended for plugins
that want to target both Paper and Folia without unnecessary
compatibility layers.

Add both a location based scheduler, an entity based scheduler,
and a global region scheduler.

Owned region API may be useful for plugins which want to perform
operations over large areas outside of the buffer zone provided
by the regionaliser, as it is not guaranteed that anything
outside of the buffer zone is owned. Then, the plugins may use
the schedulers depending on the result of the ownership check.
2023-06-17 11:52:52 +02:00
Moulberry
31871f6b40 Implement PlayerFailMoveEvent 2023-07-26 20:13:31 +08:00
SageSphinx63920
02819929b6 Add whitelist events 2023-05-14 12:57:15 +02:00
Jacob Litewski
1b118883f2 Make Amethyst throw both Spread and Grow Events 2023-06-13 19:16:39 -04:00
Golfing8
9fe671127a ExperienceOrb should call EntitySpawnEvent 2023-05-08 09:18:17 -04:00
Jason Penilla
4ced264ab6 Only set despawnTimer for Wandering Traders spawned by WanderingTraderSpawner 2021-03-19 16:07:21 -07:00
Jake Potrebic
90366d505a Fix possible NPE on painting creation 2023-06-24 09:42:53 -07:00
galacticwarrior9
6f37c3e39b Determine lava and water fluid explosion resistance by their block explosion resistance
When selecting which explosion resistance to use for lava and water, vanilla selects the highest value between their block explosion resistance and fluid explosion resistance.

Problems emerge when we want to reduce the explosion resistance of water or lava, since the fluid explosion resistance is hardcoded to return 100.0F and can't be changed by a plugin. This simply makes the fluid explosion resistance the same as the block explosion resistance, which allows plugin to change the value. Since both are the same in vanilla, this has no side effects on servers that do not need to do this.
2023-07-13 21:32:13 +01:00
Jake Potrebic
5b7b25844e Fix BanList API 2023-07-04 11:27:10 -07:00
Jake Potrebic
61ff05d0d5 fix item meta for tadpole buckets 2023-07-11 11:22:30 -07:00
Jake Potrebic
5b97ae9832 More Sign Block API
Co-authored-by: SoSeDiK <mrsosedik@gmail.com>
2023-06-23 12:16:28 -07:00
Spottedleaf
bfd4276e56 Optimize player lookups for beacons
For larger ranges, it's better to iterate over the player list
than the entity slices.
2023-07-06 20:17:37 -07:00
Shane Freeder
6fca06ec72 Don't load chunks for supporting block checks 2023-07-05 23:11:53 +01:00
Lulu13022002
8bf9982317 Call missing BlockDispenseEvent 2022-10-29 15:41:56 +02:00
Boy
539071158d Add option to disable block updates 2023-06-18 17:45:33 +02:00
Jake Potrebic
b0579722db Fix cmd permission levels for command blocks 2022-01-24 15:32:02 -08:00
Redned
4bb84c46ac Only tick item frames if players can see it
In the event that an item frame cannot be seen by any players, ticking the item frame every tick is unnecessary. This can be a very hot section of the entity tracker when lots of item frames are present on a server, so this reduces the logic which speeds it up.
2023-06-19 15:45:53 -05:00
by77er
6702fe7546 Add event for player editing sign 2023-06-12 12:56:46 -04:00
Jake Potrebic
bd6baf7618 Add method to remove all active potion effects 2023-06-17 13:17:25 -07:00
Lulu13022002
d22d2a19de Fix sniffer removeExploredLocation
Add support to remove explored location in different world
2023-06-11 19:02:46 +02:00
Jake Potrebic
275331ae56 fix MapLike spam for missing key 'selector' 2023-06-14 13:17:40 -07:00
TheMeinerLP
a652ca1f5c Don't enforce icanhasbukkit default if alias block exists 2023-06-13 16:10:59 +02:00
Lulu13022002
8ad0899aca Call BlockGrowEvent for missing blocks
Call the event for pitcher crops and sniffer egg
2023-06-09 13:04:42 +02: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
Malfrador
6c30e5b15b Add transient modifier API 2023-05-31 23:30:00 +02:00
Jake Potrebic
e48a6a04cc Refresh ProjectileSource for projectiles
Makes sure the value returned by Projectile#getShooter in
the API matches the owner UUID specified in the entity nbt.
Previously, after the entity reloaded, Projectile#getShooter
would return null, while the entity still had an owner.

Also fixes setting the shooter/owner to null actually
clearing the owner.

Co-authored-by: Warrior <50800980+Warriorrrr@users.noreply.github.com>
2023-05-30 12:59:10 -07:00
Jake Potrebic
79ffc3e056 Expand PlayerItemMendEvent 2022-01-20 18:11:20 -08:00
Warrior
605fb41674 More accurate isInOpenWater impl
For fishing hooks, the openWater field is true by default, and only calculated when a "fish" is approaching the bobber.
This patch changes the API impl to calculate the open water state itself instead of returning this field.

Relevant link: https://github.com/PaperMC/Paper/issues/9131

== AT ==
public net.minecraft.world.entity.projectile.FishingHook calculateOpenWater(Lnet/minecraft/core/BlockPos;)Z
public net.minecraft.world.entity.projectile.FishingHook outOfWaterTime
2023-05-07 22:33:50 +02:00
Owen1212055
07936857f5 Avoid Lazy Initialization for Enum Fields
This patch is meant to get rid of any instances of lazy initialization that Minecraft introduces for enums.
This has the possibility to create race condition issues, and generally don't make sense to be lazily done anyways.
2023-05-14 00:47:28 -04:00
Spottedleaf
dfe1579715 Break redstone on top of trap doors early
This logic hooks into the neighbour update which should be invoked
as a result of redstone powering the trap door.
2023-05-01 18:31:26 -07:00
GodOfPro
3079b71627 Add Mob Experience reward API 2023-04-11 16:31:39 +04:30
Warrior
915f048f00 Fix demo flag not enabling demo mode
https://github.com/PaperMC/Paper/issues/9046
2023-04-07 20:11:17 +02:00
Jake Potrebic
988f9ed56f Fix a couple of upstream bed issues
Upstream incorrectly skipped explosion logic if
the bed was occupied and added a "feature" where
if you set your spawn in a respawn anchor world
but then replaced it with a bed, you could respawn
at the bed in that world.
2023-04-09 21:11:58 -07:00
Paul Sauve
8e6779e8e9 Use array for gamerule storage 2021-05-09 16:49:49 -05:00
Shane Freeder
c060f3fae0 Prevent GameEvents being fired from unloaded chunks 2023-04-05 20:15:47 +01:00
Shane Freeder
16b8d46c1c Prevent causing expired keys from impacting new joins 2023-04-03 08:55:52 +01:00
Shane Freeder
d0107cc0c0 Treat sequence violations like they should be 2023-03-30 03:13:58 +01:00
Jake Potrebic
b436c07ec7 Fix crash relating to bad recipes in furnace-like tile entities 2023-03-19 20:36:22 -07:00
Jake Potrebic
71e08c0a8d Fix SpawnEggMeta#get/setSpawnedType 2023-02-23 13:19:13 -08:00
Owen1212055
2e77028ed4 Add Shearable API 2021-10-17 15:39:48 -04:00
Jake Potrebic
6e271dc9e4 Fix inventories returning null Locations
Wandering Trader, AbstractHorse, Beacon and Composter inventories returned null locations
when a block or entity location is readily available

Co-authored-by: Lukas Planz <lukas.planz@web.de>
2023-03-15 18:29:45 -07:00
Nassim Jahnke
7139479d40 Fix text display error on spawn 2023-03-16 16:27:50 +01:00
Jake Potrebic
a929f0aff3 Fix advancement triggers for entity damage
Changes the Interaction entity's trigger to use the vanilla
generic damage source

Fixes a couple places where the original damage and modified damage
were passed in the reverse order to the advancement triggers
2023-03-16 10:04:17 +01:00
Jake Potrebic
6e85945a4b Correctly handle ArmorStand invisibility 2023-03-05 14:38:21 -08:00
Noah van der Aa
663afe7045 Add CompostItemEvent and EntityCompostItemEvent 2021-08-08 19:56:02 +02:00
Jake Potrebic
006e8346e9 Fix HumanEntity#drop not updating the client inv
== AT ==
public net.minecraft.server.level.ServerPlayer containerSynchronizer
2021-10-10 18:18:01 -07:00
Lulu13022002
ab040d534d Add EntityFertilizeEggEvent 2022-06-24 12:39:34 +02:00
Warrior
b5442da875 Fix MC-157464 Prevent sleeping villagers moving towards food
Fixes sleeping villagers moving to nearby food by adding an !isSleeping predicate

Relevant links:
https://bugs.mojang.com/browse/MC-157464
https://github.com/PaperMC/Paper/issues/8569
2023-02-27 19:16:07 +01:00
TheTuso
d1abd737aa Add Entity Body Yaw API 2023-02-02 16:40:41 +01:00
Jake Potrebic
db1df52d4c Fix force-opening enchantment tables 2023-01-26 16:19:26 -08:00
Josh Roy
933e2e1efa Remove CraftItemStack#setAmount null assignment
This creates a problem with Paper's item serialization
api where deserialized items, which are internally
created as a CraftItemStack, will be completely lost if
#setAmount(0) is invoked (since the underlying handle
is set to null), while a regular Bukkit ItemStack
simply sets the amount field to zero, retaining the
item's data.

Vanilla treats items with zero amounts the same as items
with less than zero amounts, so this code doesn't create
a problem with operations on the vanilla ItemStack.
2023-01-23 19:19:01 -05:00
Lama06
b8ad599ceb Win Screen API
== AT ==
public net.minecraft.server.level.ServerPlayer seenCredits
2023-01-21 13:53:23 +01:00
Bjarne Koll
d648e75653 Correctly shrink items during EntityResurrectEvent
The EntityResurrectEvent logic is supposed to locate a totem of undying
in any of the interaction slots of the player inventory and then, if the
called EntityResurrectEvent is not cancelled, shrink that item by 1,
usually reducing it to zero.

For this, the logic iterates over the items in the interaction slots and
breaks out the loop if a totem of undying was found.
However, even if no totem of undying was found, the iteration item stack
variable remains as a refernce to the last interaction slot probed.

Plugins uncancelling a EntityResurrectEvent, which is published
pre-cancelled to listeners if no totem of undying could be found,
would hence cause the server logic to shrink completely unrelated items
found in, at the writing of this patch, the players off hand slot.

This patch corrects this behaviour by only shrinking the item if a totem
of undying was found and the event was called uncancelled.
2023-01-10 21:06:42 +01:00
Jake Potrebic
3af4592f2a Use single player info update packet on join 2023-01-08 17:38:28 -08:00
Jake Potrebic
a03610401b config for disabling entity tag tags 2021-09-15 14:52:42 -07:00
SoSeDiK
735cda1084 Expose pre-collision moving velocity to VehicleBlockCollisionEvent 2022-10-11 23:30:32 +03:00
TreyRuffy
602506fa98 Flying Fall Damage 2022-05-27 02:26:08 -06:00
NonSwag
d9107f8c61 Fix NPE on Allay#stopDancing while not dancing 2022-12-06 23:04:21 +01:00
NonSwag
bc837647f1 Add missing SpigotConfig logCommands check
Co-authored-by: david <mrminecraft00@gmail.com>
2022-12-08 20:25:05 +01:00
BillyGalbreath
9773687ae3 Add config option for spider worldborder climbing 2022-10-27 15:35:47 +02:00
Jake Potrebic
18a23db6f2 Improve PortalEvents 2022-12-15 10:33:39 -08:00
Jake Potrebic
b141cd3d99 Improve logging and errors
Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
2022-12-14 15:52:11 -08:00
dawon
f64904e777 Add Sneaking API for Entities 2022-10-19 23:31:53 +02:00
Jake Potrebic
981cf9de7a Add BlockLockCheckEvent 2022-05-21 20:59:45 -07:00
Spottedleaf
adf175d7ca Improve inlining for some hot BlockBehavior and FluidState methods 2020-07-06 20:46:50 -07:00
Jake Potrebic
2b90721a45 fix Instruments
properly handle Player#playNote
2022-12-09 01:47:23 -08:00
Noah van der Aa
21770104ec Limit pet look distance 2022-12-06 18:45:54 +01:00
Yannick Lamprecht
df65fbea3e Player Entity Tracking Events 2022-03-30 18:16:52 +02:00
Jake Potrebic
4d008bb329 Sync offhand slot in menus
Menus don't add slots for the offhand, so on sendAllDataToRemote calls the
offhand slot isn't sent. This is not correct because you *can* put stuff into the offhand
by pressing the offhand swap item
2022-01-14 10:20:40 -08:00
Shane Freeder
26fe3d0cff Fix premature player kicks on shutdown
When the server is stopping, the default execution handler method will throw a
RejectedExecutionException in order to prevent further execution, this causes
us to lose the actual kick reason. To mitigate this, we'll use a seperate marked
class in order to gracefully ignore these.
2024-04-11 16:37:44 +01:00
Jan Villim
bc5dd992ab Ability to control player's insomnia and phantoms 2022-01-22 17:56:19 +01:00
Noah van der Aa
e151b6fc3f Friction API 2021-09-15 20:44:22 +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
0e9f28fe68 Fix async entity add due to fungus trees 2022-03-18 21:30:00 -07:00
Jake Potrebic
012c32fac7 check global player list where appropriate
Makes certain entities check all players when searching for a player
instead of just checking players in their world.
2022-11-22 13:16:01 -08:00
Warrior
ba6112b959 Add /paper dumplisteners command
Co-authored-by: TwoLeggedCat <80929284+TwoLeggedCat@users.noreply.github.com>
2022-10-25 21:15:37 +02:00
Lulu13022002
533bc0c468 More vanilla friendly methods to update trades 2022-10-16 16:12:49 +02:00
dawon
9db4bb7ac6 Add Player Warden Warning API
== AT ==
public net.minecraft.server.level.ServerPlayer wardenSpawnTracker
public net.minecraft.world.entity.monster.warden.WardenSpawnTracker ticksSinceLastWarning
public net.minecraft.world.entity.monster.warden.WardenSpawnTracker cooldownTicks
public net.minecraft.world.entity.monster.warden.WardenSpawnTracker increaseWarningLevel()V
2022-10-15 00:46:57 +02:00
Jake Potrebic
e70d21dbfe ensure reset EnderDragon boss event name
Fix MC-257487
2022-11-12 10:08:58 -08:00
Owen1212055
37f3f89384 Add PrePlayerAttackEntityEvent 2022-09-18 13:10:18 -04:00
Denery
5ca5bc3d6c Fix EntityCombustEvent cancellation cant fully prevent entities from being set on fire 2022-10-31 14:20:52 +03:00
Jason Penilla
7c7eff2c01 Fix EntityArgument and EntitySelectorParser permissions to align with EntitySelector#checkPermissions
Fixes where the user has permission for selectors but not their
suggestions, which especially matters when we force suggestions to
the server for this type
2022-10-26 13:13:12 -07:00
dannyball710
f161307a0f Ignore impossible spawn tick 2022-02-12 23:42:48 +08:00
Owen1212055
7c891287ed Add Moving Piston API 2021-12-04 13:29:36 -05:00
VytskaLT
8c11cd85e3 Add fire-tick-delay option 2022-06-22 14:34:28 +03:00
KyGuy2002
d9db4d694b Add EntityToggleSitEvent 2022-03-11 15:33:10 +00:00
lukas81298
b9139ad4aa fix entity vehicle collision event not called 2021-01-12 14:41:38 +01:00
Noah van der Aa
5c260c7e51 Detect headless JREs
Crashes caused by the missing AWT dependency come up in the support channels fairly often.
This patch detects the missing dependency and stops the server with a clear error message,
containing a link to instructions on how to install a non-headless JRE.
2022-10-22 14:47:45 +02:00
MelnCat
95a2e4ed32 Add entity knockback API 2022-10-16 12:10:17 -07:00
SoSeDiK
7224eecfb1 Elder Guardian appearance API 2022-10-11 20:38:47 +03:00
Jakub Zacek
4f1619700a Add PlayerInventorySlotChangeEvent 2022-04-24 22:56:59 +02:00
Jake Potrebic
e56f757b1c Correctly handle interactions with items on cooldown 2022-06-16 21:57:02 -07:00
Jake Potrebic
945f6ef6e6 EntityPickupItemEvent fixes
Fixes double firing of the event in PiglinAi

Fixes cancelling the event for piglins still triggering the
advancement trigger

Fires the event when a Raider tries to pick up a raid banner
to become raid leader.
2022-07-04 21:45:36 -07:00
Jake Potrebic
3f8bb2073a Fix custom piglin loved items
Upstream didn't modify the isLovedItem check in wantsToPickup
so piglins never actually tried to pickup interestItems
2022-07-04 21:50:44 -07:00
Nassim Jahnke
dbfc5fda14 Remove unnecessary onTrackingStart during navigation warning 2022-10-03 20:48:19 +02:00
Jake Potrebic
0b9ef3701e Fix a bunch of vanilla bugs
https://bugs.mojang.com/browse/MC-253721
  wrong msg for opping multiple players

https://bugs.mojang.com/browse/MC-248588
  respect mob griefing gamerule for draining water cauldrons

https://bugs.mojang.com/browse/MC-244739
  play goat eating sound for last item in stack

https://bugs.mojang.com/browse/MC-243057
  ignore furnace fuel slot in recipe book click

https://bugs.mojang.com/browse/MC-147659
  Some witch huts spawn the incorrect cat
  Note: Marked as Won't Fix, makes 0 sense

https://bugs.mojang.com/browse/MC-179072
  Creepers do not defuse when switching from Survival to Creative/Spectator

https://bugs.mojang.com/browse/MC-259571
  Fix changeGameModeForPlayer to use gameModeForPlayer

https://bugs.mojang.com/browse/MC-262422
  Fix lightning being able to hit spectators

https://bugs.mojang.com/browse/MC-263999
  Fix mobs breaking doors not spawning block break particles

https://bugs.mojang.com/browse/MC-210802
  Fixes sheep eating blocks outside of ticking range

https://bugs.mojang.com/browse/MC-123848
  Fixes item frames dropping items above when pointing down

https://bugs.mojang.com/browse/MC-174630
  Fix secondary beacon effect remaining after switching effect

https://bugs.mojang.com/browse/MC-153086
  Fix the beacon deactivation sound always playing when broken

https://bugs.mojang.com/browse/MC-200092
  Fix yaw being ignored for a player's first spawn pos

https://bugs.mojang.com/browse/MC-158900
  Fix error when joining after tempban expired

https://bugs.mojang.com/browse/MC-99075
  Fix inventory desync within spawn protected area

https://bugs.mojang.com/browse/MC-273635
  Fix TrialSpawner forgets assigned mob when placed by player

== AT ==
public net/minecraft/world/entity/Mob leashInfoTag
public net/minecraft/server/level/ChunkMap anyPlayerCloseEnoughForSpawning(Lnet/minecraft/world/level/ChunkPos;)Z

Co-authored-by: William Blake Galbreath <blake.galbreath@gmail.com>
Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
2022-07-11 11:56:41 -07:00
MelnCat
492ebf1459 Add getDrops to BlockState
Originally added isPreferredTool to BlockData but
upstream added that.
2022-08-12 23:24:37 -07:00
Legitimoose
074f19e7fb use BlockFormEvent for mud converting into clay 2022-09-29 16:25:50 -07:00
Legitimoose
1695d7c138 fix Jigsaw block kicking user 2022-09-28 22:45:49 -07:00
Shane Freeder
084e7e62ad Mitigate effects of WorldCreator#keepSpawnLoaded ret type change
TODO: Remove in 1.21?
2022-09-19 00:13:02 +01:00
Shane Freeder
60026267e3 Configurable chat thread limit
By default, spigot shifts chat over to an unbounded thread pool,
on a normal server, this really offers no gains, the creation of a thread
on submitting to the pool on these servers eats more time vs just running it in
the netty pipeline, however, on servers using plugins which do work in here, there
could be some overall benefits to moving this stuff outside of the pipeline.

In general, this patch does two things:
1) Exposes the core size for the pool, this allows for ensuring that a number of threads
sit around in the pool, mitigating the need for creating new threads; This IS however
caveated, the ThreadPoolExecutor will ONLY create core threads as they're needed, it
just won't allow for us to dip back under the # of core threads, this can potentially
be mitigated by calling prestartCoreThread, however, I'm not sure if there is much justification
for this
2) Exposes a max size for the pool, as stated, by default this is unbounded, for most
servers limiting the size of the pool is going to have 0 effects given how fast chat
is actually processed, this is honestly really just exposed for the misnomers or people
who just wanna ensure that this won't grow over a specific size if chat gets stupidly active
2022-09-18 06:33:17 +01:00
Lulu13022002
a45d2c6068 Add source block to BlockPhysicsEvent 2022-08-07 22:16:36 +02:00
Nex
476de68a14 Added byte array serialization/deserialization for PersistentDataContainers 2022-02-24 16:28:07 +01:00
Lulu13022002
b24b187864 Missing effect cause 2022-08-16 19:44:55 +02:00
Lulu13022002
bde548833e Missing eating regain reason 2022-08-05 12:16:51 +02: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
MWHunter
2aae5e2218 Stop large look changes from crashing the server
Co-authored-by: Jaren Knodel <Jaren@Knodel.com>
2022-08-24 09:54:11 -04:00
José Miguel Moreno
a72acfb245 Fix plugin loggers on server shutdown 2021-06-05 13:45:15 +02:00
Josh Roy
ebdde69c39 Add NamespacedKey biome methods
Co-authored-by: Thonk <30448663+ExcessiveAmountsOfZombies@users.noreply.github.com>
2022-08-14 12:23:11 -04:00
Andrew Steinborn
a1051ff388 Add Velocity IP Forwarding Support
While Velocity supports BungeeCord-style IP forwarding, it is not secure. Users
have a lot of problems setting up firewalls or setting up plugins like IPWhitelist.
Further, the BungeeCord IP forwarding protocol still retains essentially its original
form, when there is brand new support for custom login plugin messages in 1.13.

Velocity's modern IP forwarding uses an HMAC-SHA256 code to ensure authenticity
of messages, is packed into a binary format that is smaller than BungeeCord's
forwarding, and is integrated into the Minecraft login process by using the 1.13
login plugin message packet.
2018-10-08 14:36:14 -04:00
Owen1212055
63ca8a9302 Block Ticking API 2021-12-26 13:23:46 -05:00
chickeneer
1158ad3a6a Fix suggest command message for brigadier syntax exceptions
This is a bug accidentally introduced in upstream CB
2022-08-01 20:13:02 -05:00
Owen1212055
19d28ade48 Collision API 2021-10-06 20:10:44 -04:00
Owen1212055
dede55eaad Add and fix missing BlockFadeEvents
Beyond calling the BlockFadeEvent in more places, this patch also aims
to pass the proper replacement state to the event, specifically for
potentially waterlogged block states fading.

Co-authored-by: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com>
2022-07-21 12:07:54 -04:00
Owen1212055
44f8b39a2c Custom Chat Completion Suggestions API 2022-07-30 11:23:05 -04:00
Owen1212055
ce7cf07354 Warn on plugins accessing faraway chunks 2022-07-29 12:35:19 -04:00
Owen1212055
8a49cbc3a7 Send block entities after destroy prediction
Minecraft's prediction system does not handle block entities, so if we are manually sending block entities during
block breaking we need to set it after the prediction is finished. This fixes block entities not showing when cancelling the BlockBreakEvent.
2022-06-25 19:45:20 -04:00
Jake Potrebic
103a5ea12b Don't use level random in entity constructors
Paper makes the entity random thread-safe
and constructing an entity off the main thread
should be supported. Some entities (for whatever
reason) use the level's random in some places.
2022-07-10 14:13:22 -07:00
Jake Potrebic
e7c3763785 Add EntityPortalReadyEvent 2021-05-12 04:30:42 -07:00
Owen1212055
8cc67f527e More Teleport API 2021-09-05 12:15:59 -04:00
Jake Potrebic
4be7165c83 Fix Bee flower NPE 2022-07-06 14:59:38 -07:00
Jake Potrebic
ce5660a8e9 Add various missing EntityDropItemEvent calls 2021-07-20 21:35:47 -07:00
Spottedleaf
39156be36a Do not sync load chunk for dynamic game event listener registration
These can be called while an entity is being added to the world,
and if the entity is being added from a chunk load context the
sync load will block indefinitely (because the chunk load context
is for completing the chunk to FULL).

This does raise questions about the current system for these
dynamic registrations, as it looks like there is _zero_ logic
to account for the case where the chunk is _not_ currently loaded
and then later loaded.
2022-07-03 22:31:37 -07:00
u9g
78f9a96605 Add Player#getFishHook 2022-06-14 19:36:10 -04:00
Jake Potrebic
7cee8d5e02 Fix CCE for SplashPotion and LingeringPotion spawning
Remove in 1.19 along with the SplashPotion and
LingeringPotion interfaces
2022-04-21 18:18:02 -07:00
Owen1212055
dd19a41799 Prevent empty items from being added to world
The previous solution caused a bunch of bandaid fixes inorder to resolve edge cases where minecraft/the api might spawn items that are air.
Just simply prevent them from being added to the world instead.
2022-06-15 21:52:57 -04:00
Jake Potrebic
5cf40e45af Don't broadcast messages to command blocks
Previously the broadcast method would update the last output
in command blocks, and if called asynchronously, would throw
an error
2022-06-16 14:22:56 -07:00
Owen1212055
1f68916ac9 Nameable Banner API 2022-04-07 17:49:25 -04:00
Owen1212055
24d356944c Add missing important BlockStateListPopulator methods
Without these methods it causes exceptions due to these being used by certain feature generators.
2022-06-12 13:25:52 -04:00
Jake Potrebic
f2dcecf4d9 Add option for strict advancement dimension checks
Craftbukkit attempts to translate worlds that use the
same generation as the Overworld, The Nether, or The End
to use those dimensions when checking the `changed_dimension`
criteria trigger, or whether to trigger the `NETHER_TRAVEL`
distance trigger. This adds a config option to ignore that
and use the exact dimension key of the worlds involved.
2022-06-12 11:47:24 -07:00
nopjar
97cab1d4a4 Add WardenAngerChangeEvent 2022-06-12 02:26:04 +02:00
Owen1212055
edcdf97059 Dont resent entity on art update 2022-06-08 11:04:47 -04:00
Jake Potrebic
6a51d13dbf Throw exception on world create while being ticked
There are no plans to support creating worlds while worlds are
being ticked themselvess.
2022-03-22 12:44:30 -07:00
Owen1212055
4c16855bdd Prevent entity loading causing async lookups 2022-03-06 11:09:09 -05:00
Nassim Jahnke
1be6fca1f1 Disable component selector resolving in books by default 2022-06-02 20:35:58 +02:00
Owen1212055
37bf078394 Sanitize sent BlockEntity NBT 2021-12-03 16:55:50 -05:00
Jake Potrebic
01eab6be00 Fix FurnaceInventory for smokers and blast furnaces 2022-01-01 23:11:26 -08:00
Jake Potrebic
c3224863eb Fix OfflinePlayer#getBedSpawnLocation
When calling getBedSpawnLocation on an
instance of CraftOfflinePlayer the world was incorrect
due to the logic for reading the NBT not being up-to-date.
2022-05-30 16:03:36 -07:00
PanSzelescik
01cb81413b Add support for Proxy Protocol 2022-04-07 16:13:39 +02:00
Owen1212055
dedddea65d Expand FallingBlock API
- add auto expire setting
- add setter for block data
- add accessors for block state

== AT ==
public net.minecraft.world.entity.item.FallingBlockEntity blockState

Co-authored-by: Lukas Planz <lukas.planz@web.de>
2021-12-05 14:58:17 -05:00
Noah van der Aa
8c8e7968ab Don't tick markers
Fixes https://github.com/PaperMC/Paper/issues/7276 and https://github.com/PaperMC/Paper/issues/8118
by using a config option that, when set to false, does not add markers to the entity
tick list at all and ignores them in Spigot's activation range checks. The entity tick
list is only used in the tick and tickPassenger methods, so we can safely not add the
markers to it. When the config option is set to true, markers are ticked as normal.
2022-01-07 11:58:26 +01:00
u9g
2082797618 Add PlayerStopUsingItemEvent 2022-05-03 20:41:37 -04:00
Jake Potrebic
954f57e596 fix powder snow cauldrons not turning to water
Powder snow cauldrons should turn to water when
extinguishing an entity
2021-12-30 14:02:13 -08:00
Jake Potrebic
f40a8e5f0c Fire CauldronLevelChange on initial fill
Also don't fire level events or game events if stalactite
drip is cancelled
2022-03-29 13:46:23 -07:00
Jake Potrebic
2e86b22228 Add EntityDyeEvent and CollarColorable interface 2022-03-18 21:15:55 -07:00
Jake Potrebic
fc19bf4dc5 Trigger bee_nest_destroyed trigger in the correct place 2022-02-02 13:50:06 -08:00