Added floor caching and spawning, added boilerplate for changing floor color
This commit is contained in:
parent
b7361acb9b
commit
bc082bb87d
@ -15,6 +15,7 @@ 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;
|
||||
@ -61,7 +62,6 @@ public class DiscoParty {
|
||||
1.667f,
|
||||
2.0f
|
||||
};
|
||||
|
||||
// Instance properties
|
||||
private Random r = new Random();
|
||||
private PartyEvents partyEvents;
|
||||
@ -117,6 +117,14 @@ public class DiscoParty {
|
||||
return guestList;
|
||||
}
|
||||
|
||||
ArrayList<BlockState> getFloorCache() {
|
||||
return this.floorBlockCache;
|
||||
}
|
||||
|
||||
ArrayList<Block> getFloorBlocks() {
|
||||
return this.floorBlocks;
|
||||
}
|
||||
|
||||
public static HashMap<String, Integer> getDefaultGuestNumbers() {
|
||||
return defaultGuestNumbers;
|
||||
}
|
||||
@ -266,6 +274,9 @@ public class DiscoParty {
|
||||
spawnGuest(world, loc, ent);
|
||||
}
|
||||
}
|
||||
|
||||
loc = player.getLocation();
|
||||
this.spawnFloor(world, new Location(world,loc.getBlockX(),loc.getBlockY()-1,loc.getBlockZ()));
|
||||
}
|
||||
|
||||
void spawnSheep(World world, Location loc) {
|
||||
@ -287,6 +298,18 @@ public class DiscoParty {
|
||||
}
|
||||
}
|
||||
|
||||
void spawnFloor(World world, Location loc) {
|
||||
// First we'll save the floor state
|
||||
for (int x = loc.getBlockX() - this.radius; x < loc.getX() + this.radius; ++x) {
|
||||
for (int z = loc.getBlockZ() - this.radius; z < loc.getZ() + this.radius; ++z) {
|
||||
Block block = world.getBlockAt(x, loc.getBlockY(), z);
|
||||
this.getFloorCache().add(block.getState());
|
||||
block.setType(Material.WOOL);
|
||||
this.getFloorBlocks().add(block);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Mark all guests for removal, then clear the array
|
||||
void removeAll() {
|
||||
for (Sheep sheeple : getSheepList()) {
|
||||
@ -295,7 +318,7 @@ public class DiscoParty {
|
||||
for (Entity guest : getGuestList()) {
|
||||
guest.remove();
|
||||
}
|
||||
for(BlockState block : this.floorBlockCache){
|
||||
for (BlockState block : this.floorBlockCache) {
|
||||
block.update(true);
|
||||
}
|
||||
getSheepList().clear();
|
||||
@ -308,6 +331,10 @@ public class DiscoParty {
|
||||
sheep.setColor(discoColours[(r.nextInt(discoColours.length))]);
|
||||
}
|
||||
|
||||
void randomizeFloorColor(Block block) {
|
||||
// Randomize them colors, boi
|
||||
}
|
||||
|
||||
void jump(Entity entity) {
|
||||
Vector orgVel = entity.getVelocity();
|
||||
Vector newVel = (new Vector()).copy(orgVel);
|
||||
@ -397,6 +424,11 @@ public class DiscoParty {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (Block block : this.floorBlocks) {
|
||||
this.randomizeFloorColor(block);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private float getPentatonicNote() {
|
||||
|
Loading…
Reference in New Issue
Block a user