mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-17 11:05:40 +00:00
Forge 1.19
* 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 <[email protected]> Co-authored-by: sciwhiz12 <[email protected]> Signed-off-by: SizableShrimp <[email protected]>
This commit is contained in:
1 parent
270e778ac5
commit
4ed9117799
1485 files changed
+14960
-15446
No files matched your search
@@ -10,13 +10,11 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.OptionalInt;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.mojang.serialization.DataResult;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.HolderSet;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
@@ -25,14 +23,16 @@ import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.core.MappedRegistry;
|
||||
import net.minecraft.core.Registry;
|
||||
|
||||
import net.minecraft.util.RandomSource;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import com.mojang.serialization.Lifecycle;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
class NamespacedWrapper<T extends IForgeRegistryEntry<T>> extends MappedRegistry<T> implements ILockableRegistry, IHolderHelperHolder<T>
|
||||
class NamespacedWrapper<T> extends MappedRegistry<T> implements ILockableRegistry, IHolderHelperHolder<T>
|
||||
{
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
private final ForgeRegistry<T> delegate;
|
||||
@@ -57,16 +57,13 @@ class NamespacedWrapper<T extends IForgeRegistryEntry<T>> extends MappedRegistry
|
||||
Validate.notNull(value);
|
||||
this.elementsLifecycle = this.elementsLifecycle.add(lifecycle);
|
||||
|
||||
if (value.getRegistryName() == null)
|
||||
value.setRegistryName(key.location());
|
||||
T oldValue = get(key);
|
||||
|
||||
T oldValue = get(value.getRegistryName());
|
||||
|
||||
int realId = this.delegate.add(id, value);
|
||||
int realId = this.delegate.add(id, key.location(), value);
|
||||
if (realId != id && id != -1)
|
||||
LOGGER.warn("Registered object did not get ID it asked for. Name: {} Type: {} Expected: {} Got: {}", key, value.getRegistryType().getName(), id, realId);
|
||||
LOGGER.warn("Registered object did not get ID it asked for. Name: {} Expected: {} Got: {}", key, id, realId);
|
||||
|
||||
return this.holders.onAdded(RegistryManager.ACTIVE, realId, value, oldValue);
|
||||
return this.holders.onAdded(RegistryManager.ACTIVE, realId, key, value, oldValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -192,8 +189,8 @@ class NamespacedWrapper<T extends IForgeRegistryEntry<T>> extends MappedRegistry
|
||||
|
||||
@Override public Optional<Holder<T>> getHolder(int id) { return this.holders.getHolder(id); }
|
||||
@Override public Optional<Holder<T>> getHolder(ResourceKey<T> key) { return this.holders.getHolder(key); }
|
||||
@Override public Holder<T> getOrCreateHolder(ResourceKey<T> key) { return this.holders.getOrCreateHolder(key); }
|
||||
@Override public Optional<Holder<T>> getRandom(Random rand) { return this.holders.getRandom(rand); }
|
||||
@Override public DataResult<Holder<T>> getOrCreateHolder(ResourceKey<T> key) { return DataResult.success(this.holders.getOrCreateHolder(key)); }
|
||||
@Override public Optional<Holder<T>> getRandom(RandomSource rand) { return this.holders.getRandom(rand); }
|
||||
@Override public Stream<Holder.Reference<T>> holders() { return this.holders.holders(); }
|
||||
@Override public boolean isKnownTagName(TagKey<T> name) { return this.holders.isKnownTagName(name); }
|
||||
@Override public Stream<Pair<TagKey<T>, HolderSet.Named<T>>> getTags() { return this.holders.getTags(); }
|
||||
@@ -210,7 +207,7 @@ class NamespacedWrapper<T extends IForgeRegistryEntry<T>> extends MappedRegistry
|
||||
@Deprecated @Override public void lock(){ this.locked = true; }
|
||||
|
||||
|
||||
public static class Factory<V extends IForgeRegistryEntry<V>> implements IForgeRegistry.CreateCallback<V>, IForgeRegistry.AddCallback<V>
|
||||
public static class Factory<V> implements IForgeRegistry.CreateCallback<V>, IForgeRegistry.AddCallback<V>
|
||||
{
|
||||
public static final ResourceLocation ID = new ResourceLocation("forge", "registry_defaulted_wrapper");
|
||||
|
||||
@@ -223,9 +220,9 @@ class NamespacedWrapper<T extends IForgeRegistryEntry<T>> extends MappedRegistry
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void onAdd(IForgeRegistryInternal<V> owner, RegistryManager stage, int id, V value, V oldValue)
|
||||
public void onAdd(IForgeRegistryInternal<V> owner, RegistryManager stage, int id, ResourceKey<V> key, V value, V oldValue)
|
||||
{
|
||||
owner.getSlaveMap(ID, NamespacedWrapper.class).holders.onAdded(stage, id, value, oldValue);
|
||||
owner.getSlaveMap(ID, NamespacedWrapper.class).holders.onAdded(stage, id, key, value, oldValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user