goodbye, manual syncing

This commit is contained in:
SD 2022-01-14 14:06:00 +05:30
parent 954b256ae9
commit 306a5cc05f

View file

@ -3,6 +3,9 @@ package org.dimdev.dimdoors.block.entity;
import java.util.Objects; import java.util.Objects;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.network.Packet;
import net.minecraft.network.listener.ClientPlayPacketListener;
import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket;
import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.math.EulerAngle; import net.minecraft.util.math.EulerAngle;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
@ -24,6 +27,7 @@ import org.dimdev.dimdoors.api.util.math.TransformationMatrix3d;
import org.dimdev.dimdoors.world.level.registry.DimensionalRegistry; import org.dimdev.dimdoors.world.level.registry.DimensionalRegistry;
import org.dimdev.dimdoors.world.pocket.VirtualLocation; import org.dimdev.dimdoors.world.pocket.VirtualLocation;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntity;
@ -35,10 +39,9 @@ import net.minecraft.text.LiteralText;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.fabricmc.fabric.api.block.entity.BlockEntityClientSerializable;
import net.fabricmc.fabric.api.networking.v1.PlayerLookup; import net.fabricmc.fabric.api.networking.v1.PlayerLookup;
public abstract class RiftBlockEntity extends BlockEntity implements BlockEntityClientSerializable, Target, EntityTarget { public abstract class RiftBlockEntity extends BlockEntity implements Target, EntityTarget {
private static final Logger LOGGER = LogManager.getLogger(); private static final Logger LOGGER = LogManager.getLogger();
public static long showRiftCoreUntil = 0; public static long showRiftCoreUntil = 0;
@ -72,14 +75,10 @@ public abstract class RiftBlockEntity extends BlockEntity implements BlockEntity
return nbt; return nbt;
} }
@Nullable
@Override @Override
public void fromClientTag(NbtCompound nbt) { public Packet<ClientPlayPacketListener> toUpdatePacket() {
this.deserialize(nbt); return BlockEntityUpdateS2CPacket.create(this);
}
@Override
public NbtCompound toClientTag(NbtCompound nbt) {
return this.serialize(nbt);
} }
public void setDestination(VirtualTarget destination) { public void setDestination(VirtualTarget destination) {