forked from Devan-Kerman/ARRP
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master'
- Loading branch information
Showing
9 changed files
with
136 additions
and
33 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
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
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,52 @@ | ||
package net.devtech.arrp.api; | ||
|
||
import java.util.List; | ||
|
||
import net.devtech.arrp.util.IrremovableList; | ||
|
||
import net.minecraft.resource.LifecycledResourceManagerImpl; | ||
import net.minecraft.resource.ResourcePack; | ||
import net.minecraft.resource.ResourceType; | ||
import net.minecraft.util.Util; | ||
|
||
import net.fabricmc.fabric.api.event.Event; | ||
import net.fabricmc.fabric.api.event.EventFactory; | ||
|
||
public interface SidedRRPCallback { | ||
/** | ||
* Register your resource pack at a higher priority than minecraft and mod resources, this is actually done by passing a reversed view of the | ||
* resource pack list, such that List#add will actually add to the beginning of the list instead of the end. | ||
*/ | ||
Event<SidedRRPCallback> BEFORE_VANILLA = EventFactory.createArrayBacked(SidedRRPCallback.class, r -> (type, rs) -> { | ||
IrremovableList<ResourcePack> packs = new IrremovableList<>(rs, $ -> { | ||
}); | ||
for(SidedRRPCallback callback : r) { | ||
callback.insert(type, packs); | ||
} | ||
}); | ||
|
||
/** | ||
* Register your resource pack at a lower priority than minecraft and mod resources. This is actually done by passing a view of the resource pack | ||
* list, such that List#add will add to the end of the list, after default resource packs. | ||
* | ||
* If you want to override a vanilla resource | ||
*/ | ||
Event<SidedRRPCallback> AFTER_VANILLA = EventFactory.createArrayBacked(SidedRRPCallback.class, r -> (type, rs) -> { | ||
IrremovableList<ResourcePack> packs = new IrremovableList<>(rs, $ -> { | ||
}); | ||
for(SidedRRPCallback callback : r) { | ||
callback.insert(type, packs); | ||
} | ||
}); | ||
|
||
/** | ||
* @see LifecycledResourceManagerImpl#LifecycledResourceManagerImpl(ResourceType, List) | ||
*/ | ||
void insert(ResourceType type, List<ResourcePack> resources); | ||
|
||
static Void INIT_ = Util.make(() -> { | ||
BEFORE_VANILLA.register((type, resources) -> RRPCallback.BEFORE_VANILLA.invoker().insert(resources)); | ||
AFTER_VANILLA.register((type, resources) -> RRPCallback.AFTER_VANILLA.invoker().insert(resources)); | ||
return null; | ||
}); | ||
} |
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
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
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