hollow-cube / minestom-ce Goto Github PK
View Code? Open in Web Editor NEWThis project forked from minestom/minestom
1.20.4 Lightweight Minecraft server
Home Page: https://minestom.net
License: Apache License 2.0
This project forked from minestom/minestom
1.20.4 Lightweight Minecraft server
Home Page: https://minestom.net
License: Apache License 2.0
When pressing F3 + 3
the network monitor of minecraft will be opened and ping request packets (play) are being sent contantly to the server. They are not implemented so this error will occurr:
java.lang.IllegalStateException: Packet id 0x1e isn't registered!
Dont forget to implement Ping Response (play) too.
So Minestom CE removed extensions, how can I extend Minestom then? Is there a new "Plugin"/Extension System?
Static API is a poor solution if someone wants to run two server instances.
I want to be able to get an object of a started process with all services.
for example:
MinecraftServer minecraftServer = MinecraftServer.init();
InstanceManager instanceManager = minecraftServer.getInstanceManager();
Server server = minecraftServer.getServer();
CommandManager commandManager = minecraftServer.getCommandManager();
GlobalEventHandler eventHandler = minecraftServer.getGlobalEventHandler();
I wanted to make a class similar to net.minestom.server.MinecraftServer to run the server, but some internal objects access static methods. It would be cool to make Minestom independent of these static fields and methods so that you can run Minestom without net.minestom.server.MinecraftServer
Running a velocity proxy (3.2.0) and using VelocityProxy.enable() with the correct forwarding secret still results in the player being kicked with "Invalid proxy response" message
I've updated to version 1.20.4 via a self-built minestom-ce on the 1_20_4 branch.
I try to make a FakePlayer appear with:
MinecraftServer.getGlobalEventHandler().addListener(PlayerSpawnEvent.class, e -> {
System.out.println("e = " + e);
FakePlayer.initPlayer(UUID.randomUUID(), "Child", fp -> {
fp.setInstance(container, new Pos(0, 42, 0));
fp.setRespawnPoint(new Pos(0, 42, 0));
fp.spawn();
System.out.println("fp = " + fp);
});
});
So, e is printed e = net.minestom.server.event.player.PlayerSpawnEvent@7926d4ab
.
But fp is not printed and the fake player does not appear.
Minestom sends packets to the player every tick, but in some cases, for example for some animations, it is necessary to send packets with a frequency greater than the server's tick rate. It would be very convenient to have a Player::sendPacketInstantly method
Ran into a issue when a entity is moving it's x/z velocity is not being updated properly to show that they are actually moving in said direction.
How to reproduce:
Listen to a vehicle moving (my example was using a task to run every 10 ticks to set the vehicle velocity to a constant by multiplying it), the issue with my example is that my X/Z is equal to 0 regardless of me moving on not.
MinecraftServer.getSchedulerManager().scheduleTask(() -> {
for (Player player : MinecraftServer.getConnectionManager().getOnlinePlayers()) {
Entity vehicle = player.getVehicle();
if (vehicle == null || !vehicle.getEntityType().equals(EntityType.BOAT))
continue;
Vec boatVec = vehicle.getVelocity();
System.out.println("ogVec " + boatVec + " (has velocity? " + vehicle.hasVelocity() + ")");
// Velocity (0, yGrav, 0), vehicle velocity state is false aswell.
Vec multipliedVec = boatVec.withY(0).mul(20);
vehicle.setVelocity(multipliedVec);
}
}, TaskSchedule.immediate(), TaskSchedule.tick(10));
When I create command with two or more arguments and defaultExecutor or syntax without arguments, custom suggesions behave very weird.
It will not show syntax popup over input fireld. Autocompletion of the first argument will be completely broken. Second argumet autocompletion will work but only after I enter some character.
It is a lot simplier to see it yourself than explain so please run showcase. https://github.com/reosfire/CommandsIssueShowcase
PR #54 has broken calls to suggestionCallback causing them to no longer happen. As such, custom tab completions are broken.
We have this command argument: return new ArgumentWord(id).map(argument::mapInput).setSuggestionCallback(argument::suggestionCallback);
The suggestion callback is never called, the mapInput is.
I'm unsure if this issue is present on regular Minestom right now.
It would be nice to optionally load all of the biomes in the registry on startup, as opposed to just plains.
I think it would be fine to always load them all (and generate an enum), but only register them all if some system property is set.
Hello,
I saw this project and thanks for maintaining the minestom project!
The readme mentions breaking changes to the minestom codespace.
It would be nice if this project has it's own javadoc.
The javadoc can be hosted using github pages: https://stackoverflow.com/a/74718164
Is your feature request related to a problem? Please describe.
When we should implement Campfire inventory, we cannot rely on the InventoryType that doesn't have such inventory type.
Describe the solution you'd like
Adding CAMPFIRE into InventoryType
interface. Current implementation is:
Describe alternatives you've considered
We could use LOOM enum, but then this will be misleading to the other project maintainers, also this may lead to the confusion.
Additional context
_
I wanted to ask if you could deprecate Player#getUuid and change it to Player#getUniqueId
// masterInstance is an InstanceContainer set elsewhere
masterInstance.setTag(Tag.Boolean("exampleTag"), true);
Instance childInstance = selectedMap.copy();
logger.info(childInstance.getTag(Tag.Boolean("exampleTag")) + " <- This tag will not exist & thus error");
org.jglrxavpok.hephaistos.mca.AnvilException: Trying to load chunk with minY = -80, but instance dimension type (minecraft:overworld) has a minY of -64
at net.minestom.server.instance.AnvilLoader.loadMCA(AnvilLoader.java:109)
at net.minestom.server.instance.AnvilLoader.loadChunk(AnvilLoader.java:87)
at net.minestom.server.instance.InstanceContainer.lambda$retrieveChunk$8(InstanceContainer.java:266)
at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804)
at java.base/java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1796)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
I have this code, this entity should be visible to only one player
val entity = Entity(EntityType.ITEM_DISPLAY)
entity.isAutoViewable = false
entity.addViewer(player)
val meta = entity.entityMeta as ItemDisplayMeta
meta.itemStack = ItemStack.of(Material.BLACK_CONCRETE)
meta.scale = Vec(20.0, 20.0, 3.0)
entity.setInstance(player.instance, player.eyePosition)
but for some reason sometimes this entity appears in other players
I had the same problem when trying to hide a player, I wanted to write vanish, but players do not always hide
As I receive more details, I will update this issue.
When quitting the server the instance is cleared and then the event is called. This causes the instance to be null in the event.
@Override
default @NotNull Instance getInstance() {
final Instance instance = getEntity().getInstance();
assert instance != null : "EntityInstanceEvent is only supported on events where the entity's instance is non-null!";
return instance;
}
Order of method calls:
Entity#remove(boolean)
Instance currentInstance = this.instance;
if (currentInstance != null) {
removeFromInstance(currentInstance);
this.instance = null;
}
Then Player#remove(boolean) (second part, after returning from Entity#remove(boolean))
...
// Clear all viewable chunks
ChunkUtils.forChunksInRange(chunkX, chunkZ, MinecraftServer.getChunkViewDistance(), chunkRemover);
Fix might be moving this snippet before the following, though I am unsure of possible side effects:
if (permanent) {
this.packets.clear();
EventDispatcher.call(new PlayerDisconnectEvent(this));
}
minestom-ce is on central, so is every dependency, except hydrazine.
This is an issue to address this, I believe either the hydrazine author should publish to central, or a hydrazine fork (without modifications) should be published to central and that used instead.
This would help a LOT with problems caused by jitpack instability, or the next time jitpack goes offline for a few days.
It would remove the need of using a proxy repository for stability, which not everybody has.
It would also allow bigger projects to start working with minestom, which they haven't because of the use of jitpack.
Another option would be to use another pathfinding library(on central!), but I don't think that is a good idea rn.
When a player is crawling they should never have their state set to sneaking, but the client will still send the start sneak action when the keybind is pressed. The server needs to know when the player is crawling and ignore that packet.
Hi, im trying to make recipes for my server but when I try to join the server sometimes i get this.
Looking in the packets i found that the packet it sends doesnt contain any data with the ingredients or the result.
Same packet from a paper server (only choose une recipe)
Trough testing I found some problems
The test is done only in minestom-ce version 5bcc72b
The code of the recipes
https://gist.github.com/josemoncab/32191389a549edb7ddf7fdc70a6c9397
Main class code
public static void main(String[] args) {
System.setProperty("minestom.use-new-chunk-sending", "true");
MinecraftServer minecraftServer = MinecraftServer.init();
MinecraftServer.getRecipeManager().addRecipe(new Recipes.Blasting()); // Change to diferent recipes
PlayerInit.init(); // Class from the demo server
minecraftServer.start("0.0.0.0", 25565);
}
currently this is the behavior for shift clicks:
first an InventoryPreClickEvent
is called for the source inventory/slot. then for each slot in the target inventory capable of receiving the item, InventoryPreClickEvent
is called. however the changes in clicked item and cursor item in both of these are ignored and only cancellation takes effect. then, for each changed slot InventoryClickEvent
is called, without any event being called for the source slot.
this is the behavior I suggest:
an InventoryPreClickEvent
is called with additional Inventory getTargetInventory()
, Map<Integer, ItemStack> getChangeMap()
and void setChangeMap(Map<Integer, ItemStack> changeMap)
methods (either through a subclass InventoryPreShiftClickEvent
or in the InventoryPreClickEvent
class itself, returning null for other clicks). this event contains regular fields about the source slot/item/inventory, alongside the target inventory and its changes. both the source item and the change map can be replaced. then the changes are applied and an InventoryClickEvent
is called with the applied changes.
Currently, the EntityAnimationPacket is sent out with the TAKE_DAMAGE Animation. This Animation does not exist anymore in 1.20.
The ID of TAKE_DAMAGE (1) is now simply unused (don't remove the please, since it will break the animations after, since all IDs are still the same and minestom is using enum ordinals here. Minecraft internally just uses int constants)
Instead, the HitAnimationPacket should be sent out. I would create a PR for this, but you are required to supply the yaw from which the damage came from, and I would rather let a more experienced minestom developer properly implement this.
Hi there,
Recently I've been trying to use the newly added display entities.
But I'm having quite a lot of trouble using them, mainly because of the maths involved.
I've found an editor that makes it quite easy to create very interesting display entity combinations, but all it does is the summon command, using the matrix system.
The problem with the current rotationRight and rotationLeft is that because it uses singular value decomposition, using rotation also changes the scale, for example.
It would be so great to have the ability to just enter the 4x4 matrix. I feel like it would help a ton. Here is how I imagine it, but kinda depends on the implementation, which I do not fully understand unfortunately.
DisplayEntityMeta.addTransformation(float[])
DisplayEntityMeta.addTransformation(float[][])
Warning : I'm not that good at maths. It might be VERY easy to translate the 4x4 matrix into scale, rotationRight, rotationLeft (and translation). But from my tests it does not seem to be that simple. Also, I'm not that used to open source projects, and know it's mostly a personal project you did on the side for your own work (and that you published to the public).
Just felt it would be very useful for plenty of people, and democratize the use of DisplayEntities in Minestom if it was a thing.
InstanceContainer instance = MinecraftServer.getInstanceManager().createInstanceContainer(DimensionType.OVERWORLD);
instance.setChunkLoader(new AnvilLoader(Path.of("worlds/world")));
instance.enableAutoChunkLoad(true);
int chunkRadius = 5;
for (int x = -chunkRadius; x < chunkRadius; x++) {
for (int y = -chunkRadius; y < chunkRadius; y++) {
instance.loadChunk(x, y);
}
}
hey, i'll try to load a spigot 1.20 world but i got the following errors:
-- Log --
https://hastebin.com/share/oyowigazec.php
what can i do, to load a spigot 1.20 world?
It acts as if the existing blocks in your inventory never match.
This is because Minestom sends an empty NBT item for items without NBT (eg {}
), but vanilla sends only an end tag in this case, eg a null value.
Hello,
I just switched the dependency minestom to minestom-ce (dev.hollowcube:minestom-ce:a99fdee831
).
I tried to connect to the server with the 1.20.1 (without mods, just vanilla) and got this error message: packet (yt) was larger than I expected, found 6 bytes extra whilst reading packet.
If a player is falling and doesn't move but rotates their head, they can float above the ground once they hit the ground on their client.
Example:
Noted vanilla fix by Moulberry: "Vanilla fixes by synchronizing every second and also whenever you jump/land"
If you use an InstanceContainer
that has not yet been loaded when copying it, the resultant InstanceContainer
will be empty. To get around this, I can use InstanceContainer#loadChunk()
but imo InstanceContainer#copy()
should do this automatically
Walk away from spawn and kill yourself, the chunks around spawn will not be sent correctly.
package net.minestom.demo.abc;
import net.minestom.server.MinecraftServer;
import net.minestom.server.command.builder.Command;
import net.minestom.server.coordinate.Pos;
import net.minestom.server.entity.GameMode;
import net.minestom.server.entity.Player;
import net.minestom.server.event.GlobalEventHandler;
import net.minestom.server.event.player.PlayerLoginEvent;
import net.minestom.server.extras.MojangAuth;
import net.minestom.server.instance.InstanceContainer;
import net.minestom.server.instance.InstanceManager;
import net.minestom.server.instance.block.Block;
import net.minestom.server.tag.Tag;
import net.minestom.server.utils.NamespaceID;
import net.minestom.server.world.DimensionType;
public class Main {
public static void main(String[] args) {
// Initialize
MinecraftServer minecraftServer = MinecraftServer.init();
MinecraftServer.setBrandName("Prismarine");
InstanceManager instanceManager = MinecraftServer.getInstanceManager();
MojangAuth.init();
// Define, Register and Generate a Dimension
DimensionType lobby = DimensionType.builder(NamespaceID.from("prismarine:lobby"))
.ambientLight(2.0f)
.build();
MinecraftServer.getDimensionTypeManager().addDimension(lobby);
InstanceContainer instanceContainer = instanceManager.createInstanceContainer(lobby);
instanceContainer.setGenerator(unit ->
unit.modifier().fillHeight(0, 2, Block.STONE));
Tag<String> tag = Tag.String("lobby");
instanceContainer.setTag(tag, "lobby");
instanceManager.registerInstance(instanceContainer);
////instanceContainer.saveChunksToStorage();
// Callback from joining to specify the spawning instance and spawn position
GlobalEventHandler globalEventHandler = MinecraftServer.getGlobalEventHandler();
globalEventHandler.addListener(PlayerLoginEvent.class, playerLoginEvent -> {
final Player player = playerLoginEvent.getPlayer();
playerLoginEvent.setSpawningInstance(instanceContainer);
player.setRespawnPoint(new Pos(0, 10, 0));
player.setGameMode(GameMode.SURVIVAL);
});
// Register Commands
MinecraftServer.getCommandManager().register(new Command("kill") {
{
setDefaultExecutor((sender, context) -> {
sender.asPlayer().kill();
});
}
});
// > kill command im using for referance
//public KillCommand() {
// super("kill", "suicide");
//
// setDefaultExecutor(((sender, context) -> {
// sender.sendMessage("Usage: /kill");
// }));
//
// addSyntax((sender, context) -> {
// if (sender instanceof Player)
// ((Player) sender).kill();
// });
//}
// < end
// Start the server
minecraftServer.start("0.0.0.0", 25565);
}
}
Basically, I'm trying to create an instance for a player in the PlayerLoginEvent, but it seems like when the player breaks a block, it throws an error in console and doesn't drop an item. This same code was working with regular Minestom.
Player login listener
CustomChunkGenerator
Block I'm trying to break that doesn't drop anything
createDefaultHandler method - this is where the error occurs
Version:
implementation("dev.hollowcube:minestom-ce:010fe985bb")
Error:
java.lang.NullPointerException: Unloaded chunk at -144,-64,112
at net.minestom.server.instance.Instance.getBlock(Instance.java:596)
at net.minestom.server.instance.block.Block$Getter.getBlock(Block.java:218)
at net.minestom.server.instance.block.Block$Getter.getBlock(Block.java:226)
at io.github.fisher2911.myserver.world.BlockHandlersKt$createDefaultHandler$3.onDestroy(BlockHandlers.kt:32)
at net.minestom.server.instance.DynamicChunk.setBlock(DynamicChunk.java:111)
at net.minestom.server.instance.Chunk.setBlock(Chunk.java:91)
at net.minestom.server.instance.AnvilLoader.loadBlockEntities(AnvilLoader.java:300)
at net.minestom.server.instance.AnvilLoader.loadMCA(AnvilLoader.java:129)
at net.minestom.server.instance.AnvilLoader.loadChunk(AnvilLoader.java:87)
at net.minestom.server.instance.InstanceContainer.lambda$retrieveChunk$6(InstanceContainer.java:294)
at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804)
at java.base/java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1796)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
The link to CHANGELOG.md in the README.md is not working
It will be very cool if you start separating some systems into separate libraries independent of Minestom
When I connect to my Minestom CE server and send a chat message like fgfdfg
in the Minecraft client's game output it says "[System] [CHAT] fgfdfg" and in the chat dialog it says:
Is this due to the signed chat system from 1.19.3 / 2?
In addition, I do not get the notification saying chat messages cannot be verified.
Does Minestom CE support the signed chat system?
Also, using system messages will confuse client side mods that require normal player messages. An example of this is Xearo's WorldMap / MiniMap when sharing a waypoint, instead of saying "playername shared a waypoint ..." it will say "Server shared a waypoint ..."
java.lang.NullPointerException: Cannot invoke "com.google.gson.JsonElement.getAsString()" because the return value of "com.google.gson.JsonObject.get(String)" is null
at net.minestom.server.network.packet.client.login.EncryptionResponsePacket.lambda$process$0(EncryptionResponsePacket.java:86)
at java.base/java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:863)
at java.base/java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:841)
at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510)
at java.base/java.util.concurrent.CompletableFuture.postFire(CompletableFuture.java:614)
at java.base/java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:844)
at java.base/java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:483)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1311)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1841)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1806)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:177)
```
The http response code not 200 should be interpreted as an error and not go further. In this case it was 503.
Please work on these for the next week ish ❤️
Regions need implemented into Aether
In 1.20 update, smithing tables got an additional slot for smithing templates. however this is not updated and minestom still has 3 registered slots for it. (line 28) the number of slots should be 4 instead of 3.
AnvilLoader crashes on minecraft:grass
java.lang.NullPointerException
at java.base/java.util.Objects.requireNonNull(Objects.java:233)
at net.minestom.server.instance.AnvilLoader.loadSections(AnvilLoader.java:228)
at net.minestom.server.instance.AnvilLoader.loadMCA(AnvilLoader.java:125)
at net.minestom.server.instance.AnvilLoader.loadChunk(AnvilLoader.java:86)
at ru.melonhell.dmndsrc.impl.cstrike.WorldModule$CustomLoader.loadChunk(WorldModule.kt:30)
at net.minestom.server.instance.InstanceContainer.lambda$retrieveChunk$6(InstanceContainer.java:294)
I think you can add something like this to AnvilLoader
if (blockName.equals("minecraft:grass")) {
blockName = "minecraft:short_grass";
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.