Merge branch 'master' of ssh://dev.mineplex.com:7999/min/Mineplex

This commit is contained in:
Jonathan Williams 2013-12-13 21:01:08 -08:00
commit e054b06cc2
5 changed files with 36 additions and 4 deletions

Binary file not shown.

View File

@ -1,5 +1,8 @@
package mineplex.core.common.util; package mineplex.core.common.util;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.TreeSet; import java.util.TreeSet;
@ -111,4 +114,9 @@ public class UtilAlg
{ {
return new Vector(vec.getX(), vec.getY(), vec.getZ()); return new Vector(vec.getX(), vec.getY(), vec.getZ());
} }
public static <T> T Random(List<T> list)
{
return list.get(UtilMath.r(list.size()));
}
} }

View File

@ -8,6 +8,7 @@ import net.minecraft.server.v1_6_R3.EntityCreature;
import net.minecraft.server.v1_6_R3.EntityEnderDragon; import net.minecraft.server.v1_6_R3.EntityEnderDragon;
import net.minecraft.server.v1_6_R3.EntityHuman; import net.minecraft.server.v1_6_R3.EntityHuman;
import net.minecraft.server.v1_6_R3.EntityInsentient; import net.minecraft.server.v1_6_R3.EntityInsentient;
import net.minecraft.server.v1_6_R3.Navigation;
import net.minecraft.server.v1_6_R3.PathfinderGoalLookAtPlayer; import net.minecraft.server.v1_6_R3.PathfinderGoalLookAtPlayer;
import net.minecraft.server.v1_6_R3.PathfinderGoalMoveTowardsRestriction; import net.minecraft.server.v1_6_R3.PathfinderGoalMoveTowardsRestriction;
import net.minecraft.server.v1_6_R3.PathfinderGoalRandomLookaround; import net.minecraft.server.v1_6_R3.PathfinderGoalRandomLookaround;
@ -19,13 +20,12 @@ import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftLivingEntity; import org.bukkit.craftbukkit.v1_6_R3.entity.CraftLivingEntity;import org.bukkit.entity.Creature;import org.bukkit.entity.Entity;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Giant; import org.bukkit.entity.Giant;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature; import org.bukkit.entity.Skeleton;import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature;
import org.bukkit.craftbukkit.v1_6_R3.CraftWorld; import org.bukkit.craftbukkit.v1_6_R3.CraftWorld;
public class UtilEnt public class UtilEnt
@ -486,4 +486,23 @@ public class UtilEnt
return false; return false;
} }
public static void CreatureMove(Creature ent, Location target, float speed)
{
EntityCreature ec = ((CraftCreature)ent).getHandle();
Navigation nav = ec.getNavigation();
if (UtilMath.offset(ent.getLocation(), target) > 24)
{
Location newTarget = ent.getLocation();
newTarget.add(UtilAlg.getTrajectory(ent.getLocation(), target).multiply(24));
nav.a(newTarget.getX(), newTarget.getY(), newTarget.getZ(), speed);
}
else
{
nav.a(target.getX(), target.getY(), target.getZ(), speed);
}
}
} }

View File

@ -239,9 +239,14 @@ public class HungerGames extends SoloGame
CreateChestCraftEnchant(); CreateChestCraftEnchant();
_supplyLocations = WorldData.GetDataLocs("WHITE"); _supplyLocations = WorldData.GetDataLocs("WHITE");
for (Location loc : _supplyLocations)
loc.getBlock().setType(Material.GLASS);
if (!WorldData.GetCustomLocs("VARS").isEmpty()) if (!WorldData.GetCustomLocs("VARS").isEmpty())
{
_maxSpreadRate = WorldData.GetCustomLocs("VARS").get(0).getBlockX(); _maxSpreadRate = WorldData.GetCustomLocs("VARS").get(0).getBlockX();
System.out.println("Spread Rate: " + _maxSpreadRate);
}
} }
private void CreateChestCraftEnchant() private void CreateChestCraftEnchant()