diff --git a/src/main/java/net/fabricmc/fabric/entity/EntityTrackingRegistry.java b/src/main/java/net/fabricmc/fabric/entity/EntityTrackingRegistry.java index a62fd8ed7..26d299e74 100644 --- a/src/main/java/net/fabricmc/fabric/entity/EntityTrackingRegistry.java +++ b/src/main/java/net/fabricmc/fabric/entity/EntityTrackingRegistry.java @@ -19,6 +19,8 @@ package net.fabricmc.fabric.entity; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; import net.minecraft.network.Packet; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import java.util.HashMap; import java.util.Map; @@ -26,6 +28,7 @@ import java.util.function.Function; // TODO: javadocs public class EntityTrackingRegistry { + private static final Logger LOGGER = LogManager.getLogger(); public static class Entry { private final int trackingDistance; private final int updateIntervalTicks; @@ -52,7 +55,6 @@ public class EntityTrackingRegistry { public static final EntityTrackingRegistry INSTANCE = new EntityTrackingRegistry(); private final Map entries = new HashMap<>(); - private final Map> spawnPacketProviders = new HashMap<>(); private EntityTrackingRegistry() { @@ -62,13 +64,9 @@ public class EntityTrackingRegistry { return entries.get(type); } + @Deprecated public Packet createSpawnPacket(Entity entity) { - Function packetFunction = spawnPacketProviders.get(entity.getType()); - if (packetFunction != null) { - return packetFunction.apply(entity); - } else { - return null; - } + return null; } public void register(EntityType type, int trackingDistance, int updateIntervalTicks) { @@ -79,7 +77,8 @@ public class EntityTrackingRegistry { entries.put(type, new Entry(trackingDistance, updateIntervalTicks, alwaysUpdateVelocity)); } + @Deprecated public void registerSpawnPacketProvider(EntityType type, Function packetFunction) { - spawnPacketProviders.put(type, packetFunction); + LOGGER.warn("[EntityTrackingRegistry] As of 19w05a, registerSpawnPacketProvider is a no-op! Update your mod!"); } } diff --git a/src/main/java/net/fabricmc/fabric/mixin/entity/MixinEntityTrackerEntry.java b/src/main/java/net/fabricmc/fabric/mixin/entity/MixinEntityTrackerEntry.java deleted file mode 100644 index 8c705e365..000000000 --- a/src/main/java/net/fabricmc/fabric/mixin/entity/MixinEntityTrackerEntry.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2016, 2017, 2018 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 net.fabricmc.fabric.mixin.entity; - -import net.fabricmc.fabric.entity.EntityTrackingRegistry; -import net.minecraft.entity.Entity; -import net.minecraft.network.Packet; -import net.minecraft.server.network.EntityTrackerEntry; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -@Mixin(EntityTrackerEntry.class) -public class MixinEntityTrackerEntry { - @Shadow - private Entity entity; - - @Inject(at = @At(value = "CONSTANT", args = {"stringValue=Don't know how to add "}), method = "createSpawnPacket", cancellable = true) - public void createSpawnPacket(CallbackInfoReturnable info) { - Packet packet = EntityTrackingRegistry.INSTANCE.createSpawnPacket(entity); - if (packet != null) { - info.setReturnValue(packet); - info.cancel(); - } - } -}