mirror of
https://github.com/architectury/architectury-api.git
synced 2026-03-28 03:56:59 -05:00
Remove @ScheduledForRemoval
This commit is contained in:
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* This file is part of architectury.
|
||||
* Copyright (C) 2020, 2021 shedaniel
|
||||
*
|
||||
* 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 me.shedaniel.architectury;
|
||||
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Please migrate to {@link me.shedaniel.architectury.annotations.ExpectPlatform}.
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.METHOD)
|
||||
@Deprecated
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.0")
|
||||
public @interface ExpectPlatform {
|
||||
}
|
||||
@@ -41,8 +41,6 @@ public final class EventHandler {
|
||||
registerCommon();
|
||||
if (Platform.getEnvironment() == Env.SERVER)
|
||||
registerServer();
|
||||
|
||||
registerDelegates();
|
||||
}
|
||||
|
||||
@ExpectPlatform
|
||||
@@ -61,10 +59,4 @@ public final class EventHandler {
|
||||
private static void registerServer() {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private static void registerDelegates() {
|
||||
BlockEvent.PLACE.register((EntityEvent.PLACE_BLOCK.invoker()::placeBlock));
|
||||
BlockEvent.BREAK.register((PlayerEvent.BREAK_BLOCK.invoker()::breakBlock));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,13 +45,6 @@ public interface EntityEvent {
|
||||
*/
|
||||
Event<Add> ADD = EventFactory.createInteractionResult();
|
||||
|
||||
/**
|
||||
* @deprecated use {@link BlockEvent#PLACE}
|
||||
*/
|
||||
@Deprecated
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.0")
|
||||
Event<PlaceBlock> PLACE_BLOCK = EventFactory.createInteractionResult();
|
||||
|
||||
interface LivingDeath {
|
||||
InteractionResult die(LivingEntity entity, DamageSource source);
|
||||
}
|
||||
@@ -63,8 +56,4 @@ public interface EntityEvent {
|
||||
interface Add {
|
||||
InteractionResult add(Entity entity, Level world);
|
||||
}
|
||||
|
||||
interface PlaceBlock {
|
||||
InteractionResult placeBlock(Level world, BlockPos pos, BlockState state, @Nullable Entity placer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,13 +52,6 @@ public interface PlayerEvent {
|
||||
Event<OpenMenu> OPEN_MENU = EventFactory.createLoop();
|
||||
Event<CloseMenu> CLOSE_MENU = EventFactory.createLoop();
|
||||
|
||||
/**
|
||||
* @deprecated use {@link BlockEvent#BREAK}
|
||||
*/
|
||||
@Deprecated
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.0")
|
||||
Event<BreakBlock> BREAK_BLOCK = EventFactory.createInteractionResult();
|
||||
|
||||
interface PlayerJoin {
|
||||
void join(ServerPlayer player);
|
||||
}
|
||||
@@ -103,10 +96,6 @@ public interface PlayerEvent {
|
||||
InteractionResult drop(Player player, ItemEntity entity);
|
||||
}
|
||||
|
||||
interface BreakBlock {
|
||||
InteractionResult breakBlock(Level world, BlockPos pos, BlockState state, ServerPlayer player, @Nullable IntValue xp);
|
||||
}
|
||||
|
||||
interface OpenMenu {
|
||||
void open(Player player, AbstractContainerMenu menu);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
package me.shedaniel.architectury.hooks;
|
||||
|
||||
import me.shedaniel.architectury.ExpectPlatform;
|
||||
import me.shedaniel.architectury.annotations.ExpectPlatform;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
|
||||
public class BlockEntityHooks {
|
||||
|
||||
@@ -57,18 +57,6 @@ public final class NetworkChannel {
|
||||
return new NetworkChannel(id);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.0")
|
||||
public <T> void register(NetworkManager.Side side, Class<T> type, BiConsumer<T, FriendlyByteBuf> encoder, Function<FriendlyByteBuf, T> decoder, BiConsumer<T, Supplier<PacketContext>> messageConsumer) {
|
||||
register(type, encoder, decoder, messageConsumer);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.0")
|
||||
public <T> void register(Optional<NetworkManager.Side> side, Class<T> type, BiConsumer<T, FriendlyByteBuf> encoder, Function<FriendlyByteBuf, T> decoder, BiConsumer<T, Supplier<PacketContext>> messageConsumer) {
|
||||
register(type, encoder, decoder, messageConsumer);
|
||||
}
|
||||
|
||||
public <T> void register(Class<T> type, BiConsumer<T, FriendlyByteBuf> encoder, Function<FriendlyByteBuf, T> decoder, BiConsumer<T, Supplier<PacketContext>> messageConsumer) {
|
||||
// TODO: this is pretty wasteful; add a way to specify custom or numeric ids
|
||||
String s = UUID.nameUUIDFromBytes(type.getName().getBytes(StandardCharsets.UTF_8)).toString().replace("-", "");
|
||||
@@ -92,24 +80,6 @@ public final class NetworkChannel {
|
||||
return h;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.0")
|
||||
public <T> void register(int id, Class<T> type, BiConsumer<T, FriendlyByteBuf> encoder, Function<FriendlyByteBuf, T> decoder, BiConsumer<T, Supplier<PacketContext>> messageConsumer) {
|
||||
register(type, encoder, decoder, messageConsumer);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.0")
|
||||
public <T> void register(NetworkManager.Side side, int id, Class<T> type, BiConsumer<T, FriendlyByteBuf> encoder, Function<FriendlyByteBuf, T> decoder, BiConsumer<T, Supplier<PacketContext>> messageConsumer) {
|
||||
register(type, encoder, decoder, messageConsumer);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.0")
|
||||
public <T> void register(Optional<NetworkManager.Side> side, int id, Class<T> type, BiConsumer<T, FriendlyByteBuf> encoder, Function<FriendlyByteBuf, T> decoder, BiConsumer<T, Supplier<PacketContext>> messageConsumer) {
|
||||
register(type, encoder, decoder, messageConsumer);
|
||||
}
|
||||
|
||||
public <T> Packet<?> toPacket(NetworkManager.Side side, T message) {
|
||||
MessageInfo<T> messageInfo = (MessageInfo<T>) Objects.requireNonNull(encoders.get(message.getClass()), "Unknown message type! " + message);
|
||||
FriendlyByteBuf buf = new FriendlyByteBuf(Unpooled.buffer());
|
||||
|
||||
Reference in New Issue
Block a user