From 86028d1d9de01383062def8b2892939403be1084 Mon Sep 17 00:00:00 2001 From: Charlie Date: Thu, 31 Jul 2014 18:11:15 -0400 Subject: [PATCH] discosheep with "jeb_" (way faster) --- nbproject/project.properties | 4 ++-- src/ca/gibstick/discosheep/DiscoParty.java | 28 ++++++++++++++-------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/nbproject/project.properties b/nbproject/project.properties index 32e8f95..39cbd0d 100644 --- a/nbproject/project.properties +++ b/nbproject/project.properties @@ -55,8 +55,8 @@ javac.compilerargs=-Xlint:deprecation javac.deprecation=false javac.processorpath=\ ${javac.classpath} -javac.source=1.8 -javac.target=1.8 +javac.source=1.6 +javac.target=1.6 javac.test.classpath=\ ${javac.classpath}:\ ${build.classes.dir} diff --git a/src/ca/gibstick/discosheep/DiscoParty.java b/src/ca/gibstick/discosheep/DiscoParty.java index 42c4ce2..d232505 100644 --- a/src/ca/gibstick/discosheep/DiscoParty.java +++ b/src/ca/gibstick/discosheep/DiscoParty.java @@ -6,19 +6,21 @@ import java.util.Map; import java.util.Random; import org.bukkit.Color; 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.Material; import org.bukkit.Sound; 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.Firework; import org.bukkit.entity.Player; 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.inventory.meta.FireworkMeta; import org.bukkit.scheduler.BukkitRunnable; @@ -279,13 +281,17 @@ public class DiscoParty { void spawnSheep(World world, Location loc) { 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.teleport(loc); // teleport is needed to set orientation + newSheep.setTarget(player); getSheepList().add(newSheep); if (doLightning) { world.strikeLightningEffect(loc); } + newSheep.setCustomName("jeb_"); + newSheep.setCustomNameVisible(true); + newSheep.setRemoveWhenFarAway(false); } void spawnGuest(World world, Location loc, EntityType type) { @@ -403,12 +409,13 @@ public class DiscoParty { void updateAll() { for (Sheep sheeple : getSheepList()) { - randomizeSheepColour(sheeple); + //randomizeSheepColour(sheeple); - if (doFireworks && state % 8 == 0) { - if (r.nextDouble() < 0.50) { + if (state % 8 == 0) { + if (r.nextDouble() < 0.50 && doFireworks) { spawnRandomFireworkAtSheep(sheeple); } + sheeple.playEffect(SHEEP_EAT); } if (doJump) { @@ -416,6 +423,7 @@ public class DiscoParty { jump(sheeple); } } + } for (Entity guest : getGuestList()) {