Fixed datapack reload listeners

This commit is contained in:
simibubi 2020-10-20 19:37:30 +02:00
parent e1c3853264
commit 275d8cf7b6
2 changed files with 4 additions and 19 deletions

View file

@ -32,13 +32,10 @@ import com.simibubi.create.foundation.utility.AnimationTickHolder;
import com.simibubi.create.foundation.utility.ServerSpeedProvider; import com.simibubi.create.foundation.utility.ServerSpeedProvider;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.client.renderer.ActiveRenderInfo; import net.minecraft.client.renderer.ActiveRenderInfo;
import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.entity.Pose;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.vector.Vector3d; import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -71,13 +68,6 @@ public class ClientEvents {
if (!isGameActive()) if (!isGameActive())
return; return;
ClientPlayerEntity player = Minecraft.getInstance().player;
AxisAlignedBB bb = player.getBoundingBox(Pose.CROUCHING).shrink(1.0E-7D);
// Stream<VoxelShape> 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.schematicSender.tick();
CreateClient.schematicAndQuillHandler.tick(); CreateClient.schematicAndQuillHandler.tick();
CreateClient.schematicHandler.tick(); CreateClient.schematicHandler.tick();

View file

@ -14,10 +14,9 @@ import com.simibubi.create.foundation.utility.recipe.RecipeFinder;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.resources.IReloadableResourceManager;
import net.minecraft.resources.IResourceManager;
import net.minecraft.world.IWorld; import net.minecraft.world.IWorld;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.event.AddReloadListenerEvent;
import net.minecraftforge.event.AttachCapabilitiesEvent; import net.minecraftforge.event.AttachCapabilitiesEvent;
import net.minecraftforge.event.TickEvent.Phase; import net.minecraftforge.event.TickEvent.Phase;
import net.minecraftforge.event.TickEvent.ServerTickEvent; 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.event.world.WorldEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber; 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.FMLServerStartingEvent;
import net.minecraftforge.fml.event.server.FMLServerStoppingEvent; import net.minecraftforge.fml.event.server.FMLServerStoppingEvent;
@ -89,12 +87,9 @@ public class CommonEvents {
} }
@SubscribeEvent @SubscribeEvent
public static void serverAboutToStart(FMLServerAboutToStartEvent event) { public static void registerReloadListeners(AddReloadListenerEvent event) {
IResourceManager manager = event.getServer().getDataPackRegistries().getResourceManager(); event.addListener(RecipeFinder.LISTENER);
if (manager instanceof IReloadableResourceManager) { event.addListener(PotionMixingRecipeManager.LISTENER);
((IReloadableResourceManager) manager).addReloadListener(RecipeFinder.LISTENER);
((IReloadableResourceManager) manager).addReloadListener(PotionMixingRecipeManager.LISTENER);
}
} }
@SubscribeEvent @SubscribeEvent