Update to 21w19a and require java 16 for compilation

Signed-off-by: shedaniel <daniel@shedaniel.me>
This commit is contained in:
shedaniel
2021-05-14 19:45:58 +08:00
parent d2952b0462
commit 2956355ce7
14 changed files with 34 additions and 49 deletions

View File

@@ -15,10 +15,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up JDK 1.8
- name: Set up JDK 16
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 16
- name: Upload to Maven
run: ./gradlew publish curseforgePublish --stacktrace
if: |

View File

@@ -15,10 +15,10 @@ jobs:
steps:
- uses: actions/checkout@v1
- name: Set up JDK 1.8
- name: Set up JDK 16
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 16
- name: Upload to Maven
run: ./gradlew publish --stacktrace
if: |

View File

@@ -1,6 +1,6 @@
plugins {
id "architectury-plugin" version "3.1-SNAPSHOT"
id "forgified-fabric-loom" version "0.6-SNAPSHOT" apply false
id "dev.architectury.loom" version "0.7.2-SNAPSHOT" apply false
id "org.cadixdev.licenser" version "0.5.0"
id "com.matthewprenger.cursegradle" version "1.4.0" apply false
id "maven-publish"
@@ -11,7 +11,7 @@ architectury {
}
subprojects {
apply plugin: "forgified-fabric-loom"
apply plugin: "dev.architectury.loom"
loom {
silentMojangMappingsLicense()

View File

@@ -34,12 +34,8 @@ import java.util.function.Function;
public final class BlockEntityRenderers {
private BlockEntityRenderers() {}
public static <T extends BlockEntity> void registerRenderer(BlockEntityType<T> type, Function<BlockEntityRenderDispatcher, BlockEntityRenderer<? super T>> provider) {
registerRenderer(type, (BlockEntityRendererProvider.Context context) -> provider.apply(context.getBlockEntityRenderDispatcher()));
}
@ExpectPlatform
public static <T extends BlockEntity> void registerRenderer(BlockEntityType<T> type, BlockEntityRendererProvider<T> provider) {
public static <T extends BlockEntity> void registerRenderer(BlockEntityType<T> type, BlockEntityRendererProvider<? super T> provider) {
throw new AssertionError();
}
}

View File

@@ -19,9 +19,9 @@
package me.shedaniel.architectury.registry;
import com.google.common.base.Suppliers;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.LazyLoadedValue;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
@@ -44,23 +44,8 @@ public class DeferredRegister<T> {
}
public static <T> DeferredRegister<T> create(String modId, ResourceKey<net.minecraft.core.Registry<T>> key) {
LazyLoadedValue<Registries> value = new LazyLoadedValue<>(() -> Registries.get(modId));
return new DeferredRegister<>(value::get, key, Objects.requireNonNull(modId));
}
@Deprecated
public static <T> DeferredRegister<T> create(Registries registries, ResourceKey<net.minecraft.core.Registry<T>> key) {
return new DeferredRegister<>(() -> registries, key, null);
}
@Deprecated
public static <T> DeferredRegister<T> create(Supplier<Registries> registries, ResourceKey<net.minecraft.core.Registry<T>> key) {
return new DeferredRegister<>(registries, key, null);
}
@Deprecated
public static <T> DeferredRegister<T> create(LazyLoadedValue<Registries> registries, ResourceKey<net.minecraft.core.Registry<T>> key) {
return create(registries::get, key);
Supplier<Registries> value = Suppliers.memoize(() -> Registries.get(modId));
return new DeferredRegister<>(value, key, Objects.requireNonNull(modId));
}
public <R extends T> RegistrySupplier<R> register(String id, Supplier<? extends R> supplier) {
@@ -96,27 +81,27 @@ public class DeferredRegister<T> {
private final ResourceLocation id;
private final Supplier<R> supplier;
private RegistrySupplier<R> value;
public Entry(ResourceLocation id, Supplier<R> supplier) {
this.id = id;
this.supplier = supplier;
}
@Override
public ResourceLocation getRegistryId() {
return key.location();
}
@Override
public ResourceLocation getId() {
return id;
}
@Override
public boolean isPresent() {
return value != null && value.isPresent();
}
@Override
public R get() {
if (isPresent()) {
@@ -124,12 +109,12 @@ public class DeferredRegister<T> {
}
throw new NullPointerException("Registry Object not present: " + this.id);
}
@Override
public int hashCode() {
return com.google.common.base.Objects.hashCode(getRegistryId(), getId());
}
@Override
public boolean equals(Object obj) {
if (this == obj) return true;
@@ -137,7 +122,7 @@ public class DeferredRegister<T> {
RegistrySupplier<?> other = (RegistrySupplier<?>) obj;
return other.getRegistryId().equals(getRegistryId()) && other.getId().equals(getId());
}
@Override
public String toString() {
return getRegistryId().toString() + "@" + id.toString();

View File

@@ -20,6 +20,7 @@
package me.shedaniel.architectury.registry.fabric;
import com.google.common.base.Objects;
import com.google.common.base.Suppliers;
import me.shedaniel.architectury.core.RegistryEntry;
import me.shedaniel.architectury.registry.Registries;
import me.shedaniel.architectury.registry.Registry;
@@ -32,7 +33,6 @@ import net.fabricmc.fabric.api.event.registry.RegistryAttribute;
import net.minecraft.core.MappedRegistry;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.LazyLoadedValue;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -112,7 +112,7 @@ public class RegistriesImpl {
@Override
public @NotNull RegistrySupplier<T> delegateSupplied(ResourceLocation id) {
LazyLoadedValue<T> value = new LazyLoadedValue<>(() -> get(id));
Supplier<T> value = Suppliers.memoize(() -> get(id));
return new RegistrySupplier<T>() {
@Override
public @NotNull ResourceLocation getRegistryId() {

View File

@@ -1 +1 @@
loom.forge=true
loom.platform=forge

View File

@@ -20,6 +20,7 @@
package me.shedaniel.architectury.registry.forge;
import com.google.common.base.Objects;
import com.google.common.base.Suppliers;
import com.google.common.collect.HashBasedTable;
import com.google.common.collect.Table;
import me.shedaniel.architectury.core.RegistryEntry;
@@ -32,7 +33,6 @@ import me.shedaniel.architectury.registry.registries.RegistryOption;
import me.shedaniel.architectury.registry.registries.StandardRegistryOption;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.LazyLoadedValue;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.eventbus.api.SubscribeEvent;
@@ -157,7 +157,7 @@ public class RegistriesImpl {
@Override
public @NotNull RegistrySupplier<T> delegateSupplied(ResourceLocation id) {
LazyLoadedValue<T> value = new LazyLoadedValue<>(() -> get(id));
Supplier<T> value = Suppliers.memoize(() -> get(id));
return new RegistrySupplier<T>() {
@Override
public @NotNull ResourceLocation getRegistryId() {
@@ -274,7 +274,7 @@ public class RegistriesImpl {
@Override
public @NotNull RegistrySupplier<T> delegateSupplied(ResourceLocation id) {
LazyLoadedValue<T> value = new LazyLoadedValue<>(() -> get(id));
Supplier<T> value = Suppliers.memoize(() -> get(id));
return new RegistrySupplier<T>() {
@Override
public @NotNull ResourceLocation getRegistryId() {

View File

@@ -12,7 +12,7 @@ base_version=2.0
maven_group=me.shedaniel
fabric_loader_version=0.11.3
fabric_api_version=0.34.0+1.17
fabric_api_version=0.34.4+1.17
mod_menu_version=2.0.0-beta.4
#forge_version=36.0.42

View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@@ -7,6 +7,10 @@ pluginManagement {
}
}
if (JavaVersion.current().ordinal() + 1 < 16) {
throw new IllegalStateException("Please run gradle with Java 16+!")
}
include("common")
include("fabric")
//include("forge")

View File

@@ -3,7 +3,7 @@ dependencies {
mappings loom.officialMojangMappings()
// We depend on fabric loader here to use the fabric @Environment annotations
// Do NOT use other classes from fabric loader
modCompile "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
implementation project(":common")
}

View File

@@ -11,8 +11,8 @@ architectury {
dependencies {
minecraft "com.mojang:minecraft:${rootProject.architectury.minecraft}"
mappings loom.officialMojangMappings()
modCompile "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
modCompile "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}"
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
modApi "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}"
implementation project(path: ":fabric", configuration: "dev")
implementation(project(path: ":common")) {

View File

@@ -1 +1 @@
loom.forge=true
loom.platform=forge