discosheep with "jeb_" (way faster)

This commit is contained in:
Charlie 2014-07-31 18:11:15 -04:00
parent dacf67d725
commit 86028d1d9d
2 changed files with 20 additions and 12 deletions

View File

@ -55,8 +55,8 @@ javac.compilerargs=-Xlint:deprecation
javac.deprecation=false javac.deprecation=false
javac.processorpath=\ javac.processorpath=\
${javac.classpath} ${javac.classpath}
javac.source=1.8 javac.source=1.6
javac.target=1.8 javac.target=1.6
javac.test.classpath=\ javac.test.classpath=\
${javac.classpath}:\ ${javac.classpath}:\
${build.classes.dir} ${build.classes.dir}

View File

@ -6,19 +6,21 @@ import java.util.Map;
import java.util.Random; import java.util.Random;
import org.bukkit.Color; import org.bukkit.Color;
import org.bukkit.DyeColor; import org.bukkit.DyeColor;
import org.bukkit.Effect;
import static org.bukkit.EntityEffect.*;
import org.bukkit.FireworkEffect;
import org.bukkit.FireworkEffect.Builder;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Firework; import org.bukkit.entity.Firework;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Sheep; import org.bukkit.entity.Sheep;
import org.bukkit.FireworkEffect;
import org.bukkit.FireworkEffect.Builder;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.entity.Entity;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import org.bukkit.inventory.meta.FireworkMeta; import org.bukkit.inventory.meta.FireworkMeta;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
@ -279,13 +281,17 @@ public class DiscoParty {
void spawnSheep(World world, Location loc) { void spawnSheep(World world, Location loc) {
Sheep newSheep = (Sheep) world.spawnEntity(loc, EntityType.SHEEP); Sheep newSheep = (Sheep) world.spawnEntity(loc, EntityType.SHEEP);
newSheep.setColor(discoColours[(r.nextInt(discoColours.length))]); //newSheep.setColor(discoColours[(r.nextInt(discoColours.length))]);
newSheep.setBreed(false); // this prevents breeding - no event listener required newSheep.setBreed(false); // this prevents breeding - no event listener required
newSheep.teleport(loc); // teleport is needed to set orientation newSheep.teleport(loc); // teleport is needed to set orientation
newSheep.setTarget(player);
getSheepList().add(newSheep); getSheepList().add(newSheep);
if (doLightning) { if (doLightning) {
world.strikeLightningEffect(loc); world.strikeLightningEffect(loc);
} }
newSheep.setCustomName("jeb_");
newSheep.setCustomNameVisible(true);
newSheep.setRemoveWhenFarAway(false);
} }
void spawnGuest(World world, Location loc, EntityType type) { void spawnGuest(World world, Location loc, EntityType type) {
@ -403,12 +409,13 @@ public class DiscoParty {
void updateAll() { void updateAll() {
for (Sheep sheeple : getSheepList()) { for (Sheep sheeple : getSheepList()) {
randomizeSheepColour(sheeple); //randomizeSheepColour(sheeple);
if (doFireworks && state % 8 == 0) { if (state % 8 == 0) {
if (r.nextDouble() < 0.50) { if (r.nextDouble() < 0.50 && doFireworks) {
spawnRandomFireworkAtSheep(sheeple); spawnRandomFireworkAtSheep(sheeple);
} }
sheeple.playEffect(SHEEP_EAT);
} }
if (doJump) { if (doJump) {
@ -416,6 +423,7 @@ public class DiscoParty {
jump(sheeple); jump(sheeple);
} }
} }
} }
for (Entity guest : getGuestList()) { for (Entity guest : getGuestList()) {