diff options
author | bowser0000 <bowser0000@gmail.com> | 2020-11-30 15:28:14 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-30 15:28:14 -0500 |
commit | 886402bdcd8d68e6d1076c86d53baab47070dd63 (patch) | |
tree | 80b30cfa6fd5127a63d51ae1037bbd129dbee1af /src/main/java/me/Danker/handlers | |
parent | 016814851e46acdbc7a8fce44746eb67feef5905 (diff) | |
parent | 7091007cdd4f214ab47d1fb18c951eb25cb67852 (diff) | |
download | SkyblockMod-886402bdcd8d68e6d1076c86d53baab47070dd63.tar.gz SkyblockMod-886402bdcd8d68e6d1076c86d53baab47070dd63.tar.bz2 SkyblockMod-886402bdcd8d68e6d1076c86d53baab47070dd63.zip |
1.8.3
Merge pull request #32 from bowser0000/development
I forgot to pull request when releasing
Diffstat (limited to 'src/main/java/me/Danker/handlers')
-rw-r--r-- | src/main/java/me/Danker/handlers/ConfigHandler.java | 6 | ||||
-rw-r--r-- | src/main/java/me/Danker/handlers/PacketHandler.java | 32 |
2 files changed, 38 insertions, 0 deletions
diff --git a/src/main/java/me/Danker/handlers/ConfigHandler.java b/src/main/java/me/Danker/handlers/ConfigHandler.java index c680716..4cc910b 100644 --- a/src/main/java/me/Danker/handlers/ConfigHandler.java +++ b/src/main/java/me/Danker/handlers/ConfigHandler.java @@ -201,6 +201,9 @@ public class ConfigHandler { if (!hasKey("toggles", "BlazePuzzle")) writeBooleanConfig("toggles", "BlazePuzzle", false); if (!hasKey("toggles", "CreeperPuzzle")) writeBooleanConfig("toggles", "CreeperPuzzle", false); if (!hasKey("toggles", "WaterPuzzle")) writeBooleanConfig("toggles", "WaterPuzzle", false); + if (!hasKey("toggles", "StartsWithTerminal")) writeBooleanConfig("toggles", "StartsWithTerminal", false); + if (!hasKey("toggles", "SelectAllTerminal")) writeBooleanConfig("toggles", "SelectAllTerminal", false); + if (!hasKey("toggles", "IgnoreItemFrameOnSeaLanterns")) writeBooleanConfig("toggles", "IgnoreItemFrameOnSeaLanterns", false); if (!hasKey("api", "APIKey")) writeStringConfig("api", "APIKey", ""); @@ -437,6 +440,9 @@ public class ConfigHandler { ToggleCommand.blazeToggled = getBoolean("toggles", "BlazePuzzle"); ToggleCommand.creeperToggled = getBoolean("toggles", "CreeperPuzzle"); ToggleCommand.waterToggled = getBoolean("toggles", "WaterPuzzle"); + ToggleCommand.startsWithToggled = getBoolean("toggles", "StartsWithTerminal"); + ToggleCommand.selectAllToggled = getBoolean("toggles", "SelectAllTerminal"); + ToggleCommand.itemFrameOnSeaLanternsToggled = getBoolean("toggles", "IgnoreItemFrameOnSeaLanterns"); String onlySlayer = getString("toggles", "BlockSlayer"); if (!onlySlayer.equals("")) { diff --git a/src/main/java/me/Danker/handlers/PacketHandler.java b/src/main/java/me/Danker/handlers/PacketHandler.java index ed1c8b0..716b27c 100644 --- a/src/main/java/me/Danker/handlers/PacketHandler.java +++ b/src/main/java/me/Danker/handlers/PacketHandler.java @@ -4,13 +4,23 @@ import java.lang.reflect.Field; import io.netty.channel.ChannelDuplexHandler; import io.netty.channel.ChannelHandlerContext; +import io.netty.channel.ChannelPromise; +import me.Danker.commands.ToggleCommand; import me.Danker.utils.Utils; import net.minecraft.client.Minecraft; +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityItemFrame; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; import net.minecraft.network.Packet; +import net.minecraft.network.play.client.C02PacketUseEntity; import net.minecraft.network.play.server.S04PacketEntityEquipment; +import net.minecraft.util.BlockPos; public class PacketHandler extends ChannelDuplexHandler { + // Spirit boots fix @Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { if (Utils.inSkyblock && msg instanceof Packet && msg.getClass().getName().endsWith("S04PacketEntityEquipment")) { // Inventory packet name @@ -26,4 +36,26 @@ public class PacketHandler extends ChannelDuplexHandler { super.channelRead(ctx, msg); } + // Ignore item frames with arrows on sea lanterns + @Override + public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { + if (ToggleCommand.itemFrameOnSeaLanternsToggled && Utils.inDungeons && msg instanceof Packet && msg.getClass().getName().endsWith("C02PacketUseEntity")) { + Minecraft mc = Minecraft.getMinecraft(); + C02PacketUseEntity packet = (C02PacketUseEntity) msg; + Entity entityHit = packet.getEntityFromWorld(mc.theWorld); + if (entityHit instanceof EntityItemFrame) { + EntityItemFrame itemFrame = (EntityItemFrame) entityHit; + ItemStack item = itemFrame.getDisplayedItem(); + if (item != null && item.getItem() == Items.arrow) { + BlockPos blockPos = Utils.getBlockUnderItemFrame(mc.theWorld, itemFrame); + if (mc.theWorld.getBlockState(blockPos).getBlock() == Blocks.sea_lantern) { + return; + } + } + } + } + + super.write(ctx, msg, promise); + } + } |