mirror of
https://github.com/GTNewHorizons/gendustry.git
synced 2026-11-22 05:02:26 +00:00
more work on drops for custom hives
This commit is contained in:
1 parent
b47fae68dd
commit
47a28c97f7
4 files changed
+14
-3
No files matched your search
@@ -21,6 +21,11 @@ HiveGen Test { // hive ID - must be unique, determines block name
|
||||
NextTo Air // At least 1 block next to hive must be air
|
||||
Replace Replaceable // Spawn instead of air or "replaceable" material blocks (plants, etc.)
|
||||
|
||||
Drops {
|
||||
90% "forestry.speciesIndustrious" (10% ignoble) + I:Forestry:beeCombs @ 0
|
||||
3% "forestry.speciesValiant" + I:Forestry:beeCombs @ 1
|
||||
}
|
||||
|
||||
// Visual settings
|
||||
// Texture must be provided by a mod or a resource pack
|
||||
// Texture will default to gendustry:beehives/{id}/{top|side} if not specified
|
||||
|
||||
@@ -24,7 +24,7 @@ trait ParserHives extends RecipeParser with GenericConfigParser {
|
||||
private def intRange = int ~ ("-" ~> int) ^^ { case a ~ b => (a, b) }
|
||||
|
||||
private def hiveDropEntry =
|
||||
(int <~ "%") ~ str ~ (int <~ "%" <~ "ignoble").? ~ ("+" ~> spec).* ^^ { case chance ~ uid ~ ignoble ~ drops => HiveDropEntry(chance, uid, ignoble.getOrElse(0) / 100F, drops) }
|
||||
(int <~ "%") ~ str ~ ("(" ~> int <~ "%" <~ "ignoble" <~ ")").? ~ ("+" ~> spec).* ^^ { case chance ~ uid ~ ignoble ~ drops => HiveDropEntry(chance, uid, ignoble.getOrElse(0) / 100F, drops) }
|
||||
|
||||
private def hiveDefStatement = (
|
||||
"YLevel" ~> int ~ "-" ~ int ^^ { case min ~ a ~ max => HDYRange(min, max) }
|
||||
|
||||
@@ -26,6 +26,7 @@ import net.minecraftforge.oredict.OreDictionary
|
||||
|
||||
object CustomHives {
|
||||
var definitions = List.empty[CSHiveDefinition]
|
||||
var blocks = Map.empty[CSHiveDefinition, BeeHive]
|
||||
|
||||
def registerHiveDefinition(definition: CSHiveDefinition): Unit = {
|
||||
definitions :+= definition
|
||||
@@ -42,6 +43,7 @@ object CustomHives {
|
||||
color = color,
|
||||
lightLevel = lightLevel
|
||||
))
|
||||
blocks += definition -> block
|
||||
Gendustry.logDebug("Registered hive block: %s", block)
|
||||
}
|
||||
|
||||
@@ -155,9 +157,13 @@ object CustomHives {
|
||||
Gendustry.logDebug("Registering hive definition: %s", hive)
|
||||
|
||||
HiveManager.hiveRegistry.registerHive("Gendustry:" + definition.id, hive)
|
||||
|
||||
blocks(definition).hive = Some(hive)
|
||||
}
|
||||
}
|
||||
|
||||
definitions = List.empty // clear definitions
|
||||
// clear data that's no longer needed
|
||||
definitions = List.empty
|
||||
blocks = Map.empty
|
||||
}
|
||||
}
|
||||
@@ -36,7 +36,7 @@ case class HiveDrop(chance: Int, species: IAlleleBeeSpecies, ignobleShare: Float
|
||||
|
||||
override def getAdditional(world: World, x: Int, y: Int, z: Int, fortune: Int): util.Collection[ItemStack] = {
|
||||
import scala.collection.JavaConversions._
|
||||
additional
|
||||
additional.map(_.copy())
|
||||
}
|
||||
|
||||
override def getChance(world: World, x: Int, y: Int, z: Int): Int = chance
|
||||
|
||||
Reference in new issue
Block a user