Commit Graph
100 Commits
Author SHA1 Message Date
Jake Potrebic ca5499c7fa Switch Impl types to Holderable 2024-11-24 15:08:19 -08: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
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
Jake Potrebic 9467a08b36 Improve performance of RecipeMap#removeRecipe 2024-10-31 20:36:41 -07: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
Jake Potrebic 5b0133e675 Call bucket events for cauldrons 2022-01-16 10:13:33 -08:00
Jake Potrebic cea3e6b65b Improve entity effect API 2024-09-27 17:13:16 -07:00
Jake Potrebic 90bc5f1e0b Add FeatureFlag API 2024-05-29 19:50:21 -07:00
Jake Potrebic 8a940ca0ba Fix SculkBloomEvent firing for block entity loading 2024-08-19 13:43:06 -07: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
Jake Potrebic f6f6664716 Add API for CanPlaceOn and CanDestroy NBT values 2018-09-12 18:53:55 +03:00
Jake Potrebic 4ef8b976c9 Add ItemType#getItemRarity 2024-07-09 18:37:37 -07: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
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
Jake Potrebic 9d89ebb121 Properly remove the experimental smithing inventory type 2023-06-08 14:45:18 -07: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
Jake Potrebic 960d0c8179 Deprecate InvAction#HOTBAR_MOVE_AND_READD 2024-05-25 09:51:13 -07:00
Jake Potrebic acdfeeea3d Prevent NPE if hooked entity was cleared 2024-05-12 21:57:23 -07:00
Jake PotrebicandSoSeDiK 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
Jake PotrebicandGhastCraftHD 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
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
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
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
Jake Potrebic 49778e042c Add config for mobs immune to default effects 2020-12-02 21:03:02 -08: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
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
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
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
Jake Potrebic e06fe76018 More Raid API
== AT ==
public net.minecraft.world.entity.raid.Raid raidEvent
2022-03-04 09:46:33 -08: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
Jake PotrebicandAlexander 597ce940a4 Add PlayerTradeEvent and PlayerPurchaseEvent
Co-authored-by: Alexander <protonull@protonmail.com>
2020-07-02 16:12:10 -07:00
Jake Potrebic 66ed50064c Add drops to shear events 2021-05-18 12:32:02 -07: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
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
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
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
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
Jake Potrebic 183683ecc5 Add missing InventoryHolders to inventories 2022-01-24 00:09:02 -08:00
Jake Potrebic d300049246 Add titleOverride to InventoryOpenEvent 2022-03-04 12:45:03 -08:00
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
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
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
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
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
Jake Potrebic 06b00246a2 API for updating recipes on clients 2021-08-21 17:25:38 -07:00
Jake Potrebic d7a197deee Respect randomizeData on more entities when spawning
* ItemEntity
* PrimedTNT
* FireworkRocketEntity
* ExperienceOrb
2023-07-13 16:10:07 -07:00
Jake Potrebic 36ae0bcfea Only capture actual tree growth 2021-08-21 18:53:03 -07:00
Jake Potrebic 90366d505a Fix possible NPE on painting creation 2023-06-24 09:42:53 -07: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 PotrebicandSoSeDiK 5b97ae9832 More Sign Block API
Co-authored-by: SoSeDiK <mrsosedik@gmail.com>
2023-06-23 12:16:28 -07:00
Jake Potrebic b0579722db Fix cmd permission levels for command blocks 2022-01-24 15:32:02 -08:00
Jake Potrebic bd6baf7618 Add method to remove all active potion effects 2023-06-17 13:17:25 -07:00
Jake Potrebic 275331ae56 fix MapLike spam for missing key 'selector' 2023-06-14 13:17:40 -07:00
Jake PotrebicandWarrior 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
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
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
Jake PotrebicandLukas Planz 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
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
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
Jake Potrebic db1df52d4c Fix force-opening enchantment tables 2023-01-26 16:19:26 -08: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
Jake Potrebic 18a23db6f2 Improve PortalEvents 2022-12-15 10:33:39 -08:00
Jake PotrebicandJason Penilla b141cd3d99 Improve logging and errors
Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
2022-12-14 15:52:11 -08:00
Jake Potrebic 981cf9de7a Add BlockLockCheckEvent 2022-05-21 20:59:45 -07:00
Jake Potrebic 2b90721a45 fix Instruments
properly handle Player#playNote
2022-12-09 01:47:23 -08: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
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
Jake Potrebic e70d21dbfe ensure reset EnderDragon boss event name
Fix MC-257487
2022-11-12 10:08:58 -08: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
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
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 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
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
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
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
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
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
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