From 45cabaf6bf781b028c17593d7983cf8128dd50f0 Mon Sep 17 00:00:00 2001 From: Walker Selby Date: Sun, 19 Nov 2023 15:53:26 +0000 Subject: Add Dessert Secret (#933) --- .../notenoughupdates/miscfeatures/WarpDessert.kt | 37 ++++++++++++++++++++++ .../mixins/MixinNetHandlerPlayClient.java | 4 +++ 2 files changed, 41 insertions(+) create mode 100644 src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/WarpDessert.kt (limited to 'src') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/WarpDessert.kt b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/WarpDessert.kt new file mode 100644 index 00000000..f6f272b9 --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/WarpDessert.kt @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2023 NotEnoughUpdates contributors + * + * This file is part of NotEnoughUpdates. + * + * NotEnoughUpdates is free software: you can redistribute it + * and/or modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation, either + * version 3 of the License, or (at your option) any later version. + * + * NotEnoughUpdates is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with NotEnoughUpdates. If not, see . + */ + +package io.github.moulberry.notenoughupdates.miscfeatures + +import io.github.moulberry.notenoughupdates.util.Utils +import net.minecraft.client.Minecraft +import net.minecraft.network.play.client.C01PacketChatMessage + +object WarpDessert { + @JvmStatic + fun onPacketChatMessage(packet: C01PacketChatMessage): Boolean { + val message = packet.message.lowercase() + if (message == "/warp dessert") { + Minecraft.getMinecraft().thePlayer.sendChatMessage("/warp desert") + Utils.addChatMessage("§eDid someone say §d§lDessert§e? Sand is yummy!") + return true + } + return false + } +} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinNetHandlerPlayClient.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinNetHandlerPlayClient.java index 5245d604..f6bb6a20 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinNetHandlerPlayClient.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinNetHandlerPlayClient.java @@ -26,6 +26,7 @@ import io.github.moulberry.notenoughupdates.miscfeatures.EnchantingSolvers; import io.github.moulberry.notenoughupdates.miscfeatures.ItemCooldowns; import io.github.moulberry.notenoughupdates.miscfeatures.MiningStuff; import io.github.moulberry.notenoughupdates.miscfeatures.StorageManager; +import io.github.moulberry.notenoughupdates.miscfeatures.WarpDessert; import io.github.moulberry.notenoughupdates.miscfeatures.world.CrystalHollowChestHighlighter; import io.github.moulberry.notenoughupdates.util.SBInfo; import net.minecraft.client.multiplayer.WorldClient; @@ -138,6 +139,9 @@ public class MixinNetHandlerPlayClient { if (AntiCoopAdd.getInstance().onPacketChatMessage((C01PacketChatMessage) packet)) { ci.cancel(); } + if (WarpDessert.onPacketChatMessage((C01PacketChatMessage) packet)) { + ci.cancel(); + } } } -- cgit