diff --git a/patches/minecraft/net/minecraft/block/BlockSponge.edit.java b/patches/minecraft/net/minecraft/block/BlockSponge.edit.java index fbc7476..49595da 100644 --- a/patches/minecraft/net/minecraft/block/BlockSponge.edit.java +++ b/patches/minecraft/net/minecraft/block/BlockSponge.edit.java @@ -18,18 +18,13 @@ ~ ArrayList arraylist = Lists.newArrayList(); -> INSERT 3 : 4 @ 3 - -+ BlockPos tmp = new BlockPos(0, 0, 0); - -> CHANGE 5 : 9 @ 5 : 7 +> CHANGE 8 : 11 @ 8 : 9 ~ EnumFacing[] facings = EnumFacing._VALUES; ~ for (int k = 0; k < facings.length; ++k) { ~ EnumFacing enumfacing = facings[k]; -~ BlockPos blockpos1 = blockpos.offsetEvenFaster(enumfacing, tmp); -> CHANGE 15 : 17 @ 15 : 17 +> CHANGE 16 : 18 @ 16 : 18 ~ for (int j = 0, l = arraylist.size(); j < l; ++j) { ~ worldIn.notifyNeighborsOfStateChange(arraylist.get(j), Blocks.air); diff --git a/patches/minecraft/net/minecraft/client/Minecraft.edit.java b/patches/minecraft/net/minecraft/client/Minecraft.edit.java index 0d34287..cf460dd 100644 --- a/patches/minecraft/net/minecraft/client/Minecraft.edit.java +++ b/patches/minecraft/net/minecraft/client/Minecraft.edit.java @@ -5,8 +5,10 @@ # Version: 1.0 # Author: lax1dude -> CHANGE 2 : 4 @ 2 : 17 +> CHANGE 2 : 6 @ 2 : 17 +~ import static net.eaglerforge.EaglerForge.removeanvil; +~ ~ import static net.lax1dude.eaglercraft.v1_8.internal.PlatformOpenGL._wglBindFramebuffer; ~ @@ -161,8 +163,9 @@ > DELETE 9 @ 9 : 11 -> CHANGE 4 : 5 @ 4 : 7 +> CHANGE 3 : 5 @ 3 : 7 +~ public static ResourceLocation mojangLogo; ~ private final List> scheduledTasks = new LinkedList(); > INSERT 14 : 18 @ 14 @@ -300,10 +303,11 @@ ~ mainMenu = new GuiConnecting(mainMenu, this, this.serverName, this.serverPort); -> INSERT 2 : 4 @ 2 +> INSERT 2 : 5 @ 2 + this.displayGuiScreen(new GuiScreenEditProfile(mainMenu)); + ++ removeanvil(); > DELETE 3 @ 3 : 6 diff --git a/patches/minecraft/net/minecraft/client/gui/GuiOptions.edit.java b/patches/minecraft/net/minecraft/client/gui/GuiOptions.edit.java index 41c88f9..b818f0a 100644 --- a/patches/minecraft/net/minecraft/client/gui/GuiOptions.edit.java +++ b/patches/minecraft/net/minecraft/client/gui/GuiOptions.edit.java @@ -59,7 +59,11 @@ ~ I18n.format("options.debugConsoleButton", new Object[0]))); ~ btn.enabled = EagRuntime.getPlatformType() != EnumPlatformType.DESKTOP; -> CHANGE 24 : 25 @ 24 : 25 +> INSERT 17 : 18 @ 17 + ++ SingleplayerServerController.setDifficulty(-1); + +> CHANGE 7 : 8 @ 7 : 8 ~ protected void actionPerformed(GuiButton parGuiButton) { diff --git a/patches/minecraft/net/minecraft/client/network/NetHandlerPlayClient.edit.java b/patches/minecraft/net/minecraft/client/network/NetHandlerPlayClient.edit.java index ffb4316..a81a34c 100644 --- a/patches/minecraft/net/minecraft/client/network/NetHandlerPlayClient.edit.java +++ b/patches/minecraft/net/minecraft/client/network/NetHandlerPlayClient.edit.java @@ -9,9 +9,12 @@ > DELETE 4 @ 4 : 6 -> INSERT 1 : 19 @ 1 +> INSERT 1 : 22 @ 1 + ++ import net.eaglerforge.api.BaseData; ++ import net.eaglerforge.api.ModAPI; ++ import net.eaglerforge.api.ModData; + import net.lax1dude.eaglercraft.v1_8.EagRuntime; + import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom; + import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID; @@ -56,7 +59,11 @@ > DELETE 32 @ 32 : 34 -> CHANGE 3 : 4 @ 3 : 4 +> CHANGE 1 : 2 @ 1 : 2 + +~ public class NetHandlerPlayClient extends ModData implements INetHandlerPlayClient { + +> CHANGE 1 : 2 @ 1 : 2 ~ private final EaglercraftNetworkManager netManager; @@ -148,7 +155,22 @@ > DELETE 7 @ 7 : 8 -> DELETE 23 @ 23 : 24 +> CHANGE 23 : 37 @ 23 : 24 + +~ ModData eventData = new ModData(); +~ eventData.set("preventDefault", false); +~ eventData.set("type", packetIn.type); +~ eventData.set("chat", packetIn.chatComponent.getFormattedText()); +~ BaseData newEvent = ModAPI.callEvent("packetchat", eventData); +~ if (newEvent.has("preventDefault") && newEvent.getBoolean("preventDefault") == true) { +~ return; +~ } +~ packetIn.type = newEvent.has("type") ? newEvent.getByte("type") : packetIn.type; +~ if (newEvent.has("chat") +~ && (newEvent.getString("chat").length() != packetIn.chatComponent.getFormattedText().length())) { +~ packetIn.chatComponent = new ChatComponentText(newEvent.getString("chat")); +~ } +~ > DELETE 9 @ 9 : 10 diff --git a/patches/minecraft/net/minecraft/network/play/server/S02PacketChat.edit.java b/patches/minecraft/net/minecraft/network/play/server/S02PacketChat.edit.java index 6d88f89..0c94b17 100644 --- a/patches/minecraft/net/minecraft/network/play/server/S02PacketChat.edit.java +++ b/patches/minecraft/net/minecraft/network/play/server/S02PacketChat.edit.java @@ -9,4 +9,9 @@ + +> CHANGE 6 : 8 @ 6 : 8 + +~ public IChatComponent chatComponent; +~ public byte type; + > EOF diff --git a/patches/minecraft/net/minecraft/network/play/server/S41PacketServerDifficulty.edit.java b/patches/minecraft/net/minecraft/network/play/server/S41PacketServerDifficulty.edit.java index 6d88f89..2647d52 100644 --- a/patches/minecraft/net/minecraft/network/play/server/S41PacketServerDifficulty.edit.java +++ b/patches/minecraft/net/minecraft/network/play/server/S41PacketServerDifficulty.edit.java @@ -9,4 +9,14 @@ + +> CHANGE 22 : 25 @ 22 : 23 + +~ int i = parPacketBuffer.readUnsignedByte(); +~ this.difficulty = EnumDifficulty.getDifficultyEnum(i & 3); +~ this.difficultyLocked = (i & 4) != 0; + +> CHANGE 3 : 4 @ 3 : 4 + +~ parPacketBuffer.writeByte(this.difficulty.getDifficultyId() | (this.difficultyLocked ? 4 : 0)); + > EOF diff --git a/patches/minecraft/net/minecraft/server/MinecraftServer.edit.java b/patches/minecraft/net/minecraft/server/MinecraftServer.edit.java index fae012e..1070e89 100644 --- a/patches/minecraft/net/minecraft/server/MinecraftServer.edit.java +++ b/patches/minecraft/net/minecraft/server/MinecraftServer.edit.java @@ -30,7 +30,9 @@ > DELETE 8 @ 8 : 11 -> DELETE 1 @ 1 : 3 +> CHANGE 1 : 2 @ 1 : 3 + +~ import net.minecraft.network.play.server.S41PacketServerDifficulty; > DELETE 1 @ 1 : 2 @@ -118,8 +120,13 @@ > DELETE 1 @ 1 : 2 -> CHANGE 39 : 44 @ 39 : 40 +> DELETE 32 @ 32 : 35 +> CHANGE 3 : 11 @ 3 : 5 + +~ if (this.worldServers[0].getWorldInfo().getDifficulty() == null) { +~ this.setDifficultyForAllWorlds(this.getDifficulty()); +~ } ~ this.isSpawnChunksLoaded = this.worldServers[0].getWorldInfo().getGameRulesInstance() ~ .getBoolean("loadSpawnChunks"); ~ if (this.isSpawnChunksLoaded) { @@ -248,7 +255,24 @@ > DELETE 4 @ 4 : 8 -> DELETE 35 @ 35 : 55 +> INSERT 16 : 19 @ 16 + ++ this.getConfigurationManager().sendPacketToAllPlayers(new S41PacketServerDifficulty( ++ this.worldServers[0].getDifficulty(), this.worldServers[0].getWorldInfo().isDifficultyLocked())); ++ } + +> INSERT 1 : 9 @ 1 + ++ public void setDifficultyLockedForAllWorlds(boolean locked) { ++ for (int i = 0; i < this.worldServers.length; ++i) { ++ WorldServer worldserver = this.worldServers[i]; ++ if (worldserver != null) { ++ worldserver.getWorldInfo().setDifficultyLocked(locked); ++ } ++ } ++ + +> DELETE 18 @ 18 : 38 > DELETE 13 @ 13 : 64 diff --git a/sources/main/java/net/eaglerforge/EaglerForge.java b/sources/main/java/net/eaglerforge/EaglerForge.java index de00ff7..3e39465 100644 --- a/sources/main/java/net/eaglerforge/EaglerForge.java +++ b/sources/main/java/net/eaglerforge/EaglerForge.java @@ -2,11 +2,13 @@ package net.eaglerforge; import net.lax1dude.eaglercraft.v1_8.log4j.LogManager; import net.lax1dude.eaglercraft.v1_8.log4j.Logger; +import net.minecraft.client.Minecraft; import org.teavm.jso.JSBody; +import static net.minecraft.client.Minecraft.mojangLogo; -import net.eaglerforge.api.ModLoader; public class EaglerForge { + private static Minecraft mc; public static final Logger log = LogManager.getLogger(); @JSBody(params = { "message" }, script = "alert(message)") public static native void jsalert(String message); @@ -19,10 +21,18 @@ public class EaglerForge { @JSBody(params = { "message", "default_text" }, script = "prompt(message, default_text)") public static native void jspromptdt(String message, String default_text); + @JSBody(script = "displayanvil()") + public static native void displayanvil(); + + @JSBody(script = "var img = document.getElementById('anvil');\n" + + "if (img) img.remove();") + public static native void removeanvil(); + public static void init() { log.info("Starting EaglerForge!"); + displayanvil(); log.info("Loading Mods..."); } } diff --git a/sources/main/java/net/eaglerforge/api/ModAPI.java b/sources/main/java/net/eaglerforge/api/ModAPI.java index 6a195af..0e09764 100644 --- a/sources/main/java/net/eaglerforge/api/ModAPI.java +++ b/sources/main/java/net/eaglerforge/api/ModAPI.java @@ -188,6 +188,7 @@ public class ModAPI { newEvent("sendpacketcustompayload"); newEvent("sendpacketspectate"); newEvent("sendpacketresourcepackstatus");*/ + newEvent("packetchat"); globalsFunctor(this); globalsRequireFunctor(this); globalsUpdateFunctor(this); diff --git a/sources/main/java/net/lax1dude/eaglercraft/v1_8/EaglercraftVersion.java b/sources/main/java/net/lax1dude/eaglercraft/v1_8/EaglercraftVersion.java index ef7f1b9..f2f1f1f 100644 --- a/sources/main/java/net/lax1dude/eaglercraft/v1_8/EaglercraftVersion.java +++ b/sources/main/java/net/lax1dude/eaglercraft/v1_8/EaglercraftVersion.java @@ -12,7 +12,7 @@ public class EaglercraftVersion { /// Customize these to fit your fork: public static final String projectForkName = "EaglerForge"; - public static final String projectForkVersion = "v1.2.2"; + public static final String projectForkVersion = "v1.2.3"; public static final String projectForkVendor = "radmanplays"; public static final String projectForkURL = "https://github.com/eaglerforge/EaglerForge"; @@ -22,7 +22,7 @@ public class EaglercraftVersion { public static final String projectOriginName = "EaglercraftX"; public static final String projectOriginAuthor = "lax1dude"; public static final String projectOriginRevision = "1.8"; - public static final String projectOriginVersion = "u24"; + public static final String projectOriginVersion = "u26"; public static final String projectOriginURL = "https://gitlab.com/lax1dude/eaglercraftx-1.8"; // rest in peace @@ -33,7 +33,7 @@ public class EaglercraftVersion { public static final boolean enableUpdateService = true; public static final String updateBundlePackageName = "net.lax1dude.eaglercraft.v1_8.client"; - public static final int updateBundlePackageVersionInt = 24; + public static final int updateBundlePackageVersionInt = 26; public static final String updateLatestLocalStorageKey = "latestUpdate_" + updateBundlePackageName; diff --git a/sources/main/java/net/lax1dude/eaglercraft/v1_8/sp/server/EaglerIntegratedServerWorker.java b/sources/main/java/net/lax1dude/eaglercraft/v1_8/sp/server/EaglerIntegratedServerWorker.java index b19c20c..f695ebe 100644 --- a/sources/main/java/net/lax1dude/eaglercraft/v1_8/sp/server/EaglerIntegratedServerWorker.java +++ b/sources/main/java/net/lax1dude/eaglercraft/v1_8/sp/server/EaglerIntegratedServerWorker.java @@ -257,7 +257,11 @@ public class EaglerIntegratedServerWorker { case IPCPacket0ASetWorldDifficulty.ID: { IPCPacket0ASetWorldDifficulty pkt = (IPCPacket0ASetWorldDifficulty)ipc; if(!isServerStopped()) { - currentProcess.setDifficultyForAllWorlds(EnumDifficulty.getDifficultyEnum(pkt.difficulty)); + if(pkt.difficulty == (byte)-1) { + currentProcess.setDifficultyLockedForAllWorlds(true); + }else { + currentProcess.setDifficultyForAllWorlds(EnumDifficulty.getDifficultyEnum(pkt.difficulty)); + } }else { logger.warn("Client tried to set difficulty while server was stopped"); } diff --git a/sources/setup/workspace_template/javascript/OfflineDownloadTemplate.txt b/sources/setup/workspace_template/javascript/OfflineDownloadTemplate.txt index 580aa75..c344dfb 100644 --- a/sources/setup/workspace_template/javascript/OfflineDownloadTemplate.txt +++ b/sources/setup/workspace_template/javascript/OfflineDownloadTemplate.txt @@ -466,6 +466,20 @@ function displayGui() { } + + + +