Skip to content

Commit

Permalink
Use PortingLibEntity.getEntitySpawningPacket
Browse files Browse the repository at this point in the history
  • Loading branch information
AlphaMode committed Feb 28, 2024
1 parent 7c3fe98 commit 515c63c
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package slimeknights.tconstruct.gadgets.entity;

import io.github.fabricators_of_create.porting_lib.entity.IEntityAdditionalSpawnData;
import io.github.fabricators_of_create.porting_lib.entity.PortingLibEntity;
import io.github.fabricators_of_create.porting_lib.event.common.ExplosionEvents;
import net.minecraft.core.BlockPos;
import net.minecraft.network.FriendlyByteBuf;
Expand Down Expand Up @@ -66,6 +67,6 @@ public void readSpawnData(FriendlyByteBuf additionalData) {
@Nonnull
@Override
public Packet<ClientGamePacketListener> getAddEntityPacket() {
return new ClientboundAddEntityPacket(this);
return PortingLibEntity.getEntitySpawningPacket(this);
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
package slimeknights.tconstruct.gadgets.entity;

import io.github.fabricators_of_create.porting_lib.entity.IEntityAdditionalSpawnData;
import io.github.fabricators_of_create.porting_lib.entity.PortingLibEntity;
import net.fabricmc.fabric.api.entity.EntityPickInteractionAware;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.chat.Component;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.ClientGamePacketListener;
import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.network.syncher.EntityDataSerializers;
import net.minecraft.network.syncher.SynchedEntityData;
Expand Down Expand Up @@ -222,6 +225,11 @@ public void readAdditionalSaveData(CompoundTag compound) {
}
}

@Override
public Packet<ClientGamePacketListener> getAddEntityPacket() {
return PortingLibEntity.getEntitySpawningPacket(this);
}

@Override
public void writeSpawnData(FriendlyByteBuf buffer) {
buffer.writeVarInt(this.getFrameId());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package slimeknights.tconstruct.gadgets.entity;

import io.github.fabricators_of_create.porting_lib.entity.IEntityAdditionalSpawnData;
import io.github.fabricators_of_create.porting_lib.entity.PortingLibEntity;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.network.FriendlyByteBuf;
Expand Down Expand Up @@ -79,6 +80,6 @@ public void readSpawnData(FriendlyByteBuf additionalData) {
@Nonnull
@Override
public Packet<ClientGamePacketListener> getAddEntityPacket() {
return new ClientboundAddEntityPacket(this);
return PortingLibEntity.getEntitySpawningPacket(this);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package slimeknights.tconstruct.gadgets.entity.shuriken;

import io.github.fabricators_of_create.porting_lib.entity.IEntityAdditionalSpawnData;
import io.github.fabricators_of_create.porting_lib.entity.PortingLibEntity;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.ClientGamePacketListener;
Expand Down Expand Up @@ -87,6 +88,6 @@ public void readSpawnData(FriendlyByteBuf additionalData) {
@Nonnull
@Override
public Packet<ClientGamePacketListener> getAddEntityPacket() {
return new ClientboundAddEntityPacket(this);
return PortingLibEntity.getEntitySpawningPacket(this);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package slimeknights.tconstruct.library.tools;

import io.github.fabricators_of_create.porting_lib.entity.PortingLibEntity;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.ClientGamePacketListener;
Expand Down Expand Up @@ -33,7 +34,7 @@ public IndestructibleItemEntity(Level worldIn, double x, double y, double z, Ite

@Override
public Packet<ClientGamePacketListener> getAddEntityPacket() {
return new ClientboundAddEntityPacket(this);
return PortingLibEntity.getEntitySpawningPacket(this);
}

/** Copies the pickup delay from another entity */
Expand Down

0 comments on commit 515c63c

Please sign in to comment.