Commit graph

5447 commits

Author SHA1 Message Date
Nassim Jahnke
5392798da4 Move range check for block placing up 2022-06-08 10:52:18 +02:00
Jake Potrebic
fc6a027549 More Enchantment API
== AT ==
public net.minecraft.world.item.enchantment.Enchantment definition

Co-authored-by: Luis <luisc99@icloud.com>
Co-authored-by: Janet Blackquill <uhhadd@gmail.com>
2021-05-06 19:57:58 -07:00
Jake Potrebic
121534e841 ItemStack repair check API 2021-05-15 22:11:11 -07: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
Connor Linfoot
f283a61ad3 Add basic Datapack API
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
2021-05-16 15:07:34 +01:00
MeFisto94
637bb9a05d Add a "should burn in sunlight" API for Phantoms and Skeletons 2021-05-11 00:48:33 +02:00
Jake Potrebic
b70d1e8bdc Inventory#close 2021-05-11 14:54:56 -07:00
Tamion
c8c11363a0 Add HiddenPotionEffect API
== AT ==
public net.minecraft.world.effect.MobEffectInstance hiddenEffect
2023-11-05 09:51:28 +01: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
80878ac918 More World API 2020-07-07 10:52:34 -07: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
12f070c05a add get-set drop chance to EntityEquipment
== AT ==
public net.minecraft.world.entity.Mob getEquipmentDropChance(Lnet/minecraft/world/entity/EquipmentSlot;)F
2021-04-22 00:28:11 -07:00
Jake Potrebic
8683cde7c0 add consumeFuel to FurnaceBurnEvent 2021-04-22 16:45:28 -07:00
Jake Potrebic
6a311ade3a add isDeeplySleeping to HumanEntity 2021-04-08 17:36:10 -07:00
Owen1212055
8cf2001602 Set area affect cloud rotation 2021-04-05 16:58:20 -04: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
Nassim Jahnke
85a8224261 Expose protocol version 2021-03-26 11:23:17 +01: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
Jake Potrebic
d0185eb56e Expand world key API 2021-01-06 00:34:04 -08:00
Anton Lindroth
a032df8427 Allow using signs inside spawn protection 2020-04-15 01:54:02 +02:00
Jake Potrebic
53ea19c9bd Add Block#isValidTool 2020-07-06 12:44:31 -07: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
Tom
90c30bbb0b Expose Tracked Players 2021-02-26 16:24:25 -06:00
Jason Penilla
41fd1852ae Merchant#getRecipes should return an immutable list 2021-02-10 14:53:36 -08:00
Trigary
f8a55d3645 fix dead slime setSize invincibility 2021-02-05 22:12:13 +01:00
ysl3000
6b65e03d85 living entity allow attribute registration 2020-10-24 16:37:44 +02:00
Aleksander Jagiello
0312fd2b42 Add getMainThreadExecutor to BukkitScheduler 2021-01-24 22:17:54 +01:00
BillyGalbreath
6888386225 Allow adding items to BlockDropItemEvent 2021-01-20 14:23:37 -06: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
Jake Potrebic
b656aa3c21 Zombie API - breaking doors
== AT ==
public net.minecraft.world.entity.monster.Zombie supportsBreakDoorGoal()Z
2020-11-18 11:32:46 -08: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
Aikar
119c616ab9 Additional Block Material API
Faster version for isSolid() that utilizes NMS's state for isSolid instead of the slower
process to do this in the Bukkit API

Adds API for buildable, replaceable, burnable too.
2020-12-30 19:43:01 -05: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
Jake Potrebic
dad7e25da8 Add OBSTRUCTED reason to BedEnterResult 2020-12-24 12:43:39 -08: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
BillyGalbreath
b22a956d7c Fix CraftSound backwards compatibility 2020-12-17 15:25:49 -06: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
Jake Potrebic
84581d0c6b Add missing default perms for commands 2020-11-16 12:01:52 -08:00
William Blake Galbreath
22069fd885 Climbing should not bypass cramming gamerule 2020-08-23 20:59:00 +02:00
Nassim Jahnke
e0fe76747b More lightning API
== AT ==
public net.minecraft.world.entity.LightningBolt life
public net.minecraft.world.entity.LightningBolt flashes
2020-07-26 14:44:09 +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
Anrza
791377732e Add LivingEntity#clearActiveItem 2020-07-15 12:08:49 +02:00
Esophose
253e7ed6c8 Fix Player spawnParticle x/y/z precision loss 2020-10-03 18:57:47 -06: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
Alfie Smith
2d042873d8 Item no age & no player pickup 2020-11-07 01:20:33 +00:00
Jason Penilla
9ac98063a0 Fix client lag on advancement loading
When new advancements are added via the UnsafeValues#loadAdvancement
API, it triggers a full datapack reload when this is not necessary. The
advancement is already loaded directly into the advancement registry,
and the point of saving the advancement to the Bukkit datapack seems to
be for persistence. By removing the call to reload datapacks when an
advancement is loaded, the client no longer completely freezes up when
adding a new advancement.
To ensure the client still receives the updated advancement data, we
manually reload the advancement data for all players, which
normally takes place as a part of the datapack reloading.
2020-10-31 11:49:01 -07: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
oxygencraft
30de939553 Add getOfflinePlayerIfCached(String) 2020-10-25 18:34:50 +11: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
Andrew Steinborn
2f55ab6d4e Lazily track plugin scoreboards by default
On servers with plugins that constantly churn through scoreboards, there is a risk of
degraded GC performance due to the number of scoreboards held on by weak references.
Most plugins don't even need the (vanilla) functionality that requires all plugin
scoreboards to be tracked by the server. Instead, only track scoreboards when an
objective is added with a non-dummy criteria.

This is a breaking change, however the change is a much more sensible default. In case
this breaks your workflow you can always force all scoreboards to be tracked with
settings.track-plugin-scoreboards in paper.yml.
2020-10-03 04:15:09 -04: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
JRoy
963cd88791 Add additional open container api to HumanEntity
== AT ==
public net/minecraft/world/level/block/state/BlockBehaviour getMenuProvider(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;)Lnet/minecraft/world/MenuProvider;
2020-08-26 02:12:31 -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
ysl3000
0c942c8542 Create HoverEvent from ItemStack Entity 2020-07-06 22:18:04 +02:00
Jake Potrebic
97620482eb Add methods to get translation keys
== AT ==
public org.bukkit.craftbukkit.inventory.CraftMetaFirework
public org.bukkit.craftbukkit.inventory.CraftMetaFirework power
public org.bukkit.craftbukkit.inventory.CraftMetaFirework getNBT(Lorg/bukkit/FireworkEffect$Type;)Lnet/minecraft/world/item/component/FireworkExplosion$Shape;

Co-authored-by: MeFisto94 <MeFisto94@users.noreply.github.com>
2020-08-11 19:16:09 +02:00
BillyGalbreath
4f4d4ac73e Add more Evoker API
== AT ==
public net.minecraft.world.entity.monster.Evoker setWololoTarget(Lnet/minecraft/world/entity/animal/Sheep;)V
public net.minecraft.world.entity.monster.Evoker getWololoTarget()Lnet/minecraft/world/entity/animal/Sheep;
2020-08-23 15:28:35 +02: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
Eearslya Sleiarion
2e8691de65 Add BellRingEvent
Add a new event, BellRingEvent, to trigger whenever a player rings a
village bell. Passes along the bell block and the player who rang it.
2020-08-23 13:04:02 +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
BillyGalbreath
15b58660bb Add moon phase API 2020-08-23 16:32:11 +02: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
William Blake Galbreath
a7e8ccc630 Add playPickupItemAnimation to LivingEntity 2020-08-23 19:36:22 +02:00
DigitalRegent
0ef48f1dd1 Brand support 2020-04-11 13:10:58 +02:00
mbax
0a7b472bee Fix regex mistake in CB NBT int deserialization
The existing regex is too open and allows for the absence of any actual
number data, detecting an NBT entry of just the letter "i" in upper or
lower case. This causes a single-character NBT entry to be processed as
an integer ending in "i", passing an empty String to to Integer.parseInt,
triggering an exception in loading the item.

This commit forces numbers to be present prior to the ending "i"
letter.
2020-08-17 12:17:37 -04: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
William Blake Galbreath
e3bd1e8117 Add entity liquid API
== AT ==
public net.minecraft.world.entity.Entity isInRain()Z
public net.minecraft.world.entity.Entity isInBubbleColumn()Z
2020-07-02 18:11:43 -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
25ed9118c5 Convert legacy attributes in Item Meta 2020-07-01 04:50:22 -04:00
Jake Potrebic
1d3be17a60 Add BlockStateMeta#clearBlockState 2024-01-11 12:41:50 -08:00
Aikar
23ae9d3c49 Improve Legacy Component serialization size
Don't constantly send format: false for all formatting options when parent already
has it false
2020-06-28 19:08:41 -04:00
Aikar
0c9fe716b7 Paper dumpitem command
Let's you quickly view the item in your hands NBT data
2020-06-28 19:27:20 -04: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
Phoenix616
1b1ab34ecd Inventory getHolder method without block snapshot 2020-06-10 23:55:15 +01: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
ossi
2e59889281 Fix CraftScheduler#runTaskTimerAsynchronously(Plugin, Consumer<BukkitTask>, long, long) scheduling a non-repeating task instead of a repeating one. 2020-06-12 01:38:06 +03: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
Mariell Hoversholm
37b20cd3d4 Add option for console having all permissions 2020-05-16 10:12:15 +02: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
JRoy
7be16c7ef0 Potential bed API
Adds a new method to fetch the location of a player's bed without generating any sync loads.

getPotentialBedLocation - Gets the last known location of a player's bed. This does not preform any check if the bed is still valid and does not load any chunks.
2020-05-10 23:06:30 -04:00
kickash32
5729115aab Fix PotionEffect ignores icon flag
Co-authored-by: Tamion <70228790+notTamion@users.noreply.github.com>
2020-05-08 00:49:18 -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
e058d38078 Set cap on JDK per-thread native byte buffer cache
See: https://www.evanjones.ca/java-bytebuffer-leak.html

This is potentially a source of lots of native memory usage.

We are clearly seeing native usage upwards to 1-4GB which doesn't make sense.

Region File usage fixed in previous patch should of tecnically only been somewhat
temporary until GC finally gets it some time later, but between all the various
plugins doing IO on various threads, this hidden detail of the JDK could be
keeping long lived large direct buffers in cache.

Set system properly at server startup if not set already to help protect from this.
2020-05-04 01:08:56 -04:00
zbk
269fd00d2a Villager Restocks API
== AT ==
public net.minecraft.world.entity.npc.Villager numberOfRestocksToday
2020-04-26 23:49:01 -04: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