Merge pull request #10 from BentoBoxWorld/master

Merge 0.1.0 into development branch
This commit is contained in:
BONNe 2019-02-03 17:35:43 +02:00 committed by GitHub
commit fedd660bcb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 88 additions and 44 deletions

View File

@ -6,7 +6,7 @@
<groupId>world.bentobox</groupId> <groupId>world.bentobox</groupId>
<artifactId>caveblock</artifactId> <artifactId>caveblock</artifactId>
<version>0.1.0-SNAPSHOT</version> <version>0.1.0</version>
<name>CaveBlock</name> <name>CaveBlock</name>
<description>CaveBlock is an add-on for BentoBox, an expandable Minecraft Bukkit plugin for island-type games like SkyBlock or AcidIsland.</description> <description>CaveBlock is an add-on for BentoBox, an expandable Minecraft Bukkit plugin for island-type games like SkyBlock or AcidIsland.</description>

View File

@ -47,7 +47,6 @@ public class ChunkGeneratorWorld extends ChunkGenerator
// --------------------------------------------------------------------- // ---------------------------------------------------------------------
/** /**
* This method sets if given coordinates can be set as spawn location * This method sets if given coordinates can be set as spawn location
*/ */
@ -217,6 +216,4 @@ public class ChunkGeneratorWorld extends ChunkGenerator
* This list contains block populators that will be applied after chunk is generated. * This list contains block populators that will be applied after chunk is generated.
*/ */
private List<BlockPopulator> blockPopulators; private List<BlockPopulator> blockPopulators;
} }

View File

@ -37,11 +37,14 @@ public class EntitiesPopulator extends BlockPopulator
public EntitiesPopulator(CaveBlock addon) public EntitiesPopulator(CaveBlock addon)
{ {
this.addon = addon; this.addon = addon;
loadSettings(); this.loadSettings();
} }
public void loadSettings() { /**
* This method load chances per environment.
*/
private void loadSettings() {
// Set up chances // Set up chances
chances = new HashMap<>(); chances = new HashMap<>();
// Normal // Normal
@ -157,6 +160,38 @@ public class EntitiesPopulator extends BlockPopulator
} }
// ---------------------------------------------------------------------
// Section: Private Classes
// ---------------------------------------------------------------------
/**
* Chances class to store chances for environments and main material
*/
private class Chances
{
/**
* @param entityChanceMap - contains chances for each entity.
* @param mainMaterial - material on which entity can replace.
*/
Chances(Map<EntityType, Pair<Double, Integer>> entityChanceMap, Material mainMaterial)
{
this.entityChanceMap = entityChanceMap;
this.mainMaterial = mainMaterial;
}
/**
* Map that contains chances for entity to spawn.
*/
final Map<EntityType, Pair<Double, Integer>> entityChanceMap;
/**
* Main material that can be replaced.
*/
final Material mainMaterial;
}
// --------------------------------------------------------------------- // ---------------------------------------------------------------------
// Section: Variables // Section: Variables
@ -167,10 +202,19 @@ public class EntitiesPopulator extends BlockPopulator
*/ */
private CaveBlock addon; private CaveBlock addon;
/**
* Map that contains chances for spawning per environment.
*/
private Map<Environment, Chances> chances; private Map<Environment, Chances> chances;
/**
* World height
*/
private int worldHeight; private int worldHeight;
/**
* Water entities
*/
private final static List<EntityType> WATER_ENTITIES = Arrays.asList(EntityType.GUARDIAN, private final static List<EntityType> WATER_ENTITIES = Arrays.asList(EntityType.GUARDIAN,
EntityType.SQUID, EntityType.SQUID,
EntityType.COD, EntityType.COD,
@ -179,22 +223,4 @@ public class EntitiesPopulator extends BlockPopulator
EntityType.TROPICAL_FISH, EntityType.TROPICAL_FISH,
EntityType.DROWNED, EntityType.DROWNED,
EntityType.DOLPHIN); EntityType.DOLPHIN);
/**
* Chances class to store chances for environments and main material
*
*/
private class Chances {
final Map<EntityType, Pair<Double, Integer>> entityChanceMap;
final Material mainMaterial;
/**
* @param materialChanceMap
* @param mainMaterial
*/
public Chances(Map<EntityType, Pair<Double, Integer>> entityChanceMap, Material mainMaterial) {
this.entityChanceMap = entityChanceMap;
this.mainMaterial = mainMaterial;
}
}
} }

View File

@ -32,14 +32,14 @@ public class MaterialPopulator extends BlockPopulator
{ {
this.addon = addon; this.addon = addon;
// Load settings // Load settings
loadSettings(); this.loadSettings();
} }
/** /**
* Loads chances for Material Populator * Loads chances for Material Populator
*/ */
public void loadSettings() { private void loadSettings() {
// Set up chances // Set up chances
chances = new HashMap<>(); chances = new HashMap<>();
// Normal // Normal
@ -158,6 +158,39 @@ public class MaterialPopulator extends BlockPopulator
} }
// ---------------------------------------------------------------------
// Section: Private Classes
// ---------------------------------------------------------------------
/**
* Chances class to store chances for environments and main material
*/
private class Chances
{
/**
* @param materialChanceMap - contains chances for each material.
* @param mainMaterial - material on which material can replace.
*/
Chances(Map<Material, Pair<Double, Integer>> materialChanceMap, Material mainMaterial)
{
this.materialChanceMap = materialChanceMap;
this.mainMaterial = mainMaterial;
}
/**
* Map that contains chances for entity to spawn.
*/
final Map<Material, Pair<Double, Integer>> materialChanceMap;
/**
* Main material that can be replaced.
*/
final Material mainMaterial;
}
// --------------------------------------------------------------------- // ---------------------------------------------------------------------
// Section: Variables // Section: Variables
// --------------------------------------------------------------------- // ---------------------------------------------------------------------
@ -168,25 +201,13 @@ public class MaterialPopulator extends BlockPopulator
*/ */
private CaveBlock addon; private CaveBlock addon;
/**
* Map that contains chances for spawning per environment.
*/
private Map<Environment, Chances> chances; private Map<Environment, Chances> chances;
private int worldHeight;
/** /**
* Chances class to store chances for environments and main material * World height
*
*/ */
private class Chances { private int worldHeight;
final Map<Material, Pair<Double, Integer>> materialChanceMap;
final Material mainMaterial;
/**
* @param materialChanceMap
* @param mainMaterial
*/
public Chances(Map<Material, Pair<Double, Integer>> materialChanceMap, Material mainMaterial) {
this.materialChanceMap = materialChanceMap;
this.mainMaterial = mainMaterial;
}
}
} }

View File

@ -578,7 +578,7 @@ blocks:
'24': '24':
==: org.bukkit.inventory.ItemStack ==: org.bukkit.inventory.ItemStack
v: 1631 v: 1631
type: beetroot_seeds type: BEETROOT_SEEDS
'26': '26':
==: org.bukkit.inventory.ItemStack ==: org.bukkit.inventory.ItemStack
v: 1631 v: 1631