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 */ 017 018package net.tridentsdk.server.entity.living; 019 020import net.tridentsdk.base.Position; 021import net.tridentsdk.entity.living.Chicken; 022import net.tridentsdk.entity.living.Player; 023import net.tridentsdk.entity.types.EntityType; 024import net.tridentsdk.event.entity.EntityDamageEvent; 025import net.tridentsdk.meta.nbt.ByteTag; 026import net.tridentsdk.meta.nbt.CompoundTag; 027import net.tridentsdk.meta.nbt.IntTag; 028import net.tridentsdk.server.entity.TridentBreedable; 029 030import java.util.UUID; 031 032public class TridentChicken extends TridentBreedable implements Chicken { 033 private volatile int layInterval; 034 private volatile boolean isJockey; 035 036 public TridentChicken(UUID id, Position spawnLocation) { 037 super(id, spawnLocation); 038 } 039 040 @Override 041 public void doLoad(CompoundTag tag) { 042 this.layInterval = ((IntTag) tag.getTag("EggLayTime")).value(); 043 this.isJockey = ((ByteTag) tag.getTag("IsChickenJockey")).value() == 1; 044 } 045 046 @Override 047 public boolean isJockey() { 048 return isJockey; 049 } 050 051 @Override 052 public int nextLayInterval() { 053 return layInterval; 054 } 055 056 @Override 057 public EntityDamageEvent lastDamageEvent() { 058 return null; 059 } 060 061 @Override 062 public Player lastPlayerDamager() { 063 return null; 064 } 065 066 @Override 067 public EntityType type() { 068 return EntityType.CHICKEN; 069 } 070}