net.minecraft.resource.ResourcePack Java Examples

The following examples show how to use net.minecraft.resource.ResourcePack. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ExistingFileHelper.java    From patchwork-api with GNU Lesser General Public License v2.1 5 votes vote down vote up
public ExistingFileHelper(Collection<Path> existingPacks, boolean enable) {
	this.clientResources = new ReloadableResourceManagerImpl(ResourceType.CLIENT_RESOURCES, Thread.currentThread());
	this.serverData = new ReloadableResourceManagerImpl(ResourceType.SERVER_DATA, Thread.currentThread());
	this.clientResources.addPack(new DefaultResourcePack("minecraft", "realms"));
	this.serverData.addPack(new DefaultResourcePack("minecraft"));

	for (Path existing : existingPacks) {
		File file = existing.toFile();
		ResourcePack pack = file.isDirectory() ? new DirectoryResourcePack(file) : new ZipResourcePack(file);
		this.clientResources.addPack(pack);
		this.serverData.addPack(pack);
	}

	this.enable = enable;
}
 
Example #2
Source File: MixinMinecraftClient.java    From Sandbox with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void addonResourcePackModifications(List<ResourcePack> packs) {
    if (SandboxClient.INSTANCE != null) {
        SandboxClient.INSTANCE.loader.getAddons().forEach(spec -> {
            try {
                Path path = Paths.get(spec.getPath().toURI());
                if (Files.isDirectory(path))
                    packs.add(new AddonFolderResourcePack(path, spec));
                else
                    packs.add(new AddonResourcePack(path.toFile()));
            } catch (URISyntaxException e) {
                e.printStackTrace();
            }
        });
    }
}
 
Example #3
Source File: MixinReloadableResourceManagerImpl.java    From multiconnect with MIT License 4 votes vote down vote up
@Inject(method = "beginMonitoredReload", at = @At("HEAD"))
private void onResourceReload(Executor prepareExecutor, Executor applyExecutor, CompletableFuture<Unit> initialStage, List<ResourcePack> packs, CallbackInfoReturnable<ResourceReloadMonitor> ci) {
    ConnectionInfo.startReloadingResources();
    ProtocolRegistry.latest().setup(true);
}
 
Example #4
Source File: OptifineZipResourcePack.java    From OptiFabric with Mozilla Public License 2.0 4 votes vote down vote up
public static Supplier<ResourcePack> getSupplier(File file) {
	return () -> new OptifineZipResourcePack(file);
}
 
Example #5
Source File: MixinMinecraftClient.java    From Sandbox with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Redirect(method = "reloadResources", at = @At(value = "INVOKE", target = "Lnet/minecraft/resource/ReloadableResourceManager;beginMonitoredReload(Ljava/util/concurrent/Executor;Ljava/util/concurrent/Executor;Ljava/util/concurrent/CompletableFuture;Ljava/util/List;)Lnet/minecraft/resource/ResourceReloadMonitor;"))
public ResourceReloadMonitor reloadResources(ReloadableResourceManager manager, Executor var1, Executor var2, CompletableFuture<Unit> var3, List<ResourcePack> var4) {
    addonResourcePackModifications(var4);
    System.out.println(var4);
    return manager.beginMonitoredReload(var1, var2, var3, var4);
}