@@ -188,7 +188,7 @@ public boolean retract(Block block) {
}

private MoveReaction getReaction(Block block) {
BlockMaterial mat = block.getSubMaterial();
BlockMaterial mat = block.getMaterial();
if (mat.equals(VanillaMaterials.AIR)) {
return MoveReaction.BREAK;
}
@@ -47,7 +47,7 @@ public PistonExtension(String name, int id) {
@Override
public void onDestroy(Block block, double dropChance) {
block = block.translate(this.getFacing(block).getOpposite());
BlockMaterial mat = block.getSubMaterial();
BlockMaterial mat = block.getMaterial();
if (mat instanceof Piston) {
((Piston) mat).onDestroy(block, dropChance);
} else {
@@ -123,7 +123,7 @@ public ArrayList<ItemStack> getDrops(Block block) {
* @param block to place a tree at
*/
public void growTree(Block block) {
BlockMaterial mat = block.getSubMaterial();
BlockMaterial mat = block.getMaterial();
if (mat instanceof Sapling) {
this.growTree(block, (Sapling) mat);
}
@@ -131,7 +131,7 @@ public boolean canAttachTo(BlockMaterial material, BlockFace face) {
}

public boolean canAttachTo(Block block, BlockFace face) {
return this.canAttachTo(block.getSubMaterial(), face);
return this.canAttachTo(block.getMaterial(), face);
}

public BlockFace getTracedFace(Block block) {
@@ -29,17 +29,21 @@
import java.util.ArrayList;

import org.spout.api.geo.cuboid.Block;
import org.spout.api.geo.cuboid.Region;
import org.spout.api.inventory.ItemStack;
import org.spout.api.material.DynamicMaterial;
import org.spout.api.material.block.BlockFace;
import org.spout.api.math.Vector3;
import org.spout.api.util.LogicUtil;

import org.spout.vanilla.material.block.ScheduleUpdated;
import org.spout.vanilla.material.block.redstone.RedstoneSource;
import org.spout.vanilla.runnable.BlockScheduler;
import org.spout.vanilla.util.RailsState;
import org.spout.vanilla.util.RedstonePowerMode;

public class DetectorRail extends RailBase implements RedstoneSource, ScheduleUpdated {
public class DetectorRail extends RailBase implements RedstoneSource, DynamicMaterial {
public static final int TICK_DELAY = 20;
private static final Vector3[] maxRange = new Vector3[]{new Vector3(0, 0, 0), new Vector3(1, 1, 1)};

public DetectorRail(String name, int id) {
super(name, id);
this.setHardness(0.7F).setResistance(1.2F).setOpacity((byte) 0);
@@ -55,19 +59,10 @@ public void doRedstoneUpdates(Block block) {
block.setSource(this).update().translate(BlockFace.BOTTOM).update();
}

@Override
public void onDelayedUpdate(Block block) {
if (this.isPowering(block)) {
//TODO: Check if a minecart is on top of this block right now...
this.setPowering(block, false);
this.doRedstoneUpdates(block);
}
}

public void activate(Block block) {
this.setPowering(block, true);
this.doRedstoneUpdates(block);
BlockScheduler.schedule(block, 20);
block.dynamicUpdate(TICK_DELAY);
}

/**
@@ -129,4 +124,26 @@ public ArrayList<ItemStack> getDrops(Block block) {
drops.add(new ItemStack(this, 1));
return drops;
}

@Override
public Vector3[] maxRange() {
return maxRange;
}

@Override
public long onPlacement(Block b, Region r, long currentTime) {
return -1;
}

@Override
public long update(Block block, Region r, long updateTime, long lastUpdateTime, Object hint) {
if (this.isPowering(block)) {
//TODO: Check if a minecart is on top of this block right now...
this.setPowering(block, false);
this.doRedstoneUpdates(block);
return -1;
} else {
return TICK_DELAY;
}
}
}
@@ -130,7 +130,7 @@ public void onUpdate(Block block) {
BlockMaterial mat;
for (BlockFace face : BlockFaces.NESW) {
neigh = block.translate(face);
mat = neigh.getSubMaterial();
mat = neigh.getMaterial();
if (mat instanceof RedstoneSource || mat instanceof RedstoneTarget) {
continue;
}
@@ -170,7 +170,7 @@ public short getRedstonePowerTo(Block block, BlockFace direction, RedstonePowerM
if (power == REDSTONE_POWER_MIN) {
return power;
} else {
BlockMaterial mat = block.translate(direction).getSubMaterial();
BlockMaterial mat = block.translate(direction).getMaterial();
if (mat instanceof RedstoneSource || mat instanceof RedstoneTarget || !isDistractedFrom(block, direction)) {
return power;
} else {
@@ -215,7 +215,7 @@ public short getReceivingPower(Block block) {
boolean topIsConductor = false;
for (BlockFace face : BlockFaces.BTEWNS) {
rel = block.translate(face);
mat = rel.getSubMaterial();
mat = rel.getMaterial();
if (mat.equals(this)) {
//handle neighbouring redstone wires
maxPower = (short) Math.max(maxPower, this.getRedstonePower(rel) - 1);
@@ -262,7 +262,7 @@ public short getReceivingPower(Block block) {
*/
public boolean isConnectedToSource(Block block, BlockFace face) {
Block target = block.translate(face);
BlockMaterial mat = target.getSubMaterial();
BlockMaterial mat = target.getMaterial();
if (mat instanceof RedstoneSource || mat instanceof RedstoneTarget) {
return true;
} else {

Large diffs are not rendered by default.

@@ -106,7 +106,7 @@ public void handleServer(Session session, Player player, PlayerBlockPlacementMes
PlayerInteractEvent interactEvent = eventManager.callEvent(new PlayerInteractEvent(player, clickedBlock.getPosition(), inventory.getCurrentItem(), Action.RIGHT_CLICK, false));

//Get the target block and validate
BlockMaterial clickedMaterial = clickedBlock.getSubMaterial();
BlockMaterial clickedMaterial = clickedBlock.getMaterial();

//alternative block to place at may the clicked block deny placement
Block alterBlock = clickedBlock.translate(clickedFace);
@@ -68,7 +68,7 @@ public void handleServer(Session session, Player player, PlayerDiggingMessage me

World w = player.getEntity().getWorld();
Block block = w.getBlock(x, y, z, player.getEntity());
BlockMaterial blockMaterial = block.getSubMaterial();
BlockMaterial blockMaterial = block.getMaterial();
BlockFace clickedFace = VanillaMessageHandlerUtils.messageToBlockFace(face);

if (x == 0 && y == 0 && z == 0 && face == 0 && state == 4) {

This file was deleted.

@@ -42,7 +42,7 @@ public class RedstoneUtil {
* @return True if it is a redstone conductor
*/
public static boolean isConductor(Block block) {
return isConductor(block.getSubMaterial());
return isConductor(block.getMaterial());
}

/**
@@ -94,7 +94,7 @@ public static boolean isPowered(Block block, RedstonePowerMode powerMode) {
}

public static boolean isPowered(Block block, BlockFace to, RedstonePowerMode powerMode) {
BlockMaterial mat = block.getSubMaterial();
BlockMaterial mat = block.getMaterial();
if (mat instanceof VanillaBlockMaterial) {
if (((VanillaBlockMaterial) mat).hasRedstonePower(block, powerMode)) {
return true;
@@ -99,7 +99,6 @@ private int getHighestSolidBlock(World world, int x, int z) {

@Override
public int[][] getSurfaceHeight(World world, int chunkX, int chunkY) {
int height = world.getHeight() - 1;
int[][] heights = new int[Chunk.BLOCKS.SIZE][Chunk.BLOCKS.SIZE];
for (int x = 0; x < Chunk.BLOCKS.SIZE; x++) {
for (int z = 0; z < Chunk.BLOCKS.SIZE; z++) {
@@ -28,24 +28,24 @@

import net.royawesome.jlibnoise.module.modifier.ScalePoint;

import org.spout.vanilla.configuration.VanillaConfiguration;
import org.spout.vanilla.configuration.BiomeConfiguration;

public class PlainBiome extends VanillaNormalBiome {
private final static ScalePoint NOISE = new ScalePoint();

static {
NOISE.SetSourceModule(0, VanillaNormalBiome.MASTER);
NOISE.setxScale(VanillaConfiguration.BIOMES.PLAINS_X_SCALE.getDouble());
NOISE.setyScale(VanillaConfiguration.BIOMES.PLAINS_Y_SCALE.getDouble());
NOISE.setzScale(VanillaConfiguration.BIOMES.PLAINS_Z_SCALE.getDouble());
NOISE.setxScale(BiomeConfiguration.PLAINS_X_SCALE.getDouble());
NOISE.setyScale(BiomeConfiguration.PLAINS_Y_SCALE.getDouble());
NOISE.setzScale(BiomeConfiguration.PLAINS_Z_SCALE.getDouble());
}

public PlainBiome(int id) {
super(id, NOISE/*, new PondDecorator(), new GrassDecorator(), new FlowerDecorator()*/);
this.minDensityTerrainHeight = VanillaConfiguration.BIOMES.PLAINS_MIN_DENSITY_TERRAIN_HEIGHT.getByte();
this.maxDensityTerrainHeight = VanillaConfiguration.BIOMES.PLAINS_MAX_DENSITY_TERRAIN_HEIGHT.getByte();
this.upperHeightMapScale = VanillaConfiguration.BIOMES.PLAINS_UPPER_HEIGHT_MAP_SCALE.getFloat();
this.bottomHeightMapScale = VanillaConfiguration.BIOMES.PLAINS_BOTTOM_HEIGHT_MAP_SCALE.getFloat();
this.minDensityTerrainHeight = BiomeConfiguration.PLAINS_MIN_DENSITY_TERRAIN_HEIGHT.getByte();
this.maxDensityTerrainHeight = BiomeConfiguration.PLAINS_MAX_DENSITY_TERRAIN_HEIGHT.getByte();
this.upperHeightMapScale = BiomeConfiguration.PLAINS_UPPER_HEIGHT_MAP_SCALE.getFloat();
this.bottomHeightMapScale = BiomeConfiguration.PLAINS_BOTTOM_HEIGHT_MAP_SCALE.getFloat();
}

@Override
@@ -28,28 +28,28 @@

import net.royawesome.jlibnoise.module.modifier.ScalePoint;

import org.spout.vanilla.configuration.VanillaConfiguration;
import org.spout.vanilla.configuration.BiomeConfiguration;

public class SmallMountainsBiome extends VanillaNormalBiome {
private final static ScalePoint NOISE = new ScalePoint();

static {
NOISE.SetSourceModule(0, VanillaNormalBiome.MASTER);
NOISE.setxScale(VanillaConfiguration.BIOMES.SMALL_MOUNTAINS_X_SCALE.getDouble());
NOISE.setyScale(VanillaConfiguration.BIOMES.SMALL_MOUNTAINS_Y_SCALE.getDouble());
NOISE.setzScale(VanillaConfiguration.BIOMES.SMALL_MOUNTAINS_Z_SCALE.getDouble());
NOISE.setxScale(BiomeConfiguration.SMALL_MOUNTAINS_X_SCALE.getDouble());
NOISE.setyScale(BiomeConfiguration.SMALL_MOUNTAINS_Y_SCALE.getDouble());
NOISE.setzScale(BiomeConfiguration.SMALL_MOUNTAINS_Z_SCALE.getDouble());
}

public SmallMountainsBiome(int biomeId) {
super(biomeId, NOISE);
minDensityTerrainHeight = VanillaConfiguration.BIOMES.SMALL_MOUNTAINS_MIN_DENSITY_TERRAIN_HEIGHT.getByte();
maxDensityTerrainHeight = VanillaConfiguration.BIOMES.SMALL_MOUNTAINS_MAX_DENSITY_TERRAIN_HEIGHT.getByte();
minDensityTerrainThickness = VanillaConfiguration.BIOMES.SMALL_MOUNTAINS_MIN_DENSITY_TERRAIN_THICKNESS.getByte();
maxDensityTerrainThickness = VanillaConfiguration.BIOMES.SMALL_MOUNTAINS_MAX_DENSITY_TERRAIN_THICKNESS.getByte();
upperHeightMapScale = VanillaConfiguration.BIOMES.SMALL_MOUNTAINS_UPPER_HEIGHT_MAP_SCALE.getFloat();
bottomHeightMapScale = VanillaConfiguration.BIOMES.SMALL_MOUNTAINS_BOTTOM_HEIGHT_MAP_SCALE.getFloat();
densityTerrainThicknessScale = VanillaConfiguration.BIOMES.SMALL_MOUNTAINS_DENSITY_TERRAIN_THICKNESS_SCALE.getFloat();
densityTerrainHeightScale = VanillaConfiguration.BIOMES.SMALL_MOUNTAINS_DENSITY_TERRAIN_HEIGHT_SCALE.getFloat();
minDensityTerrainHeight = BiomeConfiguration.SMALL_MOUNTAINS_MIN_DENSITY_TERRAIN_HEIGHT.getByte();
maxDensityTerrainHeight = BiomeConfiguration.SMALL_MOUNTAINS_MAX_DENSITY_TERRAIN_HEIGHT.getByte();
minDensityTerrainThickness = BiomeConfiguration.SMALL_MOUNTAINS_MIN_DENSITY_TERRAIN_THICKNESS.getByte();
maxDensityTerrainThickness = BiomeConfiguration.SMALL_MOUNTAINS_MAX_DENSITY_TERRAIN_THICKNESS.getByte();
upperHeightMapScale = BiomeConfiguration.SMALL_MOUNTAINS_UPPER_HEIGHT_MAP_SCALE.getFloat();
bottomHeightMapScale = BiomeConfiguration.SMALL_MOUNTAINS_BOTTOM_HEIGHT_MAP_SCALE.getFloat();
densityTerrainThicknessScale = BiomeConfiguration.SMALL_MOUNTAINS_DENSITY_TERRAIN_THICKNESS_SCALE.getFloat();
densityTerrainHeightScale = BiomeConfiguration.SMALL_MOUNTAINS_DENSITY_TERRAIN_HEIGHT_SCALE.getFloat();
}

@Override
@@ -28,24 +28,24 @@

import net.royawesome.jlibnoise.module.modifier.ScalePoint;

import org.spout.vanilla.configuration.VanillaConfiguration;
import org.spout.vanilla.configuration.BiomeConfiguration;

public class TaigaBiome extends VanillaNormalBiome {
private final static ScalePoint NOISE = new ScalePoint();

static {
NOISE.SetSourceModule(0, VanillaNormalBiome.MASTER);
NOISE.setxScale(VanillaConfiguration.BIOMES.TAIGA_X_SCALE.getDouble());
NOISE.setyScale(VanillaConfiguration.BIOMES.TAIGA_Y_SCALE.getDouble());
NOISE.setzScale(VanillaConfiguration.BIOMES.TAIGA_Z_SCALE.getDouble());
NOISE.setxScale(BiomeConfiguration.TAIGA_X_SCALE.getDouble());
NOISE.setyScale(BiomeConfiguration.TAIGA_Y_SCALE.getDouble());
NOISE.setzScale(BiomeConfiguration.TAIGA_Z_SCALE.getDouble());
}

public TaigaBiome(int biomeId) {
super(biomeId, NOISE);
this.minDensityTerrainHeight = VanillaConfiguration.BIOMES.TAIGA_MIN_DENSITY_TERRAIN_HEIGHT.getByte();
this.maxDensityTerrainHeight = VanillaConfiguration.BIOMES.TAIGA_MAX_DENSITY_TERRAIN_HEIGHT.getByte();
this.upperHeightMapScale = VanillaConfiguration.BIOMES.TAIGA_UPPER_HEIGHT_MAP_SCALE.getFloat();
this.bottomHeightMapScale = VanillaConfiguration.BIOMES.TAIGA_BOTTOM_HEIGHT_MAP_SCALE.getFloat();
this.minDensityTerrainHeight = BiomeConfiguration.TAIGA_MIN_DENSITY_TERRAIN_HEIGHT.getByte();
this.maxDensityTerrainHeight = BiomeConfiguration.TAIGA_MAX_DENSITY_TERRAIN_HEIGHT.getByte();
this.upperHeightMapScale = BiomeConfiguration.TAIGA_UPPER_HEIGHT_MAP_SCALE.getFloat();
this.bottomHeightMapScale = BiomeConfiguration.TAIGA_BOTTOM_HEIGHT_MAP_SCALE.getFloat();
}

@Override
@@ -30,7 +30,7 @@

import org.spout.api.util.cuboid.CuboidShortBuffer;

import org.spout.vanilla.configuration.VanillaConfiguration;
import org.spout.vanilla.configuration.BiomeConfiguration;
import org.spout.vanilla.material.VanillaMaterials;
import org.spout.vanilla.world.generator.normal.NormalGenerator;

@@ -39,17 +39,17 @@ public class TundraBiome extends VanillaNormalBiome {

static {
NOISE.SetSourceModule(0, VanillaNormalBiome.MASTER);
NOISE.setxScale(VanillaConfiguration.BIOMES.TUNDRA_X_SCALE.getDouble());
NOISE.setyScale(VanillaConfiguration.BIOMES.TUNDRA_Y_SCALE.getDouble());
NOISE.setzScale(VanillaConfiguration.BIOMES.TUNDRA_Z_SCALE.getDouble());
NOISE.setxScale(BiomeConfiguration.TUNDRA_X_SCALE.getDouble());
NOISE.setyScale(BiomeConfiguration.TUNDRA_Y_SCALE.getDouble());
NOISE.setzScale(BiomeConfiguration.TUNDRA_Z_SCALE.getDouble());
}

public TundraBiome(int id) {
super(id, NOISE/*, new PondDecorator()*/);
this.minDensityTerrainHeight = VanillaConfiguration.BIOMES.TUNDRA_MIN_DENSITY_TERRAIN_HEIGHT.getByte();
this.maxDensityTerrainHeight = VanillaConfiguration.BIOMES.TUNDRA_MAX_DENSITY_TERRAIN_HEIGHT.getByte();
this.upperHeightMapScale = VanillaConfiguration.BIOMES.TUNDRA_UPPER_HEIGHT_MAP_SCALE.getFloat();
this.bottomHeightMapScale = VanillaConfiguration.BIOMES.TUNDRA_BOTTOM_HEIGHT_MAP_SCALE.getFloat();
this.minDensityTerrainHeight = BiomeConfiguration.TUNDRA_MIN_DENSITY_TERRAIN_HEIGHT.getByte();
this.maxDensityTerrainHeight = BiomeConfiguration.TUNDRA_MAX_DENSITY_TERRAIN_HEIGHT.getByte();
this.upperHeightMapScale = BiomeConfiguration.TUNDRA_UPPER_HEIGHT_MAP_SCALE.getFloat();
this.bottomHeightMapScale = BiomeConfiguration.TUNDRA_BOTTOM_HEIGHT_MAP_SCALE.getFloat();
}

@Override
@@ -80,7 +80,6 @@ private int getHighestSolidBlock(World world, int x, int z) {

@Override
public int[][] getSurfaceHeight(World world, int chunkX, int chunkY) {
int height = world.getHeight() - 1;
int[][] heights = new int[Chunk.BLOCKS.SIZE][Chunk.BLOCKS.SIZE];
for (int x = 0; x < Chunk.BLOCKS.SIZE; x++) {
for (int z = 0; z < Chunk.BLOCKS.SIZE; z++) {