Skip to content

Commit

Permalink
1.21 (#657)
Browse files Browse the repository at this point in the history
* Add 1.21 worldhandler as copy of 1.20.6

* Change version check

* Fix version parsing

* Switch to parallel builds

* Attempt cross version compatible datapack
  • Loading branch information
TylerS1066 authored Jun 30, 2024
1 parent 155a0d8 commit 57417de
Show file tree
Hide file tree
Showing 29 changed files with 584 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
build-scan-terms-of-use-agree: "yes"

- name: Build with Gradle
run: ./gradlew clean shadowJar
run: ./gradlew clean shadowJar --parallel

- name: Stage jar
run: mkdir staging && cp Movecraft/build/libs/Movecraft-all.jar staging && mv staging/Movecraft-all.jar staging/Movecraft_$GITHUB_SHA.jar
Expand Down
2 changes: 2 additions & 0 deletions Movecraft/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ java.toolchain.languageVersion = JavaLanguageVersion.of(17)
dependencies {
runtimeOnly(project(":movecraft-v1_18", "reobf"))
runtimeOnly(project(":movecraft-v1_20", "reobf"))
runtimeOnly(project(":movecraft-v1_21", "reobf"))
implementation(project(":movecraft-api"))
compileOnly("org.yaml:snakeyaml:2.0")
}
Expand All @@ -22,6 +23,7 @@ tasks.shadowJar {
include(project(":movecraft-api"))
include(project(":movecraft-v1_18"))
include(project(":movecraft-v1_20"))
include(project(":movecraft-v1_21"))
}
}

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Please check the [Wiki](https://github.com/APDevTeam/Movecraft/wiki) and [FAQ](h
## Development Environment
Building Movecraft is as easy as downloading the source code and executing the following command:
```
./gradlew clean shadowJar
./gradlew clean shadowJar --parallel
```
Compiled jars can be found in the `Movecraft/build/libs` directory.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ public abstract class WorldHandler {
public abstract void setAccessLocation(@NotNull InventoryView inventoryView, @NotNull Location location);

public static @NotNull String getPackageName(@NotNull String minecraftVersion) {
return "v1_" + minecraftVersion.substring(minecraftVersion.indexOf('.') + 1, minecraftVersion.lastIndexOf('.'));
String[] parts = minecraftVersion.split("\\.");
if (parts.length < 2)
throw new IllegalArgumentException();
return "v1_" + parts[1];
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"values" : ["white_carpet", "orange_carpet", "magenta_carpet", "light_blue_carpet", "yellow_carpet", "lime_carpet", "pink_carpet", "gray_carpet", "light_gray_carpet", "cyan_carpet", "purple_carpet", "blue_carpet", "brown_carpet", "green_carpet", "red_carpet", "black_carpet"]
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"values" : ["chest", "trapped_chest", "barrel"]
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"values" : ["white_concrete", "orange_concrete", "magenta_concrete", "light_blue_concrete", "yellow_concrete", "lime_concrete", "pink_concrete", "gray_concrete", "light_gray_concrete", "cyan_concrete", "purple_concrete", "blue_concrete", "brown_concrete", "green_concrete", "red_concrete", "black_concrete"]
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"values" : ["white_concrete_powder", "orange_concrete_powder", "magenta_concrete_powder", "light_blue_concrete_powder", "yellow_concrete_powder", "lime_concrete_powder", "pink_concrete_powder", "gray_concrete_powder", "light_gray_concrete_powder", "cyan_concrete_powder", "purple_concrete_powder", "blue_concrete_powder", "brown_concrete_powder", "green_concrete_powder", "red_concrete_powder", "black_concrete_powder"]
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"values" : ["acacia_fence_gate", "birch_fence_gate", "dark_oak_fence_gate", "jungle_fence_gate", "oak_fence_gate", "spruce_fence_gate"]
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"values" : ["#glass_panes", "#glass_blocks"]
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"values" : ["glass", "#stained_glass_blocks"]
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"values" : ["glass_pane", "#stained_glass_panes"]
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"values" : ["white_glazed_terracotta", "orange_glazed_terracotta", "magenta_glazed_terracotta", "light_blue_glazed_terracotta", "yellow_glazed_terracotta", "lime_glazed_terracotta", "pink_glazed_terracotta", "gray_glazed_terracotta", "light_gray_glazed_terracotta", "cyan_glazed_terracotta", "purple_glazed_terracotta", "blue_glazed_terracotta", "brown_glazed_terracotta", "green_glazed_terracotta", "red_glazed_terracotta", "black_glazed_terracotta"]
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"values" : ["creeper_head", "creeper_wall_head", "dragon_head", "dragon_wall_head", "player_head", "player_wall_head", "zombie_head", "zombie_wall_head"]
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"values" : ["light_weighted_pressure_plate", "heavy_weighted_pressure_plate", "#wooden_pressure_plates", "stone_pressure_plate"]
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"values" : [
"redstone_torch", "redstone_wall_torch"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"values" : [
"blast_furnace", "furnace", "smoker"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"values" : ["white_stained_glass", "orange_stained_glass", "magenta_stained_glass", "light_blue_stained_glass", "yellow_stained_glass", "lime_stained_glass", "pink_stained_glass", "gray_stained_glass", "light_gray_stained_glass", "cyan_stained_glass", "purple_stained_glass", "blue_stained_glass", "brown_stained_glass", "green_stained_glass", "red_stained_glass", "black_stained_glass"]
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"values" : ["white_stained_glass_pane", "orange_stained_glass_pane", "magenta_stained_glass_pane", "light_blue_stained_glass_pane", "yellow_stained_glass_pane", "lime_stained_glass_pane", "pink_stained_glass_pane", "gray_stained_glass_pane", "light_gray_stained_glass_pane", "cyan_stained_glass_pane", "purple_stained_glass_pane", "blue_stained_glass_pane", "brown_stained_glass_pane", "green_stained_glass_pane", "red_stained_glass_pane", "black_stained_glass_pane", "white_stained_glass_pane"]
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"values" : ["terracotta", "white_terracotta", "orange_terracotta", "magenta_terracotta", "light_blue_terracotta", "yellow_terracotta", "lime_terracotta", "pink_terracotta", "gray_terracotta", "light_gray_terracotta", "cyan_terracotta", "purple_terracotta", "blue_terracotta", "brown_terracotta", "green_terracotta", "red_terracotta", "black_terracotta"]
}

2 changes: 1 addition & 1 deletion datapack/src/main/resources/movecraft-data/pack.mcmeta
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"pack": {
"pack_format": 4,
"pack_format": 8,
"description": "A data pack providing block tags for use with movecraft"
}
}
2 changes: 2 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
rootProject.name = "movecraft-parent"
include(":movecraft-v1_18")
include(":movecraft-v1_20")
include(":movecraft-v1_21")
include(":movecraft-api")
include(":movecraft-datapack")
include(":movecraft")
project(":movecraft-v1_18").projectDir = file("v1_18")
project(":movecraft-v1_20").projectDir = file("v1_20")
project(":movecraft-v1_21").projectDir = file("v1_21")
project(":movecraft-api").projectDir = file("api")
project(":movecraft-datapack").projectDir = file("datapack")
project(":movecraft").projectDir = file("Movecraft")
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,18 @@
import net.minecraft.world.level.chunk.LevelChunkSection;
import net.minecraft.world.ticks.LevelChunkTicks;
import net.minecraft.world.ticks.ScheduledTick;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.data.BlockData;
import org.bukkit.craftbukkit.v1_18_R2.CraftWorld;
import org.bukkit.craftbukkit.v1_18_R2.block.data.CraftBlockData;
import org.bukkit.craftbukkit.v1_18_R2.inventory.CraftInventoryView;
import org.bukkit.craftbukkit.v1_18_R2.util.CraftMagicNumbers;
import org.bukkit.inventory.InventoryView;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.function.Predicate;

@SuppressWarnings("unused")
Expand All @@ -54,9 +49,9 @@ public class IWorldHandler extends WorldHandler {
private final NextTickProvider tickProvider = new NextTickProvider();

public IWorldHandler() {
String mappings = ((CraftMagicNumbers) CraftMagicNumbers.INSTANCE).getMappingsVersion();
if (!mappings.equals("eaeedbff51b16ead3170906872fda334"))
throw new IllegalStateException("Movecraft is not compatible with this version of Minecraft 1.18: " + mappings);
String version = Bukkit.getServer().getMinecraftVersion();
if (!version.equals("1.18.2"))
throw new IllegalStateException("Movecraft is not compatible with this version of Minecraft: " + version);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,18 @@
import net.minecraft.world.level.chunk.LevelChunk;
import net.minecraft.world.level.chunk.LevelChunkSection;
import net.minecraft.world.ticks.ScheduledTick;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.block.data.BlockData;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.block.data.CraftBlockData;
import org.bukkit.craftbukkit.inventory.CraftInventoryView;
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
import org.bukkit.inventory.InventoryView;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;

@SuppressWarnings("unused")
public class IWorldHandler extends WorldHandler {
Expand All @@ -51,9 +47,9 @@ public class IWorldHandler extends WorldHandler {
private final NextTickProvider tickProvider = new NextTickProvider();

public IWorldHandler() {
String mappings = ((CraftMagicNumbers) CraftMagicNumbers.INSTANCE).getMappingsVersion();
if (!mappings.equals("ee13f98a43b9c5abffdcc0bb24154460"))
throw new IllegalStateException("Movecraft is not compatible with this version of Minecraft 1.20: " + mappings);
String version = Bukkit.getServer().getMinecraftVersion();
if (!version.equals("1.20.6"))
throw new IllegalStateException("Movecraft is not compatible with this version of Minecraft: " + version);
}

@Override
Expand Down
14 changes: 14 additions & 0 deletions v1_21/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
plugins {
id("buildlogic.java-conventions")
id("io.papermc.paperweight.userdev")
}

java.toolchain.languageVersion = JavaLanguageVersion.of(21)

dependencies {
api(project(":movecraft-api"))
paperweight.paperDevBundle("1.21-R0.1-SNAPSHOT")
}

description = "Movecraft-v1_21"
paperweight.reobfArtifactConfiguration = io.papermc.paperweight.userdev.ReobfArtifactConfiguration.MOJANG_PRODUCTION
Loading

0 comments on commit 57417de

Please sign in to comment.