Compare commits

..
Author SHA1 Message Date
retrooper 9b3cf41f35 Working on loading API improvements for Spigot. 2022-12-07 22:20:44 +01:00
259 changed files with 4389 additions and 140669 deletions

No files matched your search

+8 -9
View File
@@ -11,10 +11,9 @@ jobs:
packages: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v2
- name: Set up JDK 8
uses: actions/setup-java@v3
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
@@ -22,34 +21,34 @@ jobs:
settings-path: ${{ github.workspace }} # location for the settings.xml file
- name: Build with Gradle
run: chmod +x gradlew && ./gradlew shadowJar
run: gradle shadowJar
- name: Upload build artifacts api
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v1
with:
name: api-build
path: api/build/libs
- name: Upload build artifacts spigot
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v1
with:
name: spigot-build
path: spigot/build/libs
- name: Upload build artifacts netty-common
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v1
with:
name: netty-common-build
path: netty-common/build/libs
- name: Upload build artifacts bungeecord
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v1
with:
name: bungeecord-build
path: bungeecord/build/libs
- name: Upload build artifacts velocity
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v1
with:
name: velocity-build
path: velocity/build/libs
-5
View File
@@ -102,7 +102,6 @@ $RECYCLE.BIN/
.gradle
build/
bin/
# Ignore Gradle GUI config
gradle-app.setting
@@ -119,7 +118,3 @@ run/
!gradle-wrapper.jar
/src/main/resources/plugin.yml
/.idea/
.vscode/
.project
.settings/
.classpath
+13 -6
View File
@@ -1,17 +1,15 @@
# 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)
[![](https://jitpack.io/v/retrooper/packetevents.svg)](https://jitpack.io/#retrooper/packetevents)
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 \
PacketEvents is a powerful packet library. Our packet wrappers are efficient and easy to use. With our API, you can write code that runs on many platforms including Spigot, BungeeCord, Velocity, and even client-sided Fabric! Switch to PacketEvents today by joining \
our [Discord Server](https://discord.me/packetevents) for help.
### Links
* [Find release builds on Modrinth](https://modrinth.com/plugin/packetevents)
* [Find development builds on Jenkins](https://ci.codemc.io/job/retrooper/job/packetevents)
* [Find release builds on SpigotMC](https://www.spigotmc.org/resources/packetevents-api.80279/)
* [View documentation on our JavaDocs Page](https://packetevents.github.io/javadocs)
### Setup
[How to Setup PacketEvents](https://github.com/retrooper/packetevents/wiki/Depending-on-pre%E2%80%90built-PacketEvents)
[Learn more](https://github.com/retrooper/packetevents/wiki/Setup-2.0)
### Sponsorships
[![](https://www.ej-technologies.com/images/product_banners/jprofiler_small.png)](https://www.ej-technologies.com/products/jprofiler/overview.html)
@@ -20,6 +18,15 @@ 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,15 +18,20 @@
package com.github.retrooper.packetevents;
import org.jetbrains.annotations.ApiStatus;
import com.github.retrooper.packetevents.injector.ChannelInjector;
import com.github.retrooper.packetevents.manager.player.PlayerManager;
import com.github.retrooper.packetevents.manager.protocol.ProtocolManager;
import com.github.retrooper.packetevents.manager.server.ServerManager;
import com.github.retrooper.packetevents.netty.NettyManager;
import com.github.retrooper.packetevents.settings.PacketEventsSettings;
import com.github.retrooper.packetevents.util.LogManager;
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;
TIMEOUT_HANDLER_NAME;
public static PacketEventsAPI<?> getAPI() {
return API;
@@ -35,4 +40,87 @@ public final class PacketEvents {
public static void setAPI(PacketEventsAPI<?> api) {
API = api;
}
public static Builder builder() {
return new Builder();
}
public abstract static class Context<T> {
private final Object pluginInstance;
private final ProtocolManager protocolManager;
private final ServerManager serverManager;
private final PlayerManager playerManager;
private final NettyManager nettyManager;
private final ChannelInjector injector;
private final LogManager logManager;
protected boolean lateBind = false;
public Context(Object pluginInstance, ProtocolManager protocolManager, ServerManager serverManager, PlayerManager playerManager,
NettyManager nettyManager, ChannelInjector injector, LogManager logManager) {
this.pluginInstance = pluginInstance;
this.protocolManager = protocolManager;
this.serverManager = serverManager;
this.playerManager = playerManager;
this.nettyManager = nettyManager;
this.injector = injector;
this.logManager = logManager;
}
protected abstract PacketEventsAPI<T> build();
public Object getPluginInstance() {
return pluginInstance;
}
public ProtocolManager getProtocolManager() {
return protocolManager;
}
public ServerManager getServerManager() {
return serverManager;
}
public PlayerManager getPlayerManager() {
return playerManager;
}
public NettyManager getNettyManager() {
return nettyManager;
}
public ChannelInjector getInjector() {
return injector;
}
public LogManager getLogManager() {
return logManager;
}
}
public static class Builder {
private Context<?> context = null;
private PacketEventsSettings settings = new PacketEventsSettings();
public Builder context(Context<?> context) {
this.context = context;
return this;
}
public Builder settings(PacketEventsSettings settings) {
this.settings = settings;
return this;
}
public PacketEventsAPI<?> build() {
if (context == null) {
throw new IllegalStateException("Failed to build a PacketEvents instance. Please specify a PacketEvents context in the PacketEvents builder to allow PacketEvents to load the correct implementation.");
}
PacketEventsAPI<?> api = context.build();
api.setSettings(settings);
//The implementation may have already set the API.
if (getAPI() == null) {
setAPI(api);
}
return api;
}
}
}
@@ -33,19 +33,23 @@ import java.util.logging.Logger;
public abstract class PacketEventsAPI<T> {
private static final EventManager EVENT_MANAGER = new EventManager();
private static final PacketEventsSettings SETTINGS = new PacketEventsSettings();
private static final UpdateChecker UPDATE_CHECKER = new UpdateChecker();
private final Logger LOGGER = Logger.getLogger(PacketEventsAPI.class.getName());
private static final LogManager LOG_MANAGER = new LogManager();
private final Logger LOGGER = Logger.getLogger(PacketEventsAPI.class.getName());
private PacketEventsSettings settings = new PacketEventsSettings();
//TODO UPDATE
private static final PEVersion VERSION = new PEVersion(2, 2, 0);
private static final PEVersion VERSION = new PEVersion(2, 0, 0);
public EventManager getEventManager() {
return EVENT_MANAGER;
}
public PacketEventsSettings getSettings() {
return SETTINGS;
return settings;
}
public void setSettings(PacketEventsSettings settings) {
this.settings = settings;
}
public UpdateChecker getUpdateChecker() {
@@ -19,16 +19,15 @@
package com.github.retrooper.packetevents.event;
import com.github.retrooper.packetevents.PacketEvents;
import com.github.retrooper.packetevents.exception.InvalidHandshakeException;
import org.jetbrains.annotations.Nullable;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level;
public class EventManager {
private final Map<Byte, Set<PacketListenerCommon>> listenersMap = new ConcurrentHashMap<>();
private final Map<Byte, HashSet<PacketListenerCommon>> listenersMap = new ConcurrentHashMap<>();
/**
* Call the PacketEvent.
@@ -45,16 +44,13 @@ public class EventManager {
public void callEvent(PacketEvent event, @Nullable Runnable postCallListenerAction) {
for (byte priority = PacketListenerPriority.LOWEST.getId(); priority <= PacketListenerPriority.MONITOR.getId(); priority++) {
Set<PacketListenerCommon> listeners = listenersMap.get(priority);
HashSet<PacketListenerCommon> listeners = listenersMap.get(priority);
if (listeners != null) {
for (PacketListenerCommon listener : listeners) {
try {
event.call(listener);
} catch (Exception t) {
// ignore handshake exceptions
if (t.getClass() != InvalidHandshakeException.class) {
PacketEvents.getAPI().getLogger().log(Level.WARNING, "PacketEvents caught an unhandled exception while calling your listener.", t);
}
} catch (Throwable t) {
PacketEvents.getAPI().getLogger().log(Level.WARNING, "PacketEvents caught an unhandled exception while calling your listener.", t);
}
if (postCallListenerAction != null) {
postCallListenerAction.run();
@@ -62,8 +58,7 @@ public class EventManager {
}
}
}
// For performance reasons, we don't want to re-encode the packet if it's not needed.
if (event instanceof ProtocolPacketEvent && !((ProtocolPacketEvent<?>) event).needsReEncode()) {
if (event instanceof ProtocolPacketEvent && PacketEvents.getAPI().getSettings().shouldListenersReadOnly()) {
((ProtocolPacketEvent<?>) event).setLastUsedWrapper(null);
}
@@ -81,9 +76,9 @@ public class EventManager {
*/
public PacketListenerCommon registerListener(PacketListenerCommon listener) {
byte priority = listener.getPriority().getId();
Set<PacketListenerCommon> listenerSet = listenersMap.get(priority);
HashSet<PacketListenerCommon> listenerSet = listenersMap.get(priority);
if (listenerSet == null) {
listenerSet = ConcurrentHashMap.newKeySet();
listenerSet = new HashSet<>();
}
listenerSet.add(listener);
listenersMap.put(priority, listenerSet);
@@ -103,7 +98,7 @@ public class EventManager {
}
public void unregisterListener(PacketListenerCommon listener) {
Set<PacketListenerCommon> listenerSet = listenersMap.get(listener.getPriority().getId());
HashSet<PacketListenerCommon> listenerSet = listenersMap.get(listener.getPriority().getId());
if (listenerSet == null) return;
listenerSet.remove(listener);
}
@@ -47,13 +47,20 @@ public class PacketReceiveEvent extends ProtocolPacketEvent<Object> {
@Override
public PacketReceiveEvent clone() {
try {
Object clonedBuffer = ByteBufHelper.retainedDuplicate(getByteBuf());
return new PacketReceiveEvent(getPacketId(), getPacketType(), getServerVersion(),
getChannel(), getUser(), getPlayer(), clonedBuffer);
} catch (PacketProcessException e) {
e.printStackTrace();
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;
}
return null;
}
}
@@ -18,7 +18,9 @@
package com.github.retrooper.packetevents.event;
import com.github.retrooper.packetevents.event.simple.PacketHandshakeSendEvent;
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.exception.PacketProcessException;
import com.github.retrooper.packetevents.manager.server.ServerVersion;
import com.github.retrooper.packetevents.netty.buffer.ByteBufHelper;
@@ -26,12 +28,7 @@ import com.github.retrooper.packetevents.protocol.PacketSide;
import com.github.retrooper.packetevents.protocol.packettype.PacketTypeCommon;
import com.github.retrooper.packetevents.protocol.player.User;
import java.util.ArrayList;
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);
@@ -51,27 +48,19 @@ public class PacketSendEvent extends ProtocolPacketEvent<Object> {
listener.onPacketSend(this);
}
public List<Runnable> getTasksAfterSend() {
if (tasksAfterSend == null) {
tasksAfterSend = new ArrayList<>();
}
return tasksAfterSend;
}
public boolean hasTasksAfterSend() {
return tasksAfterSend != null && !tasksAfterSend.isEmpty();
}
@Override
public PacketSendEvent clone() {
try {
Object clonedBuffer = ByteBufHelper.retainedDuplicate(getByteBuf());
return new PacketSendEvent(getPacketId(), getPacketType(), getServerVersion(),
getChannel(), getUser(), getPlayer(), clonedBuffer);
} catch (PacketProcessException e) {
e.printStackTrace();
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;
}
return null;
}
}
@@ -19,7 +19,6 @@
package com.github.retrooper.packetevents.event;
import com.github.retrooper.packetevents.PacketEvents;
import com.github.retrooper.packetevents.exception.InvalidDisconnectPacketSend;
import com.github.retrooper.packetevents.exception.PacketProcessException;
import com.github.retrooper.packetevents.manager.server.ServerVersion;
import com.github.retrooper.packetevents.netty.buffer.ByteBufHelper;
@@ -52,7 +51,6 @@ public abstract class ProtocolPacketEvent<T> extends PacketEvent implements Play
private PacketWrapper<?> lastUsedWrapper;
private List<Runnable> postTasks = null;
private boolean cloned;
private boolean needsReEncode = PacketEvents.getAPI().getSettings().reEncodeByDefault();
public ProtocolPacketEvent(PacketSide packetSide, Object channel,
User user, T player, Object byteBuf,
@@ -78,17 +76,12 @@ 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();
ConnectionState state = packetSide == PacketSide.CLIENT ? user.getDecoderState() : user.getEncoderState();
this.packetType = PacketType.getById(packetSide, state,
this.packetType = PacketType.getById(packetSide, user.getConnectionState(),
version, packetID);
if (this.packetType == null) {
// 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.getDecoderState() + ", Server version: " + serverVersion.getReleaseName());
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());
}
this.connectionState = state;
this.connectionState = user.getConnectionState();
}
public ProtocolPacketEvent(int packetID, PacketTypeCommon packetType, ServerVersion serverVersion, Object channel,
@@ -100,21 +93,10 @@ public abstract class ProtocolPacketEvent<T> extends PacketEvent implements Play
this.byteBuf = byteBuf;
this.packetID = packetID;
this.packetType = packetType;
this.connectionState = (packetType != null && packetType.getSide() == PacketSide.SERVER)
? user.getEncoderState() : user.getDecoderState();
this.connectionState = user.getConnectionState();
cloned = true;
}
public void markForReEncode(boolean needsReEncode) {
this.needsReEncode = needsReEncode;
}
public boolean needsReEncode() {
return needsReEncode;
}
public boolean isClone() {
return cloned;
}
@@ -169,6 +151,7 @@ public abstract class ProtocolPacketEvent<T> extends PacketEvent implements Play
this.byteBuf = byteBuf;
}
@Deprecated
public int getPacketId() {
return packetID;
}
@@ -41,11 +41,7 @@ public abstract class SimplePacketListenerAbstract extends PacketListenerCommon
onPacketStatusReceive((PacketStatusReceiveEvent) event);
} else if (event instanceof PacketLoginReceiveEvent) {
onPacketLoginReceive((PacketLoginReceiveEvent) event);
}
else if (event instanceof PacketConfigReceiveEvent) {
onPacketConfigReceive((PacketConfigReceiveEvent) event);
}
else if (event instanceof PacketPlayReceiveEvent) {
} else if (event instanceof PacketPlayReceiveEvent) {
onPacketPlayReceive((PacketPlayReceiveEvent) event);
}
}
@@ -56,11 +52,7 @@ public abstract class SimplePacketListenerAbstract extends PacketListenerCommon
onPacketStatusSend((PacketStatusSendEvent) event);
} else if (event instanceof PacketLoginSendEvent) {
onPacketLoginSend((PacketLoginSendEvent) event);
}
else if (event instanceof PacketConfigSendEvent) {
onPacketConfigSend((PacketConfigSendEvent) event);
}
else if (event instanceof PacketPlaySendEvent) {
} else if (event instanceof PacketPlaySendEvent) {
onPacketPlaySend((PacketPlaySendEvent) event);
}
}
@@ -80,12 +72,6 @@ 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) {
}
@@ -1,59 +0,0 @@
/*
* 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();
}
}
@@ -1,59 +0,0 @@
/*
* 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();
}
}
@@ -1,5 +0,0 @@
package com.github.retrooper.packetevents.exception;
public class CancelPacketException extends RuntimeException {
public static final CancelPacketException INSTANCE = new CancelPacketException();
}
@@ -1,4 +0,0 @@
package com.github.retrooper.packetevents.exception;
public class InvalidDisconnectPacketSend extends RuntimeException {
}
@@ -1,4 +0,0 @@
package com.github.retrooper.packetevents.exception;
public class InvalidHandshakeException extends RuntimeException {
}
@@ -18,7 +18,7 @@
package com.github.retrooper.packetevents.exception;
public class PacketProcessException extends RuntimeException {
public class PacketProcessException extends Exception {
public PacketProcessException(String msg, Throwable cause) {
super(msg, cause);
}
@@ -18,7 +18,9 @@
package com.github.retrooper.packetevents.injector;
import com.github.retrooper.packetevents.protocol.ConnectionState;
import com.github.retrooper.packetevents.protocol.player.User;
import org.jetbrains.annotations.Nullable;
public interface ChannelInjector {
default boolean isServerBound() {
@@ -29,9 +31,13 @@ public interface ChannelInjector {
void uninject();
User getUser(Object channel);
void changeConnectionState(Object channel, @Nullable ConnectionState connectionState);
void updateUser(Object channel, User user);
void setPlayer(Object channel, Object player);
boolean isProxy();
boolean hasPlayer(Object player);
}
@@ -32,7 +32,6 @@ 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;
@@ -72,76 +71,44 @@ public class InternalPacketListener extends PacketListenerAbstract {
PacketEvents.getAPI().getLogManager().debug("Mapped player UUID with their channel.");
// 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);
}
//Update connection state(injectors might do some adjustments when we transition into PLAY state)
//This also updates it for the user instance
event.getPostTasks().add(() -> {
PacketEvents.getAPI().getInjector().changeConnectionState(channel, ConnectionState.PLAY);
PacketEvents.getAPI().getLogManager().debug("Transitioned " + profile.getName() + " into the PLAY state!");
});
}
// 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);
// Join game can be used to update world height, and sets dimension data
// 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());
user.setDimension(joinGame.getDimension());
if (event.getServerVersion().isOlderThanOrEquals(ServerVersion.V_1_16_5)) {
return; // Fixed world height, no tags are sent to the client
}
// Store world data
NBTCompound dimensionCodec = joinGame.getDimensionCodec();
if (dimensionCodec != null) {
NBTList<NBTCompound> list = dimensionCodec
.getCompoundTagOrNull("minecraft:dimension_type")
.getCompoundListTagOrNull("value");
user.setWorldNBT(list);
}
// Store world height
NBTList<NBTCompound> list = joinGame.getDimensionCodec().getCompoundTagOrNull("minecraft:dimension_type").getCompoundListTagOrNull("value");
user.setWorldNBT(list);
// Update world height
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());
}
NBTCompound worldNBT = user.getWorldNBT(joinGame.getDimension().getDimensionName()).getCompoundTagOrNull("element");
user.setMinWorldHeight(worldNBT.getNumberTagOrNull("min_y").getAsInt());
user.setTotalWorldHeight(worldNBT.getNumberTagOrNull("height").getAsInt());
}
// Respawn is used to switch dimensions
else if (event.getPacketType() == PacketType.Play.Server.RESPAWN) {
WrapperPlayServerRespawn respawn = new WrapperPlayServerRespawn(event);
user.setDimension(respawn.getDimension());
if (event.getServerVersion().isOlderThanOrEquals(ServerVersion.V_1_16_5)) {
return; // Fixed world height, no tags are sent to the client
}
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);
WrapperPlayServerRespawn respawn = new WrapperPlayServerRespawn(event);
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());
}
}
@@ -154,17 +121,17 @@ public class InternalPacketListener extends PacketListenerAbstract {
WrapperHandshakingClientHandshake handshake = new WrapperHandshakingClientHandshake(event);
ConnectionState nextState = handshake.getNextConnectionState();
ClientVersion clientVersion = handshake.getClientVersion();
if (clientVersion == ClientVersion.UNKNOWN) {
return;
}
//Update client version for this event call(and user)
user.setClientVersion(clientVersion);
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);
} 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);
event.getPostTasks().add(() -> {
//Transition into the LOGIN OR STATUS connection state
PacketEvents.getAPI().getInjector().changeConnectionState(channel, nextState);
PacketEvents.getAPI().getLogManager().debug("Transitioned " + address.getHostString() + ":" + address.getPort() + " into the " + nextState + " state!");
});
}
}
}
}
@@ -20,12 +20,12 @@ package com.github.retrooper.packetevents.manager.protocol;
import com.github.retrooper.packetevents.PacketEvents;
import com.github.retrooper.packetevents.netty.channel.ChannelHelper;
import com.github.retrooper.packetevents.protocol.ConnectionState;
import com.github.retrooper.packetevents.protocol.ProtocolVersion;
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;
@@ -34,7 +34,6 @@ import java.util.concurrent.ConcurrentHashMap;
public interface ProtocolManager {
Map<UUID, Object> CHANNELS = new ConcurrentHashMap<>();
// Use SocketAddress because ProtocolLib wraps Channels with NettyChannelProxy class
Map<Object, User> USERS = new ConcurrentHashMap<>();
default Collection<User> getUsers() {
@@ -92,70 +91,67 @@ public interface ProtocolManager {
}
}
//TODO Make it clear that this only updates the connection state in our user.
//Sometimes you should use getInjector().changeConnectionState because that can allow the injector to make adjustments.
//This is very important, especially on Spigot.
//As soon as we switch to the play state on spigot, our injector makes some adjustments.
default void changeConnectionState(Object channel, ConnectionState connectionState) {
getUser(channel).setConnectionState(connectionState);
}
default void setClientVersion(Object channel, ClientVersion version) {
getUser(channel).setClientVersion(version);
}
@ApiStatus.Internal
default Object[] transformWrappers(PacketWrapper<?> wrapper, Object channel, boolean outgoing) {
default Object[] transformWrappers(PacketWrapper<?> wrapper) {
//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, outgoing);
wrappers[i].prepareForSend();
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;
}
return buffers;
}
default void sendPacket(Object channel, PacketWrapper<?> wrapper) {
Object[] transformed = transformWrappers(wrapper, channel, true);
Object[] transformed = transformWrappers(wrapper);
sendPackets(channel, transformed);
}
default void sendPacketSilently(Object channel, PacketWrapper<?> wrapper) {
Object[] transformed = transformWrappers(wrapper, channel, true);
Object[] transformed = transformWrappers(wrapper);
sendPacketsSilently(channel, transformed);
}
default void writePacket(Object channel, PacketWrapper<?> wrapper) {
Object[] transformed = transformWrappers(wrapper, channel, true);
Object[] transformed = transformWrappers(wrapper);
writePackets(channel, transformed);
}
default void writePacketSilently(Object channel, PacketWrapper<?> wrapper) {
Object[] transformed = transformWrappers(wrapper, channel, true);
Object[] transformed = transformWrappers(wrapper);
writePacketsSilently(channel, transformed);
}
default void receivePacket(Object channel, PacketWrapper<?> wrapper) {
Object[] transformed = transformWrappers(wrapper, channel, false);
Object[] transformed = transformWrappers(wrapper);
receivePackets(channel, transformed);
}
default void receivePacketSilently(Object channel, PacketWrapper<?> wrapper) {
Object[] transformed = transformWrappers(wrapper, channel, false);
Object[] transformed = transformWrappers(wrapper);
receivePacketsSilently(channel, transformed);
}
default User getUser(Object channel) {
Object pipeline = ChannelHelper.getPipeline(channel);
return USERS.get(pipeline);
}
default User removeUser(Object channel) {
Object pipeline = ChannelHelper.getPipeline(channel);
return USERS.remove(pipeline);
return USERS.get(channel);
}
default void setUser(Object channel, User user) {
synchronized (channel) {
Object pipeline = ChannelHelper.getPipeline(channel);
USERS.put(pipeline, user);
USERS.put(channel, user);
}
PacketEvents.getAPI().getInjector().updateUser(channel, user);
}
@@ -46,9 +46,7 @@ public enum ServerVersion {
V_1_17(755), V_1_17_1(756),
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. 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),
V_1_19(759), V_1_19_1(760), V_1_19_2(760),
//TODO UPDATE Add server version constant
ERROR(-1, true);
@@ -81,10 +81,6 @@ public class ChannelHelper {
return Arrays.toString(pipelineHandlerNames(channel).toArray(new String[0]));
}
public static Object getPipeline(Object channel) {
return PacketEvents.getAPI().getNettyManager().getChannelOperator().getPipeline(channel);
}
public static Object getPipelineHandler(Object channel, String name) {
return PacketEvents.getAPI().getNettyManager().getChannelOperator().getPipelineHandler(channel, name);
}
@@ -93,10 +89,6 @@ public class ChannelHelper {
return PacketEvents.getAPI().getNettyManager().getChannelOperator().getPipelineContext(channel, handlerName);
}
public static Object pooledByteBuf(Object channel) {
return PacketEvents.getAPI().getNettyManager().getChannelOperator().pooledByteBuf(channel);
}
public static void runInEventLoop(Object channel, Runnable runnable) {
PacketEvents.getAPI().getNettyManager().getChannelOperator().runInEventLoop(channel, runnable);
}
@@ -20,41 +20,26 @@ package com.github.retrooper.packetevents.netty.channel;
import java.net.SocketAddress;
import java.util.List;
import java.util.Set;
public interface ChannelOperator {
Set<Class<? extends Throwable>> getIgnoredHandlerExceptions();
SocketAddress remoteAddress(Object channel);
SocketAddress localAddress(Object channel);
boolean isOpen(Object channel);
Object close(Object channel);
Object write(Object channel, Object buffer);
Object flush(Object channel);
Object writeAndFlush(Object channel, Object buffer);
Object fireChannelRead(Object channel, Object buffer);
Object writeInContext(Object channel, String ctx, Object buffer);
Object flushInContext(Object channel, String ctx);
Object writeAndFlushInContext(Object channel, String ctx, Object buffer);
Object fireChannelReadInContext(Object channel, String ctx, Object buffer);
List<String> pipelineHandlerNames(Object channel);
Object getPipelineHandler(Object channel, String name);
Object getPipelineContext(Object channel, String name);
Object getPipeline(Object channel);
void runInEventLoop(Object channel, Runnable runnable);
Object pooledByteBuf(Object channel);
}
@@ -23,7 +23,7 @@ package com.github.retrooper.packetevents.protocol;
* @since 1.8
*/
public enum ConnectionState {
HANDSHAKING, STATUS, LOGIN, PLAY, CONFIGURATION;
HANDSHAKING, STATUS, LOGIN, PLAY;
public static ConnectionState getById(int id) {
if (id >= values().length || id < 0) {
@@ -5,7 +5,6 @@ import org.jetbrains.annotations.Nullable;
import java.io.DataOutput;
import java.io.IOException;
import java.util.ArrayList;
import java.util.BitSet;
import java.util.List;
import java.util.UUID;
@@ -33,22 +32,6 @@ public class LastSeenMessages {
return entries;
}
public static class Packed {
private List<MessageSignature.Packed> packedMessageSignatures;
public Packed(List<MessageSignature.Packed> packedMessageSignatures) {
this.packedMessageSignatures = packedMessageSignatures;
}
public List<MessageSignature.Packed> getPackedMessageSignatures() {
return packedMessageSignatures;
}
public void setPackedMessageSignatures(List<MessageSignature.Packed> packedMessageSignatures) {
this.packedMessageSignatures = packedMessageSignatures;
}
}
public static class Entry {
private final UUID uuid;
private final byte[] signature;
@@ -67,11 +50,11 @@ public class LastSeenMessages {
}
}
public static class LegacyUpdate {
public static class Update {
private final LastSeenMessages lastSeenMessages;
private final @Nullable Entry lastReceived;
public LegacyUpdate(LastSeenMessages lastSeenMessages, @Nullable Entry lastReceived) {
public Update(LastSeenMessages lastSeenMessages, @Nullable Entry lastReceived) {
this.lastSeenMessages = lastSeenMessages;
this.lastReceived = lastReceived;
}
@@ -84,22 +67,4 @@ public class LastSeenMessages {
return lastReceived;
}
}
public static class Update {
private final int offset;
private final BitSet acknowledged;
public Update(int offset, BitSet acknowledged) {
this.offset = offset;
this.acknowledged = acknowledged;
}
public int getOffset() {
return offset;
}
public BitSet getAcknowledged() {
return acknowledged;
}
}
}
@@ -1,70 +0,0 @@
/*
* 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.chat;
import org.jetbrains.annotations.Nullable;
import java.util.Optional;
public class MessageSignature {
private byte[] bytes;
public MessageSignature(byte[] bytes) {
this.bytes = bytes;
}
public byte[] getBytes() {
return bytes;
}
public void setBytes(byte[] bytes) {
this.bytes = bytes;
}
public static class Packed {
private int id;
private @Nullable MessageSignature fullSignature;
public Packed(@Nullable MessageSignature fullSignature) {
this.id = -1;
this.fullSignature = fullSignature;
}
public Packed(int id) {
this.id = id;
this.fullSignature = null;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public Optional<MessageSignature> getFullSignature() {
return Optional.ofNullable(fullSignature);
}
public void setFullSignature(@Nullable MessageSignature fullSignature) {
this.fullSignature = fullSignature;
}
}
}
@@ -1,102 +0,0 @@
/*
* 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.chat;
import com.github.retrooper.packetevents.resources.ResourceLocation;
import org.jetbrains.annotations.Nullable;
import java.util.List;
import java.util.Optional;
public class Node {
private byte flags;
private List<Integer> children;
private Optional<Integer> redirectNodeIndex;
private Optional<String> name;
private Optional<Integer> parserID;
private Optional<List<Object>> properties;
private Optional<ResourceLocation> suggestionsType;
public Node(byte flags, List<Integer> children, @Nullable Integer redirectNodeIndex, @Nullable String name, @Nullable Integer parserID, @Nullable List<Object> properties, @Nullable ResourceLocation suggestionsType) {
this.flags = flags;
this.children = children;
this.redirectNodeIndex = Optional.ofNullable(redirectNodeIndex);
this.name = Optional.ofNullable(name);
this.parserID = Optional.ofNullable(parserID);
this.properties = Optional.ofNullable(properties);
this.suggestionsType = Optional.ofNullable(suggestionsType);
}
public byte getFlags() {
return flags;
}
public void setFlags(byte flags) {
this.flags = flags;
}
public List<Integer> getChildren() {
return children;
}
public void setChildren(List<Integer> children) {
this.children = children;
}
public Optional<Integer> getRedirectNodeIndex() {
return redirectNodeIndex;
}
public void setRedirectNodeIndex(Optional<Integer> redirectNodeIndex) {
this.redirectNodeIndex = redirectNodeIndex;
}
public Optional<String> getName() {
return name;
}
public void setName(Optional<String> name) {
this.name = name;
}
public Optional<Integer> getParserID() {
return parserID;
}
public void setParserID(Optional<Integer> parserID) {
this.parserID = parserID;
}
public Optional<List<Object>> getProperties() {
return properties;
}
public void setProperties(Optional<List<Object>> properties) {
this.properties = properties;
}
public Optional<ResourceLocation> getSuggestionsType() {
return suggestionsType;
}
public void setSuggestionsType(Optional<ResourceLocation> suggestionsType) {
this.suggestionsType = suggestionsType;
}
}
@@ -1,186 +0,0 @@
/*
* 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.chat;
import com.github.retrooper.packetevents.resources.ResourceLocation;
import com.github.retrooper.packetevents.wrapper.PacketWrapper;
import org.jetbrains.annotations.Nullable;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Function;
public class Parsers {
private static final List<Parser> parsers = Arrays.asList(
new Parser("brigadier:bool", null, null),
new Parser("brigadier:float",
packetWrapper -> {
byte flags = packetWrapper.readByte();
float min = (flags & 0x01) != 0 ? packetWrapper.readFloat() : -Float.MAX_VALUE;
float max = (flags & 0x02) != 0 ? packetWrapper.readFloat() : Float.MAX_VALUE;
return Arrays.asList(flags, min, max);
},
(packetWrapper, properties) -> {
byte flags = (byte) properties.get(0);
packetWrapper.writeByte(flags);
if ((flags & 0x01) != 0) packetWrapper.writeFloat((float) properties.get(1));
if ((flags & 0x02) != 0) packetWrapper.writeFloat((float) properties.get(2));
}
),
new Parser("brigadier:double",
packetWrapper -> {
byte flags = packetWrapper.readByte();
double min = (flags & 0x01) != 0 ? packetWrapper.readDouble() : -Double.MAX_VALUE;
double max = (flags & 0x02) != 0 ? packetWrapper.readDouble() : Double.MAX_VALUE;
return Arrays.asList(flags, min, max);
},
(packetWrapper, properties) -> {
byte flags = (byte) properties.get(0);
packetWrapper.writeByte(flags);
if ((flags & 0x01) != 0) packetWrapper.writeDouble((double) properties.get(1));
if ((flags & 0x02) != 0) packetWrapper.writeDouble((double) properties.get(2));
}
),
new Parser("brigadier:integer",
packetWrapper -> {
byte flags = packetWrapper.readByte();
int min = (flags & 0x01) != 0 ? packetWrapper.readInt() : Integer.MIN_VALUE;
int max = (flags & 0x02) != 0 ? packetWrapper.readInt() : Integer.MAX_VALUE;
return Arrays.asList(flags, min, max);
},
(packetWrapper, properties) -> {
byte flags = (byte) properties.get(0);
packetWrapper.writeByte(flags);
if ((flags & 0x01) != 0) packetWrapper.writeInt((int) properties.get(1));
if ((flags & 0x02) != 0) packetWrapper.writeInt((int) properties.get(2));
}
),
new Parser("brigadier:long",
packetWrapper -> {
byte flags = packetWrapper.readByte();
long min = (flags & 0x01) != 0 ? packetWrapper.readLong() : Long.MIN_VALUE;
long max = (flags & 0x02) != 0 ? packetWrapper.readLong() : Long.MAX_VALUE;
return Arrays.asList(flags, min, max);
},
(packetWrapper, properties) -> {
byte flags = (byte) properties.get(0);
packetWrapper.writeByte(flags);
if ((flags & 0x01) != 0) packetWrapper.writeLong((long) properties.get(1));
if ((flags & 0x02) != 0) packetWrapper.writeLong((long) properties.get(2));
}
),
new Parser("brigadier:string",
packetWrapper -> Collections.singletonList(packetWrapper.readVarInt()),
(packetWrapper, properties) -> packetWrapper.writeVarInt((Integer) properties.get(0))
),
new Parser("minecraft:entity",
packetWrapper -> Collections.singletonList(packetWrapper.readByte()),
(packetWrapper, properties) -> packetWrapper.writeByte(((Byte) properties.get(0)).intValue())
),
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("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("minecraft:resource_or_tag",
packetWrapper -> Collections.singletonList(packetWrapper.readIdentifier()),
(packetWrapper, properties) -> packetWrapper.writeIdentifier((ResourceLocation) properties.get(0))
),
new Parser("minecraft:resource_or_tag_key",
packetWrapper -> Collections.singletonList(packetWrapper.readIdentifier()),
(packetWrapper, properties) -> packetWrapper.writeIdentifier((ResourceLocation) properties.get(0))
),
new Parser("minecraft:resource",
packetWrapper -> Collections.singletonList(packetWrapper.readIdentifier()),
(packetWrapper, properties) -> packetWrapper.writeIdentifier((ResourceLocation) properties.get(0))
),
new Parser("minecraft:resource_key",
packetWrapper -> Collections.singletonList(packetWrapper.readIdentifier()),
(packetWrapper, properties) -> packetWrapper.writeIdentifier((ResourceLocation) properties.get(0))
),
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() {
return parsers;
}
public static final class Parser {
private final String name; //not really needed, just for toString or something
private final Optional<Function<PacketWrapper<?>, List<Object>>> read;
private final Optional<BiConsumer<PacketWrapper<?>, List<Object>>> write;
public Parser(String name, @Nullable Function<PacketWrapper<?>, List<Object>> read, @Nullable BiConsumer<PacketWrapper<?>, List<Object>> write) {
this.name = name;
this.read = Optional.ofNullable(read);
this.write = Optional.ofNullable(write);
}
public Optional<List<Object>> readProperties(PacketWrapper<?> packetWrapper) {
return read.map(fn -> fn.apply(packetWrapper));
}
public void writeProperties(PacketWrapper<?> packetWrapper, List<Object> properties) {
write.ifPresent(fn -> fn.accept(packetWrapper, properties));
}
}
}
@@ -1,41 +0,0 @@
/*
* 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.chat;
import com.github.retrooper.packetevents.protocol.player.PublicProfileKey;
import java.util.UUID;
public class RemoteChatSession {
private final UUID sessionId;
private final PublicProfileKey publicProfileKey;
public RemoteChatSession(UUID sessionId, PublicProfileKey publicProfileKey) {
this.sessionId = sessionId;
this.publicProfileKey = publicProfileKey;
}
public UUID getSessionId() {
return sessionId;
}
public PublicProfileKey getPublicProfileKey() {
return publicProfileKey;
}
}
@@ -1,27 +0,0 @@
package com.github.retrooper.packetevents.protocol.chat;
public class SignedCommandArgument {
private String argument;
private byte[] signature;
public SignedCommandArgument(String argument, byte[] signature) {
this.argument = argument;
this.signature = signature;
}
public String getArgument() {
return argument;
}
public void setArgument(String argument) {
this.argument = argument;
}
public byte[] getSignature() {
return signature;
}
public void setSignature(byte[] signature) {
this.signature = signature;
}
}
@@ -24,9 +24,10 @@ import org.jetbrains.annotations.Nullable;
import java.time.Instant;
import java.util.UUID;
//We'll extend ChatMessage_v1_16 for now, hopefully no breaking changes in the future
public class ChatMessage_v1_19 extends ChatMessage_v1_16 {
public class ChatMessage_v1_19 extends ChatMessage {
private @Nullable Component unsignedChatContent;
private UUID senderUUID;
private Component senderDisplayName;
private @Nullable Component teamName;
private Instant timestamp;
@@ -36,8 +37,9 @@ public class ChatMessage_v1_19 extends ChatMessage_v1_16 {
public ChatMessage_v1_19(Component chatContent, @Nullable Component unsignedChatContent, ChatType type,
UUID senderUUID, Component senderDisplayName, @Nullable Component teamName, Instant timestamp,
long salt, byte[] signature) {
super(chatContent, type, senderUUID);
super(chatContent, type);
this.unsignedChatContent = unsignedChatContent;
this.senderUUID = senderUUID;
this.senderDisplayName = senderDisplayName;
this.teamName = teamName;
this.timestamp = timestamp;
@@ -49,6 +51,10 @@ public class ChatMessage_v1_19 extends ChatMessage_v1_16 {
return unsignedChatContent;
}
public UUID getSenderUUID() {
return senderUUID;
}
public Component getSenderDisplayName() {
return senderDisplayName;
}
@@ -73,6 +79,10 @@ public class ChatMessage_v1_19 extends ChatMessage_v1_16 {
this.unsignedChatContent = unsignedChatContent;
}
public void setSenderUUID(UUID senderUUID) {
this.senderUUID = senderUUID;
}
public void setSenderDisplayName(Component senderDisplayName) {
this.senderDisplayName = senderDisplayName;
}
@@ -26,10 +26,11 @@ import org.jetbrains.annotations.Nullable;
import java.time.Instant;
import java.util.UUID;
//We'll extend ChatMessage_v1_16 for now, hopefully no breaking changes in the future
public class ChatMessage_v1_19_1 extends ChatMessage_v1_16 {
public class ChatMessage_v1_19_1 extends ChatMessage {
private String plainContent;
private @Nullable Component unsignedChatContent;
private UUID senderUUID;
private ChatTypeBoundNetwork chatType;
private byte @Nullable [] previousSignature;
private byte[] signature;
@@ -45,9 +46,10 @@ public class ChatMessage_v1_19_1 extends ChatMessage_v1_16 {
Instant timestamp, long salt,
LastSeenMessages lastSeenMessages,
FilterMask filterMask) {
super(decoratedChatContent, chatType.getType(), senderUUID);
super(decoratedChatContent, chatType.getType());
this.plainContent = plainContent;
this.unsignedChatContent = unsignedChatContent;
this.senderUUID = senderUUID;
this.chatType = chatType;
this.previousSignature = previousSignature;
this.signature = signature;
@@ -77,6 +79,14 @@ public class ChatMessage_v1_19_1 extends ChatMessage_v1_16 {
this.unsignedChatContent = unsignedChatContent;
}
public UUID getSenderUUID() {
return senderUUID;
}
public void setSenderUUID(UUID senderUUID) {
this.senderUUID = senderUUID;
}
@Override
public ChatType getType() {
return chatType.getType();
@@ -1,119 +0,0 @@
package com.github.retrooper.packetevents.protocol.chat.message;
import com.github.retrooper.packetevents.protocol.chat.LastSeenMessages;
import com.github.retrooper.packetevents.protocol.chat.filter.FilterMask;
import com.github.retrooper.packetevents.util.adventure.AdventureSerializer;
import net.kyori.adventure.text.Component;
import org.jetbrains.annotations.Nullable;
import java.time.Instant;
import java.util.Optional;
import java.util.UUID;
//We'll extend ChatMessage_v1_16 for now, hopefully no breaking changes in the future
public class ChatMessage_v1_19_3 extends ChatMessage_v1_16 {
int index;
byte[] signature;
String plainContent;
Instant timestamp;
long salt;
LastSeenMessages.Packed lastSeenMessagesPacked;
@Nullable Component unsignedChatContent;
FilterMask filterMask;
ChatMessage_v1_19_1.ChatTypeBoundNetwork chatType;
public ChatMessage_v1_19_3(UUID senderUUID, int index, byte[] signature, String plainContent, Instant timestamp, long salt, LastSeenMessages.Packed lastSeenMessagesPacked, @Nullable Component unsignedChatContent, FilterMask filterMask, ChatMessage_v1_19_1.ChatTypeBoundNetwork chatType) {
super(Component.text(plainContent), chatType.getType(), senderUUID);
this.index = index;
this.signature = signature;
this.plainContent = plainContent;
this.timestamp = timestamp;
this.salt = salt;
this.lastSeenMessagesPacked = lastSeenMessagesPacked;
this.unsignedChatContent = unsignedChatContent;
this.filterMask = filterMask;
this.chatType = chatType;
}
public int getIndex() {
return index;
}
public void setIndex(int index) {
this.index = index;
}
public byte[] getSignature() {
return signature;
}
public void setSignature(byte[] signature) {
this.signature = signature;
}
@Override
public Component getChatContent() {
return Component.text(plainContent);
}
@Deprecated
@Override
public void setChatContent(Component chatContent) {
throw new UnsupportedOperationException("PacketEvents is not able to serialize components to plain-text. Please use the #setPlainContent instead to update the content.");
}
public String getPlainContent() {
return plainContent;
}
public void setPlainContent(String plainContent) {
this.plainContent = plainContent;
}
public Instant getTimestamp() {
return timestamp;
}
public void setTimestamp(Instant timestamp) {
this.timestamp = timestamp;
}
public long getSalt() {
return salt;
}
public void setSalt(long salt) {
this.salt = salt;
}
public LastSeenMessages.Packed getLastSeenMessagesPacked() {
return lastSeenMessagesPacked;
}
public void setLastSeenMessagesPacked(LastSeenMessages.Packed lastSeenMessagesPacked) {
this.lastSeenMessagesPacked = lastSeenMessagesPacked;
}
public Optional<Component> getUnsignedChatContent() {
return Optional.ofNullable(unsignedChatContent);
}
public void setUnsignedChatContent(@Nullable Component unsignedChatContent) {
this.unsignedChatContent = unsignedChatContent;
}
public FilterMask getFilterMask() {
return filterMask;
}
public void setFilterMask(FilterMask filterMask) {
this.filterMask = filterMask;
}
public ChatMessage_v1_19_1.ChatTypeBoundNetwork getChatType() {
return chatType;
}
public void setChatType(ChatMessage_v1_19_1.ChatTypeBoundNetwork chatType) {
this.chatType = chatType;
}
}
@@ -40,9 +40,7 @@ public class ChatMessageProcessor_v1_19_1 implements ChatMessageProcessor {
byte[] signature = wrapper.readByteArray();
String plainContent = wrapper.readString(256);
Component chatContent = wrapper.readOptional(PacketWrapper::readComponent);
if (chatContent == null && plainContent.isEmpty()) {
chatContent = Component.empty();
} else if (chatContent == null) {
if (chatContent == null) {
chatContent = Component.text(plainContent);
}
Instant timestamp = wrapper.readTimestamp();
@@ -50,7 +48,13 @@ public class ChatMessageProcessor_v1_19_1 implements ChatMessageProcessor {
LastSeenMessages lastSeenMessages = wrapper.readLastSeenMessages();
Component unsignedChatContent = wrapper.readOptional(PacketWrapper::readComponent);
FilterMask filterMask = wrapper.readFilterMask();
ChatMessage_v1_19_1.ChatTypeBoundNetwork chatType = wrapper.readChatTypeBoundNetwork();
int id = wrapper.readVarInt();
ChatType type = ChatTypes.getById(wrapper.getServerVersion().toClientVersion(), id);
Component name = wrapper.readComponent();
Component targetName = wrapper.readOptional(PacketWrapper::readComponent);
ChatMessage_v1_19_1.ChatTypeBoundNetwork chatType = new ChatMessage_v1_19_1.ChatTypeBoundNetwork(type, name, targetName);
return new ChatMessage_v1_19_1(plainContent, chatContent, unsignedChatContent, senderUUID, chatType,
previousSignature, signature, timestamp, salt, lastSeenMessages, filterMask);
}
@@ -68,6 +72,8 @@ public class ChatMessageProcessor_v1_19_1 implements ChatMessageProcessor {
wrapper.writeLastSeenMessages(newData.getLastSeenMessages());
wrapper.writeOptional(newData.getUnsignedChatContent(), PacketWrapper::writeComponent);
wrapper.writeFilterMask(newData.getFilterMask());
wrapper.writeChatTypeBoundNetwork(newData.getChatType());
wrapper.writeVarInt(newData.getChatType().getType().getId(wrapper.getServerVersion().toClientVersion()));
wrapper.writeComponent(newData.getChatType().getName());
wrapper.writeOptional(newData.getChatType().getTargetName(), PacketWrapper::writeComponent);
}
}
@@ -1,47 +0,0 @@
package com.github.retrooper.packetevents.protocol.chat.message.reader.impl;
import com.github.retrooper.packetevents.protocol.chat.LastSeenMessages;
import com.github.retrooper.packetevents.protocol.chat.filter.FilterMask;
import com.github.retrooper.packetevents.protocol.chat.message.ChatMessage;
import com.github.retrooper.packetevents.protocol.chat.message.ChatMessage_v1_19_1;
import com.github.retrooper.packetevents.protocol.chat.message.ChatMessage_v1_19_3;
import com.github.retrooper.packetevents.protocol.chat.message.reader.ChatMessageProcessor;
import com.github.retrooper.packetevents.wrapper.PacketWrapper;
import net.kyori.adventure.text.Component;
import org.jetbrains.annotations.NotNull;
import java.time.Instant;
import java.util.UUID;
public class ChatMessageProcessor_v1_19_3 implements ChatMessageProcessor {
@Override
public ChatMessage readChatMessage(@NotNull PacketWrapper<?> wrapper) {
UUID senderUUID = wrapper.readUUID();
int index = wrapper.readVarInt();
byte[] signature = wrapper.readOptional((w) -> w.readBytes(256));
String plainContent = wrapper.readString(256);
Instant timestamp = wrapper.readTimestamp();
long salt = wrapper.readLong();
LastSeenMessages.Packed lastSeenMessagesPacked = wrapper.readLastSeenMessagesPacked();
Component unsignedChatContent = wrapper.readOptional(PacketWrapper::readComponent);
FilterMask filterMask = wrapper.readFilterMask();
ChatMessage_v1_19_1.ChatTypeBoundNetwork chatType = wrapper.readChatTypeBoundNetwork();
return new ChatMessage_v1_19_3(senderUUID, index, signature, plainContent, timestamp, salt, lastSeenMessagesPacked, unsignedChatContent, filterMask, chatType);
}
@Override
public void writeChatMessage(@NotNull PacketWrapper<?> wrapper, @NotNull ChatMessage data) {
ChatMessage_v1_19_3 newData = (ChatMessage_v1_19_3) data;
wrapper.writeUUID(newData.getSenderUUID());
wrapper.writeVarInt(newData.getIndex());
wrapper.writeOptional(newData.getSignature(), PacketWrapper::writeBytes);
wrapper.writeString(newData.getPlainContent());
wrapper.writeTimestamp(newData.getTimestamp());
wrapper.writeLong(newData.getSalt());
wrapper.writeLastSeenMessagesPacked(newData.getLastSeenMessagesPacked());
wrapper.writeOptional(newData.getUnsignedChatContent().orElse(null), PacketWrapper::writeComponent);
wrapper.writeFilterMask(newData.getFilterMask());
wrapper.writeChatTypeBoundNetwork(newData.getChatType());
}
}
@@ -21,7 +21,6 @@ package com.github.retrooper.packetevents.protocol.entity.data;
import com.github.retrooper.packetevents.PacketEvents;
import com.github.retrooper.packetevents.manager.server.ServerVersion;
import com.github.retrooper.packetevents.protocol.entity.pose.EntityPose;
import com.github.retrooper.packetevents.protocol.entity.sniffer.SnifferState;
import com.github.retrooper.packetevents.protocol.entity.villager.VillagerData;
import com.github.retrooper.packetevents.protocol.item.ItemStack;
import com.github.retrooper.packetevents.protocol.nbt.NBTCompound;
@@ -32,7 +31,6 @@ 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.Quaternion4f;
import com.github.retrooper.packetevents.util.TypesBuilder;
import com.github.retrooper.packetevents.util.TypesBuilderData;
import com.github.retrooper.packetevents.util.Vector3f;
@@ -61,9 +59,7 @@ public class EntityDataTypes {
ClientVersion.V_1_11,
ClientVersion.V_1_13,
ClientVersion.V_1_14,
ClientVersion.V_1_19,
ClientVersion.V_1_19_3,
ClientVersion.V_1_19_4);
ClientVersion.V_1_19);
public static final EntityDataType<Byte> BYTE = define("byte", PacketWrapper::readByte, PacketWrapper::writeByte);
@@ -83,19 +79,13 @@ public class EntityDataTypes {
}
});
public static final EntityDataType<Long> LONG = define("long", PacketWrapper::readVarLong, PacketWrapper::writeVarLong);
public static final EntityDataType<Float> FLOAT = define("float", PacketWrapper::readFloat, PacketWrapper::writeFloat);
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<Component> COMPONENT = define("component", PacketWrapper::readComponent, PacketWrapper::writeComponent);
@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<Optional<Component>> OPTIONAL_COMPONENT = define("optional_component", readOptionalComponentDeserializer(), writeOptionalComponentSerializer());
public static final EntityDataType<ItemStack> ITEMSTACK = define("itemstack", PacketWrapper::readItemStack, PacketWrapper::writeItemStack);
@@ -146,9 +136,6 @@ public class EntityDataTypes {
(PacketWrapper<?> wrapper, Optional<UUID> value) ->
wrapper.writeOptional(value.orElse(null), PacketWrapper::writeUUID));
public static final EntityDataType<Integer> BLOCK_STATE = define("block_state",
readIntDeserializer(), writeIntSerializer());
public static final EntityDataType<Integer> OPTIONAL_BLOCK_STATE = define("optional_block_state", readIntDeserializer(), writeIntSerializer());
public static final EntityDataType<NBTCompound> NBT = define("nbt", PacketWrapper::readNBT, PacketWrapper::writeNBT);
@@ -189,29 +176,6 @@ public class EntityDataTypes {
public static final EntityDataType<Integer> PAINTING_VARIANT_TYPE = define("painting_variant_type", readIntDeserializer(), writeIntSerializer());
public static final EntityDataType<SnifferState> SNIFFER_STATE = define("sniffer_state", (PacketWrapper<?> wrapper) -> {
int id = wrapper.readVarInt();
return SnifferState.values()[id];
}, (PacketWrapper<?> wrapper, SnifferState value) -> wrapper.writeVarInt(value.ordinal()));
public static final EntityDataType<Vector3f> VECTOR3F = define("vector3f",
(PacketWrapper<?> wrapper) -> new Vector3f(wrapper.readFloat(), wrapper.readFloat(), wrapper.readFloat()),
(PacketWrapper<?> wrapper, Vector3f value) -> {
wrapper.writeFloat(value.x);
wrapper.writeFloat(value.y);
wrapper.writeFloat(value.z);
});
public static final EntityDataType<Quaternion4f> QUATERNION = define("quaternion",
(PacketWrapper<?> wrapper) -> new Quaternion4f(wrapper.readFloat(), wrapper.readFloat(), wrapper.readFloat(), wrapper.readFloat()),
(PacketWrapper<?> wrapper, Quaternion4f value) -> {
wrapper.writeFloat(value.getX());
wrapper.writeFloat(value.getY());
wrapper.writeFloat(value.getZ());
wrapper.writeFloat(value.getW());
});
public static EntityDataType<?> getById(ClientVersion version, int id) {
int index = TYPES_BUILDER.getDataIndex(version);
Map<Integer, EntityDataType<?>> typeIdMap = ENTITY_DATA_TYPE_ID_MAP.get((byte) index);
@@ -265,44 +229,26 @@ public class EntityDataTypes {
};
}
@Deprecated
private static Function<PacketWrapper<?>, Optional<String>> readOptionalComponentJSONDeserializer() {
private static <T> Function<PacketWrapper<?>, T> readOptionalComponentDeserializer() {
return (PacketWrapper<?> wrapper) -> {
if (wrapper.readBoolean()) {
return Optional.of(wrapper.readComponentJSON());
return (T) Optional.of(wrapper.readComponent());
} else {
return Optional.empty();
return (T) Optional.empty();
}
};
}
@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());
private static <T> BiConsumer<PacketWrapper<?>, T> writeOptionalComponentSerializer() {
return (PacketWrapper<?> wrapper, T value) -> {
if (value instanceof Optional) {
Optional<Component> optional = (Optional<Component>) value;
if (optional.isPresent()) {
wrapper.writeBoolean(true);
wrapper.writeComponent(optional.get());
} else {
wrapper.writeBoolean(false);
}
} else {
wrapper.writeBoolean(false);
}
@@ -1,35 +0,0 @@
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());
}
}
@@ -16,14 +16,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.github.retrooper.packetevents.protocol.entity.sniffer;
package com.github.retrooper.packetevents.protocol.entity.data.provider;
public enum SnifferState {
IDLING,
FEELING_HAPPY,
SCENTING,
SNIFFING,
SEARCHING,
DIGGING,
RISING
import com.github.retrooper.packetevents.protocol.entity.data.EntityData;
import java.util.List;
public interface DataProvider {
List<EntityData> encode();
void decode(List<EntityData> data);
}
@@ -0,0 +1,343 @@
/*
* 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.entity.data.provider;
import com.github.retrooper.packetevents.protocol.entity.data.EntityData;
import com.github.retrooper.packetevents.protocol.entity.data.EntityDataTypes;
import com.github.retrooper.packetevents.protocol.entity.pose.EntityPose;
import net.kyori.adventure.text.Component;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
public class EntityDataProvider implements DataProvider {
@Nullable
private Component customName;
private boolean customNameVisible;
private EntityPose pose = EntityPose.STANDING;
private int airTicks;
private int ticksFrozenInPowderedSnow = 0;
private boolean onFire;
private boolean crouching;
//Now unused
private boolean riding;
private boolean sprinting;
private boolean swimming;
private boolean invisible;
private boolean glowing;
private boolean flyingWithElytra;
private boolean silent;
private boolean hasGravity = true;
@Nullable
public Component getCustomName() {
return customName;
}
public void setCustomName(@Nullable Component customName) {
this.customName = customName;
}
public boolean isCustomNameVisible() {
return customNameVisible;
}
public void setCustomNameVisible(boolean customNameVisible) {
this.customNameVisible = customNameVisible;
}
public EntityPose getPose() {
return pose;
}
public void setPose(EntityPose pose) {
this.pose = pose;
}
public int getAirTicks() {
return airTicks;
}
public void setAirTicks(int airTicks) {
this.airTicks = airTicks;
}
public int getTicksFrozenInPowderedSnow() {
return ticksFrozenInPowderedSnow;
}
public void setTicksFrozenInPowderedSnow(int ticksFrozenInPowderedSnow) {
this.ticksFrozenInPowderedSnow = ticksFrozenInPowderedSnow;
}
public boolean isOnFire() {
return onFire;
}
public void setOnFire(boolean onFire) {
this.onFire = onFire;
}
public boolean isCrouching() {
return crouching;
}
public void setCrouching(boolean crouching) {
this.crouching = crouching;
}
public boolean isRiding() {
return riding;
}
public void setRiding(boolean riding) {
this.riding = riding;
}
public boolean isSprinting() {
return sprinting;
}
public void setSprinting(boolean sprinting) {
this.sprinting = sprinting;
}
public boolean isSwimming() {
return swimming;
}
public void setSwimming(boolean swimming) {
this.swimming = swimming;
}
public boolean isInvisible() {
return invisible;
}
public void setInvisible(boolean invisible) {
this.invisible = invisible;
}
public boolean isGlowing() {
return glowing;
}
public void setGlowing(boolean glowing) {
this.glowing = glowing;
}
public boolean isFlyingWithElytra() {
return flyingWithElytra;
}
public void setFlyingWithElytra(boolean flyingWithElytra) {
this.flyingWithElytra = flyingWithElytra;
}
public boolean isSilent() {
return silent;
}
public void setSilent(boolean silent) {
this.silent = silent;
}
public boolean isHasGravity() {
return hasGravity;
}
public void setHasGravity(boolean hasGravity) {
this.hasGravity = hasGravity;
}
@Override
public List<EntityData> encode() {
byte mask = 0x00;
if (onFire) {
mask |= 0x01;
}
if (crouching) {
mask |= 0x02;
}
//TODO Rethink, should we add this?
if (riding) {
mask |= 0x04;
}
if (sprinting) {
mask |= 0x08;
}
if (swimming) {
mask |= 0x10;
}
if (invisible) {
mask |= 0x20;
}
if (glowing) {
mask |= 0x40;
}
if (flyingWithElytra) {
mask |= 0x80;
}
List<EntityData> metadata = new ArrayList<>(8);
metadata.add(new EntityData(0, EntityDataTypes.BYTE, mask));
metadata.add(new EntityData(1, EntityDataTypes.INT, airTicks));
metadata.add(new EntityData(2, EntityDataTypes.OPTIONAL_COMPONENT, Optional.ofNullable(customName)));
metadata.add(new EntityData(3, EntityDataTypes.BOOLEAN, customNameVisible));
metadata.add(new EntityData(4, EntityDataTypes.BOOLEAN, silent));
metadata.add(new EntityData(5, EntityDataTypes.BOOLEAN, !hasGravity));
metadata.add(new EntityData(6, EntityDataTypes.ENTITY_POSE, pose));
metadata.add(new EntityData(7, EntityDataTypes.INT, ticksFrozenInPowderedSnow));
return metadata;
}
@Override
public void decode(List<EntityData> data) {
for (EntityData entityData : data) {
switch (entityData.getIndex()) {
case 0:
byte mask = (byte) entityData.getValue();
onFire = (mask & 0x01) != 0;
crouching = (mask & 0x02) != 0;
riding = (mask & 0x04) != 0;
sprinting = (mask & 0x08) != 0;
swimming = (mask & 0x10) != 0;
invisible = (mask & 0x20) != 0;
glowing = (mask & 0x40) != 0;
flyingWithElytra = (mask & 0x80) != 0;
break;
case 1:
airTicks = (int) entityData.getValue();
break;
case 2:
customName = ((Optional<Component>) entityData.getValue()).orElse(null);
break;
case 3:
customNameVisible = (boolean) entityData.getValue();
break;
case 4:
silent = (boolean) entityData.getValue();
break;
case 5:
hasGravity = !(boolean) entityData.getValue();
break;
case 6:
pose = (EntityPose) entityData.getValue();
break;
case 7:
ticksFrozenInPowderedSnow = (int) entityData.getValue();
break;
}
}
}
public static EntityBuilder<EntityBuilder> builderEntity() {
return new EntityBuilder<>(new EntityDataProvider());
}
public static class EntityBuilder<T extends EntityBuilder> {
protected EntityDataProvider provider;
public EntityBuilder(EntityDataProvider provider) {
this.provider = provider;
}
public T customName(@Nullable Component customName) {
((EntityDataProvider) provider).setCustomName(customName);
return (T) this;
}
public T customNameVisible(boolean customNameVisible) {
((EntityDataProvider) provider).setCustomNameVisible(customNameVisible);
return (T) this;
}
public T pose(EntityPose pose) {
((EntityDataProvider) provider).setPose(pose);
return (T) this;
}
public T onFire(boolean onFire) {
((EntityDataProvider) provider).setOnFire(onFire);
return (T) this;
}
public T crouching(boolean crouching) {
((EntityDataProvider) provider).setCrouching(crouching);
return (T) this;
}
public T riding(boolean riding) {
((EntityDataProvider) provider).setRiding(riding);
return (T) this;
}
public T sprinting(boolean sprinting) {
((EntityDataProvider) provider).setSprinting(sprinting);
return (T) this;
}
public T swimming(boolean swimming) {
((EntityDataProvider) provider).setSwimming(swimming);
return (T) this;
}
public T invisible(boolean invisible) {
((EntityDataProvider) provider).setInvisible(invisible);
return (T) this;
}
public T glowing(boolean glowing) {
((EntityDataProvider) provider).setGlowing(glowing);
return (T) this;
}
public T flyingWithElytra(boolean flyingWithElytra) {
((EntityDataProvider) provider).setFlyingWithElytra(flyingWithElytra);
return (T) this;
}
public T silent(boolean silent) {
((EntityDataProvider) provider).setSilent(silent);
return (T) this;
}
public T hasGravity(boolean hasGravity) {
((EntityDataProvider) provider).setHasGravity(hasGravity);
return (T) this;
}
public T airTicks(int airTicks) {
((EntityDataProvider) provider).setAirTicks(airTicks);
return (T) this;
}
public T ticksFrozenInPowderedSnow(int ticksFrozenInPowderedSnow) {
((EntityDataProvider) provider).setTicksFrozenInPowderedSnow(ticksFrozenInPowderedSnow);
return (T) this;
}
public <K extends EntityDataProvider> K build() {
return (K) provider;
}
}
}
@@ -0,0 +1,232 @@
/*
* 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.entity.data.provider;
import com.github.retrooper.packetevents.protocol.entity.data.EntityData;
import com.github.retrooper.packetevents.protocol.entity.data.EntityDataTypes;
import com.github.retrooper.packetevents.protocol.player.InteractionHand;
import com.github.retrooper.packetevents.util.Vector3i;
import org.jetbrains.annotations.Nullable;
import java.util.List;
import java.util.Optional;
public class LivingEntityDataProvider extends EntityDataProvider {
private boolean handActive;
private InteractionHand hand = InteractionHand.MAIN_HAND;
private boolean isInRiptideSpinAttack;
private float health = 1.0f;
private int potionEffectColor;
private boolean potionEffectAmbient;
private int arrowInBodyCount;
private int beeStingsInBodyCount;
@Nullable
private Vector3i sleepingPosition;
public boolean isHandActive() {
return handActive;
}
public void setHandActive(boolean handActive) {
this.handActive = handActive;
}
public InteractionHand getHand() {
return hand;
}
public void setHand(InteractionHand hand) {
this.hand = hand;
}
public boolean isInRiptideSpinAttack() {
return isInRiptideSpinAttack;
}
public void setInRiptideSpinAttack(boolean inRiptideSpinAttack) {
isInRiptideSpinAttack = inRiptideSpinAttack;
}
public float getHealth() {
return health;
}
public void setHealth(float health) {
this.health = health;
}
public int getPotionEffectColor() {
return potionEffectColor;
}
public void setPotionEffectColor(int potionEffectColor) {
this.potionEffectColor = potionEffectColor;
}
public boolean isPotionEffectAmbient() {
return potionEffectAmbient;
}
public void setPotionEffectAmbient(boolean potionEffectAmbient) {
this.potionEffectAmbient = potionEffectAmbient;
}
public int getArrowInBodyCount() {
return arrowInBodyCount;
}
public void setArrowInBodyCount(int arrowInBodyCount) {
this.arrowInBodyCount = arrowInBodyCount;
}
public int getBeeStingsInBodyCount() {
return beeStingsInBodyCount;
}
public void setBeeStingsInBodyCount(int beeStingsInBodyCount) {
this.beeStingsInBodyCount = beeStingsInBodyCount;
}
@Nullable
public Vector3i getSleepingPosition() {
return sleepingPosition;
}
public void setSleepingPosition(@Nullable Vector3i sleepingPosition) {
this.sleepingPosition = sleepingPosition;
}
public static LivingEntityBuilder<LivingEntityBuilder> builderLivingEntity() {
return new LivingEntityBuilder<>(new LivingEntityDataProvider());
}
@Override
public List<EntityData> encode() {
List<EntityData> metadata = super.encode();
byte mask = 0x00;
if (handActive) {
mask |= 0x01;
}
//TODO Confirm
if (hand == InteractionHand.OFF_HAND) {
mask |= 0x02;
}
if (isInRiptideSpinAttack) {
mask |= 0x04;
}
metadata.add(new EntityData(8, EntityDataTypes.BYTE, mask));
metadata.add(new EntityData(9, EntityDataTypes.FLOAT, health));
metadata.add(new EntityData(10, EntityDataTypes.INT, potionEffectColor));
metadata.add(new EntityData(11, EntityDataTypes.BOOLEAN, potionEffectAmbient));
metadata.add(new EntityData(12, EntityDataTypes.INT, arrowInBodyCount));
metadata.add(new EntityData(13, EntityDataTypes.INT, beeStingsInBodyCount));
metadata.add(new EntityData(14, EntityDataTypes.OPTIONAL_BLOCK_POSITION, Optional.ofNullable(sleepingPosition)));
return metadata;
}
@Override
public void decode(List<EntityData> data) {
super.decode(data);
for (EntityData entityData : data) {
switch (entityData.getIndex()) {
case 8:
byte mask = (byte) entityData.getValue();
handActive = (mask & 0x01) != 0;
//TODO Test, look into
hand = (mask & 0x02) != 0 ? InteractionHand.OFF_HAND : InteractionHand.MAIN_HAND;
isInRiptideSpinAttack = (mask & 0x04) != 0;
break;
case 9:
health = (float) entityData.getValue();
break;
case 10:
potionEffectColor = (int) entityData.getValue();
break;
case 11:
potionEffectAmbient = (boolean) entityData.getValue();
break;
case 12:
arrowInBodyCount = (int) entityData.getValue();
break;
case 13:
beeStingsInBodyCount = (int) entityData.getValue();
break;
case 14:
sleepingPosition = ((Optional<Vector3i>) entityData.getValue()).orElse(null);
break;
}
}
}
public static class LivingEntityBuilder<T extends LivingEntityBuilder> extends EntityDataProvider.EntityBuilder<T> {
public LivingEntityBuilder(LivingEntityDataProvider livingEntityDataProvider) {
super(livingEntityDataProvider);
}
public T handActive(boolean handActive) {
((LivingEntityDataProvider) provider).setHandActive(handActive);
return (T) this;
}
public T hand(InteractionHand hand) {
((LivingEntityDataProvider) provider).setHand(hand);
return (T) this;
}
public T isInRiptideSpinAttack(boolean isInRiptideSpinAttack) {
((LivingEntityDataProvider) provider).setInRiptideSpinAttack(isInRiptideSpinAttack);
return (T) this;
}
public T health(float health) {
((LivingEntityDataProvider) provider).setHealth(health);
return (T) this;
}
public T potionEffectColor(int potionEffectColor) {
((LivingEntityDataProvider) provider).setPotionEffectColor(potionEffectColor);
return (T) this;
}
public T potionEffectAmbient(boolean potionEffectAmbient) {
((LivingEntityDataProvider) provider).setPotionEffectAmbient(potionEffectAmbient);
return (T) this;
}
public T arrowInBodyCount(int arrowInBodyCount) {
((LivingEntityDataProvider) provider).setArrowInBodyCount(arrowInBodyCount);
return (T) this;
}
public T beeStingsInBodyCount(int beeStingsInBodyCount) {
((LivingEntityDataProvider) provider).setBeeStingsInBodyCount(beeStingsInBodyCount);
return (T) this;
}
public T sleepingPosition(@Nullable Vector3i sleepingPosition) {
((LivingEntityDataProvider) provider).setSleepingPosition(sleepingPosition);
return (T) this;
}
}
}
@@ -0,0 +1,168 @@
/*
* 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.entity.data.provider;
import com.github.retrooper.packetevents.protocol.entity.data.EntityData;
import com.github.retrooper.packetevents.protocol.entity.data.EntityDataTypes;
import com.github.retrooper.packetevents.protocol.nbt.NBTCompound;
import com.github.retrooper.packetevents.protocol.player.HumanoidArm;
import com.github.retrooper.packetevents.protocol.player.SkinSection;
import java.util.List;
public class PlayerDataProvider extends LivingEntityDataProvider {
private float additionalHealth;
private int score;
private byte skinPartsMask = SkinSection.ALL.getMask();
private HumanoidArm mainArm = HumanoidArm.RIGHT;
private NBTCompound leftShoulderNBT = new NBTCompound();
private NBTCompound rightShoulderNBT = new NBTCompound();
public float getAdditionalHealth() {
return additionalHealth;
}
public void setAdditionalHealth(float additionalHealth) {
this.additionalHealth = additionalHealth;
}
public int getScore() {
return score;
}
public void setScore(int score) {
this.score = score;
}
public byte getSkinPartsMask() {
return skinPartsMask;
}
public void setSkinPartsMask(byte skinPartsMask) {
this.skinPartsMask = skinPartsMask;
}
public HumanoidArm getMainArm() {
return mainArm;
}
public void setMainArm(HumanoidArm mainArm) {
this.mainArm = mainArm;
}
public NBTCompound getLeftShoulderNBT() {
return leftShoulderNBT;
}
public void setLeftShoulderNBT(NBTCompound leftShoulderNBT) {
this.leftShoulderNBT = leftShoulderNBT;
}
public NBTCompound getRightShoulderNBT() {
return rightShoulderNBT;
}
public void setRightShoulderNBT(NBTCompound rightShoulderNBT) {
this.rightShoulderNBT = rightShoulderNBT;
}
public static PlayerBuilder<PlayerBuilder> builderPlayer() {
return new PlayerBuilder<>(new PlayerDataProvider());
}
@Override
public List<EntityData> encode() {
List<EntityData> metadata = super.encode();
metadata.add(new EntityData(15, EntityDataTypes.FLOAT, additionalHealth));
metadata.add(new EntityData(16, EntityDataTypes.INT, score));
metadata.add(new EntityData(17, EntityDataTypes.BYTE, skinPartsMask));
metadata.add(new EntityData(18, EntityDataTypes.BYTE, (byte) mainArm.ordinal()));
metadata.add(new EntityData(19, EntityDataTypes.NBT, leftShoulderNBT));
metadata.add(new EntityData(20, EntityDataTypes.NBT, rightShoulderNBT));
return metadata;
}
@Override
public void decode(List<EntityData> data) {
super.decode(data);
for (EntityData entityData : data) {
switch (entityData.getIndex()) {
case 15:
additionalHealth = (float) entityData.getValue();
break;
case 16:
score = (int) entityData.getValue();
break;
case 17:
skinPartsMask = (byte) entityData.getValue();
break;
case 18:
mainArm = HumanoidArm.VALUES[(byte) entityData.getValue()];
break;
case 19:
leftShoulderNBT = (NBTCompound) entityData.getValue();
break;
case 20:
rightShoulderNBT = (NBTCompound) entityData.getValue();
break;
}
}
}
public static class PlayerBuilder<T extends PlayerBuilder> extends LivingEntityDataProvider.LivingEntityBuilder<T> {
public PlayerBuilder(PlayerDataProvider entityDataProvider) {
super(entityDataProvider);
}
public T additionalHealth(float additionalHealth) {
((PlayerDataProvider)provider).setAdditionalHealth(additionalHealth);
return (T) this;
}
public T score(int score) {
((PlayerDataProvider)provider).setScore(score);
return (T) this;
}
public T skinPartsMask(byte skinPartsMask) {
((PlayerDataProvider)provider).setSkinPartsMask(skinPartsMask);
return (T)this;
}
public T skinParts(SkinSection skinSections) {
((PlayerDataProvider)provider).setSkinPartsMask(skinSections.getMask());
return (T)this;
}
public T mainArm(HumanoidArm mainArm) {
((PlayerDataProvider)provider).setMainArm(mainArm);
return (T)this;
}
public T leftShoulderNBT(NBTCompound leftShoulderNBT) {
((PlayerDataProvider)provider).setLeftShoulderNBT(leftShoulderNBT);
return (T)this;
}
public T rightShoulderNBT(NBTCompound rightShoulderNBT) {
((PlayerDataProvider)provider).setRightShoulderNBT(rightShoulderNBT);
return (T)this;
}
}
}
@@ -31,7 +31,6 @@ public enum EntityPose {
DYING,
CROAKING,
USING_TONGUE,
SITTING,
ROARING,
SNIFFING,
EMERGING,
@@ -41,9 +40,6 @@ public enum EntityPose {
if (this == DYING && version.isOlderThan(ClientVersion.V_1_17)) {
return 6;
}
if (this.ordinal() >= 11 && version.isOlderThan(ClientVersion.V_1_19_3)) {
return this.ordinal() - 1;
}
return ordinal();
}
@@ -52,10 +48,6 @@ public enum EntityPose {
if (id == 6 && version.isOlderThan(ClientVersion.V_1_17)) {
return DYING;
}
// The SITTING pose was added in 1.19.3, shifting Warden's poses by 1
if (id >= 10 && version.isOlderThan(ClientVersion.V_1_19_3)) {
id++;
}
return values()[id];
}
}
@@ -1,91 +0,0 @@
/*
* 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.entity.transform;
import com.github.retrooper.packetevents.protocol.entity.type.EntityType;
import com.github.retrooper.packetevents.protocol.nbt.NBTCompound;
import com.github.retrooper.packetevents.protocol.player.UserProfile;
import org.jetbrains.annotations.Nullable;
import java.util.Optional;
public class EntityTransformType {
public static final EntityTransformType IDENTITY = new EntityTransformType(null, 1.0F, null);
private @Nullable TypeModifier typeModifier;
private float scale;
private @Nullable UserProfile playerSkin;
//Scale must be between 0.1F and 16.0F
public EntityTransformType(@Nullable TypeModifier typeModifier, float scale, @Nullable UserProfile playerSkin) {
this.typeModifier = typeModifier;
this.scale = scale;
this.playerSkin = playerSkin;
}
public Optional<TypeModifier> getTypeModifier() {
return Optional.ofNullable(typeModifier);
}
public void setTypeModifier(@Nullable TypeModifier typeModifier) {
this.typeModifier = typeModifier;
}
public float getScale() {
return scale;
}
public void setScale(float scale) {
this.scale = scale;
}
public Optional<UserProfile> getPlayerSkin() {
return Optional.ofNullable(playerSkin);
}
public void setPlayerSkin(@Nullable UserProfile playerSkin) {
this.playerSkin = playerSkin;
}
public static class TypeModifier {
private EntityType entityType;
private @Nullable NBTCompound tag;
public TypeModifier(EntityType entityType, @Nullable NBTCompound tag) {
this.entityType = entityType;
this.tag = tag;
}
public EntityType getEntityType() {
return entityType;
}
public void setEntityType(EntityType entityType) {
this.entityType = entityType;
}
public Optional<NBTCompound> getTag() {
return Optional.ofNullable(tag);
}
public void setTag(@Nullable NBTCompound tag) {
this.tag = tag;
}
}
}
@@ -43,10 +43,7 @@ public class EntityTypes {
ClientVersion.V_1_16,
ClientVersion.V_1_16_2,
ClientVersion.V_1_17,
ClientVersion.V_1_19,
ClientVersion.V_1_19_3,
ClientVersion.V_1_19_4,
ClientVersion.V_1_20_3);
ClientVersion.V_1_19);
private static final TypesBuilder LEGACY_TYPES_BUILDER = new TypesBuilder("entity/legacy_entity_type_mappings",
ClientVersion.V_1_8,
ClientVersion.V_1_9,
@@ -181,7 +178,6 @@ public class EntityTypes {
public static final EntityType BOAT = define("boat", ENTITY);
public static final EntityType CHEST_BOAT = define("chest_boat", BOAT);
public static final EntityType CAT = define("cat", ABSTRACT_TAMEABLE_ANIMAL);
public static final EntityType CAMEL = define("camel", ABSTRACT_HORSE);
public static final EntityType SPIDER = define("spider", ABSTRACT_MONSTER);
public static final EntityType CAVE_SPIDER = define("cave_spider", SPIDER);
public static final EntityType CHICKEN = define("chicken", ABSTRACT_ANIMAL);
@@ -302,16 +298,4 @@ 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);
// 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);
}
@@ -125,7 +125,7 @@ public class ItemStack {
}
public ItemStack copy() {
return cachedIsEmpty ? EMPTY : new ItemStack(type, amount, nbt == null ? null : nbt.copy(), legacyData);
return cachedIsEmpty ? EMPTY : new ItemStack(type, amount, nbt == null ? new NBTCompound() : nbt.copy(), legacyData);
}
@Nullable
@@ -258,16 +258,7 @@ public class ItemStack {
}
public static boolean tagMatches(ItemStack left, ItemStack right) {
if (left == right) {
return true;
}
if (left == null) {
return right.isEmpty();
}
if (right == null) {
return left.isEmpty();
}
return Objects.equals(left.nbt, right.nbt);
return left.isEmpty() && right.isEmpty() || (!left.isEmpty() && !right.isEmpty() && ((left.nbt != null || right.nbt == null) && (left.nbt == null || left.nbt.equals(right.nbt))));
}
@Override
@@ -27,14 +27,7 @@ import com.github.retrooper.packetevents.util.TypesBuilderData;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
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.*;
import java.util.stream.Collectors;
public class ItemTypes {
@@ -51,11 +44,7 @@ public class ItemTypes {
ClientVersion.V_1_16_2,
ClientVersion.V_1_17,
ClientVersion.V_1_18,
ClientVersion.V_1_19,
ClientVersion.V_1_19_3,
ClientVersion.V_1_19_4,
ClientVersion.V_1_20,
ClientVersion.V_1_20_3);
ClientVersion.V_1_19);
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();
@@ -636,11 +625,7 @@ 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 SHORT_GRASS = builder("short_grass").setMaxAmount(64).setPlacedType(StateTypes.SHORT_GRASS).build();
@Deprecated
public static final ItemType GRASS = SHORT_GRASS;
public static final ItemType GRASS = builder("grass").setMaxAmount(64).setPlacedType(StateTypes.GRASS).build();
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();
@@ -1213,175 +1198,6 @@ public class ItemTypes {
public static final ItemType DARK_OAK_CHEST_BOAT = builder("dark_oak_chest_boat").setMaxAmount(1).build();
public static final ItemType MANGROVE_BOAT = builder("mangrove_boat").setMaxAmount(1).build();
public static final ItemType MANGROVE_CHEST_BOAT = builder("mangrove_chest_boat").setMaxAmount(1).build();
public static ItemType CHERRY_PLANKS = builder("CHERRY_PLANKS").setMaxAmount(64).setPlacedType(StateTypes.CHERRY_PLANKS).build();
public static ItemType BAMBOO_PLANKS = builder("BAMBOO_PLANKS").setMaxAmount(64).setPlacedType(StateTypes.BAMBOO_PLANKS).build();
public static ItemType BAMBOO_MOSAIC = builder("BAMBOO_MOSAIC").setMaxAmount(64).setPlacedType(StateTypes.BAMBOO_MOSAIC).build();
public static ItemType CHERRY_SAPLING = builder("CHERRY_SAPLING").setMaxAmount(64).setPlacedType(StateTypes.CHERRY_SAPLING).build();
public static ItemType SUSPICIOUS_SAND = builder("SUSPICIOUS_SAND").setMaxAmount(64).setPlacedType(StateTypes.SUSPICIOUS_SAND).build();
public static ItemType CHERRY_LOG = builder("CHERRY_LOG").setMaxAmount(64).setPlacedType(StateTypes.CHERRY_LOG).build();
public static ItemType BAMBOO_BLOCK = builder("BAMBOO_BLOCK").setMaxAmount(64).setPlacedType(StateTypes.BAMBOO_BLOCK).build();
public static ItemType STRIPPED_CHERRY_LOG = builder("STRIPPED_CHERRY_LOG").setMaxAmount(64).setPlacedType(StateTypes.STRIPPED_CHERRY_LOG).build();
public static ItemType STRIPPED_CHERRY_WOOD = builder("STRIPPED_CHERRY_WOOD").setMaxAmount(64).setPlacedType(StateTypes.STRIPPED_CHERRY_WOOD).build();
public static ItemType STRIPPED_BAMBOO_BLOCK = builder("STRIPPED_BAMBOO_BLOCK").setMaxAmount(64).setPlacedType(StateTypes.STRIPPED_BAMBOO_BLOCK).build();
public static ItemType CHERRY_WOOD = builder("CHERRY_WOOD").setMaxAmount(64).setPlacedType(StateTypes.CHERRY_WOOD).build();
public static ItemType CHERRY_LEAVES = builder("CHERRY_LEAVES").setMaxAmount(64).setPlacedType(StateTypes.CHERRY_LEAVES).build();
public static ItemType TORCHFLOWER = builder("TORCHFLOWER").setMaxAmount(64).setPlacedType(StateTypes.TORCHFLOWER).build();
public static ItemType PINK_PETALS = builder("PINK_PETALS").setMaxAmount(64).setPlacedType(StateTypes.PINK_PETALS).build();
public static ItemType CHERRY_SLAB = builder("CHERRY_SLAB").setMaxAmount(64).setPlacedType(StateTypes.CHERRY_SLAB).build();
public static ItemType BAMBOO_SLAB = builder("BAMBOO_SLAB").setMaxAmount(64).setPlacedType(StateTypes.BAMBOO_SLAB).build();
public static ItemType BAMBOO_MOSAIC_SLAB = builder("BAMBOO_MOSAIC_SLAB").setMaxAmount(64).setPlacedType(StateTypes.BAMBOO_MOSAIC_SLAB).build();
public static ItemType CHISELED_BOOKSHELF = builder("CHISELED_BOOKSHELF").setMaxAmount(64).setPlacedType(StateTypes.CHISELED_BOOKSHELF).build();
public static ItemType DECORATED_POT = builder("DECORATED_POT").setMaxAmount(1).setPlacedType(StateTypes.DECORATED_POT).build();
public static ItemType CHERRY_FENCE = builder("CHERRY_FENCE").setMaxAmount(64).setPlacedType(StateTypes.CHERRY_FENCE).build();
public static ItemType BAMBOO_FENCE = builder("BAMBOO_FENCE").setMaxAmount(64).setPlacedType(StateTypes.BAMBOO_FENCE).build();
public static ItemType CHERRY_STAIRS = builder("CHERRY_STAIRS").setMaxAmount(64).setPlacedType(StateTypes.CHERRY_STAIRS).build();
public static ItemType MANGROVE_STAIRS = builder("MANGROVE_STAIRS").setMaxAmount(64).setPlacedType(StateTypes.MANGROVE_STAIRS).build();
public static ItemType BAMBOO_STAIRS = builder("BAMBOO_STAIRS").setMaxAmount(64).setPlacedType(StateTypes.BAMBOO_STAIRS).build();
public static ItemType BAMBOO_MOSAIC_STAIRS = builder("BAMBOO_MOSAIC_STAIRS").setMaxAmount(64).setPlacedType(StateTypes.BAMBOO_MOSAIC_STAIRS).build();
public static ItemType CHERRY_BUTTON = builder("CHERRY_BUTTON").setMaxAmount(64).setPlacedType(StateTypes.CHERRY_BUTTON).build();
public static ItemType BAMBOO_BUTTON = builder("BAMBOO_BUTTON").setMaxAmount(64).setPlacedType(StateTypes.BAMBOO_BUTTON).build();
public static ItemType CHERRY_PRESSURE_PLATE = builder("CHERRY_PRESSURE_PLATE").setMaxAmount(64).setPlacedType(StateTypes.CHERRY_PRESSURE_PLATE).build();
public static ItemType BAMBOO_PRESSURE_PLATE = builder("BAMBOO_PRESSURE_PLATE").setMaxAmount(64).setPlacedType(StateTypes.BAMBOO_PRESSURE_PLATE).build();
public static ItemType CHERRY_DOOR = builder("CHERRY_DOOR").setMaxAmount(64).setPlacedType(StateTypes.CHERRY_DOOR).build();
public static ItemType BAMBOO_DOOR = builder("BAMBOO_DOOR").setMaxAmount(64).setPlacedType(StateTypes.BAMBOO_DOOR).build();
public static ItemType CHERRY_TRAPDOOR = builder("CHERRY_TRAPDOOR").setMaxAmount(64).setPlacedType(StateTypes.CHERRY_TRAPDOOR).build();
public static ItemType BAMBOO_TRAPDOOR = builder("BAMBOO_TRAPDOOR").setMaxAmount(64).setPlacedType(StateTypes.BAMBOO_TRAPDOOR).build();
public static ItemType CHERRY_FENCE_GATE = builder("CHERRY_FENCE_GATE").setMaxAmount(64).setPlacedType(StateTypes.CHERRY_FENCE_GATE).build();
public static ItemType BAMBOO_FENCE_GATE = builder("BAMBOO_FENCE_GATE").setMaxAmount(64).setPlacedType(StateTypes.BAMBOO_FENCE_GATE).build();
public static ItemType CHERRY_BOAT = builder("CHERRY_BOAT").setMaxAmount(1).build();
public static ItemType CHERRY_CHEST_BOAT = builder("CHERRY_CHEST_BOAT").setMaxAmount(1).build();
public static ItemType BAMBOO_RAFT = builder("BAMBOO_RAFT").setMaxAmount(1).build();
public static ItemType BAMBOO_CHEST_RAFT = builder("BAMBOO_CHEST_RAFT").setMaxAmount(1).build();
public static ItemType CHERRY_SIGN = builder("CHERRY_SIGN").setMaxAmount(16).setPlacedType(StateTypes.CHERRY_SIGN).build();
public static ItemType BAMBOO_SIGN = builder("BAMBOO_SIGN").setMaxAmount(16).setPlacedType(StateTypes.BAMBOO_SIGN).build();
public static ItemType OAK_HANGING_SIGN = builder("OAK_HANGING_SIGN").setMaxAmount(16).setPlacedType(StateTypes.OAK_HANGING_SIGN).build();
public static ItemType SPRUCE_HANGING_SIGN = builder("SPRUCE_HANGING_SIGN").setMaxAmount(16).setPlacedType(StateTypes.SPRUCE_HANGING_SIGN).build();
public static ItemType BIRCH_HANGING_SIGN = builder("BIRCH_HANGING_SIGN").setMaxAmount(16).setPlacedType(StateTypes.BIRCH_HANGING_SIGN).build();
public static ItemType JUNGLE_HANGING_SIGN = builder("JUNGLE_HANGING_SIGN").setMaxAmount(16).setPlacedType(StateTypes.JUNGLE_HANGING_SIGN).build();
public static ItemType ACACIA_HANGING_SIGN = builder("ACACIA_HANGING_SIGN").setMaxAmount(16).setPlacedType(StateTypes.ACACIA_HANGING_SIGN).build();
public static ItemType CHERRY_HANGING_SIGN = builder("CHERRY_HANGING_SIGN").setMaxAmount(16).setPlacedType(StateTypes.CHERRY_HANGING_SIGN).build();
public static ItemType DARK_OAK_HANGING_SIGN = builder("DARK_OAK_HANGING_SIGN").setMaxAmount(16).setPlacedType(StateTypes.DARK_OAK_HANGING_SIGN).build();
public static ItemType MANGROVE_HANGING_SIGN = builder("MANGROVE_HANGING_SIGN").setMaxAmount(16).setPlacedType(StateTypes.MANGROVE_HANGING_SIGN).build();
public static ItemType BAMBOO_HANGING_SIGN = builder("BAMBOO_HANGING_SIGN").setMaxAmount(16).setPlacedType(StateTypes.BAMBOO_HANGING_SIGN).build();
public static ItemType CRIMSON_HANGING_SIGN = builder("CRIMSON_HANGING_SIGN").setMaxAmount(16).setPlacedType(StateTypes.CRIMSON_HANGING_SIGN).build();
public static ItemType WARPED_HANGING_SIGN = builder("WARPED_HANGING_SIGN").setMaxAmount(16).setPlacedType(StateTypes.WARPED_HANGING_SIGN).build();
public static ItemType CAMEL_SPAWN_EGG = builder("CAMEL_SPAWN_EGG").setMaxAmount(64).build();
public static ItemType ENDER_DRAGON_SPAWN_EGG = builder("ENDER_DRAGON_SPAWN_EGG").setMaxAmount(64).build();
public static ItemType IRON_GOLEM_SPAWN_EGG = builder("IRON_GOLEM_SPAWN_EGG").setMaxAmount(64).build();
public static ItemType SNIFFER_SPAWN_EGG = builder("SNIFFER_SPAWN_EGG").setMaxAmount(64).build();
public static ItemType SNOW_GOLEM_SPAWN_EGG = builder("SNOW_GOLEM_SPAWN_EGG").setMaxAmount(64).build();
public static ItemType WITHER_SPAWN_EGG = builder("WITHER_SPAWN_EGG").setMaxAmount(64).build();
public static ItemType PIGLIN_HEAD = builder("PIGLIN_HEAD").setMaxAmount(64).setPlacedType(StateTypes.PIGLIN_HEAD).build();
public static ItemType TORCHFLOWER_SEEDS = builder("TORCHFLOWER_SEEDS").setMaxAmount(64).build();
public static ItemType BRUSH = builder("BRUSH").setMaxAmount(1).build();
public static ItemType NETHERITE_UPGRADE_SMITHING_TEMPLATE = builder("NETHERITE_UPGRADE_SMITHING_TEMPLATE").setMaxAmount(64).build();
public static ItemType SENTRY_ARMOR_TRIM_SMITHING_TEMPLATE = builder("SENTRY_ARMOR_TRIM_SMITHING_TEMPLATE").setMaxAmount(64).build();
public static ItemType DUNE_ARMOR_TRIM_SMITHING_TEMPLATE = builder("DUNE_ARMOR_TRIM_SMITHING_TEMPLATE").setMaxAmount(64).build();
public static ItemType COAST_ARMOR_TRIM_SMITHING_TEMPLATE = builder("COAST_ARMOR_TRIM_SMITHING_TEMPLATE").setMaxAmount(64).build();
public static ItemType WILD_ARMOR_TRIM_SMITHING_TEMPLATE = builder("WILD_ARMOR_TRIM_SMITHING_TEMPLATE").setMaxAmount(64).build();
public static ItemType WARD_ARMOR_TRIM_SMITHING_TEMPLATE = builder("WARD_ARMOR_TRIM_SMITHING_TEMPLATE").setMaxAmount(64).build();
public static ItemType EYE_ARMOR_TRIM_SMITHING_TEMPLATE = builder("EYE_ARMOR_TRIM_SMITHING_TEMPLATE").setMaxAmount(64).build();
public static ItemType VEX_ARMOR_TRIM_SMITHING_TEMPLATE = builder("VEX_ARMOR_TRIM_SMITHING_TEMPLATE").setMaxAmount(64).build();
public static ItemType TIDE_ARMOR_TRIM_SMITHING_TEMPLATE = builder("TIDE_ARMOR_TRIM_SMITHING_TEMPLATE").setMaxAmount(64).build();
public static ItemType SNOUT_ARMOR_TRIM_SMITHING_TEMPLATE = builder("SNOUT_ARMOR_TRIM_SMITHING_TEMPLATE").setMaxAmount(64).build();
public static ItemType RIB_ARMOR_TRIM_SMITHING_TEMPLATE = builder("RIB_ARMOR_TRIM_SMITHING_TEMPLATE").setMaxAmount(64).build();
public static ItemType SPIRE_ARMOR_TRIM_SMITHING_TEMPLATE = builder("SPIRE_ARMOR_TRIM_SMITHING_TEMPLATE").setMaxAmount(64).build();
public static ItemType POTTERY_SHARD_ARCHER = builder("POTTERY_SHARD_ARCHER").setMaxAmount(64).build();
public static ItemType POTTERY_SHARD_PRIZE = builder("POTTERY_SHARD_PRIZE").setMaxAmount(64).build();
public static ItemType POTTERY_SHARD_ARMS_UP = builder("POTTERY_SHARD_ARMS_UP").setMaxAmount(64).build();
public static ItemType POTTERY_SHARD_SKULL = builder("POTTERY_SHARD_SKULL").setMaxAmount(64).build();
//1.20 items
public static ItemType SUSPICIOUS_GRAVEL = builder("SUSPICIOUS_GRAVEL").setMaxAmount(64).build();
public static ItemType PITCHER_PLANT = builder("PITCHER_PLANT").setMaxAmount(64).build();
public static ItemType SNIFFER_EGG = builder("SNIFFER_EGG").setMaxAmount(64).build();
public static ItemType CALIBRATED_SCULK_SENSOR = builder("CALIBRATED_SCULK_SENSOR").setMaxAmount(64).build();
public static ItemType PITCHER_POD = builder("PITCHER_POD").setMaxAmount(64).build();
public static ItemType MUSIC_DISC_RELIC = builder("MUSIC_DISC_RELIC").setMaxAmount(1).setAttributes(ItemAttribute.MUSIC_DISC).build();
public static ItemType WAYFINDER_ARMOR_TRIM_SMITHING_TEMPLATE = builder("WAYFINDER_ARMOR_TRIM_SMITHING_TEMPLATE").setMaxAmount(64).build();
public static ItemType SHAPER_ARMOR_TRIM_SMITHING_TEMPLATE = builder("SHAPER_ARMOR_TRIM_SMITHING_TEMPLATE").setMaxAmount(64).build();
public static ItemType SILENCE_ARMOR_TRIM_SMITHING_TEMPLATE = builder("SILENCE_ARMOR_TRIM_SMITHING_TEMPLATE").setMaxAmount(64).build();
public static ItemType RAISER_ARMOR_TRIM_SMITHING_TEMPLATE = builder("RAISER_ARMOR_TRIM_SMITHING_TEMPLATE").setMaxAmount(64).build();
public static ItemType HOST_ARMOR_TRIM_SMITHING_TEMPLATE = builder("HOST_ARMOR_TRIM_SMITHING_TEMPLATE").setMaxAmount(64).build();
public static ItemType ANGLER_POTTERY_SHERD = builder("ANGLER_POTTERY_SHERD").setMaxAmount(64).build();
public static ItemType ARCHER_POTTERY_SHERD = builder("ARCHER_POTTERY_SHERD").setMaxAmount(64).build();
public static ItemType ARMS_UP_POTTERY_SHERD = builder("ARMS_UP_POTTERY_SHERD").setMaxAmount(64).build();
public static ItemType BLADE_POTTERY_SHERD = builder("BLADE_POTTERY_SHERD").setMaxAmount(64).build();
public static ItemType BREWER_POTTERY_SHERD = builder("BREWER_POTTERY_SHERD").setMaxAmount(64).build();
public static ItemType BURN_POTTERY_SHERD = builder("BURN_POTTERY_SHERD").setMaxAmount(64).build();
public static ItemType DANGER_POTTERY_SHERD = builder("DANGER_POTTERY_SHERD").setMaxAmount(64).build();
public static ItemType EXPLORER_POTTERY_SHERD = builder("EXPLORER_POTTERY_SHERD").setMaxAmount(64).build();
public static ItemType FRIEND_POTTERY_SHERD = builder("FRIEND_POTTERY_SHERD").setMaxAmount(64).build();
public static ItemType HEART_POTTERY_SHERD = builder("HEART_POTTERY_SHERD").setMaxAmount(64).build();
public static ItemType HEARTBREAK_POTTERY_SHERD = builder("HEARTBREAK_POTTERY_SHERD").setMaxAmount(64).build();
public static ItemType HOWL_POTTERY_SHERD = builder("HOWL_POTTERY_SHERD").setMaxAmount(64).build();
public static ItemType MINER_POTTERY_SHERD = builder("MINER_POTTERY_SHERD").setMaxAmount(64).build();
public static ItemType MOURNER_POTTERY_SHERD = builder("MOURNER_POTTERY_SHERD").setMaxAmount(64).build();
public static ItemType PLENTY_POTTERY_SHERD = builder("PLENTY_POTTERY_SHERD").setMaxAmount(64).build();
public static ItemType PRIZE_POTTERY_SHERD = builder("PRIZE_POTTERY_SHERD").setMaxAmount(64).build();
public static ItemType SHEAF_POTTERY_SHERD = builder("SHEAF_POTTERY_SHERD").setMaxAmount(64).build();
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
*/
@@ -1390,17 +1206,14 @@ 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() {
@@ -1408,7 +1221,7 @@ public class ItemTypes {
}
public static Builder builder(String key) {
return new Builder(key.toLowerCase());
return new Builder(key);
}
public static ItemType define(int maxAmount, String key, ItemType craftRemainder, StateType placedType, int maxDurability, List<ItemAttribute> attributesArr) {
@@ -33,7 +33,6 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.function.BiConsumer;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
@@ -131,16 +130,6 @@ public class NBTCodec {
else if (nbt instanceof NBTEnd) {
throw new IllegalStateException("Encountered the NBTEnd tag during the NBT to JSON conversion: " + nbt.toString());
}
else if (nbt instanceof NBTCompound) {
JsonObject jsonObject = new JsonObject();
Map<String, NBT> compoundTags = ((NBTCompound)nbt).getTags();
for (String tagName : compoundTags.keySet()) {
NBT tag = compoundTags.get(tagName);
JsonElement jsonValue = nbtToJson(tag, parseByteAsBool);
jsonObject.add(tagName, jsonValue);
}
return jsonObject;
}
else {
throw new IllegalStateException("Failed to convert NBT to JSON.");
}
@@ -148,15 +137,10 @@ 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 {
final boolean named = serverVersion.isOlderThan(ServerVersion.V_1_20_2);
return DefaultNBTSerializer.INSTANCE.deserializeTag(
new ByteBufInputStream(byteBuf), named);
return (NBTCompound) DefaultNBTSerializer.INSTANCE.deserializeTag(
new ByteBufInputStream(byteBuf));
} catch (IOException e) {
e.printStackTrace();
}
@@ -170,7 +154,7 @@ public class NBTCodec {
Object slicedBuffer = ByteBufHelper.readSlice(byteBuf, length);
try (DataInputStream stream = new DataInputStream(
new GZIPInputStream(new ByteBufInputStream(slicedBuffer)))) {
return DefaultNBTSerializer.INSTANCE.deserializeTag(stream);
return (NBTCompound) DefaultNBTSerializer.INSTANCE.deserializeTag(stream);
}
}
catch (IOException ex) {
@@ -181,15 +165,10 @@ 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) {
boolean named = serverVersion.isOlderThan(ServerVersion.V_1_20_2);
DefaultNBTSerializer.INSTANCE.serializeTag(outputStream, tag, named);
DefaultNBTSerializer.INSTANCE.serializeTag(outputStream, tag);
} else {
DefaultNBTSerializer.INSTANCE.serializeTag(outputStream, NBTEnd.INSTANCE);
}
@@ -47,33 +47,21 @@ 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;
}
if (named) {
readTagName(from);
}
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;
}
if (named) {
writeTagName(to, "");
}
writeTagName(to, "");
writeTag(to, tag);
}
@@ -23,7 +23,6 @@ import com.github.retrooper.packetevents.manager.server.ServerVersion;
import com.github.retrooper.packetevents.protocol.item.ItemStack;
import com.github.retrooper.packetevents.protocol.player.*;
import com.github.retrooper.packetevents.protocol.world.Location;
import com.github.retrooper.packetevents.wrapper.PacketWrapper;
import com.github.retrooper.packetevents.wrapper.play.server.*;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
@@ -34,7 +33,6 @@ import java.util.*;
public class NPC {
private final int id;
private final UserProfile profile;
private GameMode gamemode;
private Component tabName;
private NamedTextColor nameColor;
private Component prefixName;
@@ -49,11 +47,10 @@ public class NPC {
private ItemStack boots = null;
private final Set<Object> channels = new HashSet<>();
public NPC(UserProfile profile, int entityId, GameMode gamemode, @Nullable Component tabName, @Nullable NamedTextColor nameColor,
public NPC(UserProfile profile, int entityId, @Nullable Component tabName, @Nullable NamedTextColor nameColor,
@Nullable Component prefixName, @Nullable Component suffixName) {
this.profile = profile;
this.id = entityId;
this.gamemode = gamemode;
this.tabName = tabName;
this.nameColor = nameColor;
@@ -62,7 +59,7 @@ public class NPC {
}
public NPC(UserProfile profile, int entityId, @Nullable Component tabName) {
this(profile, entityId, GameMode.SURVIVAL, tabName, null, null, null);
this(profile, entityId, tabName, null, null, null);
}
public NPC(UserProfile profile, int entityId) {
@@ -75,15 +72,9 @@ public class NPC {
public void spawn(Object channel) {
if (hasSpawned(channel)) return;
PacketWrapper<?> playerInfo;
if (PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_19_3)) {
playerInfo = new WrapperPlayServerPlayerInfoUpdate(WrapperPlayServerPlayerInfoUpdate.Action.ADD_PLAYER,
getModernPlayerInfoData());
}
else {
playerInfo = new WrapperPlayServerPlayerInfo(WrapperPlayServerPlayerInfo.Action.ADD_PLAYER, getLegacyPlayerInfoData());
}
PacketEvents.getAPI().getProtocolManager().sendPacket(channel, playerInfo);
WrapperPlayServerPlayerInfo playerInfoPacket =
new WrapperPlayServerPlayerInfo(WrapperPlayServerPlayerInfo.Action.ADD_PLAYER, getPlayerInfoData());
PacketEvents.getAPI().getProtocolManager().sendPacket(channel, playerInfoPacket);
//TODO Later if we want entity metadata, its not supported on newer server versions though(confirm if its mandatory on older versions)
WrapperPlayServerSpawnPlayer spawnPlayer = new WrapperPlayServerSpawnPlayer(getId(),
@@ -190,44 +181,16 @@ public class NPC {
public void updateTabPing(int ping) {
setDisplayPing(ping);
for (Object channel : channels) {
PacketWrapper<?> playerInfo;
if (PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_19_3)) {
playerInfo = new WrapperPlayServerPlayerInfoUpdate(WrapperPlayServerPlayerInfoUpdate.Action.UPDATE_LATENCY, getModernPlayerInfoData());
}
else {
playerInfo =
new WrapperPlayServerPlayerInfo(WrapperPlayServerPlayerInfo.Action.UPDATE_LATENCY, getLegacyPlayerInfoData());
}
PacketEvents.getAPI().getProtocolManager().sendPacket(channel, playerInfo);
}
}
public void updateGameMode(GameMode gamemode) {
setGameMode(gamemode);
for (Object channel : channels) {
PacketWrapper<?> playerInfo;
if (PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_19_3)) {
playerInfo = new WrapperPlayServerPlayerInfoUpdate(WrapperPlayServerPlayerInfoUpdate.Action.UPDATE_GAME_MODE,
getModernPlayerInfoData());
}
else {
playerInfo =
new WrapperPlayServerPlayerInfo(WrapperPlayServerPlayerInfo.Action.UPDATE_GAME_MODE, getLegacyPlayerInfoData());
}
WrapperPlayServerPlayerInfo playerInfo =
new WrapperPlayServerPlayerInfo(WrapperPlayServerPlayerInfo.Action.UPDATE_LATENCY, getPlayerInfoData());
PacketEvents.getAPI().getProtocolManager().sendPacket(channel, playerInfo);
}
}
public void changeSkin(UUID skinUUID, List<TextureProperty> skinTextureProperties) {
for (Object channel : channels) {
PacketWrapper<?> playerInfoRemove;
if (PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_19_3)) {
playerInfoRemove = new WrapperPlayServerPlayerInfoRemove(getProfile().getUUID());
}
else {
playerInfoRemove =
new WrapperPlayServerPlayerInfo(WrapperPlayServerPlayerInfo.Action.REMOVE_PLAYER, getLegacyPlayerInfoData());
}
WrapperPlayServerPlayerInfo playerInfoRemove =
new WrapperPlayServerPlayerInfo(WrapperPlayServerPlayerInfo.Action.REMOVE_PLAYER, getPlayerInfoData());
PacketEvents.getAPI().getProtocolManager().sendPacket(channel, playerInfoRemove);
WrapperPlayServerDestroyEntities destroyEntities =
@@ -236,15 +199,8 @@ public class NPC {
getProfile().setTextureProperties(skinTextureProperties);
getProfile().setUUID(skinUUID);
PacketWrapper<?> playerInfoAdd;
if (PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_19_3)) {
playerInfoAdd = new WrapperPlayServerPlayerInfoUpdate(WrapperPlayServerPlayerInfoUpdate.Action.ADD_PLAYER,
getModernPlayerInfoData());
}
else {
playerInfoAdd =
new WrapperPlayServerPlayerInfo(WrapperPlayServerPlayerInfo.Action.ADD_PLAYER, getLegacyPlayerInfoData());
}
WrapperPlayServerPlayerInfo playerInfoAdd =
new WrapperPlayServerPlayerInfo(WrapperPlayServerPlayerInfo.Action.ADD_PLAYER, getPlayerInfoData());
PacketEvents.getAPI().getProtocolManager().sendPacket(channel, playerInfoAdd);
WrapperPlayServerSpawnPlayer spawnPlayer =
@@ -253,7 +209,7 @@ public class NPC {
}
}
public void updateNameTag() {
public void updateNameTag(NPC npc) {
for (Object channel : channels) {
//Destroy team
WrapperPlayServerTeams removeTeam =
@@ -262,8 +218,8 @@ public class NPC {
Optional.empty());
PacketEvents.getAPI().getProtocolManager().sendPacket(channel, removeTeam);
if (this.getNameColor() != null || this.getPrefixName() != null
|| this.getSuffixName() != null) {
if (npc.getNameColor() != null || npc.getPrefixName() != null
|| npc.getSuffixName() != null) {
PacketEvents.getAPI().getProtocolManager().sendPacket(channel, generateTeamsData());
}
}
@@ -411,14 +367,6 @@ public class NPC {
return profile;
}
public GameMode getGameMode() {
return gamemode;
}
public void setGameMode(GameMode gamemode) {
this.gamemode = gamemode;
}
private WrapperPlayServerTeams generateTeamsData() {
return new WrapperPlayServerTeams("custom_name_team",
WrapperPlayServerTeams.TeamMode.CREATE,
@@ -435,17 +383,12 @@ public class NPC {
getProfile().getName());
}
public WrapperPlayServerPlayerInfo.PlayerData getLegacyPlayerInfoData() {
public WrapperPlayServerPlayerInfo.PlayerData getPlayerInfoData() {
return new WrapperPlayServerPlayerInfo.PlayerData(getTabName(),
getProfile(), getGameMode(),
getProfile(), GameMode.SURVIVAL,
getDisplayPing());
}
public WrapperPlayServerPlayerInfoUpdate.PlayerInfo getModernPlayerInfoData() {
return new WrapperPlayServerPlayerInfoUpdate.PlayerInfo(getProfile(), true,
getDisplayPing(), getGameMode(), getTabName(), null);
}
public int getDisplayPing() {
return displayPing;
}
@@ -461,8 +404,4 @@ public class NPC {
public void setLocation(Location location) {
this.location = location;
}
public Set<Object> getChannels() {
return channels;
}
}
@@ -1,9 +0,0 @@
package com.github.retrooper.packetevents.protocol.packettype;
/**
* A Marker interface used to indicate that this packet is originating on
* the server, and is bound to the client.
*/
public interface ClientBoundPacket {
}
@@ -20,46 +20,8 @@ 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.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.packettype.clientbound.*;
import com.github.retrooper.packetevents.protocol.packettype.serverbound.*;
import com.github.retrooper.packetevents.protocol.player.ClientVersion;
import com.github.retrooper.packetevents.util.VersionMapper;
import org.jetbrains.annotations.Nullable;
@@ -88,11 +50,7 @@ public final class PacketType {
ClientVersion.V_1_17,
ClientVersion.V_1_18,
ClientVersion.V_1_19,
ClientVersion.V_1_19_1,
ClientVersion.V_1_19_3,
ClientVersion.V_1_19_4,
ClientVersion.V_1_20_2,
ClientVersion.V_1_20_3);
ClientVersion.V_1_19_1);
//TODO UPDATE Update packet type mappings (serverbound pt. 1)
private static final VersionMapper SERVERBOUND_PLAY_VERSION_MAPPER = new VersionMapper(
@@ -108,21 +66,11 @@ public final class PacketType {
ClientVersion.V_1_16_2,
ClientVersion.V_1_17,
ClientVersion.V_1_19,
ClientVersion.V_1_19_1,
ClientVersion.V_1_19_3,
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);
ClientVersion.V_1_19_1);
public static void prepare() {
PacketType.Play.Client.load();
PacketType.Play.Server.load();
PacketType.Configuration.Server.load();
PREPARED = true;
}
@@ -156,19 +104,13 @@ 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;
}
}
public static class Handshaking {
public enum Client implements PacketTypeConstant, ServerBoundPacket {
public enum Client implements PacketTypeConstant {
HANDSHAKE(0),
/**
* Technically not part of the current protocol, but clients older than 1.7 will send this to initiate Server List Ping.
@@ -196,14 +138,9 @@ public final class PacketType {
public int getId() {
return id;
}
@Override
public PacketSide getSide() {
return PacketSide.CLIENT;
}
}
public enum Server implements PacketTypeConstant, ClientBoundPacket {
public enum Server implements PacketTypeConstant {
LEGACY_SERVER_LIST_RESPONSE(254); //0xFE in hex
private final int id;
@@ -220,16 +157,11 @@ public final class PacketType {
public int getId() {
return id;
}
@Override
public PacketSide getSide() {
return PacketSide.SERVER;
}
}
}
public static class Status {
public enum Client implements PacketTypeConstant, ServerBoundPacket {
public enum Client implements PacketTypeConstant {
REQUEST(0),
PING(1);
@@ -253,15 +185,9 @@ public final class PacketType {
public int getId() {
return id;
}
@Override
public PacketSide getSide() {
return PacketSide.CLIENT;
}
}
public enum Server implements PacketTypeConstant, ClientBoundPacket {
public enum Server implements PacketTypeConstant {
RESPONSE(0),
PONG(1);
@@ -285,22 +211,15 @@ public final class PacketType {
public int getId() {
return id;
}
@Override
public PacketSide getSide() {
return PacketSide.SERVER;
}
}
}
public static class Login {
public enum Client implements PacketTypeConstant, ServerBoundPacket {
public enum Client implements PacketTypeConstant {
LOGIN_START(0),
ENCRYPTION_RESPONSE(1),
///Added in 1.13
LOGIN_PLUGIN_RESPONSE(2),
//Added in 1.20.2
LOGIN_SUCCESS_ACK(3);
LOGIN_PLUGIN_RESPONSE(2);
private final int id;
@@ -316,8 +235,6 @@ 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;
}
@@ -326,14 +243,9 @@ public final class PacketType {
public int getId() {
return id;
}
@Override
public PacketSide getSide() {
return PacketSide.CLIENT;
}
}
public enum Server implements PacketTypeConstant, ClientBoundPacket {
public enum Server implements PacketTypeConstant {
DISCONNECT(0),
ENCRYPTION_REQUEST(1),
LOGIN_SUCCESS(2),
@@ -369,144 +281,11 @@ 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;
}
}
}
public static class Play {
public enum Client implements PacketTypeCommon, ServerBoundPacket {
//Packets that no longer exist on the latest version
CHAT_PREVIEW,
public enum Client implements PacketTypeCommon {
TELEPORT_CONFIRM,
QUERY_BLOCK_NBT,
SET_DIFFICULTY,
@@ -559,16 +338,9 @@ public final class PacketType {
USE_ITEM,
//Added in 1.19
CHAT_COMMAND,
CHAT_PREVIEW,
//Added in 1.19.1
CHAT_ACK,
//Added in 1.19.3
CHAT_SESSION_UPDATE,
//Added in 1.20.2
CHUNK_BATCH_ACK,
CONFIGURATION_ACK,
DEBUG_PING,
//Added in 1.20.3
SLOT_STATE_CHANGE;
CHAT_ACK;
private static int INDEX = 0;
private static final Map<Byte, Map<Integer, PacketTypeCommon>> PACKET_TYPE_ID_MAP = new HashMap<>();
@@ -585,7 +357,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);
}
@@ -617,10 +389,6 @@ public final class PacketType {
loadPacketIds(ServerboundPacketType_1_17.values());
loadPacketIds(ServerboundPacketType_1_19.values());
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)
}
@@ -631,14 +399,9 @@ 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 {
public enum Server implements PacketTypeCommon {
//Packets that are no longer present on latest version
SET_COMPRESSION,
MAP_CHUNK_BULK,
@@ -654,18 +417,12 @@ public final class PacketType {
SPAWN_PAINTING,
SCULK_VIBRATION_SIGNAL,
ACKNOWLEDGE_PLAYER_DIGGING,
CHAT_PREVIEW_PACKET,
NAMED_SOUND_EFFECT,
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,
@@ -684,6 +441,7 @@ public final class PacketType {
SET_SLOT,
SET_COOLDOWN,
PLUGIN_MESSAGE,
NAMED_SOUND_EFFECT,
DISCONNECT,
ENTITY_STATUS,
EXPLOSION,
@@ -712,6 +470,7 @@ public final class PacketType {
END_COMBAT_EVENT,
ENTER_COMBAT_EVENT,
DEATH_COMBAT_EVENT,
PLAYER_INFO,
FACE_PLAYER,
PLAYER_POSITION_AND_LOOK,
UNLOCK_RECIPES,
@@ -764,35 +523,15 @@ public final class PacketType {
//Added in 1.19
ACKNOWLEDGE_BLOCK_CHANGES,
CHAT_PREVIEW_PACKET,
SERVER_DATA,
DISPLAY_CHAT_PREVIEW,
SYSTEM_CHAT_MESSAGE,
//Added in 1.19.1
DELETE_CHAT,
CUSTOM_CHAT_COMPLETIONS,
//Added in 1.19.3
DISGUISED_CHAT,
PLAYER_INFO_REMOVE,
PLAYER_INFO_UPDATE,
//Added in 1.19.4
DAMAGE_EVENT,
HURT_ANIMATION,
BUNDLE,
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;
PLAYER_CHAT_HEADER,
CUSTOM_CHAT_COMPLETIONS;
private static int INDEX = 0;
private static final Map<Byte, Map<Integer, PacketTypeCommon>> PACKET_TYPE_ID_MAP = new HashMap<>();
@@ -821,11 +560,6 @@ 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) {
@@ -857,10 +591,6 @@ public final class PacketType {
loadPacketIds(ClientboundPacketType_1_18.values());
loadPacketIds(ClientboundPacketType_1_19.values());
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,7 +18,6 @@
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 {
@@ -28,6 +27,4 @@ public interface PacketTypeCommon {
}
int getId(ClientVersion version);
PacketSide getSide();
}
@@ -20,7 +20,7 @@ package com.github.retrooper.packetevents.protocol.packettype;
import com.github.retrooper.packetevents.protocol.player.ClientVersion;
public interface PacketTypeConstant extends PacketTypeCommon {
public interface PacketTypeConstant extends PacketTypeCommon{
default int getId(ClientVersion version) {
return getId();
}
@@ -1,8 +0,0 @@
package com.github.retrooper.packetevents.protocol.packettype;
/**
* A Marker interface used to indicate that this packet is originating on
* the client, and is bound to the server.
*/
public interface ServerBoundPacket {
}
@@ -1,187 +0,0 @@
/*
* 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_19_3 {
SPAWN_ENTITY,
SPAWN_EXPERIENCE_ORB,
//Removed in 1.19
//SPAWN_LIVING_ENTITY,
//SPAWN_PAINTING,
SPAWN_PLAYER,
//Removed in 1.19
//SCULK_VIBRATION_SIGNAL,
ENTITY_ANIMATION,
STATISTICS,
//Removed in 1.19 and replaced with ACKNOWLEDGE_BLOCK_CHANGES
//ACKNOWLEDGE_PLAYER_DIGGING,
//Added in 1.19
ACKNOWLEDGE_BLOCK_CHANGES,
BLOCK_BREAK_ANIMATION,
BLOCK_ENTITY_DATA,
BLOCK_ACTION,
BLOCK_CHANGE,
BOSS_BAR,
SERVER_DIFFICULTY,
//Removed in 1.19.3
//CHAT_PREVIEW_PACKET,
CLEAR_TITLES,
TAB_COMPLETE,
DECLARE_COMMANDS,
CLOSE_WINDOW,
WINDOW_ITEMS,
WINDOW_PROPERTY,
SET_SLOT,
SET_COOLDOWN,
//Added in 1.19.1
CUSTOM_CHAT_COMPLETIONS,
PLUGIN_MESSAGE,
//Removed in 1.19.3
//NAMED_SOUND_EFFECT,
//Added in 1.19.1
DELETE_CHAT,
DISCONNECT,
//Added in 1.19.3
DISGUISED_CHAT,
ENTITY_STATUS,
EXPLOSION,
UNLOAD_CHUNK,
CHANGE_GAME_STATE,
OPEN_HORSE_WINDOW,
INITIALIZE_WORLD_BORDER,
KEEP_ALIVE,
//This is also used for lighting
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,
CRAFT_RECIPE_RESPONSE,
PLAYER_ABILITIES,
//Removed in 1.19.3
//PLAYER_CHAT_HEADER,
//Interesting changes in 1.19. This is used by vanilla to broadcast messages sent by clients to all connected clients.
CHAT_MESSAGE,
END_COMBAT_EVENT,
ENTER_COMBAT_EVENT,
DEATH_COMBAT_EVENT,
//Removed in 1.19.3 and replaced with PLAYER_INFO_REMOVE and PLAYER_INFO_UPDATE
//PLAYER_INFO,
//Added in 1.19.3 (read comment above)
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,
//Added in 1.19. Seems like cancelling it surpresses the warning of messages not being verified on the client.
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,
//Deleted in 1.19.3
//DISPLAY_CHAT_PREVIEW,
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,
STOP_SOUND,
//Added in 1.19. This is now used only for system messages by vanilla.
SYSTEM_CHAT_MESSAGE,
PLAYER_LIST_HEADER_AND_FOOTER,
NBT_QUERY_RESPONSE,
COLLECT_ITEM,
ENTITY_TELEPORT,
UPDATE_ADVANCEMENTS,
UPDATE_ATTRIBUTES,
//Added in 1.19.3
UPDATE_ENABLED_FEATURES,
ENTITY_EFFECT,
DECLARE_RECIPES,
TAGS
}
@@ -1,133 +0,0 @@
/*
* 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_19_4 {
BUNDLE, // New packet
SPAWN_ENTITY,
SPAWN_EXPERIENCE_ORB,
SPAWN_PLAYER,
ENTITY_ANIMATION,
STATISTICS,
ACKNOWLEDGE_BLOCK_CHANGES,
BLOCK_BREAK_ANIMATION,
BLOCK_ENTITY_DATA,
BLOCK_ACTION,
BLOCK_CHANGE,
BOSS_BAR,
SERVER_DIFFICULTY,
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, // New packet
DELETE_CHAT,
DISCONNECT,
DISGUISED_CHAT,
ENTITY_STATUS,
EXPLOSION,
UNLOAD_CHUNK,
CHANGE_GAME_STATE,
OPEN_HORSE_WINDOW,
HURT_ANIMATION, // New packet (?)
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,
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,
STOP_SOUND,
SYSTEM_CHAT_MESSAGE,
PLAYER_LIST_HEADER_AND_FOOTER,
NBT_QUERY_RESPONSE,
COLLECT_ITEM,
ENTITY_TELEPORT,
UPDATE_ADVANCEMENTS,
UPDATE_ATTRIBUTES,
UPDATE_ENABLED_FEATURES,
ENTITY_EFFECT,
DECLARE_RECIPES,
TAGS
}
@@ -1,137 +0,0 @@
/*
* 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,
}
@@ -1,140 +0,0 @@
/*
* 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,
}
@@ -1,32 +0,0 @@
/*
* 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,
}
@@ -1,33 +0,0 @@
/*
* 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,
}
@@ -1,86 +0,0 @@
/*
* 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_19_3 {
TELEPORT_CONFIRM,
QUERY_BLOCK_NBT,
SET_DIFFICULTY,
//Added in 1.19.1
CHAT_ACK,
//Added in 1.19
CHAT_COMMAND,
//Interesting changes in 1.19
CHAT_MESSAGE,
//Removed in 1.19.3
//CHAT_PREVIEW,
CLIENT_STATUS,
CLIENT_SETTINGS,
TAB_COMPLETE,
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,
CRAFT_RECIPE_REQUEST,
PLAYER_ABILITIES,
PLAYER_DIGGING,
ENTITY_ACTION,
STEER_VEHICLE,
PONG,
//Added in 1.19.3
CHAT_SESSION_UPDATE,
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
}
@@ -1,84 +0,0 @@
/*
* 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_19_4 {
TELEPORT_CONFIRM,
QUERY_BLOCK_NBT,
SET_DIFFICULTY,
//Added in 1.19.1
CHAT_ACK,
//Added in 1.19
CHAT_COMMAND,
//Interesting changes in 1.19
CHAT_MESSAGE,
CHAT_SESSION_UPDATE, // Moved around in 1.19.4
//Removed in 1.19.3
//CHAT_PREVIEW,
CLIENT_STATUS,
CLIENT_SETTINGS,
TAB_COMPLETE,
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,
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
}
@@ -1,77 +0,0 @@
/*
* 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,
}
@@ -1,78 +0,0 @@
/*
* 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,83 +18,54 @@
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;
import java.util.Optional;
public class ParticleVibrationData extends ParticleData {
public enum PositionType {
BLOCK("minecraft:block"), ENTITY("minecraft:entity");
public enum PositionType implements MappedEntity {
private final String name;
BLOCK(new ResourceLocation("minecraft:block")),
ENTITY(new ResourceLocation("minecraft:entity"));
private final ResourceLocation name;
PositionType(ResourceLocation name) {
PositionType(String name) {
this.name = name;
}
@Override
public ResourceLocation getName() {
public String getName() {
return 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)) {
public static PositionType getByName(String 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; // Removed in 1.19.4
private Vector3i startingPosition;
private PositionType type;
private @Nullable Vector3i blockPosition;
private @Nullable Integer entityId;
private final Optional<Vector3i> blockPosition;
private final Optional<Integer> entityId;
private int ticks;
public ParticleVibrationData(Vector3i startingPosition, @Nullable Vector3i blockPosition, int ticks) {
public ParticleVibrationData(Vector3i startingPosition, Vector3i blockPosition, int ticks) {
this.startingPosition = startingPosition;
this.type = PositionType.BLOCK;
this.blockPosition = blockPosition;
this.entityId = null;
this.blockPosition = Optional.of(blockPosition);
this.entityId = Optional.empty();
this.ticks = ticks;
}
public ParticleVibrationData(Vector3i startingPosition, int entityId, int ticks) {
this.startingPosition = startingPosition;
this.type = PositionType.ENTITY;
this.blockPosition = null;
this.entityId = entityId;
this.blockPosition = Optional.empty();
this.entityId = Optional.of(entityId);
this.ticks = ticks;
}
@@ -111,19 +82,11 @@ public class ParticleVibrationData extends ParticleData {
}
public Optional<Vector3i> getBlockPosition() {
return Optional.ofNullable(blockPosition);
}
public void setBlockPosition(@Nullable Vector3i blockPosition) {
this.blockPosition = blockPosition;
return blockPosition;
}
public Optional<Integer> getEntityId() {
return Optional.ofNullable(entityId);
}
public void setEntityId(int entityId) {
this.entityId = entityId;
return entityId;
}
public int getTicks() {
@@ -135,44 +98,28 @@ public class ParticleVibrationData extends ParticleData {
}
public static ParticleVibrationData read(PacketWrapper<?> wrapper) {
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);
}
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());
}
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);
else if (positionType == PositionType.ENTITY) {
return new ParticleVibrationData(startingPos, wrapper.readVarInt(), wrapper.readVarInt());
}
else {
throw new IllegalArgumentException("Unknown position type: " + positionTypeName);
}
}
public static void write(PacketWrapper<?> wrapper, ParticleVibrationData data) {
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());
}
wrapper.writeBlockPosition(data.getStartingPosition());
wrapper.writeString(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());
@@ -43,10 +43,7 @@ public class ParticleTypes {
ClientVersion.V_1_16_2,
ClientVersion.V_1_17,
ClientVersion.V_1_18,
ClientVersion.V_1_19,
ClientVersion.V_1_19_4,
ClientVersion.V_1_20,
ClientVersion.V_1_20_3);
ClientVersion.V_1_19);
public static ParticleType define(String key, Function<PacketWrapper<?>, ParticleData> readDataFunction, BiConsumer<PacketWrapper<?>, ParticleData> writeDataFunction) {
TypesBuilderData data = TYPES_BUILDER.defineFromArray(key);
@@ -205,20 +202,6 @@ public class ParticleTypes {
public static final ParticleType ELECTRIC_SPARK = define("electric_spark");
public static final ParticleType SCRAPE = define("scrape");
public static final ParticleType SHRIEK = define("shriek", ParticleShriekData::read, (wrapper, data) -> ParticleShriekData.write(wrapper, (ParticleShriekData) data));
//Added in 1.19.3, BUT REMOVED in 1.20, replaced with CHERRY_LEAVES
public static final ParticleType DRIPPING_CHERRY_LEAVES = define("dripping_cherry_leaves");
public static final ParticleType FALLING_CHERRY_LEAVES = define("falling_cherry_leaves");
public static final ParticleType LANDING_CHERRY_LEAVES = define("landing_cherry_leaves");
//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();
@@ -22,10 +22,6 @@ import com.github.retrooper.packetevents.manager.server.ServerVersion;
import com.github.retrooper.packetevents.manager.server.VersionComparison;
import org.jetbrains.annotations.NotNull;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
/**
* Client Version.
* This is a nice tool for minecraft's client protocol versions.
@@ -80,19 +76,11 @@ public enum ClientVersion {
V_1_19(759),
V_1_19_1(760),
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_3.protocolVersion + 1, true),
HIGHER_THAN_SUPPORTED_VERSIONS(V_1_19_1.protocolVersion + 1, true),
UNKNOWN(-1, true);
@@ -100,9 +88,15 @@ public enum ClientVersion {
private static final ClientVersion[] REVERSED_VALUES;
static {
List<ClientVersion> valuesAsList = Arrays.asList(values());
Collections.reverse(valuesAsList);
REVERSED_VALUES = valuesAsList.toArray(new ClientVersion[0]);
REVERSED_VALUES = values();
int i = 0;
int j = REVERSED_VALUES.length - 1;
ClientVersion tmp;
while (j > i) {
tmp = REVERSED_VALUES[j];
REVERSED_VALUES[j--] = REVERSED_VALUES[i];
REVERSED_VALUES[i++] = tmp;
}
}
private static final int LOWEST_SUPPORTED_PROTOCOL_VERSION = LOWER_THAN_SUPPORTED_VERSIONS.protocolVersion + 1;
@@ -171,6 +165,7 @@ public enum ClientVersion {
if (version.protocolVersion > protocolVersion) {
break;
} else if (version.protocolVersion == protocolVersion) {
//Cache for next time
return version;
}
}
@@ -280,4 +275,4 @@ public enum ClientVersion {
return false;
}
}
}
}
@@ -18,6 +18,8 @@
package com.github.retrooper.packetevents.protocol.player;
import org.jetbrains.annotations.Nullable;
/**
* Representation of a player's game mode.
*
@@ -36,15 +38,11 @@ public enum GameMode {
return ordinal();
}
@Nullable
public static GameMode getById(int id) {
// Minecraft defaults to a survival gamemode if invalid
if (id < 0 || id >= VALUES.length) {
return GameMode.SURVIVAL;
if (id == -1) {
return null;
}
return VALUES[id];
}
public static GameMode defaultGameMode() {
return SURVIVAL;
}
}
@@ -1,50 +0,0 @@
/*
* 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.player;
import java.security.PublicKey;
import java.time.Instant;
public class PublicProfileKey {
private final Instant expiresAt;
private final PublicKey key;
private final byte[] keySignature;
public PublicProfileKey(Instant expiresAt, PublicKey key, byte[] keySignature) {
this.expiresAt = expiresAt;
this.key = key;
this.keySignature = keySignature;
}
public Instant getExpiresAt() {
return expiresAt;
}
public PublicKey getKey() {
return key;
}
public byte[] getKeySignature() {
return keySignature;
}
public boolean hasExpired() {
return expiresAt.isBefore(Instant.now());
}
}
@@ -29,8 +29,7 @@ import com.github.retrooper.packetevents.protocol.chat.message.ChatMessageLegacy
import com.github.retrooper.packetevents.protocol.chat.message.ChatMessage_v1_16;
import com.github.retrooper.packetevents.protocol.nbt.NBTCompound;
import com.github.retrooper.packetevents.protocol.nbt.NBTList;
import com.github.retrooper.packetevents.protocol.world.Dimension;
import com.github.retrooper.packetevents.util.adventure.AdventureSerializer;
import com.github.retrooper.packetevents.util.AdventureSerializer;
import com.github.retrooper.packetevents.wrapper.PacketWrapper;
import com.github.retrooper.packetevents.wrapper.play.server.*;
import net.kyori.adventure.text.Component;
@@ -42,22 +41,19 @@ import java.util.UUID;
public class User {
private final Object channel;
private ConnectionState decoderState;
private ConnectionState encoderState;
private ConnectionState connectionState;
private ClientVersion clientVersion;
private final UserProfile profile;
private int entityId = -1;
private int minWorldHeight = 0;
private int totalWorldHeight = 256;
private List<NBTCompound> worldNBT;
private Dimension dimension = new Dimension(0);
public User(Object channel,
ConnectionState connectionState, ClientVersion clientVersion,
UserProfile profile) {
this.channel = channel;
this.decoderState = connectionState;
this.encoderState = connectionState;
this.connectionState = connectionState;
this.clientVersion = clientVersion;
this.profile = profile;
}
@@ -71,37 +67,11 @@ public class User {
}
public ConnectionState getConnectionState() {
ConnectionState decoderState = this.decoderState;
ConnectionState encoderState = this.encoderState;
if (decoderState != encoderState) {
throw new IllegalArgumentException("Can't get common connection state: " + decoderState + " != " + encoderState);
}
return decoderState;
return connectionState;
}
public void setConnectionState(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!");
this.connectionState = connectionState;
}
public ClientVersion getClientVersion() {
@@ -178,8 +148,7 @@ public class User {
}
public void sendMessage(Component component, ChatType type) {
ServerVersion version = PacketEvents.getAPI().getInjector().isProxy() ? getClientVersion().toServerVersion() :
PacketEvents.getAPI().getServerManager().getVersion();
ServerVersion version = PacketEvents.getAPI().getServerManager().getVersion();
PacketWrapper<?> chatPacket;
if (version.isNewerThanOrEquals(ServerVersion.V_1_19)) {
chatPacket = new WrapperPlayServerSystemChatMessage(false, component);
@@ -203,9 +172,7 @@ public class User {
}
public void sendTitle(Component title, Component subtitle, int fadeInTicks, int stayTicks, int fadeOutTicks) {
ServerVersion version = PacketEvents.getAPI().getInjector().isProxy() ? getClientVersion().toServerVersion() :
PacketEvents.getAPI().getServerManager().getVersion();
boolean modern = version.isNewerThanOrEquals(ServerVersion.V_1_17);
boolean modern = PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_17);
PacketWrapper<?> animation;
PacketWrapper<?> setTitle = null;
PacketWrapper<?> setSubtitle = null;
@@ -263,19 +230,8 @@ public class User {
this.worldNBT = worldNBT.getTags();
}
public Dimension getDimension() {
return dimension;
}
public void setDimension(Dimension dimension) {
this.dimension = dimension;
}
@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.MappedEntity;
import com.github.retrooper.packetevents.protocol.mapper.StaticMappedEntity;
public interface PotionType extends MappedEntity {
public interface PotionType extends StaticMappedEntity {
}
@@ -18,8 +18,6 @@
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;
@@ -39,17 +37,14 @@ public class PotionTypes {
}
@Override
public int getId(ClientVersion version) {
if (version.isOlderThan(ClientVersion.V_1_20_2)) {
return id + 1;
}
public int getId() {
return id;
}
@Override
public boolean equals(Object obj) {
if (obj instanceof PotionType) {
return getName().equals(((PotionType)obj).getName());
return getId() == ((PotionType)obj).getId();
}
return false;
}
@@ -57,8 +52,7 @@ public class PotionTypes {
//minecraft:speed would be a string for example
POTION_TYPE_MAP.put(potionType.getName().toString(), potionType);
//We map the 1.20.2 IDs
POTION_TYPE_ID_MAP.put((byte) potionType.getId(ClientVersion.V_1_20_2), potionType);
POTION_TYPE_ID_MAP.put((byte) potionType.getId(), potionType);
return potionType;
}
@@ -67,55 +61,42 @@ public class PotionTypes {
return POTION_TYPE_MAP.get(name);
}
@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
}
@Nullable
public static PotionType getById(int id) {
return POTION_TYPE_ID_MAP.get((byte)id);
}
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);
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);
}
@@ -20,8 +20,8 @@ package com.github.retrooper.packetevents.protocol.stats;
import com.github.retrooper.packetevents.PacketEvents;
import com.github.retrooper.packetevents.manager.server.ServerVersion;
import com.github.retrooper.packetevents.util.AdventureSerializer;
import com.github.retrooper.packetevents.util.MappingHelper;
import com.github.retrooper.packetevents.util.adventure.AdventureSerializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import net.kyori.adventure.text.Component;
@@ -67,6 +67,5 @@ public enum MaterialType {
AMETHYST,
POWDER_SNOW,
FROGSPAWN,
FROGLIGHT,
DECORATED_POT
FROGLIGHT
}
@@ -32,26 +32,9 @@ import com.github.retrooper.packetevents.protocol.world.chunk.storage.LegacyFlex
import com.github.retrooper.packetevents.protocol.world.states.WrappedBlockState;
public interface BaseChunk {
int getBlockId(int x, int y, int z);
WrappedBlockState get(ClientVersion version, 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);
}
default void set(int x, int y, int z, WrappedBlockState state) {
set(x, y, z, state.getGlobalId());
}
void set(int x, int y, int z, int combinedID);
// We don't use ClientVersion, but it's here to maintain backwards compatibility.
default void set(ClientVersion version, int x, int y, int z, int combinedID) {
set(x, y, z, combinedID);
}
void set(ClientVersion version, int x, int y, int z, int combinedID);
boolean isEmpty();
@@ -84,11 +84,11 @@ public class Chunk_v1_9 implements BaseChunk {
}
@Override
public int getBlockId(int x, int y, int z) {
return this.dataPalette.get(x, y, z);
public WrappedBlockState get(ClientVersion version, int x, int y, int z) {
return WrappedBlockState.getByGlobalId(version, this.dataPalette.get(x, y, z));
}
public void set(int x, int y, int z, int state) {
public void set(ClientVersion version, int x, int y, int z, int state) {
int curr = this.dataPalette.set(x, y, z, state);
// Pre-1.14 we don't get block counts
if (blockCount == Integer.MAX_VALUE) return;
@@ -44,12 +44,13 @@ public class Chunk_v1_7 implements BaseChunk {
}
@Override
public int getBlockId(int x, int y, int z) {
return blocks.get(x, y, z) | (extendedBlocks.get(x, y, z) << 12);
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);
}
@Override
public void set(int x, int y, int z, int combinedID) {
public void set(ClientVersion version, int x, int y, int z, int combinedID) {
blocks.set(x, y, z, combinedID & 0xFF);
extendedBlocks.set(x, y, z, combinedID >> 12);
}
@@ -52,12 +52,13 @@ public class Chunk_v1_8 implements BaseChunk {
}
@Override
public int getBlockId(int x, int y, int z) {
return this.blocks.get(x, y, z);
public WrappedBlockState get(ClientVersion version, int x, int y, int z) {
int combinedID = this.blocks.get(x, y, z);
return WrappedBlockState.getByGlobalId(version, combinedID);
}
@Override
public void set(int x, int y, int z, int combinedID) {
public void set(ClientVersion version, int x, int y, int z, int combinedID) {
this.blocks.set(x, y, z, combinedID);
}
@@ -61,12 +61,12 @@ public class Chunk_v1_18 implements BaseChunk {
}
@Override
public int getBlockId(int x, int y, int z) {
return this.chunkData.get(x, y, z);
public WrappedBlockState get(ClientVersion version, int x, int y, int z) {
return WrappedBlockState.getByGlobalId(version, this.chunkData.get(x, y, z));
}
@Override
public void set(int x, int y, int z, int state) {
public void set(ClientVersion version, int x, int y, int z, int state) {
int curr = this.chunkData.set(x, y, z, state);
if (state != AIR && curr == AIR) {
this.blockCount++;
@@ -19,11 +19,10 @@
package com.github.retrooper.packetevents.protocol.world.chunk.reader;
import com.github.retrooper.packetevents.protocol.stream.NetStreamInput;
import com.github.retrooper.packetevents.protocol.world.Dimension;
import com.github.retrooper.packetevents.protocol.world.chunk.BaseChunk;
import java.util.BitSet;
public interface ChunkReader {
BaseChunk[] read(Dimension dimension, BitSet set, BitSet sevenExtendedMask, boolean fullChunk, boolean hasSkyLight, boolean checkForSky, int chunkSize, byte[] data, NetStreamInput dataIn);
BaseChunk[] read(BitSet set, BitSet sevenExtendedMask, boolean fullChunk, boolean hasSkyLight, boolean checkForSky, int chunkSize, byte[] data, NetStreamInput dataIn);
}
@@ -19,7 +19,6 @@
package com.github.retrooper.packetevents.protocol.world.chunk.reader.impl;
import com.github.retrooper.packetevents.protocol.stream.NetStreamInput;
import com.github.retrooper.packetevents.protocol.world.Dimension;
import com.github.retrooper.packetevents.protocol.world.chunk.BaseChunk;
import com.github.retrooper.packetevents.protocol.world.chunk.impl.v1_16.Chunk_v1_9;
import com.github.retrooper.packetevents.protocol.world.chunk.reader.ChunkReader;
@@ -28,7 +27,7 @@ import java.util.BitSet;
public class ChunkReader_v1_16 implements ChunkReader {
@Override
public BaseChunk[] read(Dimension dimension, BitSet set, BitSet sevenExtendedMask, boolean fullChunk, boolean hasSkyLight, boolean checkForSky, int chunkSize, byte[] data, NetStreamInput dataIn) {
public BaseChunk[] read(BitSet set, BitSet sevenExtendedMask, boolean fullChunk, boolean hasSkyLight, boolean checkForSky, int chunkSize, byte[] data, NetStreamInput dataIn) {
BaseChunk[] chunks = new BaseChunk[chunkSize];
for (int index = 0; index < chunks.length; ++index) {
@@ -19,7 +19,6 @@
package com.github.retrooper.packetevents.protocol.world.chunk.reader.impl;
import com.github.retrooper.packetevents.protocol.stream.NetStreamInput;
import com.github.retrooper.packetevents.protocol.world.Dimension;
import com.github.retrooper.packetevents.protocol.world.chunk.BaseChunk;
import com.github.retrooper.packetevents.protocol.world.chunk.impl.v_1_18.Chunk_v1_18;
import com.github.retrooper.packetevents.protocol.world.chunk.reader.ChunkReader;
@@ -28,7 +27,7 @@ import java.util.BitSet;
public class ChunkReader_v1_18 implements ChunkReader {
@Override
public BaseChunk[] read(Dimension dimension, BitSet set, BitSet sevenExtendedMask, boolean fullChunk, boolean hasSkyLight, boolean checkForSky, int chunkSize, byte[] data, NetStreamInput dataIn) {
public BaseChunk[] read(BitSet set, BitSet sevenExtendedMask, boolean fullChunk, boolean hasSkyLight, boolean checkForSky, int chunkSize, byte[] data, NetStreamInput dataIn) {
BaseChunk[] chunks = new BaseChunk[chunkSize];
for (int index = 0; index < chunkSize; ++index) {
@@ -19,7 +19,6 @@
package com.github.retrooper.packetevents.protocol.world.chunk.reader.impl;
import com.github.retrooper.packetevents.protocol.stream.NetStreamInput;
import com.github.retrooper.packetevents.protocol.world.Dimension;
import com.github.retrooper.packetevents.protocol.world.chunk.BaseChunk;
import com.github.retrooper.packetevents.protocol.world.chunk.ByteArray3d;
import com.github.retrooper.packetevents.protocol.world.chunk.NetworkChunkData;
@@ -31,7 +30,7 @@ import java.util.BitSet;
public class ChunkReader_v1_7 implements ChunkReader {
@Override
public BaseChunk[] read(Dimension dimension, BitSet primarySet, BitSet sevenExtendedMask, boolean fullChunk, boolean hasSkyLight, boolean checkForSky, int chunkSize, byte[] data, NetStreamInput dataIn) {
public BaseChunk[] read(BitSet primarySet, BitSet sevenExtendedMask, boolean fullChunk, boolean hasSkyLight, boolean checkForSky, int chunkSize, byte[] data, NetStreamInput dataIn) {
Chunk_v1_7[] chunks = new Chunk_v1_7[16];
int pos = 0;
int expected = 0;
@@ -19,7 +19,6 @@
package com.github.retrooper.packetevents.protocol.world.chunk.reader.impl;
import com.github.retrooper.packetevents.protocol.stream.NetStreamInput;
import com.github.retrooper.packetevents.protocol.world.Dimension;
import com.github.retrooper.packetevents.protocol.world.chunk.BaseChunk;
import com.github.retrooper.packetevents.protocol.world.chunk.NetworkChunkData;
import com.github.retrooper.packetevents.protocol.world.chunk.NibbleArray3d;
@@ -35,7 +34,7 @@ import java.util.BitSet;
public class ChunkReader_v1_8 implements ChunkReader {
@Override
public BaseChunk[] read(Dimension dimension, BitSet set, BitSet sevenExtendedMask, boolean fullChunk, boolean hasSkyLight, boolean checkForSky, int chunkSize, byte[] data, NetStreamInput dataIn) {
public BaseChunk[] read(BitSet set, BitSet sevenExtendedMask, boolean fullChunk, boolean hasSkyLight, boolean checkForSky, int chunkSize, byte[] data, NetStreamInput dataIn) {
Chunk_v1_8[] chunks = new Chunk_v1_8[16];
int pos = 0;
int expected = fullChunk ? 256 : 0; // 256 if full chunk for the biome data, always sent if full chunk
@@ -18,24 +18,49 @@
package com.github.retrooper.packetevents.protocol.world.chunk.reader.impl;
import com.github.retrooper.packetevents.PacketEvents;
import com.github.retrooper.packetevents.manager.server.ServerVersion;
import com.github.retrooper.packetevents.protocol.stream.NetStreamInput;
import com.github.retrooper.packetevents.protocol.world.Dimension;
import com.github.retrooper.packetevents.protocol.world.chunk.BaseChunk;
import com.github.retrooper.packetevents.protocol.world.chunk.impl.v1_16.Chunk_v1_9;
import com.github.retrooper.packetevents.protocol.world.chunk.reader.ChunkReader;
import java.io.IOException;
import java.util.BitSet;
public class ChunkReader_v1_9 implements ChunkReader {
@Override
public BaseChunk[] read(Dimension dimension, BitSet set, BitSet sevenExtendedMask, boolean fullChunk, boolean hasBlockLight, boolean hasSkyLight, int chunkSize, byte[] data, NetStreamInput dataIn) {
public BaseChunk[] read(BitSet set, BitSet sevenExtendedMask, boolean fullChunk, boolean hasBlockLight, boolean hasSkyLight, int chunkSize, byte[] data, NetStreamInput dataIn) {
BaseChunk[] chunks = new BaseChunk[chunkSize];
for (int index = 0; index < chunks.length; ++index) {
if (set.get(index)) {
chunks[index] = new Chunk_v1_9(dataIn, hasBlockLight, hasSkyLight);
Throwable throwable = null;
try {
for (int index = 0; index < chunks.length; ++index) {
if (set.get(index)) {
chunks[index] = new Chunk_v1_9(dataIn, hasBlockLight, hasSkyLight);
}
}
} catch (Throwable e) {
throwable = e;
}
if (PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_14)) return chunks;
try {
// Unfortunately, this is needed to detect whether the chunks contain skylight or not.
// Yes, this hack is required all the way from 1.9 through 1.13!
//
// Minimum is more than 256 bytes when it is a full chunks for biome data
// if not a full chunk, any leftover data means it has skylight
int minimum = fullChunk ? 256 : 0;
if ((dataIn.available() > minimum || throwable != null ) && !hasSkyLight) {
dataIn.reset();
return read(set, sevenExtendedMask, fullChunk, hasBlockLight, true, chunkSize, data, dataIn);
}
} catch (IOException e) {
e.printStackTrace();
}
return chunks;
@@ -80,8 +80,7 @@ public class LegacyFlexibleStorage extends BaseStorage {
this.data[startIndex] = this.data[startIndex] & ~(this.maxEntryValue << startBitSubIndex) | ((long) value & this.maxEntryValue) << startBitSubIndex;
if (startIndex != endIndex) {
int endBitSubIndex = 64 - startBitSubIndex;
int j1 = this.bitsPerEntry - endBitSubIndex;
this.data[endIndex] = this.data[endIndex] >>> j1 << j1 | ((long) value & this.maxEntryValue) >> endBitSubIndex;
this.data[endIndex] = this.data[endIndex] >>> endBitSubIndex << endBitSubIndex | ((long) value & this.maxEntryValue) >> endBitSubIndex;
}
}
@@ -73,14 +73,9 @@ public class WrappedBlockState {
if (data != null) {
for (String s : data) {
try {
String[] split = s.split("=");
StateValue value = StateValue.byName(split[0]);
this.data.put(value, value.getParser().apply(split[1].toUpperCase(Locale.ROOT)));
} catch (Exception e) {
e.printStackTrace();
System.out.println("Failed to parse block state: " + s);
}
String[] split = s.split("=");
StateValue value = StateValue.byName(split[0]);
this.data.put(value, value.getParser().apply(split[1].toUpperCase(Locale.ROOT)));
}
}
@@ -96,11 +91,6 @@ public class WrappedBlockState {
this.mappingsIndex = mappingsIndex;
}
@NotNull
public static WrappedBlockState getByGlobalId(int globalID) {
return getByGlobalId(PacketEvents.getAPI().getServerManager().getVersion().toClientVersion(), globalID);
}
@NotNull
public static WrappedBlockState getByGlobalId(ClientVersion version, int globalID) {
if (globalID == 0) return AIR; // Hardcode for performance
@@ -108,29 +98,19 @@ public class WrappedBlockState {
return BY_ID.get(mappingsIndex).getOrDefault(globalID, AIR).clone();
}
@NotNull
public static WrappedBlockState getByString(String string) {
return getByString(PacketEvents.getAPI().getServerManager().getVersion().toClientVersion(), string);
}
@NotNull
public static WrappedBlockState getByString(ClientVersion version, String string) {
byte mappingsIndex = getMappingsIndex(version);
return BY_STRING.get(mappingsIndex).getOrDefault(string.replace("minecraft:", ""), AIR).clone();
}
@NotNull
public static WrappedBlockState getDefaultState(StateType type) {
return getDefaultState(PacketEvents.getAPI().getServerManager().getVersion().toClientVersion(), type);
}
@NotNull
public static WrappedBlockState getDefaultState(ClientVersion version, StateType type) {
if (type == StateTypes.AIR) return AIR;
byte mappingsIndex = getMappingsIndex(version);
WrappedBlockState state = DEFAULT_STATES.get(mappingsIndex).get(type);
if (state == null) {
PacketEvents.getAPI().getLogger().config("Default state for " + type.getName() + " is null. Returning AIR");
PacketEvents.getAPI().getLogger().warning("Default state for " + type.getName() + " is null. Returning AIR");
return AIR;
}
return state.clone();
@@ -153,19 +133,9 @@ public class WrappedBlockState {
return 6;
} else if (version.isOlderThanOrEquals(ClientVersion.V_1_18_2)) {
return 7;
} else if (version.isOlderThanOrEquals(ClientVersion.V_1_19_1)) {
} else {
return 8;
} else if (version.isOlderThanOrEquals(ClientVersion.V_1_19_3)) {
return 9;
} 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;
}
// TODO UPDATE increment index (and add previous above)
return 13;
}
private static void loadLegacy() {
@@ -915,66 +885,6 @@ public class WrappedBlockState {
checkIsStillValid();
}
public boolean isSlotZeroOccupied() {
return (boolean) data.get(StateValue.SLOT_0_OCCUPIED);
}
public void setSlotZeroOccupied(boolean slotZeroOccupied) {
checkIfCloneNeeded();
data.put(StateValue.SLOT_0_OCCUPIED, slotZeroOccupied);
checkIsStillValid();
}
public boolean isSlotOneOccupied() {
return (boolean) data.get(StateValue.SLOT_1_OCCUPIED);
}
public void setSlotOneOccupied(boolean slotOneOccupied) {
checkIfCloneNeeded();
data.put(StateValue.SLOT_1_OCCUPIED, slotOneOccupied);
checkIsStillValid();
}
public boolean isSlotTwoOccupied() {
return (boolean) data.get(StateValue.SLOT_2_OCCUPIED);
}
public void setSlotTwoOccupied(boolean slotTwoOccupied) {
checkIfCloneNeeded();
data.put(StateValue.SLOT_2_OCCUPIED, slotTwoOccupied);
checkIsStillValid();
}
public boolean isSlotThreeOccupied() {
return (boolean) data.get(StateValue.SLOT_3_OCCUPIED);
}
public void setSlotThreeOccupied(boolean slotThreeOccupied) {
checkIfCloneNeeded();
data.put(StateValue.SLOT_3_OCCUPIED, slotThreeOccupied);
checkIsStillValid();
}
public boolean isSlotFourOccupied() {
return (boolean) data.get(StateValue.SLOT_4_OCCUPIED);
}
public void setSlotFourOccupied(boolean slotFourOccupied) {
checkIfCloneNeeded();
data.put(StateValue.SLOT_4_OCCUPIED, slotFourOccupied);
checkIsStillValid();
}
public boolean isSlotFiveOccupied() {
return (boolean) data.get(StateValue.SLOT_5_OCCUPIED);
}
public void setSlotFiveOccupied(boolean slotFiveOccupied) {
checkIfCloneNeeded();
data.put(StateValue.SLOT_5_OCCUPIED, slotFiveOccupied);
checkIsStillValid();
}
public boolean isSnowy() {
return (boolean) data.get(StateValue.SNOWY);
}
@@ -1115,36 +1025,6 @@ 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
/**
@@ -1219,4 +1099,4 @@ public class WrappedBlockState {
public String toString() {
return INTO_STRING.get(mappingsIndex).get(this);
}
}
}
@@ -29,10 +29,6 @@ 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 {
private static final HashMap<String, BlockTags> byName = new HashMap<>();
@@ -41,9 +37,8 @@ public class BlockTags {
public static final BlockTags PLANKS = bind("planks");
public static final BlockTags STONE_BRICKS = bind("stone_bricks");
public static final BlockTags WOODEN_BUTTONS = bind("wooden_buttons");
public static final BlockTags STONE_BUTTONS = bind("stone_buttons");
public static final BlockTags BUTTONS = bind("buttons");
public static final BlockTags WOOL_CARPETS = bind("wool_carpets");
public static final BlockTags CARPETS = bind("carpets");
public static final BlockTags WOODEN_DOORS = bind("wooden_doors");
public static final BlockTags WOODEN_STAIRS = bind("wooden_stairs");
public static final BlockTags WOODEN_SLABS = bind("wooden_slabs");
@@ -55,23 +50,17 @@ public class BlockTags {
public static final BlockTags DOORS = bind("doors");
public static final BlockTags SAPLINGS = bind("saplings");
public static final BlockTags LOGS_THAT_BURN = bind("logs_that_burn");
public static final BlockTags OVERWORLD_NATURAL_LOGS = bind("overworld_natural_logs");
public static final BlockTags LOGS = bind("logs");
public static final BlockTags DARK_OAK_LOGS = bind("dark_oak_logs");
public static final BlockTags OAK_LOGS = bind("oak_logs");
public static final BlockTags BIRCH_LOGS = bind("birch_logs");
public static final BlockTags ACACIA_LOGS = bind("acacia_logs");
public static final BlockTags CHERRY_LOGS = bind("cherry_logs");
public static final BlockTags JUNGLE_LOGS = bind("jungle_logs");
public static final BlockTags SPRUCE_LOGS = bind("spruce_logs");
public static final BlockTags MANGROVE_LOGS = bind("mangrove_logs");
public static final BlockTags CRIMSON_STEMS = bind("crimson_stems");
public static final BlockTags WARPED_STEMS = bind("warped_stems");
public static final BlockTags BAMBOO_BLOCKS = bind("bamboo_blocks");
public static final BlockTags WART_BLOCKS = bind("wart_blocks");
public static final BlockTags BANNERS = bind("banners");
public static final BlockTags SAND = bind("sand");
public static final BlockTags SMELTS_TO_GLASS = bind("smelts_to_glass");
public static final BlockTags STAIRS = bind("stairs");
public static final BlockTags SLABS = bind("slabs");
public static final BlockTags WALLS = bind("walls");
@@ -93,11 +82,10 @@ public class BlockTags {
public static final BlockTags COAL_ORES = bind("coal_ores");
public static final BlockTags EMERALD_ORES = bind("emerald_ores");
public static final BlockTags COPPER_ORES = bind("copper_ores");
public static final BlockTags NON_FLAMMABLE_WOOD = bind("non_flammable_wood");
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");
public static final BlockTags ICE = bind("ice");
@@ -112,12 +100,7 @@ public class BlockTags {
public static final BlockTags STANDING_SIGNS = bind("standing_signs");
public static final BlockTags WALL_SIGNS = bind("wall_signs");
public static final BlockTags SIGNS = bind("signs");
public static final BlockTags CEILING_HANGING_SIGNS = bind("ceiling_hanging_signs");
public static final BlockTags WALL_HANGING_SIGNS = bind("wall_hanging_signs");
public static final BlockTags ALL_HANGING_SIGNS = bind("all_hanging_signs");
public static final BlockTags ALL_SIGNS = bind("all_signs");
public static final BlockTags DRAGON_IMMUNE = bind("dragon_immune");
public static final BlockTags DRAGON_TRANSPARENT = bind("dragon_transparent");
public static final BlockTags WITHER_IMMUNE = bind("wither_immune");
public static final BlockTags WITHER_SUMMON_BASE_BLOCKS = bind("wither_summon_base_blocks");
public static final BlockTags BEEHIVES = bind("beehives");
@@ -126,11 +109,11 @@ public class BlockTags {
public static final BlockTags PORTALS = bind("portals");
public static final BlockTags FIRE = bind("fire");
public static final BlockTags NYLIUM = bind("nylium");
public static final BlockTags WART_BLOCKS = bind("wart_blocks");
public static final BlockTags BEACON_BASE_BLOCKS = bind("beacon_base_blocks");
public static final BlockTags SOUL_SPEED_BLOCKS = bind("soul_speed_blocks");
public static final BlockTags WALL_POST_OVERRIDE = bind("wall_post_override");
public static final BlockTags CLIMBABLE = bind("climbable");
public static final BlockTags FALL_DAMAGE_RESETTING = bind("fall_damage_resetting");
public static final BlockTags SHULKER_BOXES = bind("shulker_boxes");
public static final BlockTags HOGLIN_REPELLENTS = bind("hoglin_repellents");
public static final BlockTags SOUL_FIRE_BASE_BLOCKS = bind("soul_fire_base_blocks");
@@ -148,16 +131,11 @@ public class BlockTags {
public static final BlockTags STONE_ORE_REPLACEABLES = bind("stone_ore_replaceables");
public static final BlockTags DEEPSLATE_ORE_REPLACEABLES = bind("deepslate_ore_replaceables");
public static final BlockTags BASE_STONE_NETHER = bind("base_stone_nether");
public static final BlockTags OVERWORLD_CARVER_REPLACEABLES = bind("overworld_carver_replaceables");
public static final BlockTags NETHER_CARVER_REPLACEABLES = bind("nether_carver_replaceables");
public static final BlockTags CANDLE_CAKES = bind("candle_cakes");
public static final BlockTags CAULDRONS = bind("cauldrons");
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");
public static final BlockTags CAVE_VINES = bind("cave_vines");
public static final BlockTags MOSS_REPLACEABLE = bind("moss_replaceable");
@@ -170,47 +148,23 @@ public class BlockTags {
public static final BlockTags MINEABLE_WITH_HOE = bind("mineable/hoe");
public static final BlockTags MINEABLE_WITH_PICKAXE = bind("mineable/pickaxe");
public static final BlockTags MINEABLE_WITH_SHOVEL = bind("mineable/shovel");
public static final BlockTags SWORD_EFFICIENT = bind("sword_efficient");
public static final BlockTags NEEDS_DIAMOND_TOOL = bind("needs_diamond_tool");
public static final BlockTags NEEDS_IRON_TOOL = bind("needs_iron_tool");
public static final BlockTags NEEDS_STONE_TOOL = bind("needs_stone_tool");
public static final BlockTags FEATURES_CANNOT_REPLACE = bind("features_cannot_replace");
public static final BlockTags LAVA_POOL_STONE_CANNOT_REPLACE = bind("lava_pool_stone_cannot_replace");
public static final BlockTags GEODE_INVALID_BLOCKS = bind("geode_invalid_blocks");
public static final BlockTags FROG_PREFER_JUMP_TO = bind("frog_prefer_jump_to");
public static final BlockTags SCULK_REPLACEABLE = bind("sculk_replaceable");
public static final BlockTags SCULK_REPLACEABLE_WORLD_GEN = bind("sculk_replaceable_world_gen");
public static final BlockTags ANCIENT_CITY_REPLACEABLE = bind("ancient_city_replaceable");
public static final BlockTags VIBRATION_RESONATORS = bind("vibration_resonators");
public static final BlockTags ANIMALS_SPAWNABLE_ON = bind("animals_spawnable_on");
public static final BlockTags AXOLOTLS_SPAWNABLE_ON = bind("axolotls_spawnable_on");
public static final BlockTags GOATS_SPAWNABLE_ON = bind("goats_spawnable_on");
public static final BlockTags MOOSHROOMS_SPAWNABLE_ON = bind("mooshrooms_spawnable_on");
public static final BlockTags PARROTS_SPAWNABLE_ON = bind("parrots_spawnable_on");
public static final BlockTags POLAR_BEARS_SPAWNABLE_ON_ALTERNATE = bind("polar_bears_spawnable_on_alternate");
public static final BlockTags POLAR_BEARS_SPAWNABLE_ON_IN_FROZEN_OCEAN = bind("polar_bears_spawnable_on_in_frozen_ocean");
public static final BlockTags RABBITS_SPAWNABLE_ON = bind("rabbits_spawnable_on");
public static final BlockTags FOXES_SPAWNABLE_ON = bind("foxes_spawnable_on");
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");
public static final BlockTags SNIFFER_DIGGABLE_BLOCK = bind("sniffer_diggable_block");
public static final BlockTags SNIFFER_EGG_HATCH_BOOST = bind("sniffer_egg_hatch_boost");
public static final BlockTags TRAIL_RUINS_REPLACEABLE = bind("trail_ruins_replaceable");
public static final BlockTags REPLACEABLE = bind("replaceable");
public static final BlockTags ENCHANTMENT_POWER_PROVIDER = bind("enchantment_power_provider");
public static final BlockTags ENCHANTMENT_POWER_TRANSMITTER = bind("enchantment_power_transmitter");
public static final BlockTags MAINTAINS_FARMLAND = bind("maintains_farmland");
/**
* Unofficial tag for all glass blocks
*/
@@ -222,177 +176,157 @@ public class BlockTags {
static {
BlockTags.WOOL.add(StateTypes.WHITE_WOOL, StateTypes.ORANGE_WOOL, StateTypes.MAGENTA_WOOL, StateTypes.LIGHT_BLUE_WOOL, StateTypes.YELLOW_WOOL, StateTypes.LIME_WOOL, StateTypes.PINK_WOOL, StateTypes.GRAY_WOOL, StateTypes.LIGHT_GRAY_WOOL, StateTypes.CYAN_WOOL, StateTypes.PURPLE_WOOL, StateTypes.BLUE_WOOL, StateTypes.BROWN_WOOL, StateTypes.GREEN_WOOL, StateTypes.RED_WOOL, StateTypes.BLACK_WOOL);
BlockTags.PLANKS.add(StateTypes.OAK_PLANKS, StateTypes.SPRUCE_PLANKS, StateTypes.BIRCH_PLANKS, StateTypes.JUNGLE_PLANKS, StateTypes.ACACIA_PLANKS, StateTypes.DARK_OAK_PLANKS, StateTypes.CRIMSON_PLANKS, StateTypes.WARPED_PLANKS, StateTypes.MANGROVE_PLANKS, StateTypes.BAMBOO_PLANKS, StateTypes.CHERRY_PLANKS);
BlockTags.PLANKS.add(StateTypes.OAK_PLANKS, StateTypes.SPRUCE_PLANKS, StateTypes.BIRCH_PLANKS, StateTypes.JUNGLE_PLANKS, StateTypes.ACACIA_PLANKS, StateTypes.DARK_OAK_PLANKS, StateTypes.CRIMSON_PLANKS, StateTypes.WARPED_PLANKS, StateTypes.MANGROVE_PLANKS);
BlockTags.STONE_BRICKS.add(StateTypes.STONE_BRICKS, StateTypes.MOSSY_STONE_BRICKS, StateTypes.CRACKED_STONE_BRICKS, StateTypes.CHISELED_STONE_BRICKS);
BlockTags.WOODEN_BUTTONS.add(StateTypes.OAK_BUTTON, StateTypes.SPRUCE_BUTTON, StateTypes.BIRCH_BUTTON, StateTypes.JUNGLE_BUTTON, StateTypes.ACACIA_BUTTON, StateTypes.DARK_OAK_BUTTON, StateTypes.CRIMSON_BUTTON, StateTypes.WARPED_BUTTON, StateTypes.MANGROVE_BUTTON, StateTypes.BAMBOO_BUTTON, StateTypes.CHERRY_BUTTON);
BlockTags.STONE_BUTTONS.add(StateTypes.STONE_BUTTON, StateTypes.POLISHED_BLACKSTONE_BUTTON);
BlockTags.BUTTONS.addTag(BlockTags.WOODEN_BUTTONS).addTag(BlockTags.STONE_BUTTONS);
BlockTags.WOOL_CARPETS.add(StateTypes.WHITE_CARPET, StateTypes.ORANGE_CARPET, StateTypes.MAGENTA_CARPET, StateTypes.LIGHT_BLUE_CARPET, StateTypes.YELLOW_CARPET, StateTypes.LIME_CARPET, StateTypes.PINK_CARPET, StateTypes.GRAY_CARPET, StateTypes.LIGHT_GRAY_CARPET, StateTypes.CYAN_CARPET, StateTypes.PURPLE_CARPET, StateTypes.BLUE_CARPET, StateTypes.BROWN_CARPET, StateTypes.GREEN_CARPET, StateTypes.RED_CARPET, StateTypes.BLACK_CARPET);
BlockTags.WOODEN_DOORS.add(StateTypes.OAK_DOOR, StateTypes.SPRUCE_DOOR, StateTypes.BIRCH_DOOR, StateTypes.JUNGLE_DOOR, StateTypes.ACACIA_DOOR, StateTypes.DARK_OAK_DOOR, StateTypes.CRIMSON_DOOR, StateTypes.WARPED_DOOR, StateTypes.MANGROVE_DOOR, StateTypes.BAMBOO_DOOR, StateTypes.CHERRY_DOOR);
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.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.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.WOODEN_BUTTONS.add(StateTypes.OAK_BUTTON, StateTypes.SPRUCE_BUTTON, StateTypes.BIRCH_BUTTON, StateTypes.JUNGLE_BUTTON, StateTypes.ACACIA_BUTTON, StateTypes.DARK_OAK_BUTTON, StateTypes.CRIMSON_BUTTON, StateTypes.WARPED_BUTTON, StateTypes.MANGROVE_BUTTON);
BlockTags.BUTTONS.addTag(BlockTags.WOODEN_BUTTONS).add(StateTypes.STONE_BUTTON).add(StateTypes.POLISHED_BLACKSTONE_BUTTON);
// TODO: This was renamed to WOOL_CARPETS in 1.19
BlockTags.CARPETS.add(StateTypes.WHITE_CARPET, StateTypes.ORANGE_CARPET, StateTypes.MAGENTA_CARPET, StateTypes.LIGHT_BLUE_CARPET, StateTypes.YELLOW_CARPET, StateTypes.LIME_CARPET, StateTypes.PINK_CARPET, StateTypes.GRAY_CARPET, StateTypes.LIGHT_GRAY_CARPET, StateTypes.CYAN_CARPET, StateTypes.PURPLE_CARPET, StateTypes.BLUE_CARPET, StateTypes.BROWN_CARPET, StateTypes.GREEN_CARPET, StateTypes.RED_CARPET, StateTypes.BLACK_CARPET);
BlockTags.WOODEN_DOORS.add(StateTypes.OAK_DOOR, StateTypes.SPRUCE_DOOR, StateTypes.BIRCH_DOOR, StateTypes.JUNGLE_DOOR, StateTypes.ACACIA_DOOR, StateTypes.DARK_OAK_DOOR, StateTypes.CRIMSON_DOOR, StateTypes.WARPED_DOOR, StateTypes.MANGROVE_DOOR);
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);
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);
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);
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.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);
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.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.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);
// TODO: this.tag(BlockTags.MANGROVE_LOGS).add(Blocks.MANGROVE_LOG, Blocks.MANGROVE_WOOD, Blocks.STRIPPED_MANGROVE_LOG, Blocks.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); // TODO: Add MANGROVE_LOGS tag to this
// TODO: this.tag(BlockTags.OVERWORLD_NATURAL_LOGS).add(Blocks.ACACIA_LOG).add(Blocks.BIRCH_LOG).add(Blocks.OAK_LOG).add(Blocks.JUNGLE_LOG).add(Blocks.SPRUCE_LOG).add(Blocks.DARK_OAK_LOG).add(Blocks.MANGROVE_LOG);
BlockTags.LOGS.addTag(BlockTags.LOGS_THAT_BURN).addTag(BlockTags.CRIMSON_STEMS).addTag(BlockTags.WARPED_STEMS).add(StateTypes.MANGROVE_LOG, StateTypes.MANGROVE_WOOD, StateTypes.STRIPPED_MANGROVE_LOG, StateTypes.STRIPPED_MANGROVE_WOOD); // TODO: Add mangrove logs not manually
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);
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);
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.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);
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.STAIRS.addTag(BlockTags.WOODEN_STAIRS).add(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.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);
BlockTags.RAILS.add(StateTypes.RAIL, StateTypes.POWERED_RAIL, StateTypes.DETECTOR_RAIL, StateTypes.ACTIVATOR_RAIL);
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.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);
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);
BlockTags.TRAPDOORS.addTag(BlockTags.WOODEN_TRAPDOORS).add(StateTypes.IRON_TRAPDOOR);
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.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);
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);
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);
BlockTags.SIGNS.addTag(BlockTags.STANDING_SIGNS).addTag(BlockTags.WALL_SIGNS);
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.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, 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.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);
// TODO: this.tag(BlockTags.DRAGON_TRANSPARENT).add(Blocks.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); // TODO: 1.17/1.18 doesn't have light (does it matter?)
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);
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);
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.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.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.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.LAPIS_ORES.add(StateTypes.LAPIS_ORE, StateTypes.DEEPSLATE_LAPIS_ORE);
BlockTags.SOUL_FIRE_BASE_BLOCKS.add(StateTypes.SOUL_SAND, StateTypes.SOUL_SOIL);
BlockTags.NON_FLAMMABLE_WOOD.add(StateTypes.WARPED_STEM, StateTypes.STRIPPED_WARPED_STEM, StateTypes.WARPED_HYPHAE, StateTypes.STRIPPED_WARPED_HYPHAE, StateTypes.CRIMSON_STEM, StateTypes.STRIPPED_CRIMSON_STEM, StateTypes.CRIMSON_HYPHAE, StateTypes.STRIPPED_CRIMSON_HYPHAE, StateTypes.CRIMSON_PLANKS, StateTypes.WARPED_PLANKS, StateTypes.CRIMSON_SLAB, StateTypes.WARPED_SLAB, StateTypes.CRIMSON_PRESSURE_PLATE, StateTypes.WARPED_PRESSURE_PLATE, StateTypes.CRIMSON_FENCE, StateTypes.WARPED_FENCE, StateTypes.CRIMSON_TRAPDOOR, StateTypes.WARPED_TRAPDOOR, StateTypes.CRIMSON_FENCE_GATE, StateTypes.WARPED_FENCE_GATE, StateTypes.CRIMSON_STAIRS, StateTypes.WARPED_STAIRS, StateTypes.CRIMSON_BUTTON, StateTypes.WARPED_BUTTON, StateTypes.CRIMSON_DOOR, StateTypes.WARPED_DOOR, StateTypes.CRIMSON_SIGN, StateTypes.WARPED_SIGN, StateTypes.CRIMSON_WALL_SIGN, StateTypes.WARPED_WALL_SIGN);
BlockTags.STRIDER_WARM_BLOCKS.add(StateTypes.LAVA);
BlockTags.CAMPFIRES.add(StateTypes.CAMPFIRE, StateTypes.SOUL_CAMPFIRE);
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.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.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.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);
BlockTags.UNSTABLE_BOTTOM_CENTER.addTag(BlockTags.FENCE_GATES);
BlockTags.MUSHROOM_GROW_BLOCK.add(StateTypes.MYCELIUM, StateTypes.PODZOL, StateTypes.CRIMSON_NYLIUM, StateTypes.WARPED_NYLIUM);
BlockTags.MUSHROOM_GROW_BLOCK.add(StateTypes.MYCELIUM).add(StateTypes.PODZOL).add(StateTypes.CRIMSON_NYLIUM).add(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.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.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);
// TODO: this.tag(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(Blocks.WATER, Blocks.GRAVEL, Blocks.SANDSTONE, Blocks.RED_SANDSTONE, Blocks.CALCITE, Blocks.SNOW, Blocks.PACKED_ICE, Blocks.RAW_IRON_BLOCK, Blocks.RAW_COPPER_BLOCK);
// this.tag(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(Blocks.SOUL_SAND, Blocks.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.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.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.CAULDRONS.add(StateTypes.CAULDRON, StateTypes.WATER_CAULDRON, StateTypes.LAVA_CAULDRON, StateTypes.POWDER_SNOW_CAULDRON);
BlockTags.INSIDE_STEP_SOUND_BLOCKS.add(StateTypes.SNOW, StateTypes.POWDER_SNOW, StateTypes.SCULK_VEIN);
BlockTags.DRIPSTONE_REPLACEABLE.addTag(BlockTags.BASE_STONE_OVERWORLD).add(StateTypes.DIRT);
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, 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.LUSH_GROUND_REPLACEABLE.addTag(BlockTags.MOSS_REPLACEABLE).add(StateTypes.CLAY).add(StateTypes.GRAVEL).add(StateTypes.SAND);
BlockTags.AZALEA_ROOT_REPLACEABLE.addTag(BlockTags.LUSH_GROUND_REPLACEABLE).addTag(BlockTags.TERRACOTTA).add(StateTypes.RED_SAND);
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.OCCLUDES_VIBRATION_SIGNALS.addTag(BlockTags.WOOL);
BlockTags.SNOW.add(StateTypes.SNOW, StateTypes.SNOW_BLOCK, StateTypes.POWDER_SNOW);
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.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);
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.SCULK_SENSOR, StateTypes.MOSS_BLOCK, StateTypes.MOSS_CARPET, StateTypes.MANGROVE_LEAVES, StateTypes.SCULK, StateTypes.SCULK_CATALYST, StateTypes.SCULK_VEIN, StateTypes.SCULK_SHRIEKER);
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);
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.GOATS_SPAWNABLE_ON.add(StateTypes.STONE, StateTypes.SNOW, StateTypes.POWDER_SNOW, StateTypes.SNOW_BLOCK, StateTypes.PACKED_ICE, StateTypes.GRAVEL);
BlockTags.MOOSHROOMS_SPAWNABLE_ON.add(StateTypes.MYCELIUM);
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.PARROTS_SPAWNABLE_ON.add(StateTypes.GRASS_BLOCK, StateTypes.AIR).addTag(BlockTags.LEAVES).addTag(BlockTags.LOGS);
BlockTags.POLAR_BEARS_SPAWNABLE_ON_IN_FROZEN_OCEAN.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.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.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.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.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);
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);
// TODO: this.tag(BlockTags.FROGS_SPAWNABLE_ON).add(Blocks.GRASS_BLOCK, Blocks.MUD, Blocks.MANGROVE_ROOTS, Blocks.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);
// TODO:
// this.tag(BlockTags.FROG_PREFER_JUMP_TO).add(Blocks.LILY_PAD, Blocks.BIG_DRIPLEAF);
// this.tag(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(Blocks.GRAVEL).add(Blocks.SOUL_SAND).add(Blocks.SOUL_SOIL).add(Blocks.CALCITE).add(Blocks.SMOOTH_BASALT).add(Blocks.CLAY).add(Blocks.DRIPSTONE_BLOCK).add(Blocks.END_STONE).add(Blocks.RED_SANDSTONE).add(Blocks.SANDSTONE);
// this.tag(BlockTags.SCULK_REPLACEABLE_WORLD_GEN).addTag(BlockTags.SCULK_REPLACEABLE).add(Blocks.DEEPSLATE_BRICKS).add(Blocks.DEEPSLATE_TILES).add(Blocks.COBBLED_DEEPSLATE).add(Blocks.CRACKED_DEEPSLATE_BRICKS).add(Blocks.CRACKED_DEEPSLATE_TILES).add(Blocks.POLISHED_DEEPSLATE);
// this.tag(BlockTags.CONVERTABLE_TO_MUD).add(Blocks.DIRT, Blocks.COARSE_DIRT, Blocks.ROOTED_DIRT);
// this.tag(BlockTags.ANCIENT_CITY_REPLACEABLE).add(Blocks.DEEPSLATE).add(Blocks.DEEPSLATE_BRICKS).add(Blocks.DEEPSLATE_TILES).add(Blocks.DEEPSLATE_BRICK_SLAB).add(Blocks.DEEPSLATE_TILE_SLAB).add(Blocks.DEEPSLATE_BRICK_STAIRS).add(Blocks.DEEPSLATE_TILE_WALL).add(Blocks.DEEPSLATE_BRICK_WALL).add(Blocks.COBBLED_DEEPSLATE).add(Blocks.CRACKED_DEEPSLATE_BRICKS).add(Blocks.CRACKED_DEEPSLATE_TILES).add(Blocks.GRAY_WOOL);
// this.tag(BlockTags.MANGROVE_LOGS_CAN_GROW_THROUGH).add(Blocks.MUD, Blocks.MUDDY_MANGROVE_ROOTS, Blocks.MANGROVE_ROOTS, Blocks.MANGROVE_LEAVES, Blocks.MANGROVE_LOG, Blocks.MANGROVE_PROPAGULE, Blocks.MOSS_CARPET, Blocks.VINE);
// this.tag(BlockTags.MANGROVE_ROOTS_CAN_GROW_THROUGH).add(Blocks.MUD, Blocks.MUDDY_MANGROVE_ROOTS, Blocks.MANGROVE_ROOTS, Blocks.MOSS_CARPET, Blocks.VINE, Blocks.MANGROVE_PROPAGULE, Blocks.SNOW);
// this.tag(BlockTags.DEAD_BUSH_MAY_PLACE_ON).addTag(BlockTags.SAND).addTag(BlockTags.TERRACOTTA).addTag(BlockTags.DIRT);
// this.tag(BlockTags.SNOW_LAYER_CANNOT_SURVIVE_ON).add(Blocks.ICE).add(Blocks.PACKED_ICE).add(Blocks.BARRIER);
// this.tag(BlockTags.SNOW_LAYER_CAN_SURVIVE_ON).add(Blocks.HONEY_BLOCK).add(Blocks.SOUL_SAND).add(Blocks.MUD);
// this.tag(BlockTags.COMPLETES_FIND_TREE_TUTORIAL).addTag(BlockTags.LOGS).addTag(BlockTags.LEAVES).addTag(BlockTags.WART_BLOCKS);
// this.tag(BlockTags.SNAPS_GOAT_HORN).addTag(BlockTags.OVERWORLD_NATURAL_LOGS).add(Blocks.STONE).add(Blocks.PACKED_ICE).add(Blocks.IRON_ORE).add(Blocks.COAL_ORE).add(Blocks.COPPER_ORE).add(Blocks.EMERALD_ORE);
// Unofficial blocks to help packetevents users
BlockTags.GLASS_BLOCKS.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.GLASS_PANES.add(StateTypes.GLASS_PANE, StateTypes.WHITE_STAINED_GLASS_PANE, StateTypes.ORANGE_STAINED_GLASS_PANE, StateTypes.MAGENTA_STAINED_GLASS_PANE, StateTypes.LIGHT_BLUE_STAINED_GLASS_PANE, StateTypes.YELLOW_STAINED_GLASS_PANE, StateTypes.LIME_STAINED_GLASS_PANE, StateTypes.PINK_STAINED_GLASS_PANE, StateTypes.GRAY_STAINED_GLASS_PANE, StateTypes.LIGHT_GRAY_STAINED_GLASS_PANE, StateTypes.CYAN_STAINED_GLASS_PANE, StateTypes.PURPLE_STAINED_GLASS_PANE, StateTypes.BLUE_STAINED_GLASS_PANE, StateTypes.BROWN_STAINED_GLASS_PANE, StateTypes.GREEN_STAINED_GLASS_PANE, StateTypes.RED_STAINED_GLASS_PANE, StateTypes.BLACK_STAINED_GLASS_PANE);
@@ -34,14 +34,12 @@ public class ItemTags {
public static final ItemTags PLANKS = bind("planks");
public static final ItemTags STONE_BRICKS = bind("stone_bricks");
public static final ItemTags WOODEN_BUTTONS = bind("wooden_buttons");
public static final ItemTags STONE_BUTTONS = bind("stone_buttons");
public static final ItemTags BUTTONS = bind("buttons");
public static final ItemTags WOOL_CARPETS = bind("carpets");
public static final ItemTags CARPETS = bind("carpets");
public static final ItemTags WOODEN_DOORS = bind("wooden_doors");
public static final ItemTags WOODEN_STAIRS = bind("wooden_stairs");
public static final ItemTags WOODEN_SLABS = bind("wooden_slabs");
public static final ItemTags WOODEN_FENCES = bind("wooden_fences");
public static final ItemTags FENCE_GATES = bind("fence_gates");
public static final ItemTags WOODEN_PRESSURE_PLATES = bind("wooden_pressure_plates");
public static final ItemTags WOODEN_TRAPDOORS = bind("wooden_trapdoors");
public static final ItemTags DOORS = bind("doors");
@@ -52,17 +50,12 @@ public class ItemTags {
public static final ItemTags OAK_LOGS = bind("oak_logs");
public static final ItemTags BIRCH_LOGS = bind("birch_logs");
public static final ItemTags ACACIA_LOGS = bind("acacia_logs");
public static final ItemTags CHERRY_LOGS = bind("cherry_logs");
public static final ItemTags JUNGLE_LOGS = bind("jungle_logs");
public static final ItemTags SPRUCE_LOGS = bind("spruce_logs");
public static final ItemTags MANGROVE_LOGS = bind("mangrove_logs");
public static final ItemTags CRIMSON_STEMS = bind("crimson_stems");
public static final ItemTags WARPED_STEMS = bind("warped_stems");
public static final ItemTags BAMBOO_BLOCKS = bind("bamboo_blocks");
public static final ItemTags WART_BLOCKS = bind("wart_blocks");
public static final ItemTags BANNERS = bind("banners");
public static final ItemTags SAND = bind("sand");
public static final ItemTags SMELTS_TO_GLASS = bind("smelts_to_glass");
public static final ItemTags STAIRS = bind("stairs");
public static final ItemTags SLABS = bind("slabs");
public static final ItemTags WALLS = bind("walls");
@@ -91,11 +84,7 @@ public class ItemTags {
public static final ItemTags NON_FLAMMABLE_WOOD = bind("non_flammable_wood");
public static final ItemTags SOUL_FIRE_BASE_BLOCKS = bind("soul_fire_base_blocks");
public static final ItemTags CANDLES = bind("candles");
public static final ItemTags DIRT = bind("dirt");
public static final ItemTags TERRACOTTA = bind("terracotta");
public static final ItemTags COMPLETES_FIND_TREE_TUTORIAL = bind("completes_find_tree_tutorial");
public static final ItemTags BOATS = bind("boats");
public static final ItemTags CHEST_BOATS = bind("chest_boats");
public static final ItemTags FISHES = bind("fishes");
public static final ItemTags SIGNS = bind("signs");
public static final ItemTags MUSIC_DISCS = bind("music_discs");
@@ -103,84 +92,55 @@ public class ItemTags {
public static final ItemTags COALS = bind("coals");
public static final ItemTags ARROWS = bind("arrows");
public static final ItemTags LECTERN_BOOKS = bind("lectern_books");
public static final ItemTags BOOKSHELF_BOOKS = bind("bookshelf_books");
public static final ItemTags BEACON_PAYMENT_ITEMS = bind("beacon_payment_items");
public static final ItemTags STONE_TOOL_MATERIALS = bind("stone_tool_materials");
public static final ItemTags STONE_CRAFTING_MATERIALS = bind("stone_crafting_materials");
public static final ItemTags FREEZE_IMMUNE_WEARABLES = bind("freeze_immune_wearables");
public static final ItemTags AXOLOTL_TEMPT_ITEMS = bind("axolotl_tempt_items");
public static final ItemTags DAMPENS_VIBRATIONS = bind("dampens_vibrations");
public static final ItemTags OCCLUDES_VIBRATION_SIGNALS = bind("occludes_vibration_signals");
public static final ItemTags CLUSTER_MAX_HARVESTABLES = bind("cluster_max_harvestables");
public static final ItemTags COMPASSES = bind("compasses");
public static final ItemTags HANGING_SIGNS = bind("hanging_signs");
public static final ItemTags CREEPER_IGNITERS = bind("creeper_igniters");
public static final ItemTags NOTEBLOCK_TOP_INSTRUMENTS = bind("noteblock_top_instruments");
public static final ItemTags TRIMMABLE_ARMOR = bind("trimmable_armor");
public static final ItemTags TRIM_MATERIALS = bind("trim_materials");
public static final ItemTags TRIM_TEMPLATES = bind("trim_templates");
public static final ItemTags SNIFFER_FOOD = bind("sniffer_food");
public static final ItemTags DECORATED_POT_SHERDS = bind("decorated_pot_sherds");
public static final ItemTags DECORATED_POT_INGREDIENTS = bind("decorated_pot_ingredients");
public static final ItemTags SWORDS = bind("swords");
public static final ItemTags AXES = bind("axes");
public static final ItemTags HOES = bind("hoes");
public static final ItemTags PICKAXES = bind("pickaxes");
public static final ItemTags SHOVELS = bind("shovels");
public static final ItemTags TOOLS = bind("tools");
public static final ItemTags BREAKS_DECORATED_POTS = bind("breaks_decorated_pots");
public static final ItemTags VILLAGER_PLANTABLE_SEEDS = bind("villager_plantable_seeds");
static {
copy(BlockTags.WOOL, ItemTags.WOOL);
copy(BlockTags.PLANKS, ItemTags.PLANKS);
copy(BlockTags.STONE_BRICKS, ItemTags.STONE_BRICKS);
copy(BlockTags.WOODEN_BUTTONS, ItemTags.WOODEN_BUTTONS);
copy(BlockTags.STONE_BUTTONS, ItemTags.STONE_BUTTONS);
copy(BlockTags.BUTTONS, ItemTags.BUTTONS);
copy(BlockTags.WOOL_CARPETS, ItemTags.WOOL_CARPETS);
copy(BlockTags.CARPETS, ItemTags.CARPETS);
copy(BlockTags.WOODEN_DOORS, ItemTags.WOODEN_DOORS);
copy(BlockTags.WOODEN_STAIRS, ItemTags.WOODEN_STAIRS);
copy(BlockTags.WOODEN_SLABS, ItemTags.WOODEN_SLABS);
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.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.DARK_OAK_LOGS, ItemTags.DARK_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.JUNGLE_LOGS, ItemTags.JUNGLE_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.LOGS_THAT_BURN, ItemTags.LOGS_THAT_BURN);
copy(BlockTags.LOGS, ItemTags.LOGS);
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);
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.SOUL_FIRE_BASE_BLOCKS, ItemTags.SOUL_FIRE_BASE_BLOCKS);
copy(BlockTags.CANDLES, ItemTags.CANDLES);
copy(BlockTags.OCCLUDES_VIBRATION_SIGNALS, ItemTags.OCCLUDES_VIBRATION_SIGNALS);
copy(BlockTags.GOLD_ORES, ItemTags.GOLD_ORES);
copy(BlockTags.IRON_ORES, ItemTags.IRON_ORES);
copy(BlockTags.DIAMOND_ORES, ItemTags.DIAMOND_ORES);
@@ -189,47 +149,27 @@ 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.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.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);
ItemTags.FISHES.add(ItemTypes.COD, ItemTypes.COOKED_COD, ItemTypes.SALMON, ItemTypes.COOKED_SALMON, ItemTypes.PUFFERFISH, ItemTypes.TROPICAL_FISH);
copy(BlockTags.STANDING_SIGNS, ItemTags.SIGNS);
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.MUSIC_DISCS.addTag(ItemTags.CREEPER_DROP_MUSIC_DISCS).add(ItemTypes.MUSIC_DISC_PIGSTEP);
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).add(ItemTypes.SOUL_LANTERN).add(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);
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.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.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);
}
String name;
@@ -34,12 +34,5 @@ public enum Instrument {
IRON_XYLOPHONE,
PLING,
SNARE,
XYLOPHONE,
ZOMBIE,
SKELETON,
CREEPER,
DRAGON,
WITHER_SKELETON,
PIGLIN,
CUSTOM_HEAD
XYLOPHONE
}
@@ -1,29 +0,0 @@
/*
* 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,
}
@@ -18,38 +18,56 @@
package com.github.retrooper.packetevents.protocol.world.states.type;
import com.github.retrooper.packetevents.PacketEvents;
import com.github.retrooper.packetevents.protocol.player.ClientVersion;
import com.github.retrooper.packetevents.protocol.world.MaterialType;
import com.github.retrooper.packetevents.protocol.world.PushReaction;
import com.github.retrooper.packetevents.protocol.world.states.WrappedBlockState;
public class StateType {
private final String name;
private final float blastResistance;
private final float hardness;
private final boolean isSolid;
private final boolean isBlocking;
private final float slipperiness;
private final float friction;
private final float speed;
private final boolean hasGravity;
private final boolean isAir;
private final boolean isBurnable;
private final boolean isFlammable;
private final boolean isOccluding;
private final boolean isSolid;
private final boolean isLiquid;
private final boolean isBlocking;
private final boolean requiresCorrectTool;
private final boolean isReplaceable;
private final boolean exceedsCube;
private final PushReaction pushReaction;
private final MaterialType materialType;
public StateType(String name, float blastResistance, float hardness, boolean isSolid, boolean isBlocking, boolean isAir, boolean requiresCorrectTool, boolean isShapeExceedsCube, MaterialType materialType) {
public StateType(String name, float blastResistance, float hardness, float slipperiness, float friction, float speed, boolean hasGravity,
boolean isAir, boolean isBurnable, boolean isFlammable, boolean isOccluding, boolean isSolid, boolean isLiquid,
boolean isBlocking, boolean requiresCorrectTool, boolean isReplaceable, boolean exceedsCube, PushReaction pushReaction, MaterialType materialType) {
this.name = name;
this.blastResistance = blastResistance;
this.hardness = hardness;
this.isSolid = isSolid;
this.isBlocking = isBlocking;
this.slipperiness = slipperiness;
this.friction = friction;
this.speed = speed;
this.hasGravity = hasGravity;
this.isAir = isAir;
this.isBurnable = isBurnable;
this.isFlammable = isFlammable;
this.isOccluding = isOccluding;
this.isSolid = isSolid;
this.isLiquid = isLiquid;
this.isBlocking = isBlocking;
this.requiresCorrectTool = requiresCorrectTool;
this.exceedsCube = isShapeExceedsCube;
this.isReplaceable = isReplaceable;
this.exceedsCube = exceedsCube;
this.pushReaction = pushReaction;
this.materialType = materialType;
}
public WrappedBlockState createBlockState() {
return WrappedBlockState.getDefaultState(PacketEvents.getAPI().getServerManager().getVersion().toClientVersion(), this);
}
public WrappedBlockState createBlockState(ClientVersion version) {
return WrappedBlockState.getDefaultState(version, this);
}
@@ -66,50 +84,67 @@ public class StateType {
return hardness;
}
public boolean isSolid() {
return isSolid;
public float getSlipperiness() {
return slipperiness;
}
public boolean isBlocking() {
return isBlocking;
public float getFriction() {
return friction;
}
public float getSpeed() {
return speed;
}
public boolean isHasGravity() {
return hasGravity;
}
public boolean isAir() {
return isAir;
}
public boolean isBurnable() {
return isBurnable;
}
public boolean isFlammable() {
return isFlammable;
}
public boolean isOccluding() {
return isOccluding;
}
public boolean isSolid() {
return isSolid;
}
public boolean isLiquid() {
return isLiquid;
}
public boolean isBlocking() {
return isBlocking;
}
public boolean isRequiresCorrectTool() {
return requiresCorrectTool;
}
public boolean isReplaceable() {
switch (getMaterialType()) {
case AIR:
case STRUCTURAL_AIR:
case REPLACEABLE_PLANT:
case REPLACEABLE_FIREPROOF_PLANT:
case REPLACEABLE_WATER_PLANT:
case WATER:
case BUBBLE_COLUMN:
case LAVA:
case TOP_SNOW:
case FIRE:
return true;
default:
return false;
}
return isReplaceable;
}
public boolean exceedsCube() {
return exceedsCube;
}
public PushReaction getPushReaction() {
return pushReaction;
}
public MaterialType getMaterialType() {
return materialType;
}
@Override
public String toString() {
return name;
}
}
@@ -42,7 +42,6 @@ public enum StateValue {
DISTANCE("distance", Integer::parseInt),
DOWN("down", Boolean::parseBoolean),
DRAG("drag", Boolean::parseBoolean),
DUSTED("dusted", Integer::parseInt),
EAST("east", East::valueOf),
EGGS("eggs", Integer::parseInt),
ENABLED("enabled", Boolean::parseBoolean),
@@ -50,7 +49,6 @@ public enum StateValue {
EYE("eye", Boolean::parseBoolean),
FACE("face", Face::valueOf),
FACING("facing", BlockFace::valueOf),
FLOWER_AMOUNT("flower_amount", Integer::parseInt),
HALF("half", Half::valueOf),
HANGING("hanging", Boolean::parseBoolean),
HAS_BOOK("has_book", Boolean::parseBoolean),
@@ -87,12 +85,6 @@ public enum StateValue {
SHORT("short", Boolean::parseBoolean),
SHRIEKING("shrieking", Boolean::parseBoolean),
SIGNAL_FIRE("signal_fire", Boolean::parseBoolean),
SLOT_0_OCCUPIED("slot_0_occupied", Boolean::parseBoolean),
SLOT_1_OCCUPIED("slot_1_occupied", Boolean::parseBoolean),
SLOT_2_OCCUPIED("slot_2_occupied", Boolean::parseBoolean),
SLOT_3_OCCUPIED("slot_3_occupied", Boolean::parseBoolean),
SLOT_4_OCCUPIED("slot_4_occupied", Boolean::parseBoolean),
SLOT_5_OCCUPIED("slot_5_occupied", Boolean::parseBoolean),
SNOWY("snowy", Boolean::parseBoolean),
STAGE("stage", Integer::parseInt),
SOUTH("south", South::valueOf),
@@ -104,10 +96,7 @@ public enum StateValue {
UP("up", Boolean::parseBoolean),
VERTICAL_DIRECTION("vertical_direction", VerticalDirection::valueOf),
WATERLOGGED("waterlogged", Boolean::parseBoolean),
WEST("west", West::valueOf),
CRACKED("cracked", Boolean::parseBoolean),
CRAFTING("crafting", Boolean::parseBoolean),
TRIAL_SPAWNER_STATE("trial_spawner_state", TrialSpawnerState::valueOf);
WEST("west", West::valueOf);
private final String name;
private final Function<String, Object> parser;
@@ -32,9 +32,8 @@ import java.util.function.Function;
public class PacketEventsSettings {
private TimeStampMode timestampMode = TimeStampMode.MILLIS;
private boolean defaultReencode = true; // true for backwards compat and more idiot-proof
private boolean readOnlyListeners = false;
private boolean checkForUpdates = true;
private boolean downsampleColors = true;
private boolean bStatsEnabled = true;
private boolean debugEnabled = false;
private Function<String, InputStream> resourceProvider = path -> PacketEventsSettings.class
@@ -60,12 +59,12 @@ public class PacketEventsSettings {
}
/**
* Do we re-encode all packets by default?
* @param reEncodeByDefault Value
* Are the packet listeners all read only?
* @param readOnlyListeners Value
* @return Settings instance
*/
public PacketEventsSettings reEncodeByDefault(boolean reEncodeByDefault) {
this.defaultReencode = reEncodeByDefault;
public PacketEventsSettings readOnlyListeners(boolean readOnlyListeners) {
this.readOnlyListeners = readOnlyListeners;
return this;
}
@@ -80,17 +79,6 @@ public class PacketEventsSettings {
return this;
}
/**
* This decides if PacketEvents should downsample RGB colors on pre-1.16 servers.
*
* @param downsampleColors Value
* @return Settings instance.
*/
public PacketEventsSettings downsampleColors(boolean downsampleColors) {
this.downsampleColors = downsampleColors;
return this;
}
/**
* This decides if PacketEvents should collect data anonymously and report to bStats.
*
@@ -127,10 +115,10 @@ public class PacketEventsSettings {
/**
* Should the packet listeners be read only?
* @return Getter for {@link #defaultReencode}
* @return Getter for {@link #readOnlyListeners}
*/
public boolean reEncodeByDefault() {
return defaultReencode;
public boolean shouldListenersReadOnly() {
return readOnlyListeners;
}
/**
@@ -142,15 +130,6 @@ public class PacketEventsSettings {
return checkForUpdates;
}
/**
* Should we downsample RGB colors on pre-1.16 servers?
*
* @return Getter for {@link #downsampleColors}
*/
public boolean shouldDownsampleColors() {
return downsampleColors;
}
/**
* Should we collect server data anonymously and report to bStats?
@@ -16,10 +16,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.github.retrooper.packetevents.util.adventure;
package com.github.retrooper.packetevents.util;
import com.github.retrooper.packetevents.PacketEvents;
import com.github.retrooper.packetevents.manager.server.ServerVersion;
import com.github.retrooper.packetevents.util.adventure.GsonComponentSerializerExtended;
import com.google.gson.JsonElement;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
@@ -28,43 +29,31 @@ import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
public class AdventureSerializer {
private static GsonComponentSerializer GSON;
private static LegacyComponentSerializer LEGACY;
private static final LegacyComponentSerializer LEGACY = LegacyComponentSerializer.builder().build();
public static String asVanilla(Component component) {
return LEGACY.serialize(component);
}
public static Component fromLegacyFormat(String legacyMessage) {
return LEGACY.deserialize(legacyMessage);
}
public static GsonComponentSerializer getGsonSerializer() {
if (GSON == null) {
ServerVersion version = PacketEvents.getAPI().getServerManager().getVersion();
GSON = new GsonComponentSerializerExtended(
version.isOlderThan(ServerVersion.V_1_16) && PacketEvents.getAPI().getSettings().shouldDownsampleColors(),
version.isOlderThanOrEquals(ServerVersion.V_1_12_2)
);
GSON = new GsonComponentSerializerExtended(version.isOlderThan(ServerVersion.V_1_16),
version.isOlderThanOrEquals(ServerVersion.V_1_12_2));
}
return GSON;
}
public static LegacyComponentSerializer getLegacyGsonSerializer() {
if (LEGACY == null) {
LegacyComponentSerializer.Builder builder = LegacyComponentSerializer.builder();
if (!PacketEvents.getAPI().getSettings().shouldDownsampleColors() || PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_16))
builder = builder.hexColors();
LEGACY = builder.build();
}
return LEGACY;
}
public static String asVanilla(Component component) {
return getLegacyGsonSerializer().serialize(component);
}
public static Component fromLegacyFormat(String legacyMessage) {
return getLegacyGsonSerializer().deserializeOrNull(legacyMessage);
}
public static String toLegacyFormat(Component component) {
return getLegacyGsonSerializer().serializeOrNull(component);
}
public static Component parseComponent(String json) {
return getGsonSerializer().deserializeOrNull(json);
return getGsonSerializer().deserialize(json);
}
public static Component parseJsonTree(JsonElement json) {
@@ -72,11 +61,11 @@ public class AdventureSerializer {
}
public static String toJson(Component component) {
return getGsonSerializer().serializeOrNull(component);
return getGsonSerializer().serialize(component);
}
public static JsonElement toJsonTree(Component component) {
return getGsonSerializer().serializeToTree(component);
}
}
}
@@ -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.getDecoderState()) {
switch (user.getConnectionState()) {
case HANDSHAKING:
return new PacketHandshakeReceiveEvent(channel, user, player, buffer, autoProtocolTranslation);
case STATUS:
@@ -36,15 +36,14 @@ 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);
default:
return null;
}
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.getEncoderState()) {
switch (user.getConnectionState()) {
case HANDSHAKING:
return new PacketHandshakeSendEvent(channel, user, player, buffer, autoProtocolTranslation);
case STATUS:
@@ -53,9 +52,8 @@ 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);
default:
return null;
}
throw new RuntimeException("Unknown connection state " + user.getEncoderState() + "!");
}
}
@@ -22,8 +22,9 @@ import java.util.Set;
public class ExceptionUtil {
public static boolean isException(Throwable t, Class<?> clazz) {
Class<?> throwableClass = t.getClass();
while (t != null) {
if (clazz.isAssignableFrom(t.getClass())) {
if (clazz.isAssignableFrom(throwableClass)) {
return true;
}
@@ -1,20 +0,0 @@
package com.github.retrooper.packetevents.util;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
public final class LegacyFormat {
private LegacyFormat() {
}
public static String trimLegacyFormat(String text, int length) {
if (text.length() <= length) {
return text;
}
if (text.charAt(length - 1) == LegacyComponentSerializer.SECTION_CHAR) {
return text.substring(0, length - 1);
}
return text.substring(0, length);
}
}
@@ -19,7 +19,6 @@
package com.github.retrooper.packetevents.util;
import com.github.retrooper.packetevents.PacketEvents;
import com.github.retrooper.packetevents.util.adventure.AdventureSerializer;
import com.google.gson.JsonObject;
import java.io.BufferedReader;
@@ -19,7 +19,6 @@
package com.github.retrooper.packetevents.util;
import com.github.retrooper.packetevents.protocol.player.TextureProperty;
import com.github.retrooper.packetevents.util.adventure.AdventureSerializer;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
Loaded 100 of 259 files, more files were not shown because too many files have changed in this diff. Show more