Permalink
Browse files

Change check command. Added bo2spec.

  • Loading branch information...
1 parent bb01f5e commit b86c45132ce8ad9dfc919f4d5b086a635c9f903b @Wickth Wickth committed Oct 12, 2011
View
119 bo2spec.txt
@@ -0,0 +1,119 @@
+Design Spec for Biome Object Builder v2 File Format
+
+
+File Extension .BO2
+
+
+File Structure
+[META]
+<tags>
+[DATA]
+<blocks>
+
+
+
+[META]
+<tags> can be 0 or more of the following:
+<option>=<type>
+tags are optional, if they are not present, their default value is used instead.
+
+
+<type> can be one of the following:
+<string> - Any number of characters terminated by a new line
+<int> - Any signed integer
+<bool> - Either "True" or "False"
+or a list of types deliminated by ,
+For example <string>,<string>,<string>
+
+
+Possible <option>s:
+version=<string> [Default: NA]
+spawnOnBlockType=<intList>[Default: 2] [Bound: Must be a natural block ID]
+spawnSunlight=<bool> [Default: True]
+spawnDarkness=<bool> [Default: False]
+spawnWater=<bool> [Default: False]
+spawnLava=<bool> [Default: False]
+underFill=<bool> [Default: True]
+dig=<bool> [Default: True]
+needsFoundation=<boo> [Default: True]
+rarity=<int> [Default: 10] [Bound: Min = 1, Max = 1000]
+collisionPercentage=<int> [Default: 2] [Bound: Min = 1, Max = 100]
+spawnElevationMin=<int> [Default: 0] [Bound: Min = 0, Max = 128, Min <= Max]
+spawnElevationMax=<int> [Default: 128] [Bound: Min = 0, Max = 128, Max >= Min]
+randomRotation=<bool> [Default: True]
+groupId=<string> [Default: ""]
+tree=<bool> [Default: false]
+branch=<bool> [Default: false]
+diggingBranch=<bool> [Default: false]
+branchLimit=<int> [Default: 6] [Bound: Min = 1, Max = 16]
+groupFrequencyMin=<int> [Default: 1] [Bound: Min = 1, Max = 100, Min <= Max]
+groupFrequencyMax=<int> [Default: 5] [Bound: Min = 1, Max = 100, Max >= Min]
+groupSeperationMin=<int> [Default: 0] [Bound: Min = 0, Max = 16, Min <= Max]
+groupSeperationMax=<int> [Default: 5] [Bound: Min = 0, Max = 16, Max >= Min]
+spawnInBiome=<stringList> [Default: "All"] [Bound: Only valid Biomes and "All"]
+
+
+Descriptions of options:
+version - contains a string of the current version of the file structure.
+spawnOnBlockType - contains a list of integer values of the block ids this object can spawn on.
+spawnSunlight - a flag if this object can spawn on sunlit ground
+spawnDarkness - a flag if this object can spawn in total darkness
+spawnWater - a flag if this object can spawn under water. (Note if the object is tall enough, it might portrude from the water)
+spawnLava - a flag if this object can spawn under lava.
+underFill - a flag to determin if the object should have its base filled underneath of any gaps after placing. The gaps will be filled with the block specified in spawnOnBlockType.
+needsFoundation - a flag to determin if the object requires a preexisting foundation. If this is false, the object MIGHT spawn floating.
+dig - a flag to determin if the object should dig out the sides of its area. This will reduce the frequency bailout chance drasticly.
+rarity - a 1 to 100 chance the object will spawn in any given chunk. However, each whole 100 value represents a spawn attempt, then the remainin is a precentage again (ex: rarity=320 means that there will be 3 spawn attempts plus a 20% chance of a 4th)
+collisionPercentage- a 1 to 100 percent of the total object that is allowed to collide with the terrain. With the dig flag set to flase, collsion blocks are removed, with the dig flag of true, collsion blocks from the object will override terrain.
+spawnElevationMin - an integer indicating the minimum elevation the base of the object can spawn at.
+spawnElevationMax - an integer indicating the maximum elevation the base of the object can spawn at.
+randomRotation - a flag to determin if the object can be rotated randomly 0, 90, 180 or 270 degrees on placing. A branch block will be oriented based on the branch direction, however with this flag set, it can appear in any direction.
+groupId - a string containing the group id this object belongs to. Objects with the same groupId can spawn near each other. (If group ID is absent, or "", no other group information needs to be loaded, or saved to file)
+tree - a flag to determin if this object should grow from saplings
+branch - a flag to determin if this object should spawn from branch blocks
+diggingBranch - a flag to determin if the branch block is allowed to override existing blocks in the object. If false if the branch would overlap the existing object, it fails to be added, and the branch fails completely.
+branchLimit - The maximum number of branches a single object can have before the branch engine stops adding branches
+groupFrequencyMin - The minimum number of objects from a group that are attempted to be placed near each other.
+groupFrequencyMax - The maximum number of objects from a group that are attempted to be placed near each other. (groupFrequency is calculated for each normal frequency attempt!, so be careful about setting your numbers too high)
+groupSeperationMin - The minimum distance between group objects when spawning.
+groupSeperationMax - The maximum distance between group objects when spawning.
+spawnInBiome - a list of strings of possible biomes the object can spawn in. The possibilities are "All" or the name of the Biome, such as "Tundra" or "Desert"
+
+
+[DATA]
+<blocks> can be 0 or more of:
+<location>:<block>[.<option>[#<branch>]]
+
+
+A <location> is:
+<int>,<int>,<int>
+It is in the form of Y,X,Z where Z is elevation.
+The center block of the object is at 0,0,0.
+The center block is used for calculations about spawning
+Z may be negative, if so, the object will displace blocks beneath its base, as it "digs" down.
+
+
+A <block> is:
+<int>
+It is the block ID of the given block. Air blocks do not need to be specified, but if they are not, then it is possible that enclosures might be partially filled if the dig flag is not set.
+
+
+A <otpion> is:
+<int>
+This is the extra data stored in the block id. It is used for setting meta block data. Forexample, Crop age is based on option values 0 - 7
+
+
+A <branch> is:
+<int>@<int>
+The first <int> in a value 0-3 representing 0=North, 1=East, 2=South, 3=West
+The second <int> is a value 1-100 representing the percent chance this branch block could become a branch in a given group.
+
+Notes on placement:
+If an object would extend past the top of the sky, it will fail to be placed.
+If an object would try to replace a bedrock block, it will fail to be placed.
+if max(Z) - min(Z) >= 128, the object will not be able to be placed. Even objects that have large heights (deltaZ > 32) are unlikely to be placed.
+
+Notes on branch spawning:
+-Branch blocks that are adjacent to each other, are considered 1 branch region. The block closest to the origin takes precidence for deciding direction and probability. Other branch block info is ignored. (Diagonally adjacent blocks do not count) When replacing these adjacent branch blocks, you should replace all of them at the same time with (if any) from the branch object.
+-When a branch object is spawned from a branch block, it is rotated so that it's north is the direction specified in the branch block. (Then if random rotation is in effect, then it is rotated further)
+
View
2 src/com/Khorn/PTMBukkit/BiomeConfig.java
@@ -336,7 +336,7 @@ public BiomeConfig(File settingsDir, String biomeName, int biomeId, WorldConfig
this.WriteSettingsFile(settingsFile);
BuildReplaceMatrix();
- cBiome.SetTerrainGen(this.BiomeSurface, this.BiomeVolatility);
+ cBiome.SetBiome(this);
}
View
18 src/com/Khorn/PTMBukkit/Commands/BiomeCommand.java
@@ -39,16 +39,20 @@ public boolean onCommand(CommandSender sender, List<String> args)
if (args.size() == 1 && args.get(0).equals("-f"))
{
BiomeBase[] biome = new BiomeBase[1];
+ float[] temp = new float[1];
+ float[] humidity = new float[1];
biomeManager.a(biome, (int) player.getLocation().getX(), (int) player.getLocation().getZ(), 1, 1);
+ biomeManager.getTemperatures(temp, (int) player.getLocation().getX(), (int) player.getLocation().getZ(), 1, 1);
+ biomeManager.getWetness(humidity, (int) player.getLocation().getX(), (int) player.getLocation().getZ(), 1, 1);
+
+
+ player.sendMessage(ValueColor + biome[0].l + MessageColor + " block biome!");
+ player.sendMessage(ValueColor + humidity[0] + MessageColor + " block humidity!");
+ //double notchTemp = biomeManager.temperature[0] - (((CraftWorld) player.getLocation().getWorld()).getHandle().e((int) player.getLocation().getX(), (int) player.getLocation().getZ()) - 64) / 64.0D * 0.3D;
+ player.sendMessage(ValueColor + temp[0] + MessageColor + " block temperature!");
+ //player.sendMessage(ValueColor + notchTemp + MessageColor + " block temperature with height constant!");
- /*
- player.sendMessage(ValueColor + biome[0].n + MessageColor + " block biome!");
- player.sendMessage(ValueColor + biomeManager.rain[0] + MessageColor + " block humidity!");
- double notchTemp = biomeManager.temperature[0] - (((CraftWorld) player.getLocation().getWorld()).getHandle().e((int) player.getLocation().getX(), (int) player.getLocation().getZ()) - 64) / 64.0D * 0.3D;
- player.sendMessage(ValueColor + biomeManager.temperature[0] + MessageColor + " block temperature!");
- player.sendMessage(ValueColor + notchTemp + MessageColor + " block temperature with height constant!");
- */
}
View
11 src/com/Khorn/PTMBukkit/Commands/CheckCommand.java
@@ -14,25 +14,22 @@ public CheckCommand(PTMPlugin _plugin)
super(_plugin);
name = "check";
usage = "/ptm check [World]";
- help = "Checks PTM is enable for this world";
+ help = "Checks or create PTM settings for world ";
workOnConsole = true;
}
@Override
public boolean onCommand(CommandSender sender, List<String> args)
{
- if ((sender instanceof ConsoleCommandSender) && args.size() == 0)
+ if (args.size() == 0)
{
sender.sendMessage(ErrorColor + "You need to select world");
return true;
}
- WorldConfig worldSettings = this.getSettings(sender, args.size() > 0 ? args.get(0) : "");
+ WorldConfig worldSettings = plugin.GetSettings(args.get(0), true);
- if (worldSettings != null)
- sender.sendMessage(MessageColor + "Ptm is enabled for " + worldSettings.WorldName);
- else
- sender.sendMessage(MessageColor + "Ptm is disabled for this world");
+ sender.sendMessage(MessageColor + "Done!");
return true;
}
}
View
2 src/com/Khorn/PTMBukkit/Commands/ReloadCommand.java
@@ -31,7 +31,7 @@ public boolean onCommand(CommandSender sender, List<String> args)
this.plugin.worldsSettings.remove(worldName);
- worldSettings.newSettings = this.plugin.GetSettings(worldName);
+ worldSettings.newSettings = this.plugin.GetSettings(worldName,false);
worldSettings.isDeprecated = true;
sender.sendMessage(MessageColor + "WorldConfig for world " + worldName + " reloaded");
View
15 src/com/Khorn/PTMBukkit/PTMPlugin.java
@@ -74,7 +74,7 @@ public ChunkGenerator getDefaultWorldGenerator(String worldName, String id)
ChunkGenerator prov = null;
- WorldConfig conf = this.GetSettings(worldName);
+ WorldConfig conf = this.GetSettings(worldName,false);
if (conf.Mode != WorldConfig.GenMode.OnlyBiome)
{
@@ -90,7 +90,7 @@ public ChunkGenerator getDefaultWorldGenerator(String worldName, String id)
}
- public WorldConfig GetSettings(String worldName)
+ public WorldConfig GetSettings(String worldName, boolean onlyCheck)
{
File baseFolder = new File(this.getDataFolder(), "worlds/" + worldName);
@@ -123,7 +123,8 @@ public WorldConfig GetSettings(String worldName)
WorldConfig worker = new WorldConfig(baseFolder, this, worldName);
- worldsSettings.put(worldName, worker);
+ if (!onlyCheck)
+ worldsSettings.put(worldName, worker);
System.out.println("PhoenixTerrainMod: settings for '" + worldName + "' loaded");
return worker;
@@ -194,22 +195,22 @@ private void CheckDefaultSettingsFolder()
/DefaultSettings.ini
*/
if (!this.getDataFolder().exists())
- if (this.getDataFolder().mkdir())
+ if (!this.getDataFolder().mkdir())
System.out.println("PhoenixTerrainMod: error create plugin directory");
File temp = new File(this.getDataFolder(), "worlds");
if (!temp.exists())
- if (temp.mkdir())
+ if (!temp.mkdir())
System.out.println("PhoenixTerrainMod: error create worlds directory");
temp = new File(this.getDataFolder(), PTMDefaultValues.DefaultBOBDirectoryName.stringValue());
if (!temp.exists())
- if (temp.mkdir())
+ if (!temp.mkdir())
System.out.println("PhoenixTerrainMod: error create DefaultBOBPlugins directory");
temp = new File(this.getDataFolder(), PTMDefaultValues.DefaultBiomeConfigDirectoryName.stringValue());
if (!temp.exists())
- if (temp.mkdir())
+ if (!temp.mkdir())
System.out.println("PhoenixTerrainMod: error create DefaultBiomeConfigs directory");
temp = new File(this.getDataFolder(), PTMDefaultValues.DefaultSettingsName.stringValue());
View
12 src/com/Khorn/PTMBukkit/Util/CustomBiome.java
@@ -1,6 +1,7 @@
package com.Khorn.PTMBukkit.Util;
+import com.Khorn.PTMBukkit.BiomeConfig;
import net.minecraft.server.BiomeBase;
public class CustomBiome extends BiomeBase
@@ -10,10 +11,15 @@ public CustomBiome(int id,String name)
super(id);
this.a(name);
}
- public void SetTerrainGen(float surfaceAdd,float volatility)
+ public void SetBiome(BiomeConfig config)
{
- this.q = surfaceAdd;
- this.r = volatility;
+
+ this.q = config.BiomeSurface;
+ this.r = config.BiomeVolatility;
+ this.n = config.SurfaceBlock;
+ this.o = config.GroundBlock;
+
+
}
}
View
11 src/com/Khorn/PTMBukkit/WorldConfig.java
@@ -456,7 +456,16 @@ private void ReadCustomBiomes()
return;
String[] keys = this.SettingsCache.get("CustomBiomes").split(",");
- Collections.addAll(this.CustomBiomes, keys);
+ for(String key : keys)
+ {
+ boolean isUnique = true;
+ for(int i = 0; i< DefaultBiomesCount;i++)
+ if(BiomeBase.a[i].l.equals(key))
+ isUnique= false;
+
+ if(isUnique && !this.CustomBiomes.contains(key))
+ this.CustomBiomes.add(key);
+ }
}
}
View
2 src/plugin.yml
@@ -1,5 +1,5 @@
name: PhoenixTerrainMod
-version: 0.9.4
+version: 0.9.6
description: Generates a worlds.
authors: ['Khorn', 'R-T-B']
main: com.Khorn.PTMBukkit.PTMPlugin

0 comments on commit b86c451

Please sign in to comment.