Skip to content

Commit

Permalink
Use new ParticleRewriter
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianMichael committed Oct 28, 2024
1 parent 6667a26 commit b330440
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 5 deletions.
4 changes: 2 additions & 2 deletions build-logic/src/main/groovy/vaf.base-conventions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
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;
Expand All @@ -39,6 +40,7 @@
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;

Expand All @@ -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);

Expand All @@ -59,6 +62,8 @@ public Protocol20w14infiniteTo1_16() {
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);
Expand Down Expand Up @@ -172,6 +177,11 @@ public BlockItemPacketRewriter20w14infinite getItemRewriter() {
return this.itemRewriter;
}

@Override
public ParticleRewriter<ClientboundPackets20w14infinite> getParticleRewriter() {
return particleRewriter;
}

@Override
public EntityPacketRewriter20w14infinite getEntityRewriter() {
return this.entityRewriter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ protected void registerPackets() {
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,22 @@
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> {

public static final BackwardsMappingData MAPPINGS = new AprilFoolsMappingData("3D_Shareware", "1.14", Protocol1_13_2To1_14.class);
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);
Expand All @@ -50,6 +53,8 @@ public Protocol3D_SharewareTo1_14() {
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);
Expand Down Expand Up @@ -94,4 +99,9 @@ public BlockItemPacketRewriter3D_Shareware getItemRewriter() {
return this.blockItemPackets;
}

@Override
public ParticleRewriter<ClientboundPackets3D_Shareware> getParticleRewriter() {
return particleRewriter;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ protected void registerPackets() {
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() {
Expand Down
2 changes: 1 addition & 1 deletion fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
},
"depends": {
"viafabric": ">=0.4.14",
"viabackwards": ">=5.1.0"
"viabackwards": ">=5.1.1-SNAPSHOT"
},
"custom": {
"modmenu:api": true,
Expand Down

0 comments on commit b330440

Please sign in to comment.