Commit Graph

3966 Commits

Author SHA1 Message Date
56738
afdc67fc26
Fix Palette#resize not actually resizing the palette (#503) 2021-10-24 16:04:34 +02:00
Bloepiloepi
c5f4ce8515
Fix color constructor (#502) 2021-10-23 15:15:55 +02:00
themode
13eade4e35 Workers should be minestom threads 2021-10-22 03:09:32 +02:00
TheMode
b1ef97b5af Use toList in stream chains
Signed-off-by: TheMode <themode@outlook.fr>
2021-10-22 02:23:14 +02:00
TheMode
7891cc5bbe Use more instanceof pattern matching
Signed-off-by: TheMode <themode@outlook.fr>
2021-10-22 02:19:38 +02:00
TheMode
5030664ff9 Use more enhanced switches
Signed-off-by: TheMode <themode@outlook.fr>
2021-10-22 02:14:12 +02:00
TheMode
b308ce5baa
Update to Java 17 (#462) 2021-10-22 01:55:55 +02:00
TheMode
85d9256fa8 Viewable packet process cleanup
Signed-off-by: TheMode <themode@outlook.fr>
2021-10-20 13:36:00 +02:00
Alex K
0b7b7283e6
Fix adding viewers to FakePlayer (#497) 2021-10-19 20:04:54 +02:00
TheMode
3685bf22b7 Improve CachedPacket
Signed-off-by: TheMode <themode@outlook.fr>
2021-10-19 12:41:34 +02:00
Corey Shupe
11d0f82b86
Make Mojang SessionServer Configurable (#499) 2021-10-19 10:11:04 +02:00
Konstantin Shandurenko
b6bce86eca
Fixed with* methods in Pos (#495) 2021-10-17 21:39:10 +02:00
Konstantin Shandurenko
ba76e746a2
Entity#lookAt and updating view in melee/ranged/combined attack goals when within attackable range (#494) 2021-10-17 21:07:59 +02:00
TheMode
68ff09df8a Initialized field can be made final, as it happen earlier during construction
Signed-off-by: TheMode <themode@outlook.fr>
2021-10-17 14:33:18 +02:00
TheMode
999d774f90 Trim registry hashmaps to improve lookup performance
Signed-off-by: TheMode <themode@outlook.fr>
2021-10-17 14:29:27 +02:00
Andre Roldan
fb39fa59f5
fix 'seeInvisiblePlayers' friendly flag (#491) 2021-10-17 08:21:38 +02:00
TheMode
06189ee783
Async flush (#492) 2021-10-16 19:55:24 +02:00
TheMode
13a8a22546 Add preventive kick instead of hard to debug timeouts
Signed-off-by: TheMode <themode@outlook.fr>
2021-10-15 15:54:11 +02:00
themode
099397b968 Limit viewable packet allocations 2021-10-15 11:09:05 +02:00
TheMode
0bd519c894 Use fastutil for viewable packets
Signed-off-by: TheMode <themode@outlook.fr>
2021-10-15 06:17:48 +02:00
EpicPlayerA10
ca6fbe4d09 Misspelled firework type enum 2021-10-14 19:29:33 -04:00
TheMode
21b751dbd1 Reduce default worker thread count
Signed-off-by: TheMode <themode@outlook.fr>
2021-10-13 12:37:54 +02:00
TheMode
b5b281c717 Use a parallel stream for viewable packets
Signed-off-by: TheMode <themode@outlook.fr>
2021-10-13 12:25:35 +02:00
TheMode
c0024fe4dd Optimize getEquipmentsPacket
Signed-off-by: TheMode <themode@outlook.fr>
2021-10-13 06:36:43 +02:00
TheMode
bd4aa90753
Framed packet cleanup (#489) 2021-10-13 06:33:44 +02:00
TheMode
0f4698bed7 Potentially fix removed entities from still being ticked
Signed-off-by: TheMode <themode@outlook.fr>
2021-10-11 23:38:32 +02:00
TheMode
5c2ab68a0a Add experimental Point#sameBlock
Signed-off-by: TheMode <themode@outlook.fr>
2021-10-11 11:08:35 +02:00
TheMode
eca9b5e32d Flush packets before computing mspt
Signed-off-by: TheMode <themode@outlook.fr>
2021-10-11 03:33:16 +02:00
Andre Roldan
b94d196021
use legacySection() instead of legacyAmpersand() (#488) 2021-10-10 04:19:32 +02:00
TheMode
022ec237ba KeepAliveListener cleanup
Signed-off-by: TheMode <themode@outlook.fr>
2021-10-10 03:29:51 +02:00
EpicPlayerA10
6e16fb7b13
Fix writable book (#478) 2021-10-08 22:24:01 +02:00
TheMode
11806b9166 Ensure no packet corruption due to encryption. A proxy is still recommended for optimal performance
Signed-off-by: TheMode <themode@outlook.fr>
2021-10-06 21:14:08 +02:00
TheMode
45071cebd8
Add EntityInstanceEvent (#480) 2021-10-06 20:40:17 +02:00
TheMode
2f1e4101d1 Add more try-catch to prevent the worker from returning
Signed-off-by: TheMode <themode@outlook.fr>
2021-10-06 18:47:40 +02:00
Matt Worzala
d89e5cf2ee
Hardcode heightmap value to dimension height. (#481) 2021-10-05 23:29:05 +02:00
TheMode
a6f59fc9e9 Ensure that player connections reference are not kept for viewable packets
Signed-off-by: TheMode <themode@outlook.fr>
2021-10-03 19:23:09 +02:00
TheMode
b9746a0574 Give InventoryClickEvent the proper inventory for drag clicks
Signed-off-by: TheMode <themode@outlook.fr>
2021-10-02 20:03:38 +02:00
TheMode
e71c420fa8 Remove unnecessary air check
Signed-off-by: TheMode <themode@outlook.fr>
2021-10-02 01:58:42 +02:00
Moulberry
26341005b1
Passenger Fixes (#476)
Don't teleport player when entering/exiting vehicle + better height offset logic
2021-10-01 16:35:42 +02:00
TheMode
36bcf69728 Buffer collection cleaner
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-29 18:31:28 +02:00
themode
729fc14e6d Skip 3 bytes instead of overwriting 0 2021-09-26 17:39:30 +02:00
themode
d02a898646 Fix buffer view not being used with compression disabled 2021-09-26 17:35:14 +02:00
TheMode
236683c986 No volatile read for compression/encryption
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-26 17:02:05 +02:00
TheMode
f07ab21d3e Use LocalCache for deflaters
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-25 20:29:47 +02:00
TheMode
9fe3f28497 Improve ThreadLocal performance when calling from a minestom thread
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-25 19:37:14 +02:00
TheMode
be9b11f238 Simplify path finding code, do not expose internal parts
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-24 19:31:54 +02:00
TheMode
619a9b3209 Use a parallel stream for flushing
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-23 11:32:13 +02:00
TheMode
68107c9a90 Reuse the tick buffer when possible & avoid iteration
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-22 23:24:22 +02:00
TheMode
d5d4a97694 EntityTeleportPacket must also be prepared
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-22 19:12:48 +02:00
TheMode
93a62ba133 Optimize entity teleport, prevent movement packets from being sent with teleport ones
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-22 01:13:05 +02:00
themode
1d8addaea6 Prevent TickThreads from stopping if something weird happens 2021-09-21 21:31:02 +02:00
TheMode
e97f1db184 Call Player#remove on server shutdown
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-21 19:30:36 +02:00
TheMode
5a4fc95ffd Shutdown the server on OOM
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-21 10:44:36 +02:00
TheMode
e43d001076 Passenger entities should not send velocity packets
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-21 10:37:36 +02:00
TheMode
ccbbf6b512 Fix BinaryBuffer#canRead
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-21 10:17:33 +02:00
TheMode
22ead81ebe Take the vehicle eye height into consideration
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-21 09:10:51 +02:00
TheMode
d8abdef1da Synchronize entity position when removing vehicle
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-20 22:43:54 +02:00
TheMode
2e017c3f0e Put equality check in the final method
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-20 22:32:16 +02:00
TheMode
3ea414fe85 Merge remote-tracking branch 'origin/master' 2021-09-20 22:29:11 +02:00
TheMode
a6fda18af6 Ensure that passengers are visible
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-20 22:28:09 +02:00
Bloepiloepi
497816df5a Allow playerSkin to be null 2021-09-20 20:56:12 +02:00
TheMode
62769fc343
Merge pull request #470 from MrBretze/master
Added isChunkLoaded to Instance.java
2021-09-20 19:56:14 +02:00
TheMode
2c4ea3c3c4 Serialize/Compress tag packet only once
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-20 19:34:43 +02:00
TheMode
8f3e8c5a13 Remove players during their next tick
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-20 19:30:52 +02:00
TheMode
17807f35da Add experimental PlayerConnection#sendFramedPacket
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-20 18:59:15 +02:00
TheMode
4e58d61345 Prevent deadlock when adding/removing viewers very fast
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-20 18:42:31 +02:00
TheMode
e65c9f6a79 Avoid block allocation if the properties map is the same
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-20 18:09:16 +02:00
TheMode
25055413ff Avoid unnecessary allocation in the anvil loader
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-20 17:49:39 +02:00
TheMode
860c6b21d1 Remove threadChunkMap
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-20 13:31:45 +02:00
TheMode
1edab499f1 Make dedicated thread class for tick scheduling
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-20 13:01:58 +02:00
TheMode
82a68cbfad Inline shouldBenchmark
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-20 12:47:22 +02:00
ALS
64100c64e6 Make isChunkLoaded not abstract 2021-09-19 20:54:13 +02:00
ALS
66f476b2cd Added isChunkLoaded to Instance.java 2021-09-19 20:37:39 +02:00
TheMode
cbc87a2a68
Merge pull request #468 from Project-Cepi/relative-vec-coordinate-type-getter
Add `getCoordinateType` to RelativeVec
2021-09-19 14:37:26 +02:00
LeoDog896
7c6c583ce1 Record getter 2021-09-19 08:36:27 -04:00
LeoDog896
7cc50467e2 Update RelativeVec.java 2021-09-19 08:25:22 -04:00
TheMode
872a49d371 Use a bitset for light mask (thanks @Kebab11noel)
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-19 10:09:08 +02:00
TheMode
d53ef36586 Use an array instead of list
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-18 22:14:46 +02:00
TheMode
a3ff3b25c4 Add hint in BlockGetter to only retrieve a block type at a position (ignore the handler + nbt)
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-18 16:18:41 +02:00
TheMode
dda90a6dfe Improve chunk block getter
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-18 15:59:20 +02:00
TheMode
5376b8af76 Synchronize chunk packet creation
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-17 16:58:50 +02:00
TheMode
380f5a5a67 Remove faulty fast exit
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-16 19:50:57 +02:00
TheMode
4b5ec566bd Allow FramedPackets to be sent safely
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-16 19:37:30 +02:00
TheMode
be4542e936 Ignore air when shift clicking
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-16 19:21:36 +02:00
TheMode
ba8da0647e Properly call click events for shift & double clicks
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-16 18:57:13 +02:00
TheMode
13c05626e2 Handle the connection exception being null
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-16 07:50:12 +02:00
TheMode
3211831073 Ensure that the viewable element can be collected
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-16 07:43:08 +02:00
KrystilizeNevaDies
e061c1e640 Correct Instance#getNearbyEntities implementation 2021-09-16 14:56:08 +10:00
TheMode
2589cc4f3e Inline TickThread tick method
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-16 06:21:45 +02:00
TheMode
f1a1adc74f Issue fixed in GraalVM 21.3
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-16 05:08:49 +02:00
TheMode
aa33e2256c Remove useless map lookup
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-15 17:45:09 +02:00
TheMode
0e8c07a811 Simplify ThreadDispatcher even further
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-15 17:33:01 +02:00
TheMode
9ab5e746ca Prevent another lambda allocation
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-15 15:30:24 +02:00
TheMode
cffbf47b94 Prevent lambda allocation
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-15 14:57:17 +02:00
TheMode
7f463cdf94 Cleanup
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-15 14:54:11 +02:00
TheMode
a0c38b94c6 Avoid unnecessary thread local lookup for acquirable entities
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-15 14:41:01 +02:00
TheMode
2ecd10a4ec Cipher#update is copy-safe
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-15 03:47:48 +02:00
Moulberry
c5362bffba Remove debugging 2021-09-14 17:50:56 +08:00
Moulberry
ee435f43f2 Set proper pose once flying finishes 2021-09-14 17:50:19 +08:00
Moulberry
1933914bbc Set proper pose once flying finishes 2021-09-14 17:43:02 +08:00
Moulberry
73ea79bed2 Fix flying clip bug 2021-09-14 17:37:57 +08:00
TheMode
7737d0e5b3 Cleanup MultiBlockChangePacket
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-14 08:14:14 +02:00
TheMode
2d3daf2504 Share code
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-14 07:20:58 +02:00
TheMode
8fce62ccba Simplify tick loop
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-14 04:36:10 +02:00
TheMode
983850171b Use cleaner to reuse connection buffers
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-14 02:22:58 +02:00
TheMode
561a10bddc
Merge pull request #459 from Project-Cepi/log-class-loader-finalization
Use proper logging to log class loader finalization
2021-09-14 01:20:48 +02:00
TheMode
2f9b649466 Reduce memory used for viewable packets
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-13 23:01:37 +02:00
TheMode
e1a3c295a2 Add dedicated PooledBuffers class
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-13 22:12:07 +02:00
Moulberry
5bf4758a3a Remove extra chunk unloads 2021-09-13 15:08:57 +08:00
Moulberry
9531bd5cb3 Merge upstream 2021-09-13 15:07:11 +08:00
Moulberry
0360fd3f79 Fix 2 entity loading issues 2021-09-13 15:05:16 +08:00
TheMode
527141df74 Nvm, the barrier is not necessary
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-12 23:44:53 +02:00
TheMode
ecd2200e1a Insert barrier
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-12 23:22:32 +02:00
TheMode
d9c32fe198 Improve TickThread
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-12 23:20:22 +02:00
TheMode
06d8586f7f Improve the thread provider api
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-12 22:55:37 +02:00
TheMode
c31aa8a7ec More safety in Acquired + doc
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-12 06:29:33 +02:00
TheMode
7b059d2be5 Remove redundant comments/methods
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-12 02:34:29 +02:00
LeoDog896
ab35022f60 Use slf4j instead of println for finalization (MinestomExtensionClassLoader) 2021-09-11 17:42:30 -04:00
TheMode
e77e32889b
Merge pull request #458 from Project-Cepi/add-chunk-ref-to-block-handler-methods
Add chunk reference to Tick, blockPosition (Tick) -> relativeBlockPosition
2021-09-11 23:20:41 +02:00
LeoDog896
adab546d33 Remove unnecessary imports 2021-09-11 17:19:24 -04:00
LeoDog896
332a8536be Use absolute coordinates 2021-09-11 17:08:03 -04:00
TheMode
5106927b10 Add Acquirable#isLocal
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-11 20:24:11 +02:00
LeoDog896
888405c54c Add chunk reference to Tick 2021-09-11 11:49:14 -04:00
TheMode
42f4678db0 More style
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-11 06:13:48 +02:00
TheMode
b5062ab4d6 Gravity tick counter should be part of the velocity tick method
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-11 05:54:26 +02:00
TheMode
3977b6f967 Code style
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-11 05:31:35 +02:00
TheMode
ee95015ed3 Simplify packet reading
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-11 03:39:59 +02:00
TheMode
0c5b37ed18 Optimize unnecessary chunk coordinate conversion
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-11 01:04:11 +02:00
TheMode
73237bb11b Fix wrong constant being used
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-11 00:04:35 +02:00
TheMode
75dbacf8aa
Merge pull request #455 from RinesThaix/inventorySlots
Resolving inventory- events and condition slot-issues
2021-09-10 18:11:59 +02:00
Шандуренко Константин Владимирович
6c76baa940 Code review 2021-09-10 19:08:39 +03:00
Шандуренко Константин Владимирович
1e5dc8d870 Removed stateless-related stuff from BlockManager 2021-09-10 18:42:21 +03:00
Шандуренко Константин Владимирович
e990283c40 Resolving inventory- events and condition issues 2021-09-10 18:38:27 +03:00
Шандуренко Константин Владимирович
98fc704139 BlockHandlerBase 2021-09-10 16:50:38 +03:00
Шандуренко Константин Владимирович
e3600525fa BlockManager#registerStatelessHandler 2021-09-10 16:48:01 +03:00
Шандуренко Константин Владимирович
f45484c840 Removed synchronization on BlockManager methods, related to handlers 2021-09-10 16:45:04 +03:00
Шандуренко Константин Владимирович
2f2254ebc2 Setting up BlockHandler for blocks loaded by AnvilLoader 2021-09-10 16:42:59 +03:00
TheMode
6355f06d53 Compression buffer has now multiple purpose
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-10 06:35:34 +02:00
TheMode
3ddf729a46 Code style, remove deprecated ChatMode
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-10 05:50:08 +02:00
TheMode
e6db47ec6e Add fancy Player#sendPacket shortcut
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-10 05:41:54 +02:00
TheMode
fd027ecfd7 Do not forget to put the buffer back in the pool queue
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-09 23:18:14 +02:00
TheMode
526108b896 Remove unnecessary allocation during encryption
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-09 23:15:57 +02:00
TheMode
344003f36a VanillaStackingRule style
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-09 23:14:59 +02:00
TheMode
f48199397a Simplify acquisition
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-09 20:49:54 +02:00
TheMode
acb8634b4b Acquirable style cleanup
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-09 17:16:20 +02:00
TheMode
1c719a2fd7 Make getChunkCoordinate smarter and more efficient
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-09 06:57:46 +02:00
TheMode
6ab94bb778 One less magic value
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-09 00:26:10 +02:00
TheMode
d7a116c144 Prevent buffer being resized in writeFramedPacket, it is now possible to know if a buffer couldn't be written to
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-08 22:26:18 +02:00
TheMode
f023b1bc07 Simplify writeVarIntHeader
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-08 22:23:37 +02:00
TheMode
21bac6fba4 Better name for the local deflater, add link to the packet format
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-08 20:31:13 +02:00