Skip to content

Commit f655244

Browse files
author
David
committed
update to 735 (1.16)
1 parent 909ade0 commit f655244

File tree

10 files changed

+46
-56
lines changed

10 files changed

+46
-56
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Minecraft 1.8 - 1.15.2 AFK Fishing bot
1+
Minecraft 1.8 - 1.16 AFK Fishing bot
22
=============
33
![Codacy grade](https://img.shields.io/codacy/grade/05f0f6a5d76444a1b710f911b661bf1d)
44
[![GitHub issues](https://img.shields.io/github/issues/MrKinau/FishingBot)](https://github.com/MrKinau/FishingBot/issues)
@@ -7,13 +7,12 @@ Minecraft 1.8 - 1.15.2 AFK Fishing bot
77

88
## Download
99
- a list with all releases can be found [here](https://github.com/MrKinau/FishingBot/releases)
10-
- The latest release can be downloaded [here](https://github.com/MrKinau/FishingBot/releases/latest)
1110

1211
## How to use
1312
1. Download a [release](https://github.com/MrKinau/FishingBot/releases) (or build it at you own)
1413
2. Start the Client (java -jar Fishingbot.jar)
1514
3. Fill in the config.properties, which generated on the first start
16-
4. Give a fishing rod to the account you used and place him in front of water
15+
4. Give a fishing rod to the account you used and place him in front of water (remember you can only fish treasure in open water)
1716

1817
## Features
1918
- Auto-Fishing Bot
@@ -47,6 +46,7 @@ Minecraft 1.8 - 1.15.2 AFK Fishing bot
4746
- 1.15
4847
- 1.15.1
4948
- 1.15.2
49+
- 1.16
5050

5151
## Contribution
5252
You are free to create a fork or a pull request to participate. You also can report bugs or request a new feature in the [issues](https://github.com/MrKinau/FishingBot/issues) tab (I will answer them as soon as possible)

pom.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
<groupId>systems.kinau</groupId>
1313
<artifactId>FishingBot</artifactId>
14-
<version>2.7.1</version>
14+
<version>2.7.2</version>
1515
<name>FishingBot</name>
1616
<description>An AFK fishing bot for minecraft</description>
1717

@@ -137,6 +137,4 @@
137137
</plugins>
138138
</build>
139139

140-
141-
142140
</project>

src/main/java/systems/kinau/fishingbot/fishing/ItemHandler.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,7 @@ public ItemHandler(int protocolId) {
6363
}
6464
break;
6565
}
66-
case ProtocolConstants.MINECRAFT_1_16_PRE_2:
67-
case ProtocolConstants.MINECRAFT_1_16_PRE_5:
66+
case ProtocolConstants.MINECRAFT_1_16:
6867
default: {
6968
root = new JsonParser().parse(new InputStreamReader(this.getClass().getClassLoader().getResourceAsStream("registries_1_16.json")));
7069
root = root.getAsJsonObject().get("minecraft:item").getAsJsonObject().get("entries").getAsJsonObject();

src/main/java/systems/kinau/fishingbot/modules/ClientDefaultsModule.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import systems.kinau.fishingbot.network.protocol.play.PacketOutChat;
1616
import systems.kinau.fishingbot.network.protocol.play.PacketOutClientSettings;
1717
import systems.kinau.fishingbot.network.protocol.play.PacketOutKeepAlive;
18-
import systems.kinau.fishingbot.network.protocol.play.PacketOutPosition;
18+
import systems.kinau.fishingbot.network.protocol.play.PacketOutPosLook;
1919

2020
import java.util.Arrays;
2121

@@ -91,7 +91,7 @@ private void startPositionUpdate(NetworkHandler networkHandler) {
9191
positionThread = new Thread(() -> {
9292
while (!Thread.currentThread().isInterrupted()) {
9393
Player player = FishingBot.getInstance().getPlayer();
94-
networkHandler.sendPacket(new PacketOutPosition(player.getX(), player.getY(), player.getZ(), true));
94+
networkHandler.sendPacket(new PacketOutPosLook(player.getX(), player.getY(), player.getZ(), player.getYaw(), player.getPitch(), true));
9595
try { Thread.sleep(1000); } catch (InterruptedException e) { break; }
9696
}
9797
});

src/main/java/systems/kinau/fishingbot/modules/FishingModule.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,7 @@ public void onSpawnObject(SpawnObjectEvent event) {
351351
}
352352
break;
353353
}
354-
case ProtocolConstants.MINECRAFT_1_16_PRE_2:
355-
case ProtocolConstants.MINECRAFT_1_16_PRE_5:
354+
case ProtocolConstants.MINECRAFT_1_16:
356355
default: {
357356
if(event.getType() == 106) { //106 = bobber
358357
if(FishingBot.getInstance().getPlayer().getEntityID() == -1 || event.getObjectData() == FishingBot.getInstance().getPlayer().getEntityID())

src/main/java/systems/kinau/fishingbot/network/protocol/NetworkHandler.java

Lines changed: 30 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,9 @@ private void initPacketRegistries() {
251251
getPlayRegistryOut().get(ProtocolConstants.MINECRAFT_1_13).registerPacket(0x03, PacketOutClientStatus.class);
252252
getPlayRegistryOut().get(ProtocolConstants.MINECRAFT_1_13).registerPacket(0x04, PacketOutClientSettings.class);
253253
getPlayRegistryOut().get(ProtocolConstants.MINECRAFT_1_13).registerPacket(0x0E, PacketOutKeepAlive.class);
254-
getPlayRegistryOut().get(ProtocolConstants.MINECRAFT_1_13).registerPacket(0x2A, PacketOutUseItem.class);
255254
getPlayRegistryOut().get(ProtocolConstants.MINECRAFT_1_13).registerPacket(0x10, PacketOutPosition.class);
255+
getPlayRegistryOut().get(ProtocolConstants.MINECRAFT_1_13).registerPacket(0x11, PacketOutPosLook.class);
256+
getPlayRegistryOut().get(ProtocolConstants.MINECRAFT_1_13).registerPacket(0x2A, PacketOutUseItem.class);
256257

257258
//Minecraft 1.13.1
258259

@@ -300,8 +301,9 @@ private void initPacketRegistries() {
300301
getPlayRegistryOut().get(ProtocolConstants.MINECRAFT_1_14).registerPacket(0x04, PacketOutClientStatus.class);
301302
getPlayRegistryOut().get(ProtocolConstants.MINECRAFT_1_14).registerPacket(0x05, PacketOutClientSettings.class);
302303
getPlayRegistryOut().get(ProtocolConstants.MINECRAFT_1_14).registerPacket(0x0F, PacketOutKeepAlive.class);
303-
getPlayRegistryOut().get(ProtocolConstants.MINECRAFT_1_14).registerPacket(0x2D, PacketOutUseItem.class);
304304
getPlayRegistryOut().get(ProtocolConstants.MINECRAFT_1_14).registerPacket(0x11, PacketOutPosition.class);
305+
getPlayRegistryOut().get(ProtocolConstants.MINECRAFT_1_14).registerPacket(0x12, PacketOutPosLook.class);
306+
getPlayRegistryOut().get(ProtocolConstants.MINECRAFT_1_14).registerPacket(0x2D, PacketOutUseItem.class);
305307

306308
//Minecraft 1.14.1
307309

@@ -349,36 +351,32 @@ private void initPacketRegistries() {
349351
getPlayRegistryIn().get(ProtocolConstants.MINECRAFT_1_15_2).copyOf(getPlayRegistryIn().get(ProtocolConstants.MINECRAFT_1_15));
350352
getPlayRegistryOut().get(ProtocolConstants.MINECRAFT_1_15_2).copyOf(getPlayRegistryOut().get(ProtocolConstants.MINECRAFT_1_14));
351353

352-
//Minecraft 1.16-pre2
353-
getPlayRegistryIn().get(ProtocolConstants.MINECRAFT_1_16_PRE_2).registerPacket(0x00, PacketInSpawnObject.class);
354-
getPlayRegistryIn().get(ProtocolConstants.MINECRAFT_1_16_PRE_2).registerPacket(0x0D, PacketInDifficultySet.class);
355-
getPlayRegistryIn().get(ProtocolConstants.MINECRAFT_1_16_PRE_2).registerPacket(0x0E, PacketInChat.class);
356-
getPlayRegistryIn().get(ProtocolConstants.MINECRAFT_1_16_PRE_2).registerPacket(0x16, PacketInSetSlot.class);
357-
getPlayRegistryIn().get(ProtocolConstants.MINECRAFT_1_16_PRE_2).registerPacket(0x1A, PacketInDisconnect.class);
358-
getPlayRegistryIn().get(ProtocolConstants.MINECRAFT_1_16_PRE_2).registerPacket(0x20, PacketInKeepAlive.class);
359-
getPlayRegistryIn().get(ProtocolConstants.MINECRAFT_1_16_PRE_2).registerPacket(0x25, PacketInJoinGame.class);
360-
getPlayRegistryIn().get(ProtocolConstants.MINECRAFT_1_16_PRE_2).registerPacket(0x33, PacketInPlayerListItem.class);
361-
getPlayRegistryIn().get(ProtocolConstants.MINECRAFT_1_16_PRE_2).registerPacket(0x35, PacketInPlayerPosLook.class);
362-
getPlayRegistryIn().get(ProtocolConstants.MINECRAFT_1_16_PRE_2).registerPacket(0x3F, PacketInHeldItemChange.class);
363-
getPlayRegistryIn().get(ProtocolConstants.MINECRAFT_1_16_PRE_2).registerPacket(0x44, PacketInEntityMetadata.class);
364-
getPlayRegistryIn().get(ProtocolConstants.MINECRAFT_1_16_PRE_2).registerPacket(0x46, PacketInEntityVelocity.class);
365-
getPlayRegistryIn().get(ProtocolConstants.MINECRAFT_1_16_PRE_2).registerPacket(0x48, PacketInSetExperience.class);
366-
getPlayRegistryIn().get(ProtocolConstants.MINECRAFT_1_16_PRE_2).registerPacket(0x49, PacketInUpdateHealth.class);
367-
368-
getPlayRegistryOut().get(ProtocolConstants.MINECRAFT_1_16_PRE_2).registerPacket(0x00, PacketOutTeleportConfirm.class);
369-
getPlayRegistryOut().get(ProtocolConstants.MINECRAFT_1_16_PRE_2).registerPacket(0x03, PacketOutChat.class);
370-
getPlayRegistryOut().get(ProtocolConstants.MINECRAFT_1_16_PRE_2).registerPacket(0x04, PacketOutClientStatus.class);
371-
getPlayRegistryOut().get(ProtocolConstants.MINECRAFT_1_16_PRE_2).registerPacket(0x05, PacketOutClientSettings.class);
372-
getPlayRegistryOut().get(ProtocolConstants.MINECRAFT_1_16_PRE_2).registerPacket(0x10, PacketOutKeepAlive.class);
373-
getPlayRegistryOut().get(ProtocolConstants.MINECRAFT_1_16_PRE_2).registerPacket(0x12, PacketOutPosition.class);
374-
getPlayRegistryOut().get(ProtocolConstants.MINECRAFT_1_16_PRE_2).registerPacket(0x2E, PacketOutUseItem.class);
375-
376-
//Minecraft 1.16-pre5
377-
getPlayRegistryIn().get(ProtocolConstants.MINECRAFT_1_16_PRE_5).copyOf(getPlayRegistryIn().get(ProtocolConstants.MINECRAFT_1_16_PRE_2));
378-
getPlayRegistryOut().get(ProtocolConstants.MINECRAFT_1_16_PRE_5).copyOf(getPlayRegistryOut().get(ProtocolConstants.MINECRAFT_1_16_PRE_2));
379-
380-
381-
//Register protocol of 1.16 for unknown versions
354+
//Minecraft 1.16
355+
getPlayRegistryIn().get(ProtocolConstants.MINECRAFT_1_16).registerPacket(0x00, PacketInSpawnObject.class);
356+
getPlayRegistryIn().get(ProtocolConstants.MINECRAFT_1_16).registerPacket(0x0D, PacketInDifficultySet.class);
357+
getPlayRegistryIn().get(ProtocolConstants.MINECRAFT_1_16).registerPacket(0x0E, PacketInChat.class);
358+
getPlayRegistryIn().get(ProtocolConstants.MINECRAFT_1_16).registerPacket(0x16, PacketInSetSlot.class);
359+
getPlayRegistryIn().get(ProtocolConstants.MINECRAFT_1_16).registerPacket(0x1A, PacketInDisconnect.class);
360+
getPlayRegistryIn().get(ProtocolConstants.MINECRAFT_1_16).registerPacket(0x20, PacketInKeepAlive.class);
361+
getPlayRegistryIn().get(ProtocolConstants.MINECRAFT_1_16).registerPacket(0x25, PacketInJoinGame.class);
362+
getPlayRegistryIn().get(ProtocolConstants.MINECRAFT_1_16).registerPacket(0x33, PacketInPlayerListItem.class);
363+
getPlayRegistryIn().get(ProtocolConstants.MINECRAFT_1_16).registerPacket(0x35, PacketInPlayerPosLook.class);
364+
getPlayRegistryIn().get(ProtocolConstants.MINECRAFT_1_16).registerPacket(0x3F, PacketInHeldItemChange.class);
365+
getPlayRegistryIn().get(ProtocolConstants.MINECRAFT_1_16).registerPacket(0x44, PacketInEntityMetadata.class);
366+
getPlayRegistryIn().get(ProtocolConstants.MINECRAFT_1_16).registerPacket(0x46, PacketInEntityVelocity.class);
367+
getPlayRegistryIn().get(ProtocolConstants.MINECRAFT_1_16).registerPacket(0x48, PacketInSetExperience.class);
368+
getPlayRegistryIn().get(ProtocolConstants.MINECRAFT_1_16).registerPacket(0x49, PacketInUpdateHealth.class);
369+
370+
getPlayRegistryOut().get(ProtocolConstants.MINECRAFT_1_16).registerPacket(0x00, PacketOutTeleportConfirm.class);
371+
getPlayRegistryOut().get(ProtocolConstants.MINECRAFT_1_16).registerPacket(0x03, PacketOutChat.class);
372+
getPlayRegistryOut().get(ProtocolConstants.MINECRAFT_1_16).registerPacket(0x04, PacketOutClientStatus.class);
373+
getPlayRegistryOut().get(ProtocolConstants.MINECRAFT_1_16).registerPacket(0x05, PacketOutClientSettings.class);
374+
getPlayRegistryOut().get(ProtocolConstants.MINECRAFT_1_16).registerPacket(0x10, PacketOutKeepAlive.class);
375+
getPlayRegistryOut().get(ProtocolConstants.MINECRAFT_1_16).registerPacket(0x12, PacketOutPosition.class);
376+
getPlayRegistryOut().get(ProtocolConstants.MINECRAFT_1_16).registerPacket(0x13, PacketOutPosLook.class);
377+
getPlayRegistryOut().get(ProtocolConstants.MINECRAFT_1_16).registerPacket(0x2E, PacketOutUseItem.class);
378+
379+
//Register protocol of latest for unknown versions
382380
if(!ProtocolConstants.SUPPORTED_VERSION_IDS.contains(FishingBot.getInstance().getServerProtocol())) {
383381
FishingBot.getLog().severe("This server is not running a supported protocol version: ProtocolVersion " + FishingBot.getInstance().getServerProtocol());
384382
FishingBot.getLog().severe("It is possible that it wont work correctly");

src/main/java/systems/kinau/fishingbot/network/protocol/ProtocolConstants.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ public class ProtocolConstants {
3333
public static final int MINECRAFT_1_15 = 573;
3434
public static final int MINECRAFT_1_15_1 = 575;
3535
public static final int MINECRAFT_1_15_2 = 578;
36-
public static final int MINECRAFT_1_16_PRE_2 = 722;
37-
public static final int MINECRAFT_1_16_PRE_5 = 729;
36+
public static final int MINECRAFT_1_16 = 735;
3837

3938
public static final List<String> SUPPORTED_VERSIONS = Arrays.asList(
4039
"1.8.x",
@@ -71,8 +70,7 @@ public class ProtocolConstants {
7170
ProtocolConstants.MINECRAFT_1_15,
7271
ProtocolConstants.MINECRAFT_1_15_1,
7372
ProtocolConstants.MINECRAFT_1_15_2,
74-
ProtocolConstants.MINECRAFT_1_16_PRE_2,
75-
ProtocolConstants.MINECRAFT_1_16_PRE_5
73+
ProtocolConstants.MINECRAFT_1_16
7674
);
7775

7876
public static String getVersionString(int protocolId) {
@@ -99,8 +97,7 @@ public static String getVersionString(int protocolId) {
9997
case MINECRAFT_1_15: return "1.15";
10098
case MINECRAFT_1_15_1: return "1.15.1";
10199
case MINECRAFT_1_15_2: return "1.15.2";
102-
case MINECRAFT_1_16_PRE_2: return "1.16-pre2";
103-
case MINECRAFT_1_16_PRE_5: return "1.16-pre5";
100+
case MINECRAFT_1_16: return "1.16";
104101
default: return "Unknown version";
105102
}
106103
}
@@ -128,8 +125,7 @@ public static int getProtocolId(String versionString) {
128125
case "1.15": return MINECRAFT_1_15;
129126
case "1.15.1": return MINECRAFT_1_15_1;
130127
case "1.15.2": return MINECRAFT_1_15_2;
131-
case "1.16-pre2": return MINECRAFT_1_16_PRE_2;
132-
case "1.16-pre5": return MINECRAFT_1_16_PRE_5;
128+
case "1.16": return MINECRAFT_1_16;
133129
default: return MINECRAFT_1_8;
134130
}
135131
}

src/main/java/systems/kinau/fishingbot/network/protocol/login/PacketInLoginSuccess.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public void write(ByteArrayDataOutput out, int protocolId) throws IOException {
3333
@Override
3434
public void read(ByteArrayDataInputWrapper in, NetworkHandler networkHandler, int length, int protocolId) throws IOException {
3535

36-
if (FishingBot.getInstance().getServerProtocol() < ProtocolConstants.MINECRAFT_1_16_PRE_2) {
36+
if (FishingBot.getInstance().getServerProtocol() < ProtocolConstants.MINECRAFT_1_16) {
3737
String uuidStr = readString(in).replace("-", "");
3838
this.uuid = new UUID(new BigInteger(uuidStr.substring(0, 16), 16).longValue(), new BigInteger(uuidStr.substring(16), 16).longValue());
3939
this.userName = readString(in);

src/main/java/systems/kinau/fishingbot/network/protocol/play/PacketInChat.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public void read(ByteArrayDataInputWrapper in, NetworkHandler networkHandler, in
4848
//Ignored
4949
}
5050

51-
if (FishingBot.getInstance().getServerProtocol() >= ProtocolConstants.MINECRAFT_1_16_PRE_2)
51+
if (FishingBot.getInstance().getServerProtocol() >= ProtocolConstants.MINECRAFT_1_16)
5252
this.sender = readUUID(in);
5353

5454
FishingBot.getInstance().getEventManager().callEvent(new ChatEvent(getText(), getSender()));

src/main/java/systems/kinau/fishingbot/network/protocol/play/PacketInJoinGame.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,11 @@ public void read(ByteArrayDataInputWrapper in, NetworkHandler networkHandler, in
100100
enableRespawnScreen = in.readBoolean(); //Set to false when the doImmediateRespawn gamerule is true
101101
break;
102102
}
103-
case ProtocolConstants.MINECRAFT_1_16_PRE_2:
104-
case ProtocolConstants.MINECRAFT_1_16_PRE_5:
103+
case ProtocolConstants.MINECRAFT_1_16:
105104
default: {
106105
eid = in.readInt(); //Entity ID
107106
gamemode = in.readUnsignedByte(); //Gamemode
107+
in.readUnsignedByte(); //previous gamemode
108108
int worldCount = readVarInt(in); //count of worlds
109109
worldIdentifier = new String[worldCount]; //identifier for all worlds
110110
for (int i = 0; i < worldCount; i++)

0 commit comments

Comments
 (0)