Skip to content

Commit

Permalink
1.20.6 partial port (#372)
Browse files Browse the repository at this point in the history
This contains a ton of half-ported modules, but due to our difficulties porting we're releasing a version that only contains `qsl_base`, so that we can publish QFAPI. A blog post explaining more will be written and released soon.

Co-authored-by: Eli Orona <[email protected]>
Co-authored-by: moehreag <[email protected]>
  • Loading branch information
3 people authored Jun 28, 2024
1 parent 1f42bb8 commit acac1ac
Show file tree
Hide file tree
Showing 262 changed files with 2,259 additions and 2,935 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,6 @@ $RECYCLE.BIN/

# Mac
.DS_Store

# QFAPI
qfapi/quilt
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "qfapi/fabric"]
path = qfapi/fabric
url = https://github.com/FabricMC/fabric.git
4 changes: 2 additions & 2 deletions build-logic/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ dependencies {

// Visual Studio Code needs these
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}

tasks.withType(JavaCompile).configureEach {
Expand Down
4 changes: 2 additions & 2 deletions build-logic/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[versions]
asm = "9.5"
asm = "9.7"
indra_git = "3.1.2"
yumi_gradle_licenser = "1.0.+"
quilt_parsers = "0.2.1"
quilt_loom = "1.5.7"
quilt_loom = "1.7.3"

[libraries]
asm = { module = "org.ow2.asm:asm", version.ref = "asm" }
Expand Down
1 change: 1 addition & 0 deletions build-logic/src/main/groovy/qsl.module.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ loom {
runs {
testmodClient {
client()
property("mixin.debug", "true")
source(sourceSets.testmod)
}

Expand Down
13 changes: 7 additions & 6 deletions build-logic/src/main/java/qsl/internal/Versions.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,32 +23,33 @@ public final class Versions {
/**
* The QSL version
*/
public static final String QSL_VERSION = "8.0.0-alpha.13";
// Note: Make sure this matches QFAPI's gradle.properties entry for qsl_version
public static final String QSL_VERSION = "9.0.0-alpha.1";

/**
* The target Minecraft version.
*/
public static final MinecraftVersion MINECRAFT_VERSION = new MinecraftVersion("1.20.4");
public static final MinecraftVersion MINECRAFT_VERSION = new MinecraftVersion("1.20.6");

/**
* The Minecraft versions this version of QSL is compatible with.
*/
public static final List<MinecraftVersion> COMPATIBLE_VERSIONS = versions("1.20.3");
public static final List<MinecraftVersion> COMPATIBLE_VERSIONS = versions();

/**
* The target Quilt Mappings build.
*/
public static final int MAPPINGS_BUILD = 3;
public static final int MAPPINGS_BUILD = 6;

/**
* The version of Quilt Loader to use.
*/
public static final String LOADER_VERSION = "0.23.1";
public static final String LOADER_VERSION = "0.25.0";

/**
* The target Java version.
*/
public static final int JAVA_VERSION = 17; // Minecraft is Java 17
public static final int JAVA_VERSION = 21; // Minecraft is Java 21

//region 3rd-parties libraries/mods to test
/**
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
14 changes: 7 additions & 7 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,15 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -202,11 +202,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
Expand Down
20 changes: 10 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand All @@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand Down
Empty file added library/block/DISABLE
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package org.quiltmc.qsl.block.content.registry.api.enchanting;

import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import com.mojang.serialization.MapCodec;

import net.minecraft.block.BlockState;
import net.minecraft.util.Identifier;
Expand All @@ -30,11 +30,7 @@
* @param value the boost level
*/
public record ConstantBooster(float value) implements EnchantingBooster {
public static final Codec<ConstantBooster> CODEC = RecordCodecBuilder.create(instance ->
instance.group(
Codec.FLOAT.fieldOf("value").forGetter(ConstantBooster::value)
).apply(instance, ConstantBooster::new)
);
public static final MapCodec<ConstantBooster> CODEC = Codec.FLOAT.fieldOf("value").xmap(ConstantBooster::new, ConstantBooster::value);
public static EnchantingBoosterType TYPE = EnchantingBoosters.register(new Identifier("quilt", "constant"), CODEC);

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@

import java.util.Optional;

import com.mojang.serialization.Codec;
import com.mojang.serialization.MapCodec;

/**
* A type to identify booster variations by.
*
* @param codec the codec for the booster
* @param simpleVariant the default version of the booster when only identified by the type id
*/
public record EnchantingBoosterType(Codec<? extends EnchantingBooster> codec, Optional<EnchantingBooster> simpleVariant) {}
public record EnchantingBoosterType(MapCodec<? extends EnchantingBooster> codec, Optional<EnchantingBooster> simpleVariant) {}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.mojang.datafixers.util.Either;
import com.mojang.serialization.Codec;
import com.mojang.serialization.DataResult;
import com.mojang.serialization.MapCodec;

import net.minecraft.util.Identifier;

Expand Down Expand Up @@ -83,7 +84,7 @@ public class EnchantingBoosters {
* @param codec the codec for the booster
* @return the type for the booster
*/
public static EnchantingBoosterType register(Identifier id, Codec<? extends EnchantingBooster> codec) {
public static EnchantingBoosterType register(Identifier id, MapCodec<? extends EnchantingBooster> codec) {
var type = new EnchantingBoosterType(codec, Optional.empty());
return register(id, type);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.EnchantingTableBlock;
import net.minecraft.unmapped.C_dicxqeuf;
import net.minecraft.block.FireBlock;
import net.minecraft.block.Oxidizable;
import net.minecraft.item.AxeItem;
Expand Down Expand Up @@ -137,7 +137,7 @@ private static void resetSimpleReversibleMap(BiMap<Block, Block> baseWay, BiMap<
public static float calculateBookshelfCount(World world, BlockPos pos) {
float count = 0;

for (BlockPos offset : EnchantingTableBlock.POSSIBLE_BOOKSHELF_LOCATIONS) {
for (BlockPos offset : C_dicxqeuf.field_36535) {
if (world.isAir(pos.add(offset.getX() / 2, offset.getY(), offset.getZ() / 2))) {
var blockPos = pos.add(offset);
var state = world.getBlockState(blockPos);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class BlockContentRegistriesClientInitializer implements ClientModInitial
public void onInitializeClient(ModContainer mod) {
if (Boolean.getBoolean(ENABLE_TOOLTIP_DEBUG) || QuiltLoader.isModLoaded("quilt_block_content_registry_testmod")) {
if (QuiltLoader.isModLoaded("quilt_tooltip")) {
ItemTooltipCallback.EVENT.register((stack, player, context, lines) -> {
ItemTooltipCallback.EVENT.register((stack, player, context, config, lines) -> {
Block block = Block.getBlockFromItem(stack.getItem());

BlockContentRegistries.FLATTENABLE.get(block).ifPresent(state -> lines.add(Text.literal("Flattenable block: " + state)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,26 @@

package org.quiltmc.qsl.block.content.registry.mixin;

import org.spongepowered.asm.mixin.Dynamic;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

import net.minecraft.block.BlockState;
import net.minecraft.block.EnchantingTableBlock;
import net.minecraft.unmapped.C_dicxqeuf;
import net.minecraft.registry.tag.BlockTags;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.random.RandomGenerator;
import net.minecraft.world.World;

import org.quiltmc.qsl.block.content.registry.api.BlockContentRegistries;

@Mixin(EnchantingTableBlock.class)
@Mixin(C_dicxqeuf.class)
public class EnchantingTableBlockMixin {
@Inject(method = "isValidForBookshelf", at = @At("HEAD"), cancellable = true)
@Dynamic("method_40445: isValidForBookshelf")
@Inject(method = "method_40445", at = @At("HEAD"), cancellable = true)
private static void quilt$hasEnchantmentPower(World world, BlockPos pos, BlockPos offset, CallbackInfoReturnable<Boolean> cir) {
var blockPos = pos.add(offset);
var state = world.getBlockState(blockPos);
Expand All @@ -56,7 +58,7 @@ public class EnchantingTableBlockMixin {
method = "randomDisplayTick",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/block/EnchantingTableBlock;isValidForBookshelf(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/BlockPos;)Z"
target = "Lnet/minecraft/unmapped/C_dicxqeuf;method_40445(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/BlockPos;)Z"
)
)
private boolean quilt$changeParticleChance(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public class BlockContentRegistryTest implements ModInitializer, QuiltGameTest {
@Override
public void onInitialize(ModContainer mod) {
RegistryExtensions.register(Registries.BLOCK, new Identifier(MOD_ID, "oxidizable_iron_block"),
new OxidizableBlock(Oxidizable.OxidizationLevel.UNAFFECTED, AbstractBlock.Settings.method_9630(Blocks.IRON_BLOCK)),
new OxidizableBlock(Oxidizable.OxidizationLevel.UNAFFECTED, AbstractBlock.Settings.copy(Blocks.IRON_BLOCK)),
BlockContentRegistries.OXIDIZABLE, new ReversibleBlockEntry(Blocks.IRON_BLOCK, false));

BlockContentRegistries.ENCHANTING_BOOSTERS.put(Blocks.IRON_BLOCK, new ConstantBooster(3f));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

public class AngyBlock extends BlockWithEntity {
public AngyBlock(MapColor mapColor) {
super(AbstractBlock.Settings.method_9630(Blocks.STONE).mapColor(mapColor));
super(AbstractBlock.Settings.copy(Blocks.STONE).mapColor(mapColor));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@
import net.minecraft.entity.EntityType;
import net.minecraft.feature_flags.FeatureFlag;
import net.minecraft.feature_flags.FeatureFlagBitSet;
import net.minecraft.loot.LootTable;
import net.minecraft.registry.RegistryKey;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.util.DyeColor;
import net.minecraft.util.Identifier;

import org.quiltmc.qsl.block.extensions.mixin.AbstractBlockAccessor;
import org.quiltmc.qsl.block.extensions.mixin.AbstractBlockSettingsAccessor;
Expand Down Expand Up @@ -412,7 +413,7 @@ public QuiltBlockSettings luminance(int luminance) {
* @param dropTableId the new loot table identifier
* @return {@code this} builder
*/
public QuiltBlockSettings drops(Identifier dropTableId) {
public QuiltBlockSettings drops(RegistryKey<LootTable> dropTableId) {
((AbstractBlockSettingsAccessor) this).setLootTableId(dropTableId);
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
import net.minecraft.block.piston.PistonBehavior;
import net.minecraft.entity.EntityType;
import net.minecraft.feature_flags.FeatureFlagBitSet;
import net.minecraft.loot.LootTable;
import net.minecraft.registry.RegistryKey;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.util.Identifier;

Expand Down Expand Up @@ -71,7 +73,7 @@ public interface AbstractBlockSettingsAccessor {
boolean getDynamicBounds();

@Accessor
Identifier getLootTableId();
RegistryKey<LootTable> getLootTableId();

@Accessor
boolean getOpaque();
Expand Down Expand Up @@ -140,7 +142,7 @@ public interface AbstractBlockSettingsAccessor {
void setRandomTicks(boolean ticksRandomly);

@Accessor
void setLootTableId(Identifier lootTableId);
void setLootTableId(RegistryKey<LootTable> lootTableId);

@Accessor
void setOpaque(boolean opaque);
Expand Down
Loading

0 comments on commit acac1ac

Please sign in to comment.