feat: implemented resource packs
This commit is contained in:
parent
9b575d73cc
commit
e32b047d47
@ -5,4 +5,10 @@ dependencies {
|
|||||||
api 'org.apache.logging.log4j:log4j-slf4j2-impl:2.24.0'
|
api 'org.apache.logging.log4j:log4j-slf4j2-impl:2.24.0'
|
||||||
api 'org.apache.logging.log4j:log4j-api:2.24.0'
|
api 'org.apache.logging.log4j:log4j-api:2.24.0'
|
||||||
api 'org.apache.logging.log4j:log4j-core:2.19.0'
|
api 'org.apache.logging.log4j:log4j-core:2.19.0'
|
||||||
|
|
||||||
|
api 'net.kyori:adventure-api:4.17.0'
|
||||||
|
api 'net.kyori:adventure-text-minimessage:4.17.0'
|
||||||
|
api 'team.unnamed:creative-api:1.7.3'
|
||||||
|
api 'team.unnamed:creative-serializer-minecraft:1.7.3'
|
||||||
|
api 'team.unnamed:creative-server:1.7.3'
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,6 +12,7 @@ public class Bootstrap {
|
|||||||
|
|
||||||
FlatWorldModule.init(GameMode.ADVENTURE);
|
FlatWorldModule.init(GameMode.ADVENTURE);
|
||||||
|
|
||||||
|
boot.getResourcePackManager().compile();
|
||||||
boot.start("0.0.0.0", 25565);
|
boot.start("0.0.0.0", 25565);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
package ru.dragonestia.msb3.api;
|
package ru.dragonestia.msb3.api;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import net.minestom.server.MinecraftServer;
|
import net.minestom.server.MinecraftServer;
|
||||||
|
import ru.dragonestia.msb3.api.resource.ResourcePackManager;
|
||||||
|
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
|
|
||||||
@ -22,6 +24,7 @@ public class ServerBootstrap {
|
|||||||
};
|
};
|
||||||
|
|
||||||
private final MinecraftServer server;
|
private final MinecraftServer server;
|
||||||
|
@Getter private final ResourcePackManager resourcePackManager;
|
||||||
|
|
||||||
public ServerBootstrap() {
|
public ServerBootstrap() {
|
||||||
for (var line: LOGO) log.info(line);
|
for (var line: LOGO) log.info(line);
|
||||||
@ -30,6 +33,8 @@ public class ServerBootstrap {
|
|||||||
|
|
||||||
MinecraftServer.setBrandName("Dragonestia");
|
MinecraftServer.setBrandName("Dragonestia");
|
||||||
|
|
||||||
|
resourcePackManager = new ResourcePackManager();
|
||||||
|
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,27 @@
|
|||||||
|
package ru.dragonestia.msb3.api.resource;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import team.unnamed.creative.ResourcePack;
|
||||||
|
import team.unnamed.creative.base.Writable;
|
||||||
|
import team.unnamed.creative.serialize.minecraft.MinecraftResourcePackWriter;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
@Log4j2
|
||||||
|
public class ResourcePackManager {
|
||||||
|
|
||||||
|
@Getter private final ResourcePack resourcePack;
|
||||||
|
|
||||||
|
public ResourcePackManager() {
|
||||||
|
resourcePack = ResourcePack.resourcePack();
|
||||||
|
resourcePack.packMeta(34, "Dragonestia MSB3 - Resource pack");
|
||||||
|
resourcePack.icon(Writable.resource(getClass().getClassLoader(), "logo.png"));
|
||||||
|
resourcePack.unknownFile("credits.txt", Writable.stringUtf8("dragonestia.ru"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void compile() {
|
||||||
|
MinecraftResourcePackWriter.minecraft().writeToZipFile(new File("resource-pack.zip"), resourcePack);
|
||||||
|
log.info("Compiled resource pack. File: ./resource-pack.zip");
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
api/src/main/resources/logo.png
Normal file
BIN
api/src/main/resources/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.2 KiB |
Loading…
x
Reference in New Issue
Block a user