use of com.microsoft.Malmo.Schemas.BlockType in project malmo by Microsoft.
the class MovingTargetDecoratorImplementation method isValid.
private boolean isValid(World world, BlockPos pos) {
// In bounds?
if (!blockInBounds(pos, this.arenaBounds))
return false;
// Already in path?
if (this.path.contains(pos))
return false;
// Does there need to be air above the target?
if (this.targetParams.isRequiresAirAbove() && !world.isAirBlock(pos.up()))
return false;
// Check the current block is "permeable"...
IBlockState block = world.getBlockState(pos);
List<IProperty> extraProperties = new ArrayList<IProperty>();
DrawBlock db = MinecraftTypeHelper.getDrawBlockFromBlockState(block, extraProperties);
boolean typesMatch = this.targetParams.getPermeableBlocks().getType().isEmpty();
for (BlockType bt : this.targetParams.getPermeableBlocks().getType()) {
if (db.getType() == bt) {
typesMatch = true;
break;
}
}
if (!typesMatch)
return false;
if (db.getColour() != null) {
boolean coloursMatch = this.targetParams.getPermeableBlocks().getColour().isEmpty();
for (Colour col : this.targetParams.getPermeableBlocks().getColour()) {
if (db.getColour() == col) {
coloursMatch = true;
break;
}
}
if (!coloursMatch)
return false;
}
if (db.getVariant() != null) {
boolean variantsMatch = this.targetParams.getPermeableBlocks().getVariant().isEmpty();
for (Variation var : this.targetParams.getPermeableBlocks().getVariant()) {
if (db.getVariant() == var) {
variantsMatch = true;
break;
}
}
if (!variantsMatch)
return false;
}
return true;
}
Aggregations