GithubHelp home page GithubHelp logo

minestom / minestom Goto Github PK

View Code? Open in Web Editor NEW
2.1K 41.0 334.0 201.53 MB

1.20.4 Lightweight Minecraft server

Home Page: https://minestom.net

License: Apache License 2.0

Java 100.00%
java minecraft minestom minecraft-server minecraft-api minecraft-performance nio

minestom's Introduction

banner banner

Minestom

license standard-readme compliant
javadocs wiki discord-banner

Minestom is an open-source library that enables developers to create their own Minecraft server software, without any code from Mojang.

The main difference between Mojang's vanilla server and a minestom-based server, is that ours does not contain any features by default! However, we have a complete API which is designed to allow you to make anything possible, with ease.

This is a developer API not meant to be used by end-users. Replacing Bukkit/Forge/Sponge with this will not work since we do not implement any of their APIs.

Table of contents

Install

Minestom is not installed like Bukkit/Forge/Sponge. As Minestom is a Java library, it must be loaded the same way any other Java library may be loaded. This means you need to add Minestom as a dependency, add your code and compile by yourself.

Minestom is available on Maven Central, and can be installed like the following (Gradle/Groovy):

repositories {
    mavenCentral()
    maven { url 'https://jitpack.io' }
}

dependencies {
    implementation 'net.minestom:minestom-snapshots:<???>'
}

Usage

An example of how to use the Minestom library is available here. Alternatively you can check the official wiki or the javadocs.

Why Minestom?

Minecraft has evolved a lot since its release, most of the servers today do not take advantage of vanilla features and even have to struggle because of them. Our target audience is those who want to make a server that benefits little from vanilla features. e.g. creative, kitpvp. The goal is to offer more performance for those who need it. In other words, it makes sense to use Minestom when it takes less time to implement every missing vanilla feature you want than removing every vanilla feature that will slow you down.

Advantages and Disadvantages

Minestom isn't perfect, our choices make it much better for some cases, worse for some others.

Advantages

  • Remove the overhead of vanilla features
  • Multi-threaded
  • Instance system (Collections of blocks and entities) which is much more scalable than worlds
  • Open-source
  • Modern API
  • No more legacy NMS

Disadvantages

  • Does not work with Bukkit/Forge/Sponge plugins or mods
  • Does not work with older clients (using a proxy with ViaBackwards is possible)
  • Bad for those who want a vanilla experience
  • Longer to develop something playable
  • Multi-threaded environments need extra consideration

API

Even if we do not include anything by default in the game, we simplify the way you add them, here is a preview.

Instances

It is our major concept, worlds are great for survival with friends, but when it scales up it can become unmanageable. The best examples can be found in Skyblock or minigames, not being able to separate each part properly and being forced to save everything in files, not to say the overhead caused by unnecessary data contained in them. Instances are a lightweight solution to it, being able to have every chunk in memory only, copying and sending it to another player in no time, with custom serialization and much more...

Being able to create instances directly on the go is a must-have, we believe it can push many more projects forward.

Instances also come with performance benefits, unlike some others which will be fully single-threaded or maybe using one thread per world we are using a set number of threads (pool) to manage all chunks independently from instances, meaning using more CPU power.

Blocks

Minestom by default does not know what is a chest, you will have to tell him that it opens an inventory. Every "special blocks" (which aren't only visual) need a specialized handler. After applying this handler, you have a block that can be placed anywhere simply. However, all blocks are visually there, they just won't have interaction by default.

Entities

The terms "passive" or "aggressive" monsters do not exist, nobody stops you from making a flying chicken rushing into any players coming too close, doing so with NMS is a real mess because of obfuscation and the large inheritance.

Inventories

It is a field where Minecraft evolved a lot, inventories are now used a lot as client<->server interface with clickable items and callback, we support these interactions natively without the need of programming your solution.

Commands

Commands are the simplest way of communication between clients and server. Since 1.13 Minecraft has incorporated a new library denominated "Brigadier", we then integrated an API designed to use the full potential of args types.

Credits

Contributing

See the contributing file! All WIP features are previewed as Draft PRs

License

This project is licensed under the Apache License Version 2.0.

minestom's People

Contributors

adamaq01 avatar articdive avatar deidaramc avatar draycia avatar eoghanmc22 avatar epicplayera10 avatar greatwyrm avatar hsgamer avatar iam4722202468 avatar iamceph avatar jesfot avatar jglrxavpok avatar kebab11noel avatar kezz avatar krystilizenevadies avatar leodog896 avatar minikloon avatar moulberry avatar mrbretze avatar mrgazdag avatar mworzala avatar nesaak avatar r0bbyyt avatar rinesthaix avatar steanky avatar thatcreeper avatar themode avatar thiccaxe avatar togar2 avatar zakshearman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

minestom's Issues

Running BossBar#progress(float) doesn't refresh it for audiences who have that BossBar shown

What is the current behavior?

Nothing happens on the client end

What is the expected behavior?

The BossBar shoould change its progress on the client end

What steps will reproduce the problem?

Creating a BossBar using BossBar.bossBar(), then running Player#showBossbar using that BossBar as parameter and after that running BossBar#progress(float)

Additional information / Possible thoughts on why this bug is happening

There is no packet being sent to the client when calling BossBar#progress(float)

Create a discord for Minestom?

Hey I'm interested in contributing to the project, it would be quite cool if we had a way to communicate, in general it would be great to have a discord for the community and developers looking to help.

Cannot send singular title/subtitle/times with Adventure

What is the current behavior?

As Title does not accept null components, there is no way to set individual elements of a title without resending the whole set of title packets.

Additional information / Possible thoughts on why this bug is happening

This is not intended behaviour - the vanilla client does not have the possibility to set individual parts of a title without setting the entire element. Additionally, in 1.17 this will be hard coded. It's perhaps best to leave this as it is and mark with wontfix to prep for 1.16 and make the legacy chat methods of sending titles not delegate to the Adventure method.

Change ItemStack in PickupItemEvent to ItemEntity

What would you like added/changed?

Currently the PickupItemEvent contains information about the ItemStack that is being picked up. This ItemStack is the underlying ItemStack from the ItemEntity that is actually being picked up. My proposed change is to replace this ItemStack with ItemEntity. The exact changes would be: replacing the ItemStack itemStack field in the PickupItemEvent to ItemEntity itemEntity; replacing the current constructor's second parameter (ItemStack itemStack) to ItemEntity itemEntity; and replacing the ItemStack getItemStack() method with a ItemEntity getItemEntity() method, which returns the itemEntity field.

Why do you think this is a good addition/alteration?

This change should be made to allow users to interact with the item entity being picked up, rather than being restricted to the underlying ItemStack. Users who still wish to interact with the underlying ItemStack can call ItemEntity#getItemStack() to retrieve the underlying ItemStack.

Why do you want this to be added?

In the extension I'm making I want to alter the behaviour in which players pickup item entities. Since this change results in players not picking up items in the traditional way, the PickupItemEvent would be cancelled. However, the ItemEntity they are picking up may in some cases need to be deleted. Since there's currently no way to access the ItemEntity being picked up, I am unable to delete this item.

Additional Information

I've asked about this in the Discord guild previously, however I think it was forgotten about, hence why I raise this here.

Chunk packet is sent before client settings

We currently send the chunks before receiving the settings packet (containing the player view distance), meaning that we send an arbitrary number of chunks and then update it once we receive the settings.

The correct sequence can be seen here.

Resource management

What would you like added/changed?

It would be great if extensions had access to an established resource management API. What do I mean by that? Take Bukkit/Spigot/Paper for example and how it handles plugin configs, where config files are stored within the plugin jar and can be saved into the plugin's data folder, and when loading the config, the plugin prefers the data file rather than the internal resource. Though if added, it would be great if this were expanded to any arbitrary file rather than just a specific config file.

Why do you think this is a good addition/alteration?

It would establish a standard within extensions (that can be made specifically thread safe if necessary) meaning reduced duplicate code, as well as explicit support for data files, particularly human readable data files.

Why do you want this to be added?

So I can just save / load config files and other such things and get on with making my extension.

ItemEntity is not thread-safe

What is the current behavior?

The server is deadlocked, entity pool threads are blocked 100% of the time. Clients time out.

What is the expected behavior?

CPU usage to scale with the amount of item entities.

What steps will reproduce the problem?

Throw a lot (~700 for me) of items on the ground that don't merge. This is easily done by throwing them directly from the creative inventory tabs.

What java version is being used?

OpenJDK 11

If there is an exception, use pastebin/hastebin (NB: no expiry date!) to send the stacktrace

Entity pool thread dump: https://pastebin.com/raw/qwGsNmRy

Additional information / Possible thoughts on why this bug is happening

"Ms-EntitiesPool-9" #26 prio=5 os_prio=0 cpu=62001.28ms elapsed=1883.55s tid=0x00007f94d8010800 nid=0x190b4 waiting for monitor entry [0x00007f94d68f8000]
java.lang.Thread.State: BLOCKED (on object monitor)
at net.minestom.server.entity.ItemEntity.update(ItemEntity.java:52)
- waiting to lock <0x0000000092a20a28> (a net.minestom.server.entity.ItemEntity)
- locked <0x000000008cac8028> (a net.minestom.server.entity.ItemEntity)

"Ms-EntitiesPool-10" #27 prio=5 os_prio=0 cpu=62437.06ms elapsed=1883.51s tid=0x00007f94d8012000 nid=0x190b5 waiting for monitor entry [0x00007f94d66f5000]
java.lang.Thread.State: BLOCKED (on object monitor)
at net.minestom.server.entity.ItemEntity.update(ItemEntity.java:52)
- waiting to lock <0x000000008cac8028> (a net.minestom.server.entity.ItemEntity)
- locked <0x0000000092a20a28> (a net.minestom.server.entity.ItemEntity)

The two threads both hold one of the two objects they both want. They're both blocked waiting for the other to release the other object. This issue is caused by ItemEntity::update() locking this and then the item entity it checks to see if it can merge with.

Modify "dependency" section of wiki

Hi, since commit 26b8ad1, it is necessary to add the repository for spongepowered in order to use minestom. My proposal is to change the dependency section of the wiki to this:

repositories {
    ...
    maven { url 'https://libraries.minecraft.net' }
    maven { url 'https://jitpack.io' }
    maven { url 'http://repo.spongepowered.org/maven' }
    ...
}

As of now, it looks like this:

repositories {
    ...
    maven { url 'https://libraries.minecraft.net' }
    maven { url 'https://jitpack.io' }
    ...
}

Particle DUST create a (Client ?) Heavy latence FIXED

What is the current behavior?

https://cdn.discordapp.com/attachments/483713379857596416/820632476937748480/Bug_Redstone_Particle.mp4

What is the expected behavior?

https://cdn.discordapp.com/attachments/483713379857596416/820633654995714088/Bug_Redstone_Particle_Flame_Compressed.mp4

What steps will reproduce the problem?

Get here a demo: https://github.com/MrBretze/ParticleBugMinestom

What operating system and java version is being used?

Windows 10/Ubuntu 20.04

Windows: https://adoptopenjdk.net/?variant=openjdk11&jvmVariant=hotspot
Linux: https://adoptopenjdk.net/?variant=openjdk11&jvmVariant=openj9

Additional information / Possible thoughts on why this bug is happening

I dont no

Contribution

Your Question:

Who can I talk to, to get started contributing? is there a gitter or slack somewhere?

Error when loading extension

image

Developer comment: "You need to bootstrap your main class".

Should provide more information in the exception.

Player#playSound(Sound) does not follow the player

What is the current behavior?

This method currently delegates to Player#playSound(Player, double, double, double) which fixes the sound at a given location.

What is the expected behavior?

It should be sending an EntitySoundEffectPacket instead.

Provide a Gradle task to merge files with identical names

Applying FatJar or ShadowJar on a Minestom implementation without further tweaks will generate two org.spongepowered.service.mixin.IMixinService files inside the generated jar, making Mixin fail when trying to load its services.

Messages I posted on our Discord:

Mixins use the META-INF/services folder on the jar to find the Mixin services, and the service loader API does not support multiple files with identical names

The identical names happen because both Mixin and Minestom create a org.spongepowered.service.mixin.IMixinService (name may vary) file that gets added to the jar file

Game data

The goal is to remove our dependency on prismarine minecraft-data and Mojang data generators.

It might also allow us to become registry-based instead of generating enums. Allowing users to create their own blocks, entities, etc... with a modded client.

Here is our wish list of fields to retrieve from the vanilla client.

Blocks

  • id
  • display name
  • hardness
  • bounding box information (even for complex shapes such as stairs)
  • id for every state
  • Block Entity namespace id
  • luminance (emitted light)
  • opacity (consumed light)

Entity types

  • id
  • display name
  • bounding box

Items

  • id
  • Max default stack size
  • Corresponding block

Map Colors

  • name
  • id
  • colorValue

Attacker yaw value can infinitely increase/decrease

What is the current behavior?

A player's yaw when you call player.getPosition().getYaw() can be under 0 or over 360. You can rotate and it can infinitely increase/decrease based on the direction you rotate in.

I doubt a video is needed but in case: https://zak.pink/2021/03/Frayed-Arachnid-11486.mp4

What is the expected behavior?

The rotation should roll over on itself. E.g -1 -> 359 and 365 -> 5.

What steps will reproduce the problem?

Rotate a couple times in the same direction and your yaw will either be under 0 or over 360.

What operating system and java version is being used?

Windows 10, Java 11 Azul

Command framework

The new command framework should improve on those points:

  • reduce boilerplate code
  • command redirection support
  • allow programmers to use commands in their code to retrieve data in a high-level way (like an RPC)
  • dynamic parsing, allowing custom argument type (eg: JSON, javascript expressions) using the tab completion packet

Redirection is a really great feature that is part of the protocol, for example in the "execute" command which is rich and allows a multitude of different syntax.

Commands should not only be a way for players inside a server to take action, they should also be a way to communicate with a module in a higher-level way. Taking the example of a command "/time get" which could print the current instance time in the chat, nothing would prevent this value from being retrieved in code in a computable format.
time = executor.command("time get")
executor.command("time set "+(time*2))
This will allow language interoperability, higher-level API for scripts, familiar interface for those who don't want to dig into long documentations.

Syntaxes are currently computed only when the command string is sent to the server. A lot of arguments can already be auto-suggested/completed client-side, but in some case it might not be enough. There should be an API allowing to create custom arguments that would send the completion strings to the client

Ghost Items

What is the current behavior?

If you change the slot of the hotbar quickly, ghost items occur.

What is the expected behavior?

No ghost items when you scrolling through the hotbar quickly.

What steps will reproduce the problem?

  1. Join the server
  2. Sets the gamemode to survival
  3. Scroll through the hotbar with the mouse wheel (fast)

What operating system and java version is being used?

Operating System:

Edition: Windows 10 Home
Version: 1909
Operating system build: 18363.959

Java:

openjdk 14.0.1 2020-04-14
OpenJDK Runtime Environment AdoptOpenJDK (build 14.0.1+7)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 14.0.1+7, mixed mode, sharing)

Additional information / Possible thoughts on why this bug is happening

I think the server sends one packet too many when scrolling the hotbar.

Open Deprecations

Below is a table of the deprecated methods or groups of methods and roughly when they are planned for removal.

This Table does not cover all deprecations, and other methods may still be removed without warning, for example on Minecraft version updates, as the API is not yet stable..

None of these features should be used, since they will be removed at some point. If you are unsure about what to replace your usage of these deprecated features with, come and chat to us in the Discord.

Deprecation Reason Replacement Removal See Also
Chat package (including JsonMessage and related methods/subclasses) No longer needed Adventure API Estimated 1.17 https://wiki.minestom.com/feature/adventure
SoundCategory enum No longer needed Adventure API Estimated 1.17 https://wiki.minestom.com/feature/adventure#sound
Argument types Long and Entities Estimated 1.17
ResponseData#setName(String) Misleading #setVersion(String)
ResponseDataConsumer Replaced by event ServerListPingEvent 1.17 ServerListPingEvent
ResponseData methods for Player and PingPlayer No longer needed NamedAndIdentified and entry methods 1.17
AdventureSerializer No longer needed The standard Adventure serializers

Entity Metadata API

Having a proper metadata object containing the buffer of an entity.

The layout could also be specified in EntityType (and probably some other data such as the bounding box)

java.lang.IllegalStateException: String length (768) was higher than the max length of 256

If you type
ㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇㅇ
in the chat, an error log pops up.

Errors occur only when written in Korean and do not appear in English or in numbers.
(It could be weird because it's a translator)
https://pastebin.com/PMrkdmMX

Implement the Adventure API

Adventure is a server-side user interface library for Minecraft which is fast becoming the standard user interface system for many Minecraft related projects. It is currently implemented in Velocity, Sponge 8 and Paper.

Moving to use Adventure has the following benefits:

  • Brings Minestom into step with other server implementations.
  • Allows developers to move projects to Minestom more easily.
  • Reduces all user interface maintenance in Minestom.
  • Future-proofs Minestom developers against upcoming changes (for example, the upcoming Title changes).
  • Allows developers to use the advanced API that Adventure provides.

Improve the extension system

Currently, the extension has a few flaws:

  • Unloading an extension does not automatically remove its callbacks. Event callback ownership could help on this point.
    Should this include an API change or not? It might be possible to use the extension's classloader to determine if a callback is owned by a given extension when unloading that extension.
    If we are willing to trade some memory for performance, Minestom could even cache the callbacks when they are added to immediately remove the extensions callbacks on unloading, without iterating through all active callbacks.
  • If Mixin are not used by an extension, and the Mixin library does not load, this should not crash the server.
  • Extensions should be able to mixin into some Minestom classes before they are loaded (InstanceContainer for instance). This might require to load extensions earlier than the MinecraftServer.init() call inside the Bootstrap class
    Because extension loading is currently toggleable, this option may require a command line option or a System property to be added to Minestom to turn extension loading.
  • Investigate issues with "new" JRE versions when J9 modules are present in the classpath, as security has been reinforced.

Extensions repository

Hello, I'd like to know if there is some place where can be found and shared extensions, like SpigotMC for Spigot plugins.

Possibly simplify initializing block alternatives, which could help with Block States API later on?

Here's an example of code that can generate all the magic ids of block states by only providing the default: https://gist.github.com/MichaelPriebe/c4c9c24e37ef25073f3dbf43946a5cd3

Its output matches all the traditionally hardcoded states: https://github.com/Minestom/Minestom/blob/master/src/autogenerated/java/net/minestom/server/instance/block/states/OakStairs.java

I am not sure how it would be implemented though, but it could lead to a more enjoyable usage of block states, instead of funky "key=value" lists.

Falling out of world throws NullPointerException

What is the current behavior?

Falling out of world in Creative Mode throws many NullPointerExceptions. After some time, you'll get a timeout.

What is the expected behavior?

Nothing (to implement by user) / or die?
But no NPE log spam

What steps will reproduce the problem?

Implement event handler like me to your server

val globalEventHandler = MinecraftServer.getGlobalEventHandler()
globalEventHandler.addEventCallback(
    PlayerLoginEvent::class.java
) { event: PlayerLoginEvent ->
    event.setSpawningInstance(instanceContainer)
    event.acquirablePlayer.acquire { player ->
        player.respawnPoint = Position(0.0, 42.0, 0.0)
        player.getAttribute(Attributes.MAX_HEALTH).baseValue = 2F // I don't think this line is the cause, but for completeness I took the code from my example
        player.gameMode = GameMode.CREATIVE
        player.isFlying = true
    }
}

What operating system and java version is being used?

description value
operation system Debian GNU/Linux 9.13 (stretch)
jvm OpenJDK 15.0.1

If there is an exception, use pastebin/hastebin (NB: no expiry date!) to send the stacktrace

https://ghostbin.co/paste/3ayqe

Additional information / Possible thoughts on why this bug is happening

NullPointerException / A null check would be helpful

FireworkEffect is not right

What is the current behavior?

FireworkEffect have primaryColor and fadeColor as ChatColor.

  if (compound.containsKey("Colors")) {
            int[] color = compound.getIntArray("Colors");
            primaryColor = ChatColor.fromRGB((byte) color[0], (byte) color[1], (byte) color[2]);
        }
        if (compound.containsKey("FadeColors")) {
            int[] fadeColor = compound.getIntArray("FadeColors");
            secondaryColor = ChatColor.fromRGB((byte) fadeColor[0], (byte) fadeColor[1], (byte) fadeColor[2]);

        }

What is the expected behavior?

They should be array of chat color not a single color

What steps will reproduce the problem?

Because of this you can't get firework with FireworkEffect.

What operating system and java version is being used?

Win10, Java1.15 amazon corretto

If there is an exception, use pastebin/hastebin (NB: no expiry date!) to send the stacktrace

Additional information / Possible thoughts on why this bug is happening

Inventory should be created using Component

What would you like added/changed?

An Inventory should take a Component as title, instead of a String.

Why do you think this is a good addition/alteration?

Because all the other text and chat things are using components, and it's possible too with inventories.

Why do you want this to be added?

Because I want to use rgb chat colors in inventory titles, and Components are just more flexible than a single string.

Testing framework

What would you like added/changed?

Minestom lacks tests to ensure its feature work properly.

Why do you think this is a good addition/alteration?

Having a testing framework for Minestom could allow to avoid regression bugs, make sure features are implemented correctly, and finally, can help Minestom developers (extensions, libraries or server implementations) to test their own code easily.

Why do you want this to be added?

Testing features inside Minestom can quickly become overwhelming: setting up the server, registering instances, setting up the test and finally writing the test code can take a long time to get right, and needs to be repeated for each test.

Additional Information

While it is possible to greatly reduce the length of code required via JUnit's @Before annotation, using a Minestom-specific framework could go a long way to improve the user experience.

This is heavily inspired by Mojang's own testing framework: https://www.youtube.com/watch?v=vXaWOJTCYNg

ChatColor.DARK_CYAN is broken

What is the current behaviour?

Usage of ChatColor.DARK_CYAN results in the color of the following text being set to white

What is the expected behaviour?

Usage of ChatColor.DARK_CYAN results in the color of the following text being set to a more blue-greenish color

What steps will reproduce the problem?

Command debugCyan = new Command("cyan");
debugCyan.setDefaultExecutor((sender, args) -> {
    sender.sendMessage(ChatColor.DARK_CYAN + "This text should be in dark cyan.");
    MinecraftServer.getConnectionManager().broadcastMessage(ColoredText.of(ChatColor.DARK_CYAN + "This text should be in dark cyan."));
    MinecraftServer.getConnectionManager().broadcastMessage(ColoredText.of(ChatColor.DARK_CYAN, "This text should be in dark cyan."));
});
MinecraftServer.getCommandManager().register(debugCyan);

All three resulting lines will be in white if the command /cyan is invoked

What operating system and java version is being used?

Java 11.0.9.1 (OpenJDK obtained from vendor)
Fedora 33
Minestom ed46bd0dc2 (Build from Wed Dec 16 03:12:59 UTC 2020) for both server and extension used

Additional information / Possible thoughts on why this bug is happening

The ChatColor.DARK_CYAN is correctly replaced with "{#dark_cyan}" (at least to my tests), and the decompiled output of the ChatColor class appear to also be fine, so I don't have a real idea why this is happening

Walls don't properly connect

What is the current behavior?

walls display as if connected, but aren't actually connected to any block (there's a gap between the wall and the block next to it)
Video: https://www.zak.pink/2021/03/Vivacious-Paddlefish-11433.mp4

What is the expected behavior?

Walls will connect with no gaps

What steps will reproduce the problem?

Place walls next to each other

What operating system and java version is being used?

Windows / Azul Java 11

Additional information / Possible thoughts on why this bug is happening

N/A

Using with maven

Hi, I am unable to use this as a dependency in my maven project.

Here is the relevant part of my pom.xml:

    <repositories>
        <repository>
            <id>jitpack.io</id>
            <url>https://jitpack.io</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>com.github.Minestom</groupId>
            <artifactId>Minestom</artifactId>
            <version>master-SNAPSHOT</version>
        </dependency>
    </dependencies>

What should I change?

ChatHoverEvent#showEntity and #showItem do not render correct output

What is the current behavior?

Currently, creating a ChatHoverEvent for an entity or an item will produce the following output:

"hoverEvent": {
    "action": "show_entity",
    "value": "{\"id\":\"7e59f8e9-68ed-4fc4-b632-6e3854e32250\",\"type\":\"minecraft:bee\"}"
}

The same is also the case for the show_item action, which serialises the NBT of the whole item rather than just the tag (if any).

What is the expected behavior?

The correct formatting for hover events with arbitrary NBT data is as follows:

"hoverEvent": {
    "action": "show_entity",
    "contents": {
        "type": "minecraft:bee",
        "id": "7e59f8e9-68ed-4fc4-b632-6e3854e32250"
    }
}

What steps will reproduce the problem?

Simply create a ChatHoverEvent and call toString on the event. This can be compared to hover events produced by online tools such as https://www.minecraftjson.com/.

What operating system and java version is being used?

Ubuntu 20.04 and Java 15 (replicated on Java 11).

Additional information / Possible thoughts on why this bug is happening

The reliance on NBTCompound#toSNBT is incorrect as the compound formatting differs to the string version of NBT data. This should be swapped to constructed JSON elements instead.

Tab-list API

We have currently no API to handle the tab-list.

I do not know if it should allow custom slots as Mojang took the decision to use the player-list for chat tab-completion and in the social menu.

Hidden players not visible in the tab-list

What is the current behavior?

If the player on the server leaves the spawn chunks and then another player enters the server, the new player will not see the other players who were already on the server. But even those who were already online do not see the new player, only when the old players go back to the spawn chunks of the new player, you see him again. But it can also happen that not all players see each other.

What is the expected behavior?

That all players see each other.

What steps will reproduce the problem?

  1. Join the server with an account
  2. Get out of spawn chunks
  3. Join the server with another account
  4. Press tab with the second account (no other players displayed)
  5. Go with the first account into the spawn chunks

What operating system and java version is being used?

Operating System:

Edition: Windows 10 Home
Version: 1909
Operating system build: 18363.959

Java:

openjdk 14.0.1 2020-04-14
OpenJDK Runtime Environment AdoptOpenJDK (build 14.0.1+7)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 14.0.1+7, mixed mode, sharing)

ConcurrentModificationException when unregistering instances quickly

What is the current behavior?

A ConcurrentModificationException occurs when unregistering multiple instances in a row (through a scheduler).

What is the expected behavior?

There should not be an error

What steps will reproduce the problem?

  1. Create many InstanceContainers.
  2. In a scheduled task (not sure if it errors outside of a scheduled task), use MinecraftServer.getInstanceManager().unregisterInstance(instance);
  3. Check console for error

What operating system and java version is being used?

Windows 10, Java 11

If there is an exception, use pastebin/hastebin (NB: no expiry date!) to send the stacktrace

https://pastebin.com/AYyMVUsX

The Removed instance with id _ messages are messages I send when an instance is removed.

Additional information / Possible thoughts on why this bug is happening

Perhaps use a ConcurrentHashMap instead to make it thread-safe or don't call the UNSAFE_unloadChunks method when unregistering.

ViaVersion and Via* support

Introduction

I am creating this issue to request addition of Via* support into Minestom.

Preferably, all that one needs to do is implement the basic ViaVersion/(current version-higher versions) pipeline support.
Then, the user can opt into also using ViaBackwards (1.9.x-current version) and ViaRewind (1.7.10 & 1.8.9).

Supported Versions:

Table (https://i.imgur.com/0u20Y2u.png)

Why use ViaVersion on Minestom and not on a proxy?

Some people don't want to have a proxy, just to have something like ViaVersion running on there. People also run ViaVersion on the Bukkit platform.

What about performance

Yes, I know that Minestom is epic for having thousands of connections at once thanks to the multiple optimizations done in the past. But let's be honest.. If I wanted all that bleeding edge performance, I'd use a proxy (or multiple) and do a more extreme of a job when it comes to making sure things are performant.

As a user, I just want people from other versions to be able to
connect to the server, without fuss on either side.

Some pointers for an actual implementation

My actual PoC (not finished, or want to finish) - https://github.com/OpenMinigameServer/Minestom/tree/poc/viaversion/src/main/java/net/minestom/server/via
These are usually what's required to get it to work. Implementation is partially finished in there..
Velocity implementation - https://github.com/ViaVersion/ViaVersion/tree/master/velocity/src/main/java/us/myles/ViaVersion/velocity/handlers
@hpfxd - Has done this in the past.. Might be able to help, although has done it under and NDA because fuck open-source.
ViaVersion's Discord server - https://viaversion.com/discord

Particle API

First of all, particles should not be in an enum because a few of those require extra data: https://wiki.vg/Protocol#Particle.
This would also allow us to fix ArgumentParticle, since it currently does not support the additional data.

As for the API, a few things are possible to facilitate fancy effect creation. For example a timing tool, some utils for recurrent math (circle, line towards a direction, collision with blocks/entity, gravity/velocity, etc)

ghost players in offline mode

What is the current behavior?

When a player leaves and joins an offline server quickly, a clone of the player is created

What is the expected behavior?

That the previous player entity leaves before the next one joins

What steps will reproduce the problem?

leave and join a server with mojang auth disabled in quick succession

What operating system and java version is being used?

windows 10 java 11

Additional information / Possible thoughts on why this bug is happening

Probably due to a netty channel not being terminated correctly

Scoreboard doesn't accept JSON components

What is the current behavior?

The scoreboard is erroneously being sent using the legacy component serialiser. This causes a crash for players.

What is the expected behavior?

It should use the GSON serialiser.

What steps will reproduce the problem?

Create a scoreboard with a component as a title.

What operating system and java version is being used?

N/A

If there is an exception, use pastebin/hastebin (NB: no expiry date!) to send the stacktrace

Additional information / Possible thoughts on why this bug is happening

Additional generation stage with access to multiple chunks

Implementation of some features (trees, for example) would be significantly easier with a new generation stage that provides access to a grid of loaded chunks (rather than just a single chunk).

This idea is based on Minecraft's feature generators, which are given a ChunkRegion (Yarn name), which allows access to a small grid of loaded chunks during generation.

Classes that should be shade-relocated throw a ClassNotFoundException

Edit: this is intended behaviour, with some unfortunate side effects, but hey

What is the current behavior?

  • ClassNotFound exceptions for Classes/Packages such as net.engio.mbassy or org.spongepowered.configurate
    • Affects both external dependencies and shaded (latter is ignorable as it's fixable on the developer's part)
  • These cannot be used via external dependencies
  • The hypothetical class org.spongepowered.bork.Borkton will throw a ClassNotFoundException even if it is defined in the same jar!

What is the expected behavior?

  • These classes can be used via external dependecies without issues
  • You don't have to shade them in and relocate them (Bukkit works without issues! - even when not relocated)
  • The hypothetical class org.spongepowered.bork.Borkton can be used without issues

What steps will reproduce the problem?

(For example, all Configurate libraries can reproduce it - whether self compiled or not and independent from the groupId)

  • Have org.spongepowered:configurate-hocon:4.0.0 as an artifact (found in maven central)

  • Call org.spongepowered.configurate.ConfigurateException.class.toString(); or similar within the initialize method.

  • Enjoy your ClassNotFoundException!

  • Have a class in the org.spongepowered package

  • Use that Class

What operating system and java version is being used?

  • Java 11.0.9.1 (OpenJDK obtained from vendor)
  • Fedora 33

If there is an exception, use pastebin/hastebin (NB: no expiry date!) to send the stacktrace

https://hastebin.com/anasoruzom.properties

Additional information / Possible thoughts on why this bug is happening

This is likely an issue with Minestom's Classloader since Bukkit loads just fine.
The org.spongepowered issue in itself could be a seperate issue (since it might be something to do with Mixins), but since the symptoms are exactly the same I won't open a seperate issue.

I've already spent far too much time researching into this issue (probably over 15 hours at this point) with almost no progress so I'll stop to do other things now especially since I found a workaround, but that it a hacky one at best since it's not obvious.

Batches

Add some options to batches, for example being able to revert a flush (remove all the blocks placed by the batch and replace them with what was at the position before)
And add the option to have the batch requiring relative position so the same batch can be used at multiple place

Block commands API & new world format

Integrating a list of well-defined block commands (eg fill/schematic/noise) with the following traits:

  • Serializable
  • Convertable to command syntax
  • Usable in code using block command buffers
  • Provide notable performance improvement by taking advantage of the predictable expect of those (eg fill a whole section with stone instead of setting each block one by one)

Those commands could also be used to serialize chunks and therefore be part of a new world format

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.