// 
// Decompiled by Procyon v0.6.0
// 

package com.hypixel.hytale.builtin.adventure.farming.component;

import com.hypixel.hytale.codec.Codec;
import com.hypixel.hytale.codec.KeyedCodec;
import javax.annotation.Nullable;
import com.hypixel.hytale.builtin.adventure.farming.FarmingPlugin;
import com.hypixel.hytale.component.ComponentType;
import com.hypixel.hytale.math.vector.Vector3i;
import com.hypixel.hytale.codec.builder.BuilderCodec;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import com.hypixel.hytale.component.Component;

public class CoopResidentComponent implements Component<EntityStore>
{
    public static final BuilderCodec<CoopResidentComponent> CODEC;
    private Vector3i coopLocation;
    private boolean markedForDespawn;
    
    public CoopResidentComponent() {
        this.coopLocation = new Vector3i();
    }
    
    public static ComponentType<EntityStore, CoopResidentComponent> getComponentType() {
        return FarmingPlugin.get().getCoopResidentComponentType();
    }
    
    public void setCoopLocation(final Vector3i coopLocation) {
        this.coopLocation = coopLocation;
    }
    
    public Vector3i getCoopLocation() {
        return this.coopLocation;
    }
    
    public void setMarkedForDespawn(final boolean markedForDespawn) {
        this.markedForDespawn = markedForDespawn;
    }
    
    public boolean getMarkedForDespawn() {
        return this.markedForDespawn;
    }
    
    @Nullable
    @Override
    public Component<EntityStore> clone() {
        final CoopResidentComponent component = new CoopResidentComponent();
        component.coopLocation.assign(this.coopLocation);
        component.markedForDespawn = this.markedForDespawn;
        return component;
    }
    
    static {
        CODEC = BuilderCodec.builder(CoopResidentComponent.class, CoopResidentComponent::new).append(new KeyedCodec<Vector3i>("CoopLocation", Vector3i.CODEC), (comp, ref) -> comp.coopLocation = ref, comp -> comp.coopLocation).add().append(new KeyedCodec("MarkedForDespawn", BuilderCodec.BOOLEAN), (comp, markedForDespawn) -> comp.markedForDespawn = markedForDespawn, comp -> comp.markedForDespawn).add().build();
    }
}
