Use new ParticleRewriter

This commit is contained in:
FlorianMichael 2024-10-28 11:34:44 +01:00
parent 6667a26be8
commit b3304405ec
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126
6 changed files with 23 additions and 5 deletions

View File

@ -22,8 +22,8 @@ base {
}
dependencies {
compileOnly "com.viaversion:viaversion-common:5.1.0"
compileOnly "com.viaversion:viabackwards-common:5.1.0"
compileOnly "com.viaversion:viaversion-common:5.1.1-SNAPSHOT"
compileOnly "com.viaversion:viabackwards-common:5.1.1-SNAPSHOT"
}
publishing {

View File

@ -31,6 +31,7 @@ import com.viaversion.viaversion.protocols.v1_15_2to1_16.Protocol1_15_2To1_16;
import com.viaversion.viaversion.protocols.v1_15_2to1_16.packet.ClientboundPackets1_16;
import com.viaversion.viaversion.protocols.v1_15_2to1_16.packet.ServerboundPackets1_16;
import com.viaversion.viaversion.protocols.v1_15_2to1_16.provider.PlayerAbilitiesProvider;
import com.viaversion.viaversion.rewriter.ParticleRewriter;
import com.viaversion.viaversion.rewriter.RecipeRewriter;
import com.viaversion.viaversion.rewriter.StatisticsRewriter;
import com.viaversion.viaversion.rewriter.TagRewriter;
@ -39,6 +40,7 @@ import net.raphimc.viaaprilfools.protocol.s20w14infinitetov1_16.rewriter.EntityP
import net.raphimc.viaaprilfools.protocol.s20w14infinitetov1_16.packet.ClientboundPackets20w14infinite;
import net.raphimc.viaaprilfools.protocol.s20w14infinitetov1_16.packet.ServerboundPackets20w14infinite;
import net.raphimc.viaaprilfools.protocol.s20w14infinitetov1_16.rewriter.BlockItemPacketRewriter20w14infinite;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.UUID;
@ -48,6 +50,7 @@ public class Protocol20w14infiniteTo1_16 extends BackwardsProtocol<ClientboundPa
private static final UUID ZERO_UUID = new UUID(0, 0);
private final BlockItemPacketRewriter20w14infinite itemRewriter = new BlockItemPacketRewriter20w14infinite(this);
private final ParticleRewriter<ClientboundPackets20w14infinite> particleRewriter = new ParticleRewriter<>(this);
private final EntityPacketRewriter20w14infinite entityRewriter = new EntityPacketRewriter20w14infinite(this);
private final TagRewriter<ClientboundPackets20w14infinite> tagRewriter = new TagRewriter<>(this);
@ -59,6 +62,8 @@ public class Protocol20w14infiniteTo1_16 extends BackwardsProtocol<ClientboundPa
protected void registerPackets() {
super.registerPackets();
particleRewriter.registerLevelParticles1_13(ClientboundPackets20w14infinite.LEVEL_PARTICLES, Types.DOUBLE);
tagRewriter.register(ClientboundPackets20w14infinite.UPDATE_TAGS, RegistryType.ENTITY);
new StatisticsRewriter<>(this).register(ClientboundPackets20w14infinite.AWARD_STATS);
final SoundRewriter<ClientboundPackets20w14infinite> soundRewriter = new SoundRewriter<>(this);
@ -172,6 +177,11 @@ public class Protocol20w14infiniteTo1_16 extends BackwardsProtocol<ClientboundPa
return this.itemRewriter;
}
@Override
public ParticleRewriter<ClientboundPackets20w14infinite> getParticleRewriter() {
return particleRewriter;
}
@Override
public EntityPacketRewriter20w14infinite getEntityRewriter() {
return this.entityRewriter;

View File

@ -51,7 +51,6 @@ public class BlockItemPacketRewriter20w14infinite extends ItemRewriter<Clientbou
this.registerSetSlot(ClientboundPackets20w14infinite.CONTAINER_SET_SLOT);
this.registerMerchantOffers(ClientboundPackets20w14infinite.MERCHANT_OFFERS);
this.registerAdvancements(ClientboundPackets20w14infinite.UPDATE_ADVANCEMENTS);
this.registerLevelParticles(ClientboundPackets20w14infinite.LEVEL_PARTICLES, Types.DOUBLE);
this.registerContainerClick(ServerboundPackets1_16.CONTAINER_CLICK);
this.registerSetCreativeModeSlot(ServerboundPackets1_16.SET_CREATIVE_MODE_SLOT);
final BlockRewriter<ClientboundPackets20w14infinite> blockRewriter = BlockRewriter.for1_14(this.protocol);

View File

@ -28,12 +28,14 @@ import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_14;
import com.viaversion.viaversion.protocols.v1_13_2to1_14.Protocol1_13_2To1_14;
import com.viaversion.viaversion.protocols.v1_13_2to1_14.packet.ClientboundPackets1_14;
import com.viaversion.viaversion.protocols.v1_13_2to1_14.packet.ServerboundPackets1_14;
import com.viaversion.viaversion.rewriter.ParticleRewriter;
import net.raphimc.viaaprilfools.api.data.AprilFoolsMappingData;
import net.raphimc.viaaprilfools.protocol.s3d_sharewaretov1_14.packet.ClientboundPackets3D_Shareware;
import net.raphimc.viaaprilfools.protocol.s3d_sharewaretov1_14.packet.ServerboundPackets3D_Shareware;
import net.raphimc.viaaprilfools.protocol.s3d_sharewaretov1_14.rewriter.BlockItemPacketRewriter3D_Shareware;
import net.raphimc.viaaprilfools.protocol.s3d_sharewaretov1_14.rewriter.EntityPacketRewriter3D_Shareware;
import net.raphimc.viaaprilfools.protocol.s3d_sharewaretov1_14.storage.ChunkCenterTracker3D_Shareware;
import org.checkerframework.checker.nullness.qual.Nullable;
public class Protocol3D_SharewareTo1_14 extends BackwardsProtocol<ClientboundPackets3D_Shareware, ClientboundPackets1_14, ServerboundPackets3D_Shareware, ServerboundPackets1_14> {
@ -41,6 +43,7 @@ public class Protocol3D_SharewareTo1_14 extends BackwardsProtocol<ClientboundPac
private static final int SERVERSIDE_VIEW_DISTANCE = 64;
private final BlockItemPacketRewriter3D_Shareware blockItemPackets = new BlockItemPacketRewriter3D_Shareware(this);
private final ParticleRewriter<ClientboundPackets3D_Shareware> particleRewriter = new ParticleRewriter<>(this);
public Protocol3D_SharewareTo1_14() {
super(ClientboundPackets3D_Shareware.class, ClientboundPackets1_14.class, ServerboundPackets3D_Shareware.class, ServerboundPackets1_14.class);
@ -50,6 +53,8 @@ public class Protocol3D_SharewareTo1_14 extends BackwardsProtocol<ClientboundPac
protected void registerPackets() {
super.registerPackets();
particleRewriter.registerLevelParticles1_13(ClientboundPackets3D_Shareware.LEVEL_PARTICLES, Types.FLOAT);
new EntityPacketRewriter3D_Shareware(this).registerPackets();
final SoundRewriter<ClientboundPackets3D_Shareware> soundRewriter = new SoundRewriter<>(this);
soundRewriter.registerSound(ClientboundPackets3D_Shareware.SOUND);
@ -94,4 +99,9 @@ public class Protocol3D_SharewareTo1_14 extends BackwardsProtocol<ClientboundPac
return this.blockItemPackets;
}
@Override
public ParticleRewriter<ClientboundPackets3D_Shareware> getParticleRewriter() {
return particleRewriter;
}
}

View File

@ -39,7 +39,6 @@ public class BlockItemPacketRewriter3D_Shareware extends ItemRewriter<Clientboun
this.registerAdvancements(ClientboundPackets3D_Shareware.UPDATE_ADVANCEMENTS);
this.registerContainerClick(ServerboundPackets1_14.CONTAINER_CLICK);
this.registerSetCreativeModeSlot(ServerboundPackets1_14.SET_CREATIVE_MODE_SLOT);
this.registerLevelParticles(ClientboundPackets3D_Shareware.LEVEL_PARTICLES, Types.FLOAT);
this.protocol.registerClientbound(ClientboundPackets3D_Shareware.MERCHANT_OFFERS, new PacketHandlers() {
public void register() {

View File

@ -23,7 +23,7 @@
},
"depends": {
"viafabric": ">=0.4.14",
"viabackwards": ">=5.1.0"
"viabackwards": ">=5.1.1-SNAPSHOT"
},
"custom": {
"modmenu:api": true,