Skip to content

Commit

Permalink
Merge pull request #458 from OakLoaf/dev/1.20.6/bukkit
Browse files Browse the repository at this point in the history
Updated Bukkit to 1.20.6
  • Loading branch information
justaureus authored Jun 23, 2024
2 parents dd272bc + 500cf3c commit 8d01059
Show file tree
Hide file tree
Showing 20 changed files with 42 additions and 37 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/gradle-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ jobs:

steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93
with:
java-version: '17'
java-version: '21'
distribution: 'temurin'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file
Expand Down
4 changes: 2 additions & 2 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ repositories {
maven("https://repo.codemc.org/repository/maven-public") {
name = "CodeMC"
}
maven("https://papermc.io/repo/repository/maven-public/") {
maven("https://repo.papermc.io/repository/maven-public/") {
name = "PaperMC"
}
}

dependencies {
//TODO Allow pulling from Versions.kt
implementation("com.github.johnrengelman", "shadow", "8.1.1")
implementation("io.papermc.paperweight.userdev", "io.papermc.paperweight.userdev.gradle.plugin", "1.7.0")
implementation("io.papermc.paperweight.userdev", "io.papermc.paperweight.userdev.gradle.plugin", "1.7.1")

implementation("org.ow2.asm", "asm", "9.7")
implementation("org.ow2.asm", "asm-tree", "9.7")
Expand Down
4 changes: 2 additions & 2 deletions buildSrc/src/main/kotlin/CompilationConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ fun Project.configureCompilation() {
apply<TectonicDocPlugin>()

configure<JavaPluginExtension> {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}

tasks.withType<JavaCompile> {
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/DependencyConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fun Project.configureDependencies() {
maven("https://repo.codemc.org/repository/maven-public") {
name = "CodeMC"
}
maven("https://papermc.io/repo/repository/maven-public/") {
maven("https://repo.papermc.io/repository/maven-public/") {
name = "PaperMC"
}
maven("https://files.minecraftforge.net/maven/") {
Expand Down
6 changes: 3 additions & 3 deletions buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ object Versions {

object Bukkit {
const val minecraft = "1.20.6"
const val paperBuild = "$minecraft-R0.1-20240501.172135-12"
const val paperBuild = "$minecraft-R0.1-20240602.222958-107"
const val paper = paperBuild
const val paperLib = "1.0.8"
const val reflectionRemapper = "0.1.1"
const val paperDevBundle = paperBuild
const val paperDevBundle = "$minecraft-R0.1-20240601.143523-105"
const val runPaper = "2.3.0"
const val paperWeight = "1.7.0"
const val paperWeight = "1.7.1"
}

//
Expand Down
2 changes: 1 addition & 1 deletion platforms/bukkit/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ repositories {

dependencies {
shaded(project(":platforms:bukkit:common"))
shaded(project(":platforms:bukkit:nms:v1_20_R3", configuration = "reobf"))
shaded(project(":platforms:bukkit:nms:v1_20_R6", configuration = "reobf"))
shaded("xyz.jpenilla", "reflection-remapper", Versions.Bukkit.reflectionRemapper)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public BukkitWorldHandle() {
String entityID = id.toUpperCase(Locale.ROOT).substring(10);

return new BukkitEntityType(switch(entityID) {
case "END_CRYSTAL" -> org.bukkit.entity.EntityType.ENDER_CRYSTAL;
case "END_CRYSTAL" -> org.bukkit.entity.EntityType.END_CRYSTAL;
case "ENDER_CRYSTAL" -> throw new IllegalArgumentException(
"Invalid entity identifier " + id); // make sure this issue can't happen the other way around.
default -> org.bukkit.entity.EntityType.valueOf(entityID);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package com.dfsek.terra.bukkit.nms;

import org.bukkit.Bukkit;
import com.dfsek.terra.bukkit.util.VersionUtil;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.dfsek.terra.bukkit.PlatformImpl;


public interface Initializer {
String NMS = Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3];
String NMS = VersionUtil.getMinecraftVersionInfo().toString().replace(".", "_");
String TERRA_PACKAGE = Initializer.class.getPackageName();

static boolean init(PlatformImpl platform) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@ public boolean isSpigot() {
public static final class MinecraftVersionInfo {
private static final Logger logger = LoggerFactory.getLogger(MinecraftVersionInfo.class);

private static final Pattern VERSION_PATTERN = Pattern.compile("v?(\\d+)_(\\d+)_R(\\d+)");
private static final Pattern VERSION_PATTERN = Pattern.compile("(\\d+)\\.(\\d+)\\.(\\d+)");
private final int major;
private final int minor;
private final int patch;

private MinecraftVersionInfo() {
this(Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3]);
this(Bukkit.getServer().getBukkitVersion().split("-")[0]);
}

private MinecraftVersionInfo(int major, int minor, int patch) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.dfsek.terra.bukkit.nms.v1_20_R3;
package com.dfsek.terra.bukkit.nms.v1_20_6;

import com.google.common.collect.ImmutableMap;
import com.mojang.serialization.Lifecycle;
import net.minecraft.core.Holder;
import net.minecraft.core.Holder.Reference;
import net.minecraft.core.MappedRegistry;
import net.minecraft.core.RegistrationInfo;
import net.minecraft.core.WritableRegistry;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceKey;
Expand Down Expand Up @@ -49,7 +49,7 @@ public static void registerBiomes(ConfigRegistry configRegistry) {
new ResourceLocation("terra", NMSBiomeInjector.createBiomeID(pack, key))
);

Reference<Biome> holder = biomeRegistry.register(delegateKey, platform, Lifecycle.stable());
Reference<Biome> holder = biomeRegistry.register(delegateKey, platform, RegistrationInfo.BUILT_IN);
Reflection.REFERENCE.invokeBindValue(holder, platform); // IMPORTANT: bind holder.

platformBiome.getContext().put(new NMSBiomeInfo(delegateKey));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.dfsek.terra.bukkit.nms.v1_20_R3;
package com.dfsek.terra.bukkit.nms.v1_20_6;

import net.minecraft.resources.ResourceKey;
import net.minecraft.world.level.biome.Biome;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.dfsek.terra.bukkit.nms.v1_20_R3;
package com.dfsek.terra.bukkit.nms.v1_20_6;

import net.minecraft.core.Holder;
import net.minecraft.core.Registry;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.dfsek.terra.bukkit.nms.v1_20_R3;
package com.dfsek.terra.bukkit.nms.v1_20_6;

import com.mojang.serialization.Codec;
import com.mojang.serialization.MapCodec;
import net.minecraft.core.Holder;
import net.minecraft.core.Registry;
import net.minecraft.world.level.biome.Biome;
Expand Down Expand Up @@ -35,8 +35,12 @@ protected Stream<Holder<Biome>> collectPossibleBiomes() {
}

@Override
protected @NotNull Codec<? extends BiomeSource> codec() {
return BiomeSource.CODEC;
protected @NotNull MapCodec<? extends BiomeSource> codec() {
return MapCodec.assumeMapUnsafe(BiomeSource.CODEC);
// return MapCodec.unit(null);
// BuiltInRegistries.BIOME_SOURCE.byNameCodec().dispatchMap(this::codec, Function.identity());
// BuiltInRegistries.BIOME_SOURCE.byNameCodec().dispatchStable(BiomeSource::codec, Function.identity());
// return BiomeSource.CODEC;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.dfsek.terra.bukkit.nms.v1_20_R3;
package com.dfsek.terra.bukkit.nms.v1_20_6;

import com.mojang.serialization.Codec;
import com.mojang.serialization.MapCodec;
import net.minecraft.core.BlockPos;
import net.minecraft.server.level.WorldGenRegion;
import net.minecraft.world.level.LevelAccessor;
Expand All @@ -19,7 +19,7 @@
import net.minecraft.world.level.levelgen.Heightmap.Types;
import net.minecraft.world.level.levelgen.RandomState;
import net.minecraft.world.level.levelgen.blending.Blender;
import org.bukkit.craftbukkit.v1_20_R3.block.data.CraftBlockData;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -54,8 +54,8 @@ public NMSChunkGeneratorDelegate(ChunkGenerator vanilla, ConfigPack pack, NMSBio
}

@Override
protected @NotNull Codec<? extends ChunkGenerator> codec() {
return ChunkGenerator.CODEC;
protected @NotNull MapCodec<? extends ChunkGenerator> codec() {
return MapCodec.assumeMapUnsafe(ChunkGenerator.CODEC);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.dfsek.terra.bukkit.nms.v1_20_R3;
package com.dfsek.terra.bukkit.nms.v1_20_6;

import org.bukkit.Bukkit;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.dfsek.terra.bukkit.nms.v1_20_R3;
package com.dfsek.terra.bukkit.nms.v1_20_6;

import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.chunk.ChunkGenerator;
import org.bukkit.World;
import org.bukkit.craftbukkit.v1_20_R3.CraftWorld;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.world.WorldInitEvent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.dfsek.terra.bukkit.nms.v1_20_R3;
package com.dfsek.terra.bukkit.nms.v1_20_6;

import net.minecraft.world.level.LevelHeightAccessor;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.dfsek.terra.bukkit.nms.v1_20_R3;
package com.dfsek.terra.bukkit.nms.v1_20_6;

import net.minecraft.core.Holder;
import net.minecraft.core.Holder.Reference;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.dfsek.terra.bukkit.nms.v1_20_R3;
package com.dfsek.terra.bukkit.nms.v1_20_6;

import net.minecraft.core.Registry;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceKey;
import net.minecraft.server.dedicated.DedicatedServer;
import net.minecraft.world.level.biome.Biome;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_20_R3.CraftServer;
import org.bukkit.craftbukkit.CraftServer;


public class RegistryFetcher {
Expand Down

0 comments on commit 8d01059

Please sign in to comment.