Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,8 @@ realistic_biomes:
needs_sunlight: true
not_full_sunlight_multiplier: 0.125
max_soil_layers: 0
greenhouse_rate: 0.75
greenhouse_ignore_biome: true
biomes:
mushroom: 0.5
freshwater: 0.5
Expand Down
4 changes: 2 additions & 2 deletions convert_sqlite_to_mysql_script/convert_sqlite_to_mysql_rb.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,8 @@ def isSqliteType(dbLocationArg):
tmpCursor = tmpConnection.cursor()

try:
# try getting something from the master table
tmpCursor.execute('''select * from sqlite_master limit 1''')
# try getting something from the main table
tmpCursor.execute('''select * from sqlite_main limit 1''')
except sqlite3.DatabaseError as e:
tmpCursor.close()
tmpConnection.close()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ class RefreshOption(_constants):
'HOSTS': (1 << 3, 'Flush host cache'),
'STATUS': (1 << 4, 'Flush status variables'),
'THREADS': (1 << 5, 'Flush thread cache'),
'SLAVE': (1 << 6, 'Reset master info and restart slave thread'),
'SLAVE': (1 << 6, 'Reset main info and restart subordinate thread'),
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
CR_EMBEDDED_CONNECTION = "Embedded server"
CR_PROBE_SLAVE_STATUS = "Error on SHOW SLAVE STATUS:"
CR_PROBE_SLAVE_HOSTS = "Error on SHOW SLAVE HOSTS:"
CR_PROBE_SLAVE_CONNECT = "Error connecting to slave:"
CR_PROBE_MASTER_CONNECT = "Error connecting to master:"
CR_PROBE_SLAVE_CONNECT = "Error connecting to subordinate:"
CR_PROBE_MASTER_CONNECT = "Error connecting to main:"
CR_SSL_CONNECTION_ERROR = "SSL connection error: %-.100s"
CR_MALFORMED_PACKET = "Malformed packet"
CR_WRONG_LICENSE = "This client library is licensed only for use with MySQL servers having '%s' license"
Expand Down
2 changes: 1 addition & 1 deletion plugin.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: RealisticBiomes
main: com.untamedears.realisticbiomes.RealisticBiomes
load: STARTUP
version: 0.6.4.1
version: 0.6.4.3
19 changes: 15 additions & 4 deletions src/com/untamedears/realisticbiomes/RealisticBiomes.java
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,11 @@ public double growAndPersistBlock(Block block, boolean naturalGrowEvent) {
return 0.0;
}

// Only persistent crops should be grown in this manner
if (!growthConfig.isPersistent()) {
return 0.0;
}

RealisticBiomes.doLog(Level.FINER, "Realisticbiomes.growAndPersistBlock(): plantManager.get() returned: " + plant + " for coords: " + blockCoords);

if (plant == null) {
Expand Down Expand Up @@ -443,16 +448,22 @@ public GrowthConfig getGrowthConfig(TreeType species) {
return materialGrowth.get(treeTypeMap.get(species));
}

public GrowthConfig getGrowthConfig(Block block) {
Material m = block.getType();
public GrowthConfig getGrowthConfig(Material m) {
return materialGrowth.get(m);
}

public boolean hasGrowthConfig(Block block) {
Material m = block.getType();
public GrowthConfig getGrowthConfig(Block b) {
return materialGrowth.get(b.getType());
}

public boolean hasGrowthConfig(Material m) {
return materialGrowth.containsKey(m);
}

public boolean hasGrowthConfig(Block b) {
return materialGrowth.containsKey(b.getType());
}

public boolean hasGrowthConfig(TreeType species) {
return materialGrowth.containsKey(treeTypeMap.get(species));
}
Expand Down
17 changes: 11 additions & 6 deletions src/com/untamedears/realisticbiomes/listener/GrowListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public GrowListener(RealisticBiomes plugin) {
*/
@EventHandler(ignoreCancelled = true)
public void onBlockGrow(BlockGrowEvent event) {
Material m = event.getNewState().getType();
Block b = event.getBlock();

GrowthConfig growthConfig = plugin.getGrowthConfig(b);
Expand All @@ -57,7 +58,7 @@ public void onBlockGrow(BlockGrowEvent event) {

event.setCancelled(true);
}
else if (!willGrow(b)) {
else if (!willGrow(m, b)) {
event.setCancelled(true);
}
}
Expand Down Expand Up @@ -155,13 +156,17 @@ public void onBlockDispense(BlockDispenseEvent event) {
* Determines if a plant {@link Material | @link TreeType} will grow, given the current conditions
* @param m The material type of the plant
* @param b The block that the plant is on
* @return Whether the plant will grow this tick
* @return true if the block should grow this material, otherwise false
*/
private boolean willGrow(Block b) {
if(plugin.hasGrowthConfig(b)) {
boolean willGrow = Math.random() < plugin.getGrowthConfig(b).getRate(b);
return willGrow;
private boolean willGrow(Material m, Block b) {
GrowthConfig config = plugin.getGrowthConfig(m);

// Returns true if the random value is within the growth rate
if (config != null) {
return Math.random() < config.getRate(b);
}

// Default to growth if not cofigured
return true;
}

Expand Down