Compare commits

...
83 Commits
Author SHA1 Message Date
retrooper 5f8efaaf0f Correction in documentation 2023-12-13 21:34:05 +01:00
retrooper 9b8de173e4 EntityMetadataProvider backwards compatibility 2023-12-13 21:30:24 +01:00
retrooper de4594fbdc EntityMetadataProvider abstraction has been completed (now provides a protocol version) 2023-12-13 21:26:09 +01:00
retrooper 5eae00ef0b Minor change to velocity module 2023-12-13 21:07:22 +01:00
retrooper 3c418473d8 Releasing 2.2.0
- Initialization Optimization on Spigot
- bStats support implemented for Velocity
- bStats support implemented for BungeeCord
2023-12-13 21:05:53 +01:00
retrooper 1e919053c6 Merge pull request #623 from booky10/dev/1.20.3
1.20.3/1.20.4 update
2023-12-12 22:39:15 +01:00
booky10 30ff648bad Add handling for unnamed simple components as serialized compounds 2023-12-09 00:57:17 +01:00
booky10 6c5d9beb76 Rewrite adventure nbt serialization
This will now skip building nbt objects and will directly build adventure components
2023-12-09 00:10:46 +01:00
retrooper 3e828ea9ee * Added 1.20.4 version constants
* GRASS -> SHORT_GRASS, but GRASS is deprecated.
* WrapperPlayServerTickingInfo -> WrapperPlayServerTickingState
* WrapperPlayServerTickingStep minor changes
2023-12-08 13:05:03 +01:00
booky10 4ef8b381d7 Fix NPE for adventure nbt deserialization if no translation args are present 2023-12-05 20:44:09 +01:00
booky10 24838cd7d9 Fix new particle type ids being ignored 2023-12-05 20:24:47 +01:00
booky10 e17b877b5f Add crafting and trial_spawner_state state values 2023-12-05 20:11:50 +01:00
booky10 8b85bc8d4d Some various fixes for packet wrappers 2023-12-05 20:03:35 +01:00
booky10 fca9ad22fe Fix wrong config packet type registration 2023-12-05 20:03:17 +01:00
retrooper 8f7ec3d38a PacketEvents 2.1.0 release 2023-11-27 19:18:01 +01:00
retrooper 41969994b2 EntityMetadataProvider has been added, to allow potential packetevents addons to add on to our metadata abstraction. 2023-11-27 19:01:12 +01:00
booky10 667652bfb8 Add new resourcepack status for 1.20.3-pre3 2023-11-27 17:29:40 +01:00
booky10 2da42185e8 Rename grass to short_grass for 1.20.3-pre1 2023-11-20 20:23:55 +01:00
booky10 fd1b918956 Update packet structures for 1.20.3-pre1 2023-11-20 20:22:53 +01:00
booky10 828013bf77 Update packet ids for 1.20.3-pre1 2023-11-20 20:22:37 +01:00
booky10 6e30fb393a Move new entitytypes to bottom 2023-11-17 19:13:52 +01:00
booky10 cbfca6c5fa Update block/item tags to 1.20.3
Also fixes incorrect ordering
2023-11-17 18:26:12 +01:00
booky10 945ca46491 Fix missing fields for state types 2023-11-17 16:47:26 +01:00
booky10 f7d5252bf0 WIP new state types 2023-11-16 23:24:07 +01:00
booky10 a624a76427 Add new item types 2023-11-16 22:57:27 +01:00
booky10 39f9ed008c Add new particle types 2023-11-16 22:36:31 +01:00
booky10 a0096b3032 Add breeze and wind charge entity types 2023-11-16 22:31:23 +01:00
booky10 ae1a0258fe Add new game state change "reasons" 2023-11-16 22:22:23 +01:00
booky10 f863ad026f Update explosion packet 2023-11-16 22:17:07 +01:00
booky10 abea90564f Update vibration particle data 2023-11-16 22:01:28 +01:00
booky10 3bdd110864 Fix blockstate registry index not being incremented 2023-11-16 21:47:00 +01:00
booky10 b2e47f48a5 Use nbt-based component read/write methods 2023-11-16 21:45:09 +01:00
booky10 513de88321 Update serverbound jigsaw block packet 2023-11-16 20:11:13 +01:00
retrooper 4a2146d16d Merge pull request #622 from rexlManu/2.0
Relocate only the gson and legacy
2023-11-16 20:02:18 +01:00
booky10 5a49cf2687 Implement packet wrappers for new serverbound packets 2023-11-16 18:49:29 +01:00
booky10 65fba0b83d Implement packet wrappers for new clientbound packets 2023-11-16 18:49:13 +01:00
booky10 5272557f58 Add dummy "style" command argument parser 2023-11-16 18:29:44 +01:00
booky10 51abf38d3f Fix names of command argument parsers 2023-11-16 18:28:55 +01:00
booky10 33abe17a2b Add block mappings for 1.20.3 2023-11-16 18:25:18 +01:00
booky10 593015dd0b Add new packet types 2023-11-16 18:21:29 +01:00
Emmanuel Lampe 079a2fcc53 Relocate kyori legacy and gson separate for bungeecord 2023-11-15 03:17:02 +01:00
Emmanuel Lampe b9d4ed6a60 Relocate kyori legacy and gson separate 2023-11-15 03:16:09 +01:00
retrooper aec45f19e4 Merge pull request #619 from KaspianDev/fix-merchantoffers
Fix merchant offers always being empty
2023-11-10 17:17:31 +01:00
KaspianDev 0aaa4f42b1 Fix merchant offers always being empty 2023-11-10 16:52:49 +01:00
retrooper 75dfc63d3b Merge pull request #618 from SoSeDiK/blockId
Expose block id to BaseChunk
2023-11-07 18:34:37 +01:00
retrooper ac501a26b2 Fix the way we access NetworkManager (recent server builds have changed it) 2023-11-04 23:03:23 +01:00
SoSeDiK 3ebf39d3bd Expose block id to BaseChunk 2023-11-03 21:17:20 +02:00
retrooper 363931875f Stop depending on funkemunky jars. 2023-11-01 11:11:55 +01:00
retrooper b1802fbc0c Merge pull request #613 from 4drian3d/velocity-changes
Some Velocity module improvements
2023-11-01 10:30:18 +01:00
retrooper 9f9cdca53a Fix connection state issues and casting issues with events 2023-11-01 10:29:27 +01:00
Adrian 00c85f3e41 Some Velocity module improvements
- Removed PostOrder LATE usage
- Use Injected PluginContainer
- Disabled debug mode by default
- Replace deprecated method
2023-10-17 10:36:18 -05:00
retrooper b48a91bcee PotionTypes.getById works now 2023-10-11 19:18:47 +02:00
retrooper 709edd8b21 Merge pull request #610 from AbhigyaKrishna/2.0
Retain backward compatibility with adventure 5.0.0
2023-10-11 18:57:45 +02:00
retrooper 90edf6002e PotionTypes now requires a version to work correctly. 2023-10-11 18:04:30 +02:00
retrooper 4e151f8dfb Pushing out 2.1.0 snapshot for 1.20.2 update 2023-10-07 17:14:07 +02:00
retrooper 0165e8a4ac Merge pull request #607 from booky10/dev/1.20.2
1.20.2 update
2023-10-06 23:48:39 +02:00
retrooper 385000b608 * Add full support for PacketConfigReceive & SendEvent
* WrapperConfigClientClientSettings renamed to WrapperConfigClientSettings
2023-10-06 23:42:54 +02:00
booky10 a1b7c947a0 Use ServerVersion instead of ClientVersion for potion effects 2023-10-03 14:58:31 +02:00
Abhigya ab5163bc66 Retain backward compatibility with adventure 5.0.0 2023-10-02 00:41:27 +05:30
booky10 38b25b6d48 Fix wrapper name for debug pong packet
It's not chunk related, just a copy-paste error
2023-09-27 22:42:25 +02:00
booky10 9d5d4858cf Fix blockstate mappings index 2023-09-23 00:48:32 +02:00
booky10 2e6c43ba06 Extract dimension information from registry data packet instead of login packet 2023-09-22 20:32:30 +02:00
booky10 f180a4a172 Fix packet wrapper constructor parameter types 2023-09-22 20:31:56 +02:00
booky10 5ce6b8bf9e Fix missing clientbound configuration packettype 2023-09-22 20:24:22 +02:00
booky10 b61602741b Rebase on latest changes 2023-09-22 20:24:08 +02:00
booky10 13ba9e7b81 Switch protocol after receiving signaling packet 2023-09-22 20:18:00 +02:00
booky10 d4c9444fd5 Separate encoder and decoder protocol state 2023-09-22 20:17:11 +02:00
booky10 b6c079af66 Add packet wrappers for nearly all new packets in 1.20.2
Only one missing is tags update, which already didn't have a wrapper before
2023-09-22 20:17:11 +02:00
booky10 a18d288079 Update packet structures for 1.20.2 2023-09-22 20:17:09 +02:00
booky10 c3d8f91e85 Update all mappings for 1.20.2 2023-09-22 20:16:37 +02:00
retrooper 0ca2f5c50a Minor tweaks to velocity (update api) 2023-09-22 15:21:47 +02:00
retrooper cdc7ed36e0 PacketEvents 2.0.2 update 2023-09-13 16:01:41 +02:00
retrooper 5d63308a22 Delete WrapperPlayServerChunkData default values 2023-09-13 15:36:20 +02:00
retrooper 214706dbb6 Fix update checker colors 2023-09-12 00:59:18 +02:00
retrooper fa3b563c70 2.0.1 release 2023-09-12 00:36:31 +02:00
retrooper 55e31483e7 Changes to naming of WrapperPlayServerHurtAnimation 2023-09-12 00:02:38 +02:00
retrooper aa34910468 Update User#getWorldNBT usages to handle a nullable value. 2023-09-11 23:35:11 +02:00
retrooper 5e44913a5e Sending packets on proxies is now supported!
* ChannelInjector#isProxy added to detect if our implementation is running on a proxy
2023-08-31 20:25:27 +02:00
retrooper b8dc964112 Add jenkins builds on README 2023-08-31 10:40:57 +02:00
retrooper 890844fb60 Fix broken link in README 2023-08-31 10:40:08 +02:00
retrooper fc57c9e077 Update README 2023-08-31 09:46:32 +02:00
retrooper f12ef113aa Fixed packet-modification on BungeeCord. 2023-08-26 22:35:29 +02:00
retrooper e8144ece97 Minor fix to 1.12 item type mappings. 2023-08-24 18:42:48 +02:00
138 changed files with 59545 additions and 774 deletions

No files matched your search

+5 -12
View File
@@ -1,15 +1,17 @@
# packetevents
[![](https://jitpack.io/v/retrooper/packetevents.svg)](https://jitpack.io/#retrooper/packetevents)
[![](https://img.shields.io/badge/License-GPLv3-yellow.svg)](https://github.com/retrooper/packetevents/blob/2.0/LICENSE) [![](https://github.com/retrooper/packetevents/actions/workflows/build.yml/badge.svg)](https://github.com/retrooper/packetevents/actions) [![Discord](https://img.shields.io/badge/Discord-%235865F2.svg?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/prqzNg9tRU)
PacketEvents is a fast and efficient multi-platform packet processing library. Our packet wrappers are easy to use with multi-version support. With our API you can write code that runs on Spigot, BungeeCord, Velocity, and Fabric! Switch to PacketEvents today by joining \
our [Discord Server](https://discord.me/packetevents) for help.
### Links
* [Find release builds on SpigotMC](https://www.spigotmc.org/resources/packetevents-api.80279/)
* [Find release builds on Modrinth](https://modrinth.com/plugin/packetevents)
* [Find development builds on Jenkins](https://ci.codemc.io/job/retrooper/job/packetevents)
* [View documentation on our JavaDocs Page](https://packetevents.github.io/javadocs)
### Setup
[Learn more](https://github.com/retrooper/packetevents/wiki/Setup-2.0)
[How to Setup PacketEvents](https://github.com/retrooper/packetevents/wiki/Depending-on-pre%E2%80%90built-PacketEvents)
### Sponsorships
[![](https://www.ej-technologies.com/images/product_banners/jprofiler_small.png)](https://www.ej-technologies.com/products/jprofiler/overview.html)
@@ -18,15 +20,6 @@ our [Discord Server](https://discord.me/packetevents) for help.
PacketEvents optionally collects statistics using [bStats](https://bstats.org/)\
Check out our [bStats page](https://bstats.org/plugin/bukkit/packetevents/11327)
This library is licensed under the GPLv3 (General Public License version 3). Here are a few sources to learn more about the license.\
[![](https://www.gnu.org/graphics/gplv3-with-text-136x68.png)](https://github.com/retrooper/packetevents/blob/2.0/LICENSE)
### GPL Resources
* https://www.gnu.org/philosophy/free-sw.html
* https://www.gnu.org/philosophy/free-sw.html#clarifying
* https://www.gnu.org/licenses/copyleft.en.html
* https://www.gnu.org/licenses/quick-guide-gplv3.html
* https://gpl-violations.org/faq/sourcecode-faq/
### Credit to these projects
[wiki.vg/Protocol](https://wiki.vg/Protocol)\
[netty](https://github.com/netty/netty)\
@@ -18,10 +18,13 @@
package com.github.retrooper.packetevents;
import org.jetbrains.annotations.ApiStatus;
public final class PacketEvents {
private static PacketEventsAPI<?> API;
//Put these variable names anywhere else, they are really only for the injectors
@ApiStatus.Internal
public static String IDENTIFIER, ENCODER_NAME, DECODER_NAME, CONNECTION_HANDLER_NAME, SERVER_CHANNEL_HANDLER_NAME,
TIMEOUT_HANDLER_NAME;
@@ -38,7 +38,7 @@ public abstract class PacketEventsAPI<T> {
private final Logger LOGGER = Logger.getLogger(PacketEventsAPI.class.getName());
private static final LogManager LOG_MANAGER = new LogManager();
//TODO UPDATE
private static final PEVersion VERSION = new PEVersion(2, 0, 0);
private static final PEVersion VERSION = new PEVersion(2, 2, 0);
public EventManager getEventManager() {
return EVENT_MANAGER;
@@ -47,20 +47,13 @@ public class PacketReceiveEvent extends ProtocolPacketEvent<Object> {
@Override
public PacketReceiveEvent clone() {
if (this instanceof PacketHandshakeReceiveEvent) {
return ((PacketHandshakeReceiveEvent)this).clone();
}
else if (this instanceof PacketStatusReceiveEvent) {
return ((PacketStatusReceiveEvent)this).clone();
}
else if (this instanceof PacketLoginReceiveEvent) {
return ((PacketLoginReceiveEvent)this).clone();
}
else if (this instanceof PacketPlayReceiveEvent) {
return ((PacketPlayReceiveEvent)this).clone();
}
else {
return null;
try {
Object clonedBuffer = ByteBufHelper.retainedDuplicate(getByteBuf());
return new PacketReceiveEvent(getPacketId(), getPacketType(), getServerVersion(),
getChannel(), getUser(), getPlayer(), clonedBuffer);
} catch (PacketProcessException e) {
e.printStackTrace();
}
return null;
}
}
@@ -18,11 +18,10 @@
package com.github.retrooper.packetevents.event;
import com.github.retrooper.packetevents.event.simple.PacketLoginSendEvent;
import com.github.retrooper.packetevents.event.simple.PacketPlaySendEvent;
import com.github.retrooper.packetevents.event.simple.PacketStatusSendEvent;
import com.github.retrooper.packetevents.event.simple.PacketHandshakeSendEvent;
import com.github.retrooper.packetevents.exception.PacketProcessException;
import com.github.retrooper.packetevents.manager.server.ServerVersion;
import com.github.retrooper.packetevents.netty.buffer.ByteBufHelper;
import com.github.retrooper.packetevents.protocol.PacketSide;
import com.github.retrooper.packetevents.protocol.packettype.PacketTypeCommon;
import com.github.retrooper.packetevents.protocol.player.User;
@@ -32,6 +31,7 @@ import java.util.List;
public class PacketSendEvent extends ProtocolPacketEvent<Object> {
private List<Runnable> tasksAfterSend = null;
protected PacketSendEvent(Object channel, User user, Object player, Object rawByteBuf,
boolean autoProtocolTranslation) throws PacketProcessException {
super(PacketSide.SERVER, channel, user, player, rawByteBuf, autoProtocolTranslation);
@@ -65,17 +65,13 @@ public class PacketSendEvent extends ProtocolPacketEvent<Object> {
@Override
public PacketSendEvent clone() {
if (this instanceof PacketStatusSendEvent) {
return ((PacketStatusSendEvent)this).clone();
}
else if (this instanceof PacketLoginSendEvent) {
return ((PacketLoginSendEvent)this).clone();
}
else if (this instanceof PacketPlaySendEvent) {
return ((PacketPlaySendEvent)this).clone();
}
else {
return null;
try {
Object clonedBuffer = ByteBufHelper.retainedDuplicate(getByteBuf());
return new PacketSendEvent(getPacketId(), getPacketType(), getServerVersion(),
getChannel(), getUser(), getPlayer(), clonedBuffer);
} catch (PacketProcessException e) {
e.printStackTrace();
}
return null;
}
}
@@ -78,16 +78,17 @@ public abstract class ProtocolPacketEvent<T> extends PacketEvent implements Play
throw new PacketProcessException("Failed to read the Packet ID of a packet. (Size: " + size + ")");
}
ClientVersion version = serverVersion.toClientVersion();
this.packetType = PacketType.getById(packetSide, user.getConnectionState(),
ConnectionState state = packetSide == PacketSide.CLIENT ? user.getDecoderState() : user.getEncoderState();
this.packetType = PacketType.getById(packetSide, state,
version, packetID);
if (this.packetType == null) {
// mojang fucked up and keeps sending disconnect packets in the wrong protocol state
// mojang messed up and keeps sending disconnect packets in the wrong protocol state
if (PacketType.getById(packetSide, ConnectionState.PLAY, version, packetID) == PacketType.Play.Server.DISCONNECT) {
throw new InvalidDisconnectPacketSend();
}
throw new PacketProcessException("Failed to map the Packet ID " + packetID + " to a PacketType constant. Bound: " + packetSide.getOpposite() + ", Connection state: " + user.getConnectionState() + ", Server version: " + serverVersion.getReleaseName());
throw new PacketProcessException("Failed to map the Packet ID " + packetID + " to a PacketType constant. Bound: " + packetSide.getOpposite() + ", Connection state: " + user.getDecoderState() + ", Server version: " + serverVersion.getReleaseName());
}
this.connectionState = user.getConnectionState();
this.connectionState = state;
}
public ProtocolPacketEvent(int packetID, PacketTypeCommon packetType, ServerVersion serverVersion, Object channel,
@@ -99,7 +100,9 @@ public abstract class ProtocolPacketEvent<T> extends PacketEvent implements Play
this.byteBuf = byteBuf;
this.packetID = packetID;
this.packetType = packetType;
this.connectionState = user.getConnectionState();
this.connectionState = (packetType != null && packetType.getSide() == PacketSide.SERVER)
? user.getEncoderState() : user.getDecoderState();
cloned = true;
}
@@ -166,7 +169,6 @@ public abstract class ProtocolPacketEvent<T> extends PacketEvent implements Play
this.byteBuf = byteBuf;
}
@Deprecated
public int getPacketId() {
return packetID;
}
@@ -41,7 +41,11 @@ public abstract class SimplePacketListenerAbstract extends PacketListenerCommon
onPacketStatusReceive((PacketStatusReceiveEvent) event);
} else if (event instanceof PacketLoginReceiveEvent) {
onPacketLoginReceive((PacketLoginReceiveEvent) event);
} else if (event instanceof PacketPlayReceiveEvent) {
}
else if (event instanceof PacketConfigReceiveEvent) {
onPacketConfigReceive((PacketConfigReceiveEvent) event);
}
else if (event instanceof PacketPlayReceiveEvent) {
onPacketPlayReceive((PacketPlayReceiveEvent) event);
}
}
@@ -52,7 +56,11 @@ public abstract class SimplePacketListenerAbstract extends PacketListenerCommon
onPacketStatusSend((PacketStatusSendEvent) event);
} else if (event instanceof PacketLoginSendEvent) {
onPacketLoginSend((PacketLoginSendEvent) event);
} else if (event instanceof PacketPlaySendEvent) {
}
else if (event instanceof PacketConfigSendEvent) {
onPacketConfigSend((PacketConfigSendEvent) event);
}
else if (event instanceof PacketPlaySendEvent) {
onPacketPlaySend((PacketPlaySendEvent) event);
}
}
@@ -72,6 +80,12 @@ public abstract class SimplePacketListenerAbstract extends PacketListenerCommon
public void onPacketLoginSend(PacketLoginSendEvent event) {
}
public void onPacketConfigReceive(PacketConfigReceiveEvent event) {
}
public void onPacketConfigSend(PacketConfigSendEvent event) {
}
public void onPacketPlayReceive(PacketPlayReceiveEvent event) {
}
@@ -0,0 +1,59 @@
/*
* This file is part of packetevents - https://github.com/retrooper/packetevents
* Copyright (C) 2022 retrooper and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.github.retrooper.packetevents.event.simple;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.exception.PacketProcessException;
import com.github.retrooper.packetevents.manager.server.ServerVersion;
import com.github.retrooper.packetevents.netty.buffer.ByteBufHelper;
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
import com.github.retrooper.packetevents.protocol.packettype.PacketTypeCommon;
import com.github.retrooper.packetevents.protocol.player.User;
public class PacketConfigReceiveEvent extends PacketReceiveEvent {
public PacketConfigReceiveEvent(Object channel, User user,
Object player, Object rawByteBuf,
boolean autoProtocolTranslation) throws PacketProcessException {
super(channel, user, player, rawByteBuf, autoProtocolTranslation);
}
protected PacketConfigReceiveEvent(int packetId, PacketTypeCommon packetType,
ServerVersion serverVersion,
Object channel,
User user, Object player, Object byteBuf) throws PacketProcessException {
super(packetId, packetType, serverVersion, channel, user, player, byteBuf);
}
@Override
public PacketConfigReceiveEvent clone() {
try {
Object clonedBuffer = ByteBufHelper.retainedDuplicate(getByteBuf());
return new PacketConfigReceiveEvent(getPacketId(), getPacketType(), getServerVersion(),
getChannel(), getUser(), getPlayer(), clonedBuffer);
} catch (PacketProcessException e) {
e.printStackTrace();
}
return null;
}
public PacketType.Configuration.Client getPacketType() {
return (PacketType.Configuration.Client) super.getPacketType();
}
}
@@ -0,0 +1,59 @@
/*
* This file is part of packetevents - https://github.com/retrooper/packetevents
* Copyright (C) 2022 retrooper and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.github.retrooper.packetevents.event.simple;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import com.github.retrooper.packetevents.exception.PacketProcessException;
import com.github.retrooper.packetevents.manager.server.ServerVersion;
import com.github.retrooper.packetevents.netty.buffer.ByteBufHelper;
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
import com.github.retrooper.packetevents.protocol.packettype.PacketTypeCommon;
import com.github.retrooper.packetevents.protocol.player.User;
public class PacketConfigSendEvent extends PacketSendEvent {
public PacketConfigSendEvent(Object channel, User user,
Object player, Object rawByteBuf,
boolean autoProtocolTranslation) throws PacketProcessException {
super(channel, user, player, rawByteBuf, autoProtocolTranslation);
}
protected PacketConfigSendEvent(int packetId, PacketTypeCommon packetType,
ServerVersion serverVersion,
Object channel,
User user, Object player, Object byteBuf) throws PacketProcessException {
super(packetId, packetType, serverVersion, channel, user, player, byteBuf);
}
@Override
public PacketConfigSendEvent clone() {
try {
Object clonedBuffer = ByteBufHelper.retainedDuplicate(getByteBuf());
return new PacketConfigSendEvent(getPacketId(), getPacketType(), getServerVersion(),
getChannel(), getUser(), getPlayer(), clonedBuffer);
} catch (PacketProcessException e) {
e.printStackTrace();
}
return null;
}
public PacketType.Configuration.Server getPacketType() {
return (PacketType.Configuration.Server) super.getPacketType();
}
}
@@ -32,4 +32,6 @@ public interface ChannelInjector {
void updateUser(Object channel, User user);
void setPlayer(Object channel, Object player);
boolean isProxy();
}
@@ -32,6 +32,7 @@ import com.github.retrooper.packetevents.protocol.packettype.PacketType;
import com.github.retrooper.packetevents.protocol.player.ClientVersion;
import com.github.retrooper.packetevents.protocol.player.User;
import com.github.retrooper.packetevents.protocol.player.UserProfile;
import com.github.retrooper.packetevents.wrapper.configuration.server.WrapperConfigServerRegistryData;
import com.github.retrooper.packetevents.wrapper.handshaking.client.WrapperHandshakingClientHandshake;
import com.github.retrooper.packetevents.wrapper.login.server.WrapperLoginServerLoginSuccess;
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerJoinGame;
@@ -71,14 +72,32 @@ public class InternalPacketListener extends PacketListenerAbstract {
PacketEvents.getAPI().getLogManager().debug("Mapped player UUID with their channel.");
//Switch the user's connection state to PLAY, but the variable event.getConnectionState() remains LOGIN
//We switch user state immediately to remain in sync with vanilla, allowing you to send PLAY packets immediately
user.setConnectionState(ConnectionState.PLAY);
PacketEvents.getAPI().getLogManager().debug("Transitioned " + profile.getName() + " into the PLAY state!");
// Switch the user's connection state to new state, but the variable event.getConnectionState() remains LOGIN
// We switch user state immediately to remain in sync with vanilla, allowing you to encode packets immediately
boolean proxy = PacketEvents.getAPI().getInjector().isProxy();
if (proxy ? event.getUser().getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_20_2)
: event.getServerVersion().isNewerThanOrEquals(ServerVersion.V_1_20_2)) {
user.setEncoderState(ConnectionState.CONFIGURATION);
} else {
user.setConnectionState(ConnectionState.PLAY);
}
}
// Join game can be used to update world height, and sets dimension data
// The server sends dimension information in configuration phase >= 1.20.2
else if (event.getPacketType() == PacketType.Configuration.Server.REGISTRY_DATA) {
WrapperConfigServerRegistryData registryData = new WrapperConfigServerRegistryData(event);
// Store world data
NBTCompound registryDataTag = registryData.getRegistryData();
if (registryDataTag != null) {
NBTList<NBTCompound> list = registryDataTag
.getCompoundTagOrNull("minecraft:dimension_type")
.getCompoundListTagOrNull("value");
user.setWorldNBT(list);
}
}
// The server sends dimension information in login packet for >= 1.17 and < 1.20.2
else if (event.getPacketType() == PacketType.Play.Server.JOIN_GAME) {
WrapperPlayServerJoinGame joinGame = new WrapperPlayServerJoinGame(event);
user.setEntityId(joinGame.getEntityId());
@@ -87,14 +106,22 @@ public class InternalPacketListener extends PacketListenerAbstract {
return; // Fixed world height, no tags are sent to the client
}
// Store world height
NBTList<NBTCompound> list = joinGame.getDimensionCodec().getCompoundTagOrNull("minecraft:dimension_type").getCompoundListTagOrNull("value");
user.setWorldNBT(list);
// Store world data
NBTCompound dimensionCodec = joinGame.getDimensionCodec();
if (dimensionCodec != null) {
NBTList<NBTCompound> list = dimensionCodec
.getCompoundTagOrNull("minecraft:dimension_type")
.getCompoundListTagOrNull("value");
user.setWorldNBT(list);
}
// Update world height
NBTCompound worldNBT = user.getWorldNBT(joinGame.getDimension().getDimensionName()).getCompoundTagOrNull("element");
user.setMinWorldHeight(worldNBT.getNumberTagOrNull("min_y").getAsInt());
user.setTotalWorldHeight(worldNBT.getNumberTagOrNull("height").getAsInt());
NBTCompound dimension = user.getWorldNBT(joinGame.getDimension().getDimensionName());
if (dimension != null) {
NBTCompound worldNBT = dimension.getCompoundTagOrNull("element");
user.setMinWorldHeight(worldNBT.getNumberTagOrNull("min_y").getAsInt());
user.setTotalWorldHeight(worldNBT.getNumberTagOrNull("height").getAsInt());
}
}
// Respawn is used to switch dimensions
@@ -105,9 +132,16 @@ public class InternalPacketListener extends PacketListenerAbstract {
return; // Fixed world height, no tags are sent to the client
}
NBTCompound worldNBT = user.getWorldNBT(respawn.getDimension().getDimensionName()).getCompoundTagOrNull("element"); // This is 1.17+, it always sends the world name
user.setMinWorldHeight(worldNBT.getNumberTagOrNull("min_y").getAsInt());
user.setTotalWorldHeight(worldNBT.getNumberTagOrNull("height").getAsInt());
NBTCompound dimension = user.getWorldNBT(respawn.getDimension().getDimensionName());
if (dimension != null) {
NBTCompound worldNBT = dimension.getCompoundTagOrNull("element"); // This is 1.17+, it always sends the world name
user.setMinWorldHeight(worldNBT.getNumberTagOrNull("min_y").getAsInt());
user.setTotalWorldHeight(worldNBT.getNumberTagOrNull("height").getAsInt());
}
} else if (event.getPacketType() == PacketType.Play.Server.CONFIGURATION_START) {
user.setEncoderState(ConnectionState.CONFIGURATION);
} else if (event.getPacketType() == PacketType.Configuration.Server.CONFIGURATION_END) {
user.setEncoderState(ConnectionState.PLAY);
}
}
@@ -125,7 +159,12 @@ public class InternalPacketListener extends PacketListenerAbstract {
PacketEvents.getAPI().getLogManager().debug("Processed " + address.getHostString() + ":" + address.getPort() + "'s client version. Client Version: " + clientVersion.getReleaseName());
//Transition into LOGIN or STATUS connection state immediately, to remain in sync with vanilla
user.setConnectionState(nextState);
PacketEvents.getAPI().getLogManager().debug("Transitioned " + address.getHostString() + ":" + address.getPort() + " into the " + nextState + " state!");
} else if (event.getPacketType() == PacketType.Login.Client.LOGIN_SUCCESS_ACK) {
user.setDecoderState(ConnectionState.CONFIGURATION);
} else if (event.getPacketType() == PacketType.Play.Client.CONFIGURATION_ACK) {
user.setDecoderState(ConnectionState.CONFIGURATION);
} else if (event.getPacketType() == PacketType.Configuration.Client.CONFIGURATION_END_ACK) {
user.setDecoderState(ConnectionState.PLAY);
}
}
}
}
@@ -25,6 +25,7 @@ import com.github.retrooper.packetevents.protocol.player.ClientVersion;
import com.github.retrooper.packetevents.protocol.player.User;
import com.github.retrooper.packetevents.util.PacketTransformationUtil;
import com.github.retrooper.packetevents.wrapper.PacketWrapper;
import org.jetbrains.annotations.ApiStatus;
import java.util.Collection;
import java.util.Map;
@@ -96,13 +97,14 @@ public interface ProtocolManager {
getUser(channel).setClientVersion(version);
}
default Object[] transformWrappers(PacketWrapper<?> wrapper, Object channel) {
@ApiStatus.Internal
default Object[] transformWrappers(PacketWrapper<?> wrapper, Object channel, boolean outgoing) {
//It is possible that our packet transformer util decides to transform one wrapper into multiple packets.
//(Correcting some mistakes on your end)
PacketWrapper<?>[] wrappers = PacketTransformationUtil.transform(wrapper);
Object[] buffers = new Object[wrappers.length];
for (int i = 0; i < wrappers.length; i++) {
wrappers[i].prepareForSend(channel);
wrappers[i].prepareForSend(channel, outgoing);
buffers[i] = wrappers[i].buffer;
// Fix race condition when sending packets to multiple people (due to when the buffer is freed)
wrappers[i].buffer = null;
@@ -111,32 +113,32 @@ public interface ProtocolManager {
}
default void sendPacket(Object channel, PacketWrapper<?> wrapper) {
Object[] transformed = transformWrappers(wrapper, channel);
Object[] transformed = transformWrappers(wrapper, channel, true);
sendPackets(channel, transformed);
}
default void sendPacketSilently(Object channel, PacketWrapper<?> wrapper) {
Object[] transformed = transformWrappers(wrapper, channel);
Object[] transformed = transformWrappers(wrapper, channel, true);
sendPacketsSilently(channel, transformed);
}
default void writePacket(Object channel, PacketWrapper<?> wrapper) {
Object[] transformed = transformWrappers(wrapper, channel);
Object[] transformed = transformWrappers(wrapper, channel, true);
writePackets(channel, transformed);
}
default void writePacketSilently(Object channel, PacketWrapper<?> wrapper) {
Object[] transformed = transformWrappers(wrapper, channel);
Object[] transformed = transformWrappers(wrapper, channel, true);
writePacketsSilently(channel, transformed);
}
default void receivePacket(Object channel, PacketWrapper<?> wrapper) {
Object[] transformed = transformWrappers(wrapper, channel);
Object[] transformed = transformWrappers(wrapper, channel, false);
receivePackets(channel, transformed);
}
default void receivePacketSilently(Object channel, PacketWrapper<?> wrapper) {
Object[] transformed = transformWrappers(wrapper, channel);
Object[] transformed = transformWrappers(wrapper, channel, false);
receivePacketsSilently(channel, transformed);
}
@@ -47,8 +47,8 @@ public enum ServerVersion {
V_1_18(757), V_1_18_1(757), V_1_18_2(758),
//1.19.1 and 1.19.2 have the same protocol version
V_1_19(759), V_1_19_1(760), V_1_19_2(760), V_1_19_3(761), V_1_19_4(762),
//1.20 and 1.20.1 have the same protocol version
V_1_20(763), V_1_20_1(763),
//1.20 and 1.20.1 have the same protocol version. 1.20.3 and 1.20.4 have the same protocol version.
V_1_20(763), V_1_20_1(763), V_1_20_2(764), V_1_20_3(765), V_1_20_4(765),
//TODO UPDATE Add server version constant
ERROR(-1, true);
@@ -23,7 +23,7 @@ package com.github.retrooper.packetevents.protocol;
* @since 1.8
*/
public enum ConnectionState {
HANDSHAKING, STATUS, LOGIN, PLAY;
HANDSHAKING, STATUS, LOGIN, PLAY, CONFIGURATION;
public static ConnectionState getById(int id) {
if (id >= values().length || id < 0) {
@@ -93,70 +93,71 @@ public class Parsers {
packetWrapper -> Collections.singletonList(packetWrapper.readVarInt()),
(packetWrapper, properties) -> packetWrapper.writeVarInt((Integer) properties.get(0))
),
new Parser("brigadier:entity",
new Parser("minecraft:entity",
packetWrapper -> Collections.singletonList(packetWrapper.readByte()),
(packetWrapper, properties) -> packetWrapper.writeByte(((Byte) properties.get(0)).intValue())
),
new Parser("brigadier:game_profile", null, null),
new Parser("brigadier:block_pos", null, null),
new Parser("brigadier:column_pos", null, null),
new Parser("brigadier:vec3", null, null),
new Parser("brigadier:vec2", null, null),
new Parser("brigadier:block_state", null, null),
new Parser("brigadier:block_predicate", null, null),
new Parser("brigadier:item_stack", null, null),
new Parser("brigadier:item_predicate", null, null),
new Parser("brigadier:color", null, null),
new Parser("brigadier:component", null, null),
new Parser("brigadier:message", null, null),
new Parser("brigadier:nbt", null, null),
new Parser("brigadier:nbt_tag", null, null),
new Parser("brigadier:nbt_path", null, null),
new Parser("brigadier:objective", null, null),
new Parser("brigadier:objective_criteria", null, null),
new Parser("brigadier:operation", null, null),
new Parser("brigadier:particle", null, null),
new Parser("brigadier:angle", null, null),
new Parser("brigadier:rotation", null, null),
new Parser("brigadier:scoreboard_slot", null, null),
new Parser("brigadier:score_holder",
new Parser("minecraft:game_profile", null, null),
new Parser("minecraft:block_pos", null, null),
new Parser("minecraft:column_pos", null, null),
new Parser("minecraft:vec3", null, null),
new Parser("minecraft:vec2", null, null),
new Parser("minecraft:block_state", null, null),
new Parser("minecraft:block_predicate", null, null),
new Parser("minecraft:item_stack", null, null),
new Parser("minecraft:item_predicate", null, null),
new Parser("minecraft:color", null, null),
new Parser("minecraft:component", null, null),
new Parser("minecraft:style", null, null),
new Parser("minecraft:message", null, null),
new Parser("minecraft:nbt", null, null),
new Parser("minecraft:nbt_tag", null, null),
new Parser("minecraft:nbt_path", null, null),
new Parser("minecraft:objective", null, null),
new Parser("minecraft:objective_criteria", null, null),
new Parser("minecraft:operation", null, null),
new Parser("minecraft:particle", null, null),
new Parser("minecraft:angle", null, null),
new Parser("minecraft:rotation", null, null),
new Parser("minecraft:scoreboard_slot", null, null),
new Parser("minecraft:score_holder",
packetWrapper -> Collections.singletonList(packetWrapper.readByte()),
(packetWrapper, properties) -> packetWrapper.writeByte(((Byte) properties.get(0)).intValue())
),
new Parser("brigadier:swizzle", null, null),
new Parser("brigadier:team", null, null),
new Parser("brigadier:item_slot", null, null),
new Parser("brigadier:resource_location", null, null),
new Parser("brigadier:function", null, null),
new Parser("brigadier:entity_anchor", null, null),
new Parser("brigadier:int_range", null, null),
new Parser("brigadier:float_range", null, null),
new Parser("brigadier:dimension", null, null),
new Parser("brigadier:gamemode", null, null),
new Parser("brigadier:time",
new Parser("minecraft:swizzle", null, null),
new Parser("minecraft:team", null, null),
new Parser("minecraft:item_slot", null, null),
new Parser("minecraft:resource_location", null, null),
new Parser("minecraft:function", null, null),
new Parser("minecraft:entity_anchor", null, null),
new Parser("minecraft:int_range", null, null),
new Parser("minecraft:float_range", null, null),
new Parser("minecraft:dimension", null, null),
new Parser("minecraft:gamemode", null, null),
new Parser("minecraft:time",
packetWrapper -> Collections.singletonList(packetWrapper.readInt()),
(packetWrapper, properties) -> packetWrapper.writeInt((int) properties.get(0))
),
new Parser("brigadier:resource_or_tag",
new Parser("minecraft:resource_or_tag",
packetWrapper -> Collections.singletonList(packetWrapper.readIdentifier()),
(packetWrapper, properties) -> packetWrapper.writeIdentifier((ResourceLocation) properties.get(0))
),
new Parser("brigadier:resource_or_tag_key",
new Parser("minecraft:resource_or_tag_key",
packetWrapper -> Collections.singletonList(packetWrapper.readIdentifier()),
(packetWrapper, properties) -> packetWrapper.writeIdentifier((ResourceLocation) properties.get(0))
),
new Parser("brigadier:resource",
new Parser("minecraft:resource",
packetWrapper -> Collections.singletonList(packetWrapper.readIdentifier()),
(packetWrapper, properties) -> packetWrapper.writeIdentifier((ResourceLocation) properties.get(0))
),
new Parser("brigadier:resource_key",
new Parser("minecraft:resource_key",
packetWrapper -> Collections.singletonList(packetWrapper.readIdentifier()),
(packetWrapper, properties) -> packetWrapper.writeIdentifier((ResourceLocation) properties.get(0))
),
new Parser("brigadier:template_mirror", null, null),
new Parser("brigadier:template_rotation", null, null),
new Parser("brigadier:heightmap", null, null),
new Parser("brigadier:uuid", null, null)
new Parser("minecraft:template_mirror", null, null),
new Parser("minecraft:template_rotation", null, null),
new Parser("minecraft:heightmap", null, null),
new Parser("minecraft:uuid", null, null)
);
public static List<Parser> getParsers() {
@@ -32,8 +32,13 @@ import com.github.retrooper.packetevents.protocol.player.ClientVersion;
import com.github.retrooper.packetevents.protocol.world.BlockFace;
import com.github.retrooper.packetevents.protocol.world.WorldBlockPosition;
import com.github.retrooper.packetevents.resources.ResourceLocation;
import com.github.retrooper.packetevents.util.*;
import com.github.retrooper.packetevents.util.Quaternion4f;
import com.github.retrooper.packetevents.util.TypesBuilder;
import com.github.retrooper.packetevents.util.TypesBuilderData;
import com.github.retrooper.packetevents.util.Vector3f;
import com.github.retrooper.packetevents.util.Vector3i;
import com.github.retrooper.packetevents.wrapper.PacketWrapper;
import net.kyori.adventure.text.Component;
import java.util.HashMap;
import java.util.Map;
@@ -84,9 +89,13 @@ public class EntityDataTypes {
public static final EntityDataType<String> STRING = define("string", PacketWrapper::readString, PacketWrapper::writeString);
@Deprecated
public static final EntityDataType<String> COMPONENT = define("component", PacketWrapper::readComponentJSON, PacketWrapper::writeComponentJSON);
public static final EntityDataType<Component> ADV_COMPONENT = define("component", PacketWrapper::readComponent, PacketWrapper::writeComponent);
public static final EntityDataType<Optional<String>> OPTIONAL_COMPONENT = define("optional_component", readOptionalComponentDeserializer(), writeOptionalComponentSerializer());
@Deprecated
public static final EntityDataType<Optional<String>> OPTIONAL_COMPONENT = define("optional_component", readOptionalComponentJSONDeserializer(), writeOptionalComponentJSONSerializer());
public static final EntityDataType<Optional<Component>> OPTIONAL_ADV_COMPONENT = define("optional_component", readOptionalComponentDeserializer(), writeOptionalComponentSerializer());
public static final EntityDataType<ItemStack> ITEMSTACK = define("itemstack", PacketWrapper::readItemStack, PacketWrapper::writeItemStack);
@@ -256,26 +265,44 @@ public class EntityDataTypes {
};
}
private static <T> Function<PacketWrapper<?>, T> readOptionalComponentDeserializer() {
@Deprecated
private static Function<PacketWrapper<?>, Optional<String>> readOptionalComponentJSONDeserializer() {
return (PacketWrapper<?> wrapper) -> {
if (wrapper.readBoolean()) {
return (T) Optional.of(wrapper.readString());
return Optional.of(wrapper.readComponentJSON());
} else {
return (T) Optional.empty();
return Optional.empty();
}
};
}
private static <T> BiConsumer<PacketWrapper<?>, T> writeOptionalComponentSerializer() {
return (PacketWrapper<?> wrapper, T value) -> {
if (value instanceof Optional) {
Optional<String> optional = (Optional<String>) value;
if (optional.isPresent()) {
wrapper.writeBoolean(true);
wrapper.writeString(optional.get());
} else {
wrapper.writeBoolean(false);
}
@Deprecated
private static BiConsumer<PacketWrapper<?>, Optional<String>> writeOptionalComponentJSONSerializer() {
return (PacketWrapper<?> wrapper, Optional<String> value) -> {
if (value != null && value.isPresent()) {
wrapper.writeBoolean(true);
wrapper.writeComponentJSON(value.get());
} else {
wrapper.writeBoolean(false);
}
};
}
private static Function<PacketWrapper<?>, Optional<Component>> readOptionalComponentDeserializer() {
return (PacketWrapper<?> wrapper) -> {
if (wrapper.readBoolean()) {
return Optional.of(wrapper.readComponent());
} else {
return Optional.empty();
}
};
}
private static BiConsumer<PacketWrapper<?>, Optional<Component>> writeOptionalComponentSerializer() {
return (PacketWrapper<?> wrapper, Optional<Component> value) -> {
if (value != null && value.isPresent()) {
wrapper.writeBoolean(true);
wrapper.writeComponent(value.get());
} else {
wrapper.writeBoolean(false);
}
@@ -0,0 +1,35 @@
package com.github.retrooper.packetevents.protocol.entity.data;
import com.github.retrooper.packetevents.protocol.player.ClientVersion;
import java.util.List;
/**
* This is an interface that provides a list of entity data.
* This allows custom addon libraries to implement metadata classes for various entities
* which can then be used in our API.
* @since 2.1.0
*/
public interface EntityMetadataProvider {
/**
* PacketEvents is retrieving the metadata of this specific entity.
* PacketEvents provides you with the protocol version that the library is running on
* to allow you tu specify different metadata depending on the version.
* You are free to ignore it at the cost of your features not working on all versions.
* @param version The protocol version of the format we expect the metadata to be in.
* @return Metadata (list of entity data)
*/
List<EntityData> entityData(ClientVersion version);
/**
* Similar to {@link #entityData(ClientVersion)} but does not provide a protocol version.
* It is not advised to use nor implement this.
* It is deprecated because it restricts you by not providing you the format in which the metadata should be.
* @return Metadata (list of entity data)
* @deprecated Does not specify format of metadata, therefore not advised to use this. It will assume the current latest version.
*/
@Deprecated
default List<EntityData> entityData() {
return entityData(ClientVersion.getLatest());
}
}
@@ -45,7 +45,8 @@ public class EntityTypes {
ClientVersion.V_1_17,
ClientVersion.V_1_19,
ClientVersion.V_1_19_3,
ClientVersion.V_1_19_4);
ClientVersion.V_1_19_4,
ClientVersion.V_1_20_3);
private static final TypesBuilder LEGACY_TYPES_BUILDER = new TypesBuilder("entity/legacy_entity_type_mappings",
ClientVersion.V_1_8,
ClientVersion.V_1_9,
@@ -301,11 +302,16 @@ public class EntityTypes {
public static final EntityType MINECART_TNT = define("minecart_tnt", MINECART_ABSTRACT);
public static final EntityType MINECART_HOPPER = define("minecart_hopper", MINECART_ABSTRACT);
public static final EntityType MINECART_MOB_SPAWNER = define("minecart_mob_spawner", MINECART_ABSTRACT);
// Display type entities added in 1.19.4
// Added in 1.19.4
public static final EntityType DISPLAY = define("display", ENTITY);
public static final EntityType BLOCK_DISPLAY = define("block_display", DISPLAY);
public static final EntityType ITEM_DISPLAY = define("item_display", DISPLAY);
public static final EntityType TEXT_DISPLAY = define("text_display", DISPLAY);
public static final EntityType INTERACTION = define("interaction", DISPLAY);
public static final EntityType SNIFFER = define("sniffer", ABSTRACT_ANIMAL);
// Added in 1.20.3
public static final EntityType BREEZE = define("breeze", ABSTRACT_MONSTER);
public static final EntityType WIND_CHARGE = define("wind_charge", PROJECTILE_ABSTRACT);
}
@@ -27,7 +27,14 @@ import com.github.retrooper.packetevents.util.TypesBuilderData;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.*;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
public class ItemTypes {
@@ -47,7 +54,8 @@ public class ItemTypes {
ClientVersion.V_1_19,
ClientVersion.V_1_19_3,
ClientVersion.V_1_19_4,
ClientVersion.V_1_20);
ClientVersion.V_1_20,
ClientVersion.V_1_20_3);
public static final ItemType GILDED_BLACKSTONE = builder("gilded_blackstone").setMaxAmount(64).setPlacedType(StateTypes.GILDED_BLACKSTONE).build();
public static final ItemType NETHER_BRICK_SLAB = builder("nether_brick_slab").setMaxAmount(64).setPlacedType(StateTypes.NETHER_BRICK_SLAB).build();
@@ -628,7 +636,11 @@ public class ItemTypes {
public static final ItemType RAW_COPPER_BLOCK = builder("raw_copper_block").setMaxAmount(64).setPlacedType(StateTypes.RAW_COPPER_BLOCK).build();
public static final ItemType LIGHT_GRAY_CARPET = builder("light_gray_carpet").setMaxAmount(64).setAttributes(ItemAttribute.FUEL).setPlacedType(StateTypes.LIGHT_GRAY_CARPET).build();
public static final ItemType MUSIC_DISC_WARD = builder("music_disc_ward").setMaxAmount(1).setAttributes(ItemAttribute.MUSIC_DISC).build();
public static final ItemType GRASS = builder("grass").setMaxAmount(64).setPlacedType(StateTypes.GRASS).build();
public static final ItemType SHORT_GRASS = builder("short_grass").setMaxAmount(64).setPlacedType(StateTypes.SHORT_GRASS).build();
@Deprecated
public static final ItemType GRASS = SHORT_GRASS;
public static final ItemType END_CRYSTAL = builder("end_crystal").setMaxAmount(64).build();
public static final ItemType VINDICATOR_SPAWN_EGG = builder("vindicator_spawn_egg").setMaxAmount(64).build();
public static final ItemType WHEAT = builder("wheat").setMaxAmount(64).build();
@@ -1310,6 +1322,66 @@ public class ItemTypes {
public static ItemType SHELTER_POTTERY_SHERD = builder("SHELTER_POTTERY_SHERD").setMaxAmount(64).build();
public static ItemType SKULL_POTTERY_SHERD = builder("SKULL_POTTERY_SHERD").setMaxAmount(64).build();
public static ItemType SNORT_POTTERY_SHERD = builder("SNORT_POTTERY_SHERD").setMaxAmount(64).build();
// 1.20.3 items
public static ItemType TUFF_SLAB = builder("tuff_slab").setMaxAmount(64).setPlacedType(StateTypes.TUFF_SLAB).build();
public static ItemType TUFF_STAIRS = builder("tuff_stairs").setMaxAmount(64).setPlacedType(StateTypes.TUFF_STAIRS).build();
public static ItemType TUFF_WALL = builder("tuff_wall").setMaxAmount(64).setPlacedType(StateTypes.TUFF_WALL).build();
public static ItemType CHISELED_TUFF = builder("chiseled_tuff").setMaxAmount(64).setPlacedType(StateTypes.CHISELED_TUFF).build();
public static ItemType POLISHED_TUFF = builder("polished_tuff").setMaxAmount(64).setPlacedType(StateTypes.POLISHED_TUFF).build();
public static ItemType POLISHED_TUFF_SLAB = builder("polished_tuff_slab").setMaxAmount(64).setPlacedType(StateTypes.POLISHED_TUFF_SLAB).build();
public static ItemType POLISHED_TUFF_STAIRS = builder("polished_tuff_stairs").setMaxAmount(64).setPlacedType(StateTypes.POLISHED_TUFF_STAIRS).build();
public static ItemType POLISHED_TUFF_WALL = builder("polished_tuff_wall").setMaxAmount(64).setPlacedType(StateTypes.POLISHED_TUFF_WALL).build();
public static ItemType TUFF_BRICKS = builder("tuff_bricks").setMaxAmount(64).setPlacedType(StateTypes.TUFF_BRICKS).build();
public static ItemType TUFF_BRICK_SLAB = builder("tuff_brick_slab").setMaxAmount(64).setPlacedType(StateTypes.TUFF_BRICK_SLAB).build();
public static ItemType TUFF_BRICK_STAIRS = builder("tuff_brick_stairs").setMaxAmount(64).setPlacedType(StateTypes.TUFF_BRICK_STAIRS).build();
public static ItemType TUFF_BRICK_WALL = builder("tuff_brick_wall").setMaxAmount(64).setPlacedType(StateTypes.TUFF_BRICK_WALL).build();
public static ItemType CHISELED_TUFF_BRICKS = builder("chiseled_tuff_bricks").setMaxAmount(64).setPlacedType(StateTypes.CHISELED_TUFF_BRICKS).build();
public static ItemType CHISELED_COPPER = builder("chiseled_copper").setMaxAmount(64).setPlacedType(StateTypes.CHISELED_COPPER).build();
public static ItemType EXPOSED_CHISELED_COPPER = builder("exposed_chiseled_copper").setMaxAmount(64).setPlacedType(StateTypes.EXPOSED_CHISELED_COPPER).build();
public static ItemType WEATHERED_CHISELED_COPPER = builder("weathered_chiseled_copper").setMaxAmount(64).setPlacedType(StateTypes.WEATHERED_CHISELED_COPPER).build();
public static ItemType OXIDIZED_CHISELED_COPPER = builder("oxidized_chiseled_copper").setMaxAmount(64).setPlacedType(StateTypes.OXIDIZED_CHISELED_COPPER).build();
public static ItemType WAXED_CHISELED_COPPER = builder("waxed_chiseled_copper").setMaxAmount(64).setPlacedType(StateTypes.WAXED_CHISELED_COPPER).build();
public static ItemType WAXED_EXPOSED_CHISELED_COPPER = builder("waxed_exposed_chiseled_copper").setMaxAmount(64).setPlacedType(StateTypes.WAXED_EXPOSED_CHISELED_COPPER).build();
public static ItemType WAXED_WEATHERED_CHISELED_COPPER = builder("waxed_weathered_chiseled_copper").setMaxAmount(64).setPlacedType(StateTypes.WAXED_WEATHERED_CHISELED_COPPER).build();
public static ItemType WAXED_OXIDIZED_CHISELED_COPPER = builder("waxed_oxidized_chiseled_copper").setMaxAmount(64).setPlacedType(StateTypes.WAXED_OXIDIZED_CHISELED_COPPER).build();
public static ItemType COPPER_DOOR = builder("copper_door").setMaxAmount(64).setPlacedType(StateTypes.COPPER_DOOR).build();
public static ItemType EXPOSED_COPPER_DOOR = builder("exposed_copper_door").setMaxAmount(64).setPlacedType(StateTypes.EXPOSED_COPPER_DOOR).build();
public static ItemType WEATHERED_COPPER_DOOR = builder("weathered_copper_door").setMaxAmount(64).setPlacedType(StateTypes.WEATHERED_COPPER_DOOR).build();
public static ItemType OXIDIZED_COPPER_DOOR = builder("oxidized_copper_door").setMaxAmount(64).setPlacedType(StateTypes.OXIDIZED_COPPER_DOOR).build();
public static ItemType WAXED_COPPER_DOOR = builder("waxed_copper_door").setMaxAmount(64).setPlacedType(StateTypes.WAXED_COPPER_DOOR).build();
public static ItemType WAXED_EXPOSED_COPPER_DOOR = builder("waxed_exposed_copper_door").setMaxAmount(64).setPlacedType(StateTypes.WAXED_EXPOSED_COPPER_DOOR).build();
public static ItemType WAXED_WEATHERED_COPPER_DOOR = builder("waxed_weathered_copper_door").setMaxAmount(64).setPlacedType(StateTypes.WAXED_WEATHERED_COPPER_DOOR).build();
public static ItemType WAXED_OXIDIZED_COPPER_DOOR = builder("waxed_oxidized_copper_door").setMaxAmount(64).setPlacedType(StateTypes.WAXED_OXIDIZED_COPPER_DOOR).build();
public static ItemType COPPER_TRAPDOOR = builder("copper_trapdoor").setMaxAmount(64).setPlacedType(StateTypes.COPPER_TRAPDOOR).build();
public static ItemType EXPOSED_COPPER_TRAPDOOR = builder("exposed_copper_trapdoor").setMaxAmount(64).setPlacedType(StateTypes.EXPOSED_COPPER_TRAPDOOR).build();
public static ItemType WEATHERED_COPPER_TRAPDOOR = builder("weathered_copper_trapdoor").setMaxAmount(64).setPlacedType(StateTypes.WEATHERED_COPPER_TRAPDOOR).build();
public static ItemType OXIDIZED_COPPER_TRAPDOOR = builder("oxidized_copper_trapdoor").setMaxAmount(64).setPlacedType(StateTypes.OXIDIZED_COPPER_TRAPDOOR).build();
public static ItemType WAXED_COPPER_TRAPDOOR = builder("waxed_copper_trapdoor").setMaxAmount(64).setPlacedType(StateTypes.WAXED_COPPER_TRAPDOOR).build();
public static ItemType WAXED_EXPOSED_COPPER_TRAPDOOR = builder("waxed_exposed_copper_trapdoor").setMaxAmount(64).setPlacedType(StateTypes.WAXED_EXPOSED_COPPER_TRAPDOOR).build();
public static ItemType WAXED_WEATHERED_COPPER_TRAPDOOR = builder("waxed_weathered_copper_trapdoor").setMaxAmount(64).setPlacedType(StateTypes.WAXED_WEATHERED_COPPER_TRAPDOOR).build();
public static ItemType WAXED_OXIDIZED_COPPER_TRAPDOOR = builder("waxed_oxidized_copper_trapdoor").setMaxAmount(64).setPlacedType(StateTypes.WAXED_OXIDIZED_COPPER_TRAPDOOR).build();
public static ItemType CRAFTER = builder("crafter").setMaxAmount(64).setPlacedType(StateTypes.CRAFTER).build();
public static ItemType BREEZE_SPAWN_EGG = builder("breeze_spawn_egg").setMaxAmount(64).build();
public static ItemType COPPER_GRATE = builder("copper_grate").setMaxAmount(64).setPlacedType(StateTypes.COPPER_GRATE).build();
public static ItemType EXPOSED_COPPER_GRATE = builder("exposed_copper_grate").setMaxAmount(64).setPlacedType(StateTypes.EXPOSED_COPPER_GRATE).build();
public static ItemType WEATHERED_COPPER_GRATE = builder("weathered_copper_grate").setMaxAmount(64).setPlacedType(StateTypes.WEATHERED_COPPER_GRATE).build();
public static ItemType OXIDIZED_COPPER_GRATE = builder("oxidized_copper_grate").setMaxAmount(64).setPlacedType(StateTypes.OXIDIZED_COPPER_GRATE).build();
public static ItemType WAXED_COPPER_GRATE = builder("waxed_copper_grate").setMaxAmount(64).setPlacedType(StateTypes.WAXED_COPPER_GRATE).build();
public static ItemType WAXED_EXPOSED_COPPER_GRATE = builder("waxed_exposed_copper_grate").setMaxAmount(64).setPlacedType(StateTypes.WAXED_EXPOSED_COPPER_GRATE).build();
public static ItemType WAXED_WEATHERED_COPPER_GRATE = builder("waxed_weathered_copper_grate").setMaxAmount(64).setPlacedType(StateTypes.WAXED_WEATHERED_COPPER_GRATE).build();
public static ItemType WAXED_OXIDIZED_COPPER_GRATE = builder("waxed_oxidized_copper_grate").setMaxAmount(64).setPlacedType(StateTypes.WAXED_OXIDIZED_COPPER_GRATE).build();
public static ItemType COPPER_BULB = builder("copper_bulb").setMaxAmount(64).setPlacedType(StateTypes.COPPER_BULB).build();
public static ItemType EXPOSED_COPPER_BULB = builder("exposed_copper_bulb").setMaxAmount(64).setPlacedType(StateTypes.EXPOSED_COPPER_BULB).build();
public static ItemType WEATHERED_COPPER_BULB = builder("weathered_copper_bulb").setMaxAmount(64).setPlacedType(StateTypes.WEATHERED_COPPER_BULB).build();
public static ItemType OXIDIZED_COPPER_BULB = builder("oxidized_copper_bulb").setMaxAmount(64).setPlacedType(StateTypes.OXIDIZED_COPPER_BULB).build();
public static ItemType WAXED_COPPER_BULB = builder("waxed_copper_bulb").setMaxAmount(64).setPlacedType(StateTypes.WAXED_COPPER_BULB).build();
public static ItemType WAXED_EXPOSED_COPPER_BULB = builder("waxed_exposed_copper_bulb").setMaxAmount(64).setPlacedType(StateTypes.WAXED_EXPOSED_COPPER_BULB).build();
public static ItemType WAXED_WEATHERED_COPPER_BULB = builder("waxed_weathered_copper_bulb").setMaxAmount(64).setPlacedType(StateTypes.WAXED_WEATHERED_COPPER_BULB).build();
public static ItemType WAXED_OXIDIZED_COPPER_BULB = builder("waxed_oxidized_copper_bulb").setMaxAmount(64).setPlacedType(StateTypes.WAXED_OXIDIZED_COPPER_BULB).build();
public static ItemType TRIAL_SPAWNER = builder("trial_spawner").setMaxAmount(64).setPlacedType(StateTypes.TRIAL_SPAWNER).build();
public static ItemType TRIAL_KEY = builder("trial_key").setMaxAmount(64).build();
/**
* @deprecated Burning furnace shows up as a missing texture, removed in 1.9
*/
@@ -1318,14 +1390,17 @@ public class ItemTypes {
/**
* @deprecated Fire was removed in 1.8 as an item
*/
@Deprecated
public static final ItemType FIRE = builder("fire").setMaxAmount(64).build();
/**
* @deprecated Nether portals were removed in 1.8 as an item
*/
@Deprecated
public static final ItemType NETHER_PORTAL = builder("nether_portal").setMaxAmount(1).build();
/**
* @deprecated End portals were removed in 1.8 as an item
*/
@Deprecated
public static final ItemType END_PORTAL = builder("end_portal").setMaxAmount(1).build();
public static Collection<ItemType> values() {
@@ -148,10 +148,15 @@ public class NBTCodec {
//PacketEvents end
public static NBTCompound readNBTFromBuffer(Object byteBuf, ServerVersion serverVersion) {
return (NBTCompound) readRawNBTFromBuffer(byteBuf, serverVersion);
}
public static NBT readRawNBTFromBuffer(Object byteBuf, ServerVersion serverVersion) {
if (serverVersion.isNewerThanOrEquals(ServerVersion.V_1_8)) {
try {
return (NBTCompound) DefaultNBTSerializer.INSTANCE.deserializeTag(
new ByteBufInputStream(byteBuf));
final boolean named = serverVersion.isOlderThan(ServerVersion.V_1_20_2);
return DefaultNBTSerializer.INSTANCE.deserializeTag(
new ByteBufInputStream(byteBuf), named);
} catch (IOException e) {
e.printStackTrace();
}
@@ -165,7 +170,7 @@ public class NBTCodec {
Object slicedBuffer = ByteBufHelper.readSlice(byteBuf, length);
try (DataInputStream stream = new DataInputStream(
new GZIPInputStream(new ByteBufInputStream(slicedBuffer)))) {
return (NBTCompound) DefaultNBTSerializer.INSTANCE.deserializeTag(stream);
return DefaultNBTSerializer.INSTANCE.deserializeTag(stream);
}
}
catch (IOException ex) {
@@ -176,10 +181,15 @@ public class NBTCodec {
}
public static void writeNBTToBuffer(Object byteBuf, ServerVersion serverVersion, NBTCompound tag) {
writeNBTToBuffer(byteBuf, serverVersion, (NBT) tag);
}
public static void writeNBTToBuffer(Object byteBuf, ServerVersion serverVersion, NBT tag) {
if (serverVersion.isNewerThanOrEquals(ServerVersion.V_1_8)) {
try (ByteBufOutputStream outputStream = new ByteBufOutputStream(byteBuf)) {
if (tag != null) {
DefaultNBTSerializer.INSTANCE.serializeTag(outputStream, tag);
boolean named = serverVersion.isOlderThan(ServerVersion.V_1_20_2);
DefaultNBTSerializer.INSTANCE.serializeTag(outputStream, tag, named);
} else {
DefaultNBTSerializer.INSTANCE.serializeTag(outputStream, NBTEnd.INSTANCE);
}
@@ -47,21 +47,33 @@ public class NBTSerializer<IN, OUT> {
}
public NBT deserializeTag(IN from) throws IOException {
return deserializeTag(from, true);
}
public NBT deserializeTag(IN from, boolean named) throws IOException {
NBTType<?> type = readTagType(from);
if (type == NBTType.END) {
return null;
}
readTagName(from);
if (named) {
readTagName(from);
}
return readTag(from, type);
}
public void serializeTag(OUT to, NBT tag) throws IOException {
serializeTag(to, tag, true);
}
public void serializeTag(OUT to, NBT tag, boolean named) throws IOException {
NBTType<?> type = tag.getType();
writeTagType(to, type);
if (tag.getType() == NBTType.END) {
return;
}
writeTagName(to, "");
if (named) {
writeTagName(to, "");
}
writeTag(to, tag);
}
@@ -2,7 +2,7 @@ package com.github.retrooper.packetevents.protocol.packettype;
/**
* A Marker interface used to indicate that this packet is originating on
* the server, and is bound for the client.
* the server, and is bound to the client.
*/
public interface ClientBoundPacket {
@@ -20,8 +20,46 @@ package com.github.retrooper.packetevents.protocol.packettype;
import com.github.retrooper.packetevents.protocol.ConnectionState;
import com.github.retrooper.packetevents.protocol.PacketSide;
import com.github.retrooper.packetevents.protocol.packettype.clientbound.*;
import com.github.retrooper.packetevents.protocol.packettype.serverbound.*;
import com.github.retrooper.packetevents.protocol.packettype.clientbound.ClientboundPacketType_1_12;
import com.github.retrooper.packetevents.protocol.packettype.clientbound.ClientboundPacketType_1_12_1;
import com.github.retrooper.packetevents.protocol.packettype.clientbound.ClientboundPacketType_1_13;
import com.github.retrooper.packetevents.protocol.packettype.clientbound.ClientboundPacketType_1_14;
import com.github.retrooper.packetevents.protocol.packettype.clientbound.ClientboundPacketType_1_14_4;
import com.github.retrooper.packetevents.protocol.packettype.clientbound.ClientboundPacketType_1_15;
import com.github.retrooper.packetevents.protocol.packettype.clientbound.ClientboundPacketType_1_15_2;
import com.github.retrooper.packetevents.protocol.packettype.clientbound.ClientboundPacketType_1_16;
import com.github.retrooper.packetevents.protocol.packettype.clientbound.ClientboundPacketType_1_16_2;
import com.github.retrooper.packetevents.protocol.packettype.clientbound.ClientboundPacketType_1_17;
import com.github.retrooper.packetevents.protocol.packettype.clientbound.ClientboundPacketType_1_18;
import com.github.retrooper.packetevents.protocol.packettype.clientbound.ClientboundPacketType_1_19;
import com.github.retrooper.packetevents.protocol.packettype.clientbound.ClientboundPacketType_1_19_1;
import com.github.retrooper.packetevents.protocol.packettype.clientbound.ClientboundPacketType_1_19_3;
import com.github.retrooper.packetevents.protocol.packettype.clientbound.ClientboundPacketType_1_19_4;
import com.github.retrooper.packetevents.protocol.packettype.clientbound.ClientboundPacketType_1_20_2;
import com.github.retrooper.packetevents.protocol.packettype.clientbound.ClientboundPacketType_1_20_3;
import com.github.retrooper.packetevents.protocol.packettype.clientbound.ClientboundPacketType_1_7_10;
import com.github.retrooper.packetevents.protocol.packettype.clientbound.ClientboundPacketType_1_8;
import com.github.retrooper.packetevents.protocol.packettype.clientbound.ClientboundPacketType_1_9;
import com.github.retrooper.packetevents.protocol.packettype.clientbound.ClientboundPacketType_1_9_3;
import com.github.retrooper.packetevents.protocol.packettype.config.clientbound.ClientboundConfigPacketType_1_20_2;
import com.github.retrooper.packetevents.protocol.packettype.config.clientbound.ClientboundConfigPacketType_1_20_3;
import com.github.retrooper.packetevents.protocol.packettype.serverbound.ServerboundPacketType_1_12;
import com.github.retrooper.packetevents.protocol.packettype.serverbound.ServerboundPacketType_1_12_1;
import com.github.retrooper.packetevents.protocol.packettype.serverbound.ServerboundPacketType_1_13;
import com.github.retrooper.packetevents.protocol.packettype.serverbound.ServerboundPacketType_1_14;
import com.github.retrooper.packetevents.protocol.packettype.serverbound.ServerboundPacketType_1_15_2;
import com.github.retrooper.packetevents.protocol.packettype.serverbound.ServerboundPacketType_1_16;
import com.github.retrooper.packetevents.protocol.packettype.serverbound.ServerboundPacketType_1_16_2;
import com.github.retrooper.packetevents.protocol.packettype.serverbound.ServerboundPacketType_1_17;
import com.github.retrooper.packetevents.protocol.packettype.serverbound.ServerboundPacketType_1_19;
import com.github.retrooper.packetevents.protocol.packettype.serverbound.ServerboundPacketType_1_19_1;
import com.github.retrooper.packetevents.protocol.packettype.serverbound.ServerboundPacketType_1_19_3;
import com.github.retrooper.packetevents.protocol.packettype.serverbound.ServerboundPacketType_1_19_4;
import com.github.retrooper.packetevents.protocol.packettype.serverbound.ServerboundPacketType_1_20_2;
import com.github.retrooper.packetevents.protocol.packettype.serverbound.ServerboundPacketType_1_20_3;
import com.github.retrooper.packetevents.protocol.packettype.serverbound.ServerboundPacketType_1_7_10;
import com.github.retrooper.packetevents.protocol.packettype.serverbound.ServerboundPacketType_1_8;
import com.github.retrooper.packetevents.protocol.packettype.serverbound.ServerboundPacketType_1_9;
import com.github.retrooper.packetevents.protocol.player.ClientVersion;
import com.github.retrooper.packetevents.util.VersionMapper;
import org.jetbrains.annotations.Nullable;
@@ -52,7 +90,9 @@ public final class PacketType {
ClientVersion.V_1_19,
ClientVersion.V_1_19_1,
ClientVersion.V_1_19_3,
ClientVersion.V_1_19_4);
ClientVersion.V_1_19_4,
ClientVersion.V_1_20_2,
ClientVersion.V_1_20_3);
//TODO UPDATE Update packet type mappings (serverbound pt. 1)
private static final VersionMapper SERVERBOUND_PLAY_VERSION_MAPPER = new VersionMapper(
@@ -70,11 +110,19 @@ public final class PacketType {
ClientVersion.V_1_19,
ClientVersion.V_1_19_1,
ClientVersion.V_1_19_3,
ClientVersion.V_1_19_4);
ClientVersion.V_1_19_4,
ClientVersion.V_1_20_2,
ClientVersion.V_1_20_3);
//TODO UPDATE Update packet type mappings (config clientbound pt. 1)
private static final VersionMapper CLIENTBOUND_CONFIG_VERSION_MAPPER = new VersionMapper(
ClientVersion.V_1_20_2,
ClientVersion.V_1_20_3);
public static void prepare() {
PacketType.Play.Client.load();
PacketType.Play.Server.load();
PacketType.Configuration.Server.load();
PREPARED = true;
}
@@ -108,6 +156,12 @@ public final class PacketType {
} else {
return Play.Server.getById(version, packetID);
}
case CONFIGURATION:
if (side == PacketSide.CLIENT) {
return Configuration.Client.getById(packetID);
} else {
return Configuration.Server.getById(version, packetID);
}
default:
return null;
}
@@ -142,6 +196,11 @@ public final class PacketType {
public int getId() {
return id;
}
@Override
public PacketSide getSide() {
return PacketSide.CLIENT;
}
}
public enum Server implements PacketTypeConstant, ClientBoundPacket {
@@ -161,6 +220,11 @@ public final class PacketType {
public int getId() {
return id;
}
@Override
public PacketSide getSide() {
return PacketSide.SERVER;
}
}
}
@@ -189,6 +253,12 @@ public final class PacketType {
public int getId() {
return id;
}
@Override
public PacketSide getSide() {
return PacketSide.CLIENT;
}
}
public enum Server implements PacketTypeConstant, ClientBoundPacket {
@@ -215,6 +285,11 @@ public final class PacketType {
public int getId() {
return id;
}
@Override
public PacketSide getSide() {
return PacketSide.SERVER;
}
}
}
@@ -223,7 +298,9 @@ public final class PacketType {
LOGIN_START(0),
ENCRYPTION_RESPONSE(1),
///Added in 1.13
LOGIN_PLUGIN_RESPONSE(2);
LOGIN_PLUGIN_RESPONSE(2),
//Added in 1.20.2
LOGIN_SUCCESS_ACK(3);
private final int id;
@@ -239,6 +316,8 @@ public final class PacketType {
return ENCRYPTION_RESPONSE;
} else if (packetID == 2) {
return LOGIN_PLUGIN_RESPONSE;
} else if (packetID == 3) {
return LOGIN_SUCCESS_ACK;
} else {
return null;
}
@@ -247,6 +326,11 @@ public final class PacketType {
public int getId() {
return id;
}
@Override
public PacketSide getSide() {
return PacketSide.CLIENT;
}
}
public enum Server implements PacketTypeConstant, ClientBoundPacket {
@@ -285,6 +369,136 @@ public final class PacketType {
public int getId() {
return id;
}
@Override
public PacketSide getSide() {
return PacketSide.SERVER;
}
}
}
// Added in 1.20.2
public static class Configuration {
public enum Client implements PacketTypeConstant, ServerBoundPacket {
CLIENT_SETTINGS(0x00),
PLUGIN_MESSAGE(0x01),
CONFIGURATION_END_ACK(0x02),
KEEP_ALIVE(0x03),
PONG(0x04),
RESOURCE_PACK_STATUS(0x05);
private final int id;
Client(int id) {
this.id = id;
}
public static @Nullable PacketTypeCommon getById(int packetId) {
switch (packetId) {
case 0x00:
return CLIENT_SETTINGS;
case 0x01:
return PLUGIN_MESSAGE;
case 0x02:
return CONFIGURATION_END_ACK;
case 0x03:
return KEEP_ALIVE;
case 0x04:
return PONG;
case 0x05:
return RESOURCE_PACK_STATUS;
default:
return null;
}
}
@Override
public int getId() {
return this.id;
}
@Override
public PacketSide getSide() {
return PacketSide.CLIENT;
}
}
public enum Server implements PacketTypeCommon, ClientBoundPacket {
PLUGIN_MESSAGE,
DISCONNECT,
CONFIGURATION_END,
KEEP_ALIVE,
PING,
REGISTRY_DATA,
RESOURCE_PACK_SEND,
UPDATE_ENABLED_FEATURES,
UPDATE_TAGS,
// added in 1.20.3
RESOURCE_PACK_REMOVE;
private static int INDEX = 0;
private static final Map<Byte, Map<Integer, PacketTypeCommon>> PACKET_TYPE_ID_MAP = new HashMap<>();
private final int[] ids;
Server() {
this.ids = new int[CLIENTBOUND_CONFIG_VERSION_MAPPER.getVersions().length];
Arrays.fill(this.ids, -1);
}
public static void load() {
INDEX = 0;
loadPacketIds(ClientboundConfigPacketType_1_20_2.values());
loadPacketIds(ClientboundConfigPacketType_1_20_3.values());
// TODO UPDATE Update packet type mappings (config clientbound pt. 2)
}
private static void loadPacketIds(Enum<?>[] enumConstants) {
int index = INDEX;
for (Enum<?> constant : enumConstants) {
int id = constant.ordinal();
Configuration.Server value = Configuration.Server.valueOf(constant.name());
value.ids[index] = id;
Map<Integer, PacketTypeCommon> packetIdMap = PACKET_TYPE_ID_MAP.computeIfAbsent((byte) index, k -> new HashMap<>());
packetIdMap.put(id, value);
}
INDEX++;
}
public static @Nullable PacketTypeCommon getById(int packetId) {
return getById(ClientVersion.getLatest(), packetId);
}
public static @Nullable PacketTypeCommon getById(ClientVersion version, int packetId) {
if (!PREPARED) {
PacketType.prepare();
}
int index = CLIENTBOUND_CONFIG_VERSION_MAPPER.getIndex(version);
Map<Integer, PacketTypeCommon> map = PACKET_TYPE_ID_MAP.get((byte) index);
return map.get(packetId);
}
@Deprecated
public int getId() {
return this.getId(ClientVersion.getLatest());
}
@Override
public int getId(ClientVersion version) {
if (!PREPARED) {
PacketType.prepare();
}
int index = CLIENTBOUND_CONFIG_VERSION_MAPPER.getIndex(version);
return this.ids[index];
}
@Override
public PacketSide getSide() {
return PacketSide.SERVER;
}
}
}
@@ -348,8 +562,13 @@ public final class PacketType {
//Added in 1.19.1
CHAT_ACK,
//Added in 1.19.3
CHAT_SESSION_UPDATE;
CHAT_SESSION_UPDATE,
//Added in 1.20.2
CHUNK_BATCH_ACK,
CONFIGURATION_ACK,
DEBUG_PING,
//Added in 1.20.3
SLOT_STATE_CHANGE;
private static int INDEX = 0;
private static final Map<Byte, Map<Integer, PacketTypeCommon>> PACKET_TYPE_ID_MAP = new HashMap<>();
@@ -366,7 +585,7 @@ public final class PacketType {
PacketType.prepare();
}
int index = SERVERBOUND_PLAY_VERSION_MAPPER.getIndex(version);
Map<Integer, PacketTypeCommon> packetIdMap = PACKET_TYPE_ID_MAP.computeIfAbsent((byte)index, k -> new HashMap<>());
Map<Integer, PacketTypeCommon> packetIdMap = PACKET_TYPE_ID_MAP.computeIfAbsent((byte) index, k -> new HashMap<>());
return packetIdMap.get(packetId);
}
@@ -400,6 +619,8 @@ public final class PacketType {
loadPacketIds(ServerboundPacketType_1_19_1.values());
loadPacketIds(ServerboundPacketType_1_19_3.values());
loadPacketIds(ServerboundPacketType_1_19_4.values());
loadPacketIds(ServerboundPacketType_1_20_2.values());
loadPacketIds(ServerboundPacketType_1_20_3.values());
//TODO UPDATE Update packet type mappings (serverbound pt. 2)
}
@@ -410,6 +631,11 @@ public final class PacketType {
int index = SERVERBOUND_PLAY_VERSION_MAPPER.getIndex(version);
return ids[index];
}
@Override
public PacketSide getSide() {
return PacketSide.CLIENT;
}
}
public enum Server implements PacketTypeCommon, ClientBoundPacket {
@@ -433,12 +659,13 @@ public final class PacketType {
PLAYER_CHAT_HEADER,
PLAYER_INFO,
DISPLAY_CHAT_PREVIEW,
UPDATE_ENABLED_FEATURES,
SPAWN_PLAYER,
//Okay these are normal ones
WINDOW_CONFIRMATION,
SPAWN_ENTITY,
SPAWN_EXPERIENCE_ORB,
SPAWN_PLAYER,
ENTITY_ANIMATION,
STATISTICS,
BLOCK_BREAK_ANIMATION,
@@ -548,12 +775,24 @@ public final class PacketType {
DISGUISED_CHAT,
PLAYER_INFO_REMOVE,
PLAYER_INFO_UPDATE,
UPDATE_ENABLED_FEATURES,
// 1.19.4
//Added in 1.19.4
DAMAGE_EVENT,
HURT_ANIMATION,
BUNDLE,
CHUNK_BIOMES;
CHUNK_BIOMES,
//Added in 1.20.2
CHUNK_BATCH_END,
CHUNK_BATCH_BEGIN,
DEBUG_PONG,
CONFIGURATION_START,
//Added in 1.20.3
RESET_SCORE,
RESOURCE_PACK_REMOVE,
TICKING_STATE,
TICKING_STEP;
private static int INDEX = 0;
private static final Map<Byte, Map<Integer, PacketTypeCommon>> PACKET_TYPE_ID_MAP = new HashMap<>();
@@ -582,6 +821,11 @@ public final class PacketType {
return map.get(packetId);
}
@Override
public PacketSide getSide() {
return PacketSide.SERVER;
}
private static void loadPacketIds(Enum<?>[] enumConstants) {
int index = INDEX;
for (Enum<?> constant : enumConstants) {
@@ -615,6 +859,8 @@ public final class PacketType {
loadPacketIds(ClientboundPacketType_1_19_1.values());
loadPacketIds(ClientboundPacketType_1_19_3.values());
loadPacketIds(ClientboundPacketType_1_19_4.values());
loadPacketIds(ClientboundPacketType_1_20_2.values());
loadPacketIds(ClientboundPacketType_1_20_3.values());
//TODO UPDATE Update packet type mappings (clientbound pt. 2)
}
}
@@ -18,6 +18,7 @@
package com.github.retrooper.packetevents.protocol.packettype;
import com.github.retrooper.packetevents.protocol.PacketSide;
import com.github.retrooper.packetevents.protocol.player.ClientVersion;
public interface PacketTypeCommon {
@@ -27,4 +28,6 @@ public interface PacketTypeCommon {
}
int getId(ClientVersion version);
PacketSide getSide();
}
@@ -2,7 +2,7 @@ package com.github.retrooper.packetevents.protocol.packettype;
/**
* A Marker interface used to indicate that this packet is originating on
* the client, and is bound for the server.
* the client, and is bound to the server.
*/
public interface ServerBoundPacket {
}
@@ -0,0 +1,137 @@
/*
* This file is part of packetevents - https://github.com/retrooper/packetevents
* Copyright (C) 2022 retrooper and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.github.retrooper.packetevents.protocol.packettype.clientbound;
public enum ClientboundPacketType_1_20_2 {
BUNDLE,
SPAWN_ENTITY,
SPAWN_EXPERIENCE_ORB,
ENTITY_ANIMATION,
STATISTICS,
ACKNOWLEDGE_BLOCK_CHANGES,
BLOCK_BREAK_ANIMATION,
BLOCK_ENTITY_DATA,
BLOCK_ACTION,
BLOCK_CHANGE,
BOSS_BAR,
SERVER_DIFFICULTY,
CHUNK_BATCH_END, // New packet
CHUNK_BATCH_BEGIN, // New packet
CHUNK_BIOMES,
CLEAR_TITLES,
TAB_COMPLETE,
DECLARE_COMMANDS,
CLOSE_WINDOW,
WINDOW_ITEMS,
WINDOW_PROPERTY,
SET_SLOT,
SET_COOLDOWN,
CUSTOM_CHAT_COMPLETIONS,
PLUGIN_MESSAGE,
DAMAGE_EVENT,
DELETE_CHAT,
DISCONNECT,
DISGUISED_CHAT,
ENTITY_STATUS,
EXPLOSION,
UNLOAD_CHUNK,
CHANGE_GAME_STATE,
OPEN_HORSE_WINDOW,
HURT_ANIMATION,
INITIALIZE_WORLD_BORDER,
KEEP_ALIVE,
CHUNK_DATA,
EFFECT,
PARTICLE,
UPDATE_LIGHT,
JOIN_GAME,
MAP_DATA,
MERCHANT_OFFERS,
ENTITY_RELATIVE_MOVE,
ENTITY_RELATIVE_MOVE_AND_ROTATION,
ENTITY_ROTATION,
VEHICLE_MOVE,
OPEN_BOOK,
OPEN_WINDOW,
OPEN_SIGN_EDITOR,
PING,
DEBUG_PONG, // New packet
CRAFT_RECIPE_RESPONSE,
PLAYER_ABILITIES,
CHAT_MESSAGE,
END_COMBAT_EVENT,
ENTER_COMBAT_EVENT,
DEATH_COMBAT_EVENT,
PLAYER_INFO_REMOVE,
PLAYER_INFO_UPDATE,
FACE_PLAYER,
PLAYER_POSITION_AND_LOOK,
UNLOCK_RECIPES,
DESTROY_ENTITIES,
REMOVE_ENTITY_EFFECT,
RESOURCE_PACK_SEND,
RESPAWN,
ENTITY_HEAD_LOOK,
MULTI_BLOCK_CHANGE,
SELECT_ADVANCEMENTS_TAB,
SERVER_DATA,
ACTION_BAR,
WORLD_BORDER_CENTER,
WORLD_BORDER_LERP_SIZE,
WORLD_BORDER_SIZE,
WORLD_BORDER_WARNING_DELAY,
WORLD_BORDER_WARNING_REACH,
CAMERA,
HELD_ITEM_CHANGE,
UPDATE_VIEW_POSITION,
UPDATE_VIEW_DISTANCE,
SPAWN_POSITION,
DISPLAY_SCOREBOARD,
ENTITY_METADATA,
ATTACH_ENTITY,
ENTITY_VELOCITY,
ENTITY_EQUIPMENT,
SET_EXPERIENCE,
UPDATE_HEALTH,
SCOREBOARD_OBJECTIVE,
SET_PASSENGERS,
TEAMS,
UPDATE_SCORE,
UPDATE_SIMULATION_DISTANCE,
SET_TITLE_SUBTITLE,
TIME_UPDATE,
SET_TITLE_TEXT,
SET_TITLE_TIMES,
ENTITY_SOUND_EFFECT,
SOUND_EFFECT,
CONFIGURATION_START, // New packet
STOP_SOUND,
SYSTEM_CHAT_MESSAGE,
PLAYER_LIST_HEADER_AND_FOOTER,
NBT_QUERY_RESPONSE,
COLLECT_ITEM,
ENTITY_TELEPORT,
UPDATE_ADVANCEMENTS,
UPDATE_ATTRIBUTES,
// UPDATE_ENABLED_FEATURES, removed
ENTITY_EFFECT,
DECLARE_RECIPES,
TAGS,
}
@@ -0,0 +1,140 @@
/*
* This file is part of packetevents - https://github.com/retrooper/packetevents
* Copyright (C) 2022 retrooper and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.github.retrooper.packetevents.protocol.packettype.clientbound;
public enum ClientboundPacketType_1_20_3 {
BUNDLE,
SPAWN_ENTITY,
SPAWN_EXPERIENCE_ORB,
ENTITY_ANIMATION,
STATISTICS,
ACKNOWLEDGE_BLOCK_CHANGES,
BLOCK_BREAK_ANIMATION,
BLOCK_ENTITY_DATA,
BLOCK_ACTION,
BLOCK_CHANGE,
BOSS_BAR,
SERVER_DIFFICULTY,
CHUNK_BATCH_END,
CHUNK_BATCH_BEGIN,
CHUNK_BIOMES,
CLEAR_TITLES,
TAB_COMPLETE,
DECLARE_COMMANDS,
CLOSE_WINDOW,
WINDOW_ITEMS,
WINDOW_PROPERTY,
SET_SLOT,
SET_COOLDOWN,
CUSTOM_CHAT_COMPLETIONS,
PLUGIN_MESSAGE,
DAMAGE_EVENT,
DELETE_CHAT,
DISCONNECT,
DISGUISED_CHAT,
ENTITY_STATUS,
EXPLOSION,
UNLOAD_CHUNK,
CHANGE_GAME_STATE,
OPEN_HORSE_WINDOW,
HURT_ANIMATION,
INITIALIZE_WORLD_BORDER,
KEEP_ALIVE,
CHUNK_DATA,
EFFECT,
PARTICLE,
UPDATE_LIGHT,
JOIN_GAME,
MAP_DATA,
MERCHANT_OFFERS,
ENTITY_RELATIVE_MOVE,
ENTITY_RELATIVE_MOVE_AND_ROTATION,
ENTITY_ROTATION,
VEHICLE_MOVE,
OPEN_BOOK,
OPEN_WINDOW,
OPEN_SIGN_EDITOR,
PING,
DEBUG_PONG,
CRAFT_RECIPE_RESPONSE,
PLAYER_ABILITIES,
CHAT_MESSAGE,
END_COMBAT_EVENT,
ENTER_COMBAT_EVENT,
DEATH_COMBAT_EVENT,
PLAYER_INFO_REMOVE,
PLAYER_INFO_UPDATE,
FACE_PLAYER,
PLAYER_POSITION_AND_LOOK,
UNLOCK_RECIPES,
DESTROY_ENTITIES,
REMOVE_ENTITY_EFFECT,
RESET_SCORE, // New packet
RESOURCE_PACK_REMOVE, // New packet
RESOURCE_PACK_SEND,
RESPAWN,
ENTITY_HEAD_LOOK,
MULTI_BLOCK_CHANGE,
SELECT_ADVANCEMENTS_TAB,
SERVER_DATA,
ACTION_BAR,
WORLD_BORDER_CENTER,
WORLD_BORDER_LERP_SIZE,
WORLD_BORDER_SIZE,
WORLD_BORDER_WARNING_DELAY,
WORLD_BORDER_WARNING_REACH,
CAMERA,
HELD_ITEM_CHANGE,
UPDATE_VIEW_POSITION,
UPDATE_VIEW_DISTANCE,
SPAWN_POSITION,
DISPLAY_SCOREBOARD,
ENTITY_METADATA,
ATTACH_ENTITY,
ENTITY_VELOCITY,
ENTITY_EQUIPMENT,
SET_EXPERIENCE,
UPDATE_HEALTH,
SCOREBOARD_OBJECTIVE,
SET_PASSENGERS,
TEAMS,
UPDATE_SCORE,
UPDATE_SIMULATION_DISTANCE,
SET_TITLE_SUBTITLE,
TIME_UPDATE,
SET_TITLE_TEXT,
SET_TITLE_TIMES,
ENTITY_SOUND_EFFECT,
SOUND_EFFECT,
CONFIGURATION_START,
STOP_SOUND,
SYSTEM_CHAT_MESSAGE,
PLAYER_LIST_HEADER_AND_FOOTER,
NBT_QUERY_RESPONSE,
COLLECT_ITEM,
ENTITY_TELEPORT,
TICKING_STATE, // New packet
TICKING_STEP, // New packet
UPDATE_ADVANCEMENTS,
UPDATE_ATTRIBUTES,
ENTITY_EFFECT,
DECLARE_RECIPES,
TAGS,
}
@@ -0,0 +1,32 @@
/*
* This file is part of packetevents - https://github.com/retrooper/packetevents
* Copyright (C) 2023 retrooper and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.github.retrooper.packetevents.protocol.packettype.config.clientbound;
public enum ClientboundConfigPacketType_1_20_2 {
PLUGIN_MESSAGE,
DISCONNECT,
CONFIGURATION_END,
KEEP_ALIVE,
PING,
REGISTRY_DATA,
RESOURCE_PACK_SEND,
UPDATE_ENABLED_FEATURES,
UPDATE_TAGS,
}
@@ -0,0 +1,33 @@
/*
* This file is part of packetevents - https://github.com/retrooper/packetevents
* Copyright (C) 2023 retrooper and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.github.retrooper.packetevents.protocol.packettype.config.clientbound;
public enum ClientboundConfigPacketType_1_20_3 {
PLUGIN_MESSAGE,
DISCONNECT,
CONFIGURATION_END,
KEEP_ALIVE,
PING,
REGISTRY_DATA,
RESOURCE_PACK_REMOVE, // New packet
RESOURCE_PACK_SEND,
UPDATE_ENABLED_FEATURES,
UPDATE_TAGS,
}
@@ -0,0 +1,77 @@
/*
* This file is part of packetevents - https://github.com/retrooper/packetevents
* Copyright (C) 2022 retrooper and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.github.retrooper.packetevents.protocol.packettype.serverbound;
public enum ServerboundPacketType_1_20_2 {
TELEPORT_CONFIRM,
QUERY_BLOCK_NBT,
SET_DIFFICULTY,
CHAT_ACK,
CHAT_COMMAND,
CHAT_MESSAGE,
CHAT_SESSION_UPDATE,
CHUNK_BATCH_ACK, // New packet
CLIENT_STATUS,
CLIENT_SETTINGS,
TAB_COMPLETE,
CONFIGURATION_ACK, // New packet
CLICK_WINDOW_BUTTON,
CLICK_WINDOW,
CLOSE_WINDOW,
PLUGIN_MESSAGE,
EDIT_BOOK,
QUERY_ENTITY_NBT,
INTERACT_ENTITY,
GENERATE_STRUCTURE,
KEEP_ALIVE,
LOCK_DIFFICULTY,
PLAYER_POSITION,
PLAYER_POSITION_AND_ROTATION,
PLAYER_ROTATION,
PLAYER_FLYING,
VEHICLE_MOVE,
STEER_BOAT,
PICK_ITEM,
DEBUG_PING, // New packet
CRAFT_RECIPE_REQUEST,
PLAYER_ABILITIES,
PLAYER_DIGGING,
ENTITY_ACTION,
STEER_VEHICLE,
PONG,
SET_RECIPE_BOOK_STATE,
SET_DISPLAYED_RECIPE,
NAME_ITEM,
RESOURCE_PACK_STATUS,
ADVANCEMENT_TAB,
SELECT_TRADE,
SET_BEACON_EFFECT,
HELD_ITEM_CHANGE,
UPDATE_COMMAND_BLOCK,
UPDATE_COMMAND_BLOCK_MINECART,
CREATIVE_INVENTORY_ACTION,
UPDATE_JIGSAW_BLOCK,
UPDATE_STRUCTURE_BLOCK,
UPDATE_SIGN,
ANIMATION,
SPECTATE,
PLAYER_BLOCK_PLACEMENT,
USE_ITEM,
}
@@ -0,0 +1,78 @@
/*
* This file is part of packetevents - https://github.com/retrooper/packetevents
* Copyright (C) 2022 retrooper and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.github.retrooper.packetevents.protocol.packettype.serverbound;
public enum ServerboundPacketType_1_20_3 {
TELEPORT_CONFIRM,
QUERY_BLOCK_NBT,
SET_DIFFICULTY,
CHAT_ACK,
CHAT_COMMAND,
CHAT_MESSAGE,
CHAT_SESSION_UPDATE,
CHUNK_BATCH_ACK,
CLIENT_STATUS,
CLIENT_SETTINGS,
TAB_COMPLETE,
CONFIGURATION_ACK,
CLICK_WINDOW_BUTTON,
CLICK_WINDOW,
CLOSE_WINDOW,
SLOT_STATE_CHANGE, // New packet
PLUGIN_MESSAGE,
EDIT_BOOK,
QUERY_ENTITY_NBT,
INTERACT_ENTITY,
GENERATE_STRUCTURE,
KEEP_ALIVE,
LOCK_DIFFICULTY,
PLAYER_POSITION,
PLAYER_POSITION_AND_ROTATION,
PLAYER_ROTATION,
PLAYER_FLYING,
VEHICLE_MOVE,
STEER_BOAT,
PICK_ITEM,
DEBUG_PING,
CRAFT_RECIPE_REQUEST,
PLAYER_ABILITIES,
PLAYER_DIGGING,
ENTITY_ACTION,
STEER_VEHICLE,
PONG,
SET_RECIPE_BOOK_STATE,
SET_DISPLAYED_RECIPE,
NAME_ITEM,
RESOURCE_PACK_STATUS,
ADVANCEMENT_TAB,
SELECT_TRADE,
SET_BEACON_EFFECT,
HELD_ITEM_CHANGE,
UPDATE_COMMAND_BLOCK,
UPDATE_COMMAND_BLOCK_MINECART,
CREATIVE_INVENTORY_ACTION,
UPDATE_JIGSAW_BLOCK,
UPDATE_STRUCTURE_BLOCK,
UPDATE_SIGN,
ANIMATION,
SPECTATE,
PLAYER_BLOCK_PLACEMENT,
USE_ITEM,
}
@@ -18,6 +18,10 @@
package com.github.retrooper.packetevents.protocol.particle.data;
import com.github.retrooper.packetevents.manager.server.ServerVersion;
import com.github.retrooper.packetevents.protocol.mapper.MappedEntity;
import com.github.retrooper.packetevents.protocol.player.ClientVersion;
import com.github.retrooper.packetevents.resources.ResourceLocation;
import com.github.retrooper.packetevents.util.Vector3i;
import com.github.retrooper.packetevents.wrapper.PacketWrapper;
import org.jetbrains.annotations.Nullable;
@@ -25,30 +29,54 @@ import org.jetbrains.annotations.Nullable;
import java.util.Optional;
public class ParticleVibrationData extends ParticleData {
public enum PositionType {
BLOCK("minecraft:block"), ENTITY("minecraft:entity");
private final String name;
public enum PositionType implements MappedEntity {
PositionType(String name) {
BLOCK(new ResourceLocation("minecraft:block")),
ENTITY(new ResourceLocation("minecraft:entity"));
private final ResourceLocation name;
PositionType(ResourceLocation name) {
this.name = name;
}
public String getName() {
@Override
public ResourceLocation getName() {
return name;
}
public static PositionType getByName(String name) {
for(PositionType type : values()) {
if(type.getName().equals(name)) {
public static PositionType getById(int id) {
switch (id) {
case 0x00:
return BLOCK;
case 0x01:
return ENTITY;
default:
throw new IllegalArgumentException("Illegal position type id: " + id);
}
}
public static @Nullable PositionType getByName(String name) {
return getByName(new ResourceLocation(name));
}
public static @Nullable PositionType getByName(ResourceLocation name) {
for (PositionType type : values()) {
if (type.getName().equals(name)) {
return type;
}
}
return null;
}
@Override
public int getId(ClientVersion version) {
return this.ordinal();
}
}
private Vector3i startingPosition;
private Vector3i startingPosition; // Removed in 1.19.4
private PositionType type;
private @Nullable Vector3i blockPosition;
private @Nullable Integer entityId;
@@ -107,28 +135,44 @@ public class ParticleVibrationData extends ParticleData {
}
public static ParticleVibrationData read(PacketWrapper<?> wrapper) {
Vector3i startingPos = wrapper.readBlockPosition();
String positionTypeName = wrapper.readString();
PositionType positionType = PositionType.getByName(positionTypeName);
if (positionType == PositionType.BLOCK) {
return new ParticleVibrationData(startingPos, wrapper.readBlockPosition(), wrapper.readVarInt());
Vector3i startingPos = wrapper.getServerVersion().isNewerThanOrEquals(ServerVersion.V_1_19_4)
? Vector3i.zero() : wrapper.readBlockPosition();
PositionType positionType;
if (wrapper.getServerVersion().isNewerThanOrEquals(ServerVersion.V_1_20_3)) {
positionType = PositionType.getById(wrapper.readVarInt());
} else {
String positionTypeName = wrapper.readString();
positionType = PositionType.getByName(positionTypeName);
if (positionType == null) {
throw new IllegalArgumentException("Unknown position type: " + positionTypeName);
}
}
else if (positionType == PositionType.ENTITY) {
return new ParticleVibrationData(startingPos, wrapper.readVarInt(), wrapper.readVarInt());
}
else {
throw new IllegalArgumentException("Unknown position type: " + positionTypeName);
switch (positionType) {
case BLOCK:
return new ParticleVibrationData(startingPos, wrapper.readBlockPosition(), wrapper.readVarInt());
case ENTITY:
return new ParticleVibrationData(startingPos, wrapper.readVarInt(), wrapper.readVarInt());
default:
throw new IllegalArgumentException("Illegal position type: " + positionType);
}
}
public static void write(PacketWrapper<?> wrapper, ParticleVibrationData data) {
wrapper.writeBlockPosition(data.getStartingPosition());
wrapper.writeString(data.getType().getName());
if (wrapper.getServerVersion().isOlderThan(ServerVersion.V_1_19_4)) {
wrapper.writeBlockPosition(data.getStartingPosition());
}
if (wrapper.getServerVersion().isNewerThanOrEquals(ServerVersion.V_1_20_3)) {
wrapper.writeVarInt(data.getType().getId(wrapper.getServerVersion().toClientVersion()));
} else {
wrapper.writeIdentifier(data.getType().getName());
}
if (data.getType() == PositionType.BLOCK) {
wrapper.writeBlockPosition(data.getBlockPosition().get());
}
else if (data.getType() == PositionType.ENTITY) {
} else if (data.getType() == PositionType.ENTITY) {
wrapper.writeVarInt(data.getEntityId().get());
}
wrapper.writeVarInt(data.getTicks());
@@ -45,7 +45,8 @@ public class ParticleTypes {
ClientVersion.V_1_18,
ClientVersion.V_1_19,
ClientVersion.V_1_19_4,
ClientVersion.V_1_20);
ClientVersion.V_1_20,
ClientVersion.V_1_20_3);
public static ParticleType define(String key, Function<PacketWrapper<?>, ParticleData> readDataFunction, BiConsumer<PacketWrapper<?>, ParticleData> writeDataFunction) {
TypesBuilderData data = TYPES_BUILDER.defineFromArray(key);
@@ -211,6 +212,14 @@ public class ParticleTypes {
//Added in 1.20
public static final ParticleType CHERRY_LEAVES = define("cherry_leaves");
public static final ParticleType EGG_CRACK = define("egg_crack");
//Added in 1.20.3
public static final ParticleType GUST = define("gust");
public static final ParticleType GUST_EMITTER = define("gust_emitter");
public static final ParticleType WHITE_SMOKE = define("white_smoke");
public static final ParticleType DUST_PLUME = define("dust_plume");
public static final ParticleType GUST_DUST = define("gust_dust");
public static final ParticleType TRIAL_SPAWNER_DETECTION = define("trial_spawner_detection");
static {
TYPES_BUILDER.unloadFileMappings();
}
@@ -83,11 +83,16 @@ public enum ClientVersion {
V_1_19_3(761),
V_1_19_4(762),
V_1_20(763),
V_1_20_2(764),
/**
* 1.20.3 and 1.20.4 have the same protocol version.
*/
V_1_20_3(765),
//TODO UPDATE Add new protocol version field
LOWER_THAN_SUPPORTED_VERSIONS(V_1_7_10.protocolVersion - 1, true),
//TODO UPDATE Update HIGHER_THAN_SUPPORTED_VERSIONS field
HIGHER_THAN_SUPPORTED_VERSIONS(V_1_20.protocolVersion + 1, true),
HIGHER_THAN_SUPPORTED_VERSIONS(V_1_20_3.protocolVersion + 1, true),
UNKNOWN(-1, true);
@@ -166,7 +171,6 @@ public enum ClientVersion {
if (version.protocolVersion > protocolVersion) {
break;
} else if (version.protocolVersion == protocolVersion) {
//Cache for next time
return version;
}
}
@@ -276,4 +280,4 @@ public enum ClientVersion {
return false;
}
}
}
}
@@ -42,7 +42,8 @@ import java.util.UUID;
public class User {
private final Object channel;
private ConnectionState connectionState;
private ConnectionState decoderState;
private ConnectionState encoderState;
private ClientVersion clientVersion;
private final UserProfile profile;
private int entityId = -1;
@@ -55,7 +56,8 @@ public class User {
ConnectionState connectionState, ClientVersion clientVersion,
UserProfile profile) {
this.channel = channel;
this.connectionState = connectionState;
this.decoderState = connectionState;
this.encoderState = connectionState;
this.clientVersion = clientVersion;
this.profile = profile;
}
@@ -69,11 +71,37 @@ public class User {
}
public ConnectionState getConnectionState() {
return connectionState;
ConnectionState decoderState = this.decoderState;
ConnectionState encoderState = this.encoderState;
if (decoderState != encoderState) {
throw new IllegalArgumentException("Can't get common connection state: " + decoderState + " != " + encoderState);
}
return decoderState;
}
public void setConnectionState(ConnectionState connectionState) {
this.connectionState = connectionState;
this.setDecoderState(connectionState);
this.setEncoderState(connectionState);
}
public ConnectionState getDecoderState() {
return this.decoderState;
}
public void setDecoderState(ConnectionState decoderState) {
this.decoderState = decoderState;
PacketEvents.getAPI().getLogManager().debug(
"Transitioned " + this.getName() + "'s decoder into " + decoderState + " state!");
}
public ConnectionState getEncoderState() {
return this.encoderState;
}
public void setEncoderState(ConnectionState encoderState) {
this.encoderState = encoderState;
PacketEvents.getAPI().getLogManager().debug(
"Transitioned " + this.getName() + "'s encoder into " + encoderState + " state!");
}
public ClientVersion getClientVersion() {
@@ -150,7 +178,8 @@ public class User {
}
public void sendMessage(Component component, ChatType type) {
ServerVersion version = PacketEvents.getAPI().getServerManager().getVersion();
ServerVersion version = PacketEvents.getAPI().getInjector().isProxy() ? getClientVersion().toServerVersion() :
PacketEvents.getAPI().getServerManager().getVersion();
PacketWrapper<?> chatPacket;
if (version.isNewerThanOrEquals(ServerVersion.V_1_19)) {
chatPacket = new WrapperPlayServerSystemChatMessage(false, component);
@@ -174,7 +203,9 @@ public class User {
}
public void sendTitle(Component title, Component subtitle, int fadeInTicks, int stayTicks, int fadeOutTicks) {
boolean modern = PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_17);
ServerVersion version = PacketEvents.getAPI().getInjector().isProxy() ? getClientVersion().toServerVersion() :
PacketEvents.getAPI().getServerManager().getVersion();
boolean modern = version.isNewerThanOrEquals(ServerVersion.V_1_17);
PacketWrapper<?> animation;
PacketWrapper<?> setTitle = null;
PacketWrapper<?> setSubtitle = null;
@@ -242,6 +273,9 @@ public class User {
@Nullable
public NBTCompound getWorldNBT(String worldName) {
if (worldNBT == null) {
return null;
}
for (NBTCompound compound : worldNBT) {
if (compound.getStringTagOrNull("name").getValue().equals(worldName)) {
return compound;
@@ -18,8 +18,8 @@
package com.github.retrooper.packetevents.protocol.potion;
import com.github.retrooper.packetevents.protocol.mapper.StaticMappedEntity;
import com.github.retrooper.packetevents.protocol.mapper.MappedEntity;
public interface PotionType extends StaticMappedEntity {
public interface PotionType extends MappedEntity {
}
@@ -18,6 +18,8 @@
package com.github.retrooper.packetevents.protocol.potion;
import com.github.retrooper.packetevents.PacketEvents;
import com.github.retrooper.packetevents.protocol.player.ClientVersion;
import com.github.retrooper.packetevents.resources.ResourceLocation;
import org.jetbrains.annotations.Nullable;
@@ -37,14 +39,17 @@ public class PotionTypes {
}
@Override
public int getId() {
public int getId(ClientVersion version) {
if (version.isOlderThan(ClientVersion.V_1_20_2)) {
return id + 1;
}
return id;
}
@Override
public boolean equals(Object obj) {
if (obj instanceof PotionType) {
return getId() == ((PotionType)obj).getId();
return getName().equals(((PotionType)obj).getName());
}
return false;
}
@@ -52,7 +57,8 @@ public class PotionTypes {
//minecraft:speed would be a string for example
POTION_TYPE_MAP.put(potionType.getName().toString(), potionType);
POTION_TYPE_ID_MAP.put((byte) potionType.getId(), potionType);
//We map the 1.20.2 IDs
POTION_TYPE_ID_MAP.put((byte) potionType.getId(ClientVersion.V_1_20_2), potionType);
return potionType;
}
@@ -61,42 +67,55 @@ public class PotionTypes {
return POTION_TYPE_MAP.get(name);
}
@Nullable
public static PotionType getById(int id) {
@Deprecated
public static @Nullable PotionType getById(int id) {
return getById(id, PacketEvents.getAPI().getServerManager().getVersion().toClientVersion());
}
public static @Nullable PotionType getById(int id, com.github.retrooper.packetevents.manager.server.ServerVersion version) {
return getById(id, version.toClientVersion());
}
public static @Nullable PotionType getById(int id, ClientVersion version) {
if (version.isOlderThan(ClientVersion.V_1_20_2)) {
//We map the 1.20.2 values (starting from 0)
//If the version is older than that, we must subtract one from the input ID (cause it starts from 1)
id--; // potion effects ids where shifted by -1 in 1.20.2
}
return POTION_TYPE_ID_MAP.get((byte)id);
}
public static final PotionType SPEED = define("speed", 1);
public static final PotionType SLOWNESS = define("slowness", 2);
public static final PotionType HASTE = define("haste", 3);
public static final PotionType MINING_FATIGUE = define("mining_fatigue", 4);
public static final PotionType STRENGTH = define("strength", 5);
public static final PotionType INSTANT_HEALTH = define("instant_health", 6);
public static final PotionType INSTANT_DAMAGE = define("instant_damage", 7);
public static final PotionType JUMP_BOOST = define("jump_boost", 8);
public static final PotionType NAUSEA = define("nausea", 9);
public static final PotionType REGENERATION = define("regeneration", 10);
public static final PotionType RESISTANCE = define("resistance", 11);
public static final PotionType FIRE_RESISTANCE = define("fire_resistance", 12);
public static final PotionType WATER_BREATHING = define("water_breathing", 13);
public static final PotionType INVISIBILITY = define("invisibility", 14);
public static final PotionType BLINDNESS = define("blindness", 15);
public static final PotionType NIGHT_VISION = define("night_vision", 16);
public static final PotionType HUNGER = define("hunger", 17);
public static final PotionType WEAKNESS = define("weakness", 18);
public static final PotionType POISON = define("poison", 19);
public static final PotionType WITHER = define("wither", 20);
public static final PotionType HEALTH_BOOST = define("health_boost", 21);
public static final PotionType ABSORPTION = define("absorption", 22);
public static final PotionType SATURATION = define("saturation", 23);
public static final PotionType GLOWING = define("glowing", 24);
public static final PotionType LEVITATION = define("levitation", 25);
public static final PotionType LUCK = define("luck", 26);
public static final PotionType UNLUCK = define("unluck", 27);
public static final PotionType SLOW_FALLING = define("slow_falling", 28);
public static final PotionType CONDUIT_POWER = define("conduit_power", 29);
public static final PotionType DOLPHINS_GRACE = define("dolphins_grace", 30);
public static final PotionType BAD_OMEN = define("bad_omen", 31);
public static final PotionType HERO_OF_THE_VILLAGE = define("hero_of_the_village", 32);
public static final PotionType DARKNESS = define("darkness", 33);
public static final PotionType SPEED = define("speed", 0);
public static final PotionType SLOWNESS = define("slowness", 1);
public static final PotionType HASTE = define("haste", 2);
public static final PotionType MINING_FATIGUE = define("mining_fatigue", 3);
public static final PotionType STRENGTH = define("strength", 4);
public static final PotionType INSTANT_HEALTH = define("instant_health", 5);
public static final PotionType INSTANT_DAMAGE = define("instant_damage", 6);
public static final PotionType JUMP_BOOST = define("jump_boost", 7);
public static final PotionType NAUSEA = define("nausea", 8);
public static final PotionType REGENERATION = define("regeneration", 9);
public static final PotionType RESISTANCE = define("resistance", 10);
public static final PotionType FIRE_RESISTANCE = define("fire_resistance", 11);
public static final PotionType WATER_BREATHING = define("water_breathing", 12);
public static final PotionType INVISIBILITY = define("invisibility", 13);
public static final PotionType BLINDNESS = define("blindness", 14);
public static final PotionType NIGHT_VISION = define("night_vision", 15);
public static final PotionType HUNGER = define("hunger", 16);
public static final PotionType WEAKNESS = define("weakness", 17);
public static final PotionType POISON = define("poison", 18);
public static final PotionType WITHER = define("wither", 19);
public static final PotionType HEALTH_BOOST = define("health_boost", 20);
public static final PotionType ABSORPTION = define("absorption", 21);
public static final PotionType SATURATION = define("saturation", 22);
public static final PotionType GLOWING = define("glowing", 23);
public static final PotionType LEVITATION = define("levitation", 24);
public static final PotionType LUCK = define("luck", 25);
public static final PotionType UNLUCK = define("unluck", 26);
public static final PotionType SLOW_FALLING = define("slow_falling", 27);
public static final PotionType CONDUIT_POWER = define("conduit_power", 28);
public static final PotionType DOLPHINS_GRACE = define("dolphins_grace", 29);
public static final PotionType BAD_OMEN = define("bad_omen", 30);
public static final PotionType HERO_OF_THE_VILLAGE = define("hero_of_the_village", 31);
public static final PotionType DARKNESS = define("darkness", 32);
}
@@ -32,7 +32,11 @@ import com.github.retrooper.packetevents.protocol.world.chunk.storage.LegacyFlex
import com.github.retrooper.packetevents.protocol.world.states.WrappedBlockState;
public interface BaseChunk {
WrappedBlockState get(ClientVersion version, int x, int y, int z);
int getBlockId(int x, int y, int z);
default WrappedBlockState get(ClientVersion version, int x, int y, int z) {
return WrappedBlockState.getByGlobalId(version, getBlockId(x, y, z));
}
default WrappedBlockState get(int x, int y, int z) {
return get(PacketEvents.getAPI().getServerManager().getVersion().toClientVersion(), x, y, z);
@@ -84,8 +84,8 @@ public class Chunk_v1_9 implements BaseChunk {
}
@Override
public WrappedBlockState get(ClientVersion version, int x, int y, int z) {
return WrappedBlockState.getByGlobalId(version, this.dataPalette.get(x, y, z));
public int getBlockId(int x, int y, int z) {
return this.dataPalette.get(x, y, z);
}
public void set(int x, int y, int z, int state) {
@@ -44,9 +44,8 @@ public class Chunk_v1_7 implements BaseChunk {
}
@Override
public WrappedBlockState get(ClientVersion version, int x, int y, int z) {
int combinedID = blocks.get(x, y, z) | (extendedBlocks.get(x, y, z) << 12);
return WrappedBlockState.getByGlobalId(version, combinedID);
public int getBlockId(int x, int y, int z) {
return blocks.get(x, y, z) | (extendedBlocks.get(x, y, z) << 12);
}
@Override
@@ -52,9 +52,8 @@ public class Chunk_v1_8 implements BaseChunk {
}
@Override
public WrappedBlockState get(ClientVersion version, int x, int y, int z) {
int combinedID = this.blocks.get(x, y, z);
return WrappedBlockState.getByGlobalId(version, combinedID);
public int getBlockId(int x, int y, int z) {
return this.blocks.get(x, y, z);
}
@Override
@@ -61,8 +61,8 @@ public class Chunk_v1_18 implements BaseChunk {
}
@Override
public WrappedBlockState get(ClientVersion version, int x, int y, int z) {
return WrappedBlockState.getByGlobalId(version, this.chunkData.get(x, y, z));
public int getBlockId(int x, int y, int z) {
return this.chunkData.get(x, y, z);
}
@Override
@@ -157,11 +157,15 @@ public class WrappedBlockState {
return 8;
} else if (version.isOlderThanOrEquals(ClientVersion.V_1_19_3)) {
return 9;
}
else if (version.isOlderThanOrEquals(ClientVersion.V_1_19_4)) {
} else if (version.isOlderThanOrEquals(ClientVersion.V_1_19_4)) {
return 10;
} else if (version.isOlderThanOrEquals(ClientVersion.V_1_20)) {
return 11;
} else if (version.isOlderThanOrEquals(ClientVersion.V_1_20_2)) {
return 12;
}
return 11;
// TODO UPDATE increment index (and add previous above)
return 13;
}
private static void loadLegacy() {
@@ -1111,6 +1115,36 @@ public class WrappedBlockState {
checkIsStillValid();
}
public boolean isCracked() {
return (boolean) data.get(StateValue.CRACKED);
}
public void setCracked(boolean cracked) {
checkIfCloneNeeded();
data.put(StateValue.CRACKED, cracked);
checkIsStillValid();
}
public boolean isCrafting() {
return (boolean) data.get(StateValue.CRAFTING);
}
public void setCrafting(boolean crafting) {
checkIfCloneNeeded();
data.put(StateValue.CRAFTING, crafting);
checkIsStillValid();
}
public TrialSpawnerState getTrialSpawnerState() {
return (TrialSpawnerState) data.get(StateValue.TRIAL_SPAWNER_STATE);
}
public void setTrialSpawnerState(TrialSpawnerState trialSpawnerState) {
checkIfCloneNeeded();
data.put(StateValue.TRIAL_SPAWNER_STATE, trialSpawnerState);
checkIsStillValid();
}
// End all block data types
/**
@@ -29,8 +29,9 @@ import java.util.Set;
/**
* This class allows you to use block tags on outdated versions.
* If you are on a version that sends tags to the player, you are suggested to listen to {@link com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerTags}
*
* <p>
* Might as well just fucking shade the entire vanilla jar if we are going to copy SO MANY HUNDREDS OF LINES
*
* @author DefineOutside
*/
public class BlockTags {
@@ -95,6 +96,7 @@ public class BlockTags {
public static final BlockTags CANDLES = bind("candles");
public static final BlockTags DIRT = bind("dirt");
public static final BlockTags TERRACOTTA = bind("terracotta");
public static final BlockTags CONCRETE_POWDER = bind("concrete_powder");
public static final BlockTags COMPLETES_FIND_TREE_TUTORIAL = bind("completes_find_tree_tutorial");
public static final BlockTags FLOWER_POTS = bind("flower_pots");
public static final BlockTags ENDERMAN_HOLDABLE = bind("enderman_holdable");
@@ -153,6 +155,7 @@ public class BlockTags {
public static final BlockTags CRYSTAL_SOUND_BLOCKS = bind("crystal_sound_blocks");
public static final BlockTags INSIDE_STEP_SOUND_BLOCKS = bind("inside_step_sound_blocks");
public static final BlockTags COMBINATION_STEP_SOUND_BLOCKS = bind("combination_step_sound_blocks");
public static final BlockTags CAMEL_SAND_STEP_SOUND_BLOCKS = bind("camel_sand_step_sound_blocks");
public static final BlockTags OCCLUDES_VIBRATION_SIGNALS = bind("occludes_vibration_signals");
public static final BlockTags DAMPENS_VIBRATIONS = bind("dampens_vibrations");
public static final BlockTags DRIPSTONE_REPLACEABLE = bind("dripstone_replaceable_blocks");
@@ -190,12 +193,14 @@ public class BlockTags {
public static final BlockTags WOLVES_SPAWNABLE_ON = bind("wolves_spawnable_on");
public static final BlockTags FROGS_SPAWNABLE_ON = bind("frogs_spawnable_on");
public static final BlockTags AZALEA_GROWS_ON = bind("azalea_grows_on");
@Deprecated
public static final BlockTags REPLACEABLE_PLANTS = bind("replaceable_plants");
public static final BlockTags CONVERTABLE_TO_MUD = bind("convertable_to_mud");
public static final BlockTags MANGROVE_LOGS_CAN_GROW_THROUGH = bind("mangrove_logs_can_grow_through");
public static final BlockTags MANGROVE_ROOTS_CAN_GROW_THROUGH = bind("mangrove_roots_can_grow_through");
public static final BlockTags DEAD_BUSH_MAY_PLACE_ON = bind("dead_bush_may_place_on");
public static final BlockTags SNAPS_GOAT_HORN = bind("snaps_goat_horn");
public static final BlockTags REPLACEABLE_BY_TREES = bind("replaceable_by_trees");
public static final BlockTags SNOW_LAYER_CANNOT_SURVIVE_ON = bind("snow_layer_cannot_survive_on");
public static final BlockTags SNOW_LAYER_CAN_SURVIVE_ON = bind("snow_layer_can_survive_on");
public static final BlockTags INVALID_SPAWN_INSIDE = bind("invalid_spawn_inside");
@@ -227,164 +232,164 @@ public class BlockTags {
BlockTags.WOODEN_STAIRS.add(StateTypes.OAK_STAIRS, StateTypes.SPRUCE_STAIRS, StateTypes.BIRCH_STAIRS, StateTypes.JUNGLE_STAIRS, StateTypes.ACACIA_STAIRS, StateTypes.DARK_OAK_STAIRS, StateTypes.CRIMSON_STAIRS, StateTypes.WARPED_STAIRS, StateTypes.MANGROVE_STAIRS, StateTypes.BAMBOO_STAIRS, StateTypes.CHERRY_STAIRS);
BlockTags.WOODEN_SLABS.add(StateTypes.OAK_SLAB, StateTypes.SPRUCE_SLAB, StateTypes.BIRCH_SLAB, StateTypes.JUNGLE_SLAB, StateTypes.ACACIA_SLAB, StateTypes.DARK_OAK_SLAB, StateTypes.CRIMSON_SLAB, StateTypes.WARPED_SLAB, StateTypes.MANGROVE_SLAB, StateTypes.BAMBOO_SLAB, StateTypes.CHERRY_SLAB);
BlockTags.WOODEN_FENCES.add(StateTypes.OAK_FENCE, StateTypes.ACACIA_FENCE, StateTypes.DARK_OAK_FENCE, StateTypes.SPRUCE_FENCE, StateTypes.BIRCH_FENCE, StateTypes.JUNGLE_FENCE, StateTypes.CRIMSON_FENCE, StateTypes.WARPED_FENCE, StateTypes.MANGROVE_FENCE, StateTypes.BAMBOO_FENCE, StateTypes.CHERRY_FENCE);
BlockTags.DOORS.addTag(BlockTags.WOODEN_DOORS).add(StateTypes.IRON_DOOR);
BlockTags.SAPLINGS.add(StateTypes.OAK_SAPLING, StateTypes.SPRUCE_SAPLING, StateTypes.BIRCH_SAPLING, StateTypes.JUNGLE_SAPLING, StateTypes.ACACIA_SAPLING, StateTypes.DARK_OAK_SAPLING, StateTypes.AZALEA, StateTypes.FLOWERING_AZALEA, StateTypes.MANGROVE_PROPAGULE, StateTypes.CHERRY_SAPLING);
BlockTags.BAMBOO_BLOCKS.add(StateTypes.BAMBOO_BLOCK, StateTypes.STRIPPED_BAMBOO_BLOCK);
BlockTags.DARK_OAK_LOGS.add(StateTypes.DARK_OAK_LOG, StateTypes.DARK_OAK_WOOD, StateTypes.STRIPPED_DARK_OAK_LOG, StateTypes.STRIPPED_DARK_OAK_WOOD);
BlockTags.OAK_LOGS.add(StateTypes.OAK_LOG, StateTypes.OAK_WOOD, StateTypes.STRIPPED_OAK_LOG, StateTypes.STRIPPED_OAK_WOOD);
BlockTags.ACACIA_LOGS.add(StateTypes.ACACIA_LOG, StateTypes.ACACIA_WOOD, StateTypes.STRIPPED_ACACIA_LOG, StateTypes.STRIPPED_ACACIA_WOOD);
BlockTags.CHERRY_LOGS.add(StateTypes.CHERRY_LOG, StateTypes.CHERRY_WOOD, StateTypes.STRIPPED_CHERRY_LOG, StateTypes.STRIPPED_CHERRY_WOOD);
BlockTags.BIRCH_LOGS.add(StateTypes.BIRCH_LOG, StateTypes.BIRCH_WOOD, StateTypes.STRIPPED_BIRCH_LOG, StateTypes.STRIPPED_BIRCH_WOOD);
BlockTags.JUNGLE_LOGS.add(StateTypes.JUNGLE_LOG, StateTypes.JUNGLE_WOOD, StateTypes.STRIPPED_JUNGLE_LOG, StateTypes.STRIPPED_JUNGLE_WOOD);
BlockTags.SPRUCE_LOGS.add(StateTypes.SPRUCE_LOG, StateTypes.SPRUCE_WOOD, StateTypes.STRIPPED_SPRUCE_LOG, StateTypes.STRIPPED_SPRUCE_WOOD);
BlockTags.CRIMSON_STEMS.add(StateTypes.CRIMSON_STEM, StateTypes.STRIPPED_CRIMSON_STEM, StateTypes.CRIMSON_HYPHAE, StateTypes.STRIPPED_CRIMSON_HYPHAE);
BlockTags.WARPED_STEMS.add(StateTypes.WARPED_STEM, StateTypes.STRIPPED_WARPED_STEM, StateTypes.WARPED_HYPHAE, StateTypes.STRIPPED_WARPED_HYPHAE);
BlockTags.MANGROVE_LOGS.add(StateTypes.MANGROVE_LOG, StateTypes.MANGROVE_WOOD, StateTypes.STRIPPED_MANGROVE_LOG, StateTypes.STRIPPED_MANGROVE_WOOD);
BlockTags.LOGS_THAT_BURN.addTag(BlockTags.DARK_OAK_LOGS).addTag(BlockTags.OAK_LOGS).addTag(BlockTags.ACACIA_LOGS).addTag(BlockTags.BIRCH_LOGS).addTag(BlockTags.JUNGLE_LOGS).addTag(BlockTags.SPRUCE_LOGS).addTag(BlockTags.MANGROVE_LOGS).addTag(BlockTags.CHERRY_LOGS);
BlockTags.OVERWORLD_NATURAL_LOGS.add(StateTypes.ACACIA_LOG).add(StateTypes.BIRCH_LOG).add(StateTypes.OAK_LOG).add(StateTypes.JUNGLE_LOG).add(StateTypes.SPRUCE_LOG).add(StateTypes.DARK_OAK_LOG).add(StateTypes.MANGROVE_LOG).add(StateTypes.CHERRY_LOG);
BlockTags.LOGS.addTag(BlockTags.LOGS_THAT_BURN).addTag(BlockTags.CRIMSON_STEMS).addTag(BlockTags.WARPED_STEMS);
BlockTags.ANVIL.add(StateTypes.ANVIL, StateTypes.CHIPPED_ANVIL, StateTypes.DAMAGED_ANVIL);
BlockTags.SMALL_FLOWERS.add(StateTypes.DANDELION, StateTypes.POPPY, StateTypes.BLUE_ORCHID, StateTypes.ALLIUM, StateTypes.AZURE_BLUET, StateTypes.RED_TULIP, StateTypes.ORANGE_TULIP, StateTypes.WHITE_TULIP, StateTypes.PINK_TULIP, StateTypes.OXEYE_DAISY, StateTypes.CORNFLOWER, StateTypes.LILY_OF_THE_VALLEY, StateTypes.WITHER_ROSE, StateTypes.TORCHFLOWER);
BlockTags.DIRT.add(StateTypes.DIRT, StateTypes.GRASS_BLOCK, StateTypes.PODZOL, StateTypes.COARSE_DIRT, StateTypes.MYCELIUM, StateTypes.ROOTED_DIRT, StateTypes.MOSS_BLOCK, StateTypes.MUD, StateTypes.MUDDY_MANGROVE_ROOTS);
BlockTags.ENDERMAN_HOLDABLE.addTag(BlockTags.SMALL_FLOWERS).addTag(BlockTags.DIRT).add(StateTypes.SAND, StateTypes.RED_SAND, StateTypes.GRAVEL, StateTypes.BROWN_MUSHROOM, StateTypes.RED_MUSHROOM, StateTypes.TNT, StateTypes.CACTUS, StateTypes.CLAY, StateTypes.PUMPKIN, StateTypes.CARVED_PUMPKIN, StateTypes.MELON, StateTypes.CRIMSON_FUNGUS, StateTypes.CRIMSON_NYLIUM, StateTypes.CRIMSON_ROOTS, StateTypes.WARPED_FUNGUS, StateTypes.WARPED_NYLIUM, StateTypes.WARPED_ROOTS);
BlockTags.FLOWER_POTS.add(StateTypes.FLOWER_POT, StateTypes.POTTED_POPPY, StateTypes.POTTED_BLUE_ORCHID, StateTypes.POTTED_ALLIUM, StateTypes.POTTED_AZURE_BLUET, StateTypes.POTTED_RED_TULIP, StateTypes.POTTED_ORANGE_TULIP, StateTypes.POTTED_WHITE_TULIP, StateTypes.POTTED_PINK_TULIP, StateTypes.POTTED_OXEYE_DAISY, StateTypes.POTTED_DANDELION, StateTypes.POTTED_OAK_SAPLING, StateTypes.POTTED_SPRUCE_SAPLING, StateTypes.POTTED_BIRCH_SAPLING, StateTypes.POTTED_JUNGLE_SAPLING, StateTypes.POTTED_ACACIA_SAPLING, StateTypes.POTTED_DARK_OAK_SAPLING, StateTypes.POTTED_RED_MUSHROOM, StateTypes.POTTED_BROWN_MUSHROOM, StateTypes.POTTED_DEAD_BUSH, StateTypes.POTTED_FERN, StateTypes.POTTED_CACTUS, StateTypes.POTTED_CORNFLOWER, StateTypes.POTTED_LILY_OF_THE_VALLEY, StateTypes.POTTED_WITHER_ROSE, StateTypes.POTTED_BAMBOO, StateTypes.POTTED_CRIMSON_FUNGUS, StateTypes.POTTED_WARPED_FUNGUS, StateTypes.POTTED_CRIMSON_ROOTS, StateTypes.POTTED_WARPED_ROOTS, StateTypes.POTTED_AZALEA_BUSH, StateTypes.POTTED_FLOWERING_AZALEA_BUSH, StateTypes.POTTED_MANGROVE_PROPAGULE, StateTypes.POTTED_CHERRY_SAPLING, StateTypes.POTTED_TORCHFLOWER);
BlockTags.BANNERS.add(StateTypes.WHITE_BANNER, StateTypes.ORANGE_BANNER, StateTypes.MAGENTA_BANNER, StateTypes.LIGHT_BLUE_BANNER, StateTypes.YELLOW_BANNER, StateTypes.LIME_BANNER, StateTypes.PINK_BANNER, StateTypes.GRAY_BANNER, StateTypes.LIGHT_GRAY_BANNER, StateTypes.CYAN_BANNER, StateTypes.PURPLE_BANNER, StateTypes.BLUE_BANNER, StateTypes.BROWN_BANNER, StateTypes.GREEN_BANNER, StateTypes.RED_BANNER, StateTypes.BLACK_BANNER, StateTypes.WHITE_WALL_BANNER, StateTypes.ORANGE_WALL_BANNER, StateTypes.MAGENTA_WALL_BANNER, StateTypes.LIGHT_BLUE_WALL_BANNER, StateTypes.YELLOW_WALL_BANNER, StateTypes.LIME_WALL_BANNER, StateTypes.PINK_WALL_BANNER, StateTypes.GRAY_WALL_BANNER, StateTypes.LIGHT_GRAY_WALL_BANNER, StateTypes.CYAN_WALL_BANNER, StateTypes.PURPLE_WALL_BANNER, StateTypes.BLUE_WALL_BANNER, StateTypes.BROWN_WALL_BANNER, StateTypes.GREEN_WALL_BANNER, StateTypes.RED_WALL_BANNER, StateTypes.BLACK_WALL_BANNER);
BlockTags.PRESSURE_PLATES.addTag(BlockTags.WOODEN_PRESSURE_PLATES).addTag(BlockTags.STONE_PRESSURE_PLATES).add(StateTypes.LIGHT_WEIGHTED_PRESSURE_PLATE, StateTypes.HEAVY_WEIGHTED_PRESSURE_PLATE);
BlockTags.WOODEN_PRESSURE_PLATES.add(StateTypes.OAK_PRESSURE_PLATE, StateTypes.SPRUCE_PRESSURE_PLATE, StateTypes.BIRCH_PRESSURE_PLATE, StateTypes.JUNGLE_PRESSURE_PLATE, StateTypes.ACACIA_PRESSURE_PLATE, StateTypes.DARK_OAK_PRESSURE_PLATE, StateTypes.CRIMSON_PRESSURE_PLATE, StateTypes.WARPED_PRESSURE_PLATE, StateTypes.MANGROVE_PRESSURE_PLATE, StateTypes.BAMBOO_PRESSURE_PLATE, StateTypes.CHERRY_PRESSURE_PLATE);
BlockTags.STONE_PRESSURE_PLATES.add(StateTypes.STONE_PRESSURE_PLATE, StateTypes.POLISHED_BLACKSTONE_PRESSURE_PLATE);
BlockTags.PRESSURE_PLATES.add(StateTypes.LIGHT_WEIGHTED_PRESSURE_PLATE, StateTypes.HEAVY_WEIGHTED_PRESSURE_PLATE).addTag(BlockTags.WOODEN_PRESSURE_PLATES).addTag(BlockTags.STONE_PRESSURE_PLATES);
BlockTags.WOODEN_TRAPDOORS.add(StateTypes.ACACIA_TRAPDOOR, StateTypes.BIRCH_TRAPDOOR, StateTypes.DARK_OAK_TRAPDOOR, StateTypes.JUNGLE_TRAPDOOR, StateTypes.OAK_TRAPDOOR, StateTypes.SPRUCE_TRAPDOOR, StateTypes.CRIMSON_TRAPDOOR, StateTypes.WARPED_TRAPDOOR, StateTypes.MANGROVE_TRAPDOOR, StateTypes.BAMBOO_TRAPDOOR, StateTypes.CHERRY_TRAPDOOR);
BlockTags.DOORS.addTag(BlockTags.WOODEN_DOORS).add(StateTypes.IRON_DOOR);
BlockTags.SAPLINGS.add(StateTypes.OAK_SAPLING, StateTypes.SPRUCE_SAPLING, StateTypes.BIRCH_SAPLING, StateTypes.JUNGLE_SAPLING, StateTypes.ACACIA_SAPLING, StateTypes.DARK_OAK_SAPLING, StateTypes.AZALEA, StateTypes.FLOWERING_AZALEA, StateTypes.MANGROVE_PROPAGULE, StateTypes.CHERRY_SAPLING);
BlockTags.LOGS_THAT_BURN.addTag(BlockTags.DARK_OAK_LOGS).addTag(BlockTags.OAK_LOGS).addTag(BlockTags.ACACIA_LOGS).addTag(BlockTags.BIRCH_LOGS).addTag(BlockTags.JUNGLE_LOGS).addTag(BlockTags.SPRUCE_LOGS).addTag(BlockTags.MANGROVE_LOGS).addTag(BlockTags.CHERRY_LOGS);
BlockTags.OVERWORLD_NATURAL_LOGS.add(StateTypes.ACACIA_LOG, StateTypes.BIRCH_LOG, StateTypes.OAK_LOG, StateTypes.JUNGLE_LOG, StateTypes.SPRUCE_LOG, StateTypes.DARK_OAK_LOG, StateTypes.MANGROVE_LOG, StateTypes.CHERRY_LOG);
BlockTags.LOGS.addTag(BlockTags.LOGS_THAT_BURN).addTag(BlockTags.CRIMSON_STEMS).addTag(BlockTags.WARPED_STEMS);
BlockTags.DARK_OAK_LOGS.add(StateTypes.DARK_OAK_LOG, StateTypes.DARK_OAK_WOOD, StateTypes.STRIPPED_DARK_OAK_LOG, StateTypes.STRIPPED_DARK_OAK_WOOD);
BlockTags.OAK_LOGS.add(StateTypes.OAK_LOG, StateTypes.OAK_WOOD, StateTypes.STRIPPED_OAK_LOG, StateTypes.STRIPPED_OAK_WOOD);
BlockTags.BIRCH_LOGS.add(StateTypes.BIRCH_LOG, StateTypes.BIRCH_WOOD, StateTypes.STRIPPED_BIRCH_LOG, StateTypes.STRIPPED_BIRCH_WOOD);
BlockTags.ACACIA_LOGS.add(StateTypes.ACACIA_LOG, StateTypes.ACACIA_WOOD, StateTypes.STRIPPED_ACACIA_LOG, StateTypes.STRIPPED_ACACIA_WOOD);
BlockTags.CHERRY_LOGS.add(StateTypes.CHERRY_LOG, StateTypes.CHERRY_WOOD, StateTypes.STRIPPED_CHERRY_LOG, StateTypes.STRIPPED_CHERRY_WOOD);
BlockTags.JUNGLE_LOGS.add(StateTypes.JUNGLE_LOG, StateTypes.JUNGLE_WOOD, StateTypes.STRIPPED_JUNGLE_LOG, StateTypes.STRIPPED_JUNGLE_WOOD);
BlockTags.SPRUCE_LOGS.add(StateTypes.SPRUCE_LOG, StateTypes.SPRUCE_WOOD, StateTypes.STRIPPED_SPRUCE_LOG, StateTypes.STRIPPED_SPRUCE_WOOD);
BlockTags.MANGROVE_LOGS.add(StateTypes.MANGROVE_LOG, StateTypes.MANGROVE_WOOD, StateTypes.STRIPPED_MANGROVE_LOG, StateTypes.STRIPPED_MANGROVE_WOOD);
BlockTags.CRIMSON_STEMS.add(StateTypes.CRIMSON_STEM, StateTypes.STRIPPED_CRIMSON_STEM, StateTypes.CRIMSON_HYPHAE, StateTypes.STRIPPED_CRIMSON_HYPHAE);
BlockTags.WARPED_STEMS.add(StateTypes.WARPED_STEM, StateTypes.STRIPPED_WARPED_STEM, StateTypes.WARPED_HYPHAE, StateTypes.STRIPPED_WARPED_HYPHAE);
BlockTags.BAMBOO_BLOCKS.add(StateTypes.BAMBOO_BLOCK, StateTypes.STRIPPED_BAMBOO_BLOCK);
BlockTags.WART_BLOCKS.add(StateTypes.NETHER_WART_BLOCK, StateTypes.WARPED_WART_BLOCK);
BlockTags.BANNERS.add(StateTypes.WHITE_BANNER, StateTypes.ORANGE_BANNER, StateTypes.MAGENTA_BANNER, StateTypes.LIGHT_BLUE_BANNER, StateTypes.YELLOW_BANNER, StateTypes.LIME_BANNER, StateTypes.PINK_BANNER, StateTypes.GRAY_BANNER, StateTypes.LIGHT_GRAY_BANNER, StateTypes.CYAN_BANNER, StateTypes.PURPLE_BANNER, StateTypes.BLUE_BANNER, StateTypes.BROWN_BANNER, StateTypes.GREEN_BANNER, StateTypes.RED_BANNER, StateTypes.BLACK_BANNER, StateTypes.WHITE_WALL_BANNER, StateTypes.ORANGE_WALL_BANNER, StateTypes.MAGENTA_WALL_BANNER, StateTypes.LIGHT_BLUE_WALL_BANNER, StateTypes.YELLOW_WALL_BANNER, StateTypes.LIME_WALL_BANNER, StateTypes.PINK_WALL_BANNER, StateTypes.GRAY_WALL_BANNER, StateTypes.LIGHT_GRAY_WALL_BANNER, StateTypes.CYAN_WALL_BANNER, StateTypes.PURPLE_WALL_BANNER, StateTypes.BLUE_WALL_BANNER, StateTypes.BROWN_WALL_BANNER, StateTypes.GREEN_WALL_BANNER, StateTypes.RED_WALL_BANNER, StateTypes.BLACK_WALL_BANNER);
BlockTags.SAND.add(StateTypes.SAND, StateTypes.RED_SAND, StateTypes.SUSPICIOUS_SAND, StateTypes.SUSPICIOUS_SAND);
BlockTags.SMELTS_TO_GLASS.add(StateTypes.SAND, StateTypes.RED_SAND);
BlockTags.STAIRS.addTag(BlockTags.WOODEN_STAIRS).add(StateTypes.BAMBOO_MOSAIC_STAIRS, StateTypes.COBBLESTONE_STAIRS, StateTypes.SANDSTONE_STAIRS, StateTypes.NETHER_BRICK_STAIRS, StateTypes.STONE_BRICK_STAIRS, StateTypes.BRICK_STAIRS, StateTypes.PURPUR_STAIRS, StateTypes.QUARTZ_STAIRS, StateTypes.RED_SANDSTONE_STAIRS, StateTypes.PRISMARINE_BRICK_STAIRS, StateTypes.PRISMARINE_STAIRS, StateTypes.DARK_PRISMARINE_STAIRS, StateTypes.POLISHED_GRANITE_STAIRS, StateTypes.SMOOTH_RED_SANDSTONE_STAIRS, StateTypes.MOSSY_STONE_BRICK_STAIRS, StateTypes.POLISHED_DIORITE_STAIRS, StateTypes.MOSSY_COBBLESTONE_STAIRS, StateTypes.END_STONE_BRICK_STAIRS, StateTypes.STONE_STAIRS, StateTypes.SMOOTH_SANDSTONE_STAIRS, StateTypes.SMOOTH_QUARTZ_STAIRS, StateTypes.GRANITE_STAIRS, StateTypes.ANDESITE_STAIRS, StateTypes.RED_NETHER_BRICK_STAIRS, StateTypes.POLISHED_ANDESITE_STAIRS, StateTypes.DIORITE_STAIRS, StateTypes.BLACKSTONE_STAIRS, StateTypes.POLISHED_BLACKSTONE_BRICK_STAIRS, StateTypes.POLISHED_BLACKSTONE_STAIRS, StateTypes.COBBLED_DEEPSLATE_STAIRS, StateTypes.POLISHED_DEEPSLATE_STAIRS, StateTypes.DEEPSLATE_TILE_STAIRS, StateTypes.DEEPSLATE_BRICK_STAIRS, StateTypes.OXIDIZED_CUT_COPPER_STAIRS, StateTypes.WEATHERED_CUT_COPPER_STAIRS, StateTypes.EXPOSED_CUT_COPPER_STAIRS, StateTypes.CUT_COPPER_STAIRS, StateTypes.WAXED_WEATHERED_CUT_COPPER_STAIRS, StateTypes.WAXED_EXPOSED_CUT_COPPER_STAIRS, StateTypes.WAXED_CUT_COPPER_STAIRS, StateTypes.WAXED_OXIDIZED_CUT_COPPER_STAIRS, StateTypes.MUD_BRICK_STAIRS);
BlockTags.SLABS.addTag(BlockTags.WOODEN_SLABS).add(StateTypes.BAMBOO_MOSAIC_SLAB, StateTypes.STONE_SLAB, StateTypes.SMOOTH_STONE_SLAB, StateTypes.STONE_BRICK_SLAB, StateTypes.SANDSTONE_SLAB, StateTypes.PURPUR_SLAB, StateTypes.QUARTZ_SLAB, StateTypes.RED_SANDSTONE_SLAB, StateTypes.BRICK_SLAB, StateTypes.COBBLESTONE_SLAB, StateTypes.NETHER_BRICK_SLAB, StateTypes.PETRIFIED_OAK_SLAB, StateTypes.PRISMARINE_SLAB, StateTypes.PRISMARINE_BRICK_SLAB, StateTypes.DARK_PRISMARINE_SLAB, StateTypes.POLISHED_GRANITE_SLAB, StateTypes.SMOOTH_RED_SANDSTONE_SLAB, StateTypes.MOSSY_STONE_BRICK_SLAB, StateTypes.POLISHED_DIORITE_SLAB, StateTypes.MOSSY_COBBLESTONE_SLAB, StateTypes.END_STONE_BRICK_SLAB, StateTypes.SMOOTH_SANDSTONE_SLAB, StateTypes.SMOOTH_QUARTZ_SLAB, StateTypes.GRANITE_SLAB, StateTypes.ANDESITE_SLAB, StateTypes.RED_NETHER_BRICK_SLAB, StateTypes.POLISHED_ANDESITE_SLAB, StateTypes.DIORITE_SLAB, StateTypes.CUT_SANDSTONE_SLAB, StateTypes.CUT_RED_SANDSTONE_SLAB, StateTypes.BLACKSTONE_SLAB, StateTypes.POLISHED_BLACKSTONE_BRICK_SLAB, StateTypes.POLISHED_BLACKSTONE_SLAB, StateTypes.COBBLED_DEEPSLATE_SLAB, StateTypes.POLISHED_DEEPSLATE_SLAB, StateTypes.DEEPSLATE_TILE_SLAB, StateTypes.DEEPSLATE_BRICK_SLAB, StateTypes.WAXED_WEATHERED_CUT_COPPER_SLAB, StateTypes.WAXED_EXPOSED_CUT_COPPER_SLAB, StateTypes.WAXED_CUT_COPPER_SLAB, StateTypes.OXIDIZED_CUT_COPPER_SLAB, StateTypes.WEATHERED_CUT_COPPER_SLAB, StateTypes.EXPOSED_CUT_COPPER_SLAB, StateTypes.CUT_COPPER_SLAB, StateTypes.WAXED_OXIDIZED_CUT_COPPER_SLAB, StateTypes.MUD_BRICK_SLAB);
BlockTags.WALLS.add(StateTypes.COBBLESTONE_WALL, StateTypes.MOSSY_COBBLESTONE_WALL, StateTypes.BRICK_WALL, StateTypes.PRISMARINE_WALL, StateTypes.RED_SANDSTONE_WALL, StateTypes.MOSSY_STONE_BRICK_WALL, StateTypes.GRANITE_WALL, StateTypes.STONE_BRICK_WALL, StateTypes.NETHER_BRICK_WALL, StateTypes.ANDESITE_WALL, StateTypes.RED_NETHER_BRICK_WALL, StateTypes.SANDSTONE_WALL, StateTypes.END_STONE_BRICK_WALL, StateTypes.DIORITE_WALL, StateTypes.BLACKSTONE_WALL, StateTypes.POLISHED_BLACKSTONE_BRICK_WALL, StateTypes.POLISHED_BLACKSTONE_WALL, StateTypes.COBBLED_DEEPSLATE_WALL, StateTypes.POLISHED_DEEPSLATE_WALL, StateTypes.DEEPSLATE_TILE_WALL, StateTypes.DEEPSLATE_BRICK_WALL, StateTypes.MUD_BRICK_WALL);
BlockTags.CORAL_PLANTS.add(StateTypes.TUBE_CORAL, StateTypes.BRAIN_CORAL, StateTypes.BUBBLE_CORAL, StateTypes.FIRE_CORAL, StateTypes.HORN_CORAL);
BlockTags.CORALS.addTag(BlockTags.CORAL_PLANTS).add(StateTypes.TUBE_CORAL_FAN, StateTypes.BRAIN_CORAL_FAN, StateTypes.BUBBLE_CORAL_FAN, StateTypes.FIRE_CORAL_FAN, StateTypes.HORN_CORAL_FAN);
BlockTags.WALL_CORALS.add(StateTypes.TUBE_CORAL_WALL_FAN, StateTypes.BRAIN_CORAL_WALL_FAN, StateTypes.BUBBLE_CORAL_WALL_FAN, StateTypes.FIRE_CORAL_WALL_FAN, StateTypes.HORN_CORAL_WALL_FAN);
BlockTags.SAND.add(StateTypes.SAND, StateTypes.RED_SAND, StateTypes.SUSPICIOUS_SAND);
BlockTags.SMELTS_TO_GLASS.add(StateTypes.SAND, StateTypes.RED_SAND);
BlockTags.ANVIL.add(StateTypes.ANVIL, StateTypes.CHIPPED_ANVIL, StateTypes.DAMAGED_ANVIL);
BlockTags.RAILS.add(StateTypes.RAIL, StateTypes.POWERED_RAIL, StateTypes.DETECTOR_RAIL, StateTypes.ACTIVATOR_RAIL);
BlockTags.CORAL_BLOCKS.add(StateTypes.TUBE_CORAL_BLOCK, StateTypes.BRAIN_CORAL_BLOCK, StateTypes.BUBBLE_CORAL_BLOCK, StateTypes.FIRE_CORAL_BLOCK, StateTypes.HORN_CORAL_BLOCK);
BlockTags.ICE.add(StateTypes.ICE, StateTypes.PACKED_ICE, StateTypes.BLUE_ICE, StateTypes.FROSTED_ICE);
BlockTags.VALID_SPAWN.add(StateTypes.GRASS_BLOCK, StateTypes.PODZOL);
BlockTags.LEAVES.add(StateTypes.JUNGLE_LEAVES, StateTypes.OAK_LEAVES, StateTypes.SPRUCE_LEAVES, StateTypes.DARK_OAK_LEAVES, StateTypes.ACACIA_LEAVES, StateTypes.BIRCH_LEAVES, StateTypes.AZALEA_LEAVES, StateTypes.FLOWERING_AZALEA_LEAVES, StateTypes.MANGROVE_LEAVES, StateTypes.CHERRY_LEAVES);
BlockTags.IMPERMEABLE.add(StateTypes.GLASS, StateTypes.WHITE_STAINED_GLASS, StateTypes.ORANGE_STAINED_GLASS, StateTypes.MAGENTA_STAINED_GLASS, StateTypes.LIGHT_BLUE_STAINED_GLASS, StateTypes.YELLOW_STAINED_GLASS, StateTypes.LIME_STAINED_GLASS, StateTypes.PINK_STAINED_GLASS, StateTypes.GRAY_STAINED_GLASS, StateTypes.LIGHT_GRAY_STAINED_GLASS, StateTypes.CYAN_STAINED_GLASS, StateTypes.PURPLE_STAINED_GLASS, StateTypes.BLUE_STAINED_GLASS, StateTypes.BROWN_STAINED_GLASS, StateTypes.GREEN_STAINED_GLASS, StateTypes.RED_STAINED_GLASS, StateTypes.BLACK_STAINED_GLASS, StateTypes.TINTED_GLASS);
BlockTags.WOODEN_TRAPDOORS.add(StateTypes.ACACIA_TRAPDOOR, StateTypes.BIRCH_TRAPDOOR, StateTypes.DARK_OAK_TRAPDOOR, StateTypes.JUNGLE_TRAPDOOR, StateTypes.OAK_TRAPDOOR, StateTypes.SPRUCE_TRAPDOOR, StateTypes.CRIMSON_TRAPDOOR, StateTypes.WARPED_TRAPDOOR, StateTypes.MANGROVE_TRAPDOOR, StateTypes.BAMBOO_TRAPDOOR, StateTypes.CHERRY_TRAPDOOR);
BlockTags.TRAPDOORS.addTag(BlockTags.WOODEN_TRAPDOORS).add(StateTypes.IRON_TRAPDOOR);
BlockTags.UNDERWATER_BONEMEALS.add(StateTypes.SEAGRASS).addTag(BlockTags.CORALS).addTag(BlockTags.WALL_CORALS);
BlockTags.BAMBOO_PLANTABLE_ON.addTag(BlockTags.SAND).addTag(BlockTags.DIRT).add(StateTypes.BAMBOO, StateTypes.BAMBOO_SAPLING, StateTypes.GRAVEL, StateTypes.SUSPICIOUS_GRAVEL);
BlockTags.STANDING_SIGNS.add(StateTypes.OAK_SIGN, StateTypes.SPRUCE_SIGN, StateTypes.BIRCH_SIGN, StateTypes.ACACIA_SIGN, StateTypes.JUNGLE_SIGN, StateTypes.DARK_OAK_SIGN, StateTypes.CRIMSON_SIGN, StateTypes.WARPED_SIGN, StateTypes.MANGROVE_SIGN, StateTypes.BAMBOO_SIGN, StateTypes.CHERRY_SIGN);
BlockTags.WALL_SIGNS.add(StateTypes.OAK_WALL_SIGN, StateTypes.SPRUCE_WALL_SIGN, StateTypes.BIRCH_WALL_SIGN, StateTypes.ACACIA_WALL_SIGN, StateTypes.JUNGLE_WALL_SIGN, StateTypes.DARK_OAK_WALL_SIGN, StateTypes.CRIMSON_WALL_SIGN, StateTypes.WARPED_WALL_SIGN, StateTypes.MANGROVE_WALL_SIGN, StateTypes.BAMBOO_WALL_SIGN, StateTypes.CHERRY_WALL_SIGN);
BlockTags.SIGNS.addTag(BlockTags.STANDING_SIGNS).addTag(BlockTags.WALL_SIGNS);
BlockTags.CEILING_HANGING_SIGNS.add(StateTypes.OAK_HANGING_SIGN, StateTypes.SPRUCE_HANGING_SIGN, StateTypes.BIRCH_HANGING_SIGN, StateTypes.ACACIA_HANGING_SIGN, StateTypes.JUNGLE_HANGING_SIGN, StateTypes.DARK_OAK_HANGING_SIGN, StateTypes.CRIMSON_HANGING_SIGN, StateTypes.WARPED_HANGING_SIGN, StateTypes.MANGROVE_HANGING_SIGN, StateTypes.BAMBOO_HANGING_SIGN, StateTypes.CHERRY_HANGING_SIGN);
BlockTags.WALL_HANGING_SIGNS.add(StateTypes.OAK_WALL_HANGING_SIGN, StateTypes.SPRUCE_WALL_HANGING_SIGN, StateTypes.BIRCH_WALL_HANGING_SIGN, StateTypes.ACACIA_WALL_HANGING_SIGN, StateTypes.JUNGLE_WALL_HANGING_SIGN, StateTypes.DARK_OAK_WALL_HANGING_SIGN, StateTypes.MANGROVE_WALL_HANGING_SIGN, StateTypes.CRIMSON_WALL_HANGING_SIGN, StateTypes.WARPED_WALL_HANGING_SIGN, StateTypes.BAMBOO_WALL_HANGING_SIGN, StateTypes.CHERRY_WALL_HANGING_SIGN);
BlockTags.ALL_HANGING_SIGNS.addTag(BlockTags.CEILING_HANGING_SIGNS).addTag(BlockTags.WALL_HANGING_SIGNS);
BlockTags.ALL_SIGNS.addTag(BlockTags.SIGNS).addTag(BlockTags.ALL_HANGING_SIGNS);
BlockTags.SMALL_FLOWERS.add(StateTypes.DANDELION, StateTypes.POPPY, StateTypes.BLUE_ORCHID, StateTypes.ALLIUM, StateTypes.AZURE_BLUET, StateTypes.RED_TULIP, StateTypes.ORANGE_TULIP, StateTypes.WHITE_TULIP, StateTypes.PINK_TULIP, StateTypes.OXEYE_DAISY, StateTypes.CORNFLOWER, StateTypes.LILY_OF_THE_VALLEY, StateTypes.WITHER_ROSE, StateTypes.TORCHFLOWER);
BlockTags.BEDS.add(StateTypes.RED_BED, StateTypes.BLACK_BED, StateTypes.BLUE_BED, StateTypes.BROWN_BED, StateTypes.CYAN_BED, StateTypes.GRAY_BED, StateTypes.GREEN_BED, StateTypes.LIGHT_BLUE_BED, StateTypes.LIGHT_GRAY_BED, StateTypes.LIME_BED, StateTypes.MAGENTA_BED, StateTypes.ORANGE_BED, StateTypes.PINK_BED, StateTypes.PURPLE_BED, StateTypes.WHITE_BED, StateTypes.YELLOW_BED);
BlockTags.FENCES.addTag(BlockTags.WOODEN_FENCES).add(StateTypes.NETHER_BRICK_FENCE);
BlockTags.DRAGON_IMMUNE.add(StateTypes.BARRIER, StateTypes.BEDROCK, StateTypes.END_PORTAL, StateTypes.END_PORTAL_FRAME, StateTypes.END_GATEWAY, StateTypes.COMMAND_BLOCK, StateTypes.REPEATING_COMMAND_BLOCK, StateTypes.CHAIN_COMMAND_BLOCK, StateTypes.STRUCTURE_BLOCK, StateTypes.JIGSAW, StateTypes.MOVING_PISTON, StateTypes.OBSIDIAN, StateTypes.CRYING_OBSIDIAN, StateTypes.END_STONE, StateTypes.IRON_BARS, StateTypes.RESPAWN_ANCHOR, StateTypes.REINFORCED_DEEPSLATE);
BlockTags.DRAGON_TRANSPARENT.add(StateTypes.LIGHT).addTag(BlockTags.FIRE);
BlockTags.WITHER_IMMUNE.add(StateTypes.BARRIER, StateTypes.BEDROCK, StateTypes.END_PORTAL, StateTypes.END_PORTAL_FRAME, StateTypes.END_GATEWAY, StateTypes.COMMAND_BLOCK, StateTypes.REPEATING_COMMAND_BLOCK, StateTypes.CHAIN_COMMAND_BLOCK, StateTypes.STRUCTURE_BLOCK, StateTypes.JIGSAW, StateTypes.MOVING_PISTON, StateTypes.LIGHT, StateTypes.REINFORCED_DEEPSLATE);
BlockTags.WITHER_SUMMON_BASE_BLOCKS.add(StateTypes.SOUL_SAND, StateTypes.SOUL_SOIL);
BlockTags.TALL_FLOWERS.add(StateTypes.SUNFLOWER, StateTypes.LILAC, StateTypes.PEONY, StateTypes.ROSE_BUSH, StateTypes.PITCHER_PLANT);
BlockTags.FLOWERS.addTag(BlockTags.SMALL_FLOWERS).addTag(BlockTags.TALL_FLOWERS).add(StateTypes.FLOWERING_AZALEA_LEAVES, StateTypes.FLOWERING_AZALEA, StateTypes.MANGROVE_PROPAGULE);
BlockTags.BEEHIVES.add(StateTypes.BEE_NEST, StateTypes.BEEHIVE);
BlockTags.CROPS.add(StateTypes.BEETROOTS, StateTypes.CARROTS, StateTypes.POTATOES, StateTypes.WHEAT, StateTypes.MELON_STEM, StateTypes.PUMPKIN_STEM, StateTypes.TORCHFLOWER_CROP, StateTypes.PITCHER_CROP);
BlockTags.BEE_GROWABLES.addTag(BlockTags.CROPS).add(StateTypes.SWEET_BERRY_BUSH).add(StateTypes.CAVE_VINES).add(StateTypes.CAVE_VINES_PLANT);
BlockTags.SHULKER_BOXES.add(StateTypes.SHULKER_BOX, StateTypes.BLACK_SHULKER_BOX, StateTypes.BLUE_SHULKER_BOX, StateTypes.BROWN_SHULKER_BOX, StateTypes.CYAN_SHULKER_BOX, StateTypes.GRAY_SHULKER_BOX, StateTypes.GREEN_SHULKER_BOX, StateTypes.LIGHT_BLUE_SHULKER_BOX, StateTypes.LIGHT_GRAY_SHULKER_BOX, StateTypes.LIME_SHULKER_BOX, StateTypes.MAGENTA_SHULKER_BOX, StateTypes.ORANGE_SHULKER_BOX, StateTypes.PINK_SHULKER_BOX, StateTypes.PURPLE_SHULKER_BOX, StateTypes.RED_SHULKER_BOX, StateTypes.WHITE_SHULKER_BOX, StateTypes.YELLOW_SHULKER_BOX);
BlockTags.PORTALS.add(StateTypes.NETHER_PORTAL, StateTypes.END_PORTAL, StateTypes.END_GATEWAY);
BlockTags.FIRE.add(StateTypes.FIRE, StateTypes.SOUL_FIRE);
BlockTags.NYLIUM.add(StateTypes.CRIMSON_NYLIUM, StateTypes.WARPED_NYLIUM);
BlockTags.WART_BLOCKS.add(StateTypes.NETHER_WART_BLOCK, StateTypes.WARPED_WART_BLOCK);
BlockTags.BEACON_BASE_BLOCKS.add(StateTypes.NETHERITE_BLOCK, StateTypes.EMERALD_BLOCK, StateTypes.DIAMOND_BLOCK, StateTypes.GOLD_BLOCK, StateTypes.IRON_BLOCK);
BlockTags.SOUL_SPEED_BLOCKS.add(StateTypes.SOUL_SAND, StateTypes.SOUL_SOIL);
BlockTags.WALL_POST_OVERRIDE.add(StateTypes.TORCH, StateTypes.SOUL_TORCH, StateTypes.REDSTONE_TORCH, StateTypes.TRIPWIRE).addTag(BlockTags.SIGNS).addTag(BlockTags.BANNERS).addTag(BlockTags.PRESSURE_PLATES);
BlockTags.CLIMBABLE.add(StateTypes.LADDER, StateTypes.VINE, StateTypes.SCAFFOLDING, StateTypes.WEEPING_VINES, StateTypes.WEEPING_VINES_PLANT, StateTypes.TWISTING_VINES, StateTypes.TWISTING_VINES_PLANT, StateTypes.CAVE_VINES, StateTypes.CAVE_VINES_PLANT);
BlockTags.FALL_DAMAGE_RESETTING.addTag(BlockTags.CLIMBABLE).add(StateTypes.SWEET_BERRY_BUSH, StateTypes.COBWEB);
BlockTags.PIGLIN_REPELLENTS.add(StateTypes.SOUL_FIRE).add(StateTypes.SOUL_TORCH).add(StateTypes.SOUL_LANTERN).add(StateTypes.SOUL_WALL_TORCH).add(StateTypes.SOUL_CAMPFIRE);
BlockTags.HOGLIN_REPELLENTS.add(StateTypes.WARPED_FUNGUS).add(StateTypes.POTTED_WARPED_FUNGUS).add(StateTypes.NETHER_PORTAL).add(StateTypes.RESPAWN_ANCHOR);
BlockTags.FLOWERS.addTag(BlockTags.SMALL_FLOWERS).addTag(BlockTags.TALL_FLOWERS).add(StateTypes.FLOWERING_AZALEA_LEAVES, StateTypes.FLOWERING_AZALEA, StateTypes.MANGROVE_PROPAGULE, StateTypes.CHERRY_LEAVES, StateTypes.PINK_PETALS, StateTypes.CHORUS_FLOWER, StateTypes.SPORE_BLOSSOM);
BlockTags.PIGLIN_REPELLENTS.add(StateTypes.SOUL_FIRE, StateTypes.SOUL_TORCH, StateTypes.SOUL_LANTERN, StateTypes.SOUL_WALL_TORCH, StateTypes.SOUL_CAMPFIRE);
BlockTags.GOLD_ORES.add(StateTypes.GOLD_ORE, StateTypes.NETHER_GOLD_ORE, StateTypes.DEEPSLATE_GOLD_ORE);
BlockTags.IRON_ORES.add(StateTypes.IRON_ORE, StateTypes.DEEPSLATE_IRON_ORE);
BlockTags.DIAMOND_ORES.add(StateTypes.DIAMOND_ORE, StateTypes.DEEPSLATE_DIAMOND_ORE);
BlockTags.REDSTONE_ORES.add(StateTypes.REDSTONE_ORE, StateTypes.DEEPSLATE_REDSTONE_ORE);
BlockTags.LAPIS_ORES.add(StateTypes.LAPIS_ORE, StateTypes.DEEPSLATE_LAPIS_ORE);
BlockTags.COAL_ORES.add(StateTypes.COAL_ORE, StateTypes.DEEPSLATE_COAL_ORE);
BlockTags.EMERALD_ORES.add(StateTypes.EMERALD_ORE, StateTypes.DEEPSLATE_EMERALD_ORE);
BlockTags.COPPER_ORES.add(StateTypes.COPPER_ORE, StateTypes.DEEPSLATE_COPPER_ORE);
BlockTags.LAPIS_ORES.add(StateTypes.LAPIS_ORE, StateTypes.DEEPSLATE_LAPIS_ORE);
BlockTags.CANDLES.add(StateTypes.CANDLE, StateTypes.WHITE_CANDLE, StateTypes.ORANGE_CANDLE, StateTypes.MAGENTA_CANDLE, StateTypes.LIGHT_BLUE_CANDLE, StateTypes.YELLOW_CANDLE, StateTypes.LIME_CANDLE, StateTypes.PINK_CANDLE, StateTypes.GRAY_CANDLE, StateTypes.LIGHT_GRAY_CANDLE, StateTypes.CYAN_CANDLE, StateTypes.PURPLE_CANDLE, StateTypes.BLUE_CANDLE, StateTypes.BROWN_CANDLE, StateTypes.GREEN_CANDLE, StateTypes.RED_CANDLE, StateTypes.BLACK_CANDLE);
BlockTags.DIRT.add(StateTypes.DIRT, StateTypes.GRASS_BLOCK, StateTypes.PODZOL, StateTypes.COARSE_DIRT, StateTypes.MYCELIUM, StateTypes.ROOTED_DIRT, StateTypes.MOSS_BLOCK, StateTypes.MUD, StateTypes.MUDDY_MANGROVE_ROOTS);
BlockTags.TERRACOTTA.add(StateTypes.TERRACOTTA, StateTypes.WHITE_TERRACOTTA, StateTypes.ORANGE_TERRACOTTA, StateTypes.MAGENTA_TERRACOTTA, StateTypes.LIGHT_BLUE_TERRACOTTA, StateTypes.YELLOW_TERRACOTTA, StateTypes.LIME_TERRACOTTA, StateTypes.PINK_TERRACOTTA, StateTypes.GRAY_TERRACOTTA, StateTypes.LIGHT_GRAY_TERRACOTTA, StateTypes.CYAN_TERRACOTTA, StateTypes.PURPLE_TERRACOTTA, StateTypes.BLUE_TERRACOTTA, StateTypes.BROWN_TERRACOTTA, StateTypes.GREEN_TERRACOTTA, StateTypes.RED_TERRACOTTA, StateTypes.BLACK_TERRACOTTA);
BlockTags.CONCRETE_POWDER.add(StateTypes.WHITE_CONCRETE_POWDER, StateTypes.ORANGE_CONCRETE_POWDER, StateTypes.MAGENTA_CONCRETE_POWDER, StateTypes.LIGHT_BLUE_CONCRETE_POWDER, StateTypes.YELLOW_CONCRETE_POWDER, StateTypes.LIME_CONCRETE_POWDER, StateTypes.PINK_CONCRETE_POWDER, StateTypes.GRAY_CONCRETE_POWDER, StateTypes.LIGHT_GRAY_CONCRETE_POWDER, StateTypes.CYAN_CONCRETE_POWDER, StateTypes.PURPLE_CONCRETE_POWDER, StateTypes.BLUE_CONCRETE_POWDER, StateTypes.BROWN_CONCRETE_POWDER, StateTypes.GREEN_CONCRETE_POWDER, StateTypes.RED_CONCRETE_POWDER, StateTypes.BLACK_CONCRETE_POWDER);
BlockTags.COMPLETES_FIND_TREE_TUTORIAL.addTag(BlockTags.LOGS).addTag(BlockTags.LEAVES).addTag(BlockTags.WART_BLOCKS);
BlockTags.FLOWER_POTS.add(StateTypes.FLOWER_POT, StateTypes.POTTED_POPPY, StateTypes.POTTED_BLUE_ORCHID, StateTypes.POTTED_ALLIUM, StateTypes.POTTED_AZURE_BLUET, StateTypes.POTTED_RED_TULIP, StateTypes.POTTED_ORANGE_TULIP, StateTypes.POTTED_WHITE_TULIP, StateTypes.POTTED_PINK_TULIP, StateTypes.POTTED_OXEYE_DAISY, StateTypes.POTTED_DANDELION, StateTypes.POTTED_OAK_SAPLING, StateTypes.POTTED_SPRUCE_SAPLING, StateTypes.POTTED_BIRCH_SAPLING, StateTypes.POTTED_JUNGLE_SAPLING, StateTypes.POTTED_ACACIA_SAPLING, StateTypes.POTTED_DARK_OAK_SAPLING, StateTypes.POTTED_RED_MUSHROOM, StateTypes.POTTED_BROWN_MUSHROOM, StateTypes.POTTED_DEAD_BUSH, StateTypes.POTTED_FERN, StateTypes.POTTED_CACTUS, StateTypes.POTTED_CORNFLOWER, StateTypes.POTTED_LILY_OF_THE_VALLEY, StateTypes.POTTED_WITHER_ROSE, StateTypes.POTTED_BAMBOO, StateTypes.POTTED_CRIMSON_FUNGUS, StateTypes.POTTED_WARPED_FUNGUS, StateTypes.POTTED_CRIMSON_ROOTS, StateTypes.POTTED_WARPED_ROOTS, StateTypes.POTTED_AZALEA_BUSH, StateTypes.POTTED_FLOWERING_AZALEA_BUSH, StateTypes.POTTED_MANGROVE_PROPAGULE, StateTypes.POTTED_CHERRY_SAPLING, StateTypes.POTTED_TORCHFLOWER);
BlockTags.ENDERMAN_HOLDABLE.addTag(BlockTags.SMALL_FLOWERS).addTag(BlockTags.DIRT).add(StateTypes.SAND, StateTypes.RED_SAND, StateTypes.GRAVEL, StateTypes.BROWN_MUSHROOM, StateTypes.RED_MUSHROOM, StateTypes.TNT, StateTypes.CACTUS, StateTypes.CLAY, StateTypes.PUMPKIN, StateTypes.CARVED_PUMPKIN, StateTypes.MELON, StateTypes.CRIMSON_FUNGUS, StateTypes.CRIMSON_NYLIUM, StateTypes.CRIMSON_ROOTS, StateTypes.WARPED_FUNGUS, StateTypes.WARPED_NYLIUM, StateTypes.WARPED_ROOTS);
BlockTags.ICE.add(StateTypes.ICE, StateTypes.PACKED_ICE, StateTypes.BLUE_ICE, StateTypes.FROSTED_ICE);
BlockTags.VALID_SPAWN.add(StateTypes.GRASS_BLOCK, StateTypes.PODZOL);
BlockTags.IMPERMEABLE.add(StateTypes.GLASS, StateTypes.WHITE_STAINED_GLASS, StateTypes.ORANGE_STAINED_GLASS, StateTypes.MAGENTA_STAINED_GLASS, StateTypes.LIGHT_BLUE_STAINED_GLASS, StateTypes.YELLOW_STAINED_GLASS, StateTypes.LIME_STAINED_GLASS, StateTypes.PINK_STAINED_GLASS, StateTypes.GRAY_STAINED_GLASS, StateTypes.LIGHT_GRAY_STAINED_GLASS, StateTypes.CYAN_STAINED_GLASS, StateTypes.PURPLE_STAINED_GLASS, StateTypes.BLUE_STAINED_GLASS, StateTypes.BROWN_STAINED_GLASS, StateTypes.GREEN_STAINED_GLASS, StateTypes.RED_STAINED_GLASS, StateTypes.BLACK_STAINED_GLASS, StateTypes.TINTED_GLASS);
BlockTags.UNDERWATER_BONEMEALS.addTag(BlockTags.CORALS).addTag(BlockTags.WALL_CORALS).add(StateTypes.SEAGRASS);
BlockTags.CORAL_BLOCKS.add(StateTypes.TUBE_CORAL_BLOCK, StateTypes.BRAIN_CORAL_BLOCK, StateTypes.BUBBLE_CORAL_BLOCK, StateTypes.FIRE_CORAL_BLOCK, StateTypes.HORN_CORAL_BLOCK);
BlockTags.WALL_CORALS.add(StateTypes.TUBE_CORAL_WALL_FAN, StateTypes.BRAIN_CORAL_WALL_FAN, StateTypes.BUBBLE_CORAL_WALL_FAN, StateTypes.FIRE_CORAL_WALL_FAN, StateTypes.HORN_CORAL_WALL_FAN);
BlockTags.CORAL_PLANTS.add(StateTypes.TUBE_CORAL, StateTypes.BRAIN_CORAL, StateTypes.BUBBLE_CORAL, StateTypes.FIRE_CORAL, StateTypes.HORN_CORAL);
BlockTags.CORALS.addTag(BlockTags.CORAL_PLANTS).add(StateTypes.TUBE_CORAL_FAN, StateTypes.BRAIN_CORAL_FAN, StateTypes.BUBBLE_CORAL_FAN, StateTypes.FIRE_CORAL_FAN, StateTypes.HORN_CORAL_FAN);
BlockTags.BAMBOO_PLANTABLE_ON.addTag(BlockTags.SAND).addTag(BlockTags.DIRT).add(StateTypes.BAMBOO, StateTypes.BAMBOO_SAPLING, StateTypes.GRAVEL, StateTypes.SUSPICIOUS_GRAVEL);
BlockTags.STANDING_SIGNS.add(StateTypes.OAK_SIGN, StateTypes.SPRUCE_SIGN, StateTypes.BIRCH_SIGN, StateTypes.ACACIA_SIGN, StateTypes.JUNGLE_SIGN, StateTypes.DARK_OAK_SIGN, StateTypes.CRIMSON_SIGN, StateTypes.WARPED_SIGN, StateTypes.MANGROVE_SIGN, StateTypes.BAMBOO_SIGN, StateTypes.CHERRY_SIGN);
BlockTags.WALL_SIGNS.add(StateTypes.OAK_WALL_SIGN, StateTypes.SPRUCE_WALL_SIGN, StateTypes.BIRCH_WALL_SIGN, StateTypes.ACACIA_WALL_SIGN, StateTypes.JUNGLE_WALL_SIGN, StateTypes.DARK_OAK_WALL_SIGN, StateTypes.CRIMSON_WALL_SIGN, StateTypes.WARPED_WALL_SIGN, StateTypes.MANGROVE_WALL_SIGN, StateTypes.BAMBOO_WALL_SIGN, StateTypes.CHERRY_WALL_SIGN);
BlockTags.SIGNS.addTag(BlockTags.STANDING_SIGNS).addTag(BlockTags.WALL_SIGNS);
BlockTags.CEILING_HANGING_SIGNS.add(StateTypes.OAK_HANGING_SIGN, StateTypes.SPRUCE_HANGING_SIGN, StateTypes.BIRCH_HANGING_SIGN, StateTypes.ACACIA_HANGING_SIGN, StateTypes.CHERRY_HANGING_SIGN, StateTypes.JUNGLE_HANGING_SIGN, StateTypes.DARK_OAK_HANGING_SIGN, StateTypes.CRIMSON_HANGING_SIGN, StateTypes.WARPED_HANGING_SIGN, StateTypes.MANGROVE_HANGING_SIGN, StateTypes.BAMBOO_HANGING_SIGN);
BlockTags.WALL_HANGING_SIGNS.add(StateTypes.OAK_WALL_HANGING_SIGN, StateTypes.SPRUCE_WALL_HANGING_SIGN, StateTypes.BIRCH_WALL_HANGING_SIGN, StateTypes.ACACIA_WALL_HANGING_SIGN, StateTypes.CHERRY_WALL_HANGING_SIGN, StateTypes.JUNGLE_WALL_HANGING_SIGN, StateTypes.DARK_OAK_WALL_HANGING_SIGN, StateTypes.CRIMSON_WALL_HANGING_SIGN, StateTypes.WARPED_WALL_HANGING_SIGN, StateTypes.MANGROVE_WALL_HANGING_SIGN, StateTypes.BAMBOO_WALL_HANGING_SIGN);
BlockTags.ALL_HANGING_SIGNS.addTag(BlockTags.CEILING_HANGING_SIGNS).addTag(BlockTags.WALL_HANGING_SIGNS);
BlockTags.ALL_SIGNS.addTag(BlockTags.SIGNS).addTag(BlockTags.ALL_HANGING_SIGNS);
BlockTags.DRAGON_IMMUNE.add(StateTypes.BARRIER, StateTypes.BEDROCK, StateTypes.END_PORTAL, StateTypes.END_PORTAL_FRAME, StateTypes.END_GATEWAY, StateTypes.COMMAND_BLOCK, StateTypes.REPEATING_COMMAND_BLOCK, StateTypes.CHAIN_COMMAND_BLOCK, StateTypes.STRUCTURE_BLOCK, StateTypes.JIGSAW, StateTypes.MOVING_PISTON, StateTypes.OBSIDIAN, StateTypes.CRYING_OBSIDIAN, StateTypes.END_STONE, StateTypes.IRON_BARS, StateTypes.RESPAWN_ANCHOR, StateTypes.REINFORCED_DEEPSLATE);
BlockTags.DRAGON_TRANSPARENT.addTag(BlockTags.FIRE).add(StateTypes.LIGHT);
BlockTags.WITHER_IMMUNE.add(StateTypes.BARRIER, StateTypes.BEDROCK, StateTypes.END_PORTAL, StateTypes.END_PORTAL_FRAME, StateTypes.END_GATEWAY, StateTypes.COMMAND_BLOCK, StateTypes.REPEATING_COMMAND_BLOCK, StateTypes.CHAIN_COMMAND_BLOCK, StateTypes.STRUCTURE_BLOCK, StateTypes.JIGSAW, StateTypes.MOVING_PISTON, StateTypes.LIGHT, StateTypes.REINFORCED_DEEPSLATE);
BlockTags.WITHER_SUMMON_BASE_BLOCKS.add(StateTypes.SOUL_SAND, StateTypes.SOUL_SOIL);
BlockTags.BEEHIVES.add(StateTypes.BEE_NEST, StateTypes.BEEHIVE);
BlockTags.CROPS.add(StateTypes.BEETROOTS, StateTypes.CARROTS, StateTypes.POTATOES, StateTypes.WHEAT, StateTypes.MELON_STEM, StateTypes.PUMPKIN_STEM, StateTypes.TORCHFLOWER_CROP, StateTypes.PITCHER_CROP);
BlockTags.BEE_GROWABLES.addTag(BlockTags.CROPS).add(StateTypes.SWEET_BERRY_BUSH, StateTypes.CAVE_VINES, StateTypes.CAVE_VINES_PLANT);
BlockTags.PORTALS.add(StateTypes.NETHER_PORTAL, StateTypes.END_PORTAL, StateTypes.END_GATEWAY);
BlockTags.FIRE.add(StateTypes.FIRE, StateTypes.SOUL_FIRE);
BlockTags.NYLIUM.add(StateTypes.CRIMSON_NYLIUM, StateTypes.WARPED_NYLIUM);
BlockTags.BEACON_BASE_BLOCKS.add(StateTypes.NETHERITE_BLOCK, StateTypes.EMERALD_BLOCK, StateTypes.DIAMOND_BLOCK, StateTypes.GOLD_BLOCK, StateTypes.IRON_BLOCK);
BlockTags.SOUL_SPEED_BLOCKS.add(StateTypes.SOUL_SAND, StateTypes.SOUL_SOIL);
BlockTags.WALL_POST_OVERRIDE.addTag(BlockTags.SIGNS).addTag(BlockTags.BANNERS).addTag(BlockTags.PRESSURE_PLATES).add(StateTypes.TORCH, StateTypes.SOUL_TORCH, StateTypes.REDSTONE_TORCH, StateTypes.TRIPWIRE);
BlockTags.CLIMBABLE.add(StateTypes.LADDER, StateTypes.VINE, StateTypes.SCAFFOLDING, StateTypes.WEEPING_VINES, StateTypes.WEEPING_VINES_PLANT, StateTypes.TWISTING_VINES, StateTypes.TWISTING_VINES_PLANT, StateTypes.CAVE_VINES, StateTypes.CAVE_VINES_PLANT);
BlockTags.FALL_DAMAGE_RESETTING.addTag(BlockTags.CLIMBABLE).add(StateTypes.SWEET_BERRY_BUSH, StateTypes.COBWEB);
BlockTags.SHULKER_BOXES.add(StateTypes.SHULKER_BOX, StateTypes.BLACK_SHULKER_BOX, StateTypes.BLUE_SHULKER_BOX, StateTypes.BROWN_SHULKER_BOX, StateTypes.CYAN_SHULKER_BOX, StateTypes.GRAY_SHULKER_BOX, StateTypes.GREEN_SHULKER_BOX, StateTypes.LIGHT_BLUE_SHULKER_BOX, StateTypes.LIGHT_GRAY_SHULKER_BOX, StateTypes.LIME_SHULKER_BOX, StateTypes.MAGENTA_SHULKER_BOX, StateTypes.ORANGE_SHULKER_BOX, StateTypes.PINK_SHULKER_BOX, StateTypes.PURPLE_SHULKER_BOX, StateTypes.RED_SHULKER_BOX, StateTypes.WHITE_SHULKER_BOX, StateTypes.YELLOW_SHULKER_BOX);
BlockTags.HOGLIN_REPELLENTS.add(StateTypes.WARPED_FUNGUS, StateTypes.POTTED_WARPED_FUNGUS, StateTypes.NETHER_PORTAL, StateTypes.RESPAWN_ANCHOR);
BlockTags.SOUL_FIRE_BASE_BLOCKS.add(StateTypes.SOUL_SAND, StateTypes.SOUL_SOIL);
BlockTags.STRIDER_WARM_BLOCKS.add(StateTypes.LAVA);
BlockTags.CAMPFIRES.add(StateTypes.CAMPFIRE, StateTypes.SOUL_CAMPFIRE);
BlockTags.GUARDED_BY_PIGLINS.add(StateTypes.GOLD_BLOCK, StateTypes.BARREL, StateTypes.CHEST, StateTypes.ENDER_CHEST, StateTypes.GILDED_BLACKSTONE, StateTypes.TRAPPED_CHEST, StateTypes.RAW_GOLD_BLOCK).addTag(BlockTags.SHULKER_BOXES).addTag(BlockTags.GOLD_ORES);
BlockTags.GUARDED_BY_PIGLINS.addTag(BlockTags.SHULKER_BOXES).addTag(BlockTags.GOLD_ORES).add(StateTypes.GOLD_BLOCK, StateTypes.BARREL, StateTypes.CHEST, StateTypes.ENDER_CHEST, StateTypes.GILDED_BLACKSTONE, StateTypes.TRAPPED_CHEST, StateTypes.RAW_GOLD_BLOCK);
BlockTags.PREVENT_MOB_SPAWNING_INSIDE.addTag(BlockTags.RAILS);
BlockTags.FENCE_GATES.add(StateTypes.ACACIA_FENCE_GATE, StateTypes.BIRCH_FENCE_GATE, StateTypes.DARK_OAK_FENCE_GATE, StateTypes.JUNGLE_FENCE_GATE, StateTypes.OAK_FENCE_GATE, StateTypes.SPRUCE_FENCE_GATE, StateTypes.CRIMSON_FENCE_GATE, StateTypes.WARPED_FENCE_GATE, StateTypes.MANGROVE_FENCE_GATE, StateTypes.BAMBOO_FENCE_GATE, StateTypes.CHERRY_FENCE_GATE);
BlockTags.UNSTABLE_BOTTOM_CENTER.addTag(BlockTags.FENCE_GATES);
BlockTags.MUSHROOM_GROW_BLOCK.add(StateTypes.MYCELIUM).add(StateTypes.PODZOL).add(StateTypes.CRIMSON_NYLIUM).add(StateTypes.WARPED_NYLIUM);
BlockTags.MUSHROOM_GROW_BLOCK.add(StateTypes.MYCELIUM, StateTypes.PODZOL, StateTypes.CRIMSON_NYLIUM, StateTypes.WARPED_NYLIUM);
BlockTags.INFINIBURN_OVERWORLD.add(StateTypes.NETHERRACK, StateTypes.MAGMA_BLOCK);
BlockTags.INFINIBURN_NETHER.addTag(BlockTags.INFINIBURN_OVERWORLD);
BlockTags.INFINIBURN_END.addTag(BlockTags.INFINIBURN_OVERWORLD).add(StateTypes.BEDROCK);
BlockTags.STONE_ORE_REPLACEABLES.add(StateTypes.STONE).add(StateTypes.GRANITE).add(StateTypes.DIORITE).add(StateTypes.ANDESITE);
BlockTags.DEEPSLATE_ORE_REPLACEABLES.add(StateTypes.DEEPSLATE).add(StateTypes.TUFF);
BlockTags.BASE_STONE_OVERWORLD.add(StateTypes.STONE).add(StateTypes.GRANITE).add(StateTypes.DIORITE).add(StateTypes.ANDESITE).add(StateTypes.TUFF).add(StateTypes.DEEPSLATE);
BlockTags.BASE_STONE_NETHER.add(StateTypes.NETHERRACK).add(StateTypes.BASALT).add(StateTypes.BLACKSTONE);
BlockTags.BASE_STONE_OVERWORLD.add(StateTypes.STONE, StateTypes.GRANITE, StateTypes.DIORITE, StateTypes.ANDESITE, StateTypes.TUFF, StateTypes.DEEPSLATE);
BlockTags.STONE_ORE_REPLACEABLES.add(StateTypes.STONE, StateTypes.GRANITE, StateTypes.DIORITE, StateTypes.ANDESITE);
BlockTags.DEEPSLATE_ORE_REPLACEABLES.add(StateTypes.DEEPSLATE, StateTypes.TUFF);
BlockTags.BASE_STONE_NETHER.add(StateTypes.NETHERRACK, StateTypes.BASALT, StateTypes.BLACKSTONE);
BlockTags.OVERWORLD_CARVER_REPLACEABLES.addTag(BlockTags.BASE_STONE_OVERWORLD).addTag(BlockTags.DIRT).addTag(BlockTags.SAND).addTag(BlockTags.TERRACOTTA).addTag(BlockTags.IRON_ORES).addTag(BlockTags.COPPER_ORES).add(StateTypes.WATER, StateTypes.GRAVEL, StateTypes.SUSPICIOUS_GRAVEL, StateTypes.SANDSTONE, StateTypes.RED_SANDSTONE, StateTypes.CALCITE, StateTypes.SNOW, StateTypes.PACKED_ICE, StateTypes.RAW_IRON_BLOCK, StateTypes.RAW_COPPER_BLOCK);
BlockTags.NETHER_CARVER_REPLACEABLES.addTag(BlockTags.BASE_STONE_OVERWORLD).addTag(BlockTags.BASE_STONE_NETHER).addTag(BlockTags.DIRT).addTag(BlockTags.NYLIUM).addTag(BlockTags.WART_BLOCKS).add(StateTypes.SOUL_SAND, StateTypes.SOUL_SOIL);
BlockTags.CANDLES.add(StateTypes.CANDLE, StateTypes.WHITE_CANDLE, StateTypes.ORANGE_CANDLE, StateTypes.MAGENTA_CANDLE, StateTypes.LIGHT_BLUE_CANDLE, StateTypes.YELLOW_CANDLE, StateTypes.LIME_CANDLE, StateTypes.PINK_CANDLE, StateTypes.GRAY_CANDLE, StateTypes.LIGHT_GRAY_CANDLE, StateTypes.CYAN_CANDLE, StateTypes.PURPLE_CANDLE, StateTypes.BLUE_CANDLE, StateTypes.BROWN_CANDLE, StateTypes.GREEN_CANDLE, StateTypes.RED_CANDLE, StateTypes.BLACK_CANDLE);
BlockTags.CANDLE_CAKES.add(StateTypes.CANDLE_CAKE, StateTypes.WHITE_CANDLE_CAKE, StateTypes.ORANGE_CANDLE_CAKE, StateTypes.MAGENTA_CANDLE_CAKE, StateTypes.LIGHT_BLUE_CANDLE_CAKE, StateTypes.YELLOW_CANDLE_CAKE, StateTypes.LIME_CANDLE_CAKE, StateTypes.PINK_CANDLE_CAKE, StateTypes.GRAY_CANDLE_CAKE, StateTypes.LIGHT_GRAY_CANDLE_CAKE, StateTypes.CYAN_CANDLE_CAKE, StateTypes.PURPLE_CANDLE_CAKE, StateTypes.BLUE_CANDLE_CAKE, StateTypes.BROWN_CANDLE_CAKE, StateTypes.GREEN_CANDLE_CAKE, StateTypes.RED_CANDLE_CAKE, StateTypes.BLACK_CANDLE_CAKE);
BlockTags.CRYSTAL_SOUND_BLOCKS.add(StateTypes.AMETHYST_BLOCK, StateTypes.BUDDING_AMETHYST);
BlockTags.CAULDRONS.add(StateTypes.CAULDRON, StateTypes.WATER_CAULDRON, StateTypes.LAVA_CAULDRON, StateTypes.POWDER_SNOW_CAULDRON);
BlockTags.CRYSTAL_SOUND_BLOCKS.add(StateTypes.AMETHYST_BLOCK, StateTypes.BUDDING_AMETHYST);
BlockTags.INSIDE_STEP_SOUND_BLOCKS.add(StateTypes.POWDER_SNOW, StateTypes.SCULK_VEIN, StateTypes.GLOW_LICHEN, StateTypes.LILY_PAD, StateTypes.SMALL_AMETHYST_BUD, StateTypes.PINK_PETALS);
BlockTags.COMBINATION_STEP_SOUND_BLOCKS.addTag(BlockTags.WOOL_CARPETS).add(StateTypes.MOSS_CARPET, StateTypes.SNOW, StateTypes.NETHER_SPROUTS, StateTypes.WARPED_ROOTS, StateTypes.CRIMSON_ROOTS);
BlockTags.DRIPSTONE_REPLACEABLE.addTag(BlockTags.BASE_STONE_OVERWORLD);
BlockTags.CAVE_VINES.add(StateTypes.CAVE_VINES_PLANT).add(StateTypes.CAVE_VINES);
BlockTags.MOSS_REPLACEABLE.addTag(BlockTags.BASE_STONE_OVERWORLD).addTag(BlockTags.CAVE_VINES).addTag(BlockTags.DIRT);
BlockTags.LUSH_GROUND_REPLACEABLE.addTag(BlockTags.MOSS_REPLACEABLE).add(StateTypes.CLAY).add(StateTypes.GRAVEL).add(StateTypes.SAND);
BlockTags.AZALEA_ROOT_REPLACEABLE.addTag(BlockTags.BASE_STONE_OVERWORLD).addTag(BlockTags.DIRT).addTag(BlockTags.TERRACOTTA).add(StateTypes.RED_SAND).add(StateTypes.CLAY).add(StateTypes.GRAVEL).add(StateTypes.SAND).add(StateTypes.SNOW_BLOCK).add(StateTypes.POWDER_SNOW);
BlockTags.SMALL_DRIPLEAF_PLACEABLE.add(StateTypes.CLAY).add(StateTypes.MOSS_BLOCK);
BlockTags.BIG_DRIPLEAF_PLACEABLE.addTag(BlockTags.SMALL_DRIPLEAF_PLACEABLE).addTag(BlockTags.DIRT).add(StateTypes.FARMLAND);
BlockTags.CAMEL_SAND_STEP_SOUND_BLOCKS.addTag(BlockTags.SAND).addTag(BlockTags.CONCRETE_POWDER);
BlockTags.OCCLUDES_VIBRATION_SIGNALS.addTag(BlockTags.WOOL);
BlockTags.DAMPENS_VIBRATIONS.addTag(BlockTags.WOOL).addTag(BlockTags.WOOL_CARPETS);
BlockTags.DRIPSTONE_REPLACEABLE.addTag(BlockTags.BASE_STONE_OVERWORLD);
BlockTags.CAVE_VINES.add(StateTypes.CAVE_VINES_PLANT, StateTypes.CAVE_VINES);
BlockTags.MOSS_REPLACEABLE.addTag(BlockTags.BASE_STONE_OVERWORLD).addTag(BlockTags.CAVE_VINES).addTag(BlockTags.DIRT);
BlockTags.LUSH_GROUND_REPLACEABLE.addTag(BlockTags.MOSS_REPLACEABLE).add(StateTypes.CLAY, StateTypes.GRAVEL, StateTypes.SAND);
BlockTags.AZALEA_ROOT_REPLACEABLE.addTag(BlockTags.BASE_STONE_OVERWORLD).addTag(BlockTags.DIRT).addTag(BlockTags.TERRACOTTA).add(StateTypes.RED_SAND, StateTypes.CLAY, StateTypes.GRAVEL, StateTypes.SAND, StateTypes.SNOW_BLOCK, StateTypes.POWDER_SNOW);
BlockTags.SMALL_DRIPLEAF_PLACEABLE.add(StateTypes.CLAY, StateTypes.MOSS_BLOCK);
BlockTags.BIG_DRIPLEAF_PLACEABLE.addTag(BlockTags.SMALL_DRIPLEAF_PLACEABLE).addTag(BlockTags.DIRT).add(StateTypes.FARMLAND);
BlockTags.SNOW.add(StateTypes.SNOW, StateTypes.SNOW_BLOCK, StateTypes.POWDER_SNOW);
BlockTags.MINEABLE_WITH_AXE.add(StateTypes.NOTE_BLOCK, StateTypes.ATTACHED_MELON_STEM, StateTypes.ATTACHED_PUMPKIN_STEM, StateTypes.AZALEA, StateTypes.BAMBOO, StateTypes.BARREL, StateTypes.BEE_NEST, StateTypes.BEEHIVE, StateTypes.BEETROOTS, StateTypes.BIG_DRIPLEAF_STEM, StateTypes.BIG_DRIPLEAF, StateTypes.BOOKSHELF, StateTypes.BROWN_MUSHROOM_BLOCK, StateTypes.BROWN_MUSHROOM, StateTypes.CAMPFIRE, StateTypes.CARROTS, StateTypes.CARTOGRAPHY_TABLE, StateTypes.CARVED_PUMPKIN, StateTypes.CAVE_VINES_PLANT, StateTypes.CAVE_VINES, StateTypes.CHEST, StateTypes.CHORUS_FLOWER, StateTypes.CHORUS_PLANT, StateTypes.COCOA, StateTypes.COMPOSTER, StateTypes.CRAFTING_TABLE, StateTypes.CRIMSON_FUNGUS, StateTypes.DAYLIGHT_DETECTOR, StateTypes.DEAD_BUSH, StateTypes.FERN, StateTypes.FLETCHING_TABLE, StateTypes.GLOW_LICHEN, StateTypes.GRASS, StateTypes.HANGING_ROOTS, StateTypes.JACK_O_LANTERN, StateTypes.JUKEBOX, StateTypes.LADDER, StateTypes.LARGE_FERN, StateTypes.LECTERN, StateTypes.LILY_PAD, StateTypes.LOOM, StateTypes.MELON_STEM, StateTypes.MELON, StateTypes.MUSHROOM_STEM, StateTypes.NETHER_WART, StateTypes.POTATOES, StateTypes.PUMPKIN_STEM, StateTypes.PUMPKIN, StateTypes.RED_MUSHROOM_BLOCK, StateTypes.RED_MUSHROOM, StateTypes.SCAFFOLDING, StateTypes.SMALL_DRIPLEAF, StateTypes.SMITHING_TABLE, StateTypes.SOUL_CAMPFIRE, StateTypes.SPORE_BLOSSOM, StateTypes.SUGAR_CANE, StateTypes.SWEET_BERRY_BUSH, StateTypes.TALL_GRASS, StateTypes.TRAPPED_CHEST, StateTypes.TWISTING_VINES_PLANT, StateTypes.TWISTING_VINES, StateTypes.VINE, StateTypes.WARPED_FUNGUS, StateTypes.WEEPING_VINES_PLANT, StateTypes.WEEPING_VINES, StateTypes.WHEAT).addTag(BlockTags.BANNERS).addTag(BlockTags.FENCE_GATES).addTag(BlockTags.LOGS).addTag(BlockTags.PLANKS).addTag(BlockTags.SAPLINGS).addTag(BlockTags.SIGNS).addTag(BlockTags.WOODEN_BUTTONS).addTag(BlockTags.WOODEN_DOORS).addTag(BlockTags.WOODEN_FENCES).addTag(BlockTags.WOODEN_PRESSURE_PLATES).addTag(BlockTags.WOODEN_SLABS).addTag(BlockTags.WOODEN_STAIRS).addTag(BlockTags.WOODEN_TRAPDOORS).add(StateTypes.MANGROVE_ROOTS).addTag(ALL_HANGING_SIGNS).add(StateTypes.BAMBOO_MOSAIC, StateTypes.BAMBOO_MOSAIC_SLAB, StateTypes.BAMBOO_MOSAIC_STAIRS).addTag(BAMBOO_BLOCKS).add(StateTypes.CHISELED_BOOKSHELF);
BlockTags.MINEABLE_WITH_HOE.add(StateTypes.NETHER_WART_BLOCK, StateTypes.WARPED_WART_BLOCK, StateTypes.HAY_BLOCK, StateTypes.DRIED_KELP_BLOCK, StateTypes.TARGET, StateTypes.SHROOMLIGHT, StateTypes.SPONGE, StateTypes.WET_SPONGE, StateTypes.JUNGLE_LEAVES, StateTypes.OAK_LEAVES, StateTypes.SPRUCE_LEAVES, StateTypes.DARK_OAK_LEAVES, StateTypes.ACACIA_LEAVES, StateTypes.BIRCH_LEAVES, StateTypes.AZALEA_LEAVES, StateTypes.FLOWERING_AZALEA_LEAVES, StateTypes.MANGROVE_LEAVES, StateTypes.SCULK_SENSOR, StateTypes.MOSS_BLOCK, StateTypes.MOSS_CARPET, StateTypes.SCULK, StateTypes.SCULK_CATALYST, StateTypes.SCULK_VEIN, StateTypes.SCULK_SHRIEKER, StateTypes.PINK_PETALS, StateTypes.CHERRY_LEAVES);
BlockTags.MINEABLE_WITH_PICKAXE.add(StateTypes.STONE, StateTypes.GRANITE, StateTypes.POLISHED_GRANITE, StateTypes.DIORITE, StateTypes.POLISHED_DIORITE, StateTypes.ANDESITE, StateTypes.POLISHED_ANDESITE, StateTypes.COBBLESTONE, StateTypes.GOLD_ORE, StateTypes.DEEPSLATE_GOLD_ORE, StateTypes.IRON_ORE, StateTypes.DEEPSLATE_IRON_ORE, StateTypes.COAL_ORE, StateTypes.DEEPSLATE_COAL_ORE, StateTypes.NETHER_GOLD_ORE, StateTypes.LAPIS_ORE, StateTypes.DEEPSLATE_LAPIS_ORE, StateTypes.LAPIS_BLOCK, StateTypes.DISPENSER, StateTypes.SANDSTONE, StateTypes.CHISELED_SANDSTONE, StateTypes.CUT_SANDSTONE, StateTypes.GOLD_BLOCK, StateTypes.IRON_BLOCK, StateTypes.BRICKS, StateTypes.MOSSY_COBBLESTONE, StateTypes.OBSIDIAN, StateTypes.SPAWNER, StateTypes.DIAMOND_ORE, StateTypes.DEEPSLATE_DIAMOND_ORE, StateTypes.DIAMOND_BLOCK, StateTypes.FURNACE, StateTypes.COBBLESTONE_STAIRS, StateTypes.STONE_PRESSURE_PLATE, StateTypes.IRON_DOOR, StateTypes.REDSTONE_ORE, StateTypes.DEEPSLATE_REDSTONE_ORE, StateTypes.NETHERRACK, StateTypes.BASALT, StateTypes.POLISHED_BASALT, StateTypes.STONE_BRICKS, StateTypes.MOSSY_STONE_BRICKS, StateTypes.CRACKED_STONE_BRICKS, StateTypes.CHISELED_STONE_BRICKS, StateTypes.IRON_BARS, StateTypes.CHAIN, StateTypes.BRICK_STAIRS, StateTypes.STONE_BRICK_STAIRS, StateTypes.NETHER_BRICKS, StateTypes.NETHER_BRICK_FENCE, StateTypes.NETHER_BRICK_STAIRS, StateTypes.ENCHANTING_TABLE, StateTypes.BREWING_STAND, StateTypes.END_STONE, StateTypes.SANDSTONE_STAIRS, StateTypes.EMERALD_ORE, StateTypes.DEEPSLATE_EMERALD_ORE, StateTypes.ENDER_CHEST, StateTypes.EMERALD_BLOCK, StateTypes.LIGHT_WEIGHTED_PRESSURE_PLATE, StateTypes.HEAVY_WEIGHTED_PRESSURE_PLATE, StateTypes.REDSTONE_BLOCK, StateTypes.NETHER_QUARTZ_ORE, StateTypes.HOPPER, StateTypes.QUARTZ_BLOCK, StateTypes.CHISELED_QUARTZ_BLOCK, StateTypes.QUARTZ_PILLAR, StateTypes.QUARTZ_STAIRS, StateTypes.DROPPER, StateTypes.WHITE_TERRACOTTA, StateTypes.ORANGE_TERRACOTTA, StateTypes.MAGENTA_TERRACOTTA, StateTypes.LIGHT_BLUE_TERRACOTTA, StateTypes.YELLOW_TERRACOTTA, StateTypes.LIME_TERRACOTTA, StateTypes.PINK_TERRACOTTA, StateTypes.GRAY_TERRACOTTA, StateTypes.LIGHT_GRAY_TERRACOTTA, StateTypes.CYAN_TERRACOTTA, StateTypes.PURPLE_TERRACOTTA, StateTypes.BLUE_TERRACOTTA, StateTypes.BROWN_TERRACOTTA, StateTypes.GREEN_TERRACOTTA, StateTypes.RED_TERRACOTTA, StateTypes.BLACK_TERRACOTTA, StateTypes.IRON_TRAPDOOR, StateTypes.PRISMARINE, StateTypes.PRISMARINE_BRICKS, StateTypes.DARK_PRISMARINE, StateTypes.PRISMARINE_STAIRS, StateTypes.PRISMARINE_BRICK_STAIRS, StateTypes.DARK_PRISMARINE_STAIRS, StateTypes.PRISMARINE_SLAB, StateTypes.PRISMARINE_BRICK_SLAB, StateTypes.DARK_PRISMARINE_SLAB, StateTypes.TERRACOTTA, StateTypes.COAL_BLOCK, StateTypes.RED_SANDSTONE, StateTypes.CHISELED_RED_SANDSTONE, StateTypes.CUT_RED_SANDSTONE, StateTypes.RED_SANDSTONE_STAIRS, StateTypes.STONE_SLAB, StateTypes.SMOOTH_STONE_SLAB, StateTypes.SANDSTONE_SLAB, StateTypes.CUT_SANDSTONE_SLAB, StateTypes.PETRIFIED_OAK_SLAB, StateTypes.COBBLESTONE_SLAB, StateTypes.BRICK_SLAB, StateTypes.STONE_BRICK_SLAB, StateTypes.NETHER_BRICK_SLAB, StateTypes.QUARTZ_SLAB, StateTypes.RED_SANDSTONE_SLAB, StateTypes.CUT_RED_SANDSTONE_SLAB, StateTypes.PURPUR_SLAB, StateTypes.SMOOTH_STONE, StateTypes.SMOOTH_SANDSTONE, StateTypes.SMOOTH_QUARTZ, StateTypes.SMOOTH_RED_SANDSTONE, StateTypes.PURPUR_BLOCK, StateTypes.PURPUR_PILLAR, StateTypes.PURPUR_STAIRS, StateTypes.END_STONE_BRICKS, StateTypes.MAGMA_BLOCK, StateTypes.RED_NETHER_BRICKS, StateTypes.BONE_BLOCK, StateTypes.OBSERVER, StateTypes.WHITE_GLAZED_TERRACOTTA, StateTypes.ORANGE_GLAZED_TERRACOTTA, StateTypes.MAGENTA_GLAZED_TERRACOTTA, StateTypes.LIGHT_BLUE_GLAZED_TERRACOTTA, StateTypes.YELLOW_GLAZED_TERRACOTTA, StateTypes.LIME_GLAZED_TERRACOTTA, StateTypes.PINK_GLAZED_TERRACOTTA, StateTypes.GRAY_GLAZED_TERRACOTTA, StateTypes.LIGHT_GRAY_GLAZED_TERRACOTTA, StateTypes.CYAN_GLAZED_TERRACOTTA, StateTypes.PURPLE_GLAZED_TERRACOTTA, StateTypes.BLUE_GLAZED_TERRACOTTA, StateTypes.BROWN_GLAZED_TERRACOTTA, StateTypes.GREEN_GLAZED_TERRACOTTA, StateTypes.RED_GLAZED_TERRACOTTA, StateTypes.BLACK_GLAZED_TERRACOTTA, StateTypes.WHITE_CONCRETE, StateTypes.ORANGE_CONCRETE, StateTypes.MAGENTA_CONCRETE, StateTypes.LIGHT_BLUE_CONCRETE, StateTypes.YELLOW_CONCRETE, StateTypes.LIME_CONCRETE, StateTypes.PINK_CONCRETE, StateTypes.GRAY_CONCRETE, StateTypes.LIGHT_GRAY_CONCRETE, StateTypes.CYAN_CONCRETE, StateTypes.PURPLE_CONCRETE, StateTypes.BLUE_CONCRETE, StateTypes.BROWN_CONCRETE, StateTypes.GREEN_CONCRETE, StateTypes.RED_CONCRETE, StateTypes.BLACK_CONCRETE, StateTypes.DEAD_TUBE_CORAL_BLOCK, StateTypes.DEAD_BRAIN_CORAL_BLOCK, StateTypes.DEAD_BUBBLE_CORAL_BLOCK, StateTypes.DEAD_FIRE_CORAL_BLOCK, StateTypes.DEAD_HORN_CORAL_BLOCK, StateTypes.TUBE_CORAL_BLOCK, StateTypes.BRAIN_CORAL_BLOCK, StateTypes.BUBBLE_CORAL_BLOCK, StateTypes.FIRE_CORAL_BLOCK, StateTypes.HORN_CORAL_BLOCK, StateTypes.DEAD_TUBE_CORAL, StateTypes.DEAD_BRAIN_CORAL, StateTypes.DEAD_BUBBLE_CORAL, StateTypes.DEAD_FIRE_CORAL, StateTypes.DEAD_HORN_CORAL, StateTypes.DEADLine truncated
BlockTags.MINEABLE_WITH_SHOVEL.add(StateTypes.CLAY, StateTypes.DIRT, StateTypes.COARSE_DIRT, StateTypes.PODZOL, StateTypes.FARMLAND, StateTypes.GRASS_BLOCK, StateTypes.GRAVEL, StateTypes.MYCELIUM, StateTypes.SAND, StateTypes.RED_SAND, StateTypes.SNOW_BLOCK, StateTypes.SNOW, StateTypes.SOUL_SAND, StateTypes.DIRT_PATH, StateTypes.WHITE_CONCRETE_POWDER, StateTypes.ORANGE_CONCRETE_POWDER, StateTypes.MAGENTA_CONCRETE_POWDER, StateTypes.LIGHT_BLUE_CONCRETE_POWDER, StateTypes.YELLOW_CONCRETE_POWDER, StateTypes.LIME_CONCRETE_POWDER, StateTypes.PINK_CONCRETE_POWDER, StateTypes.GRAY_CONCRETE_POWDER, StateTypes.LIGHT_GRAY_CONCRETE_POWDER, StateTypes.CYAN_CONCRETE_POWDER, StateTypes.PURPLE_CONCRETE_POWDER, StateTypes.BLUE_CONCRETE_POWDER, StateTypes.BROWN_CONCRETE_POWDER, StateTypes.GREEN_CONCRETE_POWDER, StateTypes.RED_CONCRETE_POWDER, StateTypes.BLACK_CONCRETE_POWDER, StateTypes.SOUL_SOIL, StateTypes.ROOTED_DIRT, StateTypes.MUDDY_MANGROVE_ROOTS, StateTypes.MUD, StateTypes.SUSPICIOUS_SAND, StateTypes.SUSPICIOUS_GRAVEL);
BlockTags.SWORD_EFFICIENT.addTag(BlockTags.LEAVES).addTag(BlockTags.SAPLINGS).addTag(BlockTags.SMALL_FLOWERS).addTag(BlockTags.CROPS).add(StateTypes.GRASS, StateTypes.FERN, StateTypes.DEAD_BUSH, StateTypes.VINE, StateTypes.GLOW_LICHEN, StateTypes.SUNFLOWER, StateTypes.LILAC, StateTypes.ROSE_BUSH, StateTypes.PEONY, StateTypes.TALL_GRASS, StateTypes.LARGE_FERN, StateTypes.HANGING_ROOTS, StateTypes.PITCHER_PLANT, StateTypes.BROWN_MUSHROOM, StateTypes.RED_MUSHROOM, StateTypes.SUGAR_CANE, StateTypes.PUMPKIN, StateTypes.CARVED_PUMPKIN, StateTypes.JACK_O_LANTERN, StateTypes.MELON, StateTypes.ATTACHED_PUMPKIN_STEM, StateTypes.ATTACHED_MELON_STEM, StateTypes.LILY_PAD, StateTypes.COCOA, StateTypes.PITCHER_CROP, StateTypes.SWEET_BERRY_BUSH, StateTypes.CAVE_VINES, StateTypes.CAVE_VINES_PLANT, StateTypes.SPORE_BLOSSOM, StateTypes.MOSS_CARPET, StateTypes.PINK_PETALS, StateTypes.BIG_DRIPLEAF, StateTypes.BIG_DRIPLEAF_STEM, StateTypes.SMALL_DRIPLEAF, StateTypes.NETHER_WART, StateTypes.WARPED_FUNGUS, StateTypes.WARPED_ROOTS, StateTypes.NETHER_SPROUTS, StateTypes.CRIMSON_FUNGUS, StateTypes.WEEPING_VINES, StateTypes.WEEPING_VINES_PLANT, StateTypes.TWISTING_VINES, StateTypes.TWISTING_VINES_PLANT, StateTypes.CRIMSON_ROOTS, StateTypes.CHORUS_PLANT, StateTypes.CHORUS_FLOWER);
BlockTags.MINEABLE_WITH_AXE.addTag(BlockTags.BANNERS).addTag(BlockTags.FENCE_GATES).addTag(BlockTags.LOGS).addTag(BlockTags.PLANKS).addTag(BlockTags.SAPLINGS).addTag(BlockTags.SIGNS).addTag(BlockTags.WOODEN_BUTTONS).addTag(BlockTags.WOODEN_DOORS).addTag(BlockTags.WOODEN_FENCES).addTag(BlockTags.WOODEN_PRESSURE_PLATES).addTag(BlockTags.WOODEN_SLABS).addTag(BlockTags.WOODEN_STAIRS).addTag(BlockTags.WOODEN_TRAPDOORS).addTag(BlockTags.ALL_HANGING_SIGNS).addTag(BlockTags.BAMBOO_BLOCKS).add(StateTypes.NOTE_BLOCK, StateTypes.ATTACHED_MELON_STEM, StateTypes.ATTACHED_PUMPKIN_STEM, StateTypes.AZALEA, StateTypes.BAMBOO, StateTypes.BARREL, StateTypes.BEE_NEST, StateTypes.BEEHIVE, StateTypes.BEETROOTS, StateTypes.BIG_DRIPLEAF_STEM, StateTypes.BIG_DRIPLEAF, StateTypes.BOOKSHELF, StateTypes.BROWN_MUSHROOM_BLOCK, StateTypes.BROWN_MUSHROOM, StateTypes.CAMPFIRE, StateTypes.CARROTS, StateTypes.CARTOGRAPHY_TABLE, StateTypes.CARVED_PUMPKIN, StateTypes.CAVE_VINES_PLANT, StateTypes.CAVE_VINES, StateTypes.CHEST, StateTypes.CHORUS_FLOWER, StateTypes.CHORUS_PLANT, StateTypes.COCOA, StateTypes.COMPOSTER, StateTypes.CRAFTING_TABLE, StateTypes.CRIMSON_FUNGUS, StateTypes.DAYLIGHT_DETECTOR, StateTypes.DEAD_BUSH, StateTypes.FERN, StateTypes.FLETCHING_TABLE, StateTypes.GLOW_LICHEN, StateTypes.SHORT_GRASS, StateTypes.HANGING_ROOTS, StateTypes.JACK_O_LANTERN, StateTypes.JUKEBOX, StateTypes.LADDER, StateTypes.LARGE_FERN, StateTypes.LECTERN, StateTypes.LILY_PAD, StateTypes.LOOM, StateTypes.MELON_STEM, StateTypes.MELON, StateTypes.MUSHROOM_STEM, StateTypes.NETHER_WART, StateTypes.POTATOES, StateTypes.PUMPKIN_STEM, StateTypes.PUMPKIN, StateTypes.RED_MUSHROOM_BLOCK, StateTypes.RED_MUSHROOM, StateTypes.SCAFFOLDING, StateTypes.SMALL_DRIPLEAF, StateTypes.SMITHING_TABLE, StateTypes.SOUL_CAMPFIRE, StateTypes.SPORE_BLOSSOM, StateTypes.SUGAR_CANE, StateTypes.SWEET_BERRY_BUSH, StateTypes.TALL_GRASS, StateTypes.TRAPPED_CHEST, StateTypes.TWISTING_VINES_PLANT, StateTypes.TWISTING_VINES, StateTypes.VINE, StateTypes.WARPED_FUNGUS, StateTypes.WEEPING_VINES_PLANT, StateTypes.WEEPING_VINES, StateTypes.WHEAT, StateTypes.MANGROVE_ROOTS, StateTypes.BAMBOO_MOSAIC, StateTypes.BAMBOO_MOSAIC_SLAB, StateTypes.BAMBOO_MOSAIC_STAIRS, StateTypes.CHISELED_BOOKSHELF);
BlockTags.MINEABLE_WITH_HOE.add(StateTypes.NETHER_WART_BLOCK, StateTypes.WARPED_WART_BLOCK, StateTypes.HAY_BLOCK, StateTypes.DRIED_KELP_BLOCK, StateTypes.TARGET, StateTypes.SHROOMLIGHT, StateTypes.SPONGE, StateTypes.WET_SPONGE, StateTypes.JUNGLE_LEAVES, StateTypes.OAK_LEAVES, StateTypes.SPRUCE_LEAVES, StateTypes.DARK_OAK_LEAVES, StateTypes.ACACIA_LEAVES, StateTypes.BIRCH_LEAVES, StateTypes.AZALEA_LEAVES, StateTypes.FLOWERING_AZALEA_LEAVES, StateTypes.MANGROVE_LEAVES, StateTypes.SCULK_SENSOR, StateTypes.CALIBRATED_SCULK_SENSOR, StateTypes.MOSS_BLOCK, StateTypes.MOSS_CARPET, StateTypes.SCULK, StateTypes.SCULK_CATALYST, StateTypes.SCULK_VEIN, StateTypes.SCULK_SHRIEKER, StateTypes.PINK_PETALS, StateTypes.CHERRY_LEAVES);
BlockTags.MINEABLE_WITH_PICKAXE.addTag(BlockTags.STONE_BUTTONS).addTag(BlockTags.WALLS).addTag(BlockTags.SHULKER_BOXES).addTag(BlockTags.ANVIL).addTag(BlockTags.CAULDRONS).addTag(BlockTags.RAILS).add(StateTypes.STONE, StateTypes.GRANITE, StateTypes.POLISHED_GRANITE, StateTypes.DIORITE, StateTypes.POLISHED_DIORITE, StateTypes.ANDESITE, StateTypes.POLISHED_ANDESITE, StateTypes.COBBLESTONE, StateTypes.GOLD_ORE, StateTypes.DEEPSLATE_GOLD_ORE, StateTypes.IRON_ORE, StateTypes.DEEPSLATE_IRON_ORE, StateTypes.COAL_ORE, StateTypes.DEEPSLATE_COAL_ORE, StateTypes.NETHER_GOLD_ORE, StateTypes.LAPIS_ORE, StateTypes.DEEPSLATE_LAPIS_ORE, StateTypes.LAPIS_BLOCK, StateTypes.DISPENSER, StateTypes.SANDSTONE, StateTypes.CHISELED_SANDSTONE, StateTypes.CUT_SANDSTONE, StateTypes.GOLD_BLOCK, StateTypes.IRON_BLOCK, StateTypes.BRICKS, StateTypes.MOSSY_COBBLESTONE, StateTypes.OBSIDIAN, StateTypes.SPAWNER, StateTypes.DIAMOND_ORE, StateTypes.DEEPSLATE_DIAMOND_ORE, StateTypes.DIAMOND_BLOCK, StateTypes.FURNACE, StateTypes.COBBLESTONE_STAIRS, StateTypes.STONE_PRESSURE_PLATE, StateTypes.IRON_DOOR, StateTypes.REDSTONE_ORE, StateTypes.DEEPSLATE_REDSTONE_ORE, StateTypes.NETHERRACK, StateTypes.BASALT, StateTypes.POLISHED_BASALT, StateTypes.STONE_BRICKS, StateTypes.MOSSY_STONE_BRICKS, StateTypes.CRACKED_STONE_BRICKS, StateTypes.CHISELED_STONE_BRICKS, StateTypes.IRON_BARS, StateTypes.CHAIN, StateTypes.BRICK_STAIRS, StateTypes.STONE_BRICK_STAIRS, StateTypes.NETHER_BRICKS, StateTypes.NETHER_BRICK_FENCE, StateTypes.NETHER_BRICK_STAIRS, StateTypes.ENCHANTING_TABLE, StateTypes.BREWING_STAND, StateTypes.END_STONE, StateTypes.SANDSTONE_STAIRS, StateTypes.EMERALD_ORE, StateTypes.DEEPSLATE_EMERALD_ORE, StateTypes.ENDER_CHEST, StateTypes.EMERALD_BLOCK, StateTypes.LIGHT_WEIGHTED_PRESSURE_PLATE, StateTypes.HEAVY_WEIGHTED_PRESSURE_PLATE, StateTypes.REDSTONE_BLOCK, StateTypes.NETHER_QUARTZ_ORE, StateTypes.HOPPER, StateTypes.QUARTZ_BLOCK, StateTypes.CHISELED_QUARTZ_BLOCK, StateTypes.QUARTZ_PILLAR, StateTypes.QUARTZ_STAIRS, StateTypes.DROPPER, StateTypes.WHITE_TERRACOTTA, StateTypes.ORANGE_TERRACOTTA, StateTypes.MAGENTA_TERRACOTTA, StateTypes.LIGHT_BLUE_TERRACOTTA, StateTypes.YELLOW_TERRACOTTA, StateTypes.LIME_TERRACOTTA, StateTypes.PINK_TERRACOTTA, StateTypes.GRAY_TERRACOTTA, StateTypes.LIGHT_GRAY_TERRACOTTA, StateTypes.CYAN_TERRACOTTA, StateTypes.PURPLE_TERRACOTTA, StateTypes.BLUE_TERRACOTTA, StateTypes.BROWN_TERRACOTTA, StateTypes.GREEN_TERRACOTTA, StateTypes.RED_TERRACOTTA, StateTypes.BLACK_TERRACOTTA, StateTypes.IRON_TRAPDOOR, StateTypes.PRISMARINE, StateTypes.PRISMARINE_BRICKS, StateTypes.DARK_PRISMARINE, StateTypes.PRISMARINE_STAIRS, StateTypes.PRISMARINE_BRICK_STAIRS, StateTypes.DARK_PRISMARINE_STAIRS, StateTypes.PRISMARINE_SLAB, StateTypes.PRISMARINE_BRICK_SLAB, StateTypes.DARK_PRISMARINE_SLAB, StateTypes.TERRACOTTA, StateTypes.COAL_BLOCK, StateTypes.RED_SANDSTONE, StateTypes.CHISELED_RED_SANDSTONE, StateTypes.CUT_RED_SANDSTONE, StateTypes.RED_SANDSTONE_STAIRS, StateTypes.STONE_SLAB, StateTypes.SMOOTH_STONE_SLAB, StateTypes.SANDSTONE_SLAB, StateTypes.CUT_SANDSTONE_SLAB, StateTypes.PETRIFIED_OAK_SLAB, StateTypes.COBBLESTONE_SLAB, StateTypes.BRICK_SLAB, StateTypes.STONE_BRICK_SLAB, StateTypes.NETHER_BRICK_SLAB, StateTypes.QUARTZ_SLAB, StateTypes.RED_SANDSTONE_SLAB, StateTypes.CUT_RED_SANDSTONE_SLAB, StateTypes.PURPUR_SLAB, StateTypes.SMOOTH_STONE, StateTypes.SMOOTH_SANDSTONE, StateTypes.SMOOTH_QUARTZ, StateTypes.SMOOTH_RED_SANDSTONE, StateTypes.PURPUR_BLOCK, StateTypes.PURPUR_PILLAR, StateTypes.PURPUR_STAIRS, StateTypes.END_STONE_BRICKS, StateTypes.MAGMA_BLOCK, StateTypes.RED_NETHER_BRICKS, StateTypes.BONE_BLOCK, StateTypes.OBSERVER, StateTypes.WHITE_GLAZED_TERRACOTTA, StateTypes.ORANGE_GLAZED_TERRACOTTA, StateTypes.MAGENTA_GLAZED_TERRACOTTA, StateTypes.LIGHT_BLUE_GLAZED_TERRACOTTA, StateTypes.YELLOW_GLAZED_TERRACOTTA, StateTypes.LIME_GLAZED_TERRACOTTA, StateTypes.PINK_GLAZED_TERRACOTTA, StateTypes.GRAY_GLAZED_TERRACOTTA, StateTypes.LIGHT_GRAY_GLAZED_TERRACOTTA, StateTypes.CYAN_GLAZED_TERRACOTTA, StateTypes.PURPLE_GLAZED_TERRACOTTA, StateTypes.BLUE_GLAZED_TERRACOTTA, StateTypes.BROWN_GLAZED_TERRACOTTA, StateTypes.GREEN_GLAZED_TERRACOTTA, StateTypes.RED_GLAZED_TERRACOTTA, StateTypes.BLACK_GLAZED_TERRACOTTA, StateTypes.WHITE_CONCRETE, StateTypes.ORANGE_CONCRETE, StateTypes.MAGENTA_CONCRETE, StateTypes.LIGHT_BLUE_CONCRETE, StateTypes.YELLOW_CONCRETE, StateTypes.LIME_CONCRETE, StateTypes.PINK_CONCRETE, StateTypes.GRAY_CONCRETE, StateTypes.LIGHT_GRAY_CONCRETE, StateTypes.CYAN_CONCRETE, StateTypes.PURPLE_CONCRETE, StateTypes.BLUE_CONCRETE, StateTypes.BROWN_CONCRETE, StateTypes.GREEN_CONCRETE, StateTypes.RED_CONCRETE, StateTypes.BLACK_CONCRETE, StateTypes.DEAD_TUBE_CORAL_BLOCK, StateTypes.DEAD_BRAIN_CORAL_BLOCK, StateTypes.DEAD_BUBBLE_CORAL_BLOCK, StateTypes.DEAD_FIRE_CORAL_BLOCK, StateTypes.DEAD_HORN_CORAL_BLOCK, StateTypes.TUBE_CORAL_BLOCK, StateTypes.BRAIN_CORAL_BLOCK, StateTypes.BUBBLE_CORAL_BLOCK, StateTypes.FIRE_CORAL_BLOCK, StateTypes.HORN_CORAL_BLine truncated
BlockTags.MINEABLE_WITH_SHOVEL.addTag(BlockTags.CONCRETE_POWDER).add(StateTypes.CLAY, StateTypes.DIRT, StateTypes.COARSE_DIRT, StateTypes.PODZOL, StateTypes.FARMLAND, StateTypes.GRASS_BLOCK, StateTypes.GRAVEL, StateTypes.MYCELIUM, StateTypes.SAND, StateTypes.RED_SAND, StateTypes.SNOW_BLOCK, StateTypes.SNOW, StateTypes.SOUL_SAND, StateTypes.DIRT_PATH, StateTypes.SOUL_SOIL, StateTypes.ROOTED_DIRT, StateTypes.MUDDY_MANGROVE_ROOTS, StateTypes.MUD, StateTypes.SUSPICIOUS_SAND, StateTypes.SUSPICIOUS_GRAVEL);
BlockTags.SWORD_EFFICIENT.addTag(BlockTags.LEAVES).addTag(BlockTags.SAPLINGS).addTag(BlockTags.SMALL_FLOWERS).addTag(BlockTags.CROPS).add(StateTypes.SHORT_GRASS, StateTypes.FERN, StateTypes.DEAD_BUSH, StateTypes.VINE, StateTypes.GLOW_LICHEN, StateTypes.SUNFLOWER, StateTypes.LILAC, StateTypes.ROSE_BUSH, StateTypes.PEONY, StateTypes.TALL_GRASS, StateTypes.LARGE_FERN, StateTypes.HANGING_ROOTS, StateTypes.PITCHER_PLANT, StateTypes.BROWN_MUSHROOM, StateTypes.RED_MUSHROOM, StateTypes.SUGAR_CANE, StateTypes.PUMPKIN, StateTypes.CARVED_PUMPKIN, StateTypes.JACK_O_LANTERN, StateTypes.MELON, StateTypes.ATTACHED_PUMPKIN_STEM, StateTypes.ATTACHED_MELON_STEM, StateTypes.LILY_PAD, StateTypes.COCOA, StateTypes.PITCHER_CROP, StateTypes.SWEET_BERRY_BUSH, StateTypes.CAVE_VINES, StateTypes.CAVE_VINES_PLANT, StateTypes.SPORE_BLOSSOM, StateTypes.MOSS_CARPET, StateTypes.PINK_PETALS, StateTypes.BIG_DRIPLEAF, StateTypes.BIG_DRIPLEAF_STEM, StateTypes.SMALL_DRIPLEAF, StateTypes.NETHER_WART, StateTypes.WARPED_FUNGUS, StateTypes.WARPED_ROOTS, StateTypes.NETHER_SPROUTS, StateTypes.CRIMSON_FUNGUS, StateTypes.WEEPING_VINES, StateTypes.WEEPING_VINES_PLANT, StateTypes.TWISTING_VINES, StateTypes.TWISTING_VINES_PLANT, StateTypes.CRIMSON_ROOTS, StateTypes.CHORUS_PLANT, StateTypes.CHORUS_FLOWER);
BlockTags.NEEDS_DIAMOND_TOOL.add(StateTypes.OBSIDIAN, StateTypes.CRYING_OBSIDIAN, StateTypes.NETHERITE_BLOCK, StateTypes.RESPAWN_ANCHOR, StateTypes.ANCIENT_DEBRIS);
BlockTags.NEEDS_IRON_TOOL.add(StateTypes.DIAMOND_BLOCK, StateTypes.DIAMOND_ORE, StateTypes.DEEPSLATE_DIAMOND_ORE, StateTypes.EMERALD_ORE, StateTypes.DEEPSLATE_EMERALD_ORE, StateTypes.EMERALD_BLOCK, StateTypes.GOLD_BLOCK, StateTypes.RAW_GOLD_BLOCK, StateTypes.GOLD_ORE, StateTypes.DEEPSLATE_GOLD_ORE, StateTypes.REDSTONE_ORE, StateTypes.DEEPSLATE_REDSTONE_ORE);
BlockTags.NEEDS_STONE_TOOL.add(StateTypes.IRON_BLOCK, StateTypes.RAW_IRON_BLOCK, StateTypes.IRON_ORE, StateTypes.DEEPSLATE_IRON_ORE, StateTypes.LAPIS_BLOCK, StateTypes.LAPIS_ORE, StateTypes.DEEPSLATE_LAPIS_ORE, StateTypes.COPPER_BLOCK, StateTypes.RAW_COPPER_BLOCK, StateTypes.COPPER_ORE, StateTypes.DEEPSLATE_COPPER_ORE, StateTypes.CUT_COPPER_SLAB, StateTypes.CUT_COPPER_STAIRS, StateTypes.CUT_COPPER, StateTypes.WEATHERED_COPPER, StateTypes.WEATHERED_CUT_COPPER_SLAB, StateTypes.WEATHERED_CUT_COPPER_STAIRS, StateTypes.WEATHERED_CUT_COPPER, StateTypes.OXIDIZED_COPPER, StateTypes.OXIDIZED_CUT_COPPER_SLAB, StateTypes.OXIDIZED_CUT_COPPER_STAIRS, StateTypes.OXIDIZED_CUT_COPPER, StateTypes.EXPOSED_COPPER, StateTypes.EXPOSED_CUT_COPPER_SLAB, StateTypes.EXPOSED_CUT_COPPER_STAIRS, StateTypes.EXPOSED_CUT_COPPER, StateTypes.WAXED_COPPER_BLOCK, StateTypes.WAXED_CUT_COPPER_SLAB, StateTypes.WAXED_CUT_COPPER_STAIRS, StateTypes.WAXED_CUT_COPPER, StateTypes.WAXED_WEATHERED_COPPER, StateTypes.WAXED_WEATHERED_CUT_COPPER_SLAB, StateTypes.WAXED_WEATHERED_CUT_COPPER_STAIRS, StateTypes.WAXED_WEATHERED_CUT_COPPER, StateTypes.WAXED_EXPOSED_COPPER, StateTypes.WAXED_EXPOSED_CUT_COPPER_SLAB, StateTypes.WAXED_EXPOSED_CUT_COPPER_STAIRS, StateTypes.WAXED_EXPOSED_CUT_COPPER, StateTypes.WAXED_OXIDIZED_COPPER, StateTypes.WAXED_OXIDIZED_CUT_COPPER_SLAB, StateTypes.WAXED_OXIDIZED_CUT_COPPER_STAIRS, StateTypes.WAXED_OXIDIZED_CUT_COPPER, StateTypes.LIGHTNING_ROD);
BlockTags.FEATURES_CANNOT_REPLACE.add(StateTypes.BEDROCK, StateTypes.SPAWNER, StateTypes.CHEST, StateTypes.END_PORTAL_FRAME, StateTypes.REINFORCED_DEEPSLATE);
BlockTags.LAVA_POOL_STONE_CANNOT_REPLACE.addTag(BlockTags.FEATURES_CANNOT_REPLACE).addTag(BlockTags.LEAVES).addTag(BlockTags.LOGS);
BlockTags.GEODE_INVALID_BLOCKS.add(StateTypes.BEDROCK, StateTypes.WATER, StateTypes.LAVA, StateTypes.ICE, StateTypes.PACKED_ICE, StateTypes.BLUE_ICE);
BlockTags.FROG_PREFER_JUMP_TO.add(StateTypes.LILY_PAD, StateTypes.BIG_DRIPLEAF);
BlockTags.SCULK_REPLACEABLE.addTag(BlockTags.BASE_STONE_OVERWORLD).addTag(BlockTags.DIRT).addTag(BlockTags.TERRACOTTA).addTag(BlockTags.NYLIUM).addTag(BlockTags.BASE_STONE_NETHER).add(StateTypes.SAND, StateTypes.RED_SAND, StateTypes.GRAVEL, StateTypes.SOUL_SAND, StateTypes.SOUL_SOIL, StateTypes.CALCITE, StateTypes.SMOOTH_BASALT, StateTypes.CLAY, StateTypes.DRIPSTONE_BLOCK, StateTypes.END_STONE, StateTypes.RED_SANDSTONE, StateTypes.SANDSTONE);
BlockTags.SCULK_REPLACEABLE_WORLD_GEN.addTag(BlockTags.SCULK_REPLACEABLE).add(StateTypes.DEEPSLATE_BRICKS, StateTypes.DEEPSLATE_TILES, StateTypes.COBBLED_DEEPSLATE, StateTypes.CRACKED_DEEPSLATE_BRICKS, StateTypes.CRACKED_DEEPSLATE_TILES, StateTypes.POLISHED_DEEPSLATE);
BlockTags.ANCIENT_CITY_REPLACEABLE.add(StateTypes.DEEPSLATE, StateTypes.DEEPSLATE_BRICKS, StateTypes.DEEPSLATE_TILES, StateTypes.DEEPSLATE_BRICK_SLAB, StateTypes.DEEPSLATE_TILE_SLAB, StateTypes.DEEPSLATE_BRICK_STAIRS, StateTypes.DEEPSLATE_TILE_WALL, StateTypes.DEEPSLATE_BRICK_WALL, StateTypes.COBBLED_DEEPSLATE, StateTypes.CRACKED_DEEPSLATE_BRICKS, StateTypes.CRACKED_DEEPSLATE_TILES, StateTypes.GRAY_WOOL);
BlockTags.VIBRATION_RESONATORS.add(StateTypes.AMETHYST_BLOCK);
BlockTags.ANIMALS_SPAWNABLE_ON.add(StateTypes.GRASS_BLOCK);
BlockTags.AXOLOTLS_SPAWNABLE_ON.add(StateTypes.CLAY);
BlockTags.GOATS_SPAWNABLE_ON.addTag(BlockTags.ANIMALS_SPAWNABLE_ON).add(StateTypes.STONE, StateTypes.SNOW, StateTypes.SNOW_BLOCK, StateTypes.PACKED_ICE, StateTypes.GRAVEL);
BlockTags.MOOSHROOMS_SPAWNABLE_ON.add(StateTypes.MYCELIUM);
BlockTags.PARROTS_SPAWNABLE_ON.add(StateTypes.GRASS_BLOCK, StateTypes.AIR).addTag(BlockTags.LEAVES).addTag(BlockTags.LOGS);
BlockTags.PARROTS_SPAWNABLE_ON.addTag(BlockTags.LEAVES).addTag(BlockTags.LOGS).add(StateTypes.GRASS_BLOCK, StateTypes.AIR);
BlockTags.POLAR_BEARS_SPAWNABLE_ON_ALTERNATE.add(StateTypes.ICE);
BlockTags.RABBITS_SPAWNABLE_ON.add(StateTypes.GRASS_BLOCK, StateTypes.SNOW, StateTypes.SNOW_BLOCK, StateTypes.SAND);
BlockTags.FOXES_SPAWNABLE_ON.add(StateTypes.GRASS_BLOCK, StateTypes.SNOW, StateTypes.SNOW_BLOCK, StateTypes.PODZOL, StateTypes.COARSE_DIRT);
BlockTags.WOLVES_SPAWNABLE_ON.add(StateTypes.GRASS_BLOCK, StateTypes.SNOW, StateTypes.SNOW_BLOCK);
BlockTags.FROGS_SPAWNABLE_ON.add(StateTypes.GRASS_BLOCK, StateTypes.MUD, StateTypes.MANGROVE_ROOTS, StateTypes.MUDDY_MANGROVE_ROOTS);
BlockTags.TERRACOTTA.add(StateTypes.TERRACOTTA, StateTypes.WHITE_TERRACOTTA, StateTypes.ORANGE_TERRACOTTA, StateTypes.MAGENTA_TERRACOTTA, StateTypes.LIGHT_BLUE_TERRACOTTA, StateTypes.YELLOW_TERRACOTTA, StateTypes.LIME_TERRACOTTA, StateTypes.PINK_TERRACOTTA, StateTypes.GRAY_TERRACOTTA, StateTypes.LIGHT_GRAY_TERRACOTTA, StateTypes.CYAN_TERRACOTTA, StateTypes.PURPLE_TERRACOTTA, StateTypes.BLUE_TERRACOTTA, StateTypes.BROWN_TERRACOTTA, StateTypes.GREEN_TERRACOTTA, StateTypes.RED_TERRACOTTA, StateTypes.BLACK_TERRACOTTA);
BlockTags.AZALEA_GROWS_ON.addTag(BlockTags.DIRT).addTag(BlockTags.SAND).addTag(BlockTags.TERRACOTTA).add(StateTypes.SNOW_BLOCK).add(StateTypes.POWDER_SNOW);
BlockTags.REPLACEABLE_PLANTS.add(StateTypes.GRASS, StateTypes.FERN, StateTypes.DEAD_BUSH, StateTypes.VINE, StateTypes.GLOW_LICHEN, StateTypes.SUNFLOWER, StateTypes.LILAC, StateTypes.ROSE_BUSH, StateTypes.PEONY, StateTypes.TALL_GRASS, StateTypes.LARGE_FERN, StateTypes.HANGING_ROOTS, StateTypes.PITCHER_PLANT);
BlockTags.FROG_PREFER_JUMP_TO.add(StateTypes.LILY_PAD, StateTypes.BIG_DRIPLEAF);
BlockTags.SCULK_REPLACEABLE.addTag(BlockTags.BASE_STONE_OVERWORLD).addTag(BlockTags.DIRT).addTag(BlockTags.TERRACOTTA).addTag(BlockTags.NYLIUM).addTag(BlockTags.BASE_STONE_NETHER).addTag(BlockTags.SAND).add(StateTypes.GRAVEL).add(StateTypes.SOUL_SAND).add(StateTypes.SOUL_SOIL).add(StateTypes.CALCITE).add(StateTypes.SMOOTH_BASALT).add(StateTypes.CLAY).add(StateTypes.DRIPSTONE_BLOCK).add(StateTypes.END_STONE).add(StateTypes.RED_SANDSTONE).add(StateTypes.SANDSTONE);
BlockTags.SCULK_REPLACEABLE_WORLD_GEN.addTag(BlockTags.SCULK_REPLACEABLE).add(StateTypes.DEEPSLATE_BRICKS).add(StateTypes.DEEPSLATE_TILES).add(StateTypes.COBBLED_DEEPSLATE).add(StateTypes.CRACKED_DEEPSLATE_BRICKS).add(StateTypes.CRACKED_DEEPSLATE_TILES).add(StateTypes.POLISHED_DEEPSLATE);
BlockTags.VIBRATION_RESONATORS.add(StateTypes.AMETHYST_BLOCK);
BlockTags.AZALEA_GROWS_ON.addTag(BlockTags.DIRT).addTag(BlockTags.SAND).addTag(BlockTags.TERRACOTTA).add(StateTypes.SNOW_BLOCK, StateTypes.POWDER_SNOW);
BlockTags.CONVERTABLE_TO_MUD.add(StateTypes.DIRT, StateTypes.COARSE_DIRT, StateTypes.ROOTED_DIRT);
BlockTags.ANCIENT_CITY_REPLACEABLE.add(StateTypes.DEEPSLATE).add(StateTypes.DEEPSLATE_BRICKS).add(StateTypes.DEEPSLATE_TILES).add(StateTypes.DEEPSLATE_BRICK_SLAB).add(StateTypes.DEEPSLATE_TILE_SLAB).add(StateTypes.DEEPSLATE_BRICK_STAIRS).add(StateTypes.DEEPSLATE_TILE_WALL).add(StateTypes.DEEPSLATE_BRICK_WALL).add(StateTypes.COBBLED_DEEPSLATE).add(StateTypes.CRACKED_DEEPSLATE_BRICKS).add(StateTypes.CRACKED_DEEPSLATE_TILES).add(StateTypes.GRAY_WOOL);
BlockTags.MANGROVE_LOGS_CAN_GROW_THROUGH.add(StateTypes.MUD, StateTypes.MUDDY_MANGROVE_ROOTS, StateTypes.MANGROVE_ROOTS, StateTypes.MANGROVE_LEAVES, StateTypes.MANGROVE_LOG, StateTypes.MANGROVE_PROPAGULE, StateTypes.MOSS_CARPET, StateTypes.VINE);
BlockTags.MANGROVE_ROOTS_CAN_GROW_THROUGH.add(StateTypes.MUD, StateTypes.MUDDY_MANGROVE_ROOTS, StateTypes.MANGROVE_ROOTS, StateTypes.MOSS_CARPET, StateTypes.VINE, StateTypes.MANGROVE_PROPAGULE, StateTypes.SNOW);
BlockTags.DEAD_BUSH_MAY_PLACE_ON.addTag(BlockTags.SAND).addTag(BlockTags.TERRACOTTA).addTag(BlockTags.DIRT);
BlockTags.SNOW_LAYER_CANNOT_SURVIVE_ON.add(StateTypes.ICE).add(StateTypes.PACKED_ICE).add(StateTypes.BARRIER);
BlockTags.SNOW_LAYER_CAN_SURVIVE_ON.add(StateTypes.HONEY_BLOCK).add(StateTypes.SOUL_SAND).add(StateTypes.MUD);
BlockTags.COMPLETES_FIND_TREE_TUTORIAL.addTag(BlockTags.LOGS).addTag(BlockTags.LEAVES).addTag(BlockTags.WART_BLOCKS);
BlockTags.SNAPS_GOAT_HORN.addTag(BlockTags.OVERWORLD_NATURAL_LOGS).add(StateTypes.STONE).add(StateTypes.PACKED_ICE).add(StateTypes.IRON_ORE).add(StateTypes.COAL_ORE).add(StateTypes.COPPER_ORE).add(StateTypes.EMERALD_ORE);
BlockTags.SNAPS_GOAT_HORN.addTag(BlockTags.OVERWORLD_NATURAL_LOGS).add(StateTypes.STONE, StateTypes.PACKED_ICE, StateTypes.IRON_ORE, StateTypes.COAL_ORE, StateTypes.COPPER_ORE, StateTypes.EMERALD_ORE);
BlockTags.REPLACEABLE_BY_TREES.addTag(BlockTags.LEAVES).add(StateTypes.SHORT_GRASS, StateTypes.FERN, StateTypes.DEAD_BUSH, StateTypes.VINE, StateTypes.GLOW_LICHEN, StateTypes.SUNFLOWER, StateTypes.LILAC, StateTypes.ROSE_BUSH, StateTypes.PEONY, StateTypes.TALL_GRASS, StateTypes.LARGE_FERN, StateTypes.HANGING_ROOTS, StateTypes.PITCHER_PLANT, StateTypes.WATER, StateTypes.SEAGRASS, StateTypes.TALL_SEAGRASS, StateTypes.WARPED_ROOTS, StateTypes.NETHER_SPROUTS, StateTypes.CRIMSON_ROOTS);
BlockTags.SNOW_LAYER_CANNOT_SURVIVE_ON.add(StateTypes.ICE, StateTypes.PACKED_ICE, StateTypes.BARRIER);
BlockTags.SNOW_LAYER_CAN_SURVIVE_ON.add(StateTypes.HONEY_BLOCK, StateTypes.SOUL_SAND, StateTypes.MUD);
BlockTags.INVALID_SPAWN_INSIDE.add(StateTypes.END_PORTAL, StateTypes.END_GATEWAY);
BlockTags.TRAIL_RUINS_REPLACEABLE.add(StateTypes.GRAVEL);
BlockTags.SNIFFER_DIGGABLE_BLOCK.add(StateTypes.DIRT, StateTypes.GRASS_BLOCK, StateTypes.PODZOL, StateTypes.COARSE_DIRT, StateTypes.ROOTED_DIRT, StateTypes.MOSS_BLOCK, StateTypes.MUD, StateTypes.MUDDY_MANGROVE_ROOTS);
BlockTags.SNIFFER_EGG_HATCH_BOOST.add(StateTypes.MOSS_BLOCK);
for (StateType value : StateTypes.values()) {
if (value.isReplaceable()) BlockTags.REPLACEABLE.add(value);
}
BlockTags.TRAIL_RUINS_REPLACEABLE.add(StateTypes.GRAVEL);
BlockTags.REPLACEABLE.add(StateTypes.AIR, StateTypes.WATER, StateTypes.LAVA, StateTypes.SHORT_GRASS, StateTypes.FERN, StateTypes.DEAD_BUSH, StateTypes.SEAGRASS, StateTypes.TALL_SEAGRASS, StateTypes.FIRE, StateTypes.SOUL_FIRE, StateTypes.SNOW, StateTypes.VINE, StateTypes.GLOW_LICHEN, StateTypes.LIGHT, StateTypes.TALL_GRASS, StateTypes.LARGE_FERN, StateTypes.STRUCTURE_VOID, StateTypes.VOID_AIR, StateTypes.CAVE_AIR, StateTypes.BUBBLE_COLUMN, StateTypes.WARPED_ROOTS, StateTypes.NETHER_SPROUTS, StateTypes.CRIMSON_ROOTS, StateTypes.HANGING_ROOTS);
BlockTags.ENCHANTMENT_POWER_PROVIDER.add(StateTypes.BOOKSHELF);
BlockTags.ENCHANTMENT_POWER_TRANSMITTER.addTag(BlockTags.REPLACEABLE);
BlockTags.MAINTAINS_FARMLAND.add(StateTypes.PUMPKIN_STEM, StateTypes.ATTACHED_PUMPKIN_STEM, StateTypes.MELON_STEM, StateTypes.ATTACHED_MELON_STEM, StateTypes.BEETROOTS, StateTypes.CARROTS, StateTypes.POTATOES, StateTypes.TORCHFLOWER_CROP, StateTypes.TORCHFLOWER, StateTypes.PITCHER_CROP, StateTypes.WHEAT);
@@ -144,40 +144,43 @@ public class ItemTags {
copy(BlockTags.WOODEN_FENCES, ItemTags.WOODEN_FENCES);
copy(BlockTags.FENCE_GATES, ItemTags.FENCE_GATES);
copy(BlockTags.WOODEN_PRESSURE_PLATES, ItemTags.WOODEN_PRESSURE_PLATES);
copy(BlockTags.WOODEN_TRAPDOORS, ItemTags.WOODEN_TRAPDOORS);
copy(BlockTags.DOORS, ItemTags.DOORS);
copy(BlockTags.SAPLINGS, ItemTags.SAPLINGS);
copy(BlockTags.BAMBOO_BLOCKS, ItemTags.BAMBOO_BLOCKS);
copy(BlockTags.OAK_LOGS, ItemTags.OAK_LOGS);
copy(BlockTags.DARK_OAK_LOGS, ItemTags.DARK_OAK_LOGS);
copy(BlockTags.BIRCH_LOGS, ItemTags.BIRCH_LOGS);
copy(BlockTags.ACACIA_LOGS, ItemTags.ACACIA_LOGS);
copy(BlockTags.SPRUCE_LOGS, ItemTags.SPRUCE_LOGS);
copy(BlockTags.MANGROVE_LOGS, ItemTags.MANGROVE_LOGS);
copy(BlockTags.JUNGLE_LOGS, ItemTags.JUNGLE_LOGS);
copy(BlockTags.CHERRY_LOGS, ItemTags.CHERRY_LOGS);
copy(BlockTags.CRIMSON_STEMS, ItemTags.CRIMSON_STEMS);
copy(BlockTags.WARPED_STEMS, ItemTags.WARPED_STEMS);
copy(BlockTags.WART_BLOCKS, ItemTags.WART_BLOCKS);
copy(BlockTags.LOGS_THAT_BURN, ItemTags.LOGS_THAT_BURN);
copy(BlockTags.LOGS, ItemTags.LOGS);
copy(BlockTags.DARK_OAK_LOGS, ItemTags.DARK_OAK_LOGS);
copy(BlockTags.OAK_LOGS, ItemTags.OAK_LOGS);
copy(BlockTags.BIRCH_LOGS, ItemTags.BIRCH_LOGS);
copy(BlockTags.ACACIA_LOGS, ItemTags.ACACIA_LOGS);
copy(BlockTags.CHERRY_LOGS, ItemTags.CHERRY_LOGS);
copy(BlockTags.JUNGLE_LOGS, ItemTags.JUNGLE_LOGS);
copy(BlockTags.SPRUCE_LOGS, ItemTags.SPRUCE_LOGS);
copy(BlockTags.MANGROVE_LOGS, ItemTags.MANGROVE_LOGS);
copy(BlockTags.CRIMSON_STEMS, ItemTags.CRIMSON_STEMS);
copy(BlockTags.WARPED_STEMS, ItemTags.WARPED_STEMS);
copy(BlockTags.BAMBOO_BLOCKS, ItemTags.BAMBOO_BLOCKS);
copy(BlockTags.WART_BLOCKS, ItemTags.WART_BLOCKS);
ItemTags.BANNERS.add(ItemTypes.WHITE_BANNER, ItemTypes.ORANGE_BANNER, ItemTypes.MAGENTA_BANNER, ItemTypes.LIGHT_BLUE_BANNER, ItemTypes.YELLOW_BANNER, ItemTypes.LIME_BANNER, ItemTypes.PINK_BANNER, ItemTypes.GRAY_BANNER, ItemTypes.LIGHT_GRAY_BANNER, ItemTypes.CYAN_BANNER, ItemTypes.PURPLE_BANNER, ItemTypes.BLUE_BANNER, ItemTypes.BROWN_BANNER, ItemTypes.GREEN_BANNER, ItemTypes.RED_BANNER, ItemTypes.BLACK_BANNER);
copy(BlockTags.SAND, ItemTags.SAND);
copy(BlockTags.SMELTS_TO_GLASS, ItemTags.SMELTS_TO_GLASS);
copy(BlockTags.STAIRS, ItemTags.STAIRS);
copy(BlockTags.SLABS, ItemTags.SLABS);
copy(BlockTags.WALLS, ItemTags.WALLS);
copy(BlockTags.STAIRS, ItemTags.STAIRS);
copy(BlockTags.ANVIL, ItemTags.ANVIL);
copy(BlockTags.RAILS, ItemTags.RAILS);
copy(BlockTags.LEAVES, ItemTags.LEAVES);
copy(BlockTags.WOODEN_TRAPDOORS, ItemTags.WOODEN_TRAPDOORS);
copy(BlockTags.TRAPDOORS, ItemTags.TRAPDOORS);
copy(BlockTags.SMALL_FLOWERS, ItemTags.SMALL_FLOWERS);
copy(BlockTags.BEDS, ItemTags.BEDS);
copy(BlockTags.FENCES, ItemTags.FENCES);
copy(BlockTags.TALL_FLOWERS, ItemTags.TALL_FLOWERS);
copy(BlockTags.FLOWERS, ItemTags.FLOWERS);
copy(BlockTags.SOUL_FIRE_BASE_BLOCKS, ItemTags.SOUL_FIRE_BASE_BLOCKS);
copy(BlockTags.CANDLES, ItemTags.CANDLES);
copy(BlockTags.DAMPENS_VIBRATIONS, ItemTags.DAMPENS_VIBRATIONS);
ItemTags.PIGLIN_REPELLENTS.add(ItemTypes.SOUL_TORCH, ItemTypes.SOUL_LANTERN, ItemTypes.SOUL_CAMPFIRE);
ItemTags.PIGLIN_LOVED.addTag(ItemTags.GOLD_ORES).add(ItemTypes.GOLD_BLOCK, ItemTypes.GILDED_BLACKSTONE, ItemTypes.LIGHT_WEIGHTED_PRESSURE_PLATE, ItemTypes.GOLD_INGOT, ItemTypes.BELL, ItemTypes.CLOCK, ItemTypes.GOLDEN_CARROT, ItemTypes.GLISTERING_MELON_SLICE, ItemTypes.GOLDEN_APPLE, ItemTypes.ENCHANTED_GOLDEN_APPLE, ItemTypes.GOLDEN_HELMET, ItemTypes.GOLDEN_CHESTPLATE, ItemTypes.GOLDEN_LEGGINGS, ItemTypes.GOLDEN_BOOTS, ItemTypes.GOLDEN_HORSE_ARMOR, ItemTypes.GOLDEN_SWORD, ItemTypes.GOLDEN_PICKAXE, ItemTypes.GOLDEN_SHOVEL, ItemTypes.GOLDEN_AXE, ItemTypes.GOLDEN_HOE, ItemTypes.RAW_GOLD, ItemTypes.RAW_GOLD_BLOCK);
ItemTags.IGNORED_BY_PIGLIN_BABIES.add(ItemTypes.LEATHER);
ItemTags.PIGLIN_FOOD.add(ItemTypes.PORKCHOP, ItemTypes.COOKED_PORKCHOP);
ItemTags.FOX_FOOD.add(ItemTypes.SWEET_BERRIES, ItemTypes.GLOW_BERRIES);
copy(BlockTags.GOLD_ORES, ItemTags.GOLD_ORES);
copy(BlockTags.IRON_ORES, ItemTags.IRON_ORES);
copy(BlockTags.DIAMOND_ORES, ItemTags.DIAMOND_ORES);
@@ -186,49 +189,46 @@ public class ItemTags {
copy(BlockTags.COAL_ORES, ItemTags.COAL_ORES);
copy(BlockTags.EMERALD_ORES, ItemTags.EMERALD_ORES);
copy(BlockTags.COPPER_ORES, ItemTags.COPPER_ORES);
ItemTags.NON_FLAMMABLE_WOOD.add(ItemTypes.WARPED_STEM, ItemTypes.STRIPPED_WARPED_STEM, ItemTypes.WARPED_HYPHAE, ItemTypes.STRIPPED_WARPED_HYPHAE, ItemTypes.CRIMSON_STEM, ItemTypes.STRIPPED_CRIMSON_STEM, ItemTypes.CRIMSON_HYPHAE, ItemTypes.STRIPPED_CRIMSON_HYPHAE, ItemTypes.CRIMSON_PLANKS, ItemTypes.WARPED_PLANKS, ItemTypes.CRIMSON_SLAB, ItemTypes.WARPED_SLAB, ItemTypes.CRIMSON_PRESSURE_PLATE, ItemTypes.WARPED_PRESSURE_PLATE, ItemTypes.CRIMSON_FENCE, ItemTypes.WARPED_FENCE, ItemTypes.CRIMSON_TRAPDOOR, ItemTypes.WARPED_TRAPDOOR, ItemTypes.CRIMSON_FENCE_GATE, ItemTypes.WARPED_FENCE_GATE, ItemTypes.CRIMSON_STAIRS, ItemTypes.WARPED_STAIRS, ItemTypes.CRIMSON_BUTTON, ItemTypes.WARPED_BUTTON, ItemTypes.CRIMSON_DOOR, ItemTypes.WARPED_DOOR, ItemTypes.CRIMSON_SIGN, ItemTypes.WARPED_SIGN, ItemTypes.WARPED_HANGING_SIGN, ItemTypes.CRIMSON_HANGING_SIGN);
copy(BlockTags.SOUL_FIRE_BASE_BLOCKS, ItemTags.SOUL_FIRE_BASE_BLOCKS);
copy(BlockTags.CANDLES, ItemTags.CANDLES);
copy(BlockTags.DIRT, ItemTags.DIRT);
copy(BlockTags.TERRACOTTA, ItemTags.TERRACOTTA);
copy(BlockTags.COMPLETES_FIND_TREE_TUTORIAL, ItemTags.COMPLETES_FIND_TREE_TUTORIAL);
ItemTags.BANNERS.add(ItemTypes.WHITE_BANNER, ItemTypes.ORANGE_BANNER, ItemTypes.MAGENTA_BANNER, ItemTypes.LIGHT_BLUE_BANNER, ItemTypes.YELLOW_BANNER, ItemTypes.LIME_BANNER, ItemTypes.PINK_BANNER, ItemTypes.GRAY_BANNER, ItemTypes.LIGHT_GRAY_BANNER, ItemTypes.CYAN_BANNER, ItemTypes.PURPLE_BANNER, ItemTypes.BLUE_BANNER, ItemTypes.BROWN_BANNER, ItemTypes.GREEN_BANNER, ItemTypes.RED_BANNER, ItemTypes.BLACK_BANNER);
ItemTags.BOATS.add(ItemTypes.OAK_BOAT, ItemTypes.SPRUCE_BOAT, ItemTypes.BIRCH_BOAT, ItemTypes.JUNGLE_BOAT, ItemTypes.ACACIA_BOAT, ItemTypes.DARK_OAK_BOAT, ItemTypes.MANGROVE_BOAT, ItemTypes.BAMBOO_RAFT, ItemTypes.CHERRY_BOAT).addTag(ItemTags.CHEST_BOATS);
ItemTags.BOATS.addTag(ItemTags.CHEST_BOATS).add(ItemTypes.OAK_BOAT, ItemTypes.SPRUCE_BOAT, ItemTypes.BIRCH_BOAT, ItemTypes.JUNGLE_BOAT, ItemTypes.ACACIA_BOAT, ItemTypes.DARK_OAK_BOAT, ItemTypes.MANGROVE_BOAT, ItemTypes.BAMBOO_RAFT, ItemTypes.CHERRY_BOAT);
ItemTags.CHEST_BOATS.add(ItemTypes.OAK_CHEST_BOAT, ItemTypes.SPRUCE_CHEST_BOAT, ItemTypes.BIRCH_CHEST_BOAT, ItemTypes.JUNGLE_CHEST_BOAT, ItemTypes.ACACIA_CHEST_BOAT, ItemTypes.DARK_OAK_CHEST_BOAT, ItemTypes.MANGROVE_CHEST_BOAT, ItemTypes.BAMBOO_CHEST_RAFT, ItemTypes.CHERRY_CHEST_BOAT);
ItemTags.FISHES.add(ItemTypes.COD, ItemTypes.COOKED_COD, ItemTypes.SALMON, ItemTypes.COOKED_SALMON, ItemTypes.PUFFERFISH, ItemTypes.TROPICAL_FISH);
copy(BlockTags.STANDING_SIGNS, ItemTags.SIGNS);
copy(BlockTags.CEILING_HANGING_SIGNS, ItemTags.HANGING_SIGNS);
ItemTags.CREEPER_DROP_MUSIC_DISCS.add(ItemTypes.MUSIC_DISC_13, ItemTypes.MUSIC_DISC_CAT, ItemTypes.MUSIC_DISC_BLOCKS, ItemTypes.MUSIC_DISC_CHIRP, ItemTypes.MUSIC_DISC_FAR, ItemTypes.MUSIC_DISC_MALL, ItemTypes.MUSIC_DISC_MELLOHI, ItemTypes.MUSIC_DISC_STAL, ItemTypes.MUSIC_DISC_STRAD, ItemTypes.MUSIC_DISC_WARD, ItemTypes.MUSIC_DISC_11, ItemTypes.MUSIC_DISC_WAIT);
ItemTags.MUSIC_DISCS.addTag(ItemTags.CREEPER_DROP_MUSIC_DISCS).add(ItemTypes.MUSIC_DISC_PIGSTEP, ItemTypes.MUSIC_DISC_OTHERSIDE, ItemTypes.MUSIC_DISC_5, ItemTypes.MUSIC_DISC_RELIC);
ItemTags.CREEPER_DROP_MUSIC_DISCS.add(ItemTypes.MUSIC_DISC_13, ItemTypes.MUSIC_DISC_CAT, ItemTypes.MUSIC_DISC_BLOCKS, ItemTypes.MUSIC_DISC_CHIRP, ItemTypes.MUSIC_DISC_FAR, ItemTypes.MUSIC_DISC_MALL, ItemTypes.MUSIC_DISC_MELLOHI, ItemTypes.MUSIC_DISC_STAL, ItemTypes.MUSIC_DISC_STRAD, ItemTypes.MUSIC_DISC_WARD, ItemTypes.MUSIC_DISC_11, ItemTypes.MUSIC_DISC_WAIT);
ItemTags.COALS.add(ItemTypes.COAL, ItemTypes.CHARCOAL);
ItemTags.ARROWS.add(ItemTypes.ARROW, ItemTypes.TIPPED_ARROW, ItemTypes.SPECTRAL_ARROW);
ItemTags.LECTERN_BOOKS.add(ItemTypes.WRITTEN_BOOK, ItemTypes.WRITABLE_BOOK);
ItemTags.BOOKSHELF_BOOKS.add(ItemTypes.BOOK, ItemTypes.WRITTEN_BOOK, ItemTypes.ENCHANTED_BOOK, ItemTypes.WRITABLE_BOOK, ItemTypes.KNOWLEDGE_BOOK);
ItemTags.BEACON_PAYMENT_ITEMS.add(ItemTypes.NETHERITE_INGOT, ItemTypes.EMERALD, ItemTypes.DIAMOND, ItemTypes.GOLD_INGOT, ItemTypes.IRON_INGOT);
ItemTags.PIGLIN_REPELLENTS.add(ItemTypes.SOUL_TORCH, ItemTypes.SOUL_LANTERN, ItemTypes.SOUL_CAMPFIRE);
ItemTags.PIGLIN_LOVED.addTag(ItemTags.GOLD_ORES).add(ItemTypes.GOLD_BLOCK, ItemTypes.GILDED_BLACKSTONE, ItemTypes.LIGHT_WEIGHTED_PRESSURE_PLATE, ItemTypes.GOLD_INGOT, ItemTypes.BELL, ItemTypes.CLOCK, ItemTypes.GOLDEN_CARROT, ItemTypes.GLISTERING_MELON_SLICE, ItemTypes.GOLDEN_APPLE, ItemTypes.ENCHANTED_GOLDEN_APPLE, ItemTypes.GOLDEN_HELMET, ItemTypes.GOLDEN_CHESTPLATE, ItemTypes.GOLDEN_LEGGINGS, ItemTypes.GOLDEN_BOOTS, ItemTypes.GOLDEN_HORSE_ARMOR, ItemTypes.GOLDEN_SWORD, ItemTypes.GOLDEN_PICKAXE, ItemTypes.GOLDEN_SHOVEL, ItemTypes.GOLDEN_AXE, ItemTypes.GOLDEN_HOE, ItemTypes.RAW_GOLD, ItemTypes.RAW_GOLD_BLOCK);
ItemTags.IGNORED_BY_PIGLIN_BABIES.add(ItemTypes.LEATHER);
ItemTags.PIGLIN_FOOD.add(ItemTypes.PORKCHOP, ItemTypes.COOKED_PORKCHOP);
ItemTags.FOX_FOOD.add(ItemTypes.SWEET_BERRIES, ItemTypes.GLOW_BERRIES);
ItemTags.NON_FLAMMABLE_WOOD.add(ItemTypes.WARPED_STEM, ItemTypes.STRIPPED_WARPED_STEM, ItemTypes.WARPED_HYPHAE, ItemTypes.STRIPPED_WARPED_HYPHAE, ItemTypes.CRIMSON_STEM, ItemTypes.STRIPPED_CRIMSON_STEM, ItemTypes.CRIMSON_HYPHAE, ItemTypes.STRIPPED_CRIMSON_HYPHAE, ItemTypes.CRIMSON_PLANKS, ItemTypes.WARPED_PLANKS, ItemTypes.CRIMSON_SLAB, ItemTypes.WARPED_SLAB, ItemTypes.CRIMSON_PRESSURE_PLATE, ItemTypes.WARPED_PRESSURE_PLATE, ItemTypes.CRIMSON_FENCE, ItemTypes.WARPED_FENCE, ItemTypes.CRIMSON_TRAPDOOR, ItemTypes.WARPED_TRAPDOOR, ItemTypes.CRIMSON_FENCE_GATE, ItemTypes.WARPED_FENCE_GATE, ItemTypes.CRIMSON_STAIRS, ItemTypes.WARPED_STAIRS, ItemTypes.CRIMSON_BUTTON, ItemTypes.WARPED_BUTTON, ItemTypes.CRIMSON_DOOR, ItemTypes.WARPED_DOOR, ItemTypes.CRIMSON_SIGN, ItemTypes.WARPED_SIGN, ItemTypes.WARPED_HANGING_SIGN, ItemTypes.CRIMSON_HANGING_SIGN);
ItemTags.STONE_TOOL_MATERIALS.add(ItemTypes.COBBLESTONE, ItemTypes.BLACKSTONE, ItemTypes.COBBLED_DEEPSLATE);
ItemTags.STONE_CRAFTING_MATERIALS.add(ItemTypes.COBBLESTONE, ItemTypes.BLACKSTONE, ItemTypes.COBBLED_DEEPSLATE);
ItemTags.FREEZE_IMMUNE_WEARABLES.add(ItemTypes.LEATHER_BOOTS, ItemTypes.LEATHER_LEGGINGS, ItemTypes.LEATHER_CHESTPLATE, ItemTypes.LEATHER_HELMET, ItemTypes.LEATHER_HORSE_ARMOR);
ItemTags.AXOLOTL_TEMPT_ITEMS.add(ItemTypes.TROPICAL_FISH_BUCKET);
copy(BlockTags.DAMPENS_VIBRATIONS, ItemTags.DAMPENS_VIBRATIONS);
ItemTags.CLUSTER_MAX_HARVESTABLES.add(ItemTypes.DIAMOND_PICKAXE, ItemTypes.GOLDEN_PICKAXE, ItemTypes.IRON_PICKAXE, ItemTypes.NETHERITE_PICKAXE, ItemTypes.STONE_PICKAXE, ItemTypes.WOODEN_PICKAXE);
ItemTags.COMPASSES.add(ItemTypes.COMPASS, ItemTypes.RECOVERY_COMPASS);
copy(BlockTags.CEILING_HANGING_SIGNS, ItemTags.HANGING_SIGNS);
ItemTags.CREEPER_IGNITERS.add(ItemTypes.FLINT_AND_STEEL, ItemTypes.FIRE_CHARGE);
ItemTags.SWORDS.add(ItemTypes.DIAMOND_SWORD, ItemTypes.STONE_SWORD, ItemTypes.GOLDEN_SWORD, ItemTypes.NETHERITE_SWORD, ItemTypes.WOODEN_SWORD, ItemTypes.IRON_SWORD);
ItemTags.AXES.add(ItemTypes.DIAMOND_AXE, ItemTypes.STONE_AXE, ItemTypes.GOLDEN_AXE, ItemTypes.NETHERITE_AXE, ItemTypes.WOODEN_AXE, ItemTypes.IRON_AXE);
ItemTags.PICKAXES.add(ItemTypes.DIAMOND_PICKAXE, ItemTypes.STONE_PICKAXE, ItemTypes.GOLDEN_PICKAXE, ItemTypes.NETHERITE_PICKAXE, ItemTypes.WOODEN_PICKAXE, ItemTypes.IRON_PICKAXE);
ItemTags.SHOVELS.add(ItemTypes.DIAMOND_SHOVEL, ItemTypes.STONE_SHOVEL, ItemTypes.GOLDEN_SHOVEL, ItemTypes.NETHERITE_SHOVEL, ItemTypes.WOODEN_SHOVEL, ItemTypes.IRON_SHOVEL);
ItemTags.HOES.add(ItemTypes.DIAMOND_HOE, ItemTypes.STONE_HOE, ItemTypes.GOLDEN_HOE, ItemTypes.NETHERITE_HOE, ItemTypes.WOODEN_HOE, ItemTypes.IRON_HOE);
ItemTags.TOOLS.addTag(ItemTags.SWORDS).addTag(ItemTags.AXES).addTag(ItemTags.PICKAXES).addTag(ItemTags.SHOVELS).addTag(ItemTags.HOES).add(ItemTypes.TRIDENT);
ItemTags.BREAKS_DECORATED_POTS.addTag(ItemTags.TOOLS);
ItemTags.DECORATED_POT_SHERDS.add(ItemTypes.ANGLER_POTTERY_SHERD, ItemTypes.ARCHER_POTTERY_SHERD, ItemTypes.ARMS_UP_POTTERY_SHERD, ItemTypes.BLADE_POTTERY_SHERD, ItemTypes.BREWER_POTTERY_SHERD, ItemTypes.BURN_POTTERY_SHERD, ItemTypes.DANGER_POTTERY_SHERD, ItemTypes.EXPLORER_POTTERY_SHERD, ItemTypes.FRIEND_POTTERY_SHERD, ItemTypes.HEART_POTTERY_SHERD, ItemTypes.HEARTBREAK_POTTERY_SHERD, ItemTypes.HOWL_POTTERY_SHERD, ItemTypes.MINER_POTTERY_SHERD, ItemTypes.MOURNER_POTTERY_SHERD, ItemTypes.PLENTY_POTTERY_SHERD, ItemTypes.PRIZE_POTTERY_SHERD, ItemTypes.SHEAF_POTTERY_SHERD, ItemTypes.SHELTER_POTTERY_SHERD, ItemTypes.SKULL_POTTERY_SHERD, ItemTypes.SNORT_POTTERY_SHERD);
ItemTags.DECORATED_POT_INGREDIENTS.add(ItemTypes.BRICK).addTag(ItemTags.DECORATED_POT_SHERDS);
ItemTags.NOTEBLOCK_TOP_INSTRUMENTS.add(ItemTypes.ZOMBIE_HEAD, ItemTypes.SKELETON_SKULL, ItemTypes.CREEPER_HEAD, ItemTypes.DRAGON_HEAD, ItemTypes.WITHER_SKELETON_SKULL, ItemTypes.PIGLIN_HEAD, ItemTypes.PLAYER_HEAD);
ItemTags.TRIMMABLE_ARMOR.add(ItemTypes.NETHERITE_HELMET, ItemTypes.NETHERITE_CHESTPLATE, ItemTypes.NETHERITE_LEGGINGS, ItemTypes.NETHERITE_BOOTS, ItemTypes.DIAMOND_HELMET, ItemTypes.DIAMOND_CHESTPLATE, ItemTypes.DIAMOND_LEGGINGS, ItemTypes.DIAMOND_BOOTS, ItemTypes.GOLDEN_HELMET, ItemTypes.GOLDEN_CHESTPLATE, ItemTypes.GOLDEN_LEGGINGS, ItemTypes.GOLDEN_BOOTS, ItemTypes.IRON_HELMET, ItemTypes.IRON_CHESTPLATE, ItemTypes.IRON_LEGGINGS, ItemTypes.IRON_BOOTS, ItemTypes.CHAINMAIL_HELMET, ItemTypes.CHAINMAIL_CHESTPLATE, ItemTypes.CHAINMAIL_LEGGINGS, ItemTypes.CHAINMAIL_BOOTS, ItemTypes.LEATHER_HELMET, ItemTypes.LEATHER_CHESTPLATE, ItemTypes.LEATHER_LEGGINGS, ItemTypes.LEATHER_BOOTS, ItemTypes.TURTLE_HELMET);
ItemTags.TRIM_MATERIALS.add(ItemTypes.IRON_INGOT, ItemTypes.COPPER_INGOT, ItemTypes.GOLD_INGOT, ItemTypes.LAPIS_LAZULI, ItemTypes.EMERALD, ItemTypes.DIAMOND, ItemTypes.NETHERITE_INGOT, ItemTypes.REDSTONE, ItemTypes.QUARTZ, ItemTypes.AMETHYST_SHARD);
ItemTags.TRIM_TEMPLATES.add(ItemTypes.WARD_ARMOR_TRIM_SMITHING_TEMPLATE, ItemTypes.SPIRE_ARMOR_TRIM_SMITHING_TEMPLATE, ItemTypes.COAST_ARMOR_TRIM_SMITHING_TEMPLATE, ItemTypes.EYE_ARMOR_TRIM_SMITHING_TEMPLATE, ItemTypes.DUNE_ARMOR_TRIM_SMITHING_TEMPLATE, ItemTypes.WILD_ARMOR_TRIM_SMITHING_TEMPLATE, ItemTypes.RIB_ARMOR_TRIM_SMITHING_TEMPLATE, ItemTypes.TIDE_ARMOR_TRIM_SMITHING_TEMPLATE, ItemTypes.SENTRY_ARMOR_TRIM_SMITHING_TEMPLATE, ItemTypes.VEX_ARMOR_TRIM_SMITHING_TEMPLATE, ItemTypes.SNOUT_ARMOR_TRIM_SMITHING_TEMPLATE, ItemTypes.WAYFINDER_ARMOR_TRIM_SMITHING_TEMPLATE, ItemTypes.SHAPER_ARMOR_TRIM_SMITHING_TEMPLATE, ItemTypes.SILENCE_ARMOR_TRIM_SMITHING_TEMPLATE, ItemTypes.RAISER_ARMOR_TRIM_SMITHING_TEMPLATE, ItemTypes.HOST_ARMOR_TRIM_SMITHING_TEMPLATE);
ItemTags.BOOKSHELF_BOOKS.add(ItemTypes.BOOK, ItemTypes.WRITTEN_BOOK, ItemTypes.ENCHANTED_BOOK, ItemTypes.WRITABLE_BOOK, ItemTypes.KNOWLEDGE_BOOK);
ItemTags.NOTEBLOCK_TOP_INSTRUMENTS.add(ItemTypes.ZOMBIE_HEAD, ItemTypes.SKELETON_SKULL, ItemTypes.CREEPER_HEAD, ItemTypes.DRAGON_HEAD, ItemTypes.WITHER_SKELETON_SKULL, ItemTypes.PIGLIN_HEAD, ItemTypes.PLAYER_HEAD);
ItemTags.SNIFFER_FOOD.add(ItemTypes.TORCHFLOWER_SEEDS);
ItemTags.DECORATED_POT_SHERDS.add(ItemTypes.ANGLER_POTTERY_SHERD, ItemTypes.ARCHER_POTTERY_SHERD, ItemTypes.ARMS_UP_POTTERY_SHERD, ItemTypes.BLADE_POTTERY_SHERD, ItemTypes.BREWER_POTTERY_SHERD, ItemTypes.BURN_POTTERY_SHERD, ItemTypes.DANGER_POTTERY_SHERD, ItemTypes.EXPLORER_POTTERY_SHERD, ItemTypes.FRIEND_POTTERY_SHERD, ItemTypes.HEART_POTTERY_SHERD, ItemTypes.HEARTBREAK_POTTERY_SHERD, ItemTypes.HOWL_POTTERY_SHERD, ItemTypes.MINER_POTTERY_SHERD, ItemTypes.MOURNER_POTTERY_SHERD, ItemTypes.PLENTY_POTTERY_SHERD, ItemTypes.PRIZE_POTTERY_SHERD, ItemTypes.SHEAF_POTTERY_SHERD, ItemTypes.SHELTER_POTTERY_SHERD, ItemTypes.SKULL_POTTERY_SHERD, ItemTypes.SNORT_POTTERY_SHERD);
ItemTags.DECORATED_POT_INGREDIENTS.addTag(ItemTags.DECORATED_POT_SHERDS).add(ItemTypes.BRICK);
ItemTags.SWORDS.add(ItemTypes.DIAMOND_SWORD, ItemTypes.STONE_SWORD, ItemTypes.GOLDEN_SWORD, ItemTypes.NETHERITE_SWORD, ItemTypes.WOODEN_SWORD, ItemTypes.IRON_SWORD);
ItemTags.AXES.add(ItemTypes.DIAMOND_AXE, ItemTypes.STONE_AXE, ItemTypes.GOLDEN_AXE, ItemTypes.NETHERITE_AXE, ItemTypes.WOODEN_AXE, ItemTypes.IRON_AXE);
ItemTags.HOES.add(ItemTypes.DIAMOND_HOE, ItemTypes.STONE_HOE, ItemTypes.GOLDEN_HOE, ItemTypes.NETHERITE_HOE, ItemTypes.WOODEN_HOE, ItemTypes.IRON_HOE);
ItemTags.PICKAXES.add(ItemTypes.DIAMOND_PICKAXE, ItemTypes.STONE_PICKAXE, ItemTypes.GOLDEN_PICKAXE, ItemTypes.NETHERITE_PICKAXE, ItemTypes.WOODEN_PICKAXE, ItemTypes.IRON_PICKAXE);
ItemTags.SHOVELS.add(ItemTypes.DIAMOND_SHOVEL, ItemTypes.STONE_SHOVEL, ItemTypes.GOLDEN_SHOVEL, ItemTypes.NETHERITE_SHOVEL, ItemTypes.WOODEN_SHOVEL, ItemTypes.IRON_SHOVEL);
ItemTags.TOOLS.addTag(ItemTags.SWORDS).addTag(ItemTags.AXES).addTag(ItemTags.PICKAXES).addTag(ItemTags.SHOVELS).addTag(ItemTags.HOES).add(ItemTypes.TRIDENT);
ItemTags.BREAKS_DECORATED_POTS.addTag(ItemTags.TOOLS);
ItemTags.VILLAGER_PLANTABLE_SEEDS.add(ItemTypes.WHEAT_SEEDS, ItemTypes.POTATO, ItemTypes.CARROT, ItemTypes.BEETROOT_SEEDS, ItemTypes.TORCHFLOWER_SEEDS, ItemTypes.PITCHER_POD);
}
@@ -0,0 +1,29 @@
/*
* This file is part of packetevents - https://github.com/retrooper/packetevents
* Copyright (C) 2023 retrooper and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.github.retrooper.packetevents.protocol.world.states.enums;
public enum TrialSpawnerState {
INACTIVE,
WAITING_FOR_PLAYERS,
ACTIVE,
WAITING_FOR_REWARD_EJECTION,
EJECTING_REWARD,
COOLDOWN,
}
@@ -202,7 +202,15 @@ public class StateTypes {
public static StateType CHISELED_SANDSTONE = StateTypes.builder().name("CHISELED_SANDSTONE").blastResistance(0.8f).hardness(0.8f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.STONE).build();
public static StateType CUT_SANDSTONE = StateTypes.builder().name("CUT_SANDSTONE").blastResistance(0.8f).hardness(0.8f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.STONE).build();
public static StateType COBWEB = StateTypes.builder().name("COBWEB").blastResistance(4.0f).hardness(4.0f).isBlocking(false).requiresCorrectTool(true).isSolid(false).setMaterial(MaterialType.WEB).build();
public static StateType GRASS = StateTypes.builder().name("GRASS").blastResistance(0.0f).hardness(0.0f).isBlocking(false).requiresCorrectTool(false).isSolid(false).setMaterial(MaterialType.REPLACEABLE_PLANT).build();
public static StateType SHORT_GRASS = StateTypes.builder().name("SHORT_GRASS").blastResistance(0.0f).hardness(0.0f).isBlocking(false).requiresCorrectTool(false).isSolid(false).setMaterial(MaterialType.REPLACEABLE_PLANT).build();
/**
* This is short grass.
* @deprecated Please use SHORT_GRASS instead of GRASS, this is now deprecated.
* */
@Deprecated
public static StateType GRASS = SHORT_GRASS;
public static StateType FERN = StateTypes.builder().name("FERN").blastResistance(0.0f).hardness(0.0f).isBlocking(false).requiresCorrectTool(false).isSolid(false).setMaterial(MaterialType.REPLACEABLE_PLANT).build();
public static StateType AZALEA = StateTypes.builder().name("AZALEA").blastResistance(0.0f).hardness(0.0f).isBlocking(false).requiresCorrectTool(false).isSolid(true).setMaterial(MaterialType.PLANT).build();
public static StateType FLOWERING_AZALEA = StateTypes.builder().name("FLOWERING_AZALEA").blastResistance(0.0f).hardness(0.0f).isBlocking(false).requiresCorrectTool(false).isSolid(true).setMaterial(MaterialType.PLANT).build();
@@ -1043,6 +1051,63 @@ public class StateTypes {
.blastResistance(1.5f).hardness(1.5f).isBlocking(true).requiresCorrectTool(false)
.isSolid(true).setMaterial(MaterialType.SCULK).build();
//1.20.3 added types
public static StateType TUFF_SLAB = StateTypes.builder().name("TUFF_SLAB").blastResistance(6.0f).hardness(1.5f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.STONE).build();
public static StateType TUFF_STAIRS = StateTypes.builder().name("TUFF_STAIRS").blastResistance(6.0f).hardness(1.5f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.STONE).build();
public static StateType TUFF_WALL = StateTypes.builder().name("TUFF_WALL").blastResistance(6.0f).hardness(1.5f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.STONE).build();
public static StateType POLISHED_TUFF = StateTypes.builder().name("POLISHED_TUFF").blastResistance(6.0f).hardness(1.5f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.STONE).build();
public static StateType POLISHED_TUFF_SLAB = StateTypes.builder().name("POLISHED_TUFF_SLAB").blastResistance(6.0f).hardness(1.5f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.STONE).build();
public static StateType POLISHED_TUFF_STAIRS = StateTypes.builder().name("POLISHED_TUFF_STAIRS").blastResistance(6.0f).hardness(1.5f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.STONE).build();
public static StateType POLISHED_TUFF_WALL = StateTypes.builder().name("POLISHED_TUFF_WALL").blastResistance(6.0f).hardness(1.5f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.STONE).build();
public static StateType CHISELED_TUFF = StateTypes.builder().name("CHISELED_TUFF").blastResistance(6.0f).hardness(1.5f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.STONE).build();
public static StateType TUFF_BRICKS = StateTypes.builder().name("TUFF_BRICKS").blastResistance(6.0f).hardness(1.5f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.STONE).build();
public static StateType TUFF_BRICK_SLAB = StateTypes.builder().name("TUFF_BRICK_SLAB").blastResistance(6.0f).hardness(1.5f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.STONE).build();
public static StateType TUFF_BRICK_STAIRS = StateTypes.builder().name("TUFF_BRICK_STAIRS").blastResistance(6.0f).hardness(1.5f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.STONE).build();
public static StateType TUFF_BRICK_WALL = StateTypes.builder().name("TUFF_BRICK_WALL").blastResistance(6.0f).hardness(1.5f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.STONE).build();
public static StateType CHISELED_TUFF_BRICKS = StateTypes.builder().name("CHISELED_TUFF_BRICKS").blastResistance(6.0f).hardness(1.5f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.STONE).build();
public static StateType OXIDIZED_CHISELED_COPPER = StateTypes.builder().name("OXIDIZED_CHISELED_COPPER").blastResistance(6.0f).hardness(3.0f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.METAL).build();
public static StateType WEATHERED_CHISELED_COPPER = StateTypes.builder().name("WEATHERED_CHISELED_COPPER").blastResistance(6.0f).hardness(3.0f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.METAL).build();
public static StateType EXPOSED_CHISELED_COPPER = StateTypes.builder().name("EXPOSED_CHISELED_COPPER").blastResistance(6.0f).hardness(3.0f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.METAL).build();
public static StateType CHISELED_COPPER = StateTypes.builder().name("CHISELED_COPPER").blastResistance(6.0f).hardness(3.0f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.METAL).build();
public static StateType WAXED_OXIDIZED_CHISELED_COPPER = StateTypes.builder().name("WAXED_OXIDIZED_CHISELED_COPPER").blastResistance(6.0f).hardness(3.0f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.METAL).build();
public static StateType WAXED_WEATHERED_CHISELED_COPPER = StateTypes.builder().name("WAXED_WEATHERED_CHISELED_COPPER").blastResistance(6.0f).hardness(3.0f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.METAL).build();
public static StateType WAXED_EXPOSED_CHISELED_COPPER = StateTypes.builder().name("WAXED_EXPOSED_CHISELED_COPPER").blastResistance(6.0f).hardness(3.0f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.METAL).build();
public static StateType WAXED_CHISELED_COPPER = StateTypes.builder().name("WAXED_CHISELED_COPPER").blastResistance(6.0f).hardness(3.0f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.METAL).build();
public static StateType COPPER_DOOR = StateTypes.builder().name("COPPER_DOOR").blastResistance(3.0f).hardness(3.0f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.METAL).build();
public static StateType EXPOSED_COPPER_DOOR = StateTypes.builder().name("EXPOSED_COPPER_DOOR").blastResistance(3.0f).hardness(3.0f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.METAL).build();
public static StateType OXIDIZED_COPPER_DOOR = StateTypes.builder().name("OXIDIZED_COPPER_DOOR").blastResistance(3.0f).hardness(3.0f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.METAL).build();
public static StateType WEATHERED_COPPER_DOOR = StateTypes.builder().name("WEATHERED_COPPER_DOOR").blastResistance(3.0f).hardness(3.0f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.METAL).build();
public static StateType WAXED_COPPER_DOOR = StateTypes.builder().name("WAXED_COPPER_DOOR").blastResistance(3.0f).hardness(3.0f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.METAL).build();
public static StateType WAXED_EXPOSED_COPPER_DOOR = StateTypes.builder().name("WAXED_EXPOSED_COPPER_DOOR").blastResistance(3.0f).hardness(3.0f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.METAL).build();
public static StateType WAXED_OXIDIZED_COPPER_DOOR = StateTypes.builder().name("WAXED_OXIDIZED_COPPER_DOOR").blastResistance(3.0f).hardness(3.0f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.METAL).build();
public static StateType WAXED_WEATHERED_COPPER_DOOR = StateTypes.builder().name("WAXED_WEATHERED_COPPER_DOOR").blastResistance(3.0f).hardness(3.0f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.METAL).build();
public static StateType COPPER_TRAPDOOR = StateTypes.builder().name("COPPER_TRAPDOOR").blastResistance(3.0f).hardness(3.0f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.METAL).build();
public static StateType EXPOSED_COPPER_TRAPDOOR = StateTypes.builder().name("EXPOSED_COPPER_TRAPDOOR").blastResistance(3.0f).hardness(3.0f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.METAL).build();
public static StateType OXIDIZED_COPPER_TRAPDOOR = StateTypes.builder().name("OXIDIZED_COPPER_TRAPDOOR").blastResistance(3.0f).hardness(3.0f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.METAL).build();
public static StateType WEATHERED_COPPER_TRAPDOOR = StateTypes.builder().name("WEATHERED_COPPER_TRAPDOOR").blastResistance(3.0f).hardness(3.0f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.METAL).build();
public static StateType WAXED_COPPER_TRAPDOOR = StateTypes.builder().name("WAXED_COPPER_TRAPDOOR").blastResistance(3.0f).hardness(3.0f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.METAL).build();
public static StateType WAXED_EXPOSED_COPPER_TRAPDOOR = StateTypes.builder().name("WAXED_EXPOSED_COPPER_TRAPDOOR").blastResistance(3.0f).hardness(3.0f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.METAL).build();
public static StateType WAXED_OXIDIZED_COPPER_TRAPDOOR = StateTypes.builder().name("WAXED_OXIDIZED_COPPER_TRAPDOOR").blastResistance(3.0f).hardness(3.0f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.METAL).build();
public static StateType WAXED_WEATHERED_COPPER_TRAPDOOR = StateTypes.builder().name("WAXED_WEATHERED_COPPER_TRAPDOOR").blastResistance(3.0f).hardness(3.0f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.METAL).build();
public static StateType COPPER_GRATE = StateTypes.builder().name("COPPER_GRATE").blastResistance(6.0f).hardness(3.0f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.METAL).build();
public static StateType EXPOSED_COPPER_GRATE = StateTypes.builder().name("EXPOSED_COPPER_GRATE").blastResistance(6.0f).hardness(3.0f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.METAL).build();
public static StateType WEATHERED_COPPER_GRATE = StateTypes.builder().name("WEATHERED_COPPER_GRATE").blastResistance(6.0f).hardness(3.0f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.METAL).build();
public static StateType OXIDIZED_COPPER_GRATE = StateTypes.builder().name("OXIDIZED_COPPER_GRATE").blastResistance(6.0f).hardness(3.0f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.METAL).build();
public static StateType WAXED_COPPER_GRATE = StateTypes.builder().name("WAXED_COPPER_GRATE").blastResistance(6.0f).hardness(3.0f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.METAL).build();
public static StateType WAXED_EXPOSED_COPPER_GRATE = StateTypes.builder().name("WAXED_EXPOSED_COPPER_GRATE").blastResistance(6.0f).hardness(3.0f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.METAL).build();
public static StateType WAXED_WEATHERED_COPPER_GRATE = StateTypes.builder().name("WAXED_WEATHERED_COPPER_GRATE").blastResistance(6.0f).hardness(3.0f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.METAL).build();
public static StateType WAXED_OXIDIZED_COPPER_GRATE = StateTypes.builder().name("WAXED_OXIDIZED_COPPER_GRATE").blastResistance(6.0f).hardness(3.0f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.METAL).build();
public static StateType COPPER_BULB = StateTypes.builder().name("COPPER_BULB").blastResistance(6.0f).hardness(3.0f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.METAL).build();
public static StateType EXPOSED_COPPER_BULB = StateTypes.builder().name("EXPOSED_COPPER_BULB").blastResistance(6.0f).hardness(3.0f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.METAL).build();
public static StateType WEATHERED_COPPER_BULB = StateTypes.builder().name("WEATHERED_COPPER_BULB").blastResistance(6.0f).hardness(3.0f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.METAL).build();
public static StateType OXIDIZED_COPPER_BULB = StateTypes.builder().name("OXIDIZED_COPPER_BULB").blastResistance(6.0f).hardness(3.0f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.METAL).build();
public static StateType WAXED_COPPER_BULB = StateTypes.builder().name("WAXED_COPPER_BULB").blastResistance(6.0f).hardness(3.0f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.METAL).build();
public static StateType WAXED_EXPOSED_COPPER_BULB = StateTypes.builder().name("WAXED_EXPOSED_COPPER_BULB").blastResistance(6.0f).hardness(3.0f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.METAL).build();
public static StateType WAXED_WEATHERED_COPPER_BULB = StateTypes.builder().name("WAXED_WEATHERED_COPPER_BULB").blastResistance(6.0f).hardness(3.0f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.METAL).build();
public static StateType WAXED_OXIDIZED_COPPER_BULB = StateTypes.builder().name("WAXED_OXIDIZED_COPPER_BULB").blastResistance(6.0f).hardness(3.0f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.METAL).build();
public static StateType CRAFTER = StateTypes.builder().name("CRAFTER").blastResistance(3.5f).hardness(1.5f).isBlocking(true).requiresCorrectTool(false).isSolid(true).setMaterial(MaterialType.STONE).build();
public static StateType TRIAL_SPAWNER = StateTypes.builder().name("TRIAL_SPAWNER").blastResistance(50.0f).hardness(50.0f).isBlocking(true).requiresCorrectTool(true).isSolid(true).setMaterial(MaterialType.STONE).build();
public static Builder builder() {
return new Builder();
}
@@ -1110,10 +1175,11 @@ public class StateTypes {
this.isShapeExceedsCube = b;
return this;
}
public StateType build() {
StateType type = new StateType(name, blastResistance, hardness, isSolid, isBlocking, isAir, requiresCorrectTool, isShapeExceedsCube, materialType);
BY_NAME.put(name, type);
return type;
}
}
}
}
@@ -105,7 +105,9 @@ public enum StateValue {
VERTICAL_DIRECTION("vertical_direction", VerticalDirection::valueOf),
WATERLOGGED("waterlogged", Boolean::parseBoolean),
WEST("west", West::valueOf),
CRACKED("cracked", Boolean::parseBoolean);
CRACKED("cracked", Boolean::parseBoolean),
CRAFTING("crafting", Boolean::parseBoolean),
TRIAL_SPAWNER_STATE("trial_spawner_state", TrialSpawnerState::valueOf);
private final String name;
private final Function<String, Object> parser;
@@ -27,7 +27,7 @@ import com.github.retrooper.packetevents.protocol.player.User;
public class EventCreationUtil {
public static PacketReceiveEvent createReceiveEvent(Object channel, User user, Object player, Object buffer,
boolean autoProtocolTranslation) throws PacketProcessException {
switch (user.getConnectionState()) {
switch (user.getDecoderState()) {
case HANDSHAKING:
return new PacketHandshakeReceiveEvent(channel, user, player, buffer, autoProtocolTranslation);
case STATUS:
@@ -36,13 +36,15 @@ public class EventCreationUtil {
return new PacketLoginReceiveEvent(channel, user, player, buffer, autoProtocolTranslation);
case PLAY:
return new PacketPlayReceiveEvent(channel, user, player, buffer, autoProtocolTranslation);
case CONFIGURATION:
return new PacketConfigReceiveEvent(channel, user, player, buffer, autoProtocolTranslation);
}
throw new RuntimeException("Unknown connection state " + user.getConnectionState() + "!");
throw new RuntimeException("Unknown connection state " + user.getDecoderState() + "!");
}
public static PacketSendEvent createSendEvent(Object channel, User user, Object player, Object buffer,
boolean autoProtocolTranslation) throws PacketProcessException{
switch (user.getConnectionState()) {
switch (user.getEncoderState()) {
case HANDSHAKING:
return new PacketHandshakeSendEvent(channel, user, player, buffer, autoProtocolTranslation);
case STATUS:
@@ -51,7 +53,9 @@ public class EventCreationUtil {
return new PacketLoginSendEvent(channel, user, player, buffer, autoProtocolTranslation);
case PLAY:
return new PacketPlaySendEvent(channel, user, player, buffer, autoProtocolTranslation);
case CONFIGURATION:
return new PacketConfigSendEvent(channel, user, player, buffer, autoProtocolTranslation);
}
throw new RuntimeException("Unknown connection state " + user.getConnectionState() + "!");
throw new RuntimeException("Unknown connection state " + user.getEncoderState() + "!");
}
}
@@ -56,11 +56,15 @@ public class AdventureSerializer {
}
public static Component fromLegacyFormat(String legacyMessage) {
return getLegacyGsonSerializer().deserialize(legacyMessage);
return getLegacyGsonSerializer().deserializeOrNull(legacyMessage);
}
public static String toLegacyFormat(Component component) {
return getLegacyGsonSerializer().serializeOrNull(component);
}
public static Component parseComponent(String json) {
return getGsonSerializer().deserialize(json);
return getGsonSerializer().deserializeOrNull(json);
}
public static Component parseJsonTree(JsonElement json) {
@@ -68,11 +72,11 @@ public class AdventureSerializer {
}
public static String toJson(Component component) {
return getGsonSerializer().serialize(component);
return getGsonSerializer().serializeOrNull(component);
}
public static JsonElement toJsonTree(Component component) {
return getGsonSerializer().serializeToTree(component);
}
}
}
@@ -32,6 +32,7 @@ import net.kyori.adventure.text.event.HoverEvent;
import net.kyori.adventure.util.Codec;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.Range;
import java.io.IOException;
import java.util.Locale;
@@ -43,8 +44,7 @@ import java.util.regex.Pattern;
public class HoverSerializer {
private static final TagStringIO SNBT_IO = TagStringIO.get();
// Have to change this in upcoming adventure version
private static final Codec<CompoundBinaryTag, String, IOException, IOException> SNBT_CODEC = Codec.of(SNBT_IO::asCompound, SNBT_IO::asString);
private static final Codec<CompoundBinaryTag, String, IOException, IOException> SNBT_CODEC = createCodec(SNBT_IO::asCompound, SNBT_IO::asString);
static final String ITEM_TYPE = "id";
static final String ITEM_COUNT = "Count";
@@ -61,7 +61,7 @@ public class HoverSerializer {
assertTextComponent(component);
final CompoundBinaryTag contents = SNBT_CODEC.decode(((TextComponent) component).content());
final CompoundBinaryTag tag = contents.getCompound(ITEM_TAG);
return HoverEvent.ShowItem.of(
return createShowItem(
Key.key(contents.getString(ITEM_TYPE)),
contents.getByte(ITEM_COUNT, (byte) 1),
tag == CompoundBinaryTag.empty() ? null : BinaryTagHolder.encode(tag, SNBT_CODEC)
@@ -86,7 +86,7 @@ public class HoverSerializer {
}
type = joiner.toString().toLowerCase(Locale.ROOT);
}
return HoverEvent.ShowEntity.of(
return createShowEntity(
Key.key(type),
UUID.fromString(contents.getString(ENTITY_ID)),
componentCodec.decode(contents.getString(ENTITY_NAME))
@@ -145,4 +145,29 @@ public class HoverSerializer {
}
// Backward Compatibility
private static HoverEvent.ShowItem createShowItem(final @NotNull Key item, final @Range(from = 0, to = Integer.MAX_VALUE) int count, final @Nullable BinaryTagHolder nbt) {
try {
return HoverEvent.ShowItem.showItem(item, count, nbt);
} catch (final NoSuchMethodError ignored) {
return HoverEvent.ShowItem.of(item, count, nbt);
}
}
private static HoverEvent.ShowEntity createShowEntity(final @NotNull Key type, final @NotNull UUID id, final @Nullable Component name) {
try {
return HoverEvent.ShowEntity.showEntity(type, id, name);
} catch (final NoSuchMethodError ignored) {
return HoverEvent.ShowEntity.of(type, id, name);
}
}
private static <D, E, DX extends Throwable, EX extends Throwable> @NotNull Codec<D, E, DX, EX> createCodec(final @NotNull Codec.Decoder<D, E, DX> decoder, final @NotNull Codec.Encoder<D, E, EX> encoder) {
try {
return Codec.codec(decoder, encoder);
} catch (final NoSuchMethodError ignored) {
return Codec.of(decoder, encoder);
}
}
}
@@ -69,7 +69,7 @@ public class UpdateChecker {
+ ColorUtil.toString(NamedTextColor.YELLOW) + localVersion
+ ColorUtil.toString(NamedTextColor.WHITE) + ") | Latest released build: ("
+ ColorUtil.toString(NamedTextColor.GREEN) + newVersion
+ ColorUtil.toString(NamedTextColor.RED) + ")");
+ ColorUtil.toString(NamedTextColor.WHITE) + ")");
return UpdateCheckerStatus.OUTDATED;
} else if (newVersion != null && localVersion.isNewerThan(newVersion)) {
PacketEvents.getAPI().getLogManager().info("You are on a dev or pre released build of packetevents. Your build: ("
@@ -0,0 +1,48 @@
/*
* This file is part of packetevents - https://github.com/retrooper/packetevents
* Copyright (C) 2023 retrooper and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.github.retrooper.packetevents.wrapper;
import com.github.retrooper.packetevents.protocol.packettype.PacketTypeCommon;
import org.jetbrains.annotations.Nullable;
public class PacketTypeData {
private @Nullable PacketTypeCommon packetType;
private int nativePacketId;
public PacketTypeData(@Nullable PacketTypeCommon packetType, int nativePacketId) {
this.packetType = packetType;
this.nativePacketId = nativePacketId;
}
public @Nullable PacketTypeCommon getPacketType() {
return packetType;
}
public int getNativePacketId() {
return nativePacketId;
}
public void setPacketType(@Nullable PacketTypeCommon packetType) {
this.packetType = packetType;
}
public void setNativePacketId(int nativePacketId) {
this.nativePacketId = nativePacketId;
}
}
@@ -25,20 +25,32 @@ import com.github.retrooper.packetevents.event.ProtocolPacketEvent;
import com.github.retrooper.packetevents.manager.server.ServerVersion;
import com.github.retrooper.packetevents.manager.server.VersionComparison;
import com.github.retrooper.packetevents.netty.buffer.ByteBufHelper;
import com.github.retrooper.packetevents.netty.buffer.ByteBufOutputStream;
import com.github.retrooper.packetevents.netty.channel.ChannelHelper;
import com.github.retrooper.packetevents.protocol.chat.*;
import com.github.retrooper.packetevents.protocol.PacketSide;
import com.github.retrooper.packetevents.protocol.chat.ChatType;
import com.github.retrooper.packetevents.protocol.chat.ChatTypes;
import com.github.retrooper.packetevents.protocol.chat.LastSeenMessages;
import com.github.retrooper.packetevents.protocol.chat.MessageSignature;
import com.github.retrooper.packetevents.protocol.chat.Node;
import com.github.retrooper.packetevents.protocol.chat.Parsers;
import com.github.retrooper.packetevents.protocol.chat.RemoteChatSession;
import com.github.retrooper.packetevents.protocol.chat.SignedCommandArgument;
import com.github.retrooper.packetevents.protocol.chat.filter.FilterMask;
import com.github.retrooper.packetevents.protocol.chat.filter.FilterMaskType;
import com.github.retrooper.packetevents.protocol.chat.message.ChatMessage_v1_19_1;
import com.github.retrooper.packetevents.protocol.entity.data.EntityData;
import com.github.retrooper.packetevents.protocol.entity.data.EntityDataType;
import com.github.retrooper.packetevents.protocol.entity.data.EntityDataTypes;
import com.github.retrooper.packetevents.protocol.entity.data.EntityMetadataProvider;
import com.github.retrooper.packetevents.protocol.entity.villager.VillagerData;
import com.github.retrooper.packetevents.protocol.item.ItemStack;
import com.github.retrooper.packetevents.protocol.item.type.ItemType;
import com.github.retrooper.packetevents.protocol.item.type.ItemTypes;
import com.github.retrooper.packetevents.protocol.nbt.NBT;
import com.github.retrooper.packetevents.protocol.nbt.NBTCompound;
import com.github.retrooper.packetevents.protocol.nbt.codec.NBTCodec;
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
import com.github.retrooper.packetevents.protocol.packettype.PacketTypeCommon;
import com.github.retrooper.packetevents.protocol.player.ClientVersion;
import com.github.retrooper.packetevents.protocol.player.GameMode;
@@ -50,19 +62,30 @@ import com.github.retrooper.packetevents.protocol.world.WorldBlockPosition;
import com.github.retrooper.packetevents.resources.ResourceLocation;
import com.github.retrooper.packetevents.util.StringUtil;
import com.github.retrooper.packetevents.util.Vector3i;
import com.github.retrooper.packetevents.util.adventure.AdventureNBTSerialization;
import com.github.retrooper.packetevents.util.adventure.AdventureSerializer;
import com.github.retrooper.packetevents.util.crypto.MinecraftEncryptionUtil;
import com.github.retrooper.packetevents.util.crypto.SaltSignature;
import com.github.retrooper.packetevents.util.crypto.SignatureData;
import net.kyori.adventure.text.Component;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.ApiStatus.Experimental;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.security.PublicKey;
import java.time.Instant;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
import java.util.Collection;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.function.BiConsumer;
import java.util.function.Function;
import java.util.function.IntFunction;
@@ -73,7 +96,7 @@ public class PacketWrapper<T extends PacketWrapper> {
protected ClientVersion clientVersion;
protected ServerVersion serverVersion;
private int packetID;
private PacketTypeData packetTypeData;
// For sending chunk data packets, which need this data
@Nullable
protected User user;
@@ -88,7 +111,7 @@ public class PacketWrapper<T extends PacketWrapper> {
this.clientVersion = clientVersion;
this.serverVersion = serverVersion;
this.buffer = null;
this.packetID = packetID;
this.packetTypeData = new PacketTypeData(null, packetID);
}
public PacketWrapper(PacketReceiveEvent event) {
@@ -100,7 +123,7 @@ public class PacketWrapper<T extends PacketWrapper> {
this.serverVersion = event.getServerVersion();
this.user = event.getUser();
this.buffer = event.getByteBuf();
this.packetID = event.getPacketId();
this.packetTypeData = new PacketTypeData(event.getPacketType(), event.getPacketId());
if (readData) {
readEvent(event);
}
@@ -114,7 +137,7 @@ public class PacketWrapper<T extends PacketWrapper> {
this.clientVersion = event.getUser().getClientVersion();
this.serverVersion = event.getServerVersion();
this.buffer = event.getByteBuf();
this.packetID = event.getPacketId();
this.packetTypeData = new PacketTypeData(event.getPacketType(), event.getPacketId());
this.user = event.getUser();
if (readData) {
readEvent(event);
@@ -126,13 +149,21 @@ public class PacketWrapper<T extends PacketWrapper> {
}
public PacketWrapper(int packetID) {
this(ClientVersion.UNKNOWN,
PacketEvents.getAPI().getServerManager().getVersion(),
packetID);
if (packetID == -1) {
throw new IllegalArgumentException("Packet does not exist on this protocol version!");
}
this.clientVersion = ClientVersion.UNKNOWN;
this.serverVersion = PacketEvents.getAPI().getServerManager().getVersion();
this.buffer = null;
this.packetTypeData = new PacketTypeData(null, packetID);
}
public PacketWrapper(PacketTypeCommon packetType) {
this(packetType.getId(PacketEvents.getAPI().getServerManager().getVersion().toClientVersion()));
this.clientVersion = ClientVersion.UNKNOWN;
this.serverVersion = PacketEvents.getAPI().getServerManager().getVersion();
this.buffer = null;
int id = packetType.getId(PacketEvents.getAPI().getServerManager().getVersion().toClientVersion());
this.packetTypeData = new PacketTypeData(packetType, id);
}
public static PacketWrapper<?> createUniversalPacketWrapper(Object byteBuf) {
@@ -141,14 +172,41 @@ public class PacketWrapper<T extends PacketWrapper> {
return wrapper;
}
public final void prepareForSend(Object channel) {
public static int getChunkX(long chunkKey) {
return (int) (chunkKey & 0xFFFFFFFFL);
}
public static int getChunkZ(long chunkKey) {
return (int) ((chunkKey >>> 32) & 0xFFFFFFFFL);
}
public static long getChunkKey(int chunkX, int chunkZ) {
return (long) chunkX & 0xFFFFFFFFL | ((long) chunkZ & 0xFFFFFFFFL) << 32;
}
@ApiStatus.Internal
public final void prepareForSend(Object channel, boolean outgoing) {
// Null means the packet was manually created and wasn't sent by the server itself
// A reference count of 0 means that the packet was freed (it was already sent)
if (buffer == null || ByteBufHelper.refCnt(buffer) == 0) {
buffer = ChannelHelper.pooledByteBuf(channel);
}
writeVarInt(packetID);
//On proxies, we must rewrite the packet ID in a format compatible for the targeted client version
if (PacketEvents.getAPI().getInjector().isProxy()) {
User user = PacketEvents.getAPI().getProtocolManager().getUser(channel);
if (packetTypeData.getPacketType() == null) {
//Get the packet type with the local version packet type mappings.
packetTypeData.setPacketType(PacketType.getById(outgoing ? PacketSide.SERVER : PacketSide.CLIENT,
user.getConnectionState(), serverVersion.toClientVersion(), packetTypeData.getNativePacketId()));
}
//Change local version to user version so that the packet can be processed correctly.
serverVersion = user.getClientVersion().toServerVersion();
int id = packetTypeData.getPacketType().getId(user.getClientVersion());
writeVarInt(id);
} else {
writeVarInt(packetTypeData.getNativePacketId());
}
write();
}
@@ -197,21 +255,52 @@ public class PacketWrapper<T extends PacketWrapper> {
return buffer;
}
/**
* Gets the Packet ID for the current platform version
*
* @return Packet ID
* @deprecated Use {@link #getNativePacketId()}
*/
@Deprecated
public int getPacketId() {
return packetID;
return getNativePacketId();
}
/**
* Sets the Packet ID for the current platform version
*
* @deprecated Use {@link #setNativePacketId(int)}
*/
@Deprecated
public void setPacketId(int packetID) {
this.packetID = packetID;
setNativePacketId(packetID);
}
public int getNativePacketId() {
return packetTypeData.getNativePacketId();
}
public void setNativePacketId(int nativePacketId) {
this.packetTypeData.setNativePacketId(nativePacketId);
}
@ApiStatus.Internal
public PacketTypeData getPacketTypeData() {
return packetTypeData;
}
public int getMaxMessageLength() {
return serverVersion.isNewerThanOrEquals(ServerVersion.V_1_13) ? MODERN_MESSAGE_LENGTH : LEGACY_MESSAGE_LENGTH;
}
@Deprecated
public void resetByteBuf() {
ByteBufHelper.clear(buffer);
writeVarInt(packetID);
}
public void resetBuffer() {
ByteBufHelper.clear(buffer);
}
public byte readByte() {
@@ -342,14 +431,11 @@ public class PacketWrapper<T extends PacketWrapper> {
writeNBT(itemStack.getNBT());
}
} else {
int typeID;
if (itemStack.isEmpty()) {
typeID = -1;
writeShort(-1);
} else {
typeID = itemStack.getType().getId(serverVersion.toClientVersion());
}
writeShort(typeID);
if (typeID >= 0) {
int typeID = itemStack.getType().getId(serverVersion.toClientVersion());
writeShort(typeID);
writeByte(itemStack.getAmount());
writeShort(itemStack.getLegacyData());
writeNBT(itemStack.getNBT());
@@ -358,10 +444,18 @@ public class PacketWrapper<T extends PacketWrapper> {
}
public NBTCompound readNBT() {
return (NBTCompound) this.readDirectNBT();
}
public NBT readDirectNBT() {
return NBTCodec.readNBTFromBuffer(buffer, serverVersion);
}
public void writeNBT(NBTCompound nbt) {
this.writeDirectNBT((NBT) nbt);
}
public void writeDirectNBT(NBT nbt) {
NBTCodec.writeNBTToBuffer(buffer, serverVersion, nbt);
}
@@ -387,8 +481,10 @@ public class PacketWrapper<T extends PacketWrapper> {
}
}
@Deprecated
public String readComponentJSON() {
return readString(getMaxMessageLength());
// needs to be converted to nbt as of 1.20.3
return AdventureSerializer.asVanilla(this.readComponent());
}
public void writeString(String s) {
@@ -412,16 +508,49 @@ public class PacketWrapper<T extends PacketWrapper> {
}
}
@Deprecated
public void writeComponentJSON(String json) {
writeString(json, getMaxMessageLength());
// needs to be converted to nbt as of 1.20.3
this.writeComponent(AdventureSerializer.parseComponent(json));
}
public Component readComponent() {
return AdventureSerializer.parseComponent(readComponentJSON());
return this.serverVersion.isNewerThanOrEquals(ServerVersion.V_1_20_3)
? this.readComponentAsNBT() : this.readComponentAsJSON();
}
public Component readComponentAsNBT() {
try {
return AdventureNBTSerialization.readComponent(this.buffer);
} catch (IOException exception) {
throw new IllegalStateException(exception);
}
}
public Component readComponentAsJSON() {
String jsonString = this.readString(this.getMaxMessageLength());
return AdventureSerializer.parseComponent(jsonString);
}
public void writeComponent(Component component) {
writeComponentJSON(AdventureSerializer.toJson(component));
if (this.serverVersion.isNewerThanOrEquals(ServerVersion.V_1_20_3)) {
this.writeComponentAsNBT(component);
} else {
this.writeComponentAsJSON(component);
}
}
public void writeComponentAsNBT(Component component) {
try {
AdventureNBTSerialization.writeComponent(new ByteBufOutputStream(this.buffer), component);
} catch (IOException exception) {
throw new IllegalStateException(exception);
}
}
public void writeComponentAsJSON(Component component) {
String jsonString = AdventureSerializer.toJson(component);
this.writeString(jsonString, this.getMaxMessageLength());
}
public ResourceLocation readIdentifier(int maxLen) {
@@ -668,9 +797,9 @@ public class PacketWrapper<T extends PacketWrapper> {
list.add(new EntityData(index, type, value));
}
} else {
for (byte data = readByte(); data != 127; data = readByte()) {
int typeID = (data & 224) >> 5;
int index = data & 31;
for (byte data = readByte(); data != Byte.MAX_VALUE; data = readByte()) {
int typeID = (data & 0xE0) >> 5;
int index = data & 0x1F;
EntityDataType<?> type = EntityDataTypes.getById(serverVersion.toClientVersion(), typeID);
Object value = type.getDataDeserializer().apply(this);
EntityData entityData = new EntityData(index, type, value);
@@ -708,8 +837,12 @@ public class PacketWrapper<T extends PacketWrapper> {
}
}
public void writeEntityMetadata(EntityMetadataProvider metadata) {
writeEntityMetadata(metadata.entityData(serverVersion.toClientVersion()));
}
public Dimension readDimension() {
if (PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_19)) {
if (serverVersion.isNewerThanOrEquals(ServerVersion.V_1_19)) {
Dimension dimension = new Dimension(new NBTCompound());
dimension.setDimensionName(readIdentifier().toString());
return dimension;
@@ -719,8 +852,8 @@ public class PacketWrapper<T extends PacketWrapper> {
}
public void writeDimension(Dimension dimension) {
boolean v1_19 = PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_19);
boolean v1_16_2 = PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_16_2);
boolean v1_19 = serverVersion.isNewerThanOrEquals(ServerVersion.V_1_19);
boolean v1_16_2 = serverVersion.isNewerThanOrEquals(ServerVersion.V_1_16_2);
if (v1_19 || !v1_16_2) {
writeString(dimension.getDimensionName(), 32767);
} else {
@@ -736,12 +869,10 @@ public class PacketWrapper<T extends PacketWrapper> {
//Read optional signature
if (readBoolean()) {
signature = readBytes(256);
}
else {
} else {
signature = new byte[0];
}
}
else {
} else {
signature = readByteArray(256);
}
return new SaltSignature(salt, signature);
@@ -756,8 +887,7 @@ public class PacketWrapper<T extends PacketWrapper> {
writeBytes(signature.getSignature());
}
}
else {
} else {
writeByteArray(signature.getSignature());
}
}
@@ -0,0 +1,34 @@
/*
* This file is part of packetevents - https://github.com/retrooper/packetevents
* Copyright (C) 2022 retrooper and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.github.retrooper.packetevents.wrapper.configuration.client;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
import com.github.retrooper.packetevents.wrapper.PacketWrapper;
public class WrapperConfigClientConfigurationEndAck extends PacketWrapper<WrapperConfigClientConfigurationEndAck> {
public WrapperConfigClientConfigurationEndAck(PacketReceiveEvent event) {
super(event);
}
public WrapperConfigClientConfigurationEndAck() {
super(PacketType.Configuration.Client.CONFIGURATION_END_ACK);
}
}
@@ -0,0 +1,60 @@
/*
* This file is part of packetevents - https://github.com/retrooper/packetevents
* Copyright (C) 2022 retrooper and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.github.retrooper.packetevents.wrapper.configuration.client;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
import com.github.retrooper.packetevents.wrapper.PacketWrapper;
public class WrapperConfigClientKeepAlive extends PacketWrapper<WrapperConfigClientKeepAlive> {
private long id;
public WrapperConfigClientKeepAlive(PacketReceiveEvent event) {
super(event);
}
public WrapperConfigClientKeepAlive(long id) {
super(PacketType.Configuration.Client.KEEP_ALIVE);
this.id = id;
}
@Override
public void read() {
this.id = this.readLong();
}
@Override
public void write() {
this.writeLong(this.id);
}
@Override
public void copy(WrapperConfigClientKeepAlive wrapper) {
this.id = wrapper.id;
}
public long getId() {
return this.id;
}
public void setId(long id) {
this.id = id;
}
}
@@ -0,0 +1,82 @@
/*
* This file is part of packetevents - https://github.com/retrooper/packetevents
* Copyright (C) 2022 retrooper and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.github.retrooper.packetevents.wrapper.configuration.client;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.netty.buffer.ByteBufHelper;
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
import com.github.retrooper.packetevents.resources.ResourceLocation;
import com.github.retrooper.packetevents.wrapper.PacketWrapper;
public class WrapperConfigClientPluginMessage extends PacketWrapper<WrapperConfigClientPluginMessage> {
private String channelName;
private byte[] data;
public WrapperConfigClientPluginMessage(PacketReceiveEvent event) {
super(event);
}
public WrapperConfigClientPluginMessage(ResourceLocation channelName, byte[] data) {
this(channelName.toString(), data);
}
public WrapperConfigClientPluginMessage(String channelName, byte[] data) {
super(PacketType.Configuration.Client.PLUGIN_MESSAGE);
this.channelName = channelName;
this.data = data;
}
@Override
public void read() {
this.channelName = this.readString();
if (ByteBufHelper.readableBytes(this.buffer) > 32767) {
throw new RuntimeException("Payload may not be larger than 32767 bytes");
}
this.data = this.readRemainingBytes();
}
@Override
public void write() {
this.writeString(this.channelName);
this.writeBytes(this.data);
}
@Override
public void copy(WrapperConfigClientPluginMessage wrapper) {
this.channelName = wrapper.channelName;
this.data = wrapper.data;
}
public String getChannelName() {
return this.channelName;
}
public void setChannelName(String channelName) {
this.channelName = channelName;
}
public byte[] getData() {
return this.data;
}
public void setData(byte[] data) {
this.data = data;
}
}
@@ -0,0 +1,60 @@
/*
* This file is part of packetevents - https://github.com/retrooper/packetevents
* Copyright (C) 2022 retrooper and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.github.retrooper.packetevents.wrapper.configuration.client;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
import com.github.retrooper.packetevents.wrapper.PacketWrapper;
public class WrapperConfigClientPong extends PacketWrapper<WrapperConfigClientPong> {
private int id;
public WrapperConfigClientPong(PacketReceiveEvent event) {
super(event);
}
public WrapperConfigClientPong(int id) {
super(PacketType.Configuration.Client.PONG);
this.id = id;
}
@Override
public void read() {
this.id = this.readInt();
}
@Override
public void write() {
this.writeInt(this.id);
}
@Override
public void copy(WrapperConfigClientPong wrapper) {
this.id = wrapper.id;
}
public int getId() {
return this.id;
}
public void setId(int id) {
this.id = id;
}
}
@@ -0,0 +1,99 @@
/*
* This file is part of packetevents - https://github.com/retrooper/packetevents
* Copyright (C) 2022 retrooper and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.github.retrooper.packetevents.wrapper.configuration.client;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.manager.server.ServerVersion;
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
import com.github.retrooper.packetevents.wrapper.PacketWrapper;
import java.security.Provider;
import java.util.UUID;
public class WrapperConfigClientResourcePackStatus extends PacketWrapper<WrapperConfigClientResourcePackStatus> {
private UUID packId;
private Result result;
public WrapperConfigClientResourcePackStatus(PacketReceiveEvent event) {
super(event);
}
public WrapperConfigClientResourcePackStatus(Result result) {
this(UUID.randomUUID(), result);
}
public WrapperConfigClientResourcePackStatus(UUID packId, Result result) {
super(PacketType.Configuration.Client.RESOURCE_PACK_STATUS);
this.packId = packId;
this.result = result;
}
@Override
public void read() {
if (this.serverVersion.isNewerThanOrEquals(ServerVersion.V_1_20_3)) {
this.packId = this.readUUID();
}
this.result = Result.VALUES[this.readVarInt()];
}
@Override
public void write() {
if (this.serverVersion.isNewerThanOrEquals(ServerVersion.V_1_20_3)) {
this.writeUUID(this.packId);
}
this.writeVarInt(this.result.ordinal());
}
@Override
public void copy(WrapperConfigClientResourcePackStatus wrapper) {
this.packId = wrapper.packId;
this.result = wrapper.result;
}
public UUID getPackId() {
return this.packId;
}
public void setPackId(UUID packId) {
this.packId = packId;
}
public Result getResult() {
return this.result;
}
public void setResult(Result result) {
this.result = result;
}
public enum Result {
SUCCESSFULLY_LOADED,
DECLINED,
FAILED_DOWNLOAD,
ACCEPTED,
DOWNLOADED,
INVALID_URL,
FAILED_RELOAD,
DISCARDED;
public static final Result[] VALUES = values();
}
}
@@ -0,0 +1,163 @@
/*
* This file is part of packetevents - https://github.com/retrooper/packetevents
* Copyright (C) 2022 retrooper and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.github.retrooper.packetevents.wrapper.configuration.client;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
import com.github.retrooper.packetevents.protocol.player.HumanoidArm;
import com.github.retrooper.packetevents.wrapper.PacketWrapper;
public class WrapperConfigClientSettings extends PacketWrapper<WrapperConfigClientSettings> {
private String locale;
private int viewDistance;
private ChatVisibility visibility;
private boolean chatColorable;
private byte visibleSkinSectionMask;
private HumanoidArm hand;
private boolean textFilteringEnabled;
private boolean allowServerListings;
public WrapperConfigClientSettings(PacketReceiveEvent event) {
super(event);
}
public WrapperConfigClientSettings(String locale, int viewDistance, ChatVisibility visibility,
boolean chatColorable, byte visibleSkinSectionMask, HumanoidArm hand,
boolean textFilteringEnabled, boolean allowServerListings) {
super(PacketType.Configuration.Client.CLIENT_SETTINGS);
this.locale = locale;
this.viewDistance = viewDistance;
this.visibility = visibility;
this.chatColorable = chatColorable;
this.visibleSkinSectionMask = visibleSkinSectionMask;
this.hand = hand;
this.textFilteringEnabled = textFilteringEnabled;
this.allowServerListings = allowServerListings;
}
@Override
public void read() {
this.locale = this.readString(16);
this.viewDistance = this.readByte();
this.visibility = ChatVisibility.VALUES[this.readVarInt()];
this.chatColorable = this.readBoolean();
this.visibleSkinSectionMask = (byte) this.readUnsignedByte();
this.hand = HumanoidArm.VALUES[this.readVarInt()];
this.textFilteringEnabled = this.readBoolean();
this.allowServerListings = this.readBoolean();
}
@Override
public void write() {
this.writeString(this.locale, 16);
this.writeByte(this.viewDistance);
this.writeVarInt(this.visibility.ordinal());
this.writeBoolean(this.chatColorable);
this.writeByte(this.visibleSkinSectionMask);
this.writeVarInt(this.hand.ordinal());
this.writeBoolean(this.textFilteringEnabled);
this.writeBoolean(this.allowServerListings);
}
@Override
public void copy(WrapperConfigClientSettings wrapper) {
this.locale = wrapper.locale;
this.viewDistance = wrapper.viewDistance;
this.visibility = wrapper.visibility;
this.chatColorable = wrapper.chatColorable;
this.visibleSkinSectionMask = wrapper.visibleSkinSectionMask;
this.hand = wrapper.hand;
this.textFilteringEnabled = wrapper.textFilteringEnabled;
this.allowServerListings = wrapper.allowServerListings;
}
public String getLocale() {
return this.locale;
}
public void setLocale(String locale) {
this.locale = locale;
}
public int getViewDistance() {
return this.viewDistance;
}
public void setViewDistance(int viewDistance) {
this.viewDistance = viewDistance;
}
public ChatVisibility getVisibility() {
return this.visibility;
}
public void setVisibility(ChatVisibility visibility) {
this.visibility = visibility;
}
public boolean isChatColorable() {
return this.chatColorable;
}
public void setChatColorable(boolean chatColorable) {
this.chatColorable = chatColorable;
}
public byte getVisibleSkinSectionMask() {
return this.visibleSkinSectionMask;
}
public void setVisibleSkinSectionMask(byte visibleSkinSectionMask) {
this.visibleSkinSectionMask = visibleSkinSectionMask;
}
public HumanoidArm getHand() {
return this.hand;
}
public void setHand(HumanoidArm hand) {
this.hand = hand;
}
public boolean isTextFilteringEnabled() {
return this.textFilteringEnabled;
}
public void setTextFilteringEnabled(boolean textFilteringEnabled) {
this.textFilteringEnabled = textFilteringEnabled;
}
public boolean isAllowServerListings() {
return this.allowServerListings;
}
public void setAllowServerListings(boolean allowServerListings) {
this.allowServerListings = allowServerListings;
}
public enum ChatVisibility {
FULL,
SYSTEM,
HIDDEN;
public static final ChatVisibility[] VALUES = values();
}
}
@@ -0,0 +1,34 @@
/*
* This file is part of packetevents - https://github.com/retrooper/packetevents
* Copyright (C) 2022 retrooper and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.github.retrooper.packetevents.wrapper.configuration.server;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
import com.github.retrooper.packetevents.wrapper.PacketWrapper;
public class WrapperConfigServerConfigurationEnd extends PacketWrapper<WrapperConfigServerConfigurationEnd> {
public WrapperConfigServerConfigurationEnd(PacketSendEvent event) {
super(event);
}
public WrapperConfigServerConfigurationEnd() {
super(PacketType.Configuration.Server.CONFIGURATION_END);
}
}
@@ -0,0 +1,61 @@
/*
* This file is part of packetevents - https://github.com/retrooper/packetevents
* Copyright (C) 2022 retrooper and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.github.retrooper.packetevents.wrapper.configuration.server;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
import com.github.retrooper.packetevents.wrapper.PacketWrapper;
import net.kyori.adventure.text.Component;
public class WrapperConfigServerDisconnect extends PacketWrapper<WrapperConfigServerDisconnect> {
private Component reason;
public WrapperConfigServerDisconnect(PacketSendEvent event) {
super(event);
}
public WrapperConfigServerDisconnect(Component reason) {
super(PacketType.Configuration.Server.DISCONNECT);
this.reason = reason;
}
@Override
public void read() {
this.reason = this.readComponent();
}
@Override
public void write() {
this.writeComponent(this.reason);
}
@Override
public void copy(WrapperConfigServerDisconnect wrapper) {
this.reason = wrapper.reason;
}
public Component getReason() {
return this.reason;
}
public void setReason(Component reason) {
this.reason = reason;
}
}
@@ -0,0 +1,60 @@
/*
* This file is part of packetevents - https://github.com/retrooper/packetevents
* Copyright (C) 2022 retrooper and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.github.retrooper.packetevents.wrapper.configuration.server;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
import com.github.retrooper.packetevents.wrapper.PacketWrapper;
public class WrapperConfigServerKeepAlive extends PacketWrapper<WrapperConfigServerKeepAlive> {
private long id;
public WrapperConfigServerKeepAlive(PacketSendEvent event) {
super(event);
}
public WrapperConfigServerKeepAlive(long id) {
super(PacketType.Configuration.Server.KEEP_ALIVE);
this.id = id;
}
@Override
public void read() {
this.id = this.readLong();
}
@Override
public void write() {
this.writeLong(this.id);
}
@Override
public void copy(WrapperConfigServerKeepAlive wrapper) {
this.id = wrapper.id;
}
public long getId() {
return this.id;
}
public void setId(long id) {
this.id = id;
}
}
@@ -0,0 +1,82 @@
/*
* This file is part of packetevents - https://github.com/retrooper/packetevents
* Copyright (C) 2022 retrooper and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.github.retrooper.packetevents.wrapper.configuration.server;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import com.github.retrooper.packetevents.netty.buffer.ByteBufHelper;
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
import com.github.retrooper.packetevents.resources.ResourceLocation;
import com.github.retrooper.packetevents.wrapper.PacketWrapper;
public class WrapperConfigServerPluginMessage extends PacketWrapper<WrapperConfigServerPluginMessage> {
private String channelName;
private byte[] data;
public WrapperConfigServerPluginMessage(PacketSendEvent event) {
super(event);
}
public WrapperConfigServerPluginMessage(ResourceLocation channelName, byte[] data) {
this(channelName.toString(), data);
}
public WrapperConfigServerPluginMessage(String channelName, byte[] data) {
super(PacketType.Configuration.Server.PLUGIN_MESSAGE);
this.channelName = channelName;
this.data = data;
}
@Override
public void read() {
this.channelName = this.readString();
if (ByteBufHelper.readableBytes(this.buffer) > 32767) {
throw new RuntimeException("Payload may not be larger than 32767 bytes");
}
this.data = this.readRemainingBytes();
}
@Override
public void write() {
this.writeString(this.channelName);
this.writeBytes(this.data);
}
@Override
public void copy(WrapperConfigServerPluginMessage wrapper) {
this.channelName = wrapper.channelName;
this.data = wrapper.data;
}
public String getChannelName() {
return this.channelName;
}
public void setChannelName(String channelName) {
this.channelName = channelName;
}
public byte[] getData() {
return this.data;
}
public void setData(byte[] data) {
this.data = data;
}
}
@@ -0,0 +1,61 @@
/*
* This file is part of packetevents - https://github.com/retrooper/packetevents
* Copyright (C) 2022 retrooper and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.github.retrooper.packetevents.wrapper.configuration.server;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import com.github.retrooper.packetevents.protocol.nbt.NBTCompound;
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
import com.github.retrooper.packetevents.wrapper.PacketWrapper;
public class WrapperConfigServerRegistryData extends PacketWrapper<WrapperConfigServerRegistryData> {
private NBTCompound registryData;
public WrapperConfigServerRegistryData(PacketSendEvent event) {
super(event);
}
public WrapperConfigServerRegistryData(NBTCompound registryData) {
super(PacketType.Configuration.Server.REGISTRY_DATA);
this.registryData = registryData;
}
@Override
public void read() {
this.registryData = this.readNBT();
}
@Override
public void write() {
this.writeNBT(this.registryData);
}
@Override
public void copy(WrapperConfigServerRegistryData wrapper) {
this.registryData = wrapper.registryData;
}
public NBTCompound getRegistryData() {
return this.registryData;
}
public void setRegistryData(NBTCompound registryData) {
this.registryData = registryData;
}
}
@@ -0,0 +1,63 @@
/*
* This file is part of packetevents - https://github.com/retrooper/packetevents
* Copyright (C) 2023 retrooper and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.github.retrooper.packetevents.wrapper.configuration.server;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
import com.github.retrooper.packetevents.wrapper.PacketWrapper;
import org.jetbrains.annotations.Nullable;
import java.util.UUID;
public class WrapperConfigServerResourcePackRemove extends PacketWrapper<WrapperConfigServerResourcePackRemove> {
private @Nullable UUID packId;
public WrapperConfigServerResourcePackRemove(PacketSendEvent event) {
super(event);
}
public WrapperConfigServerResourcePackRemove(@Nullable UUID packId) {
super(PacketType.Configuration.Server.RESOURCE_PACK_REMOVE);
this.packId = packId;
}
@Override
public void read() {
this.packId = this.readOptional(PacketWrapper::readUUID);
}
@Override
public void write() {
this.writeOptional(this.packId, PacketWrapper::writeUUID);
}
@Override
public void copy(WrapperConfigServerResourcePackRemove wrapper) {
this.packId = wrapper.packId;
}
public @Nullable UUID getPackId() {
return this.packId;
}
public void setPackId(@Nullable UUID packId) {
this.packId = packId;
}
}
@@ -0,0 +1,141 @@
/*
* This file is part of packetevents - https://github.com/retrooper/packetevents
* Copyright (C) 2022 retrooper and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.github.retrooper.packetevents.wrapper.configuration.server;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import com.github.retrooper.packetevents.manager.server.ServerVersion;
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
import com.github.retrooper.packetevents.wrapper.PacketWrapper;
import net.kyori.adventure.text.Component;
import org.jetbrains.annotations.Nullable;
import java.util.UUID;
public class WrapperConfigServerResourcePackSend extends PacketWrapper<WrapperConfigServerResourcePackSend> {
public static final int MAX_HASH_LENGTH = 40;
private UUID packId;
private String url;
private String hash;
private boolean required;
private Component prompt;
public WrapperConfigServerResourcePackSend(PacketSendEvent event) {
super(event);
}
public WrapperConfigServerResourcePackSend(String url, String hash, boolean required, @Nullable Component prompt) {
this(UUID.randomUUID(), url, hash, required, prompt);
}
public WrapperConfigServerResourcePackSend(UUID packId, String url, String hash, boolean required, @Nullable Component prompt) {
super(PacketType.Configuration.Server.RESOURCE_PACK_SEND);
if (hash.length() > MAX_HASH_LENGTH) {
throw new IllegalArgumentException("Hash is too long (max " + MAX_HASH_LENGTH + ", was " + hash.length() + ")");
}
this.packId = packId;
this.url = url;
this.hash = hash;
this.required = required;
this.prompt = prompt;
}
@Override
public void read() {
if (this.serverVersion.isNewerThanOrEquals(ServerVersion.V_1_20_3)) {
this.packId = this.readUUID();
}
this.url = this.readString();
this.hash = this.readString(MAX_HASH_LENGTH);
this.required = this.readBoolean();
if (this.readBoolean()) {
this.prompt = this.readComponent();
}
}
@Override
public void write() {
if (this.serverVersion.isNewerThanOrEquals(ServerVersion.V_1_20_3)) {
this.writeUUID(this.packId);
}
this.writeString(this.url);
this.writeString(this.hash, MAX_HASH_LENGTH);
this.writeBoolean(this.required);
if (this.prompt != null) {
this.writeBoolean(true);
this.writeComponent(this.prompt);
} else {
this.writeBoolean(false);
}
}
@Override
public void copy(WrapperConfigServerResourcePackSend wrapper) {
this.packId = wrapper.packId;
this.url = wrapper.url;
this.hash = wrapper.hash;
this.required = wrapper.required;
this.prompt = wrapper.prompt;
}
public UUID getPackId() {
return this.packId;
}
public void setPackId(UUID packId) {
this.packId = packId;
}
public String getUrl() {
return this.url;
}
public void setUrl(String url) {
this.url = url;
}
public String getHash() {
return this.hash;
}
public void setHash(String hash) {
this.hash = hash;
}
public boolean isRequired() {
return this.required;
}
public void setRequired(boolean required) {
this.required = required;
}
public Component getPrompt() {
return this.prompt;
}
public void setPrompt(Component prompt) {
this.prompt = prompt;
}
}
@@ -0,0 +1,64 @@
/*
* This file is part of packetevents - https://github.com/retrooper/packetevents
* Copyright (C) 2022 retrooper and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.github.retrooper.packetevents.wrapper.configuration.server;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
import com.github.retrooper.packetevents.resources.ResourceLocation;
import com.github.retrooper.packetevents.wrapper.PacketWrapper;
import java.util.HashSet;
import java.util.Set;
public class WrapperConfigServerUpdateEnabledFeatures extends PacketWrapper<WrapperConfigServerUpdateEnabledFeatures> {
private Set<ResourceLocation> features;
public WrapperConfigServerUpdateEnabledFeatures(PacketSendEvent event) {
super(event);
}
public WrapperConfigServerUpdateEnabledFeatures(Set<ResourceLocation> features) {
super(PacketType.Configuration.Server.UPDATE_ENABLED_FEATURES);
this.features = features;
}
@Override
public void read() {
this.features = this.readCollection(HashSet::new, PacketWrapper::readIdentifier);
}
@Override
public void write() {
this.writeCollection(this.features, PacketWrapper::writeIdentifier);
}
@Override
public void copy(WrapperConfigServerUpdateEnabledFeatures wrapper) {
this.features = wrapper.features;
}
public Set<ResourceLocation> getFeatures() {
return this.features;
}
public void setFeatures(Set<ResourceLocation> features) {
this.features = features;
}
}
@@ -57,12 +57,15 @@ public class WrapperLoginClientLoginStart extends PacketWrapper<WrapperLoginClie
@Override
public void read() {
this.username = readString(16);
if (clientVersion.isNewerThanOrEquals(ClientVersion.V_1_19)) {
if (serverVersion.isNewerThanOrEquals(ServerVersion.V_1_19)) {
if (serverVersion.isOlderThanOrEquals(ServerVersion.V_1_19_3)) {
//Removed in 1.19.4
this.signatureData = readOptional(PacketWrapper::readSignatureData);
}
if (clientVersion.isNewerThanOrEquals(ClientVersion.V_1_19_1)) {
if (serverVersion.isNewerThanOrEquals(ServerVersion.V_1_20_2)) {
this.playerUUID = readUUID();
} else if (serverVersion.isNewerThanOrEquals(ServerVersion.V_1_19_1)) {
this.playerUUID = readOptional(PacketWrapper::readUUID);
}
}
@@ -71,12 +74,15 @@ public class WrapperLoginClientLoginStart extends PacketWrapper<WrapperLoginClie
@Override
public void write() {
writeString(username, 16);
if (clientVersion.isNewerThanOrEquals(ClientVersion.V_1_19)) {
if (clientVersion.isOlderThanOrEquals(ClientVersion.V_1_19_3)) {
if (serverVersion.isNewerThanOrEquals(ServerVersion.V_1_19)) {
if (serverVersion.isOlderThanOrEquals(ServerVersion.V_1_19_3)) {
//Removed in 1.19.4
writeOptional(signatureData, PacketWrapper::writeSignatureData);
}
if (clientVersion.isNewerThanOrEquals(ClientVersion.V_1_19_1)) {
if (serverVersion.isNewerThanOrEquals(ServerVersion.V_1_20_2)) {
writeUUID(java.util.Objects.requireNonNull(playerUUID, "playerUUID is required for >= 1.20.2"));
} else if (serverVersion.isNewerThanOrEquals(ServerVersion.V_1_19_1)) {
writeOptional(playerUUID, PacketWrapper::writeUUID);
}
}
@@ -0,0 +1,34 @@
/*
* This file is part of packetevents - https://github.com/retrooper/packetevents
* Copyright (C) 2022 retrooper and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.github.retrooper.packetevents.wrapper.login.client;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
import com.github.retrooper.packetevents.wrapper.PacketWrapper;
public class WrapperLoginClientLoginSuccessAck extends PacketWrapper<WrapperLoginClientLoginSuccessAck> {
public WrapperLoginClientLoginSuccessAck(PacketReceiveEvent event) {
super(event);
}
public WrapperLoginClientLoginSuccessAck() {
super(PacketType.Login.Client.LOGIN_SUCCESS_ACK);
}
}
@@ -41,12 +41,12 @@ public class WrapperLoginServerDisconnect extends PacketWrapper<WrapperLoginServ
@Override
public void read() {
this.reason = readComponent();
this.reason = this.readComponentAsJSON();
}
@Override
public void write() {
writeComponent(reason);
this.writeComponentAsJSON(this.reason);
}
@Override
@@ -0,0 +1,60 @@
/*
* This file is part of packetevents - https://github.com/retrooper/packetevents
* Copyright (C) 2022 retrooper and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.github.retrooper.packetevents.wrapper.play.client;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
import com.github.retrooper.packetevents.wrapper.PacketWrapper;
public class WrapperPlayClientChunkBatchAck extends PacketWrapper<WrapperPlayClientChunkBatchAck> {
private float desiredChunksPerTick;
public WrapperPlayClientChunkBatchAck(PacketReceiveEvent event) {
super(event);
}
public WrapperPlayClientChunkBatchAck(float desiredChunksPerTick) {
super(PacketType.Play.Client.CHUNK_BATCH_ACK);
this.desiredChunksPerTick = desiredChunksPerTick;
}
@Override
public void read() {
this.desiredChunksPerTick = this.readFloat();
}
@Override
public void write() {
this.writeFloat(this.desiredChunksPerTick);
}
@Override
public void copy(WrapperPlayClientChunkBatchAck wrapper) {
this.desiredChunksPerTick = wrapper.desiredChunksPerTick;
}
public float getDesiredChunksPerTick() {
return this.desiredChunksPerTick;
}
public void setDesiredChunksPerTick(float desiredChunksPerTick) {
this.desiredChunksPerTick = desiredChunksPerTick;
}
}
@@ -0,0 +1,34 @@
/*
* This file is part of packetevents - https://github.com/retrooper/packetevents
* Copyright (C) 2022 retrooper and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.github.retrooper.packetevents.wrapper.play.client;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
import com.github.retrooper.packetevents.wrapper.PacketWrapper;
public class WrapperPlayClientConfigurationAck extends PacketWrapper<WrapperPlayClientConfigurationAck> {
public WrapperPlayClientConfigurationAck(PacketReceiveEvent event) {
super(event);
}
public WrapperPlayClientConfigurationAck() {
super(PacketType.Play.Client.CONFIGURATION_ACK);
}
}
@@ -0,0 +1,60 @@
/*
* This file is part of packetevents - https://github.com/retrooper/packetevents
* Copyright (C) 2022 retrooper and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.github.retrooper.packetevents.wrapper.play.client;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
import com.github.retrooper.packetevents.wrapper.PacketWrapper;
public class WrapperPlayClientDebugPing extends PacketWrapper<WrapperPlayClientDebugPing> {
private long timestamp;
public WrapperPlayClientDebugPing(PacketReceiveEvent event) {
super(event);
}
public WrapperPlayClientDebugPing(long timestamp) {
super(PacketType.Play.Client.DEBUG_PING);
this.timestamp = timestamp;
}
@Override
public void read() {
this.timestamp = this.readLong();
}
@Override
public void write() {
this.writeLong(this.timestamp);
}
@Override
public void copy(WrapperPlayClientDebugPing wrapper) {
this.timestamp = wrapper.timestamp;
}
public long getTimestamp() {
return this.timestamp;
}
public void setTimestamp(long timestamp) {
this.timestamp = timestamp;
}
}
@@ -23,7 +23,11 @@ import com.github.retrooper.packetevents.manager.server.ServerVersion;
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
import com.github.retrooper.packetevents.wrapper.PacketWrapper;
import java.util.UUID;
public class WrapperPlayClientResourcePackStatus extends PacketWrapper<WrapperPlayClientResourcePackStatus> {
private UUID packId;
private String hash;
private Result result;
@@ -32,7 +36,12 @@ public class WrapperPlayClientResourcePackStatus extends PacketWrapper<WrapperPl
}
public WrapperPlayClientResourcePackStatus(Result result) {
this(UUID.randomUUID(), result);
}
public WrapperPlayClientResourcePackStatus(UUID packId, Result result) {
super(PacketType.Play.Client.RESOURCE_PACK_STATUS);
this.packId = packId;
this.result = result;
}
@@ -45,6 +54,10 @@ public class WrapperPlayClientResourcePackStatus extends PacketWrapper<WrapperPl
@Override
public void read() {
if (this.serverVersion.isNewerThanOrEquals(ServerVersion.V_1_20_3)) {
this.packId = this.readUUID();
}
if (serverVersion.isOlderThan(ServerVersion.V_1_10)) {
//For now ignore hash, maybe make optional
this.hash = readString(40);
@@ -57,6 +70,10 @@ public class WrapperPlayClientResourcePackStatus extends PacketWrapper<WrapperPl
@Override
public void write() {
if (this.serverVersion.isNewerThanOrEquals(ServerVersion.V_1_20_3)) {
this.writeUUID(this.packId);
}
if (serverVersion.isOlderThan(ServerVersion.V_1_10)) {
writeString(hash, 40);
}
@@ -65,10 +82,19 @@ public class WrapperPlayClientResourcePackStatus extends PacketWrapper<WrapperPl
@Override
public void copy(WrapperPlayClientResourcePackStatus wrapper) {
this.packId = wrapper.packId;
this.hash = wrapper.hash;
this.result = wrapper.result;
}
public UUID getPackId() {
return this.packId;
}
public void setPackId(UUID packId) {
this.packId = packId;
}
public Result getResult() {
return result;
}
@@ -86,10 +112,15 @@ public class WrapperPlayClientResourcePackStatus extends PacketWrapper<WrapperPl
}
public enum Result {
SUCCESSFULLY_LOADED,
DECLINED,
FAILED_DOWNLOAD,
ACCEPTED;
ACCEPTED,
DOWNLOADED,
INVALID_URL,
FAILED_RELOAD,
DISCARDED;
public static final Result[] VALUES = values();
}
@@ -0,0 +1,86 @@
/*
* This file is part of packetevents - https://github.com/retrooper/packetevents
* Copyright (C) 2023 retrooper and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.github.retrooper.packetevents.wrapper.play.client;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
import com.github.retrooper.packetevents.wrapper.PacketWrapper;
public class WrapperPlayClientSlotStateChange extends PacketWrapper<WrapperPlayClientSlotStateChange> {
private int slot;
private int windowId;
private boolean state;
public WrapperPlayClientSlotStateChange(PacketReceiveEvent event) {
super(event);
}
public WrapperPlayClientSlotStateChange(int slot, int windowId, boolean state) {
super(PacketType.Play.Client.SLOT_STATE_CHANGE);
this.slot = slot;
this.windowId = windowId;
this.state = state;
}
@Override
public void read() {
this.slot = this.readVarInt();
this.windowId = this.readVarInt();
this.state = this.readBoolean();
}
@Override
public void write() {
this.writeVarInt(this.slot);
this.writeVarInt(this.windowId);
this.writeBoolean(this.state);
}
@Override
public void copy(WrapperPlayClientSlotStateChange wrapper) {
this.slot = wrapper.slot;
this.windowId = wrapper.windowId;
this.state = wrapper.state;
}
public int getSlot() {
return this.slot;
}
public void setSlot(int slot) {
this.slot = slot;
}
public int getWindowId() {
return this.windowId;
}
public void setWindowId(int windowId) {
this.windowId = windowId;
}
public boolean isState() {
return this.state;
}
public void setState(boolean state) {
this.state = state;
}
}
@@ -37,6 +37,8 @@ public class WrapperPlayClientUpdateJigsawBlock extends PacketWrapper<WrapperPla
private ResourceLocation pool; // target pool
private String finalState; // turns into
private @Nullable JointType jointType;
private int selectionPriority; // Added in 1.20.3
private int placementPriority; // Added in 1.20.3
public WrapperPlayClientUpdateJigsawBlock(PacketReceiveEvent event) {
super(event);
@@ -48,6 +50,11 @@ public class WrapperPlayClientUpdateJigsawBlock extends PacketWrapper<WrapperPla
public WrapperPlayClientUpdateJigsawBlock(Vector3i position, ResourceLocation name, @Nullable ResourceLocation target,
ResourceLocation pool, String finalState, @Nullable JointType jointType) {
this(position,name,target,pool,finalState,jointType,0,0);
}
public WrapperPlayClientUpdateJigsawBlock(Vector3i position, ResourceLocation name, @Nullable ResourceLocation target,
ResourceLocation pool, String finalState, @Nullable JointType jointType,
int selectionPriority, int placementPriority) {
super(PacketType.Play.Client.UPDATE_JIGSAW_BLOCK);
this.position = position;
this.name = name;
@@ -55,6 +62,8 @@ public class WrapperPlayClientUpdateJigsawBlock extends PacketWrapper<WrapperPla
this.pool = pool;
this.finalState = finalState;
this.jointType = jointType;
this.selectionPriority = selectionPriority;
this.placementPriority = placementPriority;
}
@Override
@@ -69,6 +78,10 @@ public class WrapperPlayClientUpdateJigsawBlock extends PacketWrapper<WrapperPla
if (this.v1_16()) {
this.jointType = JointType.byName(readString()).orElse(JointType.ALIGNED);
}
if (this.serverVersion.isNewerThanOrEquals(ServerVersion.V_1_20_3)) {
this.selectionPriority = this.readVarInt();
this.placementPriority = this.readVarInt();
}
}
@Override
@@ -83,6 +96,10 @@ public class WrapperPlayClientUpdateJigsawBlock extends PacketWrapper<WrapperPla
if (this.v1_16()) {
writeString(this.jointType.getSerializedName());
}
if (this.serverVersion.isNewerThanOrEquals(ServerVersion.V_1_20_3)) {
this.writeVarInt(this.selectionPriority);
this.writeVarInt(this.placementPriority);
}
}
@Override
@@ -93,6 +110,8 @@ public class WrapperPlayClientUpdateJigsawBlock extends PacketWrapper<WrapperPla
this.pool = wrapper.pool;
this.finalState = wrapper.finalState;
this.jointType = wrapper.jointType;
this.selectionPriority = wrapper.selectionPriority;
this.placementPriority = wrapper.placementPriority;
}
private boolean v1_16() {
@@ -146,4 +165,20 @@ public class WrapperPlayClientUpdateJigsawBlock extends PacketWrapper<WrapperPla
public void setJointType(@Nullable JointType jointType) {
this.jointType = jointType;
}
public int getSelectionPriority() {
return this.selectionPriority;
}
public void setSelectionPriority(int selectionPriority) {
this.selectionPriority = selectionPriority;
}
public int getPlacementPriority() {
return this.placementPriority;
}
public void setPlacementPriority(int placementPriority) {
this.placementPriority = placementPriority;
}
}
@@ -88,7 +88,9 @@ public class WrapperPlayServerChangeGameState extends PacketWrapper<WrapperPlayS
THUNDER_LEVEL_CHANGE,
PLAY_PUFFER_FISH_STING_SOUND,
PLAY_ELDER_GUARDIAN_MOB_APPEARANCE,
ENABLE_RESPAWN_SCREEN;
ENABLE_RESPAWN_SCREEN,
LIMITED_CRAFTING,
START_LOADING_CHUNKS;
private static final Reason[] VALUES = values();
@@ -0,0 +1,34 @@
/*
* This file is part of packetevents - https://github.com/retrooper/packetevents
* Copyright (C) 2023 retrooper and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.github.retrooper.packetevents.wrapper.play.server;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
import com.github.retrooper.packetevents.wrapper.PacketWrapper;
public class WrapperPlayServerChunkBatchBegin extends PacketWrapper<WrapperPlayServerChunkBatchBegin> {
public WrapperPlayServerChunkBatchBegin(PacketSendEvent event) {
super(event);
}
public WrapperPlayServerChunkBatchBegin() {
super(PacketType.Play.Server.CHUNK_BATCH_BEGIN);
}
}
@@ -0,0 +1,60 @@
/*
* This file is part of packetevents - https://github.com/retrooper/packetevents
* Copyright (C) 2023 retrooper and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.github.retrooper.packetevents.wrapper.play.server;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
import com.github.retrooper.packetevents.wrapper.PacketWrapper;
public class WrapperPlayServerChunkBatchEnd extends PacketWrapper<WrapperPlayServerChunkBatchEnd> {
private int batchSize;
public WrapperPlayServerChunkBatchEnd(PacketSendEvent event) {
super(event);
}
public WrapperPlayServerChunkBatchEnd(int batchSize) {
super(PacketType.Play.Server.CHUNK_BATCH_END);
this.batchSize = batchSize;
}
@Override
public void read() {
this.batchSize = this.readVarInt();
}
@Override
public void write() {
this.writeVarInt(this.batchSize);
}
@Override
public void copy(WrapperPlayServerChunkBatchEnd wrapper) {
this.batchSize = wrapper.batchSize;
}
public int getBatchSize() {
return this.batchSize;
}
public void setBatchSize(int batchSize) {
this.batchSize = batchSize;
}
}
@@ -59,14 +59,14 @@ public class WrapperPlayServerChunkData extends PacketWrapper<WrapperPlayServerC
// 1.18 only (lighting) - for writing data
// TODO: Make accessible?? Include in chunk data?? What do we do with this?
private boolean trustEdges;
private BitSet blockLightMask = new BitSet();
private BitSet skyLightMask = new BitSet();
private BitSet emptyBlockLightMask = new BitSet();
private BitSet emptySkyLightMask = new BitSet();
private BitSet blockLightMask;
private BitSet skyLightMask;
private BitSet emptyBlockLightMask;
private BitSet emptySkyLightMask;
private int skyLightCount;
private int blockLightCount;
private byte[][] skyLightArray = new byte[0][0];
private byte[][] blockLightArray = new byte[0][0];
private byte[][] skyLightArray;
private byte[][] blockLightArray;
public WrapperPlayServerChunkData(PacketSendEvent event) {
super(event);
@@ -0,0 +1,34 @@
/*
* This file is part of packetevents - https://github.com/retrooper/packetevents
* Copyright (C) 2023 retrooper and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.github.retrooper.packetevents.wrapper.play.server;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
import com.github.retrooper.packetevents.wrapper.PacketWrapper;
public class WrapperPlayServerConfigurationStart extends PacketWrapper<WrapperPlayServerConfigurationStart> {
public WrapperPlayServerConfigurationStart(PacketSendEvent event) {
super(event);
}
public WrapperPlayServerConfigurationStart() {
super(PacketType.Play.Server.CONFIGURATION_START);
}
}
@@ -0,0 +1,60 @@
/*
* This file is part of packetevents - https://github.com/retrooper/packetevents
* Copyright (C) 2023 retrooper and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.github.retrooper.packetevents.wrapper.play.server;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
import com.github.retrooper.packetevents.wrapper.PacketWrapper;
public class WrapperPlayServerDebugPong extends PacketWrapper<WrapperPlayServerDebugPong> {
private long timestamp;
public WrapperPlayServerDebugPong(PacketSendEvent event) {
super(event);
}
public WrapperPlayServerDebugPong(long timestamp) {
super(PacketType.Play.Server.DEBUG_PONG);
this.timestamp = timestamp;
}
@Override
public void read() {
this.timestamp = this.readLong();
}
@Override
public void write() {
this.writeLong(this.timestamp);
}
@Override
public void copy(WrapperPlayServerDebugPong wrapper) {
this.timestamp = wrapper.timestamp;
}
public long getTimestamp() {
return this.timestamp;
}
public void setTimestamp(long timestamp) {
this.timestamp = timestamp;
}
}
@@ -19,6 +19,7 @@
package com.github.retrooper.packetevents.wrapper.play.server;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import com.github.retrooper.packetevents.manager.server.ServerVersion;
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
import com.github.retrooper.packetevents.wrapper.PacketWrapper;
@@ -38,13 +39,21 @@ public class WrapperPlayServerDisplayScoreboard extends PacketWrapper<WrapperPla
@Override
public void read() {
position = readByte();
if (serverVersion.isNewerThanOrEquals(ServerVersion.V_1_20_2)) {
position = readVarInt();
} else {
position = readByte();
}
scoreName = readString(16);
}
@Override
public void write() {
writeByte(position);
if (serverVersion.isNewerThanOrEquals(ServerVersion.V_1_20_2)) {
writeVarInt(position);
} else {
writeByte(position);
}
writeString(scoreName, 16);
}
@@ -45,7 +45,7 @@ public class WrapperPlayServerEntityEffect extends PacketWrapper<WrapperPlayServ
} else {
effectId = readByte();
}
this.potionType = PotionTypes.getById(effectId);
this.potionType = PotionTypes.getById(effectId, this.serverVersion);
this.effectAmplifier = readByte();
this.effectDurationTicks = readVarInt();
if (serverVersion.isNewerThan(ServerVersion.V_1_7_10)) {
@@ -60,9 +60,9 @@ public class WrapperPlayServerEntityEffect extends PacketWrapper<WrapperPlayServ
public void write() {
writeVarInt(entityID);
if (serverVersion.isNewerThanOrEquals(ServerVersion.V_1_18_2)) {
writeVarInt(potionType.getId());
writeVarInt(potionType.getId(serverVersion.toClientVersion()));
} else {
writeByte(potionType.getId());
writeByte(potionType.getId(serverVersion.toClientVersion()));
}
writeByte(effectAmplifier);
writeVarInt(effectDurationTicks);
@@ -18,9 +18,11 @@
package com.github.retrooper.packetevents.wrapper.play.server;
import com.github.retrooper.packetevents.PacketEvents;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import com.github.retrooper.packetevents.manager.server.ServerVersion;
import com.github.retrooper.packetevents.protocol.entity.data.EntityData;
import com.github.retrooper.packetevents.protocol.entity.data.EntityMetadataProvider;
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
import com.github.retrooper.packetevents.wrapper.PacketWrapper;
@@ -40,6 +42,10 @@ public class WrapperPlayServerEntityMetadata extends PacketWrapper<WrapperPlaySe
this.entityMetadata = entityMetadata;
}
public WrapperPlayServerEntityMetadata(int entityID, EntityMetadataProvider metadata) {
this(entityID, metadata.entityData(PacketEvents.getAPI().getServerManager().getVersion().toClientVersion()));
}
@Override
public void read() {
entityID = serverVersion.isNewerThanOrEquals(ServerVersion.V_1_8) ? readVarInt() : readInt();
@@ -77,4 +83,8 @@ public class WrapperPlayServerEntityMetadata extends PacketWrapper<WrapperPlaySe
public void setEntityMetadata(List<EntityData> entityMetadata) {
this.entityMetadata = entityMetadata;
}
public void setEntityMetadata(EntityMetadataProvider metadata) {
this.entityMetadata = metadata.entityData(serverVersion.toClientVersion());
}
}
@@ -21,10 +21,16 @@ package com.github.retrooper.packetevents.wrapper.play.server;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import com.github.retrooper.packetevents.manager.server.ServerVersion;
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
import com.github.retrooper.packetevents.protocol.particle.Particle;
import com.github.retrooper.packetevents.protocol.particle.data.ParticleData;
import com.github.retrooper.packetevents.protocol.particle.type.ParticleType;
import com.github.retrooper.packetevents.protocol.particle.type.ParticleTypes;
import com.github.retrooper.packetevents.resources.ResourceLocation;
import com.github.retrooper.packetevents.util.Vector3d;
import com.github.retrooper.packetevents.util.Vector3f;
import com.github.retrooper.packetevents.util.Vector3i;
import com.github.retrooper.packetevents.wrapper.PacketWrapper;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.List;
@@ -36,16 +42,36 @@ public class WrapperPlayServerExplosion extends PacketWrapper<WrapperPlayServerE
private List<Vector3i> records;
private Vector3f playerMotion;
private Particle smallExplosionParticles;
private Particle largeExplosionParticles;
private BlockInteraction blockInteraction;
private ResourceLocation explosionSoundKey;
private @Nullable Float explosionSoundRange;
public WrapperPlayServerExplosion(PacketSendEvent event) {
super(event);
}
public WrapperPlayServerExplosion(Vector3d position, float strength, List<Vector3i> records, Vector3f playerMotion) {
this(position, strength, records, playerMotion, new Particle(ParticleTypes.EXPLOSION),
new Particle(ParticleTypes.EXPLOSION_EMITTER), BlockInteraction.DESTROY_BLOCKS,
new ResourceLocation("minecraft:entity.generic.explode"), null);
}
public WrapperPlayServerExplosion(Vector3d position, float strength, List<Vector3i> records, Vector3f playerMotion,
Particle smallExplosionParticles, Particle largeExplosionParticles,
BlockInteraction blockInteraction, ResourceLocation explosionSoundKey,
@Nullable Float explosionSoundRange) {
super(PacketType.Play.Server.EXPLOSION);
this.position = position;
this.strength = strength;
this.records = records;
this.playerMotion = playerMotion;
this.smallExplosionParticles = smallExplosionParticles;
this.largeExplosionParticles = largeExplosionParticles;
this.blockInteraction = blockInteraction;
this.explosionSoundKey = explosionSoundKey;
this.explosionSoundRange = explosionSoundRange;
}
@Override
@@ -72,6 +98,21 @@ public class WrapperPlayServerExplosion extends PacketWrapper<WrapperPlayServerE
float motY = readFloat();
float motZ = readFloat();
playerMotion = new Vector3f(motX, motY, motZ);
if (this.serverVersion.isNewerThanOrEquals(ServerVersion.V_1_20_3)) {
this.blockInteraction = BlockInteraction.values()[this.readVarInt()];
ParticleType smallPartType = ParticleTypes.getById(this.serverVersion.toClientVersion(), this.readVarInt());
ParticleData smallPartData = smallPartType.readDataFunction().apply(this);
this.smallExplosionParticles = new Particle(smallPartType, smallPartData);
ParticleType largePartType = ParticleTypes.getById(this.serverVersion.toClientVersion(), this.readVarInt());
ParticleData largePartData = largePartType.readDataFunction().apply(this);
this.largeExplosionParticles = new Particle(largePartType, largePartData);
this.explosionSoundKey = this.readIdentifier();
this.explosionSoundRange = this.readOptional(PacketWrapper::readFloat);
}
}
@Override
@@ -104,6 +145,19 @@ public class WrapperPlayServerExplosion extends PacketWrapper<WrapperPlayServerE
writeFloat(playerMotion.x);
writeFloat(playerMotion.y);
writeFloat(playerMotion.z);
if (this.serverVersion.isNewerThanOrEquals(ServerVersion.V_1_20_3)) {
this.writeVarInt(this.blockInteraction.ordinal());
this.writeVarInt(this.smallExplosionParticles.getType().getId(this.serverVersion.toClientVersion()));
this.smallExplosionParticles.getType().writeDataFunction().accept(this, this.smallExplosionParticles.getData());
this.writeVarInt(this.largeExplosionParticles.getType().getId(this.serverVersion.toClientVersion()));
this.largeExplosionParticles.getType().writeDataFunction().accept(this, this.largeExplosionParticles.getData());
this.writeIdentifier(this.explosionSoundKey);
this.writeOptional(this.explosionSoundRange, PacketWrapper::writeFloat);
}
}
@Override
@@ -112,6 +166,11 @@ public class WrapperPlayServerExplosion extends PacketWrapper<WrapperPlayServerE
strength = wrapper.strength;
records = wrapper.records;
playerMotion = wrapper.playerMotion;
smallExplosionParticles = wrapper.smallExplosionParticles;
largeExplosionParticles = wrapper.largeExplosionParticles;
blockInteraction = wrapper.blockInteraction;
explosionSoundKey = wrapper.explosionSoundKey;
explosionSoundRange = wrapper.explosionSoundRange;
}
private Vector3i toFloor(Vector3d position) {
@@ -161,4 +220,51 @@ public class WrapperPlayServerExplosion extends PacketWrapper<WrapperPlayServerE
public void setPlayerMotion(Vector3f playerMotion) {
this.playerMotion = playerMotion;
}
public Particle getSmallExplosionParticles() {
return this.smallExplosionParticles;
}
public void setSmallExplosionParticles(Particle smallExplosionParticles) {
this.smallExplosionParticles = smallExplosionParticles;
}
public Particle getLargeExplosionParticles() {
return this.largeExplosionParticles;
}
public void setLargeExplosionParticles(Particle largeExplosionParticles) {
this.largeExplosionParticles = largeExplosionParticles;
}
public BlockInteraction getBlockInteraction() {
return this.blockInteraction;
}
public void setBlockInteraction(BlockInteraction blockInteraction) {
this.blockInteraction = blockInteraction;
}
public ResourceLocation getExplosionSoundKey() {
return this.explosionSoundKey;
}
public void setExplosionSoundKey(ResourceLocation explosionSoundKey) {
this.explosionSoundKey = explosionSoundKey;
}
public @Nullable Float getExplosionSoundRange() {
return this.explosionSoundRange;
}
public void setExplosionSoundRange(@Nullable Float explosionSoundRange) {
this.explosionSoundRange = explosionSoundRange;
}
public enum BlockInteraction {
KEEP_BLOCKS,
DESTROY_BLOCKS,
DECAY_DESTROYED_BLOCKS,
TRIGGER_BLOCKS,
}
}
@@ -2,30 +2,53 @@ package com.github.retrooper.packetevents.wrapper.play.server;
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
import com.github.retrooper.packetevents.wrapper.PacketWrapper;
import com.github.retrooper.packetevents.event.PacketSendEvent;
public class WrapperPlayServerHurtAnimation extends PacketWrapper<WrapperPlayServerHurtAnimation> {
int entityId;
float hurtDir;
private int entityId;
private float yaw;
public WrapperPlayServerHurtAnimation() {
public WrapperPlayServerHurtAnimation(PacketSendEvent event) {
super(event);
}
public WrapperPlayServerHurtAnimation(int entityId, float yaw) {
super(PacketType.Play.Server.HURT_ANIMATION);
this.entityId = entityId;
this.yaw = yaw;
}
@Override
public void read() {
entityId = readVarInt();
hurtDir = readFloat();
yaw = readFloat();
}
@Override
public void write() {
writeVarInt(entityId);
writeFloat(hurtDir);
writeFloat(yaw);
}
@Override
public void copy(WrapperPlayServerHurtAnimation wrapper) {
this.entityId = wrapper.entityId;
this.hurtDir = wrapper.hurtDir;
this.yaw = wrapper.yaw;
}
public int getEntityId() {
return entityId;
}
public void setEntityId(int entityId) {
this.entityId = entityId;
}
public float getYaw() {
return yaw;
}
public void setYaw(float yaw) {
this.yaw = yaw;
}
}
@@ -50,6 +50,7 @@ public class WrapperPlayServerJoinGame extends PacketWrapper<WrapperPlayServerJo
private int simulationDistance;
private boolean reducedDebugInfo;
private boolean enableRespawnScreen;
private boolean limitedCrafting;
private boolean isDebug;
private boolean isFlat;
private WorldBlockPosition lastDeathPosition;
@@ -66,6 +67,18 @@ public class WrapperPlayServerJoinGame extends PacketWrapper<WrapperPlayServerJo
int maxPlayers, int viewDistance, int simulationDistance,
boolean reducedDebugInfo, boolean enableRespawnScreen,
boolean isDebug, boolean isFlat, WorldBlockPosition lastDeathPosition, @Nullable Integer portalCooldown) {
this(entityID, hardcore, gameMode, previousGameMode, worldNames, dimensionCodec, dimension,
difficulty, worldName, hashedSeed, maxPlayers, viewDistance, simulationDistance, reducedDebugInfo, enableRespawnScreen,
false, isDebug, isFlat, lastDeathPosition, portalCooldown);
}
public WrapperPlayServerJoinGame(int entityID, boolean hardcore, GameMode gameMode,
@Nullable GameMode previousGameMode, List<String> worldNames,
NBTCompound dimensionCodec, Dimension dimension,
Difficulty difficulty, String worldName, long hashedSeed,
int maxPlayers, int viewDistance, int simulationDistance,
boolean reducedDebugInfo, boolean enableRespawnScreen, boolean limitedCrafting,
boolean isDebug, boolean isFlat, WorldBlockPosition lastDeathPosition, @Nullable Integer portalCooldown) {
super(PacketType.Play.Server.JOIN_GAME);
this.entityID = entityID;
this.hardcore = hardcore;
@@ -82,6 +95,7 @@ public class WrapperPlayServerJoinGame extends PacketWrapper<WrapperPlayServerJo
this.simulationDistance = simulationDistance;
this.reducedDebugInfo = reducedDebugInfo;
this.enableRespawnScreen = enableRespawnScreen;
this.limitedCrafting = limitedCrafting;
this.isDebug = isDebug;
this.isFlat = isFlat;
this.lastDeathPosition = lastDeathPosition;
@@ -91,6 +105,7 @@ public class WrapperPlayServerJoinGame extends PacketWrapper<WrapperPlayServerJo
@Override
public void read() {
entityID = readInt();
boolean v1_20_2 = serverVersion.isNewerThanOrEquals(ServerVersion.V_1_20_2);
boolean v1_19 = serverVersion.isNewerThanOrEquals(ServerVersion.V_1_19);
boolean v1_18 = serverVersion.isNewerThanOrEquals(ServerVersion.V_1_18);
boolean v1_16 = serverVersion.isNewerThanOrEquals(ServerVersion.V_1_16);
@@ -98,22 +113,28 @@ public class WrapperPlayServerJoinGame extends PacketWrapper<WrapperPlayServerJo
boolean v1_14 = serverVersion.isNewerThanOrEquals(ServerVersion.V_1_14);
if (v1_16) {
hardcore = readBoolean();
gameMode = readGameMode();
if (!v1_20_2) {
gameMode = readGameMode();
}
} else {
int gameModeId = readUnsignedByte();
hardcore = (gameModeId & 0x8) == 0x8;
gameMode = GameMode.getById(gameModeId & -0x9);
}
if (v1_16) {
previousGameMode = readGameMode();
if (!v1_20_2) {
previousGameMode = readGameMode();
}
int worldCount = readVarInt();
worldNames = new ArrayList<>(worldCount);
for (int i = 0; i < worldCount; i++) {
worldNames.add(readString());
}
dimensionCodec = readNBT();
dimension = readDimension();
worldName = readString();
if (!v1_20_2) {
dimensionCodec = readNBT();
dimension = readDimension();
worldName = readString();
}
} else {
previousGameMode = gameMode;
dimensionCodec = new NBTCompound();
@@ -122,7 +143,7 @@ public class WrapperPlayServerJoinGame extends PacketWrapper<WrapperPlayServerJo
difficulty = Difficulty.getById(readByte());
}
}
if (v1_15) {
if (v1_15 && !v1_20_2) {
hashedSeed = readLong();
}
if (v1_16) {
@@ -131,6 +152,14 @@ public class WrapperPlayServerJoinGame extends PacketWrapper<WrapperPlayServerJo
if (v1_18) simulationDistance = readVarInt();
reducedDebugInfo = readBoolean();
enableRespawnScreen = readBoolean();
if (v1_20_2) {
limitedCrafting = readBoolean();
dimension = readDimension();
worldName = readString();
hashedSeed = readLong();
gameMode = readGameMode();
previousGameMode = readGameMode();
}
isDebug = readBoolean();
isFlat = readBoolean();
} else {
@@ -157,6 +186,7 @@ public class WrapperPlayServerJoinGame extends PacketWrapper<WrapperPlayServerJo
@Override
public void write() {
writeInt(entityID);
boolean v1_20_2 = serverVersion.isNewerThanOrEquals(ServerVersion.V_1_20_2);
boolean v1_19 = serverVersion.isNewerThanOrEquals(ServerVersion.V_1_19);
boolean v1_18 = serverVersion.isNewerThanOrEquals(ServerVersion.V_1_18);
boolean v1_16 = serverVersion.isNewerThanOrEquals(ServerVersion.V_1_16);
@@ -164,7 +194,9 @@ public class WrapperPlayServerJoinGame extends PacketWrapper<WrapperPlayServerJo
boolean v1_15 = serverVersion.isNewerThanOrEquals(ServerVersion.V_1_15);
if (v1_16) {
writeBoolean(hardcore);
writeGameMode(gameMode);
if (!v1_20_2) {
writeGameMode(gameMode);
}
} else {
int gameModeId = gameMode.getId();
if (hardcore) {
@@ -176,14 +208,18 @@ public class WrapperPlayServerJoinGame extends PacketWrapper<WrapperPlayServerJo
if (previousGameMode == null) {
previousGameMode = gameMode;
}
writeGameMode(previousGameMode);
if (!v1_20_2) {
writeGameMode(previousGameMode);
}
writeVarInt(worldNames.size());
for (String name : worldNames) {
writeString(name);
}
writeNBT(dimensionCodec);
writeDimension(dimension);
writeString(worldName);
if (!v1_20_2) {
writeNBT(dimensionCodec);
writeDimension(dimension);
writeString(worldName);
}
} else {
previousGameMode = gameMode;
if (serverVersion.isNewerThanOrEquals(ServerVersion.V_1_9)) {
@@ -195,7 +231,7 @@ public class WrapperPlayServerJoinGame extends PacketWrapper<WrapperPlayServerJo
writeByte(difficulty.getId());
}
}
if (v1_15) {
if (v1_15 && !v1_20_2) {
writeLong(hashedSeed);
}
if (v1_16) {
@@ -204,6 +240,14 @@ public class WrapperPlayServerJoinGame extends PacketWrapper<WrapperPlayServerJo
if (v1_18) writeVarInt(simulationDistance);
writeBoolean(reducedDebugInfo);
writeBoolean(enableRespawnScreen);
if (v1_20_2) {
writeBoolean(limitedCrafting);
writeDimension(dimension);
writeString(worldName);
writeLong(hashedSeed);
writeGameMode(gameMode);
writeGameMode(previousGameMode);
}
writeBoolean(isDebug);
writeBoolean(isFlat);
} else {
@@ -252,6 +296,7 @@ public class WrapperPlayServerJoinGame extends PacketWrapper<WrapperPlayServerJo
simulationDistance = wrapper.simulationDistance;
reducedDebugInfo = wrapper.reducedDebugInfo;
enableRespawnScreen = wrapper.enableRespawnScreen;
limitedCrafting = wrapper.limitedCrafting;
isDebug = wrapper.isDebug;
isFlat = wrapper.isFlat;
lastDeathPosition = wrapper.lastDeathPosition;
@@ -367,7 +412,6 @@ public class WrapperPlayServerJoinGame extends PacketWrapper<WrapperPlayServerJo
return reducedDebugInfo;
}
public void setReducedDebugInfo(boolean reducedDebugInfo) {
this.reducedDebugInfo = reducedDebugInfo;
}
@@ -380,6 +424,14 @@ public class WrapperPlayServerJoinGame extends PacketWrapper<WrapperPlayServerJo
this.enableRespawnScreen = enableRespawnScreen;
}
public boolean isLimitedCrafting() {
return this.limitedCrafting;
}
public void setLimitedCrafting(boolean limitedCrafting) {
this.limitedCrafting = limitedCrafting;
}
public boolean isDebug() {
return isDebug;
}
@@ -29,7 +29,7 @@ import java.util.List;
public class WrapperPlayServerMerchantOffers extends PacketWrapper<WrapperPlayServerMerchantOffers> {
private int containerId;
private List<MerchantOffer> merchantOffers = new ArrayList<>();
private List<MerchantOffer> merchantOffers;
private int villagerLevel;
private int villagerXp;
private boolean showProgress;
@@ -35,8 +35,7 @@ public class WrapperPlayServerOpenWindow extends PacketWrapper<WrapperPlayServer
private int legacySlots; // 1.13-
private int horseId; // 1.13-
private String title;
private Component titleAsComponent = null;
private Component title;
private boolean useProvidedWindowTitle; // 1.7 only
@@ -49,7 +48,7 @@ public class WrapperPlayServerOpenWindow extends PacketWrapper<WrapperPlayServer
super(PacketType.Play.Server.OPEN_WINDOW);
this.containerId = containerId;
this.type = type;
this.title = AdventureSerializer.toJson(title);
this.title = title;
}
// 1.8 through 1.13
@@ -59,7 +58,7 @@ public class WrapperPlayServerOpenWindow extends PacketWrapper<WrapperPlayServer
this.legacyType = legacyType;
this.legacySlots = legacySlots;
this.horseId = horseId;
this.title = AdventureSerializer.toJson(title);
this.title = title;
}
// 1.7
@@ -67,7 +66,7 @@ public class WrapperPlayServerOpenWindow extends PacketWrapper<WrapperPlayServer
super(PacketType.Play.Server.OPEN_WINDOW);
this.containerId = containerId;
this.type = type;
this.title = AdventureSerializer.toJson(title);
this.title = title;
this.legacySlots = legacySlots;
this.useProvidedWindowTitle = useProvidedWindowTitle;
this.horseId = horseId;
@@ -84,7 +83,7 @@ public class WrapperPlayServerOpenWindow extends PacketWrapper<WrapperPlayServer
// 1.7 has a very different packet format
if (serverVersion.isOlderThanOrEquals(ServerVersion.V_1_7_10)) {
this.type = readUnsignedByte();
this.title = readString(32);
this.title = AdventureSerializer.fromLegacyFormat(readString(32));
this.legacySlots = readUnsignedByte();
this.useProvidedWindowTitle = readBoolean();
@@ -97,10 +96,10 @@ public class WrapperPlayServerOpenWindow extends PacketWrapper<WrapperPlayServer
// Known to be 1.8 or above
if (serverVersion.isNewerThanOrEquals(ServerVersion.V_1_14)) {
this.type = readVarInt();
this.title = readComponentJSON();
this.title = readComponent();
} else {
this.legacyType = readString();
this.title = readComponentJSON();
this.title = readComponent();
this.legacySlots = readUnsignedByte();
// This is only sent for horses
if (legacyType.equals("EntityHorse")) {
@@ -120,7 +119,7 @@ public class WrapperPlayServerOpenWindow extends PacketWrapper<WrapperPlayServer
// 1.7 has a very different packet format
if (serverVersion.isOlderThanOrEquals(ServerVersion.V_1_7_10)) {
writeByte(this.type);
writeString(this.title);
writeString(AdventureSerializer.toLegacyFormat(this.title));
writeByte(this.legacySlots);
writeBoolean(this.useProvidedWindowTitle);
@@ -133,18 +132,10 @@ public class WrapperPlayServerOpenWindow extends PacketWrapper<WrapperPlayServer
// Known to be 1.8 or above
if (serverVersion.isNewerThanOrEquals(ServerVersion.V_1_14)) {
writeVarInt(this.type);
if (this.titleAsComponent != null) {
writeComponent(this.titleAsComponent);
} else {
writeString(this.title);
}
writeComponent(this.title);
} else {
writeString(this.legacyType);
if (this.titleAsComponent != null) {
writeComponent(this.titleAsComponent);
} else {
writeString(this.title);
}
writeComponent(this.title);
writeByte(this.legacySlots);
// This is only sent for horses
if (legacyType.equals("EntityHorse")) {
@@ -161,7 +152,6 @@ public class WrapperPlayServerOpenWindow extends PacketWrapper<WrapperPlayServer
this.legacySlots = wrapper.legacySlots;
this.horseId = wrapper.horseId;
this.title = wrapper.title;
this.titleAsComponent = wrapper.titleAsComponent;
this.useProvidedWindowTitle = wrapper.useProvidedWindowTitle;
}
@@ -206,12 +196,11 @@ public class WrapperPlayServerOpenWindow extends PacketWrapper<WrapperPlayServer
}
public Component getTitle() {
if (titleAsComponent != null) return titleAsComponent;
return titleAsComponent = AdventureSerializer.parseComponent(title);
return this.title;
}
public void setTitle(Component title) {
titleAsComponent = title;
this.title = title;
}
public boolean isUseProvidedWindowTitle() {
@@ -25,85 +25,99 @@ import com.github.retrooper.packetevents.wrapper.PacketWrapper;
import net.kyori.adventure.text.Component;
public class WrapperPlayServerPlayerListHeaderAndFooter extends PacketWrapper<WrapperPlayServerPlayerListHeaderAndFooter> {
@Deprecated
public static boolean HANDLE_JSON = true;
private String headerJson;
private String footerJson;
private Component headerComponent;
private Component footerComponent;
private Component header;
private Component footer;
public WrapperPlayServerPlayerListHeaderAndFooter(PacketSendEvent event) {
super(event);
}
public WrapperPlayServerPlayerListHeaderAndFooter(Component headerComponent, Component footerComponent) {
super(PacketType.Play.Server.PLAYER_LIST_HEADER_AND_FOOTER);
this.headerComponent = headerComponent;
this.footerComponent = footerComponent;
@Deprecated
public WrapperPlayServerPlayerListHeaderAndFooter(String headerJson, String footerJson) {
this(AdventureSerializer.parseComponent(headerJson), AdventureSerializer.parseComponent(footerJson));
}
public WrapperPlayServerPlayerListHeaderAndFooter(String headerJson, String footerJson) {
public WrapperPlayServerPlayerListHeaderAndFooter(Component header, Component footer) {
super(PacketType.Play.Server.PLAYER_LIST_HEADER_AND_FOOTER);
this.headerJson = headerJson;
this.footerJson = footerJson;
this.header = header;
this.footer = footer;
}
@Override
public void read() {
headerJson = readComponentJSON();
footerJson = readComponentJSON();
if (HANDLE_JSON) {
headerComponent = AdventureSerializer.parseComponent(headerJson);
footerComponent = AdventureSerializer.parseComponent(footerJson);
}
this.header = this.readComponent();
this.footer = this.readComponent();
}
@Override
public void write() {
if (HANDLE_JSON && headerComponent != null && footerComponent != null) {
headerJson = AdventureSerializer.toJson(headerComponent);
footerJson = AdventureSerializer.toJson(footerComponent);
}
writeComponentJSON(headerJson);
writeComponentJSON(footerJson);
this.writeComponent(this.header);
this.writeComponent(this.footer);
}
@Override
public void copy(WrapperPlayServerPlayerListHeaderAndFooter wrapper) {
headerJson = wrapper.headerJson;
footerJson = wrapper.footerJson;
headerComponent = wrapper.headerComponent;
footerComponent = wrapper.footerComponent;
this.header = wrapper.header;
this.footer = wrapper.footer;
}
public Component getHeader() {
return this.header;
}
public void setHeader(Component header) {
this.header = header;
}
public Component getFooter() {
return this.footer;
}
public void setFooter(Component footer) {
this.footer = footer;
}
@Deprecated
public String getHeaderJson() {
return headerJson;
return AdventureSerializer.toJson(this.getHeader());
}
@Deprecated
public void setHeaderJson(String headerJson) {
this.headerJson = headerJson;
this.setHeader(AdventureSerializer.parseComponent(headerJson));
}
@Deprecated
public String getFooterJson() {
return footerJson;
return AdventureSerializer.toJson(this.getFooter());
}
@Deprecated
public void setFooterJson(String footerJson) {
this.footerJson = footerJson;
this.setFooter(AdventureSerializer.parseComponent(footerJson));
}
@Deprecated
public Component getHeaderComponent() {
return headerComponent;
return this.getHeader();
}
@Deprecated
public void setHeaderComponent(Component headerComponent) {
this.headerComponent = headerComponent;
this.setHeader(headerComponent);
}
@Deprecated
public Component getFooterComponent() {
return footerComponent;
return this.getFooter();
}
@Deprecated
public void setFooterComponent(Component footerComponent) {
this.footerComponent = footerComponent;
this.setFooter(footerComponent);
}
}
@@ -48,16 +48,16 @@ public class WrapperPlayServerRemoveEntityEffect extends PacketWrapper<WrapperPl
} else {
effectId = readByte();
}
this.potionType = PotionTypes.getById(effectId);
this.potionType = PotionTypes.getById(effectId, this.serverVersion);
}
@Override
public void write() {
writeVarInt(entityId);
if (serverVersion.isNewerThanOrEquals(ServerVersion.V_1_18_2)) {
writeVarInt(potionType.getId());
writeVarInt(potionType.getId(serverVersion.toClientVersion()));
} else {
writeByte(potionType.getId());
writeByte(potionType.getId(serverVersion.toClientVersion()));
}
}
@@ -0,0 +1,83 @@
/*
* This file is part of packetevents - https://github.com/retrooper/packetevents
* Copyright (C) 2023 retrooper and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.github.retrooper.packetevents.wrapper.play.server;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import com.github.retrooper.packetevents.manager.server.ServerVersion;
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
import com.github.retrooper.packetevents.wrapper.PacketWrapper;
import org.jetbrains.annotations.Nullable;
public class WrapperPlayServerResetScore extends PacketWrapper<WrapperPlayServerResetScore> {
private String targetName;
private @Nullable String objective;
public WrapperPlayServerResetScore(PacketSendEvent event) {
super(event);
}
public WrapperPlayServerResetScore(String targetName, @Nullable String objective) {
super(PacketType.Play.Server.RESET_SCORE);
this.targetName = targetName;
this.objective = objective;
}
@Override
public void read() {
this.targetName = this.readString();
this.objective = this.readOptional(PacketWrapper::readString);
}
@Override
public void write() {
this.writeString(this.targetName);
this.writeOptional(this.objective, PacketWrapper::writeString);
}
@Override
public void copy(WrapperPlayServerResetScore wrapper) {
this.targetName = wrapper.targetName;
this.objective = wrapper.objective;
}
/**
* Scoreboard name of the target score holder.
* This can be an entity, player, or nothing at all.
*/
public String getTargetName() {
return this.targetName;
}
/**
* Scoreboard name of the target score holder.
* This can be an entity, player, or nothing at all.
*/
public void setTargetName(String targetName) {
this.targetName = targetName;
}
public @Nullable String getObjective() {
return this.objective;
}
public void setObjective(@Nullable String objective) {
this.objective = objective;
}
}
@@ -0,0 +1,63 @@
/*
* This file is part of packetevents - https://github.com/retrooper/packetevents
* Copyright (C) 2023 retrooper and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.github.retrooper.packetevents.wrapper.play.server;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
import com.github.retrooper.packetevents.wrapper.PacketWrapper;
import org.jetbrains.annotations.Nullable;
import java.util.UUID;
public class WrapperPlayServerResourcePackRemove extends PacketWrapper<WrapperPlayServerResourcePackRemove> {
private @Nullable UUID packId;
public WrapperPlayServerResourcePackRemove(PacketSendEvent event) {
super(event);
}
public WrapperPlayServerResourcePackRemove(@Nullable UUID packId) {
super(PacketType.Play.Server.RESOURCE_PACK_REMOVE);
this.packId = packId;
}
@Override
public void read() {
this.packId = this.readOptional(PacketWrapper::readUUID);
}
@Override
public void write() {
this.writeOptional(this.packId, PacketWrapper::writeUUID);
}
@Override
public void copy(WrapperPlayServerResourcePackRemove wrapper) {
this.packId = wrapper.packId;
}
public @Nullable UUID getPackId() {
return this.packId;
}
public void setPackId(@Nullable UUID packId) {
this.packId = packId;
}
}
@@ -25,8 +25,13 @@ import com.github.retrooper.packetevents.wrapper.PacketWrapper;
import net.kyori.adventure.text.Component;
import org.jetbrains.annotations.Nullable;
import java.util.UUID;
public class WrapperPlayServerResourcePackSend extends PacketWrapper<WrapperPlayServerResourcePackSend> {
public static final int MAX_HASH_LENGTH = 40;
private UUID packId;
private String url;
private String hash;
private boolean required;
@@ -37,19 +42,29 @@ public class WrapperPlayServerResourcePackSend extends PacketWrapper<WrapperPlay
}
public WrapperPlayServerResourcePackSend(String url, String hash, boolean required, @Nullable Component prompt) {
this(UUID.randomUUID(), url, hash, required, prompt);
}
public WrapperPlayServerResourcePackSend(UUID packId, String url, String hash, boolean required, @Nullable Component prompt) {
super(PacketType.Play.Server.RESOURCE_PACK_SEND);
if (hash.length() > MAX_HASH_LENGTH) {
throw new IllegalArgumentException("Hash is too long (max 40, was " + hash.length() + ")");
} else {
this.url = url;
this.hash = hash;
this.required = required;
this.prompt = prompt;
throw new IllegalArgumentException("Hash is too long (max " + MAX_HASH_LENGTH + ", was " + hash.length() + ")");
}
this.packId = packId;
this.url = url;
this.hash = hash;
this.required = required;
this.prompt = prompt;
}
@Override
public void read() {
if (this.serverVersion.isNewerThanOrEquals(ServerVersion.V_1_20_3)) {
this.packId = this.readUUID();
}
url = readString();
hash = readString(MAX_HASH_LENGTH);
if (serverVersion.isNewerThanOrEquals(ServerVersion.V_1_16)) {
@@ -63,6 +78,10 @@ public class WrapperPlayServerResourcePackSend extends PacketWrapper<WrapperPlay
@Override
public void write() {
if (this.serverVersion.isNewerThanOrEquals(ServerVersion.V_1_20_3)) {
this.writeUUID(this.packId);
}
writeString(url);
writeString(hash, MAX_HASH_LENGTH);
if (serverVersion.isNewerThanOrEquals(ServerVersion.V_1_16)) {
@@ -76,24 +95,45 @@ public class WrapperPlayServerResourcePackSend extends PacketWrapper<WrapperPlay
@Override
public void copy(WrapperPlayServerResourcePackSend wrapper) {
packId = wrapper.packId;
url = wrapper.url;
hash = wrapper.hash;
required = wrapper.required;
prompt = wrapper.prompt;
}
public UUID getPackId() {
return this.packId;
}
public void setPackId(UUID packId) {
this.packId = packId;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getHash() {
return hash;
}
public void setHash(String hash) {
this.hash = hash;
}
public boolean isRequired() {
return required;
}
public void setRequired(boolean required) {
this.required = required;
}
public Component getPrompt() {
return prompt;
}
@@ -30,6 +30,12 @@ import org.jetbrains.annotations.Nullable;
import java.util.Optional;
public class WrapperPlayServerRespawn extends PacketWrapper<WrapperPlayServerRespawn> {
public static final byte KEEP_NOTHING = 0;
public static final byte KEEP_ATTRIBUTES = 0b01;
public static final byte KEEP_ENTITY_DATA = 0b10;
public static final byte KEEP_ALL_DATA = KEEP_ATTRIBUTES | KEEP_ENTITY_DATA;
private Dimension dimension;
private Optional<String> worldName;
private Difficulty difficulty;
@@ -38,7 +44,7 @@ public class WrapperPlayServerRespawn extends PacketWrapper<WrapperPlayServerRes
private @Nullable GameMode previousGameMode;
private boolean worldDebug;
private boolean worldFlat;
private boolean keepingAllPlayerData;
private byte keptData;
private WorldBlockPosition lastDeathPosition;
private Integer portalCooldown;
@@ -53,6 +59,13 @@ public class WrapperPlayServerRespawn extends PacketWrapper<WrapperPlayServerRes
@Nullable GameMode previousGameMode, boolean worldDebug, boolean worldFlat, boolean keepingAllPlayerData,
@Nullable ResourceLocation deathDimensionName, @Nullable WorldBlockPosition lastDeathPosition,
@Nullable Integer portalCooldown) {
this(dimension, worldName, difficulty, hashedSeed, gameMode, previousGameMode, worldDebug, worldFlat,
keepingAllPlayerData ? KEEP_ALL_DATA : KEEP_NOTHING, lastDeathPosition, portalCooldown);
}
public WrapperPlayServerRespawn(Dimension dimension, @Nullable String worldName, Difficulty difficulty, long hashedSeed, GameMode gameMode,
@Nullable GameMode previousGameMode, boolean worldDebug, boolean worldFlat, byte keptData,
@Nullable WorldBlockPosition lastDeathPosition, @Nullable Integer portalCooldown) {
super(PacketType.Play.Server.RESPAWN);
this.dimension = dimension;
setWorldName(worldName);
@@ -62,7 +75,7 @@ public class WrapperPlayServerRespawn extends PacketWrapper<WrapperPlayServerRes
this.previousGameMode = previousGameMode;
this.worldDebug = worldDebug;
this.worldFlat = worldFlat;
this.keepingAllPlayerData = keepingAllPlayerData;
this.keptData = keptData;
this.lastDeathPosition = lastDeathPosition;
this.portalCooldown = portalCooldown;
}
@@ -73,23 +86,37 @@ public class WrapperPlayServerRespawn extends PacketWrapper<WrapperPlayServerRes
boolean v1_15_0 = serverVersion.isNewerThanOrEquals(ServerVersion.V_1_15);
boolean v1_16_0 = serverVersion.isNewerThanOrEquals(ServerVersion.V_1_16);
boolean v1_19 = serverVersion.isNewerThanOrEquals(ServerVersion.V_1_19);
boolean v1_19_3 = serverVersion.isNewerThanOrEquals(ServerVersion.V_1_19_3);
boolean v1_20_2 = serverVersion.isNewerThanOrEquals(ServerVersion.V_1_20_2);
if (v1_16_0) {
dimension = readDimension();
worldName = Optional.of(readString());
hashedSeed = readLong();
gameMode = GameMode.getById(readUnsignedByte());
int previousMode = readByte();
previousGameMode = previousMode == -1 ? null : GameMode.getById(previousMode);
if (v1_20_2) {
gameMode = readGameMode();
} else {
gameMode = GameMode.getById(readUnsignedByte());
}
previousGameMode = readGameMode();
worldDebug = readBoolean();
worldFlat = readBoolean();
keepingAllPlayerData = readBoolean();
if (v1_19_3) {
if (!v1_20_2) {
keptData = readByte();
}
} else {
keptData = readBoolean() ? KEEP_ALL_DATA : KEEP_ENTITY_DATA;
}
if (v1_19) {
lastDeathPosition = readOptional(PacketWrapper::readWorldBlockPosition);
}
if (serverVersion.isNewerThanOrEquals(ServerVersion.V_1_20)) {
portalCooldown = readVarInt();
}
if (v1_20_2) {
keptData = readByte();
}
} else {
dimension = new Dimension(readInt());
@@ -115,16 +142,24 @@ public class WrapperPlayServerRespawn extends PacketWrapper<WrapperPlayServerRes
boolean v1_15_0 = serverVersion.isNewerThanOrEquals(ServerVersion.V_1_15);
boolean v1_16_0 = serverVersion.isNewerThanOrEquals(ServerVersion.V_1_16);
boolean v1_19 = serverVersion.isNewerThanOrEquals(ServerVersion.V_1_19);
boolean v1_19_3 = serverVersion.isNewerThanOrEquals(ServerVersion.V_1_19_3);
boolean v1_20_2 = serverVersion.isNewerThanOrEquals(ServerVersion.V_1_20_2);
if (v1_16_0) {
writeDimension(dimension);
writeString(worldName.orElse(""));
writeLong(hashedSeed);
writeByte(gameMode.ordinal());
writeByte(previousGameMode == null ? -1 : previousGameMode.ordinal());
writeGameMode(gameMode);
writeGameMode(previousGameMode);
writeBoolean(worldDebug);
writeBoolean(worldFlat);
writeBoolean(keepingAllPlayerData);
if (v1_19_3) {
if (!v1_20_2) {
writeByte(keptData);
}
} else {
writeBoolean((keptData & KEEP_ATTRIBUTES) != 0);
}
if (v1_19) {
writeOptional(lastDeathPosition, PacketWrapper::writeWorldBlockPosition);
}
@@ -132,6 +167,9 @@ public class WrapperPlayServerRespawn extends PacketWrapper<WrapperPlayServerRes
int pCooldown = portalCooldown != null ? portalCooldown : 0;
writeVarInt(pCooldown);
}
if (v1_20_2) {
writeByte(keptData);
}
} else {
writeInt(dimension.getId());
if (v1_15_0) {
@@ -165,7 +203,7 @@ public class WrapperPlayServerRespawn extends PacketWrapper<WrapperPlayServerRes
previousGameMode = wrapper.previousGameMode;
worldDebug = wrapper.worldDebug;
worldFlat = wrapper.worldFlat;
keepingAllPlayerData = wrapper.keepingAllPlayerData;
keptData = wrapper.keptData;
lastDeathPosition = wrapper.lastDeathPosition;
}
@@ -235,11 +273,19 @@ public class WrapperPlayServerRespawn extends PacketWrapper<WrapperPlayServerRes
}
public boolean isKeepingAllPlayerData() {
return keepingAllPlayerData;
return (keptData & KEEP_ATTRIBUTES) != 0;
}
public void setKeepingAllPlayerData(boolean keepAllPlayerData) {
this.keepingAllPlayerData = keepAllPlayerData;
this.keptData = keepAllPlayerData ? KEEP_ALL_DATA : KEEP_ENTITY_DATA;
}
public byte getKeptData() {
return keptData;
}
public void setKeptData(byte keptData) {
this.keptData = keptData;
}
public @Nullable WorldBlockPosition getLastDeathPosition() {
@@ -25,59 +25,55 @@ import com.github.retrooper.packetevents.wrapper.PacketWrapper;
import net.kyori.adventure.text.Component;
public class WrapperPlayServerSetTitleSubtitle extends PacketWrapper<WrapperPlayServerSetTitleSubtitle> {
@Deprecated
public static boolean HANDLE_JSON = true;
private String subtitleJson;
private Component subtitle;
public WrapperPlayServerSetTitleSubtitle(PacketSendEvent event) {
super(event);
}
public WrapperPlayServerSetTitleSubtitle(String subtitleJson) {
this(AdventureSerializer.parseComponent(subtitleJson));
}
public WrapperPlayServerSetTitleSubtitle(Component subtitle) {
super(PacketType.Play.Server.SET_TITLE_SUBTITLE);
this.subtitle = subtitle;
}
public WrapperPlayServerSetTitleSubtitle(String subtitleJson) {
super(PacketType.Play.Server.SET_TITLE_SUBTITLE);
this.subtitleJson = subtitleJson;
}
@Override
public void read() {
subtitleJson = readComponentJSON();
if (HANDLE_JSON) {
subtitle = AdventureSerializer.parseComponent(subtitleJson);
}
this.subtitle = this.readComponent();
}
@Override
public void write() {
if (HANDLE_JSON && subtitle != null) {
subtitleJson = AdventureSerializer.toJson(subtitle);
}
writeComponentJSON(subtitleJson);
this.writeComponent(this.subtitle);
}
@Override
public void copy(WrapperPlayServerSetTitleSubtitle wrapper) {
subtitleJson = wrapper.subtitleJson;
subtitle = wrapper.subtitle;
this.subtitle = wrapper.subtitle;
}
public Component getSubtitle() {
return subtitle;
return this.subtitle;
}
public void setSubtitle(Component subtitle) {
this.subtitle = subtitle;
}
@Deprecated
public String getSubtitleJson() {
return subtitleJson;
return AdventureSerializer.toJson(this.getSubtitle());
}
@Deprecated
public void setSubtitleJson(String subtitleJson) {
this.subtitleJson = subtitleJson;
this.setSubtitle(AdventureSerializer.parseComponent(subtitleJson));
}
}
@@ -25,44 +25,38 @@ import com.github.retrooper.packetevents.wrapper.PacketWrapper;
import net.kyori.adventure.text.Component;
public class WrapperPlayServerSetTitleText extends PacketWrapper<WrapperPlayServerSetTitleText> {
@Deprecated
public static boolean HANDLE_JSON = true;
private String titleJson;
private Component title;
public WrapperPlayServerSetTitleText(PacketSendEvent event) {
super(event);
}
public WrapperPlayServerSetTitleText(String titleJson) {
this(AdventureSerializer.parseComponent(titleJson));
}
public WrapperPlayServerSetTitleText(Component title) {
super(PacketType.Play.Server.SET_TITLE_TEXT);
this.title = title;
}
public WrapperPlayServerSetTitleText(String titleJson) {
super(PacketType.Play.Server.SET_TITLE_TEXT);
this.titleJson = titleJson;
}
@Override
public void read() {
titleJson = readComponentJSON();
if (HANDLE_JSON) {
title = AdventureSerializer.parseComponent(titleJson);
}
this.title = this.readComponent();
}
@Override
public void write() {
if (HANDLE_JSON && title != null) {
titleJson = AdventureSerializer.toJson(title);
}
writeComponentJSON(titleJson);
this.writeComponent(this.title);
}
@Override
public void copy(WrapperPlayServerSetTitleText wrapper) {
titleJson = wrapper.titleJson;
title = wrapper.title;
this.title = wrapper.title;
}
public Component getTitle() {
@@ -73,11 +67,13 @@ public class WrapperPlayServerSetTitleText extends PacketWrapper<WrapperPlayServ
this.title = title;
}
@Deprecated
public String getTitleJson() {
return titleJson;
return AdventureSerializer.toJson(this.getTitle());
}
@Deprecated
public void setTitleJson(String titleJson) {
this.titleJson = titleJson;
this.setTitle(AdventureSerializer.parseComponent(titleJson));
}
}
Loaded 100 of 138 files, more files were not shown because too many files have changed in this diff. Show more