Commit graph

255 commits

Author SHA1 Message Date
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
miclebrick
68e76b43b8 Optimize CraftBlockData Creation
Avoids a hashmap lookup by cacheing a reference to the CraftBlockData
and cloning it when one is needed.
2018-08-23 11:45:32 -04:00
Byteflux
28ea7bb560 Configurable speed for water flowing over lava 2018-08-08 16:33:21 -06:00
BillyGalbreath
14aa197675 Slime Pathfinder Events 2018-08-24 08:18:42 -05:00
Spottedleaf
4e0ee05920 Optimize BlockPosition helper methods 2018-08-15 12:05:12 -07:00
Aikar
d178f73bb8 Use a Queue for Queueing Commands
Lists are bad as Queues mmmkay.
2018-08-12 02:33:39 -04:00
egg82
f6519a79fe Use ConcurrentHashMap in JsonList
This is specifically aimed at fixing #471

Using a ConcurrentHashMap because thread safety
The performance benefit of Map over ConcurrentMap is negligabe at best in this scenaio, as most operations will be get and not add or remove
Even without considering the use-case the benefits are still negligable

Original ideas for the system included an expiration policy and/or handler
The simpler solution was to use a computeIfPresent in the get method
This will simultaneously have an O(1) lookup time and automatically expire any values
Since the get method (nor other similar methods) don't seem to have a critical need to flush the map to disk at any of these points further processing is simply wasteful
Meaning the original function expired values unrelated to the current value without actually having any explicit need to

The h method was heavily modified to be much more efficient in its processing
Also instead of being called on every get, it's now called just before a save
This will eliminate stale values being flushed to disk

Modified isEmpty to use the isEmpty() method instead of the slightly confusing size() < 1
The point of this is readability, but does have a side-benefit of a small microptimization
2018-08-07 01:24:23 -06:00
miclebrick
31fc02af68 Add Early Warning Feature to WatchDog
Detect when the server has been hung for a long duration, and start printing
thread dumps at an interval until the point of crash.

This will help diagnose what was going on in that time before the crash.
2018-08-08 15:30:52 -04:00
Aikar
2f4d83a219 Add Debug Entities option to debug dupe uuid issues 2018-07-21 08:25:40 -04:00
Aikar
223c6c3b5a Remove unnecessary itemmeta handling 2016-11-22 00:40:42 -05:00
Aikar
394e4c04f7 Fix NBT type issues
Addresses two issues:
- MC-135506: Experience should save as Integers
- Allay duplication cooldown is saved and exposed as a long, but loaded as an int
2018-08-03 00:04:54 -04:00
Shane Freeder
88409ad861 Break up and make tab spam limits configurable
Due to the changes in 1.13, clients will send a tab completion request
for all bukkit commands in order to factor in the lack of support for
brigadier and provide backwards support in the API.

Craftbukkit, however; has moved the chat spam limiter to also interact
with the tab completion request, which while good for avoiding abuse,
causes 1.13 clients to easilly be kicked from a server in bukkit due
to this. Removing the spam limit could cause issues for servers, however,
there is no way for servers to manipulate this without blindly cancelling
kick events, which only causes additional complications. This also causes
issues in that the tab spam limit and chat share the same field but different
limits, meaning that a player having typed a long command may be kicked from
the server.

Splitting the field up and making it configurable allows for server owners
to take the burden of this into their own hand without having to rely on
plugins doing unsafe things.
2018-07-29 05:02:15 +01:00
Mark Vainomaa
30f16143ba Add TNTPrimeEvent 2018-07-16 00:05:05 +03:00
BillyGalbreath
f20fbf5477 AnvilDamageEvent 2018-07-20 23:37:03 -05:00
BillyGalbreath
da011362dc SkeletonHorse Additions 2018-07-27 22:36:31 -05:00
Riley Park
c0a3a0d12c Allow disabling armor stand ticking 2018-08-15 01:26:09 -07:00
Hugo Manrique
510b8187c7 Vanished players don't have rights 2018-07-23 14:22:26 +02:00
Hugo Manrique
1549b076df Option to prevent armor stands from doing entity lookups 2018-07-23 12:57:39 +02:00
Techcable
85be8cc620 Improve BlockPosition inlining
Normally the JVM can inline virtual getters by having two sets of code, one is the 'optimized' code and the other is the 'deoptimized' code.
If a single type is used 99% of the time, then its worth it to inline, and to revert to 'deoptimized' the 1% of the time we encounter other types.
But if two types are encountered commonly, then the JVM can't inline them both, and the call overhead remains.

This scenario also occurs with BlockPos and MutableBlockPos.
The variables in BlockPos are final, so MutableBlockPos can't modify them.
MutableBlockPos fixes this by adding custom mutable variables, and overriding the getters to access them.

This approach with utility methods that operate on MutableBlockPos and BlockPos.
Specific examples are BlockPosition.up(), and World.isValidLocation().
It makes these simple methods much slower than they need to be.

This should result in an across the board speedup in anything that accesses blocks or does logic with positions.

This is based upon conclusions drawn from inspecting the assenmbly generated bythe JIT compiler on my microbenchmarks.
They had 'callq' (invoke) instead of 'mov' (get from memory) instructions.
2016-11-30 20:56:58 -06:00
BillyGalbreath
925d397466 PlayerLaunchProjectileEvent 2018-07-21 03:11:03 -05:00
BillyGalbreath
a949eef7aa PlayerElytraBoostEvent 2018-07-21 01:59:59 -05:00
BillyGalbreath
e054d501fb EnderDragon Events 2018-07-21 01:51:27 -05:00
Aikar
eb528f5f37 add more information to Entity.toString()
UUID, ticks lived, valid, dead
2018-07-19 01:13:28 -04:00
Aikar
3430a002d1 InventoryCloseEvent Reason API
Allows you to determine why an inventory was closed, enabling plugin developers
to "confirm" things based on if it was player triggered close or not.
2018-07-03 21:56:23 -04:00
BillyGalbreath
b7f23ee86d Add config to disable ender dragon legacy check 2018-06-22 10:38:31 -05:00
Aikar
dddd41ac34 Expand Explosions API
Add Entity as a Source capability, and add more API choices, and on Location.

Co-authored-by: Esoteric Enderman <90862990+EsotericEnderman@users.noreply.github.com>
Co-authored-by: Bjarne Koll <git@lynxplay.dev>
2018-06-20 23:17:24 -04:00
Brokkonaut
991875920d Add entity knockback events
- EntityKnockbackEvent
- EntityPushedByEntityAttackEvent
- EntityKnockbackByEntityEvent

Co-authored-by: aerulion <aerulion@gmail.com>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
2018-06-18 15:46:23 +02:00
Aikar
d68fcd321f PlayerReadyArrowEvent
Called when a player is firing a bow and the server is choosing an arrow to use.
Plugins can skip selection of certain arrows and control which is used.
2018-06-18 01:12:53 -04:00
Aikar
26ade76848 Improve EntityShootBowEvent
Adds missing call to Illagers and also adds Arrow ItemStack to skeletons

== AT ==
public net.minecraft.world.entity.projectile.AbstractArrow getPickupItem()Lnet.minecraft.world.item.ItemStack;
2013-06-15 19:51:17 -04:00
BillyGalbreath
2d9d74f9a9 Make shield blocking delay configurable 2018-06-16 01:18:16 -05:00
Aikar
4ec0188c4d Print Error details when failing to save player data 2018-06-15 20:37:03 -04:00
Aikar
d50334d6e8 Configurable LootPool luck formula
Rewrites the Vanilla luck application formula so that luck can be
applied to items that do not have any quality defined.

See: https://luckformula.emc.gs for data and details
-----------

The rough summary is:
My goal was that in a pool, when luck was applied, the pool
rebalances so the percentages for bigger items is
lowered and smaller items is boosted.

Do this by boosting and then reducing the weight value,
so that larger numbers are penalized more than smaller numbers.
resulting in a larger reduction of entries for more common
items than the reduction on small weights,
giving smaller weights more of a chance

-----------

This work kind of obsoletes quality, but quality would be useful
for 2 items with same weight that you want luck to impact
in varying directions.

Fishing still falls into that as the weights are closer, so luck
will invalidate junk more.

This change will result in some major changes to fishing formulas.

-----------

I would love to see this change in Vanilla, so Mojang please pull :)
2018-06-15 00:30:32 -04:00
Aikar
809fa1fbea Unset Ignited flag on cancel of Explosion Event
Otherwise the creeper infinite explodes
2018-06-10 01:18:49 -04:00
Shane Freeder
d6d2d75fe6 Add EntityTeleportEndGatewayEvent 2018-06-09 14:08:39 +02:00
Aikar
b64e7f96d3 WitchReadyPotionEvent 2018-06-05 22:47:26 -04:00
Aikar
a3b5f969ed WitchThrowPotionEvent
Fired when a witch throws a potion at a player
2018-05-16 20:44:58 -04:00
Aikar
72743537f4 WitchConsumePotionEvent
Fires when a witch consumes the potion in their hand
2018-05-16 20:35:16 -04:00
Aikar
40e2712d61 EndermanAttackPlayerEvent
Allow control over whether or not an enderman aggros a player.

This allows you to override/extend the pumpkin/stare logic.
2018-05-01 20:18:54 -04:00
0x22
952a6d631c Fix exploit that allowed colored signs to be created 2018-04-26 04:41:11 -04:00
Aikar
634b639098 Expand World.spawnParticle API and add Builder
Adds ability to control who receives it and who is the source/sender (vanish API)
the standard API is to send the packet to everyone in the world, which is ineffecient.
Adds an option to control the force mode of the particle.

This adds a new Builder API which is much friendlier to use.
2017-08-15 22:29:12 -04:00
Aikar
b4ece1619f EndermanEscapeEvent
Fires an event anytime an enderman intends to teleport away from the player

You may cancel this, enabling ranged attacks to damage the enderman for example.
2018-04-30 13:15:55 -04:00
Brokkonaut
5a528af05e Configurable sprint interruption on attack
If the sprint interruption is disabled players continue sprinting when they attack entities.
2018-04-14 20:20:46 +02:00
Minecrell
0511551203 Call PaperServerListPingEvent for legacy pings 2017-10-11 19:30:51 +02:00
Minecrell
361fc3ab43 Make legacy ping handler more reliable
The Minecraft server often fails to respond to old ("legacy") pings
from old Minecraft versions using the protocol used before the switch
to Netty in Minecraft 1.7.

Due to packet fragmentation[1], we might not have all needed bytes
available when the LegacyPingHandler is called. In this case, it will
run into an error, remove the handler and continue using the modern
protocol.

This is unlikely to happen for the first two revisions of the legacy
ping protocol (used in Minecraft 1.5.x and older) since the request
consists of only one or two bytes, but happens frequently for the
last/third revision introduced in Minecraft 1.6.

It has much larger, variable packet sizes due to the inclusion of
the virtual host (the hostname/port used to connect to the server).

The solution[2] is simple: If we find more than two matching bytes,
we buffer the remaining bytes until we have enough to fully read and
respond to the request.

[1]: https://netty.io/wiki/user-guide-for-4.x.html#wiki-h3-11
[2]: https://netty.io/wiki/user-guide-for-4.x.html#wiki-h4-13
2017-10-11 18:22:50 +02:00