-
-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Violently commit crimes against git with the power of copy-paste
Basically a manual rebase/merge onto upstream 1.20.2—actually doing either resulted in things breaking horribly because git moment Also fixed the quilt.mod.json for the resource_loader package—it still had the old name for the ClientLoaderEventsTestMod test (formerly ClientResourceLoaderEventsTestMod)
- Loading branch information
1 parent
5da1018
commit 2020994
Showing
12 changed files
with
323 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
...urce_loader/src/main/java/org/quiltmc/qsl/resource/loader/impl/StaticResourceManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright 2023 The Quilt Project | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.quiltmc.qsl.resource.loader.impl; | ||
|
||
import java.util.List; | ||
|
||
import org.jetbrains.annotations.ApiStatus; | ||
|
||
import net.minecraft.resource.MultiPackResourceManager; | ||
import net.minecraft.resource.ResourceType; | ||
import net.minecraft.resource.pack.ResourcePack; | ||
|
||
/** | ||
* Exists primarily for determining whether a manager is involved in static resource loading or regular resource loading, | ||
* and also prevents the MultiPackResourceManager from being closed. | ||
* <p> | ||
* This is used to avoid activating certain mixins when they are not necessary. | ||
*/ | ||
@ApiStatus.Internal | ||
public class StaticResourceManager extends MultiPackResourceManager { | ||
public StaticResourceManager(ResourceType type, List<ResourcePack> packs) { | ||
super(type, packs); | ||
} | ||
|
||
/** | ||
* Forbids the StaticResourceManager instance from being closed (by throwing a RuntimeException) as a sanity check of sorts. | ||
* <p> | ||
* Ultimately, this method should never be called by consumers of the API, | ||
* as the two StaticResourceManager instances are cast to {@link net.minecraft.resource.ResourceManager} when provided, | ||
* and ResourceManager does <i>not</i> extend {@link AutoCloseable}. | ||
*/ | ||
@Override | ||
public void close() { | ||
throw new RuntimeException("StaticResourceManager instances cannot be closed!"); | ||
} | ||
} |
Oops, something went wrong.