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>
<artifactId>caveblock</artifactId>
<version>0.1.0-SNAPSHOT</version>
<version>0.1.0</version>
<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>

View File

@ -47,7 +47,6 @@ public class ChunkGeneratorWorld extends ChunkGenerator
// ---------------------------------------------------------------------
/**
* 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.
*/
private List<BlockPopulator> blockPopulators;
}

View File

@ -37,11 +37,14 @@ public class EntitiesPopulator extends BlockPopulator
public EntitiesPopulator(CaveBlock addon)
{
this.addon = addon;
loadSettings();
this.loadSettings();
}
public void loadSettings() {
/**
* This method load chances per environment.
*/
private void loadSettings() {
// Set up chances
chances = new HashMap<>();
// 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
@ -167,10 +202,19 @@ public class EntitiesPopulator extends BlockPopulator
*/
private CaveBlock addon;
/**
* Map that contains chances for spawning per environment.
*/
private Map<Environment, Chances> chances;
/**
* World height
*/
private int worldHeight;
/**
* Water entities
*/
private final static List<EntityType> WATER_ENTITIES = Arrays.asList(EntityType.GUARDIAN,
EntityType.SQUID,
EntityType.COD,
@ -179,22 +223,4 @@ public class EntitiesPopulator extends BlockPopulator
EntityType.TROPICAL_FISH,
EntityType.DROWNED,
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;
// Load settings
loadSettings();
this.loadSettings();
}
/**
* Loads chances for Material Populator
*/
public void loadSettings() {
private void loadSettings() {
// Set up chances
chances = new HashMap<>();
// 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
// ---------------------------------------------------------------------
@ -168,25 +201,13 @@ public class MaterialPopulator extends BlockPopulator
*/
private CaveBlock addon;
/**
* Map that contains chances for spawning per environment.
*/
private Map<Environment, Chances> chances;
private int worldHeight;
/**
* Chances class to store chances for environments and main material
*
* World height
*/
private class Chances {
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;
}
}
private int worldHeight;
}

View File

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