mirror of
				https://github.com/eaglerforge/EaglerForge-old.git
				synced 2025-06-05 17:20:57 -05:00 
			
		
		
		
	v1.3
This commit is contained in:
		
							parent
							
								
									fea1305b1b
								
							
						
					
					
						commit
						c9bf822287
					
				| @ -139,11 +139,12 @@ | ||||
| 
 | ||||
| ~ public class Minecraft extends ModData implements IThreadListener { | ||||
| 
 | ||||
| > CHANGE  2 : 3  @  2 : 9 | ||||
| > CHANGE  2 : 4  @  2 : 10 | ||||
| 
 | ||||
| ~ 	public static final boolean isRunningOnMac = false; | ||||
| ~ 	public static ServerData currentServerData; | ||||
| 
 | ||||
| > DELETE  12  @  12 : 14 | ||||
| > DELETE  11  @  11 : 13 | ||||
| 
 | ||||
| > INSERT  11 : 12  @  11 | ||||
| 
 | ||||
|  | ||||
| @ -105,7 +105,7 @@ | ||||
| ~ 				for (int i = 0, l = list.size(); i < l; ++i) { | ||||
| ~ 					y = list.get(i).calculateYOffset(this.getEntityBoundingBox(), y); | ||||
| 
 | ||||
| > INSERT  232 : 602  @  232 | ||||
| > INSERT  232 : 603  @  232 | ||||
| 
 | ||||
| + 	public void loadModData(BaseData data) { | ||||
| + 		posX = data.getDouble("x"); | ||||
| @ -363,6 +363,7 @@ | ||||
| + 		data.setCallbackBoolean("getAlwaysRenderNameTagForRender", () -> { | ||||
| + 			return getAlwaysRenderNameTagForRender(); | ||||
| + 		}); | ||||
| +  | ||||
| + 		data.setCallbackFloatWithDataArg("getBrightness", (BaseData params) -> { | ||||
| + 			return getBrightness(params.getFloat("var1")); | ||||
| + 		}); | ||||
|  | ||||
| @ -1,19 +1,17 @@ | ||||
| package net.eaglerforge.api; | ||||
| 
 | ||||
| import com.sun.org.apache.bcel.internal.generic.RETURN; | ||||
| import net.eaglerforge.gui.EmptyGui; | ||||
| import net.eaglerforge.gui.ModGUI; | ||||
| import net.lax1dude.eaglercraft.v1_8.EagRuntime; | ||||
| import net.lax1dude.eaglercraft.v1_8.log4j.LogManager; | ||||
| import net.lax1dude.eaglercraft.v1_8.log4j.Logger; | ||||
| import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager; | ||||
| import net.lax1dude.eaglercraft.v1_8.profile.EaglerProfile; | ||||
| import net.lax1dude.eaglercraft.v1_8.sp.SingleplayerServerController; | ||||
| import net.minecraft.client.ClientBrandRetriever; | ||||
| import net.minecraft.client.Minecraft; | ||||
| import net.minecraft.client.gui.ScaledResolution; | ||||
| import net.minecraft.entity.Entity; | ||||
| import net.minecraft.util.ChatComponentText; | ||||
| import me.otterdev.UwUAPI; | ||||
| import net.minecraft.util.EnumParticleTypes; | ||||
| import org.teavm.jso.JSBody; | ||||
| import org.teavm.jso.JSObject; | ||||
| import net.minecraft.enchantment.Enchantment; | ||||
| @ -216,7 +214,7 @@ public class ModAPI { | ||||
|         getModAPI().setCallbackInt("getFPS", () -> { | ||||
|             return getDebugFPS(); | ||||
|         }); | ||||
|         getModAPI().setCallbackVoidWithDataArg("displayParticleAtPlayer", (BaseData params) -> { | ||||
|         /*getModAPI().setCallbackVoidWithDataArg("displayParticleAtPlayer", (BaseData params) -> { | ||||
|             if (params.getString("type") == "EXPLOSION_NORMAL") { | ||||
|                 mc.effectRenderer.emitParticleAtEntity(mc.thePlayer, EnumParticleTypes.EXPLOSION_NORMAL); | ||||
|             } else if (params.getString("type") == "EXPLOSION_LARGE") { | ||||
| @ -302,7 +300,7 @@ public class ModAPI { | ||||
|             } else if (params.getString("type") == "MOB_APPEARANCE") { | ||||
|                 mc.effectRenderer.emitParticleAtEntity(mc.thePlayer, EnumParticleTypes.MOB_APPEARANCE); | ||||
|             } | ||||
|         }); | ||||
|         });*/ | ||||
|         getModAPI().set("clientBrand", ClientBrandRetriever.getClientModName()); | ||||
| 
 | ||||
|         setGlobal("enchantments", Enchantment.makeModDataStatic()); | ||||
| @ -313,9 +311,10 @@ public class ModAPI { | ||||
|         setMinecraftContext(mc); | ||||
|         setGlobal("platform", PlatformAPI.makeModData()); | ||||
|         setGlobal("logger", LoggerAPI.makeModData()); | ||||
|         setGlobal("emptygui", EmptyGui.makeModData()); | ||||
|         //setGlobal("emptygui", EmptyGui.makeModData()); | ||||
|         setGlobal("ScaledResolution", ScaledResolution.makeModData()); | ||||
|         setGlobal("GlStateManager", GlStateManager.makeModData()); | ||||
|         setGlobal("sp", SingleplayerServerController.makeModData()); | ||||
|         getModAPI().setCallbackString("currentScreen", () -> { | ||||
|             return mc.currentScreen.toString(); | ||||
|         }); | ||||
| @ -370,6 +369,7 @@ public class ModAPI { | ||||
|     } | ||||
|   | ||||
| 
 | ||||
| 
 | ||||
|     public void onUpdate() { | ||||
|         if (requiredList.contains("player") && mc.thePlayer != null) { | ||||
|             ModAPI.setGlobal("player", mc.thePlayer.makeModData()); | ||||
| @ -377,6 +377,9 @@ public class ModAPI { | ||||
|         if (requiredList.contains("network") && mc.thePlayer != null && mc.thePlayer.sendQueue != null) { | ||||
|             ModAPI.setGlobal("network", mc.thePlayer.sendQueue.makeModData()); | ||||
|         } | ||||
|         if (requiredList.contains("server") && mc.getCurrentServerData() != null) { | ||||
|             ModAPI.setGlobal("server", server.makeModData()); | ||||
|         } | ||||
|         ModAPI.callEvent("update", new ModData()); | ||||
|     } | ||||
|     public void onFrame(){ | ||||
|  | ||||
							
								
								
									
										38
									
								
								sources/main/java/net/eaglerforge/api/server.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								sources/main/java/net/eaglerforge/api/server.java
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,38 @@ | ||||
| package net.eaglerforge.api; | ||||
| 
 | ||||
| 
 | ||||
| import net.minecraft.client.Minecraft; | ||||
| 
 | ||||
| public class server extends ModData{ | ||||
|     private static Minecraft mc; | ||||
| 
 | ||||
|     public static ModData makeModData() { | ||||
|         ModData serverglobal = new ModData(); | ||||
|         serverglobal.setCallbackString("getCurrentQuery", () -> { | ||||
|             return Minecraft.currentServerData.currentQuery.toString(); | ||||
|         }); | ||||
|         serverglobal.setCallbackString("getServerIP", () -> { | ||||
|             return Minecraft.currentServerData.serverIP; | ||||
|         }); | ||||
|         serverglobal.setCallbackString("getServerMOTD", () -> { | ||||
|             return Minecraft.currentServerData.serverMOTD; | ||||
|         }); | ||||
|         serverglobal.setCallbackString("getServerName", () -> { | ||||
|             return Minecraft.currentServerData.serverName; | ||||
|         }); | ||||
|         serverglobal.setCallbackString("getGameVersion", () -> { | ||||
|             return Minecraft.currentServerData.gameVersion; | ||||
|         }); | ||||
|         serverglobal.setCallbackString("getPlayerListToString", () -> { | ||||
|             return Minecraft.currentServerData.playerList; | ||||
|         }); | ||||
|         serverglobal.setCallbackDouble("getPingSentTime", () -> { | ||||
|             return Minecraft.currentServerData.pingSentTime; | ||||
|         }); | ||||
|         serverglobal.setCallbackDouble("getPingToServer", () -> { | ||||
|             return Minecraft.currentServerData.pingToServer; | ||||
|         }); | ||||
| 
 | ||||
|         return serverglobal; | ||||
|     } | ||||
| } | ||||
| @ -7,6 +7,7 @@ import java.util.LinkedList; | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
| 
 | ||||
| import net.eaglerforge.api.ModData; | ||||
| import net.lax1dude.eaglercraft.v1_8.internal.PlatformWebRTC; | ||||
| 
 | ||||
| import org.apache.commons.lang3.StringUtils; | ||||
| @ -31,6 +32,7 @@ import net.minecraft.world.storage.ISaveFormat; | ||||
| import net.minecraft.world.storage.ISaveHandler; | ||||
| import net.minecraft.world.storage.SaveFormatComparator; | ||||
| import net.minecraft.world.storage.WorldInfo; | ||||
| import org.teavm.jso.JSObject; | ||||
| 
 | ||||
| /** | ||||
|  * Copyright (c) 2022-2024 lax1dude, ayunami2000. All Rights Reserved. | ||||
| @ -47,7 +49,7 @@ import net.minecraft.world.storage.WorldInfo; | ||||
|  * POSSIBILITY OF SUCH DAMAGE. | ||||
|  *  | ||||
|  */ | ||||
| public class SingleplayerServerController implements ISaveFormat { | ||||
| public class SingleplayerServerController extends ModData implements ISaveFormat { | ||||
| 
 | ||||
| 	public static final String IPC_CHANNEL = "~!IPC"; | ||||
| 	public static final String PLAYER_CHANNEL = "~!LOCAL_PLAYER"; | ||||
| @ -591,4 +593,33 @@ public class SingleplayerServerController implements ISaveFormat { | ||||
| 		Minecraft mc = Minecraft.getMinecraft(); | ||||
| 		return mc != null && mc.thePlayer != null && mc.thePlayer.sendQueue.isClientInEaglerSingleplayerOrLAN(); | ||||
| 	} | ||||
| 
 | ||||
| 	public static ModData makeModData() { | ||||
| 		ModData spglobal = new ModData(); | ||||
| 		spglobal.setCallbackBoolean("isIntegratedServerWorkerStarted", () -> { | ||||
| 			return isIntegratedServerWorkerStarted(); | ||||
| 		}); | ||||
| 		spglobal.setCallbackVoid("startIntegratedServerWorker", () -> { | ||||
| 			startIntegratedServerWorker(); | ||||
| 		}); | ||||
| 		spglobal.setCallbackBoolean("isIntegratedServerWorkerAlive", () -> { | ||||
| 			return isIntegratedServerWorkerAlive(); | ||||
| 		}); | ||||
| 		spglobal.setCallbackBoolean("isReady", () -> { | ||||
| 			return isReady(); | ||||
| 		}); | ||||
| 
 | ||||
| 		spglobal.set("IPC_CHANNEL", IPC_CHANNEL); | ||||
| 		spglobal.set("PLAYER_CHANNEL", PLAYER_CHANNEL); | ||||
| 		spglobal.set("statusState", statusState); | ||||
| 		spglobal.set("loggingState", loggingState); | ||||
| 		spglobal.set("worldStatusString", worldStatusString); | ||||
| 		spglobal.set("worldStatusProgress", worldStatusProgress); | ||||
| 		spglobal.set("isPaused", isPaused); | ||||
| 		spglobal.set("integratedServerTPS", (JSObject) integratedServerTPS); | ||||
| 		spglobal.set("integratedServerLastTPSUpdate", integratedServerLastTPSUpdate); | ||||
| 		return spglobal; | ||||
| 	} | ||||
| 
 | ||||
| 
 | ||||
| } | ||||
|  | ||||
| @ -564,6 +564,9 @@ public class PlatformInput { | ||||
| 	@JSBody(params = { "mediaQuery" }, script = "return mediaQuery.matches;") | ||||
| 	private static native boolean mediaQueryMatches(JSObject mediaQuery); | ||||
| 
 | ||||
| 	@JSBody(params = {}, script = "return document.getElementById('game_frame');") | ||||
| 	private static native HTMLElement game_frame(); | ||||
| 
 | ||||
| 	public static void toggleFullscreen() { | ||||
| 		if (isFullscreen()) { | ||||
| 			if (keyboardLockSupported) { | ||||
| @ -576,7 +579,7 @@ public class PlatformInput { | ||||
| 				lockKeys(); | ||||
| 				lockKeys = true; | ||||
| 			} | ||||
| 			requestFullscreen(canvas); | ||||
| 			requestFullscreen(game_frame()); | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user