Commit Graph

857 Commits

Author SHA1 Message Date
jglrxavpok
34030e3a8f Bump Hephaistos version + fix loading of <0 sections for 1.18 worlds 2022-01-10 16:51:21 +01:00
TheMode
5c6d0dc7b2 Improve viewer loop performance
Signed-off-by: TheMode <themode@outlook.fr>
2022-01-10 16:51:21 +01:00
Xavier Niochaut
9ab4277502 Port to Hephaistos v2 (#424) 2022-01-10 16:51:21 +01:00
TheMode
0ed847a47f Use RoaringBitmap
Signed-off-by: TheMode <themode@outlook.fr>
2022-01-10 16:51:21 +01:00
TheMode
f9b1ec8798 Keep the array Object to allow reuse
Signed-off-by: TheMode <themode@outlook.fr>
2022-01-10 16:51:21 +01:00
TheMode
ac4210d7d7 Improve thread safety of viewer iterator (forEach is recommended instead)
Signed-off-by: TheMode <themode@outlook.fr>
2022-01-10 16:51:21 +01:00
TheMode
61995e1b0c Fix viewers Set size
Signed-off-by: TheMode <themode@outlook.fr>
2022-01-10 16:51:21 +01:00
TheMode
affd4f10e6 Optimize Set#toArray for viewers
Signed-off-by: TheMode <themode@outlook.fr>
2022-01-10 16:51:21 +01:00
TheMode
22a8ccabfa Fix notifications
Signed-off-by: TheMode <themode@outlook.fr>
2022-01-10 16:51:21 +01:00
TheMode
9d26fa8137 Make LightData record
Signed-off-by: TheMode <themode@outlook.fr>
2022-01-10 16:51:21 +01:00
TheMode
05de99f45f immutable packets (record) (#528) 2022-01-10 16:51:21 +01:00
TheMode
f52cc8d82b Prepare changes for the biome api
Signed-off-by: TheMode <themode@outlook.fr>
2022-01-10 16:51:21 +01:00
TheMode
972e15a62b Add basic block entity support, simplify code
Signed-off-by: TheMode <themode@outlook.fr>
2022-01-10 16:51:21 +01:00
TheMode
d3b55700e2 Initial non-working 1.18 commit
Signed-off-by: TheMode <themode@outlook.fr>
2022-01-10 16:51:21 +01:00
TheMode
e53c0a68fb Properly remove manual viewers
Signed-off-by: TheMode <themode@outlook.fr>
2021-11-25 21:30:58 +01:00
TheMode
b637cd3059 Avoid socket write when the buffer is empty
Signed-off-by: TheMode <themode@outlook.fr>
2021-11-24 15:51:45 +01:00
TheMode
7889400e5b Fix manual viewers
Signed-off-by: TheMode <themode@outlook.fr>
2021-11-23 23:19:34 +01:00
TheMode
3fa7a0ba4b Deprecate unsafe casting methods
Signed-off-by: TheMode <themode@outlook.fr>
2021-11-23 20:38:57 +01:00
TheMode
0f2ad33e52 Use java 17 toList()
Signed-off-by: TheMode <themode@outlook.fr>
2021-11-23 20:27:25 +01:00
TheMode
ad75e942aa Remove unused/unsafe hashmap, make namespace cache thread safe
Signed-off-by: TheMode <themode@outlook.fr>
2021-11-23 19:20:49 +01:00
TheMode
098885cc7f Optimize PooledBuffers
Signed-off-by: TheMode <themode@outlook.fr>
2021-11-21 13:15:29 +01:00
TheMode
6ed55a68c0 Prevent stream allocation when viewable packets are disabled
Signed-off-by: TheMode <themode@outlook.fr>
2021-11-20 13:56:59 +01:00
TheMode
8b1856d5b7
Async packet write (#533) 2021-11-17 06:31:24 +01:00
TheMode
c5e947c76e Move CachedPacket and FramedPacket
Signed-off-by: TheMode <themode@outlook.fr>
2021-11-17 00:48:43 +01:00
GreatWyrm
62b9e80d46
Fix exception on invalid username or UUID (#532) 2021-11-15 19:23:20 +01:00
TheMode
e9a3144606 Fix boolean properties
Signed-off-by: TheMode <themode@outlook.fr>
2021-11-10 23:34:19 +01:00
TheMode
dc6a520ab5
Add properties for grouped, cached & viewable packets (#524) 2021-11-10 22:34:21 +01:00
TheMode
519c1cb937 Only url should be used as cache key
Signed-off-by: TheMode <themode@outlook.fr>
2021-11-08 08:49:25 +01:00
TheMode
e5ad5609cf Simplify MojangUtils
Signed-off-by: TheMode <themode@outlook.fr>
2021-11-07 14:46:26 +01:00
TheMode
a29cac471b More records
Signed-off-by: TheMode <themode@outlook.fr>
2021-11-07 14:33:07 +01:00
TheMode
bc921cfde9 Add size property for pooled buffers
Signed-off-by: TheMode <themode@outlook.fr>
2021-11-07 13:48:04 +01:00
TheMode
d7cbcfe239 Add Blocking annotation
Signed-off-by: TheMode <themode@outlook.fr>
2021-11-07 11:59:10 +01:00
TheMode
cde7e69c1f Use an Object2ObjectArrayMap to store block properties
Signed-off-by: TheMode <themode@outlook.fr>
2021-11-07 08:26:02 +01:00
TheMode
ec2d164e7b Add internal ObjectArray
Signed-off-by: TheMode <themode@outlook.fr>
2021-11-06 14:07:42 +01:00
TheMode
ca6f0b1eb5 Lazily initialize nbtReader
Signed-off-by: TheMode <themode@outlook.fr>
2021-11-04 19:13:11 +01:00
TheMode
b18df47feb Avoid slice allocation when compressing packets
Signed-off-by: TheMode <themode@outlook.fr>
2021-11-03 03:06:19 +01:00
TheMode
d919e1b60d Add viewer fallback for non-entities
Signed-off-by: TheMode <themode@outlook.fr>
2021-11-02 16:08:21 +01:00
TheMode
5b63636e92 Use caffeine map
Signed-off-by: TheMode <themode@outlook.fr>
2021-11-02 06:17:58 +01:00
TheMode
970d4d2d9c Allow buffer index/length to be specified
Signed-off-by: TheMode <themode@outlook.fr>
2021-11-02 03:08:36 +01:00
TheMode
0ba41ac88b Use the backing array for viewable packets
Signed-off-by: TheMode <themode@outlook.fr>
2021-11-02 02:22:05 +01:00
TheMode
ae97aec7aa Add back guava map, keep ViewableStorage synchronized
Signed-off-by: TheMode <themode@outlook.fr>
2021-11-02 01:24:57 +01:00
TheMode
faa289a097
Entity tracking rework (#486) 2021-11-01 18:04:00 +01:00
TheMode
50a0c13120 Rollback concurrent map change, due to guava not providing a compute implementation
Signed-off-by: TheMode <themode@outlook.fr>
2021-10-30 00:49:21 +02:00
themode
484727d02a Use a concurrent map for viewable packets 2021-10-29 03:03:18 +02:00
themode
72461ade73 instanceof pattern matching in LocalCache 2021-10-28 02:55:40 +02:00
TheMode
02054447f8 Use forEach to take advantage of specialized impl
Signed-off-by: TheMode <themode@outlook.fr>
2021-10-26 02:00:59 +02:00
TheMode
23d59cb135 Returned framed buffers should be flipped
Signed-off-by: TheMode <themode@outlook.fr>
2021-10-26 00:05:03 +02:00
TheMode
00401bed25 Avoid allocation when writing framed packets
Signed-off-by: TheMode <themode@outlook.fr>
2021-10-25 23:55:20 +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
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
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
bd4aa90753
Framed packet cleanup (#489) 2021-10-13 06:33:44 +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
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
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
ccbbf6b512 Fix BinaryBuffer#canRead
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-21 10:17:33 +02:00
TheMode
17807f35da Add experimental PlayerConnection#sendFramedPacket
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-20 18:59:15 +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
dda90a6dfe Improve chunk block getter
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-18 15:59:20 +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
TheMode
f1a1adc74f Issue fixed in GraalVM 21.3
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-16 05:08:49 +02: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
983850171b Use cleaner to reuse connection buffers
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-14 02:22:58 +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
TheMode
7b059d2be5 Remove redundant comments/methods
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-12 02:34:29 +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
6355f06d53 Compression buffer has now multiple purpose
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-10 06:35:34 +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
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
TheMode
e1c4a7afce Fix chunk 0 being sent multiple time
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-07 20:14:15 +02:00
TheMode
4a260b98c2 Simplify/Improve getChunksInRange
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-07 19:58:26 +02:00
TheMode
1c76fd152e Fix viewable packet when a connection has multiple pairs
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-07 04:47:33 +02:00
TheMode
adf1023e35 There is no commit here - fix compression
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-07 01:31:34 +02:00
TheMode
8f1e84ffdb Prevent framed packets from being corrupted
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-07 01:24:51 +02:00
TheMode
b2a0b91a45 Add warning in PacketUtils
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-06 13:40:11 +02:00
TheMode
8cbd6460f4 Cleanup...
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-05 03:40:30 +02:00
TheMode
026550ac07 Simplify PacketUtils
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-05 02:50:59 +02:00
TheMode
7b8277b6be Do not flip the buffer inside #write(ByteBuffer)
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-04 23:56:27 +02:00
TheMode
f717279adc Independent socket send & receive buffer size
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-04 16:43:45 +02:00
TheMode
96bfc4c6fa Add getters for chunk coordinates in Point
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-04 15:29:20 +02:00
TheMode
4b2bda15f5 Merge branch 'master' into viewable-broadcast
# Conflicts:
#	src/main/java/net/minestom/server/network/player/PlayerSocketConnection.java
2021-09-02 18:50:55 +02:00
TheMode
d4e51f562c Remove threadlocal buffer cache in ChunkDataPacket
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-02 18:44:50 +02:00
TheMode
399eb860a7 Improve performance when slow clients are connected
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-02 15:44:36 +02:00
TheMode
9bb4043571 Remove legacy weirdness
Signed-off-by: TheMode <themode@outlook.fr>
2021-09-01 11:56:09 +02:00
jglrxavpok
9f97c985aa Make javadoc build again 2021-08-28 17:09:07 +02:00
jglrxavpok
42938111d5 Allow tasks to be bound to the same thread for each run. 2021-08-26 19:50:28 +02:00
TheMode
af82bf1236 Reduce allocations for chunk packet writing 2021-08-26 10:55:56 +02:00
TheMode
024f8d36bd API cleanup 2021-08-26 10:36:31 +02:00
TheMode
73f125763c Use a lock + weak map 2021-08-25 17:25:08 +02:00
TheMode
e185bca468 Fix obvious packet corruption 2021-08-25 13:54:09 +02:00
TheMode
5e18f48a1b Cleanup 2021-08-25 10:45:35 +02:00
TheMode
2ae0c0bbcd Batch movement packets 2021-08-25 09:01:13 +02:00
TheMode
6520855418 Fix buffer offset 2021-08-24 21:21:51 +02:00
TheMode
ec66beece4 Initial viewable broadcast attempt 2021-08-24 14:59:17 +02:00
Шандуренко Константин Владимирович
f2f592209a Entity#getLineOfSightEntity and BoundingBox#intersect(Point, Point) 2021-08-22 16:56:34 +03:00
TheMode
72bda2c4ec Fast exit when trying to write an empty array 2021-08-19 11:54:26 +02:00
TheMode
69e8792ce0 Special case when an entity is teleported in the same chunk 2021-08-17 21:58:15 +02:00
TheMode
9afb86a511 Use fastutil #fastIterable when possible 2021-08-17 20:37:15 +02:00
TheMode
42afae9b68 Add warning for string reading + incorrectly configured ip forwarding 2021-08-17 06:10:36 +02:00
TheMode
e72c87f670 Reduce allocation in Navigator movement 2021-08-16 02:53:07 +02:00
TheMode
f3524d4a4f Use var to replace verbose map entrySet loop 2021-08-16 01:29:46 +02:00
TheMode
8410ac51c3 Fix enchantment nbt writing 2021-08-15 20:12:10 +02:00
TheMode
d53d2ecea5 Remove future allocation 2021-08-15 06:00:17 +02:00
TheMode
6c242cbc7f Simplify InstanceContainer 2021-08-15 05:58:53 +02:00
TheMode
168672e002 Keep reference to the framed packet for debugging/transformation purpose 2021-08-14 14:39:11 +02:00
TheMode
d4f74abc64 Include original packet in FramedPacket for debugging/listening purpose 2021-08-13 19:58:14 +02:00
TheMode
322572c96d Rename to LocalCache 2021-08-13 01:13:58 +02:00
TheMode
78126fad6c Add experimental local buffer API. Remove allocation when writing chunk packets (should help with startup time) 2021-08-13 01:08:19 +02:00
TheMode
ea951f9566 Less allocation for compressed packets 2021-08-11 14:47:20 +02:00
TheMode
fd08cabb6a Change default tab implementation to show all online players 2021-08-11 14:18:04 +02:00
TheMode
ae3884efdc Automatically resize BinaryWriter 2021-08-11 01:01:50 +02:00
TheMode
7f4e4a9b80 Steal var-int/long code from async-profiler 2021-08-10 18:45:02 +02:00
TheMode
18058bc3c8 Reduce ByteBuffer allocation 2021-08-09 23:54:45 +02:00
TheMode
5b8b9cab57 Fix buffer not being emptied 2021-08-09 02:05:51 +02:00
TheMode
1b708bc851 Fix BinaryBuffer#canWrite, use read-only buffers for caching 2021-08-09 01:45:00 +02:00
TheMode
1591df16aa Rename netty to socket wherever possible 2021-08-08 19:11:47 +02:00
TheMode
b56509718c Add encryption support 2021-08-08 19:02:36 +02:00
TheMode
f75f755194 Make BinaryBuffer internal 2021-08-08 17:01:44 +02:00
TheMode
a2e2461d22 Revert BinaryReader changes 2021-08-06 17:30:39 +02:00
TheMode
f135edba0d Replace BinaryReader to BinaryBuffer 2021-08-06 16:30:52 +02:00
TheMode
9bcf89b677 Simplify var-int reading 2021-08-06 14:30:55 +02:00
TheMode
455c21208e WIP BinaryBuffer 2021-08-06 14:21:11 +02:00
TheMode
aa2a6522dc Increase socket size, cache direct buffers 2021-08-05 15:42:16 +02:00
TheMode
87f141ff50 Simplify packet writing 2021-08-05 03:09:45 +02:00
TheMode
58487f4455 Add PacketUtils#allocateTrimmedPacket 2021-08-05 00:08:53 +02:00
TheMode
120b58db6a Fix ghost player, trim chunk/light packets 2021-08-04 21:02:59 +02:00
TheMode
9b9d3f3405 Better chunk packet caching 2021-08-04 16:49:01 +02:00
TheMode
174ef14303 Reuse grouped buffers 2021-08-04 12:41:15 +02:00
TheMode
8895e49a52 Improve socket shutdown 2021-08-04 05:15:40 +02:00
TheMode
557d34c378 Reduce allocation count 2021-08-04 04:00:42 +02:00
TheMode
9bb50430d4 Fix memory leak, decrease socket size 2021-08-04 03:53:01 +02:00
TheMode
66b567597a Fix connection crash
Signed-off-by: TheMode <themode@outlook.fr>
2021-08-04 00:37:17 +02:00