mirror of
https://github.com/TeamMidnightDust/CullLeaves.git
synced 2025-12-17 06:35:10 +01:00
port: The Copper Age (1.21.9/10)
This commit is contained in:
@@ -37,7 +37,7 @@ dependencies {
|
||||
// Remove the next line if you don't want to depend on the API
|
||||
//modApi "dev.architectury:architectury-forge:${rootProject.architectury_version}"
|
||||
modImplementation "maven.modrinth:midnightlib:${rootProject.midnightlib_version}-neoforge"
|
||||
modImplementation "maven.modrinth:sodium:${rootProject.sodium_version}-neoforge"
|
||||
modCompileOnlyApi "maven.modrinth:sodium:${rootProject.sodium_version}-neoforge"
|
||||
//include "maven.modrinth:midnightlib:${rootProject.midnightlib_version}-forge"
|
||||
|
||||
common(project(path: ":common", configuration: "namedElements")) { transitive false }
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package eu.midnightdust.cullleaves.neoforge;
|
||||
|
||||
import eu.midnightdust.cullleaves.CullLeavesClient;
|
||||
import net.minecraft.network.packet.PacketType;
|
||||
import net.minecraft.resource.*;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Identifier;
|
||||
@@ -10,31 +11,19 @@ import net.neoforged.fml.ModList;
|
||||
import net.neoforged.fml.common.EventBusSubscriber;
|
||||
import net.neoforged.neoforge.client.event.AddClientReloadListenersEvent;
|
||||
import net.neoforged.neoforge.event.AddPackFindersEvent;
|
||||
import net.neoforged.neoforge.resource.ResourcePackLoader;
|
||||
import net.neoforged.neoforgespi.locating.IModFile;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@EventBusSubscriber(modid = CullLeavesClient.MOD_ID, bus = EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
|
||||
@EventBusSubscriber(modid = CullLeavesClient.MOD_ID, value = Dist.CLIENT)
|
||||
public class CullLeavesClientEvents {
|
||||
@SubscribeEvent
|
||||
public static void addPackFinders(AddPackFindersEvent event) {
|
||||
if (event.getPackType() == ResourceType.CLIENT_RESOURCES) {
|
||||
registerResourcePack(event, Identifier.of(CullLeavesClient.MOD_ID, "smartleaves"), false);
|
||||
event.addPackFinders(Identifier.of(CullLeavesClient.MOD_ID, "resourcepacks/smartleaves"), ResourceType.CLIENT_RESOURCES, Text.of("cullleaves/smartleaves"), ResourcePackSource.BUILTIN, false, ResourcePackProfile.InsertionPosition.TOP);
|
||||
}
|
||||
}
|
||||
private static void registerResourcePack(AddPackFindersEvent event, Identifier id, boolean alwaysEnabled) {
|
||||
event.addRepositorySource(((profileAdder) -> {
|
||||
IModFile file = ModList.get().getModFileById(id.getNamespace()).getFile();
|
||||
try {
|
||||
ResourcePackProfile.PackFactory pack = new DirectoryResourcePack.DirectoryBackedFactory(file.findResource("resourcepacks/" + id.getPath()));
|
||||
ResourcePackInfo info = new ResourcePackInfo(id.toString(), Text.of(id.getNamespace()+"/"+id.getPath()), ResourcePackSource.BUILTIN, Optional.empty());
|
||||
ResourcePackProfile packProfile = ResourcePackProfile.create(info, pack, ResourceType.CLIENT_RESOURCES, new ResourcePackPosition(alwaysEnabled, ResourcePackProfile.InsertionPosition.TOP, false));
|
||||
if (packProfile != null) {
|
||||
profileAdder.accept(packProfile);
|
||||
}
|
||||
} catch (NullPointerException e) {e.fillInStackTrace();}
|
||||
}));
|
||||
}
|
||||
@SubscribeEvent
|
||||
public static void onResourceReload(AddClientReloadListenersEvent event) {
|
||||
event.addListener(Identifier.of(CullLeavesClient.MOD_ID, "resourcepack_options"), CullLeavesClient.ReloadListener.INSTANCE);
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
package eu.midnightdust.cullleaves.neoforge;
|
||||
|
||||
import eu.midnightdust.cullleaves.CullLeavesClient;
|
||||
import eu.midnightdust.cullleaves.config.CullLeavesConfig;
|
||||
import eu.midnightdust.lib.config.MidnightConfig;
|
||||
import net.neoforged.fml.common.Mod;
|
||||
|
||||
@Mod("cullleaves")
|
||||
@Mod(CullLeavesClient.MOD_ID)
|
||||
public class CullLeavesClientForge {
|
||||
public CullLeavesClientForge() {
|
||||
MidnightConfig.init("cullleaves", CullLeavesConfig.class);
|
||||
MidnightConfig.init(CullLeavesClient.MOD_ID, CullLeavesConfig.class);
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,7 @@ public class MixinSodiumGameOptionPages {
|
||||
groups.add(OptionGroup.createBuilder()
|
||||
.add(OptionImpl.createBuilder(boolean.class, sodiumOpts)
|
||||
.setName(Text.translatable("cullleaves.midnightconfig.enabled"))
|
||||
.setTooltip(Text.translatable("cullleaves.midnightconfig.enabled.tooltip.sodium"))
|
||||
.setTooltip(Text.translatable("cullleaves.midnightconfig.enabled.tooltip"))
|
||||
.setControl(TickBoxControl::new)
|
||||
.setBinding((opts, value) -> {
|
||||
CullLeavesConfig.enabled = value;
|
||||
@@ -39,7 +39,7 @@ public class MixinSodiumGameOptionPages {
|
||||
.build()
|
||||
).add(OptionImpl.createBuilder(boolean.class, sodiumOpts)
|
||||
.setName(Text.translatable("cullleaves.midnightconfig.cullRoots"))
|
||||
.setTooltip(Text.translatable("cullleaves.midnightconfig.cullRoots.tooltip.sodium"))
|
||||
.setTooltip(Text.translatable("cullleaves.midnightconfig.cullRoots.tooltip"))
|
||||
.setControl(TickBoxControl::new)
|
||||
.setBinding((opts, value) -> {
|
||||
CullLeavesConfig.cullRoots = value;
|
||||
|
||||
Reference in New Issue
Block a user