Skip to content

Commit

Permalink
Update to 1.20.4 and to fabric api 0.96.4
Browse files Browse the repository at this point in the history
  • Loading branch information
OroArmor committed Mar 15, 2024
2 parents fa98cde + 95a1372 commit 6692316
Show file tree
Hide file tree
Showing 265 changed files with 5,627 additions and 1,142 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ classes/
# Debug artifacts
run
*.log
*.log.gz

# Windows
*.db
Expand Down
33 changes: 21 additions & 12 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,26 @@ plugins {
id "idea"
id "maven-publish"
id 'jacoco'
id "org.quiltmc.loom" version "1.4.1" apply false
id "org.quiltmc.loom" version "1.5.3" apply false
id "dev.yumi.gradle.licenser" version "1.0.+"
id "com.diffplug.spotless" version "6.20.0"
id "org.ajoberstar.grgit" version "3.1.0"
id "me.modmuss50.remotesign" version "0.4.0" apply false
id "io.github.p03w.machete" version "2.0.1"
id "me.modmuss50.mod-publish-plugin" version "0.4.0"
id "me.modmuss50.mod-publish-plugin" version "0.4.5"
}

def ENV = System.getenv()

version = "$project.version+${ENV.GITHUB_RUN_NUMBER ? '' : 'local-'}$project.upstream_version-${getBranch()}${ENV.SNAPSHOTS_URL ? '-SNAPSHOT' : ''}"
logger.lifecycle("Building Quilted Fabric API: $version")

def metaProjects = [
'deprecated',
'fabric-api-bom',
'fabric-api-catalog'
]

import net.fabricmc.loom.util.gradle.SourceSetHelper
import java.util.stream.Collectors
import groovy.json.JsonSlurper
Expand Down Expand Up @@ -131,7 +137,7 @@ allprojects {
setupRepositories(repositories)
}

if (it.name == "deprecated") {
if (metaProjects.contains(it.name)) {
return
}

Expand All @@ -151,6 +157,9 @@ allprojects {

loom {
splitEnvironmentSourceSets()
mixin {
useLegacyMixinAp = true
}
}

sourceSets {
Expand Down Expand Up @@ -199,7 +208,7 @@ allprojects {
}

allprojects.each { p ->
if (project.name == "deprecated") {
if (metaProjects.contains(project.name)) {
return
}

Expand Down Expand Up @@ -250,7 +259,7 @@ allprojects {
inputs.property "version", project.version
inputs.property "upstream_version", project.upstream_version

filesMatching(["fabric.mod.json", "quilt.mod.json"]) {
filesMatching(["quilt.mod.json", "quilt.mod.json"]) {
expand "version": project.version, "upstream_version": project.upstream_version
}
}
Expand Down Expand Up @@ -326,7 +335,7 @@ remapTestmodJar {
def testModJarTasks = []

subprojects {
if (it.name == "deprecated" || !(it.file("src/testmod").exists() || it.file("src/testmodClient").exists())) {
if (metaProjects.contains(it.name) || !(it.file("src/testmod").exists() || it.file("src/testmodClient").exists())) {
return
}

Expand Down Expand Up @@ -367,7 +376,7 @@ javadoc {
}

allprojects.each {
if (it.name == "deprecated") {
if (metaProjects.contains(it.name)) {
return
}

Expand Down Expand Up @@ -543,7 +552,7 @@ def addPomMetadataInformation(Project project, MavenPom pom) {
}

subprojects {
if (it.name == 'deprecated') {
if (metaProjects.contains(it.name)) {
return
}

Expand Down Expand Up @@ -635,7 +644,7 @@ publishing {
}
subprojects.each {
// The maven BOM containing all of the deprecated modules is added manually below.
if (it.path.startsWith(":deprecated")) {
if (it.path.startsWith(":deprecated") || metaProjects.contains(it.name)) {
return
}

Expand Down Expand Up @@ -690,7 +699,7 @@ void setupRepositories(RepositoryHandler repositories) {
}

subprojects.each {
if (it.name == "deprecated") {
if (metaProjects.contains(it.name)) {
return
}

Expand All @@ -714,7 +723,7 @@ dependencies {
include "$it.moduleGroup:$it.moduleName:$it.moduleVersion"
}
subprojects.each {
if (it.name == "deprecated") {
if (metaProjects.contains(it.name)) {
return
}

Expand Down Expand Up @@ -748,7 +757,7 @@ java.util.stream.Stream<ResolvedDependency> getAllQslModules() {
remapJar {
afterEvaluate {
subprojects.each {
if (it.name in devOnlyModules || it.name == "deprecated") {
if (it.name in devOnlyModules || metaProjects.contains(it.name)) {
return
}

Expand Down
7 changes: 7 additions & 0 deletions crowdin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
files:
- source: fabric-resource-loader-v0/src/main/resources/assets/fabric-resource-loader-v0/lang/en_us.json
translation: /fabric-resource-loader-v0/src/main/resources/assets/fabric-resource-loader-v0/lang/%locale_with_underscore%.json
- source: fabric-item-group-api-v1/src/main/resources/assets/fabric/lang/en_us.json
translation: /fabric-item-group-api-v1/src/main/resources/assets/fabric/lang/%locale_with_underscore%.json
- source: fabric-registry-sync-v0/src/main/resources/assets/fabric-registry-sync-v0/lang/en_us.json
translation: /fabric-registry-sync-v0/src/main/resources/assets/fabric-registry-sync-v0/lang/%locale_with_underscore%.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.Drawable;
import net.minecraft.client.gui.screen.GameMenuScreen;
import net.minecraft.client.gui.screen.LevelLoadingScreen;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen;
import net.minecraft.client.gui.screen.ingame.InventoryScreen;
import net.minecraft.client.gui.screen.world.LevelLoadingScreen;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.gui.widget.ClickableWidget;
import net.minecraft.client.gui.widget.CyclingButtonWidget;
Expand Down
31 changes: 31 additions & 0 deletions fabric-api-bom/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
plugins {
id 'java-platform'
}

version = rootProject.version

publishing.publications {
register('mavenJava', MavenPublication) {
from(components['javaPlatform'])
}
}

tasks.withType(GenerateModuleMetadata) {
// todo: RemoteSignJar fails when this is false (as set by parent build script)
enabled = true
}

dependencies {
constraints {
for (proj in rootProject.allprojects) {
if (proj == project) { // the bom itself
continue
}
if (proj.name == 'fabric-api-catalog') {
continue
}

api(project(proj.path))
}
}
}
57 changes: 57 additions & 0 deletions fabric-api-catalog/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
plugins {
id 'version-catalog'
}

version = rootProject.version

publishing.publications {
register('mavenJava', MavenPublication) {
from components.versionCatalog
}
}

tasks.withType(GenerateModuleMetadata) {
// todo: RemoteSignJar fails when this is false (as set by parent build script)
enabled = true
}

// Avoid configuration ordering issues by creating the catalog entries during task execution time
tasks.register('configureCatalog') {
doFirst {
doConfigureCatalog()
}
}
tasks.named('generateCatalogAsToml') {
dependsOn('configureCatalog')
}

def doConfigureCatalog() {
for (proj in rootProject.allprojects) {
if (proj == project) { // the catalog itself
continue
}

String catalogName = proj.name
if (catalogName == 'fabric-api-base') {
catalogName = 'base'
} else if (catalogName == 'fabric-api-bom') {
catalogName = 'bom'
} else if (catalogName == 'deprecated') {
catalogName = 'deprecated-fabric-api'
} else if (catalogName == 'fabric-api') {
catalogName = 'fabric-api'
} else {
catalogName = catalogName.substring('fabric-'.length())
}

if (proj.parent != null && proj.parent.name == 'deprecated') {
catalogName = 'deprecated-' + catalogName
}

catalog {
versionCatalog {
library(catalogName, "net.fabricmc.fabric-api:${proj.name}:${proj.version}")
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -154,17 +154,17 @@ public void registerForBlockEntities(BlockEntityApiProvider<A, C> provider, Bloc
throw new IllegalArgumentException("Must register at least one BlockEntityType instance with a BlockEntityApiProvider.");
}

BlockApiProvider<A, C> nullCheckedProvider = (world, pos, state, blockEntity, context) -> {
if (blockEntity == null) {
return null;
} else {
return provider.find(blockEntity, context);
}
};

for (BlockEntityType<?> blockEntityType : blockEntityTypes) {
Objects.requireNonNull(blockEntityType, "Encountered null block entity type while registering a block entity API provider mapping.");

BlockApiProvider<A, C> nullCheckedProvider = (world, pos, state, blockEntity, context) -> {
if (blockEntity == null || blockEntity.getType() != blockEntityType) {
return null;
} else {
return provider.find(blockEntity, context);
}
};

Block[] blocks = ((BlockEntityTypeAccessor) blockEntityType).getBlocks().toArray(new Block[0]);
registerForBlocks(nullCheckedProvider, blocks);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package net.fabricmc.fabric.test.lookup;

import com.mojang.serialization.MapCodec;
import org.jetbrains.annotations.Nullable;

import net.minecraft.block.BlockState;
Expand All @@ -32,6 +33,11 @@ public ChuteBlock(Settings settings) {
super(settings);
}

@Override
protected MapCodec<? extends BlockWithEntity> getCodec() {
throw new UnsupportedOperationException("not implemented yet");
}

@Nullable
@Override
public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package net.fabricmc.fabric.test.lookup;

import com.mojang.serialization.MapCodec;
import org.jetbrains.annotations.Nullable;

import net.minecraft.block.BlockState;
Expand All @@ -29,6 +30,11 @@ public CobbleGenBlock(Settings settings) {
super(settings);
}

@Override
protected MapCodec<? extends BlockWithEntity> getCodec() {
throw new UnsupportedOperationException("not implemented yet");
}

@Nullable
@Override
public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +0,0 @@
/*
* Copyright 2022 The Quilt Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package net.fabricmc.fabric.mixin.biome;

import org.quiltmc.qsl.worldgen.biome.impl.modification.BiomeModificationContextImpl;
import org.spongepowered.asm.mixin.Mixin;

import net.fabricmc.fabric.api.biome.v1.BiomeModificationContext;

@Mixin(BiomeModificationContextImpl.class)
public abstract class BiomeModificationContextImplMixin implements BiomeModificationContext { }
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright (c) 2016, 2017, 2018, 2019 FabricMC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package net.fabricmc.fabric.mixin.block;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;

@Mixin(targets = "net/minecraft/world/chunk/ChunkSection$BlockStateCounter")
public class ChunkSectionBlockStateCounterMixin {
/**
* Makes Chunk Sections not have isAir = true modded blocks be replaced with AIR against their will.
* Mojang report: https://bugs.mojang.com/browse/MC-232360
*/
@Redirect(method = "accept(Lnet/minecraft/block/BlockState;I)V",
at = @At(value = "INVOKE", target = "Lnet/minecraft/block/BlockState;isAir()Z"))
private boolean modifyAirCheck(BlockState blockState) {
return blockState.isOf(Blocks.AIR) || blockState.isOf(Blocks.CAVE_AIR) || blockState.isOf(Blocks.VOID_AIR);
}
}
Loading

0 comments on commit 6692316

Please sign in to comment.