mirror of
https://github.com/architectury/architectury-api.git
synced 2026-03-28 03:56:59 -05:00
Merge remote-tracking branch 'architectury/1.18.2' into 1.19
This commit is contained in:
@@ -270,10 +270,11 @@ public class EventHandlerImplCommon {
|
||||
public static void eventLivingSpawnEvent(LivingSpawnEvent.CheckSpawn event) {
|
||||
EventResult result = EntityEvent.LIVING_CHECK_SPAWN.invoker().canSpawn(event.getEntity(), event.getLevel(), event.getX(), event.getY(), event.getZ(), event.getSpawnReason(), event.getSpawner());
|
||||
if (result.interruptsFurtherEvaluation()) {
|
||||
if (result.value() != null) {
|
||||
event.setResult(result.value() == Boolean.TRUE ? Event.Result.ALLOW : Event.Result.DENY);
|
||||
if (result.isEmpty()) {
|
||||
event.setResult(Event.Result.DEFAULT);
|
||||
} else {
|
||||
event.setResult(result.value() ? Event.Result.ALLOW : Event.Result.DENY);
|
||||
}
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ package dev.architectury.registry.forge;
|
||||
import com.google.common.collect.Lists;
|
||||
import dev.architectury.forge.ArchitecturyForge;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.packs.PackType;
|
||||
import net.minecraft.server.packs.resources.PreparableReloadListener;
|
||||
import net.minecraft.server.packs.resources.ReloadableResourceManager;
|
||||
@@ -31,13 +32,15 @@ import net.minecraftforge.event.AddReloadListenerEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@Mod.EventBusSubscriber(modid = ArchitecturyForge.MOD_ID)
|
||||
public class ReloadListenerRegistryImpl {
|
||||
private static List<PreparableReloadListener> serverDataReloadListeners = Lists.newArrayList();
|
||||
|
||||
public static void register(PackType type, PreparableReloadListener listener) {
|
||||
public static void register(PackType type, PreparableReloadListener listener, @Nullable ResourceLocation listenerId, Collection<ResourceLocation> dependencies) {
|
||||
if (type == PackType.SERVER_DATA) {
|
||||
serverDataReloadListeners.add(listener);
|
||||
} else if (type == PackType.CLIENT_RESOURCES) {
|
||||
|
||||
Reference in New Issue
Block a user