use of net.minecraft.server.packs.resources.ResourceManagerReloadListener in project Beyond-Earth by MrScautHD.
the class AlienTrade method addReloadListener.
@SubscribeEvent
public static void addReloadListener(AddReloadListenerEvent event) {
if (event.getServerResources() != null) {
RecipeManager recipeManager = event.getServerResources().getRecipeManager();
event.addListener(new ResourceManagerReloadListener() {
@Override
public void onResourceManagerReload(ResourceManager resourceManager) {
AlienTrade.registerTrades(recipeManager);
}
});
}
}
use of net.minecraft.server.packs.resources.ResourceManagerReloadListener in project Applied-Energistics-2 by AppliedEnergistics.
the class StyleManagerTest method testInitialize.
@Test
void testInitialize() throws IOException {
ReloadableResourceManager resourceManager = MockResourceManager.create();
StyleManager.initialize(resourceManager);
verify(resourceManager).registerReloadListener(reloadCaptor.capture());
assertThat(reloadCaptor.getValue()).isNotNull().isInstanceOf(ResourceManagerReloadListener.class);
((ResourceManagerReloadListener) reloadCaptor.getValue()).onResourceManagerReload(resourceManager);
}
use of net.minecraft.server.packs.resources.ResourceManagerReloadListener in project Beyond-Earth by MrScautHD.
the class AlienTrade method addReloadListener.
public static void addReloadListener(AddReloadListenerEvent event) {
if (event.getServerResources() != null) {
RecipeManager recipeManager = event.getServerResources().getRecipeManager();
event.addListener(new ResourceManagerReloadListener() {
@Override
public void onResourceManagerReload(ResourceManager resourceManager) {
AlienTrade.registerTrades(recipeManager);
}
});
}
}
use of net.minecraft.server.packs.resources.ResourceManagerReloadListener in project ModernUI by BloCamLimb.
the class ModernUITextMC method init.
public static void init() {
FMLJavaModLoadingContext.get().getModEventBus().register(ModernUITextMC.class);
FMLPaths.getOrCreateGameRelativePath(FMLPaths.CONFIGDIR.get().resolve(ModernUI.NAME_CPT), ModernUI.NAME_CPT);
ModContainer mod = ModLoadingContext.get().getActiveContainer();
ForgeConfigSpec.Builder builder = new ForgeConfigSpec.Builder();
CONFIG = new Config(builder);
CONFIG_SPEC = builder.build();
mod.addConfig(new ModConfig(ModConfig.Type.CLIENT, CONFIG_SPEC, mod, ModernUI.NAME_CPT + "/text.toml"));
FMLJavaModLoadingContext.get().getModEventBus().addListener(CONFIG::reload);
if (!DatagenModLoader.isRunningDataGen()) {
((ReloadableResourceManager) Minecraft.getInstance().getResourceManager()).registerReloadListener((ResourceManagerReloadListener) (manager) -> TextLayoutEngine.getInstance().reload());
}
}
Aggregations