mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-11-15 10:45:35 +01:00
Code cleanup
This commit is contained in:
parent
f45895c547
commit
a6fd03ded2
@ -20,7 +20,10 @@
|
||||
package de.florianmichael.viafabricplus.fixes;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.AbstractSimpleProtocol;
|
||||
import com.viaversion.viaversion.api.protocol.packet.*;
|
||||
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType;
|
||||
import com.viaversion.viaversion.api.protocol.packet.State;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.protocols.protocol1_20_5to1_20_3.packet.ClientboundPackets1_20_5;
|
||||
@ -104,5 +107,6 @@ public class VFPProtocol extends AbstractSimpleProtocol {
|
||||
interface PacketReader {
|
||||
|
||||
void read(PacketWrapper wrapper) throws Exception;
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ public abstract class MixinDrawContext {
|
||||
|
||||
@Redirect(method = "drawItemInSlot(Lnet/minecraft/client/font/TextRenderer;Lnet/minecraft/item/ItemStack;IILjava/lang/String;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;getCount()I"))
|
||||
private int handleNegativeItemCount(ItemStack instance) {
|
||||
final NbtCompound tag = ItemUtil.getOrNull(instance);
|
||||
final NbtCompound tag = ItemUtil.getTagOrNull(instance);
|
||||
if (tag != null && tag.contains(ClientsideFixes.ITEM_COUNT_FIX_KEY)) {
|
||||
return tag.getInt(ClientsideFixes.ITEM_COUNT_FIX_KEY);
|
||||
} else {
|
||||
|
@ -62,7 +62,7 @@ public abstract class MixinItemStack {
|
||||
return;
|
||||
}
|
||||
|
||||
final NbtCompound tag = ItemUtil.getOrNull((ItemStack) (Object) this);
|
||||
final NbtCompound tag = ItemUtil.getTagOrNull((ItemStack) (Object) this);
|
||||
if (tag == null) {
|
||||
return;
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ import net.minecraft.nbt.NbtCompound;
|
||||
public class ItemUtil {
|
||||
|
||||
// Via 1.20.5->.3 will always put the original item data into CUSTOM_DATA if it's not empty.
|
||||
public static NbtCompound getOrNull(final ItemStack stack) {
|
||||
public static NbtCompound getTagOrNull(final ItemStack stack) {
|
||||
if (!stack.contains(DataComponentTypes.CUSTOM_DATA)) {
|
||||
return null;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user