67 lines
1.6 KiB
Java
67 lines
1.6 KiB
Java
package net.minecraft.world.entity;
|
|
|
|
import net.minecraft.nbt.CompoundTag;
|
|
import net.minecraft.network.protocol.Packet;
|
|
import net.minecraft.network.protocol.game.ClientGamePacketListener;
|
|
import net.minecraft.network.syncher.SynchedEntityData;
|
|
import net.minecraft.server.level.ServerEntity;
|
|
import net.minecraft.world.level.Level;
|
|
import net.minecraft.world.level.material.PushReaction;
|
|
|
|
public class Marker extends Entity {
|
|
private static final String DATA_TAG = "data";
|
|
private CompoundTag data = new CompoundTag();
|
|
|
|
public Marker(EntityType<?> entityType, Level level) {
|
|
super(entityType, level);
|
|
this.noPhysics = true;
|
|
}
|
|
|
|
@Override
|
|
public void tick() {
|
|
}
|
|
|
|
@Override
|
|
protected void defineSynchedData(SynchedEntityData.Builder builder) {
|
|
}
|
|
|
|
@Override
|
|
protected void readAdditionalSaveData(CompoundTag compound) {
|
|
this.data = compound.getCompound("data");
|
|
}
|
|
|
|
@Override
|
|
protected void addAdditionalSaveData(CompoundTag compound) {
|
|
compound.put("data", this.data.copy());
|
|
}
|
|
|
|
@Override
|
|
public Packet<ClientGamePacketListener> getAddEntityPacket(ServerEntity entity) {
|
|
throw new IllegalStateException("Markers should never be sent");
|
|
}
|
|
|
|
@Override
|
|
protected boolean canAddPassenger(Entity passenger) {
|
|
return false;
|
|
}
|
|
|
|
@Override
|
|
protected boolean couldAcceptPassenger() {
|
|
return false;
|
|
}
|
|
|
|
@Override
|
|
protected void addPassenger(Entity passenger) {
|
|
throw new IllegalStateException("Should never addPassenger without checking couldAcceptPassenger()");
|
|
}
|
|
|
|
@Override
|
|
public PushReaction getPistonPushReaction() {
|
|
return PushReaction.IGNORE;
|
|
}
|
|
|
|
@Override
|
|
public boolean isIgnoringBlockTriggers() {
|
|
return true;
|
|
}
|
|
}
|