001/*
002 * Trident - A Multithreaded Server Alternative
003 * Copyright 2014 The TridentSDK Team
004 *
005 * Licensed under the Apache License, Version 2.0 (the "License");
006 * you may not use this file except in compliance with the License.
007 * You may obtain a copy of the License at
008 *
009 *    http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package net.tridentsdk.server.effect.visual;
018
019import net.tridentsdk.base.Position;
020import net.tridentsdk.effect.visual.VisualEffect;
021import net.tridentsdk.effect.visual.VisualEffectType;
022import net.tridentsdk.server.effect.TridentRemoteEffect;
023import net.tridentsdk.server.netty.packet.OutPacket;
024import net.tridentsdk.server.packets.play.out.PacketPlayOutEffect;
025import net.tridentsdk.util.Vector;
026import net.tridentsdk.world.World;
027
028public class TridentVisualEffect extends TridentRemoteEffect<VisualEffectType> implements VisualEffect {
029
030    private PacketPlayOutEffect packet = new PacketPlayOutEffect();
031
032    public TridentVisualEffect(World world, VisualEffectType type){
033        packet.set("loc", new Position(world, 0, 0, 0));
034        packet.set("status", type);
035    }
036
037    @Override
038    public VisualEffectType type(){
039        return null; // TODO Add revers lookup map
040    }
041
042    @Override
043    public void setType(VisualEffectType type){
044        packet.set("status", type);
045    }
046
047    @Override
048    public void setData(int data){
049        packet.set("data", data);
050    }
051
052    @Override
053    public int data(){
054        return packet.data();
055    }
056
057    @Override
058    public void setPosition(Vector vector){
059        packet.location().setX(vector.x());
060        packet.location().setY(vector.y());
061        packet.location().setZ(vector.z());
062    }
063
064    @Override
065    public OutPacket getPacket(){
066        return packet;
067    }
068
069}