mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-12-22 08:27:37 +01:00
parent
f93c64d6aa
commit
e32205ddaf
@ -28,9 +28,10 @@ import com.viaversion.viaversion.api.type.Types;
|
||||
import com.viaversion.viaversion.api.type.types.ArrayType;
|
||||
import com.viaversion.viaversion.api.type.types.version.Types1_21;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
public record FoodProperties1_20_5(int nutrition, float saturationModifier, boolean canAlwaysEat, float eatSeconds,
|
||||
Item usingConvertsTo, FoodEffect[] possibleEffects) {
|
||||
@Nullable Item usingConvertsTo, FoodEffect[] possibleEffects) {
|
||||
|
||||
public static final Type<FoodProperties1_20_5> TYPE1_20_5 = new Type<>(FoodProperties1_20_5.class) {
|
||||
@Override
|
||||
|
@ -423,12 +423,20 @@ public final class BlockItemPacketRewriter1_21_2 extends StructuredItemRewriter<
|
||||
}
|
||||
|
||||
super.handleItemToClient(connection, item);
|
||||
|
||||
// Handle food properties item manually here - the only protocol that has it
|
||||
// The other way around it's handled by the super handleItemToServer method
|
||||
final StructuredDataContainer data = item.dataContainer();
|
||||
final FoodProperties1_20_5 food = data.get(StructuredDataKey.FOOD1_21);
|
||||
if (food != null && food.usingConvertsTo() != null) {
|
||||
this.handleItemToClient(connection, food.usingConvertsTo());
|
||||
}
|
||||
|
||||
updateItemData(item);
|
||||
|
||||
// Add data components to fix issues in older protocols
|
||||
appendItemDataFixComponents(connection, item);
|
||||
|
||||
final StructuredDataContainer data = item.dataContainer();
|
||||
final Enchantments enchantments = data.get(StructuredDataKey.ENCHANTMENTS);
|
||||
if (enchantments != null && enchantments.size() != 0) {
|
||||
// Level 0 is no longer allowed
|
||||
|
Loading…
Reference in New Issue
Block a user