From 275d8cf7b6f4660c6afd607e37c9177dc2b6d8f5 Mon Sep 17 00:00:00 2001 From: simibubi <31564874+simibubi@users.noreply.github.com> Date: Tue, 20 Oct 2020 19:37:30 +0200 Subject: [PATCH] Fixed datapack reload listeners --- .../com/simibubi/create/events/ClientEvents.java | 10 ---------- .../com/simibubi/create/events/CommonEvents.java | 13 ++++--------- 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/simibubi/create/events/ClientEvents.java b/src/main/java/com/simibubi/create/events/ClientEvents.java index d11636847..a1818a4fb 100644 --- a/src/main/java/com/simibubi/create/events/ClientEvents.java +++ b/src/main/java/com/simibubi/create/events/ClientEvents.java @@ -32,13 +32,10 @@ import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.ServerSpeedProvider; import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.player.ClientPlayerEntity; import net.minecraft.client.renderer.ActiveRenderInfo; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.texture.OverlayTexture; -import net.minecraft.entity.Pose; import net.minecraft.item.ItemStack; -import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.vector.Vector3d; import net.minecraft.util.text.ITextComponent; import net.minecraft.world.World; @@ -71,13 +68,6 @@ public class ClientEvents { if (!isGameActive()) return; - ClientPlayerEntity player = Minecraft.getInstance().player; - AxisAlignedBB bb = player.getBoundingBox(Pose.CROUCHING).shrink(1.0E-7D); -// Stream blockCollisions = world.getBlockCollisions(player, bb); -// Debug.debugChat(blockCollisions.count() + ""); -// blockCollisions.forEach(vs -> Debug.debugChat(vs.toString())); -// Debug.debugChat("" + blockCollisions.allMatch(VoxelShape::isEmpty)); - CreateClient.schematicSender.tick(); CreateClient.schematicAndQuillHandler.tick(); CreateClient.schematicHandler.tick(); diff --git a/src/main/java/com/simibubi/create/events/CommonEvents.java b/src/main/java/com/simibubi/create/events/CommonEvents.java index 13ce09e69..e5610ff26 100644 --- a/src/main/java/com/simibubi/create/events/CommonEvents.java +++ b/src/main/java/com/simibubi/create/events/CommonEvents.java @@ -14,10 +14,9 @@ import com.simibubi.create.foundation.utility.recipe.RecipeFinder; import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; -import net.minecraft.resources.IReloadableResourceManager; -import net.minecraft.resources.IResourceManager; import net.minecraft.world.IWorld; import net.minecraft.world.World; +import net.minecraftforge.event.AddReloadListenerEvent; import net.minecraftforge.event.AttachCapabilitiesEvent; import net.minecraftforge.event.TickEvent.Phase; import net.minecraftforge.event.TickEvent.ServerTickEvent; @@ -29,7 +28,6 @@ import net.minecraftforge.event.world.ChunkEvent; import net.minecraftforge.event.world.WorldEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; -import net.minecraftforge.fml.event.server.FMLServerAboutToStartEvent; import net.minecraftforge.fml.event.server.FMLServerStartingEvent; import net.minecraftforge.fml.event.server.FMLServerStoppingEvent; @@ -89,12 +87,9 @@ public class CommonEvents { } @SubscribeEvent - public static void serverAboutToStart(FMLServerAboutToStartEvent event) { - IResourceManager manager = event.getServer().getDataPackRegistries().getResourceManager(); - if (manager instanceof IReloadableResourceManager) { - ((IReloadableResourceManager) manager).addReloadListener(RecipeFinder.LISTENER); - ((IReloadableResourceManager) manager).addReloadListener(PotionMixingRecipeManager.LISTENER); - } + public static void registerReloadListeners(AddReloadListenerEvent event) { + event.addListener(RecipeFinder.LISTENER); + event.addListener(PotionMixingRecipeManager.LISTENER); } @SubscribeEvent