ACTUALLY update to 1.20.2
that was fake, MCProtocolLib fooled me :(
This commit is contained in:
parent
ab1a7654d8
commit
a830b7a701
7 changed files with 27 additions and 14 deletions
|
@ -15,6 +15,8 @@ description = 'ChomeNS Bot'
|
||||||
java.sourceCompatibility = JavaVersion.VERSION_17
|
java.sourceCompatibility = JavaVersion.VERSION_17
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
|
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
|
||||||
maven {
|
maven {
|
||||||
|
@ -28,12 +30,10 @@ repositories {
|
||||||
maven {
|
maven {
|
||||||
url = uri('https://repo.maven.apache.org/maven2/')
|
url = uri('https://repo.maven.apache.org/maven2/')
|
||||||
}
|
}
|
||||||
|
|
||||||
mavenLocal()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'com.github.steveice10:mcprotocollib:1.20-2-SNAPSHOT'
|
implementation 'com.github.steveice10:mcprotocollib:1.20.2-1-SNAPSHOT'
|
||||||
implementation 'net.kyori:adventure-text-serializer-ansi:4.14.0'
|
implementation 'net.kyori:adventure-text-serializer-ansi:4.14.0'
|
||||||
implementation 'com.google.code.gson:gson:2.10.1'
|
implementation 'com.google.code.gson:gson:2.10.1'
|
||||||
implementation 'com.google.guava:guava:31.1-jre'
|
implementation 'com.google.guava:guava:31.1-jre'
|
||||||
|
|
|
@ -5,8 +5,8 @@ import com.github.steveice10.mc.protocol.MinecraftProtocol;
|
||||||
import com.github.steveice10.mc.protocol.data.game.entity.player.HandPreference;
|
import com.github.steveice10.mc.protocol.data.game.entity.player.HandPreference;
|
||||||
import com.github.steveice10.mc.protocol.data.game.setting.ChatVisibility;
|
import com.github.steveice10.mc.protocol.data.game.setting.ChatVisibility;
|
||||||
import com.github.steveice10.mc.protocol.data.game.setting.SkinPart;
|
import com.github.steveice10.mc.protocol.data.game.setting.SkinPart;
|
||||||
|
import com.github.steveice10.mc.protocol.packet.common.serverbound.ServerboundClientInformationPacket;
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundLoginPacket;
|
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundLoginPacket;
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundClientInformationPacket;
|
|
||||||
import com.github.steveice10.mc.protocol.packet.login.clientbound.ClientboundGameProfilePacket;
|
import com.github.steveice10.mc.protocol.packet.login.clientbound.ClientboundGameProfilePacket;
|
||||||
import com.github.steveice10.packetlib.Session;
|
import com.github.steveice10.packetlib.Session;
|
||||||
import com.github.steveice10.packetlib.event.session.*;
|
import com.github.steveice10.packetlib.event.session.*;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package land.chipmunk.chayapak.chomens_bot.plugins;
|
package land.chipmunk.chayapak.chomens_bot.plugins;
|
||||||
|
|
||||||
|
import com.github.steveice10.mc.auth.data.GameProfile;
|
||||||
import com.github.steveice10.mc.protocol.data.game.PlayerListEntry;
|
import com.github.steveice10.mc.protocol.data.game.PlayerListEntry;
|
||||||
import com.github.steveice10.mc.protocol.data.game.PlayerListEntryAction;
|
import com.github.steveice10.mc.protocol.data.game.PlayerListEntryAction;
|
||||||
import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode;
|
import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode;
|
||||||
|
@ -91,7 +92,11 @@ public class PlayersPlugin extends Bot.Listener {
|
||||||
public PlayerEntry getBotEntry () { return getEntry(bot.username); }
|
public PlayerEntry getBotEntry () { return getEntry(bot.username); }
|
||||||
|
|
||||||
private PlayerEntry getEntry (PlayerListEntry other) {
|
private PlayerEntry getEntry (PlayerListEntry other) {
|
||||||
return getEntry(other.getProfile().getId());
|
final GameProfile gameProfile = other.getProfile();
|
||||||
|
|
||||||
|
if (gameProfile == null) return null;
|
||||||
|
|
||||||
|
return getEntry(gameProfile.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeChat (PlayerListEntry newEntry) {
|
private void initializeChat (PlayerListEntry newEntry) {
|
||||||
|
|
|
@ -5,7 +5,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.Client
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundMoveEntityRotPacket;
|
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundMoveEntityRotPacket;
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundRemoveEntitiesPacket;
|
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.ClientboundRemoveEntitiesPacket;
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundPlayerPositionPacket;
|
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.player.ClientboundPlayerPositionPacket;
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.spawn.ClientboundAddPlayerPacket;
|
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.entity.spawn.ClientboundAddEntityPacket;
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundAcceptTeleportationPacket;
|
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundAcceptTeleportationPacket;
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundMovePlayerPosPacket;
|
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundMovePlayerPosPacket;
|
||||||
import com.github.steveice10.packetlib.Session;
|
import com.github.steveice10.packetlib.Session;
|
||||||
|
@ -54,7 +54,7 @@ public class PositionPlugin extends Bot.Listener {
|
||||||
else if (packet instanceof ClientboundMoveEntityRotPacket) packetReceived((ClientboundMoveEntityRotPacket) packet);
|
else if (packet instanceof ClientboundMoveEntityRotPacket) packetReceived((ClientboundMoveEntityRotPacket) packet);
|
||||||
else if (packet instanceof ClientboundMoveEntityPosPacket) packetReceived((ClientboundMoveEntityPosPacket) packet);
|
else if (packet instanceof ClientboundMoveEntityPosPacket) packetReceived((ClientboundMoveEntityPosPacket) packet);
|
||||||
else if (packet instanceof ClientboundMoveEntityPosRotPacket) packetReceived((ClientboundMoveEntityPosRotPacket) packet);
|
else if (packet instanceof ClientboundMoveEntityPosRotPacket) packetReceived((ClientboundMoveEntityPosRotPacket) packet);
|
||||||
else if (packet instanceof ClientboundAddPlayerPacket) packetReceived((ClientboundAddPlayerPacket) packet);
|
else if (packet instanceof ClientboundAddEntityPacket) packetReceived((ClientboundAddEntityPacket) packet);
|
||||||
else if (packet instanceof ClientboundRemoveEntitiesPacket) packetReceived((ClientboundRemoveEntitiesPacket) packet);
|
else if (packet instanceof ClientboundRemoveEntitiesPacket) packetReceived((ClientboundRemoveEntitiesPacket) packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ public class PositionPlugin extends Bot.Listener {
|
||||||
for (Listener listener : listeners) { listener.positionChange(position); }
|
for (Listener listener : listeners) { listener.positionChange(position); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public void packetReceived (ClientboundAddPlayerPacket packet) {
|
public void packetReceived (ClientboundAddEntityPacket packet) {
|
||||||
final PlayerEntry entry = bot.players.getEntry(packet.getUuid());
|
final PlayerEntry entry = bot.players.getEntry(packet.getUuid());
|
||||||
|
|
||||||
if (entry == null) return;
|
if (entry == null) return;
|
||||||
|
|
|
@ -129,7 +129,7 @@ public class SelfCarePlugin extends Bot.Listener {
|
||||||
|
|
||||||
public void packetReceived (ClientboundLoginPacket packet) {
|
public void packetReceived (ClientboundLoginPacket packet) {
|
||||||
this.entityId = packet.getEntityId();
|
this.entityId = packet.getEntityId();
|
||||||
this.gamemode = packet.getGameMode();
|
this.gamemode = packet.getCommonPlayerSpawnInfo().getGameMode();
|
||||||
|
|
||||||
cspy = false;
|
cspy = false;
|
||||||
vanish = false;
|
vanish = false;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package land.chipmunk.chayapak.chomens_bot.plugins;
|
package land.chipmunk.chayapak.chomens_bot.plugins;
|
||||||
|
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundCustomPayloadPacket;
|
import com.github.steveice10.mc.protocol.packet.common.clientbound.ClientboundCustomPayloadPacket;
|
||||||
|
import com.github.steveice10.mc.protocol.packet.common.serverbound.ServerboundCustomPayloadPacket;
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundLoginPacket;
|
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundLoginPacket;
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundCustomPayloadPacket;
|
|
||||||
import com.github.steveice10.packetlib.Session;
|
import com.github.steveice10.packetlib.Session;
|
||||||
import com.github.steveice10.packetlib.event.session.DisconnectedEvent;
|
import com.github.steveice10.packetlib.event.session.DisconnectedEvent;
|
||||||
import com.github.steveice10.packetlib.packet.Packet;
|
import com.github.steveice10.packetlib.packet.Packet;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package land.chipmunk.chayapak.chomens_bot.plugins;
|
package land.chipmunk.chayapak.chomens_bot.plugins;
|
||||||
|
|
||||||
|
import com.github.steveice10.mc.protocol.packet.configuration.clientbound.ClientboundRegistryDataPacket;
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundLoginPacket;
|
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundLoginPacket;
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundRespawnPacket;
|
import com.github.steveice10.mc.protocol.packet.ingame.clientbound.ClientboundRespawnPacket;
|
||||||
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
||||||
|
@ -13,6 +14,8 @@ import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class WorldPlugin extends Bot.Listener {
|
public class WorldPlugin extends Bot.Listener {
|
||||||
|
private final Bot bot;
|
||||||
|
|
||||||
public int minY = 0;
|
public int minY = 0;
|
||||||
public int maxY = 256;
|
public int maxY = 256;
|
||||||
|
|
||||||
|
@ -21,6 +24,8 @@ public class WorldPlugin extends Bot.Listener {
|
||||||
private final List<Listener> listeners = new ArrayList<>();
|
private final List<Listener> listeners = new ArrayList<>();
|
||||||
|
|
||||||
public WorldPlugin (Bot bot) {
|
public WorldPlugin (Bot bot) {
|
||||||
|
this.bot = bot;
|
||||||
|
|
||||||
bot.addListener(this);
|
bot.addListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,6 +33,7 @@ public class WorldPlugin extends Bot.Listener {
|
||||||
public void packetReceived(Session session, Packet packet) {
|
public void packetReceived(Session session, Packet packet) {
|
||||||
if (packet instanceof ClientboundLoginPacket) packetReceived((ClientboundLoginPacket) packet);
|
if (packet instanceof ClientboundLoginPacket) packetReceived((ClientboundLoginPacket) packet);
|
||||||
else if (packet instanceof ClientboundRespawnPacket) packetReceived((ClientboundRespawnPacket) packet);
|
else if (packet instanceof ClientboundRespawnPacket) packetReceived((ClientboundRespawnPacket) packet);
|
||||||
|
else if (packet instanceof ClientboundRegistryDataPacket) packetReceived((ClientboundRegistryDataPacket) packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
@ -48,14 +54,16 @@ public class WorldPlugin extends Bot.Listener {
|
||||||
for (Listener listener : listeners) listener.worldChanged(dimension);
|
for (Listener listener : listeners) listener.worldChanged(dimension);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void packetReceived (ClientboundLoginPacket packet) {
|
public void packetReceived (ClientboundRegistryDataPacket packet) {
|
||||||
registry = packet.getRegistry();
|
registry = packet.getRegistry();
|
||||||
|
}
|
||||||
|
|
||||||
worldChanged(packet.getDimension());
|
public void packetReceived (ClientboundLoginPacket packet) {
|
||||||
|
worldChanged(packet.getCommonPlayerSpawnInfo().getDimension());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void packetReceived (ClientboundRespawnPacket packet) {
|
public void packetReceived (ClientboundRespawnPacket packet) {
|
||||||
worldChanged(packet.getDimension());
|
worldChanged(packet.getCommonPlayerSpawnInfo().getDimension());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Listener {
|
public static class Listener {
|
||||||
|
|
Loading…
Reference in a new issue