Added remaining non-existent item remappers

This commit is contained in:
RaphiMC 2023-01-21 00:46:48 +01:00
parent 5d06b20348
commit 7fe64745b6
24 changed files with 518 additions and 21 deletions

View File

@ -23,7 +23,9 @@ import com.viaversion.viaversion.api.platform.providers.ViaProviders;
import com.viaversion.viaversion.api.protocol.AbstractProtocol;
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
import com.viaversion.viaversion.api.type.Type;
import net.raphimc.vialegacy.api.remapper.LegacyItemRewriter;
import net.raphimc.vialegacy.api.splitter.PreNettySplitter;
import net.raphimc.vialegacy.protocols.beta.protocol1_0_0_1tob1_8_0_1.rewriter.ItemRewriter;
import net.raphimc.vialegacy.protocols.beta.protocol1_0_0_1tob1_8_0_1.storage.PlayerAirTimeStorage;
import net.raphimc.vialegacy.protocols.beta.protocol1_0_0_1tob1_8_0_1.task.PlayerAirTimeUpdateTask;
import net.raphimc.vialegacy.protocols.beta.protocol1_0_0_1tob1_8_0_1.types.Typesb1_8_0_1;
@ -35,12 +37,16 @@ import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types.Types
public class Protocol1_0_0_1tob1_8_0_1 extends AbstractProtocol<ClientboundPacketsb1_8, ClientboundPackets1_0, ServerboundPacketsb1_8, ServerboundPackets1_0> {
private final LegacyItemRewriter<Protocol1_0_0_1tob1_8_0_1> itemRewriter = new ItemRewriter(this);
public Protocol1_0_0_1tob1_8_0_1() {
super(ClientboundPacketsb1_8.class, ClientboundPackets1_0.class, ServerboundPacketsb1_8.class, ServerboundPackets1_0.class);
}
@Override
protected void registerPackets() {
this.itemRewriter.register();
this.registerClientbound(ClientboundPacketsb1_8.SET_EXPERIENCE, new PacketRemapper() {
@Override
public void registerMap() {
@ -95,6 +101,7 @@ public class Protocol1_0_0_1tob1_8_0_1 extends AbstractProtocol<ClientboundPacke
public void registerMap() {
map(Type.SHORT); // slot
map(Types1_2_4.COMPRESSED_NBT_ITEM, Typesb1_8_0_1.CREATIVE_ITEM); // item
handler(wrapper -> itemRewriter.handleItemToServer(wrapper.get(Typesb1_8_0_1.CREATIVE_ITEM, 0)));
}
});
this.cancelServerbound(ServerboundPackets1_0.CLICK_WINDOW_BUTTON);
@ -112,4 +119,9 @@ public class Protocol1_0_0_1tob1_8_0_1 extends AbstractProtocol<ClientboundPacke
userConnection.put(new PlayerAirTimeStorage(userConnection));
}
@Override
public LegacyItemRewriter<Protocol1_0_0_1tob1_8_0_1> getItemRewriter() {
return this.itemRewriter;
}
}

View File

@ -0,0 +1,34 @@
/*
* This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy
* Copyright (C) 2023 RK_01/RaphiMC and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.beta.protocol1_0_0_1tob1_8_0_1.rewriter;
import net.raphimc.vialegacy.api.remapper.LegacyItemRewriter;
import net.raphimc.vialegacy.protocols.beta.protocol1_0_0_1tob1_8_0_1.Protocol1_0_0_1tob1_8_0_1;
public class ItemRewriter extends LegacyItemRewriter<Protocol1_0_0_1tob1_8_0_1> {
public ItemRewriter(final Protocol1_0_0_1tob1_8_0_1 protocol) {
super(protocol, "b1.8.1");
this.addNonExistentItemRange(110, 122);
this.addNonExistentItemRange(369, 382);
this.addNonExistentItems(438);
this.addNonExistentItemRange(2256, 2266);
}
}

View File

@ -22,8 +22,10 @@ import com.viaversion.viaversion.api.protocol.AbstractProtocol;
import com.viaversion.viaversion.api.protocol.packet.State;
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
import com.viaversion.viaversion.api.type.Type;
import net.raphimc.vialegacy.api.remapper.LegacyItemRewriter;
import net.raphimc.vialegacy.api.splitter.PreNettySplitter;
import net.raphimc.vialegacy.protocols.release.protocol1_1to1_0_0_1.rewriter.ChatFilter;
import net.raphimc.vialegacy.protocols.release.protocol1_1to1_0_0_1.rewriter.ItemRewriter;
import net.raphimc.vialegacy.protocols.release.protocol1_2_1_3to1_1.ClientboundPackets1_1;
import net.raphimc.vialegacy.protocols.release.protocol1_2_1_3to1_1.ServerboundPackets1_1;
import net.raphimc.vialegacy.protocols.release.protocol1_7_2_5to1_6_4.types.Types1_6_4;
@ -31,12 +33,16 @@ import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types.Types
public class Protocol1_1to1_0_0_1 extends AbstractProtocol<ClientboundPackets1_0, ClientboundPackets1_1, ServerboundPackets1_0, ServerboundPackets1_1> {
private final LegacyItemRewriter<Protocol1_1to1_0_0_1> itemRewriter = new ItemRewriter(this);
public Protocol1_1to1_0_0_1() {
super(ClientboundPackets1_0.class, ClientboundPackets1_1.class, ServerboundPackets1_0.class, ServerboundPackets1_1.class);
}
@Override
protected void registerPackets() {
this.itemRewriter.register();
this.registerServerbound(State.LOGIN, ServerboundPackets1_0.LOGIN.getId(), ServerboundPackets1_1.LOGIN.getId(), new PacketRemapper() {
@Override
public void registerMap() {
@ -126,4 +132,9 @@ public class Protocol1_1to1_0_0_1 extends AbstractProtocol<ClientboundPackets1_0
userConnection.put(new PreNettySplitter(userConnection, Protocol1_1to1_0_0_1.class, ClientboundPackets1_0::getPacket));
}
@Override
public LegacyItemRewriter<Protocol1_1to1_0_0_1> getItemRewriter() {
return this.itemRewriter;
}
}

View File

@ -0,0 +1,38 @@
/*
* This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy
* Copyright (C) 2023 RK_01/RaphiMC and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.release.protocol1_1to1_0_0_1.rewriter;
import net.raphimc.vialegacy.api.remapper.LegacyItemRewriter;
import net.raphimc.vialegacy.protocols.release.protocol1_1to1_0_0_1.Protocol1_1to1_0_0_1;
import net.raphimc.vialegacy.protocols.release.protocol1_2_1_3to1_1.ServerboundPackets1_1;
import net.raphimc.vialegacy.protocols.release.protocol1_3_1_2to1_2_4_5.types.Types1_2_4;
public class ItemRewriter extends LegacyItemRewriter<Protocol1_1to1_0_0_1> {
public ItemRewriter(final Protocol1_1to1_0_0_1 protocol) {
super(protocol, "1.0");
this.addNonExistentItems(383);
}
@Override
protected void registerPackets() {
this.registerCreativeInventoryAction(ServerboundPackets1_1.CREATIVE_INVENTORY_ACTION, Types1_2_4.COMPRESSED_NBT_ITEM);
}
}

View File

@ -33,6 +33,7 @@ import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
import net.raphimc.vialegacy.ViaLegacy;
import net.raphimc.vialegacy.api.model.IdAndData;
import net.raphimc.vialegacy.api.remapper.LegacyItemRewriter;
import net.raphimc.vialegacy.api.splitter.PreNettySplitter;
import net.raphimc.vialegacy.protocols.beta.protocolb1_8_0_1tob1_7_0_3.Protocolb1_8_0_1tob1_7_0_3;
import net.raphimc.vialegacy.protocols.classic.protocola1_0_15toc0_28_30.Protocola1_0_15toc0_30;
@ -43,6 +44,7 @@ import net.raphimc.vialegacy.protocols.release.protocol1_2_1_3to1_1.biome.beta.W
import net.raphimc.vialegacy.protocols.release.protocol1_2_1_3to1_1.biome.release.WorldChunkManager_r1_1;
import net.raphimc.vialegacy.protocols.release.protocol1_2_1_3to1_1.chunks.NibbleArray1_1;
import net.raphimc.vialegacy.protocols.release.protocol1_2_1_3to1_1.model.NonFullChunk1_1;
import net.raphimc.vialegacy.protocols.release.protocol1_2_1_3to1_1.rewriter.ItemRewriter;
import net.raphimc.vialegacy.protocols.release.protocol1_2_1_3to1_1.storage.DimensionTracker;
import net.raphimc.vialegacy.protocols.release.protocol1_2_1_3to1_1.storage.PendingBlocksTracker;
import net.raphimc.vialegacy.protocols.release.protocol1_2_1_3to1_1.storage.SeedStorage;
@ -61,12 +63,16 @@ import java.util.Arrays;
public class Protocol1_2_1_3to1_1 extends AbstractProtocol<ClientboundPackets1_1, ClientboundPackets1_2_1, ServerboundPackets1_1, ServerboundPackets1_2_1> {
private final LegacyItemRewriter<Protocol1_2_1_3to1_1> itemRewriter = new ItemRewriter(this);
public Protocol1_2_1_3to1_1() {
super(ClientboundPackets1_1.class, ClientboundPackets1_2_1.class, ServerboundPackets1_1.class, ServerboundPackets1_2_1.class);
}
@Override
protected void registerPackets() {
this.itemRewriter.register();
this.registerClientbound(ClientboundPackets1_1.JOIN_GAME, new PacketRemapper() {
@Override
public void registerMap() {
@ -376,4 +382,9 @@ public class Protocol1_2_1_3to1_1 extends AbstractProtocol<ClientboundPackets1_1
}
}
@Override
public LegacyItemRewriter<Protocol1_2_1_3to1_1> getItemRewriter() {
return this.itemRewriter;
}
}

View File

@ -0,0 +1,44 @@
/*
* This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy
* Copyright (C) 2023 RK_01/RaphiMC and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.release.protocol1_2_1_3to1_1.rewriter;
import net.raphimc.vialegacy.api.remapper.LegacyItemRewriter;
import net.raphimc.vialegacy.protocols.release.protocol1_2_1_3to1_1.Protocol1_2_1_3to1_1;
import net.raphimc.vialegacy.protocols.release.protocol1_2_4_5to1_2_1_3.ServerboundPackets1_2_1;
import net.raphimc.vialegacy.protocols.release.protocol1_3_1_2to1_2_4_5.types.Types1_2_4;
public class ItemRewriter extends LegacyItemRewriter<Protocol1_2_1_3to1_1> {
public ItemRewriter(final Protocol1_2_1_3to1_1 protocol) {
super(protocol, "1.1");
this.addNonExistentItem(6, 3);
this.addNonExistentItem(17, 3);
this.addNonExistentItem(18, 3);
this.addNonExistentItem(98, 3);
this.addNonExistentItemRange(123, 124);
this.addNonExistentItemRange(384, 385);
this.addNonExistentItem(383, 98);
}
@Override
protected void registerPackets() {
this.registerCreativeInventoryAction(ServerboundPackets1_2_1.CREATIVE_INVENTORY_ACTION, Types1_2_4.COMPRESSED_NBT_ITEM);
}
}

View File

@ -19,18 +19,24 @@ package net.raphimc.vialegacy.protocols.release.protocol1_2_4_5to1_2_1_3;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.protocol.AbstractProtocol;
import net.raphimc.vialegacy.api.remapper.LegacyItemRewriter;
import net.raphimc.vialegacy.api.splitter.PreNettySplitter;
import net.raphimc.vialegacy.protocols.release.protocol1_2_4_5to1_2_1_3.rewriter.ItemRewriter;
import net.raphimc.vialegacy.protocols.release.protocol1_3_1_2to1_2_4_5.ClientboundPackets1_2_4;
import net.raphimc.vialegacy.protocols.release.protocol1_3_1_2to1_2_4_5.ServerboundPackets1_2_4;
public class Protocol1_2_4_5to1_2_1_3 extends AbstractProtocol<ClientboundPackets1_2_1, ClientboundPackets1_2_4, ServerboundPackets1_2_1, ServerboundPackets1_2_4> {
private final LegacyItemRewriter<Protocol1_2_4_5to1_2_1_3> itemRewriter = new ItemRewriter(this);
public Protocol1_2_4_5to1_2_1_3() {
super(ClientboundPackets1_2_1.class, ClientboundPackets1_2_4.class, ServerboundPackets1_2_1.class, ServerboundPackets1_2_4.class);
}
@Override
protected void registerPackets() {
this.itemRewriter.register();
this.cancelServerbound(ServerboundPackets1_2_4.PLAYER_ABILITIES);
}
@ -39,4 +45,9 @@ public class Protocol1_2_4_5to1_2_1_3 extends AbstractProtocol<ClientboundPacket
userConnection.put(new PreNettySplitter(userConnection, Protocol1_2_4_5to1_2_1_3.class, ClientboundPackets1_2_1::getPacket));
}
@Override
public LegacyItemRewriter<Protocol1_2_4_5to1_2_1_3> getItemRewriter() {
return this.itemRewriter;
}
}

View File

@ -0,0 +1,39 @@
/*
* This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy
* Copyright (C) 2023 RK_01/RaphiMC and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.release.protocol1_2_4_5to1_2_1_3.rewriter;
import net.raphimc.vialegacy.api.remapper.LegacyItemRewriter;
import net.raphimc.vialegacy.protocols.release.protocol1_2_4_5to1_2_1_3.Protocol1_2_4_5to1_2_1_3;
import net.raphimc.vialegacy.protocols.release.protocol1_3_1_2to1_2_4_5.ServerboundPackets1_2_4;
import net.raphimc.vialegacy.protocols.release.protocol1_3_1_2to1_2_4_5.types.Types1_2_4;
public class ItemRewriter extends LegacyItemRewriter<Protocol1_2_4_5to1_2_1_3> {
public ItemRewriter(final Protocol1_2_4_5to1_2_1_3 protocol) {
super(protocol, "1.2.3");
this.addNonExistentItem(5, 1, 3);
this.addNonExistentItem(24, 1, 2);
}
@Override
protected void registerPackets() {
this.registerCreativeInventoryAction(ServerboundPackets1_2_4.CREATIVE_INVENTORY_ACTION, Types1_2_4.COMPRESSED_NBT_ITEM);
}
}

View File

@ -41,12 +41,14 @@ import net.raphimc.vialegacy.ViaLegacy;
import net.raphimc.vialegacy.api.data.BlockList1_6;
import net.raphimc.vialegacy.api.model.IdAndData;
import net.raphimc.vialegacy.api.model.Location;
import net.raphimc.vialegacy.api.remapper.LegacyItemRewriter;
import net.raphimc.vialegacy.api.splitter.PreNettySplitter;
import net.raphimc.vialegacy.protocols.release.protocol1_3_1_2to1_2_4_5.data.EntityList;
import net.raphimc.vialegacy.protocols.release.protocol1_3_1_2to1_2_4_5.model.AbstractTrackedEntity;
import net.raphimc.vialegacy.protocols.release.protocol1_3_1_2to1_2_4_5.model.TrackedEntity;
import net.raphimc.vialegacy.protocols.release.protocol1_3_1_2to1_2_4_5.model.TrackedLivingEntity;
import net.raphimc.vialegacy.protocols.release.protocol1_3_1_2to1_2_4_5.providers.OldAuthProvider;
import net.raphimc.vialegacy.protocols.release.protocol1_3_1_2to1_2_4_5.rewriter.ItemRewriter;
import net.raphimc.vialegacy.protocols.release.protocol1_3_1_2to1_2_4_5.sound.Sound;
import net.raphimc.vialegacy.protocols.release.protocol1_3_1_2to1_2_4_5.sound.SoundType;
import net.raphimc.vialegacy.protocols.release.protocol1_3_1_2to1_2_4_5.storage.ChestStateTracker;
@ -74,12 +76,16 @@ import java.util.logging.Level;
public class Protocol1_3_1_2to1_2_4_5 extends AbstractProtocol<ClientboundPackets1_2_4, ClientboundPackets1_3_1, ServerboundPackets1_2_4, ServerboundPackets1_3_1> {
private final LegacyItemRewriter<Protocol1_3_1_2to1_2_4_5> itemRewriter = new ItemRewriter(this);
public Protocol1_3_1_2to1_2_4_5() {
super(ClientboundPackets1_2_4.class, ClientboundPackets1_3_1.class, ServerboundPackets1_2_4.class, ServerboundPackets1_3_1.class);
}
@Override
protected void registerPackets() {
this.itemRewriter.register();
this.registerClientbound(State.LOGIN, ClientboundPackets1_2_4.HANDSHAKE.getId(), ClientboundPackets1_3_1.SHARED_KEY.getId(), new PacketRemapper() {
@Override
public void registerMap() {
@ -717,6 +723,7 @@ public class Protocol1_3_1_2to1_2_4_5 extends AbstractProtocol<ClientboundPacket
public void registerMap() {
map(Type.SHORT); // slot
map(Types1_7_6.COMPRESSED_ITEM, Types1_2_4.COMPRESSED_NBT_ITEM); // item
handler(wrapper -> itemRewriter.handleItemToServer(wrapper.get(Types1_2_4.COMPRESSED_NBT_ITEM, 0)));
}
});
this.registerServerbound(ServerboundPackets1_3_1.PLAYER_ABILITIES, new PacketRemapper() {
@ -799,7 +806,7 @@ public class Protocol1_3_1_2to1_2_4_5 extends AbstractProtocol<ClientboundPacket
}
break;
} else if (index == MetaIndex1_8to1_7_6.CREEPER_STATE) {
if(metadata.<Byte>value() > 0) {
if (metadata.<Byte>value() > 0) {
tracker.playSoundAt(entity.getLocation(), Sound.RANDOM_FUSE, 1.0F, 0.5F);
}
}
@ -857,4 +864,9 @@ public class Protocol1_3_1_2to1_2_4_5 extends AbstractProtocol<ClientboundPacket
}
}
@Override
public LegacyItemRewriter<Protocol1_3_1_2to1_2_4_5> getItemRewriter() {
return this.itemRewriter;
}
}

View File

@ -0,0 +1,33 @@
/*
* This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy
* Copyright (C) 2023 RK_01/RaphiMC and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.release.protocol1_3_1_2to1_2_4_5.rewriter;
import net.raphimc.vialegacy.api.remapper.LegacyItemRewriter;
import net.raphimc.vialegacy.protocols.release.protocol1_3_1_2to1_2_4_5.Protocol1_3_1_2to1_2_4_5;
public class ItemRewriter extends LegacyItemRewriter<Protocol1_3_1_2to1_2_4_5> {
public ItemRewriter(final Protocol1_3_1_2to1_2_4_5 protocol) {
super(protocol, "1.2.5");
this.addNonExistentItemRange(126, 136);
this.addNonExistentItem(322, 1);
this.addNonExistentItemRange(386, 388);
}
}

View File

@ -31,7 +31,9 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import com.viaversion.viaversion.api.type.Type;
import net.raphimc.vialegacy.ViaLegacy;
import net.raphimc.vialegacy.api.data.ItemList1_6;
import net.raphimc.vialegacy.api.remapper.LegacyItemRewriter;
import net.raphimc.vialegacy.api.splitter.PreNettySplitter;
import net.raphimc.vialegacy.protocols.release.protocol1_4_2to1_3_1_2.rewriter.ItemRewriter;
import net.raphimc.vialegacy.protocols.release.protocol1_4_2to1_3_1_2.rewriter.SoundRewriter;
import net.raphimc.vialegacy.protocols.release.protocol1_4_2to1_3_1_2.types.Types1_3_1;
import net.raphimc.vialegacy.protocols.release.protocol1_4_4_5to1_4_2.ClientboundPackets1_4_2;
@ -47,12 +49,16 @@ import java.util.logging.Level;
public class Protocol1_4_2to1_3_1_2 extends AbstractProtocol<ClientboundPackets1_3_1, ClientboundPackets1_4_2, ServerboundPackets1_3_1, ServerboundPackets1_5_2> {
private final LegacyItemRewriter<Protocol1_4_2to1_3_1_2> itemRewriter = new ItemRewriter(this);
public Protocol1_4_2to1_3_1_2() {
super(ClientboundPackets1_3_1.class, ClientboundPackets1_4_2.class, ServerboundPackets1_3_1.class, ServerboundPackets1_5_2.class);
}
@Override
protected void registerPackets() {
this.itemRewriter.register();
this.registerClientbound(State.STATUS, ClientboundPackets1_3_1.DISCONNECT.getId(), ClientboundPackets1_4_2.DISCONNECT.getId(), new PacketRemapper() {
@Override
public void registerMap() {
@ -267,19 +273,6 @@ public class Protocol1_4_2to1_3_1_2 extends AbstractProtocol<ClientboundPackets1
handler(PacketWrapper::clearPacket);
}
});
this.registerServerbound(ServerboundPackets1_5_2.CREATIVE_INVENTORY_ACTION, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.SHORT); // slot
map(Types1_7_6.COMPRESSED_ITEM); // item
handler(wrapper -> {
final Item itm = wrapper.get(Types1_7_6.COMPRESSED_ITEM, 0);
if (itm != null && itm.identifier() == ItemList1_6.emptyMap.itemID) {
itm.setIdentifier(ItemList1_6.map.itemID);
}
});
}
});
this.registerServerbound(ServerboundPackets1_5_2.CLIENT_SETTINGS, new PacketRemapper() {
@Override
public void registerMap() {
@ -314,4 +307,9 @@ public class Protocol1_4_2to1_3_1_2 extends AbstractProtocol<ClientboundPackets1
userConnection.put(new PreNettySplitter(userConnection, Protocol1_4_2to1_3_1_2.class, ClientboundPackets1_3_1::getPacket));
}
@Override
public LegacyItemRewriter<Protocol1_4_2to1_3_1_2> getItemRewriter() {
return this.itemRewriter;
}
}

View File

@ -0,0 +1,53 @@
/*
* This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy
* Copyright (C) 2023 RK_01/RaphiMC and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.release.protocol1_4_2to1_3_1_2.rewriter;
import com.viaversion.viaversion.api.minecraft.item.Item;
import net.raphimc.vialegacy.api.data.ItemList1_6;
import net.raphimc.vialegacy.api.remapper.LegacyItemRewriter;
import net.raphimc.vialegacy.protocols.release.protocol1_4_2to1_3_1_2.Protocol1_4_2to1_3_1_2;
import net.raphimc.vialegacy.protocols.release.protocol1_6_1to1_5_2.ServerboundPackets1_5_2;
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types.Types1_7_6;
public class ItemRewriter extends LegacyItemRewriter<Protocol1_4_2to1_3_1_2> {
public ItemRewriter(final Protocol1_4_2to1_3_1_2 protocol) {
super(protocol, "1.3.2");
this.addNonExistentItemRange(137, 145);
this.addNonExistentItemRange(389, 400);
this.addNonExistentItem(383, 65);
this.addNonExistentItem(383, 66);
this.addNonExistentItems(422);
}
@Override
protected void registerPackets() {
this.registerCreativeInventoryAction(ServerboundPackets1_5_2.CREATIVE_INVENTORY_ACTION, Types1_7_6.COMPRESSED_ITEM);
}
@Override
public Item handleItemToServer(Item item) {
if (item != null && item.identifier() == ItemList1_6.emptyMap.itemID) {
item.setIdentifier(ItemList1_6.map.itemID);
}
return super.handleItemToServer(item);
}
}

View File

@ -22,7 +22,9 @@ import com.viaversion.viaversion.api.minecraft.metadata.Metadata;
import com.viaversion.viaversion.api.protocol.AbstractProtocol;
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
import com.viaversion.viaversion.api.type.Type;
import net.raphimc.vialegacy.api.remapper.LegacyItemRewriter;
import net.raphimc.vialegacy.api.splitter.PreNettySplitter;
import net.raphimc.vialegacy.protocols.release.protocol1_4_4_5to1_4_2.rewriter.ItemRewriter;
import net.raphimc.vialegacy.protocols.release.protocol1_4_4_5to1_4_2.types.Types1_4_2;
import net.raphimc.vialegacy.protocols.release.protocol1_4_6_7to1_4_4_5.ClientboundPackets1_4_4;
import net.raphimc.vialegacy.protocols.release.protocol1_6_1to1_5_2.ServerboundPackets1_5_2;
@ -33,12 +35,16 @@ import java.util.List;
public class Protocol1_4_4_5to1_4_2 extends AbstractProtocol<ClientboundPackets1_4_2, ClientboundPackets1_4_4, ServerboundPackets1_5_2, ServerboundPackets1_5_2> {
private final LegacyItemRewriter<Protocol1_4_4_5to1_4_2> itemRewriter = new ItemRewriter(this);
public Protocol1_4_4_5to1_4_2() {
super(ClientboundPackets1_4_2.class, ClientboundPackets1_4_4.class, ServerboundPackets1_5_2.class, ServerboundPackets1_5_2.class);
}
@Override
protected void registerPackets() {
this.itemRewriter.register();
this.registerClientbound(ClientboundPackets1_4_2.MAP_DATA, new PacketRemapper() {
@Override
public void registerMap() {
@ -101,4 +107,9 @@ public class Protocol1_4_4_5to1_4_2 extends AbstractProtocol<ClientboundPackets1
userConnection.put(new PreNettySplitter(userConnection, Protocol1_4_4_5to1_4_2.class, ClientboundPackets1_4_2::getPacket));
}
@Override
public LegacyItemRewriter<Protocol1_4_4_5to1_4_2> getItemRewriter() {
return this.itemRewriter;
}
}

View File

@ -0,0 +1,38 @@
/*
* This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy
* Copyright (C) 2023 RK_01/RaphiMC and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.release.protocol1_4_4_5to1_4_2.rewriter;
import net.raphimc.vialegacy.api.remapper.LegacyItemRewriter;
import net.raphimc.vialegacy.protocols.release.protocol1_4_4_5to1_4_2.Protocol1_4_4_5to1_4_2;
import net.raphimc.vialegacy.protocols.release.protocol1_6_1to1_5_2.ServerboundPackets1_5_2;
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types.Types1_7_6;
public class ItemRewriter extends LegacyItemRewriter<Protocol1_4_4_5to1_4_2> {
public ItemRewriter(final Protocol1_4_4_5to1_4_2 protocol) {
super(protocol, "1.4.2");
this.addNonExistentItems(2267);
}
@Override
protected void registerPackets() {
this.registerCreativeInventoryAction(ServerboundPackets1_5_2.CREATIVE_INVENTORY_ACTION, Types1_7_6.COMPRESSED_ITEM);
}
}

View File

@ -27,7 +27,9 @@ import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
import com.viaversion.viaversion.api.type.Type;
import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
import net.raphimc.vialegacy.api.remapper.LegacyItemRewriter;
import net.raphimc.vialegacy.api.splitter.PreNettySplitter;
import net.raphimc.vialegacy.protocols.release.protocol1_4_6_7to1_4_4_5.rewriter.ItemRewriter;
import net.raphimc.vialegacy.protocols.release.protocol1_4_6_7to1_4_4_5.types.ChunkBulk1_4_4Type;
import net.raphimc.vialegacy.protocols.release.protocol1_5_0_1to1_4_6_7.ClientboundPackets1_4_6;
import net.raphimc.vialegacy.protocols.release.protocol1_6_1to1_5_2.ServerboundPackets1_5_2;
@ -39,12 +41,16 @@ import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types.Types
public class Protocol1_4_6_7to1_4_4_5 extends AbstractProtocol<ClientboundPackets1_4_4, ClientboundPackets1_4_6, ServerboundPackets1_5_2, ServerboundPackets1_5_2> {
private final LegacyItemRewriter<Protocol1_4_6_7to1_4_4_5> itemRewriter = new ItemRewriter(this);
public Protocol1_4_6_7to1_4_4_5() {
super(ClientboundPackets1_4_4.class, ClientboundPackets1_4_6.class, ServerboundPackets1_5_2.class, ServerboundPackets1_5_2.class);
}
@Override
protected void registerPackets() {
this.itemRewriter.register();
this.registerClientbound(ClientboundPackets1_4_4.JOIN_GAME, new PacketRemapper() {
@Override
public void registerMap() {
@ -153,4 +159,9 @@ public class Protocol1_4_6_7to1_4_4_5 extends AbstractProtocol<ClientboundPacket
}
}
@Override
public LegacyItemRewriter<Protocol1_4_6_7to1_4_4_5> getItemRewriter() {
return this.itemRewriter;
}
}

View File

@ -0,0 +1,40 @@
/*
* This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy
* Copyright (C) 2023 RK_01/RaphiMC and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.release.protocol1_4_6_7to1_4_4_5.rewriter;
import net.raphimc.vialegacy.api.remapper.LegacyItemRewriter;
import net.raphimc.vialegacy.protocols.release.protocol1_4_6_7to1_4_4_5.Protocol1_4_6_7to1_4_4_5;
import net.raphimc.vialegacy.protocols.release.protocol1_6_1to1_5_2.ServerboundPackets1_5_2;
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types.Types1_7_6;
public class ItemRewriter extends LegacyItemRewriter<Protocol1_4_6_7to1_4_4_5> {
public ItemRewriter(final Protocol1_4_6_7to1_4_4_5 protocol) {
super(protocol, "1.4.5");
this.addNonExistentItem(43, 6);
this.addNonExistentItem(44, 6);
this.addNonExistentItemRange(401, 403);
}
@Override
protected void registerPackets() {
this.registerCreativeInventoryAction(ServerboundPackets1_5_2.CREATIVE_INVENTORY_ACTION, Types1_7_6.COMPRESSED_ITEM);
}
}

View File

@ -24,7 +24,9 @@ import com.viaversion.viaversion.api.protocol.AbstractProtocol;
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
import com.viaversion.viaversion.api.type.Type;
import net.raphimc.vialegacy.api.remapper.LegacyItemRewriter;
import net.raphimc.vialegacy.api.splitter.PreNettySplitter;
import net.raphimc.vialegacy.protocols.release.protocol1_5_0_1to1_4_6_7.rewriter.ItemRewriter;
import net.raphimc.vialegacy.protocols.release.protocol1_6_1to1_5_2.ClientboundPackets1_5_2;
import net.raphimc.vialegacy.protocols.release.protocol1_6_1to1_5_2.ServerboundPackets1_5_2;
import net.raphimc.vialegacy.protocols.release.protocol1_7_2_5to1_6_4.types.Types1_6_4;
@ -32,12 +34,16 @@ import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types.Types
public class Protocol1_5_0_1to1_4_6_7 extends AbstractProtocol<ClientboundPackets1_4_6, ClientboundPackets1_5_2, ServerboundPackets1_5_2, ServerboundPackets1_5_2> {
private final LegacyItemRewriter<Protocol1_5_0_1to1_4_6_7> itemRewriter = new ItemRewriter(this);
public Protocol1_5_0_1to1_4_6_7() {
super(ClientboundPackets1_4_6.class, ClientboundPackets1_5_2.class, ServerboundPackets1_5_2.class, ServerboundPackets1_5_2.class);
}
@Override
protected void registerPackets() {
this.itemRewriter.register();
this.registerClientbound(ClientboundPackets1_4_6.SPAWN_ENTITY, new PacketRemapper() {
@Override
public void registerMap() {
@ -147,4 +153,9 @@ public class Protocol1_5_0_1to1_4_6_7 extends AbstractProtocol<ClientboundPacket
userConnection.put(new PreNettySplitter(userConnection, Protocol1_5_0_1to1_4_6_7.class, ClientboundPackets1_4_6::getPacket));
}
@Override
public LegacyItemRewriter<Protocol1_5_0_1to1_4_6_7> getItemRewriter() {
return this.itemRewriter;
}
}

View File

@ -0,0 +1,42 @@
/*
* This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy
* Copyright (C) 2023 RK_01/RaphiMC and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.release.protocol1_5_0_1to1_4_6_7.rewriter;
import net.raphimc.vialegacy.api.remapper.LegacyItemRewriter;
import net.raphimc.vialegacy.protocols.release.protocol1_5_0_1to1_4_6_7.Protocol1_5_0_1to1_4_6_7;
import net.raphimc.vialegacy.protocols.release.protocol1_6_1to1_5_2.ServerboundPackets1_5_2;
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types.Types1_7_6;
public class ItemRewriter extends LegacyItemRewriter<Protocol1_5_0_1to1_4_6_7> {
public ItemRewriter(final Protocol1_5_0_1to1_4_6_7 protocol) {
super(protocol, "1.4.7");
this.addNonExistentItem(43, 7);
this.addNonExistentItem(44, 7);
this.addNonExistentItemRange(146, 158);
this.addNonExistentItems(178);
this.addNonExistentItemRange(404, 408);
}
@Override
protected void registerPackets() {
this.registerCreativeInventoryAction(ServerboundPackets1_5_2.CREATIVE_INVENTORY_ACTION, Types1_7_6.COMPRESSED_ITEM);
}
}

View File

@ -26,8 +26,10 @@ import com.viaversion.viaversion.api.protocol.packet.State;
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
import com.viaversion.viaversion.api.type.Type;
import net.raphimc.vialegacy.ViaLegacy;
import net.raphimc.vialegacy.api.remapper.LegacyItemRewriter;
import net.raphimc.vialegacy.api.splitter.PreNettySplitter;
import net.raphimc.vialegacy.protocols.release.protocol1_6_1to1_5_2.metadata.MetadataRewriter;
import net.raphimc.vialegacy.protocols.release.protocol1_6_1to1_5_2.rewriter.ItemRewriter;
import net.raphimc.vialegacy.protocols.release.protocol1_6_1to1_5_2.rewriter.SoundRewriter;
import net.raphimc.vialegacy.protocols.release.protocol1_6_1to1_5_2.storage.AttachTracker;
import net.raphimc.vialegacy.protocols.release.protocol1_6_1to1_5_2.storage.EntityTracker;
@ -41,12 +43,16 @@ import java.util.List;
public class Protocol1_6_1to1_5_2 extends AbstractProtocol<ClientboundPackets1_5_2, ClientboundPackets1_6_1, ServerboundPackets1_5_2, ServerboundPackets1_6_4> {
private final LegacyItemRewriter<Protocol1_6_1to1_5_2> itemRewriter = new ItemRewriter(this);
public Protocol1_6_1to1_5_2() {
super(ClientboundPackets1_5_2.class, ClientboundPackets1_6_1.class, ServerboundPackets1_5_2.class, ServerboundPackets1_6_4.class);
}
@Override
protected void registerPackets() {
this.itemRewriter.register();
this.registerClientbound(ClientboundPackets1_5_2.JOIN_GAME, new PacketRemapper() {
@Override
public void registerMap() {
@ -352,4 +358,9 @@ public class Protocol1_6_1to1_5_2 extends AbstractProtocol<ClientboundPackets1_5
userConnection.put(new AttachTracker(userConnection));
}
@Override
public LegacyItemRewriter<Protocol1_6_1to1_5_2> getItemRewriter() {
return this.itemRewriter;
}
}

View File

@ -0,0 +1,41 @@
/*
* This file is part of ViaLegacy - https://github.com/RaphiMC/ViaLegacy
* Copyright (C) 2023 RK_01/RaphiMC and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.raphimc.vialegacy.protocols.release.protocol1_6_1to1_5_2.rewriter;
import net.raphimc.vialegacy.api.remapper.LegacyItemRewriter;
import net.raphimc.vialegacy.protocols.release.protocol1_6_1to1_5_2.Protocol1_6_1to1_5_2;
import net.raphimc.vialegacy.protocols.release.protocol1_7_2_5to1_6_4.ServerboundPackets1_6_4;
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types.Types1_7_6;
public class ItemRewriter extends LegacyItemRewriter<Protocol1_6_1to1_5_2> {
public ItemRewriter(final Protocol1_6_1to1_5_2 protocol) {
super(protocol, "1.5.2");
this.addNonExistentItems(159);
this.addNonExistentItemRange(170, 173);
this.addNonExistentItem(383, 100);
this.addNonExistentItemRange(417, 421);
}
@Override
protected void registerPackets() {
this.registerCreativeInventoryAction(ServerboundPackets1_6_4.CREATIVE_INVENTORY_ACTION, Types1_7_6.COMPRESSED_ITEM);
}
}

View File

@ -63,7 +63,6 @@ import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types.Chunk
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types.ChunkBulk1_7_6Type;
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types.MetaType1_7_6;
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types.Types1_7_6;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.List;
import java.util.logging.Level;
@ -1204,7 +1203,6 @@ public class Protocol1_7_2_5to1_6_4 extends AbstractProtocol<ClientboundPackets1
}
}
@Nullable
@Override
public LegacyItemRewriter<Protocol1_7_2_5to1_6_4> getItemRewriter() {
return this.itemRewriter;

View File

@ -55,10 +55,10 @@ public class ItemRewriter extends LegacyItemRewriter<Protocol1_7_2_5to1_6_4> {
this.addRemappedItem(149, 404, "Unlit Redstone Comparator");
this.addRemappedItem(150, 404, "Lit Redstone Comparator");
this.addNonExistentItems(3, 2);
this.addNonExistentItem(3, 2);
this.addNonExistentItem(5, 4, 5);
this.addNonExistentItem(6, 4, 5);
this.addNonExistentItems(12, 1);
this.addNonExistentItem(12, 1);
this.addNonExistentItem(38, 1, 8);
this.addNonExistentItems(95);
this.addNonExistentItem(97, 3, 5);

View File

@ -66,7 +66,6 @@ import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.storage.*;
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types.Chunk1_7_6Type;
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types.ChunkBulk1_7_6Type;
import net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.types.Types1_7_6;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.nio.charset.StandardCharsets;
import java.util.*;
@ -1593,7 +1592,6 @@ public class Protocol1_8to1_7_6_10 extends AbstractProtocol<ClientboundPackets1_
userConnection.put(new ChunkTracker(userConnection));
}
@Nullable
@Override
public LegacyItemRewriter<Protocol1_8to1_7_6_10> getItemRewriter() {
return this.itemRewriter;

View File

@ -34,7 +34,7 @@ import java.util.UUID;
public class ItemRewriter extends LegacyItemRewriter<Protocol1_8to1_7_6_10> {
public ItemRewriter(final Protocol1_8to1_7_6_10 protocol) {
super(protocol, "1.7");
super(protocol, "1.7.10");
this.addRemappedItem(8, 326, "Water Block");
this.addRemappedItem(9, 326, "Stationary Water Block");