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:
shedaniel
2021-12-08 22:13:12 +08:00
parent 7d745d612c
commit 7857615bfc
23 changed files with 78 additions and 152 deletions

View File

@@ -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);
}

View File

@@ -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));
}

View File

@@ -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;
}
}

View File

@@ -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

View File

@@ -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();
}
}

View File

@@ -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

View File

@@ -0,0 +1,3 @@
{
"accessWidener": "architectury-common.accessWidener"
}