mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-11-16 10:55:39 +01:00
Rename tracker package and ViaFabricPlusProtocol protocol
This commit is contained in:
parent
68c6310c9d
commit
ad75e36213
@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viafabricplus.fixes.tracker;
|
||||
package de.florianmichael.viafabricplus.fixes.viaversion;
|
||||
|
||||
import com.viaversion.viaversion.api.connection.StoredObject;
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viafabricplus.fixes.tracker;
|
||||
package de.florianmichael.viafabricplus.fixes.viaversion;
|
||||
|
||||
import com.viaversion.viaversion.api.connection.StoredObject;
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viafabricplus.fixes;
|
||||
package de.florianmichael.viafabricplus.fixes.viaversion;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.AbstractSimpleProtocol;
|
||||
import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType;
|
||||
@ -41,13 +41,13 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
// Protocol to handle error handling changes in older protocols, always last element of the pipeline
|
||||
public class VFPProtocol extends AbstractSimpleProtocol {
|
||||
public class ViaFabricPlusProtocol extends AbstractSimpleProtocol {
|
||||
|
||||
public static final VFPProtocol INSTANCE = new VFPProtocol();
|
||||
public static final ViaFabricPlusProtocol INSTANCE = new ViaFabricPlusProtocol();
|
||||
|
||||
private final Map<String, Pair<ProtocolVersion, PacketReader>> payloadDiff = new HashMap<>();
|
||||
|
||||
public VFPProtocol() {
|
||||
public ViaFabricPlusProtocol() {
|
||||
registerMapping(BrandCustomPayload.ID, LegacyProtocolVersion.c0_0_15a_1, wrapper -> wrapper.passthrough(Types.STRING));
|
||||
registerMapping(DebugGameTestAddMarkerCustomPayload.ID, ProtocolVersion.v1_14, wrapper -> {
|
||||
wrapper.passthrough(Types.BLOCK_POSITION1_14);
|
@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.florianmichael.viafabricplus.fixes.tracker;
|
||||
package de.florianmichael.viafabricplus.fixes.viaversion;
|
||||
|
||||
import com.viaversion.viaversion.api.connection.StoredObject;
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
@ -21,7 +21,7 @@ package de.florianmichael.viafabricplus.injection.mixin.base.integration;
|
||||
|
||||
import com.viaversion.viaversion.api.connection.ProtocolInfo;
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import de.florianmichael.viafabricplus.fixes.tracker.JoinGameDataTracker;
|
||||
import de.florianmichael.viafabricplus.fixes.viaversion.JoinGameDataTracker;
|
||||
import de.florianmichael.viafabricplus.injection.ViaFabricPlusMixinPlugin;
|
||||
import de.florianmichael.viafabricplus.injection.access.IChunkTracker;
|
||||
import de.florianmichael.viafabricplus.injection.access.IRakSessionCodec;
|
||||
|
@ -20,7 +20,7 @@
|
||||
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.entity;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.fixes.tracker.WolfHealthTracker;
|
||||
import de.florianmichael.viafabricplus.fixes.viaversion.WolfHealthTracker;
|
||||
import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import net.minecraft.component.DataComponentTypes;
|
||||
import net.minecraft.component.type.FoodComponent;
|
||||
|
@ -51,7 +51,6 @@ import org.spongepowered.asm.mixin.Mutable;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.*;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashSet;
|
||||
@ -78,9 +77,6 @@ public abstract class MixinClientPlayNetworkHandler extends ClientCommonNetworkH
|
||||
@Shadow
|
||||
protected abstract boolean isSecureChatEnforced();
|
||||
|
||||
@Shadow
|
||||
public abstract void sendChatCommand(String command);
|
||||
|
||||
protected MixinClientPlayNetworkHandler(MinecraftClient client, ClientConnection connection, ClientConnectionState connectionState) {
|
||||
super(client, connection, connectionState);
|
||||
}
|
||||
@ -94,14 +90,6 @@ public abstract class MixinClientPlayNetworkHandler extends ClientCommonNetworkH
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "sendCommand", at = @At("HEAD"), cancellable = true)
|
||||
private void alwaysSendSignedCommand(String command, CallbackInfoReturnable<Boolean> cir) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20_3)) {
|
||||
sendChatCommand(command);
|
||||
cir.setReturnValue(true);
|
||||
}
|
||||
}
|
||||
|
||||
@WrapWithCondition(method = "onEnterReconfiguration", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;sendAcknowledgment()V"))
|
||||
private boolean dontSendChatAck(ClientPlayNetworkHandler instance) {
|
||||
return ProtocolTranslator.getTargetVersion().newerThanOrEqualTo(ProtocolVersion.v1_20_5);
|
||||
|
@ -25,7 +25,7 @@ import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||
import com.viaversion.viaversion.api.type.Types;
|
||||
import com.viaversion.viaversion.protocols.v1_8to1_9.packet.ClientboundPackets1_8;
|
||||
import com.viaversion.viaversion.protocols.v1_8to1_9.packet.ServerboundPackets1_8;
|
||||
import de.florianmichael.viafabricplus.fixes.tracker.TeleportTracker;
|
||||
import de.florianmichael.viafabricplus.fixes.viaversion.TeleportTracker;
|
||||
import net.raphimc.vialegacy.protocol.release.r1_7_2_5tor1_7_6_10.packet.ClientboundPackets1_7_2;
|
||||
import net.raphimc.vialegacy.protocol.release.r1_7_2_5tor1_7_6_10.packet.ServerboundPackets1_7_2;
|
||||
import net.raphimc.vialegacy.protocol.release.r1_7_6_10tor1_8.Protocolr1_7_6_10Tor1_8;
|
||||
|
@ -24,7 +24,7 @@ import com.viaversion.viaversion.protocols.v1_14_4to1_15.Protocol1_14_4To1_15;
|
||||
import com.viaversion.viaversion.protocols.v1_14_4to1_15.rewriter.EntityPacketRewriter1_15;
|
||||
import com.viaversion.viaversion.rewriter.EntityRewriter;
|
||||
import com.viaversion.viaversion.rewriter.entitydata.EntityDataFilter;
|
||||
import de.florianmichael.viafabricplus.fixes.tracker.WolfHealthTracker;
|
||||
import de.florianmichael.viafabricplus.fixes.viaversion.WolfHealthTracker;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
@ -20,7 +20,7 @@
|
||||
package de.florianmichael.viafabricplus.injection.mixin.viabedrock;
|
||||
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import de.florianmichael.viafabricplus.fixes.tracker.JoinGameDataTracker;
|
||||
import de.florianmichael.viafabricplus.fixes.viaversion.JoinGameDataTracker;
|
||||
import net.raphimc.viabedrock.protocol.BedrockProtocol;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
|
@ -21,7 +21,7 @@ package de.florianmichael.viafabricplus.injection.mixin.viabedrock;
|
||||
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import de.florianmichael.viafabricplus.fixes.tracker.JoinGameDataTracker;
|
||||
import de.florianmichael.viafabricplus.fixes.viaversion.JoinGameDataTracker;
|
||||
import net.raphimc.viabedrock.protocol.packets.JoinPackets;
|
||||
import net.raphimc.viabedrock.protocol.types.primitive.LongLEType;
|
||||
import net.raphimc.viabedrock.protocol.types.primitive.StringType;
|
||||
|
@ -35,7 +35,7 @@ import com.viaversion.viaversion.connection.UserConnectionImpl;
|
||||
import com.viaversion.viaversion.protocol.ProtocolPipelineImpl;
|
||||
import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.Protocol1_20_3To1_20_5;
|
||||
import de.florianmichael.viafabricplus.event.ChangeProtocolVersionCallback;
|
||||
import de.florianmichael.viafabricplus.fixes.VFPProtocol;
|
||||
import de.florianmichael.viafabricplus.fixes.viaversion.ViaFabricPlusProtocol;
|
||||
import de.florianmichael.viafabricplus.injection.access.IClientConnection;
|
||||
import de.florianmichael.viafabricplus.protocoltranslator.impl.command.ViaFabricPlusVLCommandHandler;
|
||||
import de.florianmichael.viafabricplus.protocoltranslator.impl.platform.ViaFabricPlusViaLegacyPlatformImpl;
|
||||
@ -323,7 +323,7 @@ public class ProtocolTranslator {
|
||||
);
|
||||
Protocol1_20_3To1_20_5.strictErrorHandling = false;
|
||||
ProtocolVersion.register(AUTO_DETECT_PROTOCOL);
|
||||
VFPProtocol.INSTANCE.initialize();
|
||||
ViaFabricPlusProtocol.INSTANCE.initialize();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@ package de.florianmichael.viafabricplus.protocoltranslator.netty;
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||
import de.florianmichael.viafabricplus.ViaFabricPlus;
|
||||
import de.florianmichael.viafabricplus.fixes.VFPProtocol;
|
||||
import de.florianmichael.viafabricplus.fixes.viaversion.ViaFabricPlusProtocol;
|
||||
import io.netty.channel.ChannelHandler;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import net.minecraft.network.handler.HandlerNames;
|
||||
@ -47,7 +47,7 @@ public class ViaFabricPlusVLLegacyPipeline extends VLLegacyPipeline {
|
||||
|
||||
ctx.pipeline().addAfter(VIA_DECODER_NAME, VIA_FLOW_CONTROL, new NoReadFlowControlHandler());
|
||||
|
||||
this.user.getProtocolInfo().getPipeline().add(VFPProtocol.INSTANCE);
|
||||
this.user.getProtocolInfo().getPipeline().add(ViaFabricPlusProtocol.INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -29,7 +29,7 @@ import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.api.type.Types;
|
||||
import com.viaversion.viaversion.api.type.types.version.Types1_20_5;
|
||||
import de.florianmichael.viafabricplus.ViaFabricPlus;
|
||||
import de.florianmichael.viafabricplus.fixes.VFPProtocol;
|
||||
import de.florianmichael.viafabricplus.fixes.viaversion.ViaFabricPlusProtocol;
|
||||
import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
@ -60,7 +60,7 @@ public class ItemTranslator {
|
||||
buf.writeShort(0); // slot
|
||||
ItemStack.OPTIONAL_PACKET_CODEC.encode(buf, stack); // item
|
||||
|
||||
final PacketWrapper setCreativeModeSlot = PacketWrapper.create(VFPProtocol.getSetCreativeModeSlot(), buf, user);
|
||||
final PacketWrapper setCreativeModeSlot = PacketWrapper.create(ViaFabricPlusProtocol.getSetCreativeModeSlot(), buf, user);
|
||||
user.getProtocolInfo().getPipeline().transform(Direction.SERVERBOUND, State.PLAY, setCreativeModeSlot);
|
||||
|
||||
setCreativeModeSlot.read(Types.SHORT); // slot
|
||||
|
Loading…
Reference in New Issue
Block a user