fixed material placement

This commit is contained in:
FlorianMichael 2023-03-03 17:45:36 +01:00
parent 42ad790415
commit 43fb26bcc2
5 changed files with 5 additions and 37 deletions

View File

@ -8,7 +8,7 @@ yarn_mappings=1.19.3+build.5
loader_version=0.14.14
# viafabricplus
mod_version=1.5.8
mod_version=1.5.9
maven_group=de.florianmichael
archives_base_name=viafabricplus

View File

@ -1,11 +0,0 @@
package de.florianmichael.viafabricplus.injection.access;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.util.Pair;
import java.util.Deque;
public interface IPacketWrapperImpl {
Deque<Pair<Type<?>, Object>> viafabricplus_readableObjects();
}

View File

@ -1,21 +0,0 @@
package de.florianmichael.viafabricplus.injection.mixin.fixes.viaversion;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.protocol.packet.PacketWrapperImpl;
import com.viaversion.viaversion.util.Pair;
import de.florianmichael.viafabricplus.injection.access.IPacketWrapperImpl;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import java.util.Deque;
@Mixin(value = PacketWrapperImpl.class, remap = false)
public class MixinPacketWrapperImpl implements IPacketWrapperImpl {
@Shadow @Final private Deque<Pair<Type<?>, Object>> readableObjects;
@Override
public Deque<Pair<Type<?>, Object>> viafabricplus_readableObjects() {
return this.readableObjects;
}
}

View File

@ -7,8 +7,8 @@ import com.viaversion.viaversion.api.protocol.ProtocolPathEntry;
import com.viaversion.viaversion.api.protocol.packet.Direction;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.protocol.packet.State;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.protocol.packet.PacketWrapperImpl;
import de.florianmichael.viafabricplus.injection.access.IPacketWrapperImpl;
import de.florianmichael.vialoadingbase.ViaLoadingBase;
import io.netty.buffer.Unpooled;
import net.minecraft.item.ItemStack;
@ -36,10 +36,11 @@ public class ItemTranslator {
final PacketWrapper wrapper = new PacketWrapperImpl(id, emptyBuf, user);
try {
wrapper.apply(Direction.SERVERBOUND, State.PLAY, 0, protocolPath.stream().map(ProtocolPathEntry::protocol).collect(Collectors.toList()));
wrapper.read(Type.SHORT);
return wrapper.read(Type.ITEM);
} catch (Exception e) {
throw new RuntimeException(e);
}
return (Item) ((IPacketWrapperImpl) wrapper).viafabricplus_readableObjects().stream().filter(typeObjectPair -> Item.class.equals(typeObjectPair.key().getOutputClass())).findFirst().orElse(null).value();
}
}

View File

@ -100,7 +100,6 @@
"fixes.vialegacy.MixinProtocol1_8to1_7_6_10",
"fixes.vialoadingbase.MixinVLBViaConfig",
"fixes.viaversion.MixinCommonBoss",
"fixes.viaversion.MixinPacketWrapperImpl",
"fixes.viaversion.MixinProtocolVersion",
"fixes.viaversion.protocol1_11to1_10.MixinProtocol1_11To1_10",
"fixes.viaversion.protocol1_12to1_11_1.MixinChatItemRewriter",