mirror of
https://github.com/architectury/architectury-api.git
synced 2026-03-28 03:56:59 -05:00
Migrate to transitive access wideners (#146)
* Migrate to transitive access wideners * Fix invalid AW * Bump minor version, changes to gradle buildscript Co-authored-by: Max <maxh2709@gmail.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
loom {
|
||||
accessWidenerPath = file("src/main/resources/architectury.accessWidener")
|
||||
accessWidenerPath = file("src/main/resources/architectury-common.accessWidener")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -12,20 +12,6 @@ architectury {
|
||||
common(rootProject.forgeEnabled.toBoolean())
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
remapJar {
|
||||
remapAccessWidener = false
|
||||
}
|
||||
}
|
||||
|
||||
configurations {
|
||||
dev
|
||||
}
|
||||
|
||||
artifacts {
|
||||
dev(jar)
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
mavenCommon(MavenPublication) {
|
||||
|
||||
@@ -20,11 +20,17 @@
|
||||
package dev.architectury.hooks;
|
||||
|
||||
import net.minecraft.world.level.storage.LevelResource;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
public class LevelResourceHooks {
|
||||
private LevelResourceHooks() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use the constructor directly.
|
||||
*/
|
||||
@Deprecated
|
||||
@ApiStatus.ScheduledForRemoval
|
||||
public static LevelResource create(String id) {
|
||||
return new LevelResource(id);
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Set;
|
||||
@@ -35,6 +36,11 @@ public class BlockEntityHooks {
|
||||
private BlockEntityHooks() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use the Builder from vanilla directly.
|
||||
*/
|
||||
@Deprecated
|
||||
@ApiStatus.ScheduledForRemoval
|
||||
public static <T extends BlockEntity> TypeBuilder<T> builder(Constructor<? extends T> constructor, Block... blocks) {
|
||||
return new TypeBuilder<>(constructor, ImmutableSet.copyOf(blocks));
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import dev.architectury.injectables.annotations.ExpectPlatform;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.level.Explosion;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public final class ExplosionHooks {
|
||||
@@ -34,19 +35,31 @@ public final class ExplosionHooks {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use the field directly.
|
||||
*/
|
||||
@Nullable
|
||||
@ExpectPlatform
|
||||
@Deprecated
|
||||
@ApiStatus.ScheduledForRemoval
|
||||
public static Entity getSource(Explosion explosion) {
|
||||
throw new AssertionError();
|
||||
return explosion.source;
|
||||
}
|
||||
|
||||
@ExpectPlatform
|
||||
/**
|
||||
* @deprecated Use the field directly.
|
||||
*/
|
||||
@Deprecated
|
||||
@ApiStatus.ScheduledForRemoval
|
||||
public static float getRadius(Explosion explosion) {
|
||||
throw new AssertionError();
|
||||
return explosion.radius;
|
||||
}
|
||||
|
||||
@ExpectPlatform
|
||||
/**
|
||||
* @deprecated Use the field directly.
|
||||
*/
|
||||
@Deprecated
|
||||
@ApiStatus.ScheduledForRemoval
|
||||
public static void setRadius(Explosion explosion, float radius) {
|
||||
throw new AssertionError();
|
||||
explosion.radius = radius;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,15 +23,20 @@ import dev.architectury.injectables.annotations.ExpectPlatform;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||
import net.minecraft.world.phys.shapes.EntityCollisionContext;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public final class EntityHooks {
|
||||
private EntityHooks() {
|
||||
}
|
||||
|
||||
@ExpectPlatform
|
||||
/**
|
||||
* @deprecated Use the field directly.
|
||||
*/
|
||||
@Deprecated
|
||||
@ApiStatus.ScheduledForRemoval
|
||||
public static String getEncodeId(Entity entity) {
|
||||
throw new AssertionError();
|
||||
return entity.getEncodeId();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -21,6 +21,8 @@ package dev.architectury.hooks.level.entity;
|
||||
|
||||
import dev.architectury.injectables.annotations.ExpectPlatform;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public final class PlayerHooks {
|
||||
private PlayerHooks() {
|
||||
@@ -31,8 +33,12 @@ public final class PlayerHooks {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
@ExpectPlatform
|
||||
/**
|
||||
* @deprecated Use the method directly.
|
||||
*/
|
||||
@Deprecated
|
||||
@ApiStatus.ScheduledForRemoval
|
||||
public static void closeContainer(Player player) {
|
||||
throw new AssertionError();
|
||||
player.closeContainer();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
accessWidener v1 named
|
||||
accessWidener v2 named
|
||||
accessible method net/minecraft/world/level/block/state/BlockBehaviour$Properties <init> (Lnet/minecraft/world/level/material/Material;Ljava/util/function/Function;)V
|
||||
accessible field net/minecraft/world/level/biome/Biome climateSettings Lnet/minecraft/world/level/biome/Biome$ClimateSettings;
|
||||
accessible field net/minecraft/world/level/biome/Biome biomeCategory Lnet/minecraft/world/level/biome/Biome$BiomeCategory;
|
||||
@@ -35,11 +35,17 @@ accessible field net/minecraft/world/level/biome/BiomeSpecialEffects ambientAddi
|
||||
mutable field net/minecraft/world/level/biome/BiomeSpecialEffects ambientAdditionsSettings Ljava/util/Optional;
|
||||
accessible field net/minecraft/world/level/biome/BiomeSpecialEffects backgroundMusic Ljava/util/Optional;
|
||||
mutable field net/minecraft/world/level/biome/BiomeSpecialEffects backgroundMusic Ljava/util/Optional;
|
||||
accessible method net/minecraft/world/level/storage/LevelResource <init> (Ljava/lang/String;)V
|
||||
accessible class net/minecraft/world/level/block/entity/BlockEntityType$BlockEntitySupplier
|
||||
transitive-accessible method net/minecraft/world/entity/Entity getEncodeId ()Ljava/lang/String;
|
||||
transitive-accessible method net/minecraft/world/level/storage/LevelResource <init> (Ljava/lang/String;)V
|
||||
transitive-accessible class net/minecraft/world/level/block/entity/BlockEntityType$BlockEntitySupplier
|
||||
accessible field net/minecraft/world/item/AxeItem STRIPPABLES Ljava/util/Map;
|
||||
mutable field net/minecraft/world/item/AxeItem STRIPPABLES Ljava/util/Map;
|
||||
accessible field net/minecraft/world/item/ShovelItem FLATTENABLES Ljava/util/Map;
|
||||
mutable field net/minecraft/world/item/ShovelItem FLATTENABLES Ljava/util/Map;
|
||||
accessible field net/minecraft/world/item/HoeItem TILLABLES Ljava/util/Map;
|
||||
mutable field net/minecraft/world/item/HoeItem TILLABLES Ljava/util/Map;
|
||||
transitive-accessible field net/minecraft/world/level/Explosion source Lnet/minecraft/world/entity/Entity;
|
||||
transitive-mutable field net/minecraft/world/level/Explosion source Lnet/minecraft/world/entity/Entity;
|
||||
transitive-accessible field net/minecraft/world/level/Explosion radius F
|
||||
transitive-mutable field net/minecraft/world/level/Explosion radius F
|
||||
transitive-accessible method net/minecraft/world/entity/player/Player closeContainer ()V
|
||||
3
common/src/main/resources/architectury.common.json
Normal file
3
common/src/main/resources/architectury.common.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"accessWidener": "architectury-common.accessWidener"
|
||||
}
|
||||
@@ -18,11 +18,6 @@ configurations {
|
||||
compileClasspath.extendsFrom common
|
||||
runtimeClasspath.extendsFrom common
|
||||
developmentFabric.extendsFrom common
|
||||
dev
|
||||
}
|
||||
|
||||
artifacts {
|
||||
dev(jar)
|
||||
}
|
||||
|
||||
repositories {
|
||||
@@ -34,7 +29,7 @@ dependencies {
|
||||
modImplementation "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}"
|
||||
modCompileOnly("com.terraformersmc:modmenu:${rootProject.mod_menu_version}") { transitive false }
|
||||
|
||||
common(project(path: ":common", configuration: "dev")) { transitive false }
|
||||
common(project(path: ":common", configuration: "namedElements")) { transitive false }
|
||||
shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) { transitive false }
|
||||
}
|
||||
|
||||
@@ -46,6 +41,9 @@ processResources {
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
exclude "architectury-common.accessWidener"
|
||||
exclude "architectury.common.json"
|
||||
|
||||
configurations = [project.configurations.shadowCommon]
|
||||
classifier "dev-shadow"
|
||||
}
|
||||
|
||||
@@ -25,10 +25,6 @@ import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.level.entity.EntityInLevelCallback;
|
||||
|
||||
public class EntityHooksImpl {
|
||||
public static String getEncodeId(Entity entity) {
|
||||
return entity.getEncodeId();
|
||||
}
|
||||
|
||||
public static EntityInLevelCallback wrapEntityInLevelCallback(Entity entity, EntityInLevelCallback callback) {
|
||||
if (callback == EntityInLevelCallback.NULL) return callback;
|
||||
if (callback == null) return callback;
|
||||
|
||||
@@ -25,8 +25,4 @@ public class PlayerHooksImpl {
|
||||
public static boolean isFake(Player player) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void closeContainer(Player player) {
|
||||
player.closeContainer();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
package dev.architectury.hooks.level.fabric;
|
||||
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.level.Explosion;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
@@ -28,25 +27,7 @@ public class ExplosionHooksImpl {
|
||||
return ((ExplosionExtensions) explosion).architectury_getPosition();
|
||||
}
|
||||
|
||||
public static Entity getSource(Explosion explosion) {
|
||||
return ((ExplosionExtensions) explosion).architectury_getSource();
|
||||
}
|
||||
|
||||
public static float getRadius(Explosion explosion) {
|
||||
return ((ExplosionExtensions) explosion).architectury_getRadius();
|
||||
}
|
||||
|
||||
public static void setRadius(Explosion explosion, float radius) {
|
||||
((ExplosionExtensions) explosion).architectury_setRadius(radius);
|
||||
}
|
||||
|
||||
public interface ExplosionExtensions {
|
||||
Vec3 architectury_getPosition();
|
||||
|
||||
Entity architectury_getSource();
|
||||
|
||||
float architectury_getRadius();
|
||||
|
||||
void architectury_setRadius(float v);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,14 +50,6 @@ public class MixinExplosion implements ExplosionHooksImpl.ExplosionExtensions {
|
||||
@Shadow
|
||||
@Final
|
||||
private double z;
|
||||
@Shadow
|
||||
@Final
|
||||
@Nullable
|
||||
private Entity source;
|
||||
@Shadow
|
||||
@Final
|
||||
@Mutable
|
||||
private float radius;
|
||||
@Unique
|
||||
Vec3 position;
|
||||
|
||||
@@ -74,19 +66,4 @@ public class MixinExplosion implements ExplosionHooksImpl.ExplosionExtensions {
|
||||
}
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entity architectury_getSource() {
|
||||
return source;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float architectury_getRadius() {
|
||||
return radius;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void architectury_setRadius(float v) {
|
||||
radius = v;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
accessWidener v1 named
|
||||
accessWidener v2 named
|
||||
accessible method net/minecraft/client/gui/screens/Screen addRenderableWidget (Lnet/minecraft/client/gui/components/events/GuiEventListener;)Lnet/minecraft/client/gui/components/events/GuiEventListener;
|
||||
accessible method net/minecraft/client/gui/screens/Screen addRenderableOnly (Lnet/minecraft/client/gui/components/Widget;)Lnet/minecraft/client/gui/components/Widget;
|
||||
accessible method net/minecraft/client/gui/screens/Screen addWidget (Lnet/minecraft/client/gui/components/events/GuiEventListener;)Lnet/minecraft/client/gui/components/events/GuiEventListener;
|
||||
@@ -102,3 +102,7 @@ accessible field net/minecraft/world/item/HoeItem TILLABLES Ljava/util/Map;
|
||||
mutable field net/minecraft/world/item/HoeItem TILLABLES Ljava/util/Map;
|
||||
accessible method net/minecraft/client/renderer/item/ItemProperties registerGeneric (Lnet/minecraft/resources/ResourceLocation;Lnet/minecraft/client/renderer/item/ClampedItemPropertyFunction;)Lnet/minecraft/client/renderer/item/ClampedItemPropertyFunction;
|
||||
accessible method net/minecraft/client/renderer/item/ItemProperties register (Lnet/minecraft/world/item/Item;Lnet/minecraft/resources/ResourceLocation;Lnet/minecraft/client/renderer/item/ClampedItemPropertyFunction;)V
|
||||
accessible field net/minecraft/world/level/Explosion source Lnet/minecraft/world/entity/Entity;
|
||||
mutable field net/minecraft/world/level/Explosion source Lnet/minecraft/world/entity/Entity;
|
||||
accessible field net/minecraft/world/level/Explosion radius F
|
||||
mutable field net/minecraft/world/level/Explosion radius F
|
||||
|
||||
@@ -21,17 +21,12 @@ configurations {
|
||||
compileClasspath.extendsFrom common
|
||||
runtimeClasspath.extendsFrom common
|
||||
developmentForge.extendsFrom common
|
||||
dev
|
||||
}
|
||||
|
||||
artifacts {
|
||||
dev(jar)
|
||||
}
|
||||
|
||||
dependencies {
|
||||
forge "net.minecraftforge:forge:${rootProject.architectury.minecraft}-${rootProject.forge_version}"
|
||||
|
||||
common(project(path: ":common", configuration: "dev")) { transitive false }
|
||||
common(project(path: ":common", configuration: "namedElements")) { transitive false }
|
||||
shadowCommon(project(path: ":common", configuration: "transformProductionForge")) { transitive false }
|
||||
}
|
||||
|
||||
@@ -45,6 +40,7 @@ processResources {
|
||||
shadowJar {
|
||||
exclude "fabric.mod.json"
|
||||
exclude "architectury-common.accessWidener"
|
||||
exclude "architectury.common.json"
|
||||
|
||||
configurations = [project.configurations.shadowCommon]
|
||||
classifier "dev-shadow"
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
* This file is part of architectury.
|
||||
* Copyright (C) 2020, 2021 architectury
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
package dev.architectury.hooks.level.entity.forge;
|
||||
|
||||
import net.minecraft.world.entity.Entity;
|
||||
|
||||
public class EntityHooksImpl {
|
||||
public static String getEncodeId(Entity entity) {
|
||||
return entity.getEncodeId();
|
||||
}
|
||||
}
|
||||
@@ -26,8 +26,4 @@ public class PlayerHooksImpl {
|
||||
public static boolean isFake(Player playerEntity) {
|
||||
return playerEntity instanceof FakePlayer;
|
||||
}
|
||||
|
||||
public static void closeContainer(Player playerEntity) {
|
||||
playerEntity.closeContainer();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
package dev.architectury.hooks.level.forge;
|
||||
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.level.Explosion;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
@@ -27,16 +26,4 @@ public class ExplosionHooksImpl {
|
||||
public static Vec3 getPosition(Explosion explosion) {
|
||||
return explosion.getPosition();
|
||||
}
|
||||
|
||||
public static Entity getSource(Explosion explosion) {
|
||||
return explosion.getExploder();
|
||||
}
|
||||
|
||||
public static float getRadius(Explosion explosion) {
|
||||
return explosion.radius;
|
||||
}
|
||||
|
||||
public static void setRadius(Explosion explosion, float v) {
|
||||
explosion.radius = v;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ cf_type=release
|
||||
|
||||
archives_base_name=architectury
|
||||
archives_base_name_snapshot=architectury-snapshot
|
||||
base_version=3.1
|
||||
base_version=3.2
|
||||
maven_group=dev.architectury
|
||||
|
||||
fabric_loader_version=0.12.5
|
||||
|
||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
||||
@@ -8,11 +8,3 @@ dependencies {
|
||||
architectury {
|
||||
common(rootProject.forgeEnabled.toBoolean())
|
||||
}
|
||||
|
||||
configurations {
|
||||
dev
|
||||
}
|
||||
|
||||
artifacts {
|
||||
dev(jar)
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ dependencies {
|
||||
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
|
||||
modImplementation "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}"
|
||||
|
||||
implementation project(path: ":fabric", configuration: "dev")
|
||||
common(project(path: ":common", configuration: "dev")) { transitive = false }
|
||||
common(project(path: ":testmod-common", configuration: "dev")) { transitive false }
|
||||
implementation project(path: ":fabric", configuration: "namedElements")
|
||||
common(project(path: ":common", configuration: "namedElements")) { transitive false }
|
||||
common(project(path: ":testmod-common", configuration: "namedElements")) { transitive false }
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ configurations {
|
||||
dependencies {
|
||||
forge "net.minecraftforge:forge:${gradle.rootProject.architectury.minecraft}-${rootProject.forge_version}"
|
||||
|
||||
implementation project(path: ":forge", configuration: "dev")
|
||||
common(project(path: ":common", configuration: "dev")) { transitive false }
|
||||
common(project(path: ":testmod-common", configuration: "dev")) { transitive false }
|
||||
implementation project(path: ":forge", configuration: "namedElements")
|
||||
common(project(path: ":common", configuration: "namedElements")) { transitive false }
|
||||
common(project(path: ":testmod-common", configuration: "namedElements")) { transitive false }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user