Abstracted all block IDs to BlockID and item ids to ItemType. Overloaded recently changed methods for compatibility and cleaned a few things up.

This commit is contained in:
Wizjany
2011-09-03 12:54:20 -04:00
parent 8c0d0f9ed4
commit 4c00a24c1d
30 changed files with 873 additions and 652 deletions

View File

@@ -19,6 +19,7 @@ package com.sk89q.worldedit;
*/
import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.blocks.BlockID;
import com.sk89q.worldedit.filtering.HeightMapFilter;
import com.sk89q.worldedit.regions.Region;
@@ -43,7 +44,17 @@ public class HeightMap {
* @param session
* @param region
*/
public HeightMap(EditSession session, Region region) {
this(session, region, false);
}
/**
* Constructs the HeightMap
*
* @param session
* @param region
* @param naturalOnly ignore non-natural blocks
*/
public HeightMap(EditSession session, Region region, boolean naturalOnly) {
this.session = session;
this.region = region;
@@ -99,7 +110,7 @@ public class HeightMap {
int originZ = minY.getBlockZ();
int maxY = region.getMaximumPoint().getBlockY();
BaseBlock fillerAir = new BaseBlock(0);
BaseBlock fillerAir = new BaseBlock(BlockID.AIR);
int blocksChanged = 0;
@@ -125,7 +136,8 @@ public class HeightMap {
BaseBlock existing = session.getBlock(new Vector(X, curHeight, Z));
// Skip water/lava
if (existing.getType() < 8 || existing.getType() > 11) {
if (existing.getType() != BlockID.WATER && existing.getType() != BlockID.STATIONARY_WATER
&& existing.getType() != BlockID.LAVA && existing.getType() != BlockID.STATIONARY_LAVA) {
session.setBlock(new Vector(X, newHeight, Z), existing);
++blocksChanged;