HyCodeYourTale
classpublicPriority 3

EntityRemoveSnapshot

com.hypixel.hytale.builtin.buildertools.snapshot.EntityRemoveSnapshot

implements EntitySnapshot

2

Methods

2

Public Methods

1

Fields

1

Constructors

Constructors

public
EntityRemoveSnapshot(Ref<EntityStore> ref)

Methods

Public Methods (2)

public
Holder<EntityStore> getHolder()
@Nonnull
public
EntityAddSnapshot restoreEntity(Player player, World world, ComponentAccessor<EntityStore> componentAccessor)

Fields

Private/Package Fields (1)

privateHolder<EntityStore> holder

Inheritance

Parent
Current
Interface
Child

Use mouse wheel to zoom, drag to pan. Click nodes to navigate.

Related Classes

Source Code

package com.hypixel.hytale.builtin.buildertools.snapshot;

import com.hypixel.hytale.component.AddReason;
import com.hypixel.hytale.component.ComponentAccessor;
import com.hypixel.hytale.component.Holder;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.server.core.entity.entities.Player;
import com.hypixel.hytale.server.core.universe.world.World;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import javax.annotation.Nonnull;

public class EntityRemoveSnapshot implements EntitySnapshot<EntityAddSnapshot> {
   @Nonnull
   private final Holder<EntityStore> holder;

   public EntityRemoveSnapshot(@Nonnull Ref<EntityStore> ref) {
      this.holder = ref.getStore().copyEntity(ref);
   }

   @Nonnull
   public Holder<EntityStore> getHolder() {
      return this.holder;
   }

   public EntityAddSnapshot restoreEntity(@Nonnull Player player, @Nonnull World world, @Nonnull ComponentAccessor<EntityStore> componentAccessor) {
      Ref<EntityStore> entityRef = componentAccessor.addEntity(this.holder, AddReason.LOAD);
      return new EntityAddSnapshot(entityRef);
   }
}