mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-20 04:09:51 +00:00
Update to 1.18.2
Co-authored-by: sciwhiz12 <[email protected]> Co-authored-by: Marc Hermans <[email protected]> Co-authored-by: LexManos <[email protected]> Co-authored-by: Curle <[email protected]> Signed-off-by: SizableShrimp <[email protected]>
This commit is contained in:
1 parent
34291c1fb2
commit
425eff39ff
234 files changed
+2175
-3226
No files matched your search
@@ -6,8 +6,8 @@
|
||||
package net.minecraftforge.event;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.profiling.ProfilerFiller;
|
||||
import net.minecraft.server.ServerResources;
|
||||
import net.minecraft.server.packs.resources.PreparableReloadListener;
|
||||
import net.minecraft.server.packs.resources.ResourceManager;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
@@ -22,7 +22,7 @@ import java.util.concurrent.Executor;
|
||||
import net.minecraft.server.packs.resources.PreparableReloadListener.PreparationBarrier;
|
||||
|
||||
/**
|
||||
* The main ResourceManager is recreated on each reload, through {@link ServerResources}'s creation.
|
||||
* The main ResourceManager is recreated on each reload, through {@link MinecraftServer.ReloadableResources}'s creation.
|
||||
*
|
||||
* The event is fired on each reload and lets modders add their own ReloadListeners, for server-side resources.
|
||||
* The event is fired on the {@link MinecraftForge#EVENT_BUS}
|
||||
@@ -30,30 +30,34 @@ import net.minecraft.server.packs.resources.PreparableReloadListener.Preparation
|
||||
public class AddReloadListenerEvent extends Event
|
||||
{
|
||||
private final List<PreparableReloadListener> listeners = new ArrayList<>();
|
||||
private final ServerResources dataPackRegistries;
|
||||
|
||||
public AddReloadListenerEvent(ServerResources dataPackRegistries)
|
||||
/*
|
||||
private final MinecraftServer.ReloadableResources dataPackRegistries;
|
||||
|
||||
public AddReloadListenerEvent(MinecraftServer.ReloadableResources dataPackRegistries)
|
||||
{
|
||||
this.dataPackRegistries = dataPackRegistries;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param listener the listener to add to the ResourceManager on reload
|
||||
*/
|
||||
public void addListener(PreparableReloadListener listener)
|
||||
{
|
||||
listeners.add(new WrappedStateAwareListener(listener));
|
||||
}
|
||||
public void addListener(PreparableReloadListener listener)
|
||||
{
|
||||
listeners.add(new WrappedStateAwareListener(listener));
|
||||
}
|
||||
|
||||
public List<PreparableReloadListener> getListeners()
|
||||
{
|
||||
return ImmutableList.copyOf(listeners);
|
||||
}
|
||||
|
||||
public ServerResources getDataPackRegistries()
|
||||
public List<PreparableReloadListener> getListeners()
|
||||
{
|
||||
return ImmutableList.copyOf(listeners);
|
||||
}
|
||||
|
||||
/*
|
||||
public MinecraftServer.ReloadableResources getDataPackRegistries()
|
||||
{
|
||||
return dataPackRegistries;
|
||||
}
|
||||
*/
|
||||
private static class WrappedStateAwareListener implements PreparableReloadListener {
|
||||
private final PreparableReloadListener wrapped;
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.players.PlayerList;
|
||||
import net.minecraft.world.Container;
|
||||
import net.minecraft.world.entity.projectile.FireworkRocketEntity;
|
||||
@@ -48,7 +49,6 @@ import net.minecraft.world.item.crafting.RecipeType;
|
||||
import net.minecraft.world.level.storage.loot.LootTable;
|
||||
import net.minecraft.world.level.storage.loot.LootTables;
|
||||
import net.minecraft.server.packs.resources.PreparableReloadListener;
|
||||
import net.minecraft.server.ServerResources;
|
||||
import net.minecraft.world.level.BaseSpawner;
|
||||
import net.minecraft.world.InteractionResultHolder;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
@@ -709,9 +709,9 @@ public class ForgeEventFactory
|
||||
return event.getNewTime();
|
||||
}
|
||||
|
||||
public static List<PreparableReloadListener> onResourceReload(ServerResources dataPackRegistries)
|
||||
public static List<PreparableReloadListener> onResourceReload(/*MinecraftServer.ReloadableResources dataPackRegistries*/)
|
||||
{
|
||||
AddReloadListenerEvent event = new AddReloadListenerEvent(dataPackRegistries);
|
||||
AddReloadListenerEvent event = new AddReloadListenerEvent(/*dataPackRegistries*/);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
return event.getListeners();
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
package net.minecraftforge.event;
|
||||
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import net.minecraft.server.ServerResources;
|
||||
import net.minecraft.server.ReloadableServerResources;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
|
||||
@@ -15,7 +15,7 @@ import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
|
||||
/**
|
||||
* Commands are rebuilt whenever {@link ServerResources} is recreated.
|
||||
* Commands are rebuilt whenever {@link ReloadableServerResources} is recreated.
|
||||
* You can use this event to register your commands whenever the {@link Commands} class in constructed.
|
||||
*
|
||||
* The event is fired on the {@link MinecraftForge#EVENT_BUS}
|
||||
|
||||
@@ -5,33 +5,23 @@
|
||||
|
||||
package net.minecraftforge.event;
|
||||
|
||||
import net.minecraft.tags.TagContainer;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
|
||||
/**
|
||||
* Fired on the client when :
|
||||
* {@link TagContainer} has all of its tags synced from the server to the client (just after a client has connected).
|
||||
* The integrated server is about to be created see {@code net.minecraft.client.Minecraft#doLoadLevel}
|
||||
* Fired on the server when {@link TagContainer} has read all tags from disk, during initial load and after the reload command is used
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}
|
||||
* On the client, this event fires on the Client Thread.
|
||||
* On the server, this event may be fired on the Server Thread, or an async reloader thread.
|
||||
*/
|
||||
public class TagsUpdatedEvent extends Event
|
||||
{
|
||||
private final TagContainer manager;
|
||||
private final RegistryAccess registries;
|
||||
|
||||
public TagsUpdatedEvent(TagContainer manager)
|
||||
{
|
||||
this.manager = manager;
|
||||
}
|
||||
public TagsUpdatedEvent(RegistryAccess registries)
|
||||
{
|
||||
this.registries = registries;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The impl tag manager that has been updated with newly received tags.
|
||||
*/
|
||||
public TagContainer getTagManager()
|
||||
{
|
||||
return manager;
|
||||
}
|
||||
/**
|
||||
* @return The dynamic registries that have had their tags rebound.
|
||||
*/
|
||||
public RegistryAccess getTagManager()
|
||||
{
|
||||
return registries;
|
||||
}
|
||||
}
|
||||
@@ -43,13 +43,15 @@ public class StructureSpawnListGatherEvent extends Event
|
||||
public StructureSpawnListGatherEvent(StructureFeature<?> structure)
|
||||
{
|
||||
this.structure = structure;
|
||||
this.insideOnly = this.structure.getDefaultRestrictsSpawnsToInside();
|
||||
this.insideOnly = false;
|
||||
/*this.insideOnly = this.structure.getDefaultRestrictsSpawnsToInside();
|
||||
|
||||
for (MobCategory cat : MobCategory.values()) {
|
||||
List<SpawnerData> lst = this.structure.getDefaultSpawnList(cat);
|
||||
if (!lst.isEmpty())
|
||||
addEntitySpawns(cat, lst);
|
||||
}
|
||||
}*/
|
||||
// TODO-PATCHING: follow how StructureSpawnManager is reengineered
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user