Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.shocknetwork.turt2live.kingofthehill.mob;
- import java.util.List;
- import net.minecraft.server.v1_6_R3.Entity;
- import net.minecraft.server.v1_6_R3.EntityPlayer;
- import net.minecraft.server.v1_6_R3.EntityZombie;
- import net.minecraft.server.v1_6_R3.World;
- import net.shocknetwork.gameapi.GameAPI;
- import net.shocknetwork.gameapi.engine.GameSession;
- import net.shocknetwork.gameapi.minigame.GameTeam;
- import org.bukkit.DyeColor;
- import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
- import org.bukkit.entity.Player;
- public class KothZombie extends EntityZombie{
- public DyeColor color;
- public KothZombie(World world){
- super(world);
- }
- @Override
- protected Entity findTarget(){
- List<?> near = this.world.players;
- EntityPlayer nearest = null;
- for(Object o : near){
- if(o instanceof EntityPlayer){
- EntityPlayer pl = (EntityPlayer) o;
- double d3 = 16; // Range
- double d4 = -1;
- // START CODE COPY/PASTE FROM NMS
- if(!pl.abilities.isInvulnerable && pl.isAlive()){
- double d5 = pl.e(locX, locY, locZ);
- double d6 = d3;
- if(pl.isSneaking()){
- d6 = d3 * 0.800000011920929D;
- }
- if(pl.isInvisible()){
- float f = pl.bx();
- if(f < 0.1F){
- f = 0.1F;
- }
- d6 *= (0.7F * f);
- }
- if((d3 < 0.0D || d5 < d6 * d6) && (d4 == -1.0D || d5 < d4)){
- d4 = d5;
- // turt2live start
- Player player = pl.getBukkitEntity();
- GameSession session = GameAPI.getGameByPlayer(player);
- if(session != null){
- GameTeam team = session.getPlayerTeam(player.getName());
- if(team != null){
- if(team.getTeamDyeColor() != color){
- nearest = pl;
- }
- }
- }
- // turt2live end
- }
- }
- // END CODE COPY/PASTE FROM NMS
- }
- }
- return nearest;
- }
- @Override
- public CraftEntity getBukkitEntity(){
- if(this.bukkitEntity == null){
- this.bukkitEntity = new CraftKothZombie(this.world.getServer(), this);
- }
- return this.bukkitEntity;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment