Remove most deprecated features marked for removal in previous versions

Signed-off-by: Max <maxh2709@gmail.com>
This commit is contained in:
Max
2022-06-08 13:17:21 +02:00
parent 5b42f8d2dd
commit c870ccab83
22 changed files with 18 additions and 655 deletions

View File

@@ -1,37 +0,0 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021, 2022 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;
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

@@ -19,7 +19,6 @@
package dev.architectury.hooks.block;
import com.google.common.collect.ImmutableSet;
import com.mojang.datafixers.types.Type;
import dev.architectury.injectables.annotations.ExpectPlatform;
import net.minecraft.core.BlockPos;
@@ -27,7 +26,6 @@ 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;
@@ -36,15 +34,6 @@ 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));
}
public static class TypeBuilder<T extends BlockEntity> {
private final Constructor<? extends T> constructor;
private final Set<Block> validBlocks;

View File

@@ -19,16 +19,11 @@
package dev.architectury.hooks.item.tool;
import com.google.common.collect.ImmutableMap;
import com.mojang.datafixers.util.Pair;
import dev.architectury.injectables.annotations.ExpectPlatform;
import net.minecraft.world.item.HoeItem;
import net.minecraft.world.item.context.UseOnContext;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import org.jetbrains.annotations.ApiStatus;
import java.util.HashMap;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Predicate;
@@ -37,30 +32,6 @@ public final class HoeItemHooks {
private HoeItemHooks() {
}
/**
* Adds a new tilling (interact with hoe) interaction to the game.<p>
*
* Tilling uses a predicate/consumer pair system:
* <ul>
* <li>First, the game tests the context using the predicate.</li>
* <li>Then, if the predicate returns {@code true}, the game will, <em>on the server side only</em>,
* invoke the action and then damage the hoe item by 1.</li>
* <li>Otherwise, no action will be invoked.</li>
* </ul>
*
* @param input input block
* @param predicate context predicate
* @param action action to run
*/
@Deprecated(forRemoval = true)
@ApiStatus.ScheduledForRemoval
public static void addTillable(Block input, Predicate<UseOnContext> predicate, Consumer<UseOnContext> action) {
if (HoeItem.TILLABLES instanceof ImmutableMap) {
HoeItem.TILLABLES = new HashMap<>(HoeItem.TILLABLES);
}
HoeItem.TILLABLES.put(input, new Pair<>(predicate, action));
}
/**
* Adds a new tilling action.
*

View File

@@ -20,11 +20,8 @@
package dev.architectury.hooks.level;
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 {
private ExplosionHooks() {
@@ -34,32 +31,4 @@ public final class ExplosionHooks {
public static Vec3 getPosition(Explosion explosion) {
throw new AssertionError();
}
/**
* @deprecated Use the field directly.
*/
@Nullable
@Deprecated
@ApiStatus.ScheduledForRemoval
public static Entity getSource(Explosion explosion) {
return explosion.source;
}
/**
* @deprecated Use the field directly.
*/
@Deprecated
@ApiStatus.ScheduledForRemoval
public static float getRadius(Explosion explosion) {
return explosion.radius;
}
/**
* @deprecated Use the field directly.
*/
@Deprecated
@ApiStatus.ScheduledForRemoval
public static void setRadius(Explosion explosion, float radius) {
explosion.radius = radius;
}
}

View File

@@ -19,26 +19,15 @@
package dev.architectury.hooks.level.entity;
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() {
}
/**
* @deprecated Use the field directly.
*/
@Deprecated
@ApiStatus.ScheduledForRemoval
public static String getEncodeId(Entity entity) {
return entity.getEncodeId();
}
@Nullable
public static Entity fromCollision(CollisionContext ctx) {
return ctx instanceof EntityCollisionContext ? ((EntityCollisionContext) ctx).getEntity() : null;

View File

@@ -21,8 +21,6 @@ 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() {
@@ -32,13 +30,4 @@ public final class PlayerHooks {
public static boolean isFake(Player player) {
throw new AssertionError();
}
/**
* @deprecated Use the method directly.
*/
@Deprecated
@ApiStatus.ScheduledForRemoval
public static void closeContainer(Player player) {
player.closeContainer();
}
}

View File

@@ -1,66 +0,0 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021, 2022 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.registry.block;
import dev.architectury.injectables.annotations.ExpectPlatform;
import net.minecraft.world.item.DyeColor;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.level.material.MaterialColor;
import org.jetbrains.annotations.ApiStatus;
import java.util.function.Function;
@Deprecated
@ApiStatus.ScheduledForRemoval
public abstract class BlockProperties extends BlockBehaviour.Properties implements BlockPropertiesExtension {
public BlockProperties(Material material, Function<BlockState, MaterialColor> function) {
super(material, function);
}
public static BlockProperties of(Material material) {
return of(material, material.getColor());
}
public static BlockProperties of(Material material, DyeColor color) {
return of(material, color.getMaterialColor());
}
@ExpectPlatform
public static BlockProperties of(Material material, MaterialColor color) {
throw new AssertionError();
}
@ExpectPlatform
public static BlockProperties of(Material material, Function<BlockState, MaterialColor> color) {
throw new AssertionError();
}
@ExpectPlatform
public static BlockProperties copy(BlockBehaviour block) {
throw new AssertionError();
}
@ExpectPlatform
public static BlockProperties copy(BlockBehaviour.Properties properties) {
throw new AssertionError();
}
}

View File

@@ -1,27 +0,0 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021, 2022 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.registry.block;
import org.jetbrains.annotations.ApiStatus;
@Deprecated
@ApiStatus.ScheduledForRemoval
public interface BlockPropertiesExtension {
}

View File

@@ -1,88 +0,0 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021, 2022 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.registry.level;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.level.GameRules;
import org.jetbrains.annotations.ApiStatus;
import java.util.function.BiConsumer;
/**
* A utility class for creating game rule types.
*/
public final class GameRuleFactory {
private GameRuleFactory() {
}
/**
* Creates a boolean rule type.
*
* @param defaultValue the rule's default value
* @return the created type
* @deprecated Use the method directly.
*/
@Deprecated
@ApiStatus.ScheduledForRemoval
public static GameRules.Type<GameRules.BooleanValue> createBooleanRule(boolean defaultValue) {
return GameRules.BooleanValue.create(defaultValue);
}
/**
* Creates a boolean rule type.
*
* @param defaultValue the rule's default value
* @param changedCallback a callback that is called when the rule's value is changed
* @return the created type
* @deprecated Use the method directly.
*/
@Deprecated
@ApiStatus.ScheduledForRemoval
public static GameRules.Type<GameRules.BooleanValue> createBooleanRule(boolean defaultValue, BiConsumer<MinecraftServer, GameRules.BooleanValue> changedCallback) {
return GameRules.BooleanValue.create(defaultValue, changedCallback);
}
/**
* Creates an integer rule type.
*
* @param defaultValue the rule's default value
* @return the created type
* @deprecated Use the method directly.
*/
@Deprecated
@ApiStatus.ScheduledForRemoval
public static GameRules.Type<GameRules.IntegerValue> createIntRule(int defaultValue) {
return GameRules.IntegerValue.create(defaultValue);
}
/**
* Creates an integer rule type.
*
* @param defaultValue the rule's default value
* @param changedCallback a callback that is called when the rule's value is changed
* @return the created type
* @deprecated Use the method directly.
*/
@Deprecated
@ApiStatus.ScheduledForRemoval
public static GameRules.Type<GameRules.IntegerValue> createIntRule(int defaultValue, BiConsumer<MinecraftServer, GameRules.IntegerValue> changedCallback) {
return GameRules.IntegerValue.create(defaultValue, changedCallback);
}
}

View File

@@ -1,47 +0,0 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021, 2022 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.registry.level;
import net.minecraft.world.level.GameRules;
import org.jetbrains.annotations.ApiStatus;
/**
* A registry for registering game rules.
*/
public final class GameRuleRegistry {
private GameRuleRegistry() {
}
/**
* Registers a game rule.
*
* @param name the rule's name
* @param category the rule category
* @param type the type of the rule
* @param <T> the type of the rule value
* @return a key for the registered rule
* @deprecated Use the method directly.
*/
@Deprecated
@ApiStatus.ScheduledForRemoval
public static <T extends GameRules.Value<T>> GameRules.Key<T> register(String name, GameRules.Category category, GameRules.Type<T> type) {
return GameRules.register(name, category, type);
}
}

View File

@@ -1,43 +0,0 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021, 2022 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.registry.level.advancement;
import net.minecraft.advancements.CriteriaTriggers;
import net.minecraft.advancements.CriterionTrigger;
import org.jetbrains.annotations.ApiStatus;
public final class CriteriaTriggersRegistry {
private CriteriaTriggersRegistry() {
}
/**
* Invokes {@link net.minecraft.advancements.CriteriaTriggers#register(CriterionTrigger)}.
*
* @param trigger The trigger to register
* @param <T> The type of trigger
* @return The trigger registered
* @deprecated Use the method directly.
*/
@Deprecated
@ApiStatus.ScheduledForRemoval
public static <T extends CriterionTrigger<?>> T register(T trigger) {
return CriteriaTriggers.register(trigger);
}
}

View File

@@ -1,44 +0,0 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021, 2022 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.registry.level.entity;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import org.jetbrains.annotations.ApiStatus;
import java.util.function.Supplier;
@Environment(EnvType.CLIENT)
public final class EntityRendererRegistry {
private EntityRendererRegistry() {
}
/**
* @deprecated Migrate to {@link dev.architectury.registry.client.level.entity.EntityRendererRegistry}
*/
@Deprecated
@ApiStatus.ScheduledForRemoval
public static <T extends Entity> void register(Supplier<EntityType<? extends T>> type, EntityRendererProvider<T> provider) {
dev.architectury.registry.client.level.entity.EntityRendererRegistry.register(type, provider);
}
}

View File

@@ -1,52 +0,0 @@
/*
* 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 dev.architectury.utils;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.Tag;
import org.jetbrains.annotations.ApiStatus;
/**
* @deprecated Use the vanilla constants (e.g. {@link Tag#TAG_END}) instead.
*/
@Deprecated
@ApiStatus.ScheduledForRemoval
public final class NbtType {
public static final int END = 0;
public static final int BYTE = 1;
public static final int SHORT = 2;
public static final int INT = 3;
public static final int LONG = 4;
public static final int FLOAT = 5;
public static final int DOUBLE = 6;
public static final int BYTE_ARRAY = 7;
public static final int STRING = 8;
public static final int LIST = 9;
public static final int COMPOUND = 10;
public static final int INT_ARRAY = 11;
public static final int LONG_ARRAY = 12;
/**
* Any numeric value: byte, short, int, long, float, double.
*
* @see CompoundTag#contains(String, int)
*/
public static final int NUMBER = 99;
private NbtType() {
}
}