fix proxy
This commit is contained in:
		
							
								
								
									
										16
									
								
								build.gradle
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								build.gradle
									
									
									
									
									
								
							@@ -3,7 +3,7 @@ plugins {
 | 
				
			|||||||
    id 'eclipse'
 | 
					    id 'eclipse'
 | 
				
			||||||
    id 'idea'
 | 
					    id 'idea'
 | 
				
			||||||
    id 'maven-publish'
 | 
					    id 'maven-publish'
 | 
				
			||||||
    id 'net.neoforged.gradle.userdev' version '7.0.145'
 | 
					    id 'net.neoforged.gradle.userdev' version '7.0.165'
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
version = mod_version
 | 
					version = mod_version
 | 
				
			||||||
@@ -32,7 +32,6 @@ runs {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
    server {
 | 
					    server {
 | 
				
			||||||
        systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
 | 
					        systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
 | 
				
			||||||
        programArgument '--nogui'
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    gameTestServer {
 | 
					    gameTestServer {
 | 
				
			||||||
        systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
 | 
					        systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
 | 
				
			||||||
@@ -151,14 +150,19 @@ dependencies {
 | 
				
			|||||||
    implementation "vazkii.patchouli:Patchouli:${patchouli_ver}"
 | 
					    implementation "vazkii.patchouli:Patchouli:${patchouli_ver}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    runtimeOnly "dev.xkmc:l2damagetracker:3.0.2"
 | 
					    runtimeOnly "dev.xkmc:l2damagetracker:3.0.3+2"
 | 
				
			||||||
    runtimeOnly "dev.xkmc:l2menustacker:3.0.9"
 | 
					    runtimeOnly "dev.xkmc:l2menustacker:3.0.9"
 | 
				
			||||||
    runtimeOnly "dev.xkmc:l2itemselector:3.0.7"
 | 
					    runtimeOnly "dev.xkmc:l2itemselector:3.0.8"
 | 
				
			||||||
    runtimeOnly "dev.xkmc:l2library:3.0.2"
 | 
					    runtimeOnly "dev.xkmc:l2library:3.0.2+4"
 | 
				
			||||||
    runtimeOnly "dev.xkmc:l2complements:3.0.2+3"
 | 
					    runtimeOnly "dev.xkmc:l2complements:3.0.2+7"
 | 
				
			||||||
 | 
					    runtimeOnly "dev.xkmc:l2archery:3.0.0+8"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    runtimeOnly "curse.maven:embeddium-908741:5630163"
 | 
					    runtimeOnly "curse.maven:embeddium-908741:5630163"
 | 
				
			||||||
    runtimeOnly "curse.maven:farmers-delight-398521:5566383"
 | 
					    runtimeOnly "curse.maven:farmers-delight-398521:5566383"
 | 
				
			||||||
    runtimeOnly "dev.xkmc:cuisinedelight:1.2.2"
 | 
					    runtimeOnly "dev.xkmc:cuisinedelight:1.2.2"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    implementation "curse.maven:enchantment-descriptions-250419:5760047"
 | 
				
			||||||
 | 
					    implementation "curse.maven:bookshelf-228525:5757624"
 | 
				
			||||||
 | 
					    implementation "curse.maven:prickle-1023259:5757615"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -10,7 +10,7 @@ neogradle.subsystems.parchment.mappingsVersion=2024.06.02
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
minecraft_version=1.21.1
 | 
					minecraft_version=1.21.1
 | 
				
			||||||
minecraft_version_range=[1.21.1,1.22)
 | 
					minecraft_version_range=[1.21.1,1.22)
 | 
				
			||||||
neo_version=21.1.4
 | 
					neo_version=21.1.61
 | 
				
			||||||
neo_version_range=[21.1.4,)
 | 
					neo_version_range=[21.1.4,)
 | 
				
			||||||
loader_version_range=[2,)
 | 
					loader_version_range=[2,)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -18,7 +18,7 @@ loader_version_range=[2,)
 | 
				
			|||||||
mod_id=l2core
 | 
					mod_id=l2core
 | 
				
			||||||
mod_name=L2Core
 | 
					mod_name=L2Core
 | 
				
			||||||
mod_license=LGPL-2.1
 | 
					mod_license=LGPL-2.1
 | 
				
			||||||
mod_version=3.0.7+42
 | 
					mod_version=3.0.7+45
 | 
				
			||||||
mod_group_id=dev.xkmc
 | 
					mod_group_id=dev.xkmc
 | 
				
			||||||
mod_authors=lcy0x1
 | 
					mod_authors=lcy0x1
 | 
				
			||||||
mod_description=Core Library mod for all L2 mods
 | 
					mod_description=Core Library mod for all L2 mods
 | 
				
			||||||
@@ -32,4 +32,4 @@ patchouli_ver = 1.21-87-NEOFORGE-SNAPSHOT
 | 
				
			|||||||
lljij = false
 | 
					lljij = false
 | 
				
			||||||
rootMod = false
 | 
					rootMod = false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
l2serial_ver = 3.0.9
 | 
					l2serial_ver = 3.0.9+4
 | 
				
			||||||
							
								
								
									
										
											BIN
										
									
								
								libs/l2archery-3.0.0+8-sources.jar
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								libs/l2archery-3.0.0+8-sources.jar
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								libs/l2archery-3.0.0+8.jar
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								libs/l2archery-3.0.0+8.jar
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								libs/l2damagetracker-3.0.3+2-sources.jar
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								libs/l2damagetracker-3.0.3+2-sources.jar
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								libs/l2damagetracker-3.0.3+2.jar
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								libs/l2damagetracker-3.0.3+2.jar
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								libs/l2modularblocks-3.0.0+4-sources.jar
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								libs/l2modularblocks-3.0.0+4-sources.jar
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								libs/l2modularblocks-3.0.0+4.jar
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								libs/l2modularblocks-3.0.0+4.jar
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							@@ -61,7 +61,7 @@ public class ClientEventHandler {
 | 
				
			|||||||
		for (int i = 0; i < n; i++) {
 | 
							for (int i = 0; i < n; i++) {
 | 
				
			||||||
			Component comp = list.get(i);
 | 
								Component comp = list.get(i);
 | 
				
			||||||
			Component lit;
 | 
								Component lit;
 | 
				
			||||||
			if (comp.getContents() instanceof PlainTextContents.LiteralContents txt && comp.getSiblings().size() == 1) {
 | 
								if (comp.getContents() instanceof PlainTextContents txt && !comp.getSiblings().isEmpty()) {
 | 
				
			||||||
				comp = comp.getSiblings().getFirst();
 | 
									comp = comp.getSiblings().getFirst();
 | 
				
			||||||
				lit = Component.literal(txt.text());
 | 
									lit = Component.literal(txt.text());
 | 
				
			||||||
			} else lit = Component.empty();
 | 
								} else lit = Component.empty();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,7 @@
 | 
				
			|||||||
package dev.xkmc.l2core.init.reg.registrate;
 | 
					package dev.xkmc.l2core.init.reg.registrate;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import dev.xkmc.l2serial.util.Wrappers;
 | 
					import dev.xkmc.l2serial.util.Wrappers;
 | 
				
			||||||
 | 
					import net.minecraft.core.Holder;
 | 
				
			||||||
import net.minecraft.network.chat.Component;
 | 
					import net.minecraft.network.chat.Component;
 | 
				
			||||||
import net.minecraft.network.chat.MutableComponent;
 | 
					import net.minecraft.network.chat.MutableComponent;
 | 
				
			||||||
import net.minecraft.resources.ResourceLocation;
 | 
					import net.minecraft.resources.ResourceLocation;
 | 
				
			||||||
@@ -46,4 +47,8 @@ public class NamedEntry<T extends NamedEntry<T>> {
 | 
				
			|||||||
		return Wrappers.cast(this);
 | 
							return Wrappers.cast(this);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						public Holder<T> holder() {
 | 
				
			||||||
 | 
							return registry.get().wrapAsHolder(getThis());
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,6 +7,7 @@ import net.minecraft.server.MinecraftServer;
 | 
				
			|||||||
import net.minecraft.world.entity.player.Player;
 | 
					import net.minecraft.world.entity.player.Player;
 | 
				
			||||||
import net.minecraft.world.level.Level;
 | 
					import net.minecraft.world.level.Level;
 | 
				
			||||||
import net.neoforged.api.distmarker.Dist;
 | 
					import net.neoforged.api.distmarker.Dist;
 | 
				
			||||||
 | 
					import net.neoforged.api.distmarker.OnlyIn;
 | 
				
			||||||
import net.neoforged.fml.loading.FMLEnvironment;
 | 
					import net.neoforged.fml.loading.FMLEnvironment;
 | 
				
			||||||
import net.neoforged.neoforge.server.ServerLifecycleHooks;
 | 
					import net.neoforged.neoforge.server.ServerLifecycleHooks;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -23,21 +24,6 @@ public class Proxy {
 | 
				
			|||||||
		return null;
 | 
							return null;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@Nullable
 | 
					 | 
				
			||||||
	public static RegistryAccess getRegistryAccess() {
 | 
					 | 
				
			||||||
		if (FMLEnvironment.dist == Dist.CLIENT) {
 | 
					 | 
				
			||||||
			var level = Minecraft.getInstance().level;
 | 
					 | 
				
			||||||
			if (level != null) {
 | 
					 | 
				
			||||||
				return Minecraft.getInstance().level.registryAccess();
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		var server = ServerLifecycleHooks.getCurrentServer();
 | 
					 | 
				
			||||||
		if (server != null) {
 | 
					 | 
				
			||||||
			return server.registryAccess();
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		return null;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Nullable
 | 
						@Nullable
 | 
				
			||||||
	public static Level getLevel() {
 | 
						public static Level getLevel() {
 | 
				
			||||||
		if (FMLEnvironment.dist == Dist.CLIENT) {
 | 
							if (FMLEnvironment.dist == Dist.CLIENT) {
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										28
									
								
								src/main/java/dev/xkmc/l2core/util/ServerProxy.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								src/main/java/dev/xkmc/l2core/util/ServerProxy.java
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,28 @@
 | 
				
			|||||||
 | 
					package dev.xkmc.l2core.util;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import net.minecraft.core.RegistryAccess;
 | 
				
			||||||
 | 
					import net.minecraft.world.level.Level;
 | 
				
			||||||
 | 
					import net.neoforged.api.distmarker.Dist;
 | 
				
			||||||
 | 
					import net.neoforged.fml.loading.FMLEnvironment;
 | 
				
			||||||
 | 
					import net.neoforged.neoforge.server.ServerLifecycleHooks;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import javax.annotation.Nullable;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class ServerProxy {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						@Nullable
 | 
				
			||||||
 | 
						public static RegistryAccess getRegistryAccess() {
 | 
				
			||||||
 | 
							if (FMLEnvironment.dist == Dist.CLIENT) {
 | 
				
			||||||
 | 
								Level level = Proxy.getLevel();
 | 
				
			||||||
 | 
								if (level != null) {
 | 
				
			||||||
 | 
									return level.registryAccess();
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							var server = ServerLifecycleHooks.getCurrentServer();
 | 
				
			||||||
 | 
							if (server != null) {
 | 
				
			||||||
 | 
								return server.registryAccess();
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							return null;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user