Commit graph

1098 commits

Author SHA1 Message Date
Jacob Litewski
1b118883f2 Make Amethyst throw both Spread and Grow Events 2023-06-13 19:16:39 -04:00
Jason Penilla
4ced264ab6 Only set despawnTimer for Wandering Traders spawned by WanderingTraderSpawner 2021-03-19 16:07:21 -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
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
275331ae56 fix MapLike spam for missing key 'selector' 2023-06-14 13:17:40 -07: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
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
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
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
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
Noah van der Aa
663afe7045 Add CompostItemEvent and EntityCompostItemEvent 2021-08-08 19:56:02 +02: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
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
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
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
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
Lulu13022002
533bc0c468 More vanilla friendly methods to update trades 2022-10-16 16:12:49 +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
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
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
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
Lulu13022002
a45d2c6068 Add source block to BlockPhysicsEvent 2022-08-07 22:16:36 +02: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
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
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
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
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
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
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
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
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
HexedHero
bc02501cc2 Expand PlayerItemDamageEvent 2022-04-10 06:26:32 +01:00
Doc
90ee0e7de2 Use username instead of display name in PlayerList#getPlayerStats 2022-04-15 17:40:30 -04:00
etil2jz
f97f51d382 Fix NBT pieces overriding a block entity during worldgen deadlock
By checking if the world passed into StructureTemplate's placeInWorld
is not a WorldGenRegion, we can bypass the deadlock entirely.
See https://bugs.mojang.com/browse/MC-246262
2022-04-02 23:29:24 +02:00
Doc
3dc8a5ce57 Allow changing the EnderDragon podium 2022-04-03 11:31:42 -04:00
Jake Potrebic
96c7383ba4 Cache resource keys and optimize reference Holder tags set
TagKeys are always interned, so we can use a reference hash set for them
2022-03-20 22:06:47 -07:00
Spottedleaf
636e993d37 Ensure entity passenger world matches ridden entity
Bad plugins doing this would cause some obvious problems...
2022-03-31 05:11:37 -07:00
Jake Potrebic
7b3898ad66 fix player loottables running when mob loot gamerule is false 2022-03-22 09:50:40 -07:00
SoSeDiK
58f0db0820 Fix new block data for EntityChangeBlockEvent
Also standardizes how to handle EntityChangeBlockEvent before a removeBlock or destroyBlock
call. Always use 'state.getFluidState().createLegacyBlock()' to get the new state instead of
just using the 'air' state.

Also fixes the new block data for EntityBreakDoorEvent (a sub-event from
EntityChangeBlockEvent)

Co-authored-by: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
2022-03-21 20:00:53 +02:00
Owen1212055
8f23a7f6af Add TameableDeathMessageEvent 2021-06-21 21:24:45 -04:00
Shane Freeder
30ccd487cf Buffer OOB setBlock calls
lets debug mode throw a trace in order to potentially see where
such calls are cascading from easier, but, generally, if you see one setBlock
call, you're gonna see more, and this just potentially causes a flood of logs
which can cause issues for slower terminals, etc.

We can limit the flood by just allowing one for a single gen region,
we'll also only gen a trace for the first one, I see no real pressing need
to generate more, given that that would *massively* negate this patch otherwise
2022-03-19 12:12:22 +00:00
Spottedleaf
0d199767d2 Don't allow vehicle movement from players while teleporting
Bring the vehicle move packet behavior in line with the
regular player move packet.
2022-03-14 12:35:37 -07:00
Spottedleaf
2de1053b58 Fix swamp hut cat generation deadlock
The worldgen thread will attempt to get structure references
via the world's getChunkAt method, which is fine if the gen is
not cancelled - but if the chunk was unloaded, the call will block
indefinitely. Instead of using the world state, we use the already
supplied ServerLevelAccessor which will always have the chunk available.
2022-03-12 06:31:13 -08:00
Owen1212055
df181fa967 More Projectile API
== AT ==
public net.minecraft.world.entity.projectile.FishingHook timeUntilLured
public net.minecraft.world.entity.projectile.FishingHook fishAngle
public net.minecraft.world.entity.projectile.ShulkerBullet targetDeltaX
public net.minecraft.world.entity.projectile.ShulkerBullet targetDeltaY
public net.minecraft.world.entity.projectile.ShulkerBullet targetDeltaZ
public net.minecraft.world.entity.projectile.ShulkerBullet currentMoveDirection
public net.minecraft.world.entity.projectile.ShulkerBullet flightSteps
public net.minecraft.world.entity.projectile.AbstractArrow soundEvent
public net.minecraft.world.entity.projectile.AbstractArrow setPickupItemStack(Lnet/minecraft/world/item/ItemStack;)V
public net.minecraft.world.entity.projectile.ThrownTrident dealtDamage
public net.minecraft.world.entity.projectile.Arrow NO_EFFECT_COLOR
public net.minecraft.world.entity.projectile.Projectile hasBeenShot
public net.minecraft.world.entity.projectile.Projectile leftOwner
public net.minecraft.world.entity.projectile.Projectile ownerUUID
public net.minecraft.world.entity.projectile.Projectile preOnHit(Lnet/minecraft/world/phys/HitResult;)V
public net.minecraft.world.entity.projectile.Projectile canHitEntity(Lnet/minecraft/world/entity/Entity;)Z
public net.minecraft.world.entity.projectile.FireworkRocketEntity getDefaultItem()Lnet/minecraft/world/item/ItemStack;
public net.minecraft.world.item.CrossbowItem FIREWORK_POWER

Co-authored-by: Nassim Jahnke <nassim@njahnke.dev>
Co-authored-by: SoSeDiK <mrsosedik@gmail.com>
Co-authored-by: MelnCat <melncatuwu@gmail.com>
Co-authored-by: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com>
2021-06-22 23:41:11 -04:00
Jake Potrebic
c6b07ad816 Fix cancelling ProjectileHitEvent for piercing arrows
Piercing arrows search for multiple entities inside a while
loop that is checking the projectile entity's removed state.
If the hit event is cancelled on the first entity, the event will
be called over and over again inside that while loop until the event
is not cancelled. The solution here, is to make use of an
already-existing field on AbstractArrow for tracking entities hit by
piercing arrows to avoid duplicate damage being applied.

== AT ==
protected net.minecraft.world.entity.projectile.Projectile hitCancelled
2022-02-19 19:05:59 -08:00
Nassim Jahnke
b85ac14d28 Force close world loading screen
Dead players would be stuck in the world loading screen and other players may
miss messages and similar sent in the join event if chunk loading is slow.
Paper already circumvents falling through the world before chunks are loaded,
so we do not need that. The client only needs the chunk it is currently in to
be loaded to close the loading screen, so we just send an empty one.
2022-03-02 09:45:56 +01:00
Jake Potrebic
0b5d7ad8d6 Custom Potion Mixes
== AT ==
public-f net.minecraft.server.MinecraftServer potionBrewing
2021-10-07 14:34:55 -07:00
Spottedleaf
299d7beee0 Put world into worldlist before initing the world
Some parts of legacy conversion will need the overworld
to get the legacy structure data storage
2022-02-22 14:21:35 -08:00
Jake Potrebic
b854576e5d Option to have default CustomSpawners in custom worlds
By default, only LevelStem's that specifically match the ResourceKey for
OVERWORLD will have the 5 (currently) impls of CustomSpawner (for
phantoms, wandering traders, etc.). This adds an option to instead of
just looking at the LevelStem key, look at the DimensionType key which
is one level below that. Defaults to off to keep vanilla behavior.
2022-02-19 20:15:41 -08:00
Jake Potrebic
c21f27243d Configurable sculk sensor listener range
== AT ==
public-f net.minecraft.world.level.gameevent.vibrations.VibrationListener listenerRange
2021-08-19 18:45:42 -07:00
Spottedleaf
62d962ce01 Execute chunk tasks fairly for worlds while waiting for next tick
Currently, only the first world would have had tasks executed.
This might result in chunks loading far slower in the nether,
for example.
2021-12-28 07:19:01 -08:00
Jake Potrebic
140e68625c Fix cancelled powdered snow bucket placement
Cancelling the placement of powdered snow from the powdered
snow bucket didn't revert grass that became snowy because of the
placement.
2021-10-08 13:12:58 -07:00
Jake Potrebic
83b4d889b7 Add missing structure set seed configs
The 4 missing structure set seed configs are strongholds, mineshafts,
buried treasure, and ancient cities.

Strongholds use a ring placement scheme which isn't random so they
utilize the world seed by default, this adds a config to override it
for just generating the ring positions.

Mineshafts and Buried Treasure structure sets are special cases
where the "salt" that can be defined for them via datapacks has 0
effect because the difference between the spacing and separation is 1
which is used as the upper bound in the random with salt. So the random
always returns the same int (0) so the salt has no effect. This adds
seeds/salts to the frequency reducer which has a similar effect.

Co-authored-by: William Blake Galbreath <blake.galbreath@gmail.com>
2022-01-13 23:05:53 -08:00
Shane Freeder
0202f1788d Use a CHM for StructureTemplate.Pallete cache
fixes a CME due to this collection being shared across threads
2021-07-12 12:28:29 +01:00
Owen1212055
0a2552a791 Freeze Tick Lock API 2021-12-26 20:27:43 -05:00
Kieran Wallbanks
e764b2b7f4 Fix NotePlayEvent
== AT ==
public org.bukkit.craftbukkit.block.data.CraftBlockData toNMS(Ljava/lang/Enum;Ljava/lang/Class;)Ljava/lang/Enum;
2021-06-21 14:23:50 +01:00
Brody Beckwith
a17ed327b3 Multi Block Change API Implementation 2022-01-14 00:41:11 -05:00
Jake Potrebic
1476dea76f Fix xp reward for baby zombies
The field that tracks the xpReward was not
getting reset if the death was cancelled
so this resets it after each call to
Zombie#getExperienceReward
2022-01-16 10:34:02 -08:00
Doc
87d0d2d557 Add configurable height for slime spawn 2021-08-02 11:24:39 -04:00
Nassim Jahnke
cbe94e7657 Reset placed block on exception 2022-01-07 11:45:15 +01:00
Cryptite
0fd1e5c650 Multiple Entries with Scoreboards 2021-09-21 18:17:33 -05:00
Jake Potrebic
69548ae4ec Add config option for worlds affected by time cmd 2022-01-02 22:34:51 -08:00
Jason Penilla
25af4f1bec Expose vanilla BiomeProvider from WorldInfo 2022-01-06 15:59:06 -08:00
Brokkonaut
a6dd9f7a68 Make water animal spawn height configurable 2021-12-18 08:26:55 +01:00
Spottedleaf
5be900b223 Validate usernames 2022-01-01 05:19:37 -08:00
Jake Potrebic
29d059d659 Fix sticky pistons and BlockPistonRetractEvent
There is an explicit check in the handling code for empty pistons that
prevents sticky pistons from firing the event. However when we look back
at the history we see that this check was originally added so that ONLY
sticky pistons would fire the retract event. I'm not sure why.
1092acbddf

Over the course of several updates, the meaning of that field appears to
have changed from "is NOT sticky" to "is sticky". So now its having the
opposite effect. Only normal pistons fire the retraction event. And like
all things in CB, it's just been carried around since.

If we are to believe the history, the correct fix for this issue is to
flip it so it only fires for sticky pistons, but that puts us in a
bind. It's already firing for non-sticky pistons, changing it now would
likely result in breakage. Furthermore, there is little documentation as
to WHY that was ever intended to be the case.

Instead we opt to remove the check entirely so that the event fires for
all piston types.

Co-authored-by: Zach Brown <1254957+zachbr@users.noreply.github.com>
Co-authored-by: Madeline Miller <mnmiller1@me.com>
2021-12-22 09:51:48 -08:00
Nassim Jahnke
929de37045 Configurable max block light for monster spawning 2021-12-16 09:40:39 +01:00
Jake Potrebic
d237e02832 Forward CraftEntity in teleport command 2021-12-04 17:04:47 -08:00
LemonCaramel
c5e4146598 Add more Campfire API 2021-07-16 00:39:03 +09:00
stonar96
71ac6d7e6a Optimize HashMapPalette
HashMapPalette uses an instance of CrudeIncrementalIntIdentityHashBiMap
internally. A Palette has a preset maximum size = 1 << bits.
CrudeIncrementalIntIdentityHashBiMap has an initial size but is
automatically resized. The CrudeIncrementalIntIdentityHashBiMap is created
with the maximum size in the constructor of HashMapPalette, with the aim
that it doesn't need to be resized anymore. However, there are two things
that I think Mojang hasn't considered here:
1) The CrudeIncrementalIntIdentityHashBiMap is resized, when its initial
size is reached and not the next time, when a further object is added.
2) HashMapPalette adds objects (unnecessarily) before checking if the
initial size of CrudeIncrementalIntIdentityHashBiMap is reached.
This means to actually avoid resize operations in
CrudeIncrementalIntIdentityHashBiMap, one has to add 2 to the initial size
or add 1 and check the size before adding objects. This commit implements
the second approach. Note that this isn't only an optimization but also
makes async reads of Palettes fail-safe. An async read while the
CrudeIncrementalIntIdentityHashBiMap is resized is fatal and can even lead
to corrupted data. This is also something that Anti-Xray is currently
relying on.
2021-01-17 01:11:36 +01:00
SamB440
24e3d1c857 Add PlayerItemFrameChangeEvent 2021-11-15 18:10:10 +00:00
Shane Freeder
c472c71eca Prevent ContainerOpenersCounter openCount from going negative 2021-11-30 05:30:35 +00:00
Jason Penilla
0919b52439 Fix Spigot growth modifiers
Fixes kelp modifier changing growth for other crops
Also add growth modifiers for glow berries, mangrove propagules,
torchflower crops and pitcher plant crops
Also fix above-mentioned modifiers from having the reverse effect

Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
Co-authored-by: Noah van der Aa <ndvdaa@gmail.com>
Co-authored-by: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com>
2021-12-03 17:09:24 -08:00
Jason Penilla
22d5c6386f Remove client-side code using deprecated for removal AccessController
Fixes warnings on build
2021-11-26 15:09:58 -08:00
Nassim Jahnke
99808779a1 Prevent excessive velocity through repeated crits 2021-11-25 10:25:09 +01:00
sulu5890
16f4f7a2e0 don't attempt to teleport dead entities 2021-10-24 22:48:14 -05:00
egg82
61353ac496 Add root/admin user detection
This patch detects whether or not the server is currently executing as a privileged user and spits out a warning.
The warning serves as a sort-of PSA for newer server admins who don't understand the risks of running as root.
We've seen plenty of bad/malicious plugins hit markets, and there's been a few close-calls with exploits in the past.
Hopefully this helps mitigate some potential damage to servers, even if it is just a warning.

Co-authored-by: Noah van der Aa <ndvdaa@gmail.com>
2021-09-11 22:55:14 +02:00
Nassim Jahnke
987d596834 Configurable feature seeds
Co-authored-by: Thonk <30448663+ExcessiveAmountsOfZombies@users.noreply.github.com>
2021-08-31 17:05:27 +02:00
Jake Potrebic
e259cfeb72 Fix upstreams block state factories
Sometimes, blocks are changed and then logic is called before the associated
tile entity is removed. When this happens, the factories were relying on the
block at the position, not the tile entity. This change prioritizes using the
tile entity type to determine the block state factory and falls back on
the material type of the block at that location.

== AT ==
public net.minecraft.world.level.block.entity.BlockEntityType validBlocks
2021-10-06 20:50:48 -07:00
Jake Potrebic
552c78a7a0 prevent unintended light block manipulation 2021-09-13 18:55:45 -07:00
Owen1212055
8c5582489a Update head rotation in missing places
In certain areas the player's head rotation could be desynced when teleported/moved.
This is because bukkit uses a separate head rotation field for yaw.
This issue only applies to players.
2021-06-21 21:55:23 -04:00
lexikiq
5c4d5afef1 Preserve overstacked loot
Preserves overstacked items in loot tables, such as shulker box drops, to prevent the items
from being deleted (as they'd overflow past the bounds of the container)-- or worse, causing
chunk bans via the large amount of NBT created by unstacking the items.

Fixes GH-5140 and GH-4748.
2021-06-21 23:21:58 -04:00
Jake Potrebic
37fa505050 fix various menus with empty level accesses 2021-07-11 12:52:56 -07:00
Shane Freeder
04a78195ec Fix CocaoDecorator causing a crash when trying to generate without logs 2021-09-07 21:29:38 +01:00
Noah van der Aa
f911fd4880 Prevent softlocked end exit portal generation 2021-08-30 15:22:18 +02:00
Nassim Jahnke
457b4033ab Ensure valid vehicle status 2021-09-28 09:47:47 +02:00
Spottedleaf
0277ecd75d Add packet limiter config
Example config:
packet-limiter:
  kick-message: '&cSent too many packets'
  limits:
    all:
      interval: 7.0
      max-packet-rate: 500.0
    ServerboundPlaceRecipePacket:
      interval: 4.0
      max-packet-rate: 5.0
      action: DROP

all section refers to all incoming packets, the action for all is
hard coded to KICK.

For specific limits, the section name is the class's name,
and an action can be defined: DROP or KICK

If interval or rate are less-than 0, the limit is ignored
2020-10-30 22:37:16 -07:00
stonar96
740e6b1eed Don't respond to ServerboundCommandSuggestionPacket when tab-complete is disabled 2021-09-12 00:14:21 +02:00
stonar96
62607d2c90 Check requirement before suggesting root nodes
Child nodes are handled by CommandDispatcher#parse checking
requirements.

Vanilla clients only send ServerboundCommandSuggestionPacket when
encountering a command node with ASK_SERVER suggestions, however a
modified client can send this packet whenever it wants.
2021-09-12 00:14:21 +02:00
Jake Potrebic
ce689ae7e0 Fix merchant inventory not closing on entity removal 2021-09-02 00:24:06 -07:00
Spottedleaf
d063ae6275 Optimise BlockSoil nearby water lookup
Apparently the abstract block iteration was taking about
75% of the method call.
2021-06-10 14:36:00 -07:00
Spottedleaf
82a8294625 Oprimise map impl for tracked players
Reference2BooleanOpenHashMap is going to have
better lookups than HashMap.
2021-02-19 22:51:52 -08:00
Spottedleaf
12321d761e Don't lookup fluid state when raytracing, skip air blocks
Just use the iblockdata already retrieved, removes a getType call.

Also save approx. 5% for the raytrace call, as most (expensive)
raytracing tends to go through air and returning early is an
easy win. The remaining problems with this function
are mostly with the block getting itself.
2020-08-28 12:33:47 -07:00
Spottedleaf
698c758855 Don't read neighbour chunk data off disk when converting chunks
Lighting is purged on update anyways, so let's not add more
into the conversion process
2021-04-11 02:58:48 -07:00
Spottedleaf
ebaf017f9c Make sure inlined getChunkAt has inlined logic for loaded chunks
Tux did some profiling some time ago and showed that the
previous getChunkAt method which had inlined logic for loaded
chunks did get inlined, but the standard CPS.getChunkAt
method was not inlined.
2020-09-20 16:10:49 -07:00
Spottedleaf
32107198d1 Manually inline methods in BlockPosition 2020-07-06 22:48:48 -07:00
Nassim Jahnke
37bc4f0b04 Sanitize ResourceLocation error logging 2021-08-26 12:09:47 +02:00
Jason Penilla
b67ec825d2 Add '/paper mobcaps' and '/paper playermobcaps'
Add commands to get the mobcaps for a world, as well as the mobcaps for
each player when per-player mob spawning is enabled.

Also has a hover text on each mob category listing what entity types are
in said category
2021-08-16 01:31:54 -05:00
Spottedleaf
c593e8510e Improve and expand AsyncCatcher
Log when the async catcher is tripped
  The chunk system can swallow the exception given it's all
  built with completablefuture, so ensure it is at least printed.

Add/move several async catchers

Async catch modifications to critical entity state
  These used to be here from Spigot, but were dropped with 1.17.
  Now in 1.17, this state is _even more_ critical than it was before,
  so these must exist to catch stupid plugins.

Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
2021-08-25 20:17:12 -07:00
Spottedleaf
efb3bbf2bb Fix GameProfileCache concurrency
Separate lookup and state access locks prevent lookups
from stalling simple state access/write calls
2020-07-11 05:09:28 -07:00
Spottedleaf
7b293aba08 Do not run close logic for inventories on chunk unload
Still call the event and change the active container though. We
want to avoid close logic because it's possible to load the
chunk through it. This should also be OK from a leak prevention/
state desync POV because the TE is getting unloaded anyways.
2021-03-11 03:03:32 -08:00
Jason Penilla
6dafeceebd Vanilla command permission fixes
Fixes permission checks for vanilla commands which don't have a
requirement, as well as for namespaced vanilla commands.

== AT ==
public-f com.mojang.brigadier.tree.CommandNode requirement
2021-08-25 13:19:53 -07:00
Mariell Hoversholm
33aad47ee1 Add Raw Byte Entity Serialization
== AT ==
public net.minecraft.world.entity.Entity setLevel(Lnet/minecraft/world/level/Level;)V
2021-10-24 16:20:31 -04:00
Seggan
4e20ba8bf7 Goat ram API 2021-08-05 13:10:27 -04:00
Jake Potrebic
310d8c53aa Fix issues with mob conversion 2021-10-24 20:29:45 -07:00
dodison
2852803dbf Add critical damage API 2021-07-26 17:32:36 +02:00
syldium
864494345a Add more advancement API
== AT ==
public net.minecraft.advancements.Advancement decorateName(Lnet/minecraft/advancements/DisplayInfo;)Lnet/minecraft/network/chat/Component;

Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
2021-07-09 18:50:40 +02:00
Jakub Zacek
067c4e04bd Add methods to find targets for lightning strikes
== AT ==
public net.minecraft.server.level.ServerLevel findLightningRod(Lnet/minecraft/core/BlockPos;)Ljava/util/Optional;
2021-10-04 10:16:44 +02:00
Jake Potrebic
424403988d Add back EntityPortalExitEvent 2021-05-16 09:39:46 -07:00
Jake Potrebic
65ec6cf342 Option to prevent data components copy in smithing recipes 2021-09-26 12:57:28 -07:00
Jake Potrebic
b96b8f7723 Add BlockBreakBlockEvent 2021-01-03 17:58:11 -08:00
Jake Potrebic
a6362921cc Change EnderEye target without changing other things 2021-08-21 12:13:53 -07:00
Warrior
c754319985 Configurable item frame map cursor update interval 2021-08-13 01:14:38 +02:00
Andrew Steinborn
8a3f9f7eb6 Optimize indirect passenger iteration 2021-08-09 00:38:37 -04:00
Jake Potrebic
826dc5744d Add EntityDamageItemEvent 2020-12-22 13:52:48 -08:00
Jason Penilla
d4dfcccc84 Config option for Piglins guarding chests 2020-12-02 03:07:58 -08:00
Andrew Steinborn
ac0d44684a Optimize entity tracker passenger checks 2021-08-08 00:52:54 -04:00
Jake Potrebic
70262052bd Make hoppers respect inventory max stack size 2021-07-07 16:30:17 -07:00
Jake Potrebic
0e4e270396 Add PlayerSetSpawnEvent 2021-05-19 18:59:10 -07:00
Professor Bloodstone
2e42192ea2 Allow skipping writing of comments to server.properties
Makes less git noise, as it won't update the date every single time

Use -DPaper.skipServerPropertiesComments=true flag to disable writing it
2021-07-23 02:32:04 +02:00
Noah van der Aa
bb3dbd3116 Prevent AFK kick while watching end credits 2021-07-24 16:54:11 +02:00
Jake Potrebic
29ce813416 Add missing forceDrop toggles 2021-07-20 21:25:35 -07:00
Phoenix616
a600754f0d Rate options and timings for sensors and behaviors
This adds config options to specify the tick rate for sensors
 and behaviors of different entity types as well as timings
 for those in order to be able to have some metrics as to which
 ones might need tweaking.
2021-06-28 22:38:29 +01:00
Phoenix616
e7de2be721 Don't apply cramming damage to players
It does not make a lot of sense to damage players if they get crammed,
 especially as the usecase of teleporting lots of players to the same
 location isn't too uncommon and killing all those players isn't
 really what one would expect to happen.

For those who really want it a config option is provided.
2021-06-20 16:35:42 +01:00
Jake Potrebic
818a84cfbe Fix kick event leave message not being sent 2021-07-07 16:19:41 -07:00
Jake Potrebic
485db97ad6 Add PlayerArmSwingEvent 2021-03-12 19:22:21 -08:00
Jake Potrebic
39716421ea Fix commands from signs not firing command events
This patch changes sign command logic so that `run_command` click events:
  - are logged to the console
  - fire PlayerCommandPreprocessEvent
  - work with double-slash commands like `//wand`
  - sends failure messages to the player who clicked the sign
2021-07-09 13:50:48 -07:00
Spottedleaf
9ce3172c9f Use getChunkIfLoadedImmediately in places
This prevents us from hitting chunk loads for chunks at or less-than
ticket level 33 (yes getChunkIfLoaded will actually perform a chunk
load in that case).
2019-07-08 00:13:36 -07:00
Owen1212055
df822c00c9 Missing Entity API
== AT ==
public net.minecraft.world.entity.animal.Fox isDefending()Z
public net.minecraft.world.entity.animal.Fox setDefending(Z)V
public net.minecraft.world.entity.animal.Fox setFaceplanted(Z)V
public net.minecraft.world.entity.animal.Panda getEatCounter()I
public net.minecraft.world.entity.animal.Panda setEatCounter(I)V
public net.minecraft.world.entity.animal.Bee isRolling()Z
public net.minecraft.world.entity.animal.Bee setRolling(Z)V
public net.minecraft.world.entity.animal.Bee numCropsGrownSincePollination
public net.minecraft.world.entity.animal.Bee ticksWithoutNectarSinceExitingHive
public net.minecraft.world.entity.monster.piglin.Piglin isChargingCrossbow()Z
public net.minecraft.world.entity.ambient.Bat targetPosition
public net.minecraft.world.entity.monster.Ravager attackTick
public net.minecraft.world.entity.monster.Ravager stunnedTick
public net.minecraft.world.entity.monster.Ravager roarTick
public net.minecraft.world.entity.vehicle.MinecartTNT explode(D)V
public net.minecraft.world.entity.vehicle.MinecartTNT fuse
public net.minecraft.world.entity.monster.Endermite life
public net.minecraft.world.entity.projectile.AbstractArrow soundEvent
public net.minecraft.world.entity.monster.Phantom anchorPoint
public net.minecraft.world.entity.npc.WanderingTrader getWanderTarget()Lnet/minecraft/core/BlockPos;
public net.minecraft.world.entity.animal.AbstractSchoolingFish leader
public net.minecraft.world.entity.animal.AbstractSchoolingFish schoolSize
public net.minecraft.world.entity.animal.Rabbit moreCarrotTicks
public net.minecraft.world.entity.AreaEffectCloud ownerUUID
public net.minecraft.world.entity.animal.MushroomCow stewEffects
public net.minecraft.world.entity.Entity FLAG_INVISIBLE
public net.minecraft.world.entity.animal.Cat setRelaxStateOne(Z)V
public net.minecraft.world.entity.animal.Cat isRelaxStateOne()Z

Co-authored-by: Nassim Jahnke <nassim@njahnke.dev>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
Co-authored-by: William Blake Galbreath <blake.galbreath@gmail.com>
Co-authored-by: SoSeDiK <mrsosedik@gmail.com>
Co-authored-by: booky10 <boooky10@gmail.com>
Co-authored-by: Amin <amin.haddou@frg.wwschool.de>
Co-authored-by: TrollyLoki <trollyloki@gmail.com>
Co-authored-by: FireInstall <kettnerl@hu-berlin.de>
Co-authored-by: maxcom1 <46265094+maxcom1@users.noreply.github.com>
Co-authored-by: TotalledZebra <Holappa57@gmail.com>
2021-06-21 23:56:07 -04:00
Spottedleaf
ac687d7ecb Fix PlayerDropItemEvent using wrong item 2021-06-20 21:55:59 -07:00
Jake Potrebic
0bf80e49be Fix potions splash events
Fix PotionSplashEvent for water splash potions
Fixes SPIGOT-6221: https://hub.spigotmc.org/jira/projects/SPIGOT/issues/SPIGOT-6221
Fix splash events cancellation that still show particles/sound
2021-05-20 20:40:53 -07:00
TwoLeggedCat
750a4590ce Line Of Sight Changes 2021-05-29 14:33:25 -05:00
Aikar
c002a90053 Optimize Biome Mob Lookups for Mob Spawning
Uses an EnumMap as well as a Set paired List for O(1) contains calls.
2018-09-12 21:47:01 -04:00
Owen1212055
f67092fe39 Add ElderGuardianAppearanceEvent 2021-03-19 23:39:09 -04:00
Max Lee
4198f9a836 Fix invulnerable end crystals
MC-108513
2021-05-27 14:52:30 -07:00
Owen1212055
16ad983f5c Add BellRevealRaiderEvent 2021-05-26 17:09:07 -04:00
GioSDA
c9533ae126 Add option to fix items merging through walls 2021-03-10 10:06:45 -08:00
Aikar
c4f8064fb9 Synchronize PalettedContainer instead of ThreadingDetector/Semaphore
Mojang has flaws in their logic about chunks being concurrently
wrote to. So we constantly see crashes around multiple threads writing.

Additionally, java has optimized synchronization so well that its
in many times faster than trying to manage read write locks for low
contention situations.

And this is extremely a low contention situation.
2020-05-29 20:29:02 -04:00
Jake Potrebic
e86b844e04 Fix PlayerBucketEmptyEvent result itemstack
Fixes SPIGOT-2560: https://hub.spigotmc.org/jira/projects/SPIGOT/issues/SPIGOT-2560
2021-05-20 22:16:37 -07:00
HexedHero
37143dae29 Add PufferFishStateChangeEvent 2021-05-10 16:59:05 +01:00
Jake Potrebic
75225eb102 Add PlayerKickEvent causes 2021-05-15 20:30:45 -07:00
Yive
e8cb0ac761 Limit item frame cursors on maps 2021-05-26 15:09:33 -07:00
Jake Potrebic
f61b2947ad Add cause to Weather/ThunderChangeEvents 2020-12-02 18:23:26 -08:00
Jake Potrebic
eb675d9110 Add EntityInsideBlockEvent 2021-05-08 18:02:36 -07:00
Andrew Steinborn
cc2c25ba55 Add Unix domain socket support 2021-05-11 17:39:22 -04:00
Jake Potrebic
15d02795ea Correctly check if bucket dispenses will succeed for event
Upstream incorrectly checks if the bucket place will succeed
in order to fire the BlockDispenseEvent. This patch corrects
that.
2024-01-01 12:57:19 -08:00
Nassim Jahnke
5392798da4 Move range check for block placing up 2022-06-08 10:52:18 +02:00
Jake Potrebic
d6b69e74a9 Expand PlayerGameModeChangeEvent 2021-05-15 10:04:43 -07:00
Riley Park
64365b4218 Add environment variable to disable server gui 2021-05-17 00:34:55 -07:00
MeFisto94
637bb9a05d Add a "should burn in sunlight" API for Phantoms and Skeletons 2021-05-11 00:48:33 +02:00
Alvinn8
556bc3e8b5 Add Adventure message to PlayerAdvancementDoneEvent 2021-01-08 20:31:13 +01:00
Owen1212055
f24aec2051 Add EntityBlockStorage#clearEntities() 2021-04-05 18:12:29 -04:00
HexedHero
2329a7b1c8 Add more WanderingTrader API 2021-05-06 14:56:43 +01:00
Shane Freeder
6949e999eb Send empty commands if tab completion is disabled 2021-04-26 01:27:08 +01:00
Nassim Jahnke
3ab2001afb Add Channel initialization listeners 2021-04-29 21:19:33 +02:00
Spyridon Pagkalos
639cb2d6aa Introduce beacon activation/deactivation events 2021-03-25 20:28:04 +02:00
HexedHero
73239b4aa7 Expand PlayerRespawnEvent, fix passed parameter issues
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
2021-04-23 22:42:42 +01:00
Jason Penilla
b9cab64e46 Implement methods to convert between Component and Brigadier's Message 2021-04-24 02:09:32 -07:00
Jake Potrebic
472880fdde Add PlayerBedFailEnterEvent 2020-12-24 12:27:41 -08:00
Jake Potrebic
bb4539d223 Add PlayerDeepSleepEvent 2021-04-21 15:58:19 -07:00
chickeneer
a3c944c37b fix PlayerItemHeldEvent firing twice 2021-04-22 19:02:07 -07:00
Trigary
83afbd0e3b fix PigZombieAngerEvent cancellation 2021-03-18 21:38:01 +01:00
Jake Potrebic
8683cde7c0 add consumeFuel to FurnaceBurnEvent 2021-04-22 16:45:28 -07:00
Shane Freeder
635832cc39 Add bypass host check
Paper.bypassHostCheck

Seriously, fix your firewalls. -.-
2021-04-18 21:27:01 +01:00
chickeneer
3ab3613d10 Fix PlayerItemConsumeEvent cancelling properly
When the active item is not cleared, the item is still readied
for use and will repeatedly trigger the PlayerItemConsumeEvent
till their item is switched.
This patch clears the active item when the event is cancelled
2021-03-19 00:33:15 -05:00
Jason Penilla
a6eda6cb37 Enhance console tab completions for brigadier commands
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
2021-03-30 16:06:08 -07:00
Jason Penilla
273355e28c Don't ignore result of PlayerEditBookEvent 2021-04-05 18:35:15 -07:00
Trigary
f2e70c48f9 forced whitelist: use configurable kick message 2021-03-27 09:24:23 +01:00
Dmitry Sidorov
06ee0e08d7 Drop carried item when player has disconnected
Fixes disappearance of held items, when a player gets disconnected and PlayerDropItemEvent is cancelled.
Closes #5036
2021-02-04 20:32:01 +03:00
Irmo van den Berge
28e1766b3b Add fast alternative constructor for Rotations 2021-03-10 21:26:31 +01:00
Anton Lindroth
a032df8427 Allow using signs inside spawn protection 2020-04-15 01:54:02 +02:00
Thonk
a9cee72542 Add recipe to cook events 2021-01-06 12:04:03 -08:00
Jake Potrebic
000882670b Add PlayerNameEntityEvent 2020-07-05 00:33:54 -07:00
Jake Potrebic
eed0bcb63d Add worldborder events 2021-01-04 22:40:34 -08:00
Jake Potrebic
bf99953fa0 fix converting txt to json file 2021-01-04 19:49:15 -08:00
AlexProgrammerDE
73deb32107 Improve ServerGUI
- Added logo to server frame
- Show tps in the server stats
2020-10-03 08:27:40 +02:00
ysl3000
6b65e03d85 living entity allow attribute registration 2020-10-24 16:37:44 +02:00
Andrew Steinborn
1d6a99b50b Inline shift direction fields
Removes a layer of indirection for EnumDirection.getAdjacent(X|Y|Z)(), which is in the
critical section for much of the server, including the lighting engine.
2021-01-18 20:45:25 -05:00
lukas81298
9ba22a1143 added option to disable pathfinding updates on block changes 2021-01-25 14:37:57 +01:00
William Blake Galbreath
48c492c4d1 Add EntityMoveEvent 2020-02-11 21:56:48 -06:00
Trigary
6f6ed7acb9 Add DragonEggFormEvent 2021-01-25 14:53:57 +01:00
Yive
e3b367dcae Reset shield blocking on dimension change 2021-01-24 08:55:19 -08:00
Nassim Jahnke
a85863338c Expand EntityUnleashEvent 2021-01-29 15:13:11 +01:00
Jake Potrebic
1292627c18 Add PlayerStonecutterRecipeSelectEvent
Co-Authored-By: MiniDigger | Martin <admin@benndorf.dev>
2020-11-27 17:14:27 -08:00
William Blake Galbreath
d4892b5c73 Add toggle for always placing the dragon egg 2020-11-26 11:47:24 +00:00
Jake Potrebic
92507ca231 Add PlayerChangeBeaconEffectEvent 2020-06-24 15:14:51 -06:00
Madeline Miller
b69f8fb10b Add BlockPreDispenseEvent 2021-01-17 13:16:09 +10:00
Jake Potrebic
cd4969468c Configurable max leash distance 2021-01-03 21:04:03 -08:00
Jake Potrebic
0faa210781 Make schedule command per-world 2021-01-04 19:52:44 -08:00
CDFN
3daa3905f0 Return chat component with empty text instead of throwing exception 2020-07-07 17:53:23 +02:00
Mariell Hoversholm
df6902585c Collision option for requiring a player participant 2020-11-14 16:48:37 +01:00
dfsek
33a7c0284d Add StructuresLocateEvent
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
2020-09-16 01:12:29 -07:00
Jake Potrebic
239e7a6b37 Add RegistryAccess for managing Registries
RegistryAccess is independant from CraftServer and
doesn't require one to be created allowing the
org.bukkit.Registry class to be loaded earlier.

== AT ==
public net.minecraft.server.RegistryLayer STATIC_ACCESS
2023-02-27 18:28:39 -08:00
Mariell Hoversholm
23b8639dbf Add sendOpLevel API 2020-12-29 15:03:03 +01:00
Jason Penilla
921d396ffa Fix villager boat exploit 2021-01-11 12:43:51 -08:00
Shane Freeder
cabf9f914d Remove stale POIs 2021-01-09 14:17:07 +01:00
Mariell Hoversholm
6ba5436a48 Empty commands shall not be dispatched 2021-01-06 23:38:43 +01:00
Jake Potrebic
36020d6749 Configurable door breaking difficulty
== AT ==
public net.minecraft.world.entity.monster.Vindicator DOOR_BREAKING_PREDICATE
public net.minecraft.world.entity.monster.Zombie DOOR_BREAKING_PREDICATE

Co-authored-by: Doc <nachito94@msn.com>
2021-01-03 22:27:43 -08:00
Jake Potrebic
55c56acfc0 Add PlayerLoomPatternSelectEvent 2020-11-25 16:33:27 -08:00
Jake Potrebic
4054b19800 Add PlayerLecternPageChangeEvent 2020-11-23 12:58:51 -08:00
TheViperShow
36eff9b616 Add BlockFailedDispenseEvent 2020-04-22 09:40:38 +02:00
Jake Potrebic
84d13a09ca Add world settings for mobs picking up loot 2020-11-28 18:43:52 -08:00
Jake Potrebic
1245e2a0de Add ServerResourcesReloadedEvent 2020-12-02 20:04:01 -08:00
Jake Potrebic
1e05072232 Add WorldGameRuleChangeEvent 2020-12-20 16:41:44 -08:00
JRoy
e793c7d8be Add EntityLoadCrossbowEvent 2020-10-07 12:04:01 -04:00
Jake Potrebic
2ff5ce988f Fix nerfed slime when splitting 2020-08-24 08:39:06 -07:00
TheMolkaPL
40789b9ca7 Fix interact event not being called sometimes
* Call PlayerInteractEvent when left-clicking on a block in adventure
  mode.
* Call PlayerInteractEvent when left-clicking an Entity that is out of
  range in adventure/survival (entity reach is 3.0).

Co-authored-by: Moulberry <james.jenour@protonmail.com>
2020-06-21 17:21:46 +02:00
MisterVector
a5f9a41152 Add PlayerFlowerPotManipulateEvent 2019-08-13 19:45:06 -07:00
Aikar
397d058748 Fix "Not a string" Map Conversion spam
The maps did convert successfully, but had noisy logs due to Spigot
implementing this logic incorrectly.

This stops the spam by converting the old format to new before
requesting the world.

Track spigot issue to see when fixed: https://hub.spigotmc.org/jira/browse/SPIGOT-6181
2020-10-08 00:00:25 -04:00
BrodyBeckwith
870ed90a9a Allow disabling mob spawner spawn egg transformation 2020-10-09 20:30:12 -04:00
Madeline Miller
38ea31d1cb API to get Material from Boats and Minecarts
== AT ==
public net.minecraft.world.entity.vehicle.AbstractBoat getDropItem()Lnet/minecraft/world/item/Item;
2020-12-31 12:48:19 +10:00
BillyGalbreath
d9c0a60246 MC-4: Fix item position desync
This fixes item position desync (MC-4) by running the item coordinates
through the encode/decode methods of the packet that causes the precision
loss, which forces the server to lose the same precision as the client
keeping them in sync.
2020-12-08 20:24:52 -06:00
Jason Penilla
c4dc717563 Add TargetHitEvent 2020-11-25 23:20:44 -08:00
Shane Freeder
5b7474984b Fix crash from invalid ingredient lists in VillagerAcquireTradeEvent 2020-12-27 11:31:06 +00:00
Mark Vainomaa
1cedeb97af Expose LivingEntity hurt direction 2020-12-13 05:32:05 +02:00
Aikar
3f4b9fd365 Optimize Dynamic#get Missing Keys
get was calling toString() on every NBT object that was ever asked for an optional
key from the object to build a string for the error text.

When done on large NBT objects, this was using a ton of computation time building the
JSON representation of the NBT object.

Now we will just skip the value when 99.9999% of the time the text is never even printed.
2020-12-21 11:01:42 -05:00
ysl3000
e32901791b Player Chunk Load/Unload Events 2020-10-05 21:25:16 +02:00
Shane Freeder
1f21f3032b Limit recipe packets 2020-12-12 23:45:28 +00:00
JRoy
661fc1e52e Add PlayerShearBlockEvent 2020-08-27 15:02:48 -04:00
William Blake Galbreath
22069fd885 Climbing should not bypass cramming gamerule 2020-08-23 20:59:00 +02:00
SuperCoder7979
e1ec33acb3 Significantly improve performance of the end generation
This patch implements a noise cache for the end which significantly reduces the computation time of generation. This results in about a 3x improvement.

Original code by SuperCoder7979 and Gegy in Lithium, licensed under LGPL-3.0 (Source: https://github.com/jellysquid3/lithium-fabric)

Co-authored-by: Gegy <gegy1000@gmail.com>
Co-authored-by: Dylan Xaldin <Puremin0rez515@gmail.com>
Co-authored-by: pop4959 <pop4959@gmail.com>
2020-11-03 23:48:05 -06:00
Nassim Jahnke
d1d54d35bf Add PlayerItemCooldownEvent 2020-08-25 13:48:33 +02:00
Ineusia
c068010b34 Add Destroy Speed API
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
2020-10-26 11:48:06 -05:00
Jason Penilla
93f14c745c Add Wandering Trader spawn rate config options
Adds config options for modifying the spawn rates of Wandering Traders.
These values are all easy to understand and configure after a quick read of this
page on the Minecraft wiki: https://minecraft.wiki/wiki/Wandering_Trader#Spawning
Usages of the vanilla WanderingTraderSpawnDelay and WanderingTraderSpawnChance values
in IWorldServerData are removed as they were only used in certain places, with hardcoded
values used in other places.
2020-08-20 11:20:12 -07:00
Mariell Hoversholm
4b0e4655fd Add API for quit reason 2020-11-14 16:19:52 +01:00
Jake Potrebic
5b1f73e2dc Beacon API - custom effect ranges 2020-06-24 12:39:08 -06:00
Mariell Hoversholm
c8ba4fb789 Toggle for removing existing dragon 2020-09-30 22:49:14 +02:00
Mariell Hoversholm
8bac10ce5e Add ignore discounts API 2020-11-09 20:44:51 +01:00
Toon Schoenmakers
69fa242c6a Avoid error bubbling up when item stack is empty in fishing loot
This can realistically only happen if there's custom loot active on fishing
which can return 0 items. This would disconnect the player who's fishing.
2020-10-23 15:01:44 +02:00
giacomo
053db61214 Fix bell block entity memory leak
BellBlockEntity has a list of entities (entitiesAtRing) that was not being cleared at the right time, causing leaks whenever a bell would be rung near a crowd of entities.
2020-10-10 12:15:33 +02:00
William Blake Galbreath
416280fc29 Fix item locations dropped from campfires
Fixes #4259 by not flooring the blockposition among other weirdness
Vanilla Issue: MC-267622
2020-10-03 20:32:25 -05:00
Spottedleaf
87fdd68f47 Retain block place order when capturing blockstates
Fixes twisted vines not connecting properly when grown via
bonemeal by a player.

In general, look at making this logic more robust (i.e properly handling
cases where a captured entry is overriden) - but for now this will do.
2020-08-07 04:27:56 -07:00
William Blake Galbreath
691c4ee7b6 Villager#resetOffers 2019-10-07 00:15:37 -05:00
Spottedleaf
f24af9bc9c Optimise getType calls
Remove the map lookup for converting from Block->Bukkit Material
2020-06-03 11:37:13 -07:00
Spottedleaf
093bd60eae Fix for large move vectors crashing server
Check movement distance also based on current position.
2020-05-17 23:47:33 -07:00
Aikar
c760673958 Reset Ender Crystals on Dragon Spawn
Crystals can end up in a bad state in certain conditions which causes
an exception on the expected number of crystals going negative.

This ensures the crystals/pillars are in expected state when the dragon spawns.

See #3522
2016-06-01 23:29:17 -04:00
Aikar
1d8508b7ac Fix Concurrency issue in ShufflingList
if multiple threads from worldgen sort at same time, it will crash.
So make a copy of the list for sorting purposes.
2020-07-06 18:36:41 -04:00
William Blake Galbreath
c2be5a5354 Fix deop kicking non-whitelisted player when white list is not enabled 2020-10-03 22:00:27 -05:00
William Blake Galbreath
972b6a6f18 Entity#isTicking 2020-10-03 21:39:16 -05:00
MeFisto94
73b101005b Expose the Entity Counter to allow plugins to use valid and non-conflicting Entity Ids 2020-08-28 01:41:26 +02:00
Shane Freeder
af1fabed04 Extend block drop capture to capture all items added to the world 2020-09-17 00:36:05 +01:00
Aikar
a4cc307c2b Cache DataFixerUpper Rewrite Rules on demand
Mojang precaches every single potential rewrite rule that could ever
exist on server startup. This includes rules from all the way back to versions from 6+ years ago.

This is the source of why the server hogs every CPU core at 100% every start.

For anyone who hard resets for updates or has force upgraded their entire world, this
results in completely wasted cpu cycles.

This massive CPU usage also delays server startup time.

We improve this by making "min version to precache" that defaults to a future version
so that no rewrite rules are precached.

someone who expects to be converting a lot chunks could theoretically set
-DPaper.minPrecachedDatafixVersion=<dataVersionConvertingFrom> as a startup
parameter and only build from that point on.

However this will likely never be needed as the server will still run
the same cache logic on demand when it's actually needed. The only
cost would be some delay on the FIRST chunk conversion, but paper already
runs chunk conversions on another thread so this will likely never be
a concern for TPS.

This patch will significantly reduce CPU use on startup, reduce memory usage,
and improve server startup time.
2020-09-12 17:21:38 -04:00
Aikar
aebf9e869b Fix Entity Teleportation and cancel velocity if teleported
Uses correct setPositionRotation for Entity teleporting instead of setLocation
as this is how Vanilla teleports entities.

Cancel any pending motion when teleported.
2020-08-25 20:45:36 -04:00
miclebrick
74de6853f4 Cache block data strings 2018-12-06 19:52:50 -05:00
JRoy
88335d97a8 Fix hex colors not working in some kick messages 2020-08-27 16:57:25 -04:00
Shane Freeder
5d139ca424 Buffer joins to world
This patch buffers the number of logins which will attempt to join
the world per tick, this attempts to reduce the impact that join floods
has on the server
2020-08-19 05:05:54 +01:00
BillyGalbreath
f1a2ddbc7b Add zombie targets turtle egg config 2020-08-23 15:47:34 +02:00
commandblockguy
54ce8682aa Prevent headless pistons from being created
Prevent headless pistons from being created by explosions or tree/mushroom growth.
2020-08-14 14:44:14 -05:00
Zach Brown
300af129c1 Do not let the server load chunks from newer versions
If the server attempts to load a chunk generated by a newer version of
the game, immediately stop the server to prevent data corruption.

You can override this functionality at your own peril.
2019-07-23 20:44:47 -05:00
William Blake Galbreath
b77fd7dd24 Fix SpawnChangeEvent not firing for all use-cases 2020-08-22 23:36:21 +02:00
Mariell Hoversholm
17cde37876 Don't require FACING data 2020-08-23 19:01:04 +02:00
DigitalRegent
0ef48f1dd1 Brand support 2020-04-11 13:10:58 +02:00
Spottedleaf
07d11145d9 Fix some rails connecting improperly 2020-07-24 15:56:05 -07:00
Andrew Steinborn
5f6808db9a Optimize NetworkManager Exception Handling 2020-07-05 22:38:18 -04:00
Spottedleaf
7b340b4aa2 Fix AdvancementDataPlayer leak due from quitting early in login
Move the criterion storage to the AdvancementDataPlayer object
itself, so the criterion object stores no references - and thus
needs no cleanup.
2020-07-13 06:22:54 -07:00
William Blake Galbreath
760f623ace Fix SPIGOT-5885 Unable to disable advancements 2020-07-10 12:38:12 -05:00
William Blake Galbreath
1110af5fe2 Fix SPIGOT-5824 Bukkit world-container is not used 2020-07-10 13:12:33 -05:00
Aikar
def8b96d4b Thread Safe Vanilla Command permission checking
Datapacks check this on load and are built concurrently. This was breaking them badly due
to race conditions.

Plus, .canUse we want to be safe for async anyways.
2020-07-11 03:54:28 -04:00
William Blake Galbreath
3ceb5297a3 Fix arrows never despawning MC-125757
This forces the despawn counter to start ticking regardless of
state after the arrow has been alive for 200 ticks (10 seconds)
instead of getting stuck in a never despawn state (bubble columns,
etc).
2020-07-08 11:24:30 -05:00
Aikar
9cb53a41ca Don't check chunk for portal on world gen entity add 2020-07-05 14:59:31 -04:00
William Blake Galbreath
ea5eaa7503 Add PrepareResultEvent
Adds a new event for all crafting stations that generate a result slot item

Anvil, Grindstone and Smithing now extend this event
2020-07-03 11:58:56 -05:00
Jake Potrebic
50c31de6f0 Improve/fix EntityTargetLivingEntityEvent 2022-12-09 03:10:23 -08:00
Spottedleaf
74550736aa Do not accept invalid client settings 2022-05-07 14:58:53 -07:00
Aikar
2e3c775b68 Fix Per World Difficulty / Remembering Difficulty
Fixes per world difficulty with /difficulty command and also
makes it so that the server keeps the last difficulty used instead
of restoring the server.properties every single load.
2020-06-28 03:59:10 -04:00
Aikar
454ff5e5b9 Ensure Entity position and AABB are never invalid
Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
2020-05-10 22:12:46 -04:00
Mariell Hoversholm
2a6962e59e Add permission for command blocks 2020-05-16 10:05:30 +02:00
Spottedleaf
1b13d5c85e Hide sync chunk writes behind flag
Syncing writes on each write call has terrible performance
on harddrives.

-DPaper.enable-sync-chunk-writes=true to enable
2020-06-26 22:35:08 -07:00
JRoy
6a6851c040 Add PlayerRecipeBookClickEvent 2020-06-05 18:24:06 -04:00
Spottedleaf
4c32788db0 Prevent position desync causing tp exploit
Caused the server to revert to the player's overworld coordinates
after teleporting into the end.

Sidenote: The underlying issue is that the move call can teleport
entities and do other things like kill the entity. In the future,
to fix all exploits derieved from this usually unexpected
behaviour, we need to move all of this dangerous logic outside
of the move call and into an appropriate place in the tick method.
2020-06-12 16:51:39 -07:00
David Slovikosky
c637868aef Fix missing chunks due to integer overflow
This patch fixes a bug in the EndIslandDensityFunction class where the distance
from 0,0 squared overflows the maximum size of an integer. The overflow leads
to hard chunk borders around 370,000 blocks from 0,0. After this cutoff there
is a few hundred thousand block gap before end land resuming to generate at
530,000 blocks from spawn. This is due to the integer flipping back and forth.

The fix for the issue is quite simple, casting chunk coordinates to longs
allows the distance calculation to avoid overflow and work as intended.

This issue is being tracked in Mojira ticket MC-159283
2020-06-09 00:10:03 -07:00
Spottedleaf
47dd7e1c0a Fix piston physics inconsistency - MC-188840
Pistons invoke physics when they move blocks. The physics can cause
tnt blocks to ignite. However, pistons (when storing the blocks they "moved")
don't actually go back to the world state sometimes to check if something
like that happened. As a result they end up moving the tnt like it was
never ignited. This resulted in the ability to create machines
that can duplicate tnt, called "world eaters".
This patch makes the piston logic retrieve the block state from the world
prevent this from occuring.

This patch also sets the moved pos to air immediately after creating
the moving piston TE. This prevents the block from being updated from
other physics calls by the piston.

Tested against the following tnt duper design:
https://www.youtube.com/watch?v=mS7xxNGhjxs

This patch also affects every type of machine that utilises
this mechanic. For example, dead coral is removed by a physics
update when being moved while it is attached to slimeblocks.

Standard piston machines that don't destroy or modify the
blocks they move by physics updates should be entirely
unaffected.

This patch fixes https://bugs.mojang.com/browse/MC-188840

This patch also fixes rail duping and carpet duping.
2020-06-11 17:29:42 -07:00
Aikar
6815064398 Use seed based lookup for Treasure Maps - Fixes lag from carto/sunken maps 2020-06-07 19:25:13 -04:00
Phoenix616
1631c7e251 Maps shouldn't load chunks
Previously maps would load all chunks in a certain radius depending on
 their scale when trying to update their content. This would result in
 main thread chunk loads when they weren't really necessary, especially
 on low view distances or "slow" async chunk loads after teleports or
 other prioritisation.

 This changes it to only try to render already loaded chunks based on
 the assumption that the chunks around the player will get loaded
 eventually anyways and that maps will get checked for update every
 five ticks that movement occur in anyways.
2020-06-07 21:43:42 +01:00
chickeneer
2898b4a7eb Fix villager trading demand - MC-163962
Prevent demand from going negative and tending to negative infinity
2020-06-05 20:02:04 -05:00
kickash32
ed712d373a Ensure EntityRaider respects game and entity rules for picking up items 2020-05-09 02:01:48 -04:00
Aikar
74343ef1be Wait for Async Tasks during shutdown
Server.reload() had this logic to give time for tasks to shutdown,
however shutdown did not...

Adds a 5 second grace period for any async tasks to finish and warns
if any are still running after that delay just as reload does.
2020-05-10 22:16:17 -04:00
BillyGalbreath
e91df097e9 ExperienceOrb merging/stacking API and fixes
Adds an option for maximum exp value when merging orbs

Adds ExperienceOrbMergeEvent
Fired when the server is about to merge 2 experience orbs
as entities. Plugins can cancel it if they want to ensure experience orbs do not lose important
metadata such as spawn reason, or conditionally move data from source to target.

Fixes an issue where the stacked count was not taking into account
for mending repairs and when merging with spigot's merge-on-spawn
logic

== AT ==
public net.minecraft.world.entity.ExperienceOrb count

Co-authored-by: Aikar <aikar@aikar.co>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
2017-11-10 23:03:12 -05:00
Mariell Hoversholm
e5e4cc7020 Add villager reputation API
== AT ==
public net.minecraft.world.entity.ai.gossip.GossipContainer$EntityGossips
public net.minecraft.world.entity.ai.gossip.GossipContainer$EntityGossips <init>()V
public net.minecraft.world.entity.ai.gossip.GossipContainer gossips
2020-04-22 23:29:20 +02:00
MiniDigger | Martin
82290d3060 Implement Mob Goal API 2020-01-03 16:26:19 +01:00
Shane Freeder
f5cfd89975 Prevent teleporting dead entities 2020-03-03 05:26:40 +00:00
Shane Freeder
35b7f788a9 misc debugging dumps 2021-02-18 20:23:28 +00:00
Aikar
4b1f23c2e8 Fix item duplication and teleport issues
This notably fixes the newest "Donkey Dupe", but also fixes a lot
of dupe bugs in general around nether portals and entity world transfer

We also fix item duplication generically by anytime we clone an item
to drop it on the ground, destroy the source item.

This avoid an itemstack ever existing twice in the world state pre
clean up stage.

So even if something NEW comes up, it would be impossible to drop the
same item twice because the source was destroyed.
2020-04-25 06:46:35 -04:00
William Blake Galbreath
8a71e1c7da Add phantom creative and insomniac controls 2020-04-25 15:13:41 -05:00
Aikar
56752585e8 Don't fire BlockFade on worldgen threads 2020-04-23 01:36:39 -04:00
nossr50
c157d209f3 Add PlayerAttackEntityCooldownResetEvent 2020-03-26 19:44:50 -07:00
2277
dd3e099c9c Move player to spawn point if spawn in unloaded world
If the playerdata contains an invalid world (missing, unloaded, invalid,
etc.), spawn the player at the spawn point of the main world.

Co-authored-by: Wyatt Childers <wchilders@nearce.com>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
2020-03-31 10:33:55 +01:00
Aikar
d7f24e6729 Fire PlayerJoinEvent when Player is actually ready
For years, plugin developers have had to delay many things they do
inside of the PlayerJoinEvent by 1 tick to make it actually work.

This all boiled down to 1 reason why: The event fired before the
player was fully ready and joined to the world!

Additionally, if that player logged out on a vehicle, the event
fired before the vehicle was even loaded, so that plugins had no
access to the vehicle during this event either.

This change finally fixes this issue, fully preparing the player
into the world as a fully ready entity, vehicle included.

There should be no plugins that break because of this change, but might
improve consistency with other plugins instead.

For example, if 2 plugins listens to this event, and the first one
teleported the player in the event, then the 2nd plugin actually
would be getting a valid player!

This was very non deterministic. This change will ensure every plugin
receives a deterministic result, and should no longer require 1 tick
delays anymore.

== AT ==
public net.minecraft.server.level.ChunkMap addEntity(Lnet/minecraft/world/entity/Entity;)V
2020-04-19 00:05:46 -04:00
Aikar
b7898433d0 Don't crash if player is attempted to be removed from untracked chunk.
I suspect it deals with teleporting as it uses players current x/y/z
2020-04-18 15:59:41 -04:00
MiniDigger | Martin
57802a490d Implement Player Client Options API
== AT ==
public net.minecraft.world.entity.player.Player DATA_PLAYER_MODE_CUSTOMISATION
public net.minecraft.server.level.ServerPlayer particleStatus
2020-01-20 21:38:15 +01:00
Spottedleaf
3d63d68ecb Don't run entity collision code if not needed
Will not run if:
Max entity cramming is disabled and the max collisions per entity is less than or equal to 0.
Entity#isPushable() returns false, meaning all entities will not be able to collide with this
entity anyways.
The entity's current team collision rule causes them to NEVER collide.

Co-authored-by: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
2020-04-15 17:56:07 -07:00
Shane Freeder
6b7013458d Prevent opening inventories when frozen 2020-04-13 07:31:44 +01:00
Spottedleaf
ee1fd0844d Reduce memory footprint of CompoundTag
Fastutil maps are going to have a lower memory footprint - which
is important because we clone chunk data after reading it for safety.
So, reduce the impact of the clone on GC.
2020-04-06 17:39:25 -07:00
Spottedleaf
60c674b750 Reduce Either Optional allocation
In order to get chunk values, we shouldn't need to create
an optional each time.
2020-04-06 18:35:09 -07:00
Aikar
aa8e04867f Optimize Pathfinding
Prevents pathfinding from spamming failures for things such as
arrow attacks.
2016-03-03 02:02:07 -06:00
Aikar
7659c20386 Don't move existing players to world spawn
This can cause a nasty server lag the spawn chunks are not kept loaded
or they aren't finished loading yet, or if the world spawn radius is
larger than the keep loaded range.

By skipping this, we avoid potential for a large spike on server start.

== AT ==
public net.minecraft.server.level.ServerPlayer fudgeSpawnLocation(Lnet/minecraft/server/level/ServerLevel;)V
2020-04-09 21:20:33 -04:00
Aikar
6242e1dad0 Dead Player's shouldn't be able to move
This fixes a lot of game state issues where packets were delayed for processing
due to 1.15's new queue but processed while dead.
2020-04-02 19:31:16 -04:00
Aikar
e7044bdebb Don't tick dead players
Causes sync chunk loads and who knows what all else.
This is safe because Spectators are skipped in unloaded chunks too in vanilla.
2020-04-02 17:16:48 -04:00
Aikar
ac79088eb6 Prevent Double PlayerChunkMap adds crashing server
Suspected case would be around the technique used in .stopRiding
Stack will identify any causer of this and warn instead of crashing.
2020-04-02 01:42:39 -04:00
chickeneer
c569dccd4e Do not allow Vexes to load chunks 2020-03-17 14:18:50 -05:00
Aikar
a44dc35353 Remote Connections shouldn't hold up shutdown
Bugs in the connection logic appears to leave stale connections even, preventing shutdown
2020-03-31 03:50:42 -04:00
Phoenix616
1273cf0f21 Pillager patrol spawn settings and per player options
This adds config options for defining the spawn chance, spawn delay and
spawn start day as well as toggles for handling the spawn delay and
start day per player. (Based on the time played statistic)
When not per player it will use the Vanilla mechanic of one delay per
world and the world age for the start day.
2020-02-01 16:50:39 +01:00
William Blake Galbreath
db792f5e1d Add tick times API and /mspt command 2020-04-05 22:23:14 -05:00
Spottedleaf
34933f9884 Optimise Chunk#getFluid
Removing the try catch and generally reducing ops should make it
faster on its own, however removing the try catch makes it
easier to inline due to code size
2020-01-14 14:59:08 -08:00
Zero
05df94d332 Configurable chance of villager zombie infection
This allows you to solve an issue in vanilla behavior where:
* On easy difficulty your villagers will NEVER get infected, meaning they will always die.
* On normal difficulty they will have a 50% of getting infected or dying.
2020-02-22 16:10:31 -05:00
William Blake Galbreath
fd378a7262 Add option to allow iron golems to spawn in air 2019-04-13 16:50:58 -05:00
Shane Freeder
26067ca04b Validate tripwire hook placement before update 2020-03-07 00:07:51 +00:00
William Blake Galbreath
fa7c667a3e Make the GUI graph fancier 2020-02-02 04:00:40 -06:00
William Blake Galbreath
196c153504 Add option to nerf pigmen from nether portals 2020-02-07 14:36:56 -06:00
BillyGalbreath
0dd8044178 Entity Jump API
== AT ==
public net.minecraft.world.entity.LivingEntity jumping
2020-02-08 23:26:11 -06:00
William Blake Galbreath
4e20691d59 Add ThrownEggHatchEvent
Adds a new event similar to PlayerEggThrowEvent, but without the Player requirement
(dispensers can throw eggs to hatch them, too).
2020-02-09 00:19:05 -06:00
Spottedleaf
f179cfaff2 Add debug for sync chunk loads
This patch adds a tool to find calls to getChunkAt which would load
chunks, however it must be enabled by setting the startup flag
-Dpaper.debug-sync-loads=true

- To get a debug log for sync loads, the command is
  /paper syncloadinfo
- To clear clear the currently stored sync load info, use
  /paper syncloadinfo clear
2019-07-19 03:29:14 -07:00
Jake Potrebic
2ce266b657 Improve Block#breakNaturally API
Adds bool parameter to play world effect on block break

Adds bool parameter to drop xp from blocks

Fixes fluid-logged blocks not leaving fluid behind if
broken

Handles special cases for ice and turtle eggs

== AT ==
public net.minecraft.world.level.block.TurtleEggBlock decreaseEggs(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;)V

Co-authored-by: William Blake Galbreath <Blake.Galbreath@GMail.com>
2020-01-02 12:25:07 -06:00
William Blake Galbreath
e4290a3697 Bees get gravity in void. Fixes MC-167279 2020-01-26 16:30:19 -06:00
kickash32
c7b38e2bc7 Tracking Range Improvements
Sets tracking range of watermobs to animals instead of misc and simplifies code

Also ignores Enderdragon, defaulting it to Mojang's setting
2019-12-21 15:22:09 -05:00
kickash32
7b1d3d673a Alternative item-despawn-rate
Co-authored-by: Noah van der Aa <ndvdaa@gmail.com>
2019-06-03 02:02:39 -04:00
Spottedleaf
c33f47103e Guard against serializing mismatching chunk coordinate
Should help if something dumb happens
2019-12-27 09:42:26 -08:00
BrodyBeckwith
2eb4908754 Optimize call to getFluid for explosions 2020-01-14 17:49:03 -05:00
Nassim Jahnke
8a2c2db2a5 Fix item EAR ticks
Item entities only have their gravity ticked every 4 ticks when on ground.
Fix that and also remove Spigot's arbitrary tick skipping. It's a terribly
cheap way of getting extra performance that doesn't really work at all.
2024-10-30 13:51:54 +01:00
Spottedleaf
b948d38658 Optimise EntityGetter#getPlayerByUUID
Use the PlayerList map instead of iterating over all players
2020-01-11 21:50:56 -08:00
Aikar
a91c1c2d18 Don't load Chunks from Hoppers and other things
Hoppers call this to I guess "get the primary side" of a double sided chest.

If the double sided chest crosses chunk lines, it causes the chunk to load.
This will end up causing sync chunk loads, which will unload with Chunk GC,
only to be reloaded again the next tick.

This of course is undesirable, so just return the loaded side as "primary"
and treat it as a single chest if the other sides are unloaded
2016-11-03 20:28:12 -04:00
William Blake Galbreath
0e5a5711fc Prevent bees loading chunks checking hive position 2020-01-05 17:24:34 -06:00
Shane Freeder
0664232c53 PlayerDeathEvent#shouldDropExperience 2019-12-24 00:35:42 +00:00
Aikar
cd2f06bbc2 Duplicate UUID Resolve Option
Due to a bug in 2e29af3df0
which was added all the way back in March of 2016, it was unknown (potentially not at the time)
that an entity might actually change the seed of the random object.

At some point, EntitySquid did start setting the seed. Due to this shared random, this caused
every entity to use a Random object with a predictable seed.

This has caused entities to potentially generate with the same UUID....

Over the years, servers have had entities disappear, but no sign of trouble
because CraftBukkit removed the log lines indicating that something was wrong.

We have fixed the root issue causing duplicate UUID's, however we now have chunk
files full of entities that have the same UUID as another entity!

When these chunks load, the 2nd entity will not be added to the world correctly.

If that chunk loads in a different order in the future, then it will reverse and the
missing one is now the one added to the world and not the other. This results in very
inconsistent entity behavior.

This change allows you to recover any duplicate entity by generating a new UUID for it.
This also lets you delete them instead if you don't want to risk having new entities added to
the world that you previously did not see.

But for those who are ok with leaving this inconsistent behavior, you may use WARN or NOTHING options.

It is recommended you regenerate the entities, as these were legit entities, and deserve your love.
2018-07-21 14:27:34 -04:00
Callahan
a0513959ea Prevent sync chunk loads when villagers try to find beds 2020-01-13 23:47:28 -06:00
William Blake Galbreath
a0dc4eeb99 Add option to disable pillager patrols 2019-10-09 21:46:15 -05:00
Nassim Jahnke
ccc1107255 Dont send unnecessary sign update 2021-09-11 11:56:51 +02:00
kickash32
2cb6b995cc Prevent consuming the wrong itemstack 2019-08-19 19:42:35 +05:00
kickash32
0198ee9c8a offset item frame ticking 2019-07-30 03:17:16 +05:00
Lucavon
a89e4e6ae3 Configurable projectile relative velocity
This patch adds an option "disable relative projectile velocity", which, when
enabled, will cause projectiles to ignore the shooter's current velocity,
like they did in Minecraft 1.8 and prior.
If a player is falling, for example, their shooting range will be drastically
reduced, as a downwards velocity is applied to the projectile. This prevents
players from saving themselves from falling off floating islands, for example,
as a thrown ender pearl will not make it back to the island, while it would
have in 1.8.

While this could easily be done with plugins, too, there are multiple problems:
P1) If multiple plugins cancel the velocity by subtracting the shooter's velocity
from the projectile's velocity, the projectile's velocity would be different.
As there's no way to detect whether the projectile's velocity has already been
adjusted to ignore the player's velocity, plugins can't not do it if it's not
necessary.
P2) I've noticed some inconsistencies, e.g. weird velocity when shooting while
using an elytra. Checking for those inconsistencies is possible, but not as
efficient as just not applying the velocity in the first place.
P3) Solutions for 1) and especially 2) might not be future-proof, while this
server-internal fix makes this change future-proof.
2019-07-23 20:29:20 -05:00
Aikar
2cd6ace7ab Only count Natural Spawned mobs towards natural spawn mob limit
This resolves the super common complaint about mobs not spawning.

This was ultimately a flaw in the vanilla count algorithim that allows
spawners and other misc mobs to count against the mob limit, which are
not bounded, and can prevent the entire world from spawning new.

I believe Bukkits changes around persistence may of actually made it
worse than vanilla.

This should fully solve all of the issues around it so that only natural
influences natural spawns.
2019-03-24 01:01:32 -04:00
Phoenix616
f5be267fbf Fix sounds when item frames are modified (MC-123450)
This also fixes the adding sound playing when the item frame direction is changed.
2019-04-27 20:00:43 +01:00
Shane Freeder
26c77784e5 Fix CB call to changed postToMainThread method 2019-05-10 18:38:19 +01:00
William Blake Galbreath
b68af3dfa1 Mob Spawner API Enhancements
== AT ==
public net.minecraft.world.level.BaseSpawner isNearPlayer(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;)Z
public net.minecraft.world.level.BaseSpawner delay(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;)V
public net.minecraft.world.level.BaseSpawner setNextSpawnData(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/SpawnData;)V
2019-04-19 12:41:13 -05:00
Aikar
5630b55346 Optimize Captured BlockEntity Lookup
upstream was doing a containsKey/get pattern, and always doing it at that.
that scenario is only even valid if were in the middle of a block place.

Optimize to check if the captured list even has values in it, and also to
just do a get call since the value can never be null.
2019-04-06 10:16:48 -04:00
Aikar
18f38c3167 PlayerDeathEvent#getItemsToKeep
Exposes a mutable array on items a player should keep on death

Example Usage: https://gist.github.com/aikar/5bb202de6057a051a950ce1f29feb0b4

== AT ==
public net.minecraft.world.entity.player.Inventory compartments
2019-03-27 23:01:33 -04:00
Aikar
8e13bc622b Server Tick Events
Fires event at start and end of a server tick
2019-03-27 22:48:45 -04:00
MisterVector
4ee0744e6d Add PlayerPostRespawnEvent 2018-10-26 21:31:00 -07:00
Mark Vainomaa
2433988460 Fire event on GS4 query 2019-03-17 21:46:56 +02:00
Aikar
0b77748b35 Fixes and additions to the spawn reason API
Expose an entities spawn reason on the entity.
Pre existing entities will return NATURAL if it was a non
persistenting Living Entity, SPAWNER for spawners,
or DEFAULT since data was not stored.

Additionally, add missing spawn reasons.

Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
Co-authored-by: Doc <nachito94@msn.com>
2019-03-24 00:24:52 -04:00
Mark Vainomaa
19bd3b2655 Call WhitelistToggleEvent when whitelist is toggled 2019-03-13 20:08:09 +02:00
Aikar
04c783377e Limit Client Sign length more
modified clients can send more data from the client
to the server and it would get stored on the sign as sent.

Mojang has a limit of 384 which is much higher than reasonable.

the client can barely render around 16 characters as-is, but formatting
codes can get it to be more than 16 actual length.

Set a limit of 80 which should give an average of 16 characters 2
sets of legacy formatting codes which should be plenty for all uses.

This does not strip any existing data from the NBT as plugins
may use this for storing data out of the rendered area.

it only impacts data sent from the client.

Set -DPaper.maxSignLength=XX to change limit or -1 to disable
2019-02-27 22:18:40 -05:00
Aikar
05f977e3d1 Brigadier Mojang API
Adds AsyncPlayerSendCommandsEvent
  - Allows modifying on a per command basis what command data they see.

Adds CommandRegisteredEvent
  - Allows manipulating the CommandNode to add more children/metadata for the client
2020-04-19 18:15:29 -04:00
Callahan
41218728d9 Async command map building
This adds a custom pool inorder to make sure that they are closed
without much though, as it doesn't matter if the client is not sent
commands if the server is restarting. Using the default async pool caused issues to arise
due to the shutdown logic generally being much later.
2020-04-08 02:42:14 -05:00
Aikar
b71ceb5e0f BlockDestroyEvent
Adds an event for when the server is going to destroy a current block,
potentially causing it to drop. This event can be cancelled to avoid
the block destruction, such as preventing signs from popping when
floating in the air.

This can replace many uses of BlockPhysicsEvent
2019-02-06 00:20:33 -05:00
connorhartley
2c43d196e4 Workaround for vehicle tracking issue on disconnect 2019-01-07 14:43:48 -06:00
Zach Brown
f1f016dd5e Replace OfflinePlayer#getLastPlayed
Currently OfflinePlayer#getLastPlayed could more accurately be described
as "OfflinePlayer#getLastTimeTheirDataWasSaved".

The API doc says it should return the last time the server "witnessed"
the player, whilst also saying it should return the last time they
logged in. The current implementation does neither.

Given this interesting contradiction in the API documentation and the
current defacto implementation, I've elected to deprecate (with no
intent to remove) and replace it with two new methods, clearly named and
documented as to their purpose.
2019-01-02 00:35:43 -06:00
Spottedleaf
f5226d3739 Add PlayerConnectionCloseEvent
This event is invoked when a player has disconnected. It is guaranteed that,
if the server is in online-mode, that the provided uuid and username have been
validated.

The event is invoked for players who have not yet logged into the world, whereas
PlayerQuitEvent is only invoked on players who have logged into the world.

The event is invoked for players who have already logged into the world,
although whether or not the player exists in the world at the time of
firing is undefined. (That is, whether the plugin can retrieve a Player object
using the event parameters is undefined). However, it is guaranteed that this
event is invoked AFTER PlayerQuitEvent, if the player has already logged into
the world.

This event is guaranteed to never fire unless AsyncPlayerPreLoginEvent has
been called beforehand, and this event may not be called in parallel with
AsyncPlayerPreLoginEvent for the same connection.

Cancelling the AsyncPlayerPreLoginEvent guarantees the corresponding
PlayerConnectionCloseEvent is never called.

The event may be invoked asynchronously or synchronously. As it stands,
it is never invoked asynchronously. However, plugins should check
Event#isAsynchronous to be future-proof.

On purpose, the deprecated PlayerPreLoginEvent event is left out of the
API spec for this event. Plugins should not be using that event, and
how PlayerPreLoginEvent interacts with PlayerConnectionCloseEvent
is undefined.

== AT ==
public net.minecraft.server.network.ServerLoginPacketListenerImpl$State
public net.minecraft.server.network.ServerLoginPacketListenerImpl state
2018-10-07 12:05:28 -07:00
Aikar
a1a073eaae Book size limits
Puts some limits on the size of books.
2018-11-16 23:08:50 -05:00
BillyGalbreath
ea164c2f4a Add more Zombie API
== AT ==
public net.minecraft.world.entity.monster.Zombie isSunSensitive()Z
2018-10-07 04:29:59 -05:00
Shane Freeder
373c8ff0b2 force entity dismount during teleportation
Entities must be dismounted before teleportation in order to avoid
multiple issues in the server with regards to teleportation, shamefully,
too many plugins rely on the events firing, which means that not firing
these events caues more issues than it solves;

In order to counteract this, Entity dismount/exit vehicle events have
been modified to supress cancellation (and has a method to allow plugins
to check if this has been set), noting that cancellation will be silently
surpressed given that plugins are not expecting this event to not be cancellable.

This is a far from ideal scenario, however: given the current state of this
event and other alternatives causing issues elsewhere, I believe that
this is going to be the best soultion all around.

Improvements/suggestions welcome!
2018-11-15 13:38:37 +00:00
Shane Freeder
4da5176b89 Don't allow digging into unloaded chunks 2018-11-11 21:01:09 +00:00
Shane Freeder
52ea2a0cd9 Fix SpongeAbsortEvent handling
Only process drops when the block is actually going to be removed
2018-11-10 05:15:21 +00:00
Aikar
1d1ddeccb9 Optimize World Time Updates
Splits time updates into incremental updates as well as does
the updates per world, so that we can re-use the same packet
object for every player unless they have per-player time enabled.
2018-11-02 23:11:51 -04:00
Aikar
9902ba8869 Improve Server Thread Pool and Thread Priorities
Use a simple executor since Fork join is a much more complex pool
type and we are not using its capabilities.

Set thread priorities so main thread has above normal priority over
server threads

Allow usage of a single thread executor by not using ForkJoin so single core CPU's
and reduce worldgen thread worker count for low core count CPUs.

== AT ==
public net.minecraft.Util onThreadException(Ljava/lang/Thread;Ljava/lang/Throwable;)V

Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
2018-10-23 23:14:38 -04:00
Aikar
539f1ba018 Don't sleep after profile lookups if not needed
Mojang was sleeping even if we had no more requests to go after
the current one finished, resulting in 100ms lost per profile lookup
2018-10-23 20:25:05 -04:00
GreenMeanie
a48e72fb4d Reset players airTicks on respawn 2018-10-20 22:34:02 -04:00
Gabriele C
7c062523e0 Add option to prevent players from moving into unloaded chunks #1551 2018-10-22 17:34:10 +02:00
BillyGalbreath
8f806f31bb Check Drowned for Villager Aggression Config 2018-10-10 21:22:44 -05:00
BillyGalbreath
a24fb45a27 Add more Witch API
== AT ==
public net.minecraft.world.entity.monster.Witch usingTime
2018-10-12 14:10:46 -05:00
Caleb Bassham
473a79e490 Call player spectator target events and improve implementation
Use a proper teleport for teleporting to entities in different
worlds.

Implementation improvements authored by Spottedleaf <Spottedleaf@users.noreply.github.com>
Validate that the target entity is valid and deny spectate
requests from frozen players.

Also, make sure the entity is spawned to the client before
sending the camera packet. If the entity isn't spawned clientside
when it receives the camera packet, then the client will not
spectate the target entity.

Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
2018-09-28 02:32:19 -05:00
BillyGalbreath
fb18e19bb0 Turtle API
== AT ==
public net.minecraft.world.entity.animal.Turtle getHomePos()Lnet/minecraft/core/BlockPos;
public net.minecraft.world.entity.animal.Turtle setHasEgg(Z)V
public net.minecraft.world.entity.animal.Turtle isGoingHome()Z
public net.minecraft.world.entity.animal.Turtle setGoingHome(Z)V
public net.minecraft.world.entity.animal.Turtle isTravelling()Z
public net.minecraft.world.entity.animal.Turtle setTravelling(Z)V
2018-09-29 16:08:23 -05:00
BillyGalbreath
5a43ef8127 Add LivingEntity#getTargetEntity 2018-09-22 00:33:08 -05:00
Phoenix616
b2cbea9e63 PreSpawnerSpawnEvent
This adds a separate event before an entity is spawned by a spawner
which contains the location of the spawner too similarly to how the
SpawnerSpawnEvent gets called instead of the CreatureSpawnEvent for
spawners.
2018-09-18 23:53:23 +01:00
Aikar
8ea84d0962 Prevent chunk loading from Fluid Flowing 2018-09-10 23:36:16 -04:00
Shane Freeder
fed1922643 Configurable connection throttle kick message 2018-10-02 09:57:50 +01:00
BillyGalbreath
46109028f9 Honor EntityAgeable.ageLock 2018-09-23 20:59:53 -05:00
Tassu
4bea989f34 Implement furnace cook speed multiplier API
Fixed an issue where a furnace's cook-speed multiplier rounds down
to the nearest Integer when updating its current cook time.

== AT ==
public net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity getTotalCookTime(Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity;)I

Co-authored-by: Eric Su <ericsu@alumni.usc.edu>
2018-09-13 08:45:21 +03:00
Aikar
ac503c148a Prevent mob spawning from loading/generating chunks
also prevents if out of world border bounds
2018-09-12 21:12:57 -04:00
Aikar
54b44d1f1c Prevent various interactions from causing chunk loads
Co-authored-by: Shane Freeder <theboyetronic@gmail.com>
2018-09-10 23:56:36 -04:00
Aikar
ca42ec8f4e Mob Pathfinding API
Implements Pathfinding API for mobs

== AT ==
public net.minecraft.world.entity.ai.navigation.PathNavigation pathFinder
public net.minecraft.world.level.pathfinder.PathFinder nodeEvaluator
public net.minecraft.world.level.pathfinder.Path nodes
2018-09-09 13:30:00 -04:00
BillyGalbreath
ca341c9de8 Allow chests to be placed with NBT data 2018-09-08 18:43:31 -05:00
Phoenix616
04afedcccf Improve death events
This adds the ability to cancel the death events and to modify the sound
an entity makes when dying. (In cases were no sound should it will be
called with shouldPlaySound set to false allowing unsilencing of silent
entities)

It makes handling of entity deaths a lot nicer as you no longer need
to listen on the damage event and calculate if the entity dies yourself
to cancel the death which has the benefit of also receiving the dropped
items and experience which is otherwise only properly possible by using
internal code.

== AT ==
public net.minecraft.world.entity.LivingEntity getDeathSound()Lnet/minecraft/sounds/SoundEvent;
public net.minecraft.world.entity.LivingEntity getSoundVolume()F
2018-08-21 01:39:35 +01:00
BillyGalbreath
228730983d Add ray tracing methods to LivingEntity 2018-09-03 18:20:03 -05:00
BillyGalbreath
bfd8b7bcef Add More Creeper API 2018-08-24 11:50:26 -05:00
BillyGalbreath
f6b20dccfc Add PhantomPreSpawnEvent 2018-08-25 19:56:51 -05:00
Aikar
1ef5dc7644 Optimize MappedRegistry
Use larger initial sizes to increase bucket capacity on the BiMap

BiMap.get was seen to be using a good bit of CPU time.
2018-08-26 20:49:50 -04:00