mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-12-23 00:47:39 +01:00
parent
d43ad37663
commit
5053d739c0
@ -82,7 +82,7 @@ public class ItemType1_20_5 extends Type<Item> {
|
||||
|
||||
@Override
|
||||
public void write(final ByteBuf buffer, @Nullable final Item object) {
|
||||
if (object == null || object.identifier() == 0 || object.amount() <= 0) {
|
||||
if (object == null || object.isEmpty()) {
|
||||
Types.VAR_INT.writePrimitive(buffer, 0);
|
||||
return;
|
||||
}
|
||||
|
@ -28,8 +28,8 @@ import com.viaversion.viaversion.api.minecraft.Particle;
|
||||
import com.viaversion.viaversion.api.minecraft.RegistryEntry;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_20_5;
|
||||
import com.viaversion.viaversion.api.minecraft.item.Item;
|
||||
import com.viaversion.viaversion.api.minecraft.entitydata.EntityData;
|
||||
import com.viaversion.viaversion.api.minecraft.item.Item;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||
import com.viaversion.viaversion.api.type.Types;
|
||||
@ -46,6 +46,7 @@ import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ClientboundCon
|
||||
import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ClientboundPackets1_20_5;
|
||||
import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.storage.AcknowledgedMessagesStorage;
|
||||
import com.viaversion.viaversion.rewriter.EntityRewriter;
|
||||
import com.viaversion.viaversion.rewriter.entitydata.EntityDataHandler;
|
||||
import com.viaversion.viaversion.util.Key;
|
||||
import com.viaversion.viaversion.util.TagUtil;
|
||||
import it.unimi.dsi.fastutil.ints.IntArraySet;
|
||||
@ -481,6 +482,18 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter<Clientbound
|
||||
meta.setValue(withAlpha(color));
|
||||
}
|
||||
});
|
||||
|
||||
final EntityDataHandler emptyItemHandler = (event, data) -> {
|
||||
final Item item = data.value();
|
||||
if (item == null || item.isEmpty()) {
|
||||
// The item is used for particles or projectile display and can no longer be empty
|
||||
event.cancel();
|
||||
}
|
||||
};
|
||||
filter().type(EntityTypes1_20_5.EGG).index(8).handler(emptyItemHandler);
|
||||
filter().type(EntityTypes1_20_5.SNOWBALL).index(8).handler(emptyItemHandler);
|
||||
filter().type(EntityTypes1_20_5.ENDER_PEARL).index(8).handler(emptyItemHandler);
|
||||
filter().type(EntityTypes1_20_5.EXPERIENCE_BOTTLE).index(8).handler(emptyItemHandler);
|
||||
}
|
||||
|
||||
private void addColor(@Nullable final EntityData particleMeta, final int color) {
|
||||
|
@ -513,7 +513,7 @@ public abstract class EntityRewriter<C extends ClientboundPacketType, T extends
|
||||
final Map<String, DimensionData> dimensionDataMap = new HashMap<>(entries.length);
|
||||
for (int i = 0; i < entries.length; i++) {
|
||||
final RegistryEntry entry = entries[i];
|
||||
dimensionDataMap.put(entry.key(), new DimensionDataImpl(i, (CompoundTag) entry.tag()));
|
||||
dimensionDataMap.put(Key.stripMinecraftNamespace(entry.key()), new DimensionDataImpl(i, (CompoundTag) entry.tag()));
|
||||
}
|
||||
tracker(wrapper.user()).setDimensions(dimensionDataMap);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user