mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-14 01:04:24 +00:00
* Bump pack.mcmeta formats * 1.19 biome modifiers * Mark ClientPlayerNetworkEvent.LoggedOutEvent's getters as nullable * Add docs and package-info to client extension interfaces package * Move RenderBlockOverlayEvent hooks to ForgeHooksClient * Add package-infos to client events package * Rename SoundLoadEvent to SoundEngineLoadEvent This reduces confusion from consumers which may think the name SoundLoadEvent refers to an individual sound being loaded rather than the sound engine. * Document and change SoundLoadEvent to fire on mod bus Previously, it fired on both the mod bus and the Forge bus, which is confusing for consumers. * Delete SoundSetupEvent Looking at its original implementation shows that there isn't an appropriate place in the new sound code to reinsert the event, and the place of 'sound engine/manager initialization event' is taken already by SoundLoadEvent. * Perform some cleanup on client events - Removed nullable annotations from ClientPlayerNetworkEvent - Renamed #getPartialTicks methods to #getPartialTick, to be consistent with vanilla's naming of the partial tick - Cleanup documentation to remove line breaks, use the spelling 'cancelled' over 'canceled', and improve docs on existing and new methods. * Remove EntityEvent.CanUpdate Closes MinecraftForge/MinecraftForge#6394 * Switch to Jetbrains nullability annotations * New PlayLevelSoundEvent; replaces old PlaySoundAtEntityEvent * Remove ForgeWorldPresetScreens * Remove IForgeRegistryEntry * Remove use of List<Throwable> in FML's CompletableFutures * Add docs to mod loading stages, stages, and phases * Gradle 7.4.2 * Use SLF4J in FMLLoader and other subprojects * Switch dynamic versions in subprojects to pinned ones * Switch ForgeRoot and MDK to FG plugin markers * Configure Forge javadoc task The task now uses a custom stylesheet with MCForge elements, and configured to combine the generation from the four FML subprojects (fmlloader, fmlcore, javafmllanguage, mclanguage) and the Forge project into the javadoc output. * Update docs/md files, for 1.19 update and the move away from IRC to Discord. * Make "Potentially dangerous alternative prefix" a debug warning, not info. Co-authored-by: Curle <curle@gemwire.uk> Co-authored-by: sciwhiz12 <arnoldnunag12@gmail.com> Signed-off-by: SizableShrimp <sizableshrimp@sizableshrimp.me>
85 lines
2.6 KiB
Java
85 lines
2.6 KiB
Java
/*
|
|
* Copyright (c) Forge Development LLC and contributors
|
|
* SPDX-License-Identifier: LGPL-2.1-only
|
|
*/
|
|
|
|
package net.minecraftforge.registries;
|
|
|
|
import com.google.common.collect.ImmutableList;
|
|
import com.google.common.collect.ImmutableSet;
|
|
import com.google.common.collect.Lists;
|
|
import com.google.common.collect.Maps;
|
|
import net.minecraft.resources.ResourceLocation;
|
|
import net.minecraftforge.eventbus.api.Event;
|
|
|
|
import java.util.Comparator;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
/**
|
|
* Called whenever the ID mapping might have changed. If you register for this event, you
|
|
* will be called back whenever the client or server loads an ID set. This includes both
|
|
* when the ID maps are loaded from disk, as well as when the ID maps revert to the initial
|
|
* state.
|
|
* <p>
|
|
* Note: you cannot change the IDs that have been allocated, but you might want to use
|
|
* this event to update caches or other in-mod artifacts that might be impacted by an ID
|
|
* change.
|
|
* <p>
|
|
* Fired on the {@link net.minecraftforge.common.MinecraftForge#EVENT_BUS forge bus}.
|
|
*/
|
|
public class IdMappingEvent extends Event
|
|
{
|
|
public static class ModRemapping
|
|
{
|
|
public final ResourceLocation registry;
|
|
public final ResourceLocation key;
|
|
public final int oldId;
|
|
public final int newId;
|
|
|
|
private ModRemapping(ResourceLocation registry, ResourceLocation key, int oldId, int newId)
|
|
{
|
|
this.registry = registry;
|
|
this.key = key;
|
|
this.oldId = oldId;
|
|
this.newId = newId;
|
|
}
|
|
}
|
|
|
|
public record IdRemapping(int currId, int newId) {}
|
|
|
|
private final Map<ResourceLocation, ImmutableList<ModRemapping>> remaps;
|
|
private final ImmutableSet<ResourceLocation> keys;
|
|
|
|
private final boolean isFrozen;
|
|
|
|
public IdMappingEvent(Map<ResourceLocation, Map<ResourceLocation, IdRemapping>> remaps, boolean isFrozen)
|
|
{
|
|
this.isFrozen = isFrozen;
|
|
this.remaps = Maps.newHashMap();
|
|
remaps.forEach((name, rm) ->
|
|
{
|
|
List<ModRemapping> tmp = Lists.newArrayList();
|
|
rm.forEach((key, value) -> tmp.add(new ModRemapping(name, key, value.currId, value.newId)));
|
|
tmp.sort(Comparator.comparingInt(o -> o.newId));
|
|
this.remaps.put(name, ImmutableList.copyOf(tmp));
|
|
});
|
|
this.keys = ImmutableSet.copyOf(this.remaps.keySet());
|
|
}
|
|
|
|
public ImmutableSet<ResourceLocation> getRegistries()
|
|
{
|
|
return this.keys;
|
|
}
|
|
|
|
public ImmutableList<ModRemapping> getRemaps(ResourceLocation registry)
|
|
{
|
|
return this.remaps.get(registry);
|
|
}
|
|
|
|
public boolean isFrozen()
|
|
{
|
|
return isFrozen;
|
|
}
|
|
}
|