Update project configuration and refactor codebase

- Migrated Minestom dependency to new groupId.
- Added Maven Shade plugin for packaging.
- Switched Java version to 21 and corrected JDK settings.
- Refactored terrain generation logic to use the updated Minestom API.
- Replaced deprecated particle creation methods.
- Enabled Velocity proxy support.
- Updated various configuration files to align with the new build setup.
This commit is contained in:
MineTec committed 2025-12-19 21:45:07 +01:00
1 parent 7561d42f41
commit d6b396758b
20 files changed
+139 -69

No files matched your search

@@ -6,12 +6,14 @@ import net.minestom.server.coordinate.Pos;
import net.minestom.server.entity.Player;
import net.minestom.server.entity.PlayerSkin;
import net.minestom.server.event.GlobalEventHandler;
import net.minestom.server.event.player.AsyncPlayerConfigurationEvent;
import net.minestom.server.event.player.PlayerDisconnectEvent;
import net.minestom.server.event.player.PlayerLoginEvent;
import net.minestom.server.event.player.PlayerMoveEvent;
import net.minestom.server.extras.velocity.VelocityProxy;
import net.minestom.server.instance.InstanceContainer;
import net.minestom.server.instance.InstanceManager;
import net.minestom.server.instance.block.Block;
import net.minestom.server.timer.TaskSchedule;
import java.util.HashMap;
@@ -24,12 +26,12 @@ public class EndlessJumper {
HashMap<Player, JumpGenerator> games = new HashMap<>();
eventHandler.addListener(PlayerLoginEvent.class, event -> {
eventHandler.addListener(AsyncPlayerConfigurationEvent.class, event -> {
final Player p = event.getPlayer();
p.setRespawnPoint(new Pos(0.5,101.5,0.5));
final InstanceContainer world = instanceManager.createInstanceContainer();
world.setChunkGenerator(new TerrainGenerator());
world.setGenerator(new TerrainGenerator());
Pos startingAt = new Pos(0,100,0);
world.setBlock(startingAt, Block.DIAMOND_BLOCK);
@@ -41,7 +43,11 @@ public class EndlessJumper {
event.setSpawningInstance(world);
games.put(p, new JumpGenerator(startingAt, p, world));
MinecraftServer.getSchedulerManager().scheduleTask(
() -> games.put(p, new JumpGenerator(startingAt, p, world)),
TaskSchedule.seconds(3),
TaskSchedule.stop()
);
});
eventHandler.addListener(PlayerMoveEvent.class, event -> {
@@ -70,11 +76,10 @@ public class EndlessJumper {
//if(p.getPosition().z() > target.z()+2) generator.highlight();
});
eventHandler.addListener(PlayerDisconnectEvent.class, event -> {
games.remove(event.getPlayer());
});
eventHandler.addListener(PlayerDisconnectEvent.class, event -> games.remove(event.getPlayer()));
server.start("0.0.0.0", 25565);
VelocityProxy.enable("iph0YHK9jNWZ");
server.start("0.0.0.0", 25501);
}
}
@@ -1,36 +1,12 @@
package eu.mhsl.minecraft.endlessjumper;
import net.minestom.server.instance.Chunk;
import net.minestom.server.instance.ChunkGenerator;
import net.minestom.server.instance.ChunkPopulator;
import net.minestom.server.instance.batch.ChunkBatch;
import net.minestom.server.instance.block.Block;
import net.minestom.server.world.biomes.Biome;
import net.minestom.server.instance.generator.GenerationUnit;
import net.minestom.server.instance.generator.Generator;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Arrays;
import java.util.List;
public class TerrainGenerator implements ChunkGenerator {
public class TerrainGenerator implements Generator {
@Override
public void generateChunkData(@NotNull ChunkBatch batch, int chunkX, int chunkZ) {
for(byte x = 0; x < Chunk.CHUNK_SIZE_X; x++) {
for(byte z = 0; z < Chunk.CHUNK_SIZE_Z; z++) {
for(byte y = 0; y < 1; y++) {
batch.setBlock(x, y, z, Block.AIR);
}
}
}
}
public void generate(@NotNull GenerationUnit unit) {
@Override
public void fillBiomes(@NotNull Biome[] biomes, int chunkX, int chunkZ) {
Arrays.fill(biomes, Biome.PLAINS);
}
@Override
public @Nullable List<ChunkPopulator> getPopulators() {
return null;
}
}
@@ -17,8 +17,6 @@ public class BlockPalette {
blocks.add(Block.OXIDIZED_COPPER);
blocks.add(Block.OXIDIZED_CUT_COPPER);
return blocks.get(r.nextInt(0, blocks.size()));
}
}
@@ -8,23 +8,23 @@ import net.minestom.server.coordinate.Pos;
import net.minestom.server.entity.Player;
import net.minestom.server.instance.InstanceContainer;
import net.minestom.server.instance.block.Block;
import net.minestom.server.network.packet.server.play.ParticlePacket;
import net.minestom.server.particle.Particle;
import net.minestom.server.particle.ParticleCreator;
import net.minestom.server.sound.SoundEvent;
import java.util.ArrayList;
import java.util.Random;
public class JumpGenerator {
private Player player;
private InstanceContainer world;
private ArrayList<Pos> blocks = new ArrayList<>();
private final Player player;
private final InstanceContainer world;
private final ArrayList<Pos> blocks = new ArrayList<>();
private Pos checkpoint;
private Pos starting;
private int combo = 0;
private int preview = 2;
private final int preview = 2;
public JumpGenerator(Pos starting, Player player, InstanceContainer world) {
@@ -53,12 +53,12 @@ public class JumpGenerator {
this.checkpoint = current;
this.player.playSound(Sound.sound(SoundEvent.ENTITY_PLAYER_LEVELUP, Sound.Source.BLOCK, 0.3f, 1f));
this.player.showTitle(Title.title(Component.text(""), Component.text("Checkpoint", TextColor.color(0, 255, 0))));
this.player.sendPacket(ParticleCreator.createParticlePacket(Particle.CRIT, current.x()+0.5, current.y()+0.5, current.z()+0.5, 1.5f, 1.5f, 1.5f, 50));
this.player.sendPacket(new ParticlePacket(Particle.CRIT, current, current.add(0.5), 1.5f, 50));
}
this.world.setBlock(target.add(0, 1 ,0), Block.LIGHT);
this.blocks.add(target);
this.player.sendPacket(ParticleCreator.createParticlePacket(Particle.CRIT, target.x()+0.5, target.y()+0.5, target.z()+0.5, 1, 1, 1, 10));
this.player.sendPacket(ParticleCreator.createParticlePacket(Particle.FALLING_NECTAR, target.x()+0.5, target.y()+1.5, target.z()+0.5, 0.3f, 0.1f, 0.3f, 10));
this.player.sendPacket(new ParticlePacket(Particle.CRIT, target, target.add(0.5), 1, 10));
this.player.sendPacket(new ParticlePacket(Particle.FALLING_NECTAR, target, target.add(0.5),0.3f, 10));
this.combo++;
}
@@ -95,14 +95,6 @@ public class JumpGenerator {
return checkpoint;
}
public Player getPlayer() {
return player;
}
public InstanceContainer getWorld() {
return world;
}
public ArrayList<Pos> getBlocks() {
return blocks;
}